|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] tools/hvmloader: implement Intel IGD extended VBT support
On 14.08.2026 17:23, Chuck Zmudzinski wrote: > On 8/14/2026 9:46 AM, Jan Beulich wrote: >> On 14.08.2026 15:18, Chuck Zmudzinski wrote: >>> On 8/14/2026 3:35 AM, Jan Beulich wrote: >>>> On 14.08.2026 02:45, Chuck Zmudzinski wrote: >>>>> On 8/13/2026 6:35 AM, Jan Beulich wrote: >>>>>> On 02.08.2026 07:08, Chuck Zmudzinski wrote: >>>>>>> -- snip -- >>>>>>> To address this problem, this patch implements support for >>>>>>> Intel IGD devices with an extended VBT and OpRegion version 2 >>>>>>> and higher which is required for most modern Intel IGD devices. >>>>>> >>>>>> First of all: Where's the spec of all of this? >>>>> >>>>> Well, your first question is quite provocative. Certainly more >>>>> social/legal than technical. >>>> >>>> Well, it was very much meant to be technical. I've had a hard time >>>> following >>>> what your new code does, and having a spec to hand would likely have >>>> helped. >>> >>> I agree that having the spec at hand would be better. To be more precise, I >>> can say that what this patch essentially does is port the support for >>> the extended VBT with OpRegion 2+ for the Intel IGD passthrough that exists >>> in KVM/vfio to Xen. Should I explicitly say in the title of the commit >>> message that this is a port of KVM/vfio support for extended VBT to Xen? >> >> Not in the title, as that would likely make it too long, but perhaps in the >> description. > > Ok. > >> >>>>> So my answer is as follows: >>>>> >>>>> I do not have access to the official spec that defines "all this" but >>>>> I do have access, as does the general public, to the Linux kernel's >>>>> implementation of support for the Intel IGD from many sources such as >>>>> git.kernel.org. The Linux kernel has enough accurate information about >>>>> the spec of "all this" to provide very good support for the Intel IGD >>>>> on bare metal. >>>>> >>>>> To elaborate a bit more, the spec of "all this" can be derived from the >>>>> Linux kernel code that supports the Intel IGD. >>>> >>>> So you expect every reader to locate and decipher the underlying >>>> information >>>> from a (afaik) pretty large piece of code in the Linux kernel? If the Linux >>>> kernel sources are the reference, please can you at least provide pointers >>>> into there? >>> >>> No, I do not expect every reader to decipher the underlying information... >>> >>> That is why I provided these two links at the bottom of the commit message. >>> Perhaps you did not notice them: >>> >>> Link: https://lore.kernel.org/kvm/20211012124855.52463-1-colin.xu@xxxxxxxxx/ >>> Link: https://lore.kernel.org/kvm/20210325170953.24549-1-fred.gao@xxxxxxxxx/ >>> >>> They are the patches to the vfio kernel driver that added support for the >>> extended VBT for KVM/vfio guests. >> >> Patches can still be in flight, so provide only limited help. Would it be a >> problem to instead reference commits, or the actual localtion in Linux >> sources? > > No problem. I will format references to kernel commits the way it was done in > this commit message of commit 99794c8a8ff8 in the Xen tree that references > some Linux kernel commits unless you suggest a better way to reference Linux > kernel commits: > > xen/acpi: Import PPTT definitions from Linux > > Import the Processor Properties Topology Table (PPTT) definitions > from the Linux kernel header (include/acpi/actbl2.h) into Xen. > > Signed-off-by: Hirokazu Takahashi <taka@xxxxxxxxxxxxx> > Origin: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git > b8355bcac253 > Origin: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git > e62f8227851d > Origin: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git > 091c4af3562d I expect though that Origin: tags would be questionable to use in your case. Can't you simply use URLs pointing at the commits in Lunus'es tree? >>>>>>> + printf("VBT size: 0x%x\n", rvds); >>>>>>> + >>>>>>> + if ( !rvds || !rvda_host ) { >>>>>>> + printf("guest OpRegion address: 0x%x\n", igd_guest_opregion); >>>>>>> + rvda_host = 0; >>>>>>> + } >>>>>>> + /* >>>>>>> + * Write rvda_host as 2 successive 32-bit values >>>>>>> + * to communicate location of the VBT to the device >>>>>>> + * model. If rvda_host is not 0, The device model >>>>>>> + * unmaps the OpRegion and eventually maps the VBT >>>>>>> + * after we also write the guest address where the >>>>>>> + * VBT will be mapped. >>>>>>> + * >>>>>>> + * If we send rvda_host = 0 to the device model, it >>>>>>> + * will assume we do not need OpRegion 2 support and >>>>>>> + * it will not unmap the OpRegion. >>>>>>> + */ >>>>>>> + pci_writel(vga_devfn, PCI_INTEL_OPREGION, >>>>>>> + (uint32_t)(rvda_host & 0xfffffffful)); >>>>>>> + unsigned long rvda_host_upper_32 = (uint64_t)rvda_host >> 32; >>>>>>> + pci_writel(vga_devfn, PCI_INTEL_OPREGION, >>>>>>> + (uint32_t)rvda_host_upper_32); >>>>>> >>>>>> Why would you need to communicate a host property to the DM? >>>>> >>>>> The DM cannot access the host rvda value because it is only accessible >>>>> from the host kernel, and the DM is only a user-space process on the host. >>>> >>>> I don't follow this: Anything the guest can access should also be >>>> accessible >>>> by its DM. >>> >>> I think the host OpRegion is not currently accessible by the DM. >> >> Can you explain to me how the region becomes accessible to the guest? >> That would then (hopefully) help me understand why the DM would not have >> access. Fundamentally any MMIO and any I/O ports that are assigned to a >> guest are also assigned to its DM. > > Currently, in the device model (Qemu) we have: > > ret = xc_domain_memory_mapping(xen_xc, xen_domid, > (unsigned long)(igd_guest_opregion >> XC_PAGE_SHIFT), > (unsigned long)(igd_host_opregion >> XC_PAGE_SHIFT), > XEN_PCI_INTEL_OPREGION_PAGES, > DPCI_ADD_MAPPING); > > That statement is in the igd_write_opregion(...) function in the > hw/xen/xen_pt_graphics.c file of the upstream Qemu source. > > If I understand our current implementation correctly, this statement > is what gives the guest access to the host OpRegion (3 pages as defined > by XEN_PCI_INTEL_OPREGION_PAGES, and in agreement with IGD_OPREGION_PAGES > in hvmloader code). No, it introduces mappings of those pages into the guest's P2M. > I don't think this statement makes the host OpRegion > accessible to the device model, though, so I think, if I understand your > comment in an earlier about my patch resulting in what you called a "layering > violation" correctly, that our current implementation is also guilty of this > same kind of "layering violation." That code, if it can be successfully executed, indeed doesn't grant any permissions (to the DM or the guest). Instead it proves that the DM has the needed permissions to access the pages itself. This is what the handling of XEN_DOMCTL_memory_mapping has in this regard: ret = -EPERM; if ( !iomem_access_permitted(current->domain, mfn, mfn_end) ) /* Nothing. */; Subsequently we check that the guest is also permitted access: else if ( iomem_access_permitted(d, mfn, mfn_end) ) Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |