[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4ce3668-28e7-4974-bfe9-2f81da41d19e@amd.com>
Date: Sat, 9 Nov 2024 12:13:22 -0800
From: "Melody (Huibo) Wang" <huibo.wang@....com>
To: Neeraj Upadhyay <Neeraj.Upadhyay@....com>, <linux-kernel@...r.kernel.org>
CC: <tglx@...utronix.de>, <mingo@...hat.com>, <dave.hansen@...ux.intel.com>,
<Thomas.Lendacky@....com>, <nikunj@....com>, <Santosh.Shukla@....com>,
<Vasant.Hegde@....com>, <Suravee.Suthikulpanit@....com>, <bp@...en8.de>,
<David.Kaplan@....com>, <x86@...nel.org>, <hpa@...or.com>,
<peterz@...radead.org>, <seanjc@...gle.com>, <pbonzini@...hat.com>,
<kvm@...r.kernel.org>
Subject: Re: [sos-linux-ext-patches] [RFC 05/14] x86/apic: Initialize APIC ID
for Secure AVIC
Hi Neeraj,
On 9/13/2024 4:36 AM, Neeraj Upadhyay wrote:
> Initialize the APIC ID in the APIC backing page with the
> CPUID function 0000_000bh_EDX (Extended Topology Enumeration),
> and ensure that APIC ID msr read from hypervisor is consistent
> with the value read from CPUID.
>
> Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
> ---
> arch/x86/kernel/apic/x2apic_savic.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/x86/kernel/apic/x2apic_savic.c b/arch/x86/kernel/apic/x2apic_savic.c
> index 99151be4e173..09fbc1857bf3 100644
> --- a/arch/x86/kernel/apic/x2apic_savic.c
> +++ b/arch/x86/kernel/apic/x2apic_savic.c
> @@ -14,6 +14,7 @@
> #include <linux/sizes.h>
>
> #include <asm/apic.h>
> +#include <asm/cpuid.h>
> #include <asm/sev.h>
>
> #include "local.h"
> @@ -200,6 +201,8 @@ static void x2apic_savic_send_IPI_mask_allbutself(const struct cpumask *mask, in
>
> static void init_backing_page(void *backing_page)
> {
> + u32 hv_apic_id;
> + u32 apic_id;
> u32 val;
> int i;
>
> @@ -220,6 +223,13 @@ static void init_backing_page(void *backing_page)
>
> val = read_msr_from_hv(APIC_LDR);
> set_reg(backing_page, APIC_LDR, val);
> +
> + /* Read APIC ID from Extended Topology Enumeration CPUID */
> + apic_id = cpuid_edx(0x0000000b);
> + hv_apic_id = read_msr_from_hv(APIC_ID);
> + WARN_ONCE(hv_apic_id != apic_id, "Inconsistent APIC_ID values: %d (cpuid), %d (msr)",
> + apic_id, hv_apic_id);
> + set_reg(backing_page, APIC_ID, apic_id);
> }
>
With this warning that hv_apic_id and apic_id is different, do you still want to set_reg after that? If so, wonder why we have this warning?
Thanks,
Melody
> static void x2apic_savic_setup(void)
Powered by blists - more mailing lists