[2/2] Drivers: hv: Kconfig: Add HYPERV_VTL_MODE dependencies

Message ID 1683816877-10747-2-git-send-email-ssengar@linux.microsoft.com
State New
Headers
Series [1/2] x86/Kconfig: Allow CONFIG_X86_MPPARSE disable for OF platforms |

Commit Message

Saurabh Singh Sengar May 11, 2023, 2:54 p.m. UTC
  MTRRs are not per-VTL and are controlled by VTL0, make sure it
is disabled for all other VTLs.

X86_MPPARSE scans low memory for MP tables, which is not required
for Hyper-V VTL platforms.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
 drivers/hv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Michael Kelley (LINUX) May 20, 2023, 4:50 p.m. UTC | #1
From: Saurabh Sengar <ssengar@linux.microsoft.com>
> 
> MTRRs are not per-VTL and are controlled by VTL0, make sure it
> is disabled for all other VTLs.

Clarifying the wording a bit:

MTRRs are not per-VTL, but are always controlled by VTL0.   Allow
building for VTLs other than VTL0 only when MTRR functionality
is disabled.

> 
> X86_MPPARSE scans low memory for MP tables, which is not required
> for Hyper-V VTL platforms.

Is the above statement saying that MP tables aren't required, so remove
the code to save space?  Or is there a problem/failure if MP table code
runs and scans low memory?   *Requiring* that it be disabled, and the
reference to scanning low memory makes me think it might be the latter,
in which case I'd suggest this more forceful wording:

The MP table code scans low memory, which causes failures in VTLs
other than VTL0.   Allow building for VTLs other than VTL0 only when
MP table functionality is disabled.

If you can give slightly more detail about "causes failures" (a panic?
some other problem?) that would be good too.

Michael

> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
>  drivers/hv/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
> index 00242107d62e..c8d443886b9d 100644
> --- a/drivers/hv/Kconfig
> +++ b/drivers/hv/Kconfig
> @@ -16,6 +16,8 @@ config HYPERV
>  config HYPERV_VTL_MODE
>  	bool "Enable Linux to boot in VTL context"
>  	depends on X86_64 && HYPERV
> +	depends on !MTRR
> +	depends on !X86_MPPARSE
>  	default n
>  	help
>  	  Virtual Secure Mode (VSM) is a set of hypervisor capabilities and
> --
> 2.34.1
  
Saurabh Singh Sengar May 24, 2023, 4:09 p.m. UTC | #2
> -----Original Message-----
> From: Michael Kelley (LINUX) <mikelley@microsoft.com>
> Sent: Saturday, May 20, 2023 10:20 PM
> To: Saurabh Sengar <ssengar@linux.microsoft.com>; tglx@linutronix.de;
> mingo@redhat.com; bp@alien8.de; dave.hansen@linux.intel.com;
> x86@kernel.org; hpa@zytor.com; KY Srinivasan <kys@microsoft.com>;
> Haiyang Zhang <haiyangz@microsoft.com>; wei.liu@kernel.org; Dexuan Cui
> <decui@microsoft.com>; linux-kernel@vger.kernel.org; linux-
> hyperv@vger.kernel.org
> Cc: Saurabh Singh Sengar <ssengar@microsoft.com>
> Subject: [EXTERNAL] RE: [PATCH 2/2] Drivers: hv: Kconfig: Add
> HYPERV_VTL_MODE dependencies
> 
> From: Saurabh Sengar <ssengar@linux.microsoft.com>
> >
> > MTRRs are not per-VTL and are controlled by VTL0, make sure it is
> > disabled for all other VTLs.
> 
> Clarifying the wording a bit:
> 
> MTRRs are not per-VTL, but are always controlled by VTL0.   Allow
> building for VTLs other than VTL0 only when MTRR functionality is disabled.

Ok

> 
> >
> > X86_MPPARSE scans low memory for MP tables, which is not required for
> > Hyper-V VTL platforms.
> 
> Is the above statement saying that MP tables aren't required, so remove the
> code to save space?  Or is there a problem/failure if MP table code
> runs and scans low memory?   *Requiring* that it be disabled, and the
> reference to scanning low memory makes me think it might be the latter, in
> which case I'd suggest this more forceful wording:
> 
> The MP table code scans low memory, which causes failures in VTLs
> other than VTL0.   Allow building for VTLs other than VTL0 only when
> MP table functionality is disabled.

Ok

> 
> If you can give slightly more detail about "causes failures" (a panic?
> some other problem?) that would be good too.

When CONFIG_X86_MPPARSE is enabled, the kernel will scan low memory,
looking for MP tables. In Hyper-V VBS setup, lower memory is assigned to
VTL0. This lower memory may contain the actual MPPARSE table for VTL0,
which can confuse the VTLx kernel and cause issues. (x > 0)

> 
> Michael
> 
> >
> > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> > ---
> >  drivers/hv/Kconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index
> > 00242107d62e..c8d443886b9d 100644
> > --- a/drivers/hv/Kconfig
> > +++ b/drivers/hv/Kconfig
> > @@ -16,6 +16,8 @@ config HYPERV
> >  config HYPERV_VTL_MODE
> >  	bool "Enable Linux to boot in VTL context"
> >  	depends on X86_64 && HYPERV
> > +	depends on !MTRR
> > +	depends on !X86_MPPARSE
> >  	default n
> >  	help
> >  	  Virtual Secure Mode (VSM) is a set of hypervisor capabilities and
> > --
> > 2.34.1
  

Patch

diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
index 00242107d62e..c8d443886b9d 100644
--- a/drivers/hv/Kconfig
+++ b/drivers/hv/Kconfig
@@ -16,6 +16,8 @@  config HYPERV
 config HYPERV_VTL_MODE
 	bool "Enable Linux to boot in VTL context"
 	depends on X86_64 && HYPERV
+	depends on !MTRR
+	depends on !X86_MPPARSE
 	default n
 	help
 	  Virtual Secure Mode (VSM) is a set of hypervisor capabilities and