On 29 March 2017 at 00:45, Yao, Jiewen <jiewen....@intel.com> wrote: > Agree. That is a good idea. > > > > I will add that in V2 patch. >
Hello Jiewen, As a bit of background, what I have in mind is an enhancement of the PCI root bridge I/O allocate, map and unmap methods so that situations that would currently lead to failure or to suboptimal performance are left for the IOMMU protocol to handle if one is present. Note that this may imply having IOMMU protocol instances for each PCI root bridge, and for other masters as well. (For example, AMD Seattle has separate IOMMUs for PCI and for the networking controllers, which are wired to the internal interconnect directly) So in RootBridgeIoMap(), for instance, we have this condition PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress; if ((!RootBridge->DmaAbove4G || (Operation != EfiPciOperationBusMasterRead64 && Operation != EfiPciOperationBusMasterWrite64 && Operation != EfiPciOperationBusMasterCommonBuffer64)) && ((PhysicalAddress + *NumberOfBytes) > SIZE_4GB)) { to decide whether bounce buffering is necessary (or even possible). The mapping between DeviceAddress and HostAddress could be supplied by the IOMMU protocol instance, which also means we should reinterpret DmaAbove4G and other variables related to 32-bit addressing to apply to the device address and not the physical address. Similarly, in RootBridgeIoAllocateBuffer(), a failure to allocate below 4 GB may not be an error if the IOMMU protocol instance can provide a 32-bit addressable mapping for it. I am aware that this complicates matters for you, but having IOMMU support in the generic PCI host bridge driver is extremely useful for us. I am happy to help out in any way I can. Thanks, Ard. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel