Re: [PATCH v3 4/5] x86/hyperv: VTL support for Hyper-V

From: Saurabh Singh Sengar
Date: Tue Mar 21 2023 - 07:27:21 EST


On Mon, Mar 20, 2023 at 06:16:37PM +0000, Michael Kelley (LINUX) wrote:
> From: Saurabh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx> Sent: Monday, March 20, 2023 3:04 AM
> >
>
> [snip]
>
> > diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> > index 35b16b177035..4af218e70395 100644
> > --- a/arch/x86/include/asm/mshyperv.h
> > +++ b/arch/x86/include/asm/mshyperv.h
> > @@ -11,6 +11,10 @@
> > #include <asm/paravirt.h>
> > #include <asm/mshyperv.h>
> >
> > +#define HV_VTL_NORMAL 0x0
> > +#define HV_VTL_SECURE 0x1
> > +#define HV_VTL_MGMT 0x2
> > +
> > union hv_ghcb;
> >
> > DECLARE_STATIC_KEY_FALSE(isolation_type_snp);
> > @@ -272,6 +276,12 @@ static inline int hv_set_mem_host_visibility(unsigned long
> > addr, int numpages,
> > #endif /* CONFIG_HYPERV */
> >
> >
> > +#ifdef CONFIG_HYPERV_VTL_MODE
>
> Hmmm. CONFIG_HYPERV_VTL_MODE isn't defined until Patch 5 of this series.
> I guess this works because of #ifdef behavior with non-existent values, but
> it is a little bit weird to be referencing a CONFIG_ option that hasn't been
> defined yet.

I am fine to pull Kconfig changes before this patch.

>
> > +void __init hv_vtl_init_platform(void);
> > +#else
> > +static inline void __init hv_vtl_init_platform(void) {}
> > +#endif
> > +
> > #include <asm-generic/mshyperv.h>
> >
> > #endif
> > diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> > index 61363ce0b335..0dd385cdc332 100644
> > --- a/arch/x86/kernel/cpu/mshyperv.c
> > +++ b/arch/x86/kernel/cpu/mshyperv.c
> > @@ -520,6 +520,7 @@ static void __init ms_hyperv_init_platform(void)
> >
> > /* Register Hyper-V specific clocksource */
> > hv_init_clocksource();
> > + hv_vtl_init_platform();
> > #endif
> > /*
> > * TSC should be marked as unstable only after Hyper-V
> > --
> > 2.34.1