Re: [PATCH 2/3] KVM: x86: Add support for VMware guest specific hypercalls

Sean Christopherson
2024-12-18T03:43:56Z

On Thu, Dec 12, 2024, Doug Covelli wrote:
> On Thu, Nov 14, 2024 at 10:45 AM Doug Covelli <doug.covelli@broadcom.com> wrote:
> > > For LINT1, it should be less performance critical; if it's possible
> > > to just go through all vCPUs, and do KVM_GET_LAPIC to check who you
> > > should send a KVM_NMI to, then I'd do that. I'd also accept a patch
> > > that adds a VM-wide KVM_NMI ioctl that does the same in the hypervisor
> > > if it's useful for you.
> >
> > Thanks for the patch - I'll get it a try but it might not be right away.
> >
> > > And since I've been proven wrong already, what do you need INIT/SIPI for?
> >
> > I don't think this one is as critical. I believe the reason it was
> > added was so that we can synchronize startup of the APs with execution
> > of the BSP for guests that do not do a good job of that (Windows).
> >
> > Doug
>
> We were able to get the in-kernel APIC working with our code using the split
> IRQ chip option with our virtual EFI FW even w/o the traps for SVR and LVT0
> writes. Performance of Windows VMs is greatly improved as expected.
> Unfortunately our ancient legacy BIOS will not work with > 1 VCPU due to lack
> of support for IPIs with an archaic delivery mode of remote read which it uses
> to discover APs by attempting to read their APIC ID register. MSFT WHP supports
> this functionality via an option, WHvPartitionPropertyCodeApicRemoteReadSupport.
>
> Changing our legacy BIOS is not an option so in order to support Windows VMs
> with the legacy BIOS with decent performance we would either need to add support
> for remote reads of the APIC ID register to KVM or support CR8 accesses w/o
> exiting w/o the in-kernel APIC in order. Do you have a preference?

I didn't quite follow the CR8 access thing. If the choice is between emulating
Remote Read IPIs and using a userspace local APIC, then I vote with both hands
for emulating Remote Reads, especially if we can do a half-assed version that
provides only what your crazy BIOS needs :-)

The biggest wrinkle I can think of is that KVM uses the Remote Read IPI encoding
for a paravirt vCPU kick feature, but I doubt that's used by Windows guests and
so can be sacrificed on the Altar of Ancient BIOS.