01 Aug, 2011
1 commit
-
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
m68k/math-emu: Remove unnecessary code
m68k/math-emu: Remove commented out old code
m68k: Kill warning in setup_arch() when compiling for Sun3
m68k/atari: Prefix GPIO_{IN,OUT} with CODEC_
sparc: iounmap() and *_free_coherent() - Use lookup_resource()
m68k/atari: Reserve some ST-RAM early on for device buffer use
m68k/amiga: Chip RAM - Use lookup_resource()
resources: Add lookup_resource()
sparc: _sparc_find_resource() should check for exact matches
m68k/amiga: Chip RAM - Offset resource end by CHIP_PHYSADDR
m68k/amiga: Chip RAM - Use resource_size() to fix off-by-one error
m68k/amiga: Chip RAM - Change chipavail to an atomic_t
m68k/amiga: Chip RAM - Always allocate from the start of memory
m68k/amiga: Chip RAM - Convert from printk() to pr_*()
m68k/amiga: Chip RAM - Use tabs for indentation
31 Jul, 2011
1 commit
-
Add a function to find an existing resource by a resource start address.
This allows to implement simple allocators (with a malloc/free-alike API)
on top of the resource system.Signed-off-by: Geert Uytterhoeven
26 Jul, 2011
1 commit
-
Resource definitions that just define start, end and flags =
IORESOURCE_MEM or IORESOURCE_IRQ (with start=end) are quite common. So
introduce a shortcut for them. For completeness add macros for
IORESOURCE_DMA and IORESOURCE_IO, too and also make available a set of
macros to specify named resources of all types which are less common.Signed-off-by: Uwe Kleine-König
Cc: Arnd Bergmann
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
18 Dec, 2010
2 commits
-
This adds arch_remove_reservations(), which an arch can implement if it
needs to protect part of the address space from allocation.Sometimes that can be done by just putting a region in the resource tree,
but there are cases where that doesn't work well. For example, x86 BIOS
E820 reservations are not related to devices, so they may overlap part of,
all of, or more than a device resource, so they may not end up at the
correct spot in the resource tree.Acked-by: H. Peter Anvin
Signed-off-by: Bjorn Helgaas
Signed-off-by: Jesse Barnes -
This reverts commit e7f8567db9a7f6b3151b0b275e245c1cef0d9c70.
Acked-by: H. Peter Anvin
Signed-off-by: Bjorn Helgaas
Signed-off-by: Jesse Barnes
27 Oct, 2010
1 commit
-
Allocate space from the top of a region first, then work downward,
if an architecture desires this.When we allocate space from a resource, we look for gaps between children
of the resource. Previously, we always looked at gaps from the bottom up.
For example, given this:[mem 0xbff00000-0xf7ffffff] PCI Bus 0000:00
[mem 0xbff00000-0xbfffffff] gap -- available
[mem 0xc0000000-0xdfffffff] PCI Bus 0000:02
[mem 0xe0000000-0xf7ffffff] gap -- availablewe attempted to allocate from the [mem 0xbff00000-0xbfffffff] gap first,
then the [mem 0xe0000000-0xf7ffffff] gap.With this patch an architecture can choose to allocate from the top gap
[mem 0xe0000000-0xf7ffffff] first.We can't do this across the board because iomem_resource.end is initialized
to 0xffffffff_ffffffff on 64-bit architectures, and most machines can't
address the entire 64-bit physical address space. Therefore, we only
allocate top-down if the arch requests it by clearing
"resource_alloc_from_bottom".Signed-off-by: Bjorn Helgaas
Signed-off-by: Jesse Barnes
12 May, 2010
1 commit
-
SuperIO devices share regions and use lock/unlock operations to chip
select. We therefore need to be able to request a resource and wait for
it to be freed by whichever other SuperIO device currently hogs it.
Right now you have to poll which is horrible.Add a MUXED field to IO port resources. If the MUXED field is set on the
resource and on the request (via request_muxed_region) then we block
until the previous owner of the muxed resource releases their region.This allows us to implement proper resource sharing and locking for
superio chips using code of the formenable_my_superio_dev() {
request_muxed_region(0x44, 0x02, "superio:watchdog");
outb() ..sequence to enable chip
}disable_my_superio_dev() {
outb() .. sequence of disable chip
release_region(0x44, 0x02);
}Signed-off-by: Giel van Schijndel
Signed-off-by: Alan Cox
Signed-off-by: Jesse Barnes
24 Mar, 2010
1 commit
-
request_resource() and insert_resource() only return success or failure,
which no information about what existing resource conflicted with the
proposed new reservation. This patch adds request_resource_conflict()
and insert_resource_conflict(), which return the conflicting resource.Callers may use this for better error messages or to adjust the new
resource and retry the request.Signed-off-by: Bjorn Helgaas
Signed-off-by: Jesse Barnes
15 Mar, 2010
3 commits
-
Add support for resource windows. This is for bridge resources, i.e.,
regions where a bridge forwards transactions from the primary to the
secondary side.Signed-off-by: Bjorn Helgaas
Signed-off-by: Len Brown -
Add support for bus number resources. This is for bridges with a range of
bus numbers behind them.Signed-off-by: Bjorn Helgaas
Signed-off-by: Len Brown -
No functional change; this just makes room for another resource type.
Signed-off-by: Bjorn Helgaas
Signed-off-by: Len Brown
23 Feb, 2010
3 commits
-
Useful for freeing a portion of the resource tree, e.g. when trying to
reallocate resources more efficiently.Signed-off-by: Yinghai Lu
Acked-by: Linus Torvalds
Signed-off-by: Jesse Barnes -
Now that we return the new resource start position, there is no
need to update "struct resource" inside the align function.
Therefore, mark the struct resource as const.Cc: Bjorn Helgaas
Cc: Yinghai Lu
Signed-off-by: Dominik Brodowski
Signed-off-by: Jesse Barnes -
As suggested by Linus, align functions should return the start
of a resource, not void. An update of "res->start" is no longer
necessary.Cc: Bjorn Helgaas
Cc: Yinghai Lu
Signed-off-by: Dominik Brodowski
Signed-off-by: Jesse Barnes
16 Dec, 2009
1 commit
-
resource_size() doesn't change the resource it operates on, so the res
parameter can be marked const. Same for resource_type().Signed-off-by: Jean Delvare
Reviewed-by: WANG Cong
Cc: Greg KH
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
23 Sep, 2009
1 commit
-
Originally, walk_memory_resource() was introduced to traverse all memory
of "System RAM" for detecting memory hotplug/unplug range. For doing so,
flags of IORESOUCE_MEM|IORESOURCE_BUSY was used and this was enough for
memory hotplug.But for using other purpose, /proc/kcore, this may includes some firmware
area marked as IORESOURCE_BUSY | IORESOUCE_MEM. This patch makes the
check strict to find out busy "System RAM".Note: PPC64 keeps their own walk_memory_resouce(), which walk through
ppc64's lmb informaton. Because old kclist_add() is called per lmb, this
patch makes no difference in behavior, finally.And this patch removes CONFIG_MEMORY_HOTPLUG check from this function.
Because pfn_valid() just show "there is memmap or not* and cannot be used
for "there is physical memory or not", this function is useful in generic
to scan physical memory range.Signed-off-by: KAMEZAWA Hiroyuki
Cc: Ralf Baechle
Cc: Benjamin Herrenschmidt
Cc: WANG Cong
Cc: Américo Wang
Cc: David Rientjes
Cc: Roland Dreier
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
12 Jun, 2009
1 commit
-
We should not assign 64bit ranges to PCI devices that only take 32bit
prefetchable addresses.Try to set IORESOURCE_MEM_64 in 64bit resource of pci_device/pci_bridge
and make the bus resource only have that bit set when all devices under
it support 64bit prefetchable memory. Use that flag to allocate
resources from that range.Reported-by: Yannick
Reviewed-by: Ivan Kokshaysky
Signed-off-by: Yinghai Lu
Signed-off-by: Jesse Barnes
16 Jan, 2009
1 commit
-
Fix __request_region() parameter kernel-doc notation and parameter name:
Warning(linux-2.6.28-git10//kernel/resource.c:627): No description found for parameter 'flags'
Signed-off-by: Randy Dunlap
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
08 Jan, 2009
1 commit
-
Device drivers that use pci_request_regions() (and similar APIs) have a
reasonable expectation that they are the only ones accessing their device.
As part of the e1000e hunt, we were afraid that some userland (X or some
bootsplash stuff) was mapping the MMIO region that the driver thought it
had exclusively via /dev/mem or via various sysfs resource mappings.This patch adds the option for device drivers to cause their reserved
regions to the "banned from /dev/mem use" list, so now both kernel memory
and device-exclusive MMIO regions are banned.
NOTE: This is only active when CONFIG_STRICT_DEVMEM is set.In addition to the config option, a kernel parameter iomem=relaxed is
provided for the cases where developers want to diagnose, in the field,
drivers issues from userspace.Reviewed-by: Matthew Wilcox
Signed-off-by: Arjan van de Ven
Signed-off-by: Jesse Barnes
17 Oct, 2008
2 commits
-
* 'core-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
do_generic_file_read: s/EINTR/EIO/ if lock_page_killable() fails
softirq, warning fix: correct a format to avoid a warning
softirqs, debug: preemption check
x86, pci-hotplug, calgary / rio: fix EBDA ioremap()
IO resources, x86: ioremap sanity check to catch mapping requests exceeding, fix
IO resources, x86: ioremap sanity check to catch mapping requests exceeding the BAR sizes
softlockup: Documentation/sysctl/kernel.txt: fix softlockup_thresh description
dmi scan: warn about too early calls to dmi_check_system()
generic: redefine resource_size_t as phys_addr_t
generic: make PFN_PHYS explicitly return phys_addr_t
generic: add phys_addr_t for holding physical addresses
softirq: allocate less vectors
IO resources: fix/remove printk
printk: robustify printk, update comment
printk: robustify printk, fix #2
printk: robustify printk, fix
printk: robustify printkFixed up conflicts in:
arch/powerpc/include/asm/types.h
arch/powerpc/platforms/Kconfig.cputype
manually. -
Add resource_type() and IORESOURCE_TYPE_BITS. They make it easier to add
more resource types without having to rewrite tons of code.Signed-off-by: Magnus Damm
Cc: Ben Dooks
Cc: Jean Delvare
Cc: Paul Mundt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
15 Oct, 2008
1 commit
-
…' and 'core/misc' into core-v28-for-linus
12 Oct, 2008
1 commit
-
Conflicts:
arch/x86/kernel/cpu/common.c
arch/x86/kernel/signal_64.c
include/asm-x86/cpufeature.h
26 Sep, 2008
1 commit
-
Go through the iomem resource tree to check if any of the ioremap()
requests span more than any slot in the iomem resource tree and do
a WARN_ON() if we hit this check.This will raise a red-flag, if some driver is mapping more than what
is needed. And hopefully identify possible corruptions much earlier.Signed-off-by: Suresh Siddha
Signed-off-by: Ingo Molnar
14 Sep, 2008
1 commit
-
akpm: these have no callers at this time, but they shall soon, so let's
get them right.[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Hiroshi DOYU
Cc: Tony Lindgren
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
05 Sep, 2008
1 commit
-
add reserve_region_with_split() to not lose e820 reserved entries if
they overlap with existing IO regions:with test case by extend 0xe0000000 - 0xeffffff to 0xdd800000 -
we get:
e0000000-efffffff : PCI MMCONFIG 0
e0000000-efffffff : reservedand in /proc/iomem we get:
found conflict for reserved [dd800000, efffffff], try to reserve with split
__reserve_region_with_split: (PCI Bus #80) [dd000000, ddffffff], res: (reserved) [dd800000, efffffff]
__reserve_region_with_split: (PCI Bus #00) [de000000, dfffffff], res: (reserved) [de000000, efffffff]
initcall pci_subsys_init+0x0/0x121 returned 0 after 381 msecs
in dmesgvarious fixes and improvements suggested by Linus.
Signed-off-by: Yinghai Lu
Signed-off-by: Ingo Molnar
30 Aug, 2008
1 commit
-
Not used anywhere yet, but this complements the existing plain
'insert_resource()' functionality with a version that can expand the
resource we are adding in order to fix up any conflicts it has with
existing resources.Signed-off-by: Linus Torvalds
31 Jul, 2008
1 commit
-
Avoid one-off errors by introducing a resource_size() function.
Signed-off-by: Magnus Damm
Cc: Ben Dooks
Cc: Jean Delvare
Cc: Paul Mundt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
17 Jul, 2008
2 commits
-
This patch adds an IORESOURCE_IRQ_OPTIONAL flag for use when
assigning resources to a device. If the flag is set and we are
unable to assign an IRQ to the device, we can leave the IRQ
disabled but allow the overall resource allocation to succeed.Some devices request an IRQ, but can run without an IRQ
(possibly with degraded performance). This flag lets us run
the device without the IRQ instead of just leaving the
device disabled.This is a reimplementation of this previous change by Rene
Herman :
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3b73a223661ed137c5d3d2635f954382e94f5a43I reimplemented this for two reasons:
- to prepare for converting all resource options into a single linked
list, as opposed to the per-resource-type lists we have now, and
- to preserve the order and number of resource options.In PNPBIOS and ACPI, we configure a device by giving firmware a
list of resource assignments. It is important that this list
has exactly the same number of resources, in the same order,
as the "template" list we got from the firmware in the first
place.The problem of a sound card MPU401 being left disabled for want of
an IRQ was reported by Uwe Bugla .Signed-off-by: Bjorn Helgaas
Signed-off-by: Andi Kleen
Acked-by: Rene Herman
Signed-off-by: Len Brown -
PNP previously defined PNP_PORT_FLAG_16BITADDR and PNP_PORT_FLAG_FIXED
in a private header file, but put those flags in struct resource.flags
fields. Better to make them IORESOURCE_IO_* flags like the existing
IRQ, DMA, and MEM flags.Signed-off-by: Bjorn Helgaas
Signed-off-by: Andi Kleen
Acked-by: Rene Herman
Signed-off-by: Len Brown
12 Jun, 2008
1 commit
-
When decoding IRQ trigger mode and polarity, it is not enough to mask by
IORESOURCE_BITS because there are now additional bits defined. For
example, if IORESOURCE_IRQ_SHAREABLE was set, we failed to set *triggering
and *polarity at all.I can't point to a failure that this patch fixes, but
bugs in this area have caused problems when resuming after
suspend, for example:http://bugzilla.kernel.org/show_bug.cgi?id=6316
http://bugzilla.kernel.org/show_bug.cgi?id=9487
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/152187This is based on a patch by Tom Jaeger:
http://bugzilla.kernel.org/show_bug.cgi?id=9487#c32[rene.herman@keyaccess.nl: fix comment]
Signed-off-by: Bjorn Helgaas
Signed-off-by: Andrew Morton
Signed-off-by: Len Brown
21 Apr, 2008
1 commit
-
Done per Linus' request and suggestions. Linus has explained that
better than I'll be able to explain:On Thu, Mar 27, 2008 at 10:12:10AM -0700, Linus Torvalds wrote:
> Actually, before we go any further, there might be a less intrusive
> alternative: add just a couple of flags to the resource flags field (we
> still have something like 8 unused bits on 32-bit), and use those to
> implement a generic "resource_alignment()" routine.
>
> Two flags would do it:
>
> - IORESOURCE_SIZEALIGN: size indicates alignment (regular PCI device
> resources)
>
> - IORESOURCE_STARTALIGN: start field is alignment (PCI bus resources
> during probing)
>
> and then the case of both flags zero (or both bits set) would actually be
> "invalid", and we would also clear the IORESOURCE_STARTALIGN flag when we
> actually allocate the resource (so that we don't use the "start" field as
> alignment incorrectly when it no longer indicates alignment).
>
> That wouldn't be totally generic, but it would have the nice property of
> automatically at least add sanity checking for that whole "res->start has
> the odd meaning of 'alignment' during probing" and remove the need for a
> new field, and it would allow us to have a generic "resource_alignment()"
> routine that just gets a resource pointer.Besides, I removed IORESOURCE_BUS_HAS_VGA flag which was unused for ages.
Signed-off-by: Ivan Kokshaysky
Cc: Linus Torvalds
Cc: Gary Hade
Signed-off-by: Greg Kroah-Hartman
30 Jan, 2008
1 commit
-
This patch removes the extern struct resource declarations for
data_resource, code_resource and bss_resource on x86 and declares that
three structures as static as done on other architectures like IA64.On i386, these structures are moved to setup_32.c (from e820_32.c) because
that's code that is not specific to e820 and also required on EFI systems.
That makes the "extern" reference superfluous.On x86_64, data_resource, code_resource and bss_resource are passed to
e820_reserve_resources() as arguments just as done on i386 and IA64. That
also avoids the "extern" reference and it's possible to make it static.Signed-off-by: Bernhard Walle
Cc: "Luck, Tony"
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
Signed-off-by: Ingo Molnar
Signed-off-by: Thomas Gleixner
17 Oct, 2007
1 commit
-
A clean up patch for "scanning memory resource [start, end)" operation.
Now, find_next_system_ram() function is used in memory hotplug, but this
interface is not easy to use and codes are complicated.This patch adds walk_memory_resouce(start,len,arg,func) function.
The function 'func' is called per valid memory resouce range in [start,pfn).[pbadari@us.ibm.com: Error handling in walk_memory_resource()]
Signed-off-by: KAMEZAWA Hiroyuki
Signed-off-by: Badari Pulavarty
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
29 Apr, 2007
1 commit
-
Both old-IDE and libata should be able handle all controllers and
devices found using normal resource reservation methods.This eliminates the awful, low-performing split-driver configuration
where old-IDE drove the PATA portion of a PCI device, in PIO-only mode,
and libata drove the SATA portion of the /same/ PCI device, in DMA mode.
Typically vendors would ship SATA hard drive / PATA optical
configuration, which would lend itself to slow (PIO-only) CD-ROM
performance.For Intel users running in combined mode, it is now wholly dependent on
your driver choice (potentially link order, if you compile both drivers
in) whether old-IDE or libata will drive your hardware.In either case, you will get full performance from both SATA and PATA
ports now, without having to pass a kernel command line parameter.Signed-off-by: Jeff Garzik
10 Feb, 2007
1 commit
-
Implement device resource management, in short, devres. A device
driver can allocate arbirary size of devres data which is associated
with a release function. On driver detach, release function is
invoked on the devres data, then, devres data is freed.devreses are typed by associated release functions. Some devreses are
better represented by single instance of the type while others need
multiple instances sharing the same release function. Both usages are
supported.devreses can be grouped using devres group such that a device driver
can easily release acquired resources halfway through initialization
or selectively release resources (e.g. resources for port 1 out of 4
ports).This patch adds devres core including documentation and the following
managed interfaces.* alloc/free : devm_kzalloc(), devm_kzfree()
* IO region : devm_request_region(), devm_release_region()
* IRQ : devm_request_irq(), devm_free_irq()
* DMA : dmam_alloc_coherent(), dmam_free_coherent(),
dmam_declare_coherent_memory(), dmam_pool_create(),
dmam_pool_destroy()
* PCI : pcim_enable_device(), pcim_pin_device(), pci_is_managed()
* iomap : devm_ioport_map(), devm_ioport_unmap(), devm_ioremap(),
devm_ioremap_nocache(), devm_iounmap(), pcim_iomap_table(),
pcim_iomap(), pcim_iounmap()Signed-off-by: Tejun Heo
Signed-off-by: Jeff Garzik
21 Dec, 2006
1 commit
-
Since commit 368c73d4f689dae0807d0a2aa74c61fd2b9b075f the kernel will try
to update the non-writeable BAR registers 0..3 of PIIX4 IDE adapters if
pci_assign_unassigned_resources() is used to do full resource assignment of
the bus. This fails because in the PIIX4 these BAR registers have
implicitly assumed values and read back as zero; it used to work because
the kernel used to just write zero to that register the read back value did
match what was written.The fix is a new resource flag IORESOURCE_PCI_FIXED used to mark a resource
as non-movable. This will also be useful to keep other import system
resources from being moved around - for example system consoles on PCI
busses.[akpm@osdl.org: cleanup]
Signed-off-by: Ralf Baechle
Acked-by: Alan Cox
Signed-off-by: Andrew Morton
Signed-off-by: Greg Kroah-Hartman
02 Dec, 2006
1 commit
-
Support a shadowed ROM when running with an ACPI capable PROM.
Define a new dev.resource flag IORESOURCE_ROM_BIOS_COPY to
describe the case of a BIOS shadowed ROM, which can then
be used to avoid pci_map_rom() making an unneeded call to
pci_enable_rom().Signed-off-by: John Keller
Signed-off-by: Greg Kroah-Hartman
13 Jul, 2006
1 commit
-
Implement the scheduled unexport of insert_resource.
Signed-off-by: Adrian Bunk
Signed-off-by: Andrew Morton
Signed-off-by: Greg Kroah-Hartman
04 Jul, 2006
1 commit
-
ACPI supplies a "shareable" indication, but PNPACPI ignores it. If a PNP
device uses a shared interrupt, request_irq() fails because the PNP driver
can't tell whether to supply SA_SHIRQ.This patch allows PNP drivers to test
(pnp_irq_flags(dev, 0) & IORESOURCE_IRQ_SHAREABLE)Signed-off-by: Bjorn Helgaas
Cc: Adam Belay
Cc: Matthieu Castet
Cc: Li Shaohua
Cc: Len Brown
Cc: Russell King
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds