linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests
@ 2021-06-28 17:27 Smita Koralahalli
  2021-07-08 20:41 ` Yazen Ghannam
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Smita Koralahalli @ 2021-06-28 17:27 UTC (permalink / raw)
  To: x86, linux-edac, linux-kernel
  Cc: Robert Richter, Tony Luck, James Morse, yazen.ghannam, Smita Koralahalli

Hypervisors may not expose SMCA feature to the guest.

Check for X86_FEATURE_HYPERVISOR on entry in mce_amd_init() and return
-ENODEV if set.

Suggested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
---
 drivers/edac/mce_amd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index 5dd905a3f30c..1a1629166aa3 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -1176,6 +1176,9 @@ static int __init mce_amd_init(void)
 	    c->x86_vendor != X86_VENDOR_HYGON)
 		return -ENODEV;
 
+	if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
+		return -ENODEV;
+
 	if (boot_cpu_has(X86_FEATURE_SMCA)) {
 		xec_mask = 0x3f;
 		goto out;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests
  2021-06-28 17:27 [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests Smita Koralahalli
@ 2021-07-08 20:41 ` Yazen Ghannam
  2021-07-23 18:18 ` Kim Phillips
  2021-08-09 10:44 ` Borislav Petkov
  2 siblings, 0 replies; 4+ messages in thread
From: Yazen Ghannam @ 2021-07-08 20:41 UTC (permalink / raw)
  To: Smita Koralahalli
  Cc: x86, linux-edac, linux-kernel, Robert Richter, Tony Luck, James Morse

On Mon, Jun 28, 2021 at 12:27:40PM -0500, Smita Koralahalli wrote:
> Hypervisors may not expose SMCA feature to the guest.
> 
> Check for X86_FEATURE_HYPERVISOR on entry in mce_amd_init() and return
> -ENODEV if set.
> 
> Suggested-by: Borislav Petkov <bp@suse.de>
> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
> ---
>  drivers/edac/mce_amd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
> index 5dd905a3f30c..1a1629166aa3 100644
> --- a/drivers/edac/mce_amd.c
> +++ b/drivers/edac/mce_amd.c
> @@ -1176,6 +1176,9 @@ static int __init mce_amd_init(void)
>  	    c->x86_vendor != X86_VENDOR_HYGON)
>  		return -ENODEV;
>  
> +	if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
> +		return -ENODEV;
> +
>  	if (boot_cpu_has(X86_FEATURE_SMCA)) {
>  		xec_mask = 0x3f;
>  		goto out;
> --

Looks good to me.

Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>

Thanks,
Yazen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests
  2021-06-28 17:27 [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests Smita Koralahalli
  2021-07-08 20:41 ` Yazen Ghannam
@ 2021-07-23 18:18 ` Kim Phillips
  2021-08-09 10:44 ` Borislav Petkov
  2 siblings, 0 replies; 4+ messages in thread
From: Kim Phillips @ 2021-07-23 18:18 UTC (permalink / raw)
  To: Smita Koralahalli, x86, linux-edac, linux-kernel
  Cc: Robert Richter, Tony Luck, James Morse, yazen.ghannam

On 6/28/21 12:27 PM, Smita Koralahalli wrote:
> Hypervisors may not expose SMCA feature to the guest.
> 
> Check for X86_FEATURE_HYPERVISOR on entry in mce_amd_init() and return
> -ENODEV if set.
> 
> Suggested-by: Borislav Petkov <bp@suse.de>
> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
> ---

This gets rid of the "Huh? What family is it: 0x19?!" messages in my 
F19h hosted guest:


Tested-by: Kim Phillips <kim.phillips@amd.com>


Thanks,

Kim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests
  2021-06-28 17:27 [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests Smita Koralahalli
  2021-07-08 20:41 ` Yazen Ghannam
  2021-07-23 18:18 ` Kim Phillips
@ 2021-08-09 10:44 ` Borislav Petkov
  2 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2021-08-09 10:44 UTC (permalink / raw)
  To: Smita Koralahalli
  Cc: x86, linux-edac, linux-kernel, Robert Richter, Tony Luck,
	James Morse, yazen.ghannam

On Mon, Jun 28, 2021 at 12:27:40PM -0500, Smita Koralahalli wrote:
> Hypervisors may not expose SMCA feature to the guest.
> 
> Check for X86_FEATURE_HYPERVISOR on entry in mce_amd_init() and return
> -ENODEV if set.
> 
> Suggested-by: Borislav Petkov <bp@suse.de>
> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
> ---
>  drivers/edac/mce_amd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
> index 5dd905a3f30c..1a1629166aa3 100644
> --- a/drivers/edac/mce_amd.c
> +++ b/drivers/edac/mce_amd.c
> @@ -1176,6 +1176,9 @@ static int __init mce_amd_init(void)
>  	    c->x86_vendor != X86_VENDOR_HYGON)
>  		return -ENODEV;
>  
> +	if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
> +		return -ENODEV;
> +
>  	if (boot_cpu_has(X86_FEATURE_SMCA)) {
>  		xec_mask = 0x3f;
>  		goto out;
> -- 
> 2.17.1

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-09 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 17:27 [PATCH] EDAC/mce_amd: Do not load edac_mce_amd module on guests Smita Koralahalli
2021-07-08 20:41 ` Yazen Ghannam
2021-07-23 18:18 ` Kim Phillips
2021-08-09 10:44 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).