Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46617 )
Change subject: device/pci_device: Map big PCI bars above 4 GiB ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46617/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46617/1//COMMIT_MSG@10 PS1, Line 10: FIXME: This should probably go into the resource allocator. I don't think the resource allocator is the right place to implement this policy. I agree in this case it is straightforward since the device needs > 4GiB of MMIO space. There is no way it can be done below the 4G boundary. However, there can be cases where a device needs say 2GiB of MMIO space. It might be possible to allocate that below 4G boundary or not depending upon what other devices are present on the board and also which device/resource needs to be accessible within coreboot and which device/resource is used only by the OS.
It might be better to have a PCI driver specifically for the device which sets the flag to request allocation above 4G boundary. This allows the mainboard to decide: 1. What devices are used in coreboot? 2. Does the mainboard have combination of devices which is going to require large MMIO allocation and which resource to allocate above the 4G boundary?
In this case(> 4GiB request), I think it's okay to let the common pci_device driver set the flag indicating that the resource request needs to be satisfied by allocation above 4G boundary since it knows that the request is for >= 4GiB of space.
https://review.coreboot.org/c/coreboot/+/46617/1/src/device/pci_device.c File src/device/pci_device.c:
https://review.coreboot.org/c/coreboot/+/46617/1/src/device/pci_device.c@182 PS1, Line 182: 0x100000000ULL
Do we have a function call to know how much unallocated space we have below 4G? I guess bars < 4G th […]
It is possible to get a complete picture of the available space only after read_resources is done. Also, it depends upon how the resource allocator walks and satisfies each resource request. There might also be cases where certain resources are okay to be allocated above 4G boundary but not others (e.g. resources being accessed/used in coreboot).