[Qemu-devel] RFC: Proposed vfio IGD assignment fw_cfg ABI
Hey folks, I'm planning to add a couple fw_cfg files for vfio IGD (Intel Graphics Device) assignment, but since this does represent a QEMU-BIOS ABI and since most of the vfio code is committed with only my own sign-off and review, I'd like to pull this out for discussion separate from the patches themselves. #1: "etc/igd-opregion" the IGD OpRegion is an area of memory which contains among other things, the Video BIOS Table which is integral in allowing an assigned IGD to configure and make use of the physical display outputs of the system. "etc/igd-opregion" is an opaque fw_cfg file which the BIOS will use to allocate an appropriately sized reserved memory region, copy the contents of the fw_cfg file into the allocated memory region, and write the base address of the allocated memory region to the dword registers at 0xFC in PCI config space on the IGD device itself. The BIOS will look for this fw_cfg file any time a PCI class VGA device is found with Intel vendor ID. Multiple IGD devices per VM, such as might potentially be possible with Intel vGPU, is not within the scope of this proposal. The expected size of this fw_cfg file is on the order of a few pages, 8KB is typical. #2: "etc/igd-bdsm" The BDSM is the register on IGD storing the base address of stolen memory (Base Data of Stolen Memory). This is simply an area of reserved RAM which the IGD uses for both GTT and stolen video memory. The semantics are much the same as for "etc/igd-opregion" with the exception that the fw_cfg file is only used to request a reserved memory allocation for this purpose and to indicate the size of the reserved memory. There is no content to this fw_cfg file and it should not be read or written. As above, the BIOS should look for this file upon discovering a PCI class VGA device with Intel vendor ID, allocate the necessary size and write the address to the IGD device. The BDSM register is a dword register located at 0x5C in PCI config space of the IGD device. This proposal does not intend to address the vague possibility of multiple BDSM per VM. The expected size of this fw_cfg file is from 1MB to multiple hundreds of MB with user specified stolen video memory. 8MB would be the typical maximum as QEMU currently does not allocate stolen video memory itself. I'd appreciate any comments on these entries and I'd be happy to describe them further. Perhaps we should create a docs/api/ directory with these sorts of descriptions where we define how a given API is intended to work. Thanks, Alex
Re: [Qemu-devel] RFC: Proposed vfio IGD assignment fw_cfg ABI
> #1: "etc/igd-opregion" > > the IGD OpRegion is an area of memory which contains among other > things, the Video BIOS Table which is integral in allowing an assigned > IGD to configure and make use of the physical display outputs of the > system. "etc/igd-opregion" is an opaque fw_cfg file which the BIOS > will use to allocate an appropriately sized reserved memory region, > copy the contents of the fw_cfg file into the allocated memory region, > and write the base address of the allocated memory region to the dword > registers at 0xFC in PCI config space on the IGD device itself. The > BIOS will look for this fw_cfg file any time a PCI class VGA device is > found with Intel vendor ID. Multiple IGD devices per VM, such as might > potentially be possible with Intel vGPU, is not within the scope of > this proposal. The expected size of this fw_cfg file is on the order > of a few pages, 8KB is typical. Looks good to me. > #2: "etc/igd-bdsm" > possibility of multiple BDSM per VM. The expected size of this fw_cfg > file is from 1MB to multiple hundreds of MB with user specified stolen > video memory. Having a big fw_cfg file without using the content looks a bit odd to me. I'd suggest to create a fw_cfg file with the size in it instead. Usual way to do this is to stick a 64bit value in little endian byte order into fw_cfg, then use romfile_loadint() in seabios to read it. > I'd appreciate any comments on these entries and I'd be happy to > describe them further. Perhaps we should create a docs/api/ > directory with these sorts of descriptions where we define how a > given API is intended to work. There is docs/specs/ already where this would fit, and it even has a fw_cfg.txt file. It might make sense to have a separate igd-assign.txt though. cheers, Gerd
Re: [Qemu-devel] RFC: Proposed vfio IGD assignment fw_cfg ABI
On Fri, 13 May 2016 10:21:00 +0200 Gerd Hoffmann wrote: > > #1: "etc/igd-opregion" > > > > the IGD OpRegion is an area of memory which contains among other > > things, the Video BIOS Table which is integral in allowing an assigned > > IGD to configure and make use of the physical display outputs of the > > system. "etc/igd-opregion" is an opaque fw_cfg file which the BIOS > > will use to allocate an appropriately sized reserved memory region, > > copy the contents of the fw_cfg file into the allocated memory region, > > and write the base address of the allocated memory region to the dword > > registers at 0xFC in PCI config space on the IGD device itself. The > > BIOS will look for this fw_cfg file any time a PCI class VGA device is > > found with Intel vendor ID. Multiple IGD devices per VM, such as might > > potentially be possible with Intel vGPU, is not within the scope of > > this proposal. The expected size of this fw_cfg file is on the order > > of a few pages, 8KB is typical. > > Looks good to me. > > > #2: "etc/igd-bdsm" > > > possibility of multiple BDSM per VM. The expected size of this fw_cfg > > file is from 1MB to multiple hundreds of MB with user specified stolen > > video memory. > > Having a big fw_cfg file without using the content looks a bit odd to > me. I'd suggest to create a fw_cfg file with the size in it instead. > Usual way to do this is to stick a 64bit value in little endian byte > order into fw_cfg, then use romfile_loadint() in seabios to read it. I think following this approach I'd rename the fw_cfg file to "etc/igd-bdsm-size", otherwise looks reasonable, I'll make the change. > > I'd appreciate any comments on these entries and I'd be happy to > > describe them further. Perhaps we should create a docs/api/ > > directory with these sorts of descriptions where we define how a > > given API is intended to work. > > There is docs/specs/ already where this would fit, and it even has a > fw_cfg.txt file. It might make sense to have a separate igd-assign.txt > though. Yeah, even beyond these fw_cfg options there's probably enough oddity with IGD assignment to have it's own docs file. I'll cook something up for the next posting. Thanks for the review and comments. Alex