[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALMp9eQGdwun8NSgJC07VpN_TRMWZ=hsMLO1F7hojh5vz4bquQ@mail.gmail.com>
Date: Mon, 16 Sep 2024 13:21:50 -0700
From: Jim Mattson <jmattson@...gle.com>
To: "Nikunj A. Dadhania" <nikunj@....com>
Cc: linux-kernel@...r.kernel.org, thomas.lendacky@....com, bp@...en8.de,
x86@...nel.org, kvm@...r.kernel.org, mingo@...hat.com, tglx@...utronix.de,
dave.hansen@...ux.intel.com, pgonda@...gle.com, seanjc@...gle.com,
pbonzini@...hat.com
Subject: Re: [PATCH v11 20/20] x86/cpu/amd: Do not print FW_BUG for Secure TSC
On Mon, Sep 16, 2024 at 4:41 AM Nikunj A. Dadhania <nikunj@....com> wrote:
>
>
>
> On 9/13/2024 11:12 PM, Jim Mattson wrote:
> > On Wed, Jul 31, 2024 at 8:16 AM Nikunj A Dadhania <nikunj@....com> wrote:
> >>
> >> When Secure TSC is enabled and TscInvariant (bit 8) in CPUID_8000_0007_edx
> >> is set, the kernel complains with the below firmware bug:
> >>
> >> [Firmware Bug]: TSC doesn't count with P0 frequency!
> >>
> >> Secure TSC does not need to run at P0 frequency; the TSC frequency is set
> >> by the VMM as part of the SNP_LAUNCH_START command. Skip this check when
> >> Secure TSC is enabled
> >>
> >> Signed-off-by: Nikunj A Dadhania <nikunj@....com>
> >> Tested-by: Peter Gonda <pgonda@...gle.com>
> >> ---
> >> arch/x86/kernel/cpu/amd.c | 3 ++-
> >> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> >> index be5889bded49..87b55d2183a0 100644
> >> --- a/arch/x86/kernel/cpu/amd.c
> >> +++ b/arch/x86/kernel/cpu/amd.c
> >> @@ -370,7 +370,8 @@ static void bsp_determine_snp(struct cpuinfo_x86 *c)
> >>
> >> static void bsp_init_amd(struct cpuinfo_x86 *c)
> >> {
> >> - if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
> >> + if (cpu_has(c, X86_FEATURE_CONSTANT_TSC) &&
> >> + !cc_platform_has(CC_ATTR_GUEST_SECURE_TSC)) {
> >
> > Could we extend this to never complain in a virtual machine? i.e.
>
> Let me get more clarity on the below and your commit[1]
>
> > ...
> > - if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
> > + if (cpu_has(c, X86_FEATURE_CONSTANT_TSC) &&
> > + !cpu_has(c, X86_FEATURE_HYPERVISOR)) {
> > ...
>
> Or do this for Family 15h and above ?
I don't think there exists a virtual firmware that sets this bit on
older CPU families. In fact, before my referenced commit, it wasn't
possible.
> Regards
> Nikunj
>
> 1. https://github.com/torvalds/linux/commit/8b0e00fba934
Something like this is necessary for existing versions of Linux. I
would like to have set HW_CR.TscFreqSel[bit 24] at VCPU creation, but
Sean would not let me. So, now userspace has to do it right after VCPU
creation. I don't have any intention of adding the code to qemu, but
maybe someone will.
Powered by blists - more mailing lists