[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUoDJxfNZgNjY8zh@google.com>
Date: Tue, 21 Sep 2021 16:07:03 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Ashish Kalra <ashish.kalra@....com>,
Steve Rutherford <srutherford@...gle.com>, pbonzini@...hat.com,
tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
joro@...tes.org, thomas.lendacky@....com, x86@...nel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
brijesh.singh@....com, dovmurik@...ux.ibm.com, tobin@...ux.ibm.com,
jejb@...ux.ibm.com, dgilbert@...hat.com
Subject: Re: [PATCH v6 1/5] x86/kvm: Add AMD SEV specific Hypercall3
On Tue, Sep 21, 2021, Borislav Petkov wrote:
> On Tue, Sep 21, 2021 at 01:50:09PM +0000, Sean Christopherson wrote:
> > apply_alternatives() is a generic helper that can work on any struct alt_instr
> > array, e.g. KVM_HYPERCALL can put its alternative into a different section that's
> > patched as soon as the VMM is identified.
>
> Where exactly in the boot process you wanna move it?
init_hypervisor_platform(), after x86_init.hyper.init_platform() so that the
PV support can set the desired feature flags. Since kvm_hypercall*() is only
used by KVM guests, set_cpu_cap(c, X86_FEATURE_VMMCALL) can be moved out of
early_init_amd/hygon() and into kvm_init_platform().
> As Ashish says, you need the boot_cpu_data bits properly set before it
> runs.
Another option would be to refactor apply_alternatives() to allow the caller to
provide a different feature check mechanism than boot_cpu_has(), which I think
would let us drop X86_FEATURE_VMMCALL, X86_FEATURE_VMCALL, and X86_FEATURE_VMW_VMMCALL
from cpufeatures. That might get more than a bit gross though.
But like I said, if others think I'm over-engineering this...
Powered by blists - more mailing lists