RE: [PATCH v3] hyperv: root partition faults writing to VP ASSIST MSR PAGE

From: Sunil Muthuswamy
Date: Tue Jul 27 2021 - 12:51:27 EST


> >
> > - if (*hvp) {
> > - u64 val;
> > + WARN_ON(!(*hvp));
> >
> > - val = vmalloc_to_pfn(*hvp);
> > - val = (val << HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT) |
> > - HV_X64_MSR_VP_ASSIST_PAGE_ENABLE;
> > + if (*hvp) {
> > + if (!hv_root_partition)
> > + msr.guest_physical_address = vmalloc_to_pfn(*hvp);
> >
> > - wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE, val);
> > + msr.enable = 1;
> > + wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE, msr.as_uint64);
>
> This version has a substantive difference compared with previous versions
> in that the "enable" bit is being set and written back to the MSR even when
> running in the root partition. Is that intentional?

Yes, the hypervisor won't allow the root to change the page address. So, to
enable/disable it, the page address needs to be preserved and just the enable
bit needs to be toggled.

- Sunil