|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH] tools/libs/light/libxl_pci.c: explicitly grant access to Intel IGD opregion
On 3/30/22 1:15 PM, Anthony PERARD wrote: Hi Chuck, On Sun, Mar 13, 2022 at 11:41:37PM -0400, Chuck Zmudzinski wrote:When gfx_passthru is enabled for the Intel IGD, hvmloader maps the IGD opregion to the guest but libxl does not grant the guest permission to
Hi Anthony,
Let me try to answer your question again. My tests indicate
that this code in hvmloader is actually run in my case. As I
mentioned in an earlier message, the allocation of the three
pages for the opregion is not done for the guest if I remove
this code from hvmloader. The only concern I had was about
the difference in what I was reading for the opregion address
in sysfs (fcffc018 in my case) and the address that hvmloader
wrote (fcffc000 in my case). The change is easily explained by
what the Qemu device model (both upstream and traditional)
does when the device model writes the opregion address into
the Intel IGD config attribute:
This is the traditional Qemu code in hw/pt_graphics.c:66
void igd_write_opregion(struct pt_dev *real_dev, uint32_t val)
{
uint32_t host_opregion = 0;
int ret;
if ( igd_guest_opregion )
{
PT_LOG("opregion register already been set, ignoring %x\n", val);
return;
}
host_opregion = pt_pci_host_read(real_dev->pci_dev,
PCI_INTEL_OPREGION, 4);
igd_guest_opregion = (val & ~0xfff) | (host_opregion & 0xfff);------------------------ End of code snippet ----------------------------------- The offset of the opregion in the guest (0x18 in my case) is recovered by that last statement. The upstream model does the same thing using the constant XEN_PCI_INTEL_OPREGION_MASK set to 0xfff to recover the offset. So what we have in hvmloader is correct and necessary.
No, hvmloader wrote the mapped address and here we are reading the opregion address of the host, not the mapped address of the guest. There is no problem here. It this call to xc_domain_iomem_permission() does actually anything useful? Or is it by luck that the address returned by sysfs_dev_get_igd_opregion() happened to be the address that hvmloader is going to write? No, it is not luck, we use the same constant in hvmloader, Qemu, and here in this patch to properly map the opregion to the guest, and the constant is PCI_INTEL_OPREGION, set to 0xfc, the offset of where in the config attribute the opregion address is stored. Or maybe hvmloader doesn't actually do anything? It does do something, and what it does is necessary. Regards, Chuck
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |