5226301765
We currently have two competing mechanisms to limit the placement of resources: 1. the explicit `.limit` field of a resource, and 2. the IORESOURCE_ABOVE_4G flag. This makes the resource allocator unnecessarily complex. Ideally, we would always reduce the `.limit` field if we want to "pin" a specific resource below 4G. However, as that's not done across the tree yet, we will use the _absence_ of the IORESOURCE_ABOVE_4G flag as a hint to implicitly lower the `limit` of a resource. In this patch, this is done inside the effective_limit() function that hides the flag from the rest of the allocator. To automatically place resources above 4G if their limit allows it, we have to allocate from top down. Hence, we disable the prompt for RESOURCE_ALLOCATION_TOP_DOWN and turn it on by default. Platforms that are incompatible should be fixed, but can also override the default as a temporary measure. One implication of the changes is that we act differently when a cold-plugged device reports a prefetchable resource with 32-bit limit. Before this change, we would fail to allocate the resource. After this change, it forces everything on the same root port below the 4G line. A possible solution to get completely rid of the IORESOURCE_ABOVE_4G flag would be rules to place resources of certain devices below 4G. For instance, the primary VGA device and storage and HID devices could be made available to a payload that can only address 32 bits. For now, effective_limit() provides us enough abstraction as if the `limit` would be the only variable to consider. With this, we get rid of all the special handling of above 4G resources during phase 2 of the allocator. Which saves us about 20% of the code :D An earlier version of this change (commit |
||
---|---|---|
.. | ||
dram | ||
oprom | ||
azalia_device.c | ||
cardbus_device.c | ||
cpu_device.c | ||
device.c | ||
device_const.c | ||
device_util.c | ||
gpio.c | ||
i2c.c | ||
i2c_bus.c | ||
Kconfig | ||
Makefile.inc | ||
mdio.c | ||
mmio.c | ||
pci_class.c | ||
pci_device.c | ||
pci_early.c | ||
pci_ops.c | ||
pci_rom.c | ||
pciexp_device.c | ||
pcix_device.c | ||
pnp_device.c | ||
resource_allocator_common.c | ||
resource_allocator_v4.c | ||
root_device.c | ||
smbus_ops.c | ||
software_i2c.c | ||
xhci.c | ||
xhci_resource.c |