Re: [PATCH v2 6/6] selftests: KVM: Add test case for MMIO during vectoring

Ivan Orlov
2024-12-12T17:11:16Z

On Wed, Dec 11, 2024 at 10:19:40AM -0800, Sean Christopherson wrote:
> > +static void guest_code_mmio_during_vectoring(void)
> > +{
> > + const struct desc_ptr idt_desc = {
> > + .address = MEM_REGION_GPA,
> > + .size = 0xFFF,
> > + };
> > +
> > + set_idt(&idt_desc);
> > +
> > + /* Generate a #GP by dereferencing a non-canonical address */
> > + *((uint8_t *)NONCANONICAL) = 0x1;
>
> Now I'm curious what happens if this uses vcpu_arch_put_guest(), i.e. if the
> test forces KVM to emulate the write.
>
> No action needed, the test is a-ok as-is. I'm really just curious :-)

:) Just tried enabling `force_emulation_prefix` kvm parameter and replacing the
write with

vcpu_arch_put_guest(*((uint8_t *)NONCANONICAL), 0x1);

And the test simply passes (so it returns the same internal error with
suberror=3, patches applied)

--
Kind regards,
Ivan Orlov