All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Chuck Zmudzinski <brchuckz@aol.com>,
	Anthony PERARD <anthony.perard@vates.tech>
Cc: qemu-devel@nongnu.org,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger@xenproject.org>,
	"Teddy Astie" <teddy.astie@vates.tech>,
	"Tomita Moeko" <tomitamoeko@gmail.com>,
	xen-devel@lists.xenproject.org,
	"Chuck Zmudzinski" <brchuckz@netscape.net>
Subject: Re: [PATCH v2] tools/hvmloader: implement Intel IGD extended VBT support
Date: Fri, 14 Aug 2026 15:46:07 +0200	[thread overview]
Message-ID: <02a7dc18-4184-4e86-84cb-121769187f71@suse.com> (raw)
In-Reply-To: <de56c8bd-f0e8-4fe9-8cf5-f6807698176c@aol.com>

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.

>>> 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@gmail.com/
> Link: https://lore.kernel.org/kvm/20210325170953.24549-1-fred.gao@intel.com/
> 
> 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?

>>>>> +    pci_writel(vga_devfn, PCI_INTEL_OPREGION,
>>>>> +               (igd_opregion_pgbase << PAGE_SHIFT) |
>>>>> +                IGD_OPREGION2_SUPPORT_MASK);
>>>>
>>>> This looks to imply qemu is the only possible device model.
>>>
>>> Yeah, this is an issue. Other device models that intend to support
>>> the Intel IGD with hvmloader will also have to be compatible with this.
>>> It would be easier if we did not have to worry about backward
>>> compatibility and supporting what we had in the codebase for many years
>>> in both hvmloader and Qemu and we would not need IGD_OPREGION2_SUPPORT_MASK
>>> in that case. Instead, we would just completely deprecate all previous
>>> implementations of the Intel IGD passthrough feature in both hvmloader and
>>> the Qemu DM as unsupported. So my previous comments about backward
>>> compatibility apply here again.
>>
>> As said, I don't think backward compatibility can be dropped. My comment
>> also didn't really mean to hint in that direction. Instead I was wondering
>> in how far, even if perhaps by only a few #define-s, the necessary
>> interfacing couldn't be put down in a public header, for any DM to consume.
> 
> Ok. Perhaps the IGD_* defines could be moved to a public header to define the
> interface to be used to support the Intel IGD. Would it be OK to move those
> to a separate igd.h header

This may require input by others, as in the given situation I'm not quite
sure what is best. Anthony - do you possibly have any suggestion here?

> and include it in hvmloader/config.h?

I don't see why that would be needed. The few files which need the #define-s
can include that new public header, without impacting anything else.

>>>>> +    printf("guest OpRegion tentative "
>>>>> +           "address: 0x%x\n", igd_guest_opregion);
>>>>> +
>>>>> +    if ( !verify_opregion(igd_guest_opregion) ) {
>>>>> +        printf("error: IGD OpRegion signature "
>>>>> +               "not found.\n");
>>>>
>>>> No full stop in messages please.
>>>
>>> Would it be OK to just get rid of the error message here?
>>
>> That would then leave ...
>>
>>>>> +        BUG();
>>
>> ... an un-annotated BUG(), which generally isn't very nice.
> 
> I don't think I understand what you mean by "No full stop in messages..."

That's the period at the end of a sentence (when in log messages the term
"sentence" is of questionable nature).

> We have code like this in hvmloader/e820.c:
> 
>     if ( rc || !nr_entries )
>     {
>         printf("Get guest memory maps[%d] failed. (%d)\n", nr_entries, rc);
>         BUG();
>     }

Well, you'll almost always be able to find bad pre-existing examples.

>>>>> +    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.

> On the KVM
> platform, this is made possible via the kernel vfio driver and then Qemu exposes
> the OpRegion to the guest using the Qemu FwCfg device interface. How should we make
> the OpRegion and VBT accessible to the device model and then, to the guest, on Xen?
> I think it could be done via the xen-pciback kernel driver. Should we do that
> instead? I think to do that we would have to convince the kernel developers that
> the Intel OpRegion, as you say, "should" be accessible by the Xen device model.
> I can imagine them saying, why not use the vfio driver?

I can't answer this; all I can say is that it feels wrong to involve e.g.
xen-pciback here.

Jan


  reply	other threads:[~2026-08-14 13:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260802050824.10554-1-brchuckz.ref@aol.com>
2026-08-02  5:08 ` [PATCH v2] tools/hvmloader: implement Intel IGD extended VBT support Chuck Zmudzinski
2026-08-13 10:35   ` Jan Beulich
2026-08-14  0:45     ` Chuck Zmudzinski
2026-08-14  7:35       ` Jan Beulich
2026-08-14 13:18         ` Chuck Zmudzinski
2026-08-14 13:46           ` Jan Beulich [this message]
2026-08-14 15:23             ` Chuck Zmudzinski
2026-08-14 16:18               ` Chuck Zmudzinski
2026-08-14 19:13                 ` Chuck Zmudzinski
2026-08-14 17:07               ` Chuck Zmudzinski
2026-08-17  8:42               ` Jan Beulich
2026-08-17 16:04                 ` Chuck Zmudzinski
2026-08-17 17:04                   ` Chuck Zmudzinski
2026-08-18  7:17                   ` Jan Beulich
2026-08-18 11:52                     ` Chuck Zmudzinski
2026-08-18 12:18                       ` Jan Beulich
2026-08-18 12:29                         ` Chuck Zmudzinski
2026-08-18 17:15                           ` Chuck Zmudzinski
2026-08-19  7:30                             ` Jan Beulich
2026-08-19 12:16                               ` Chuck Zmudzinski
2026-08-19 12:36                                 ` Chuck Zmudzinski
2026-08-19 13:51                                   ` Jan Beulich
2026-08-19 15:47                                     ` Chuck Zmudzinski
2026-08-19 17:49                                       ` Chuck Zmudzinski
2026-08-19 19:09                                         ` Chuck Zmudzinski
2026-08-20  7:58                                           ` Jan Beulich
2026-08-20 13:03                                             ` Chuck Zmudzinski
2026-08-20 14:58                                               ` Chuck Zmudzinski
2026-08-20  7:53                                         ` Jan Beulich
2026-08-20 13:03                                           ` Chuck Zmudzinski
2026-08-19 17:13                                     ` Chuck Zmudzinski
2026-08-20  7:51                                       ` Jan Beulich
2026-08-20 11:47                                         ` Chuck Zmudzinski
2026-08-20 15:17                                           ` Jan Beulich
2026-08-20 16:53                                             ` Chuck Zmudzinski
2026-08-21  8:19                                               ` Jan Beulich
2026-08-21 13:12                                                 ` Chuck Zmudzinski
2026-08-19 12:10                             ` Chuck Zmudzinski
2026-08-15  2:22             ` Chuck Zmudzinski
2026-08-17  9:11               ` Jan Beulich
2026-08-16 16:38         ` Chuck Zmudzinski
2026-08-17  9:18           ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02a7dc18-4184-4e86-84cb-121769187f71@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=brchuckz@aol.com \
    --cc=brchuckz@netscape.net \
    --cc=qemu-devel@nongnu.org \
    --cc=roger@xenproject.org \
    --cc=teddy.astie@vates.tech \
    --cc=tomitamoeko@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.