All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons
@ 2019-05-16 14:38 Bernhard M. Wiedemann
  0 siblings, 0 replies; 5+ messages in thread
From: Bernhard M. Wiedemann @ 2019-05-16 14:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Bernhard M. Wiedemann

Without this patch, a VM on a Opteron G3 host will have the svm flag, but
the kvm-amd module fails to load in there, complaining that it needs
cpuid 0x8000000a

I have successfully built and tested this for 3+ years in production
on Opteron G3 servers.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
---
 target/i386/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 722c5514d4..df1d81ded8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2723,7 +2723,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT_SSE3,
         .features[FEAT_8000_0001_EDX] =
             CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
-        .xlevel = 0x80000008,
+        .xlevel = 0x8000000A,
         .model_id = "AMD Opteron 240 (Gen 1 Class Opteron)",
     },
     {
@@ -2745,7 +2745,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
         .features[FEAT_8000_0001_ECX] =
             CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-        .xlevel = 0x80000008,
+        .xlevel = 0x8000000A,
         .model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)",
     },
     {
@@ -2770,7 +2770,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .features[FEAT_8000_0001_ECX] =
             CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A |
             CPUID_EXT3_ABM | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-        .xlevel = 0x80000008,
+        .xlevel = 0x8000000A,
         .model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)",
     },
     {
-- 
2.16.4



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

* Re: [Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons
  2019-05-23 21:27   ` Eduardo Habkost
@ 2019-05-27  7:49     ` Bernhard M. Wiedemann
  0 siblings, 0 replies; 5+ messages in thread
From: Bernhard M. Wiedemann @ 2019-05-27  7:49 UTC (permalink / raw)
  To: Eduardo Habkost, Dr. David Alan Gilbert; +Cc: bsd, qemu-devel

On 23/05/2019 23.27, Eduardo Habkost wrote:
> On Thu, May 23, 2019 at 07:57:38PM +0100, Dr. David Alan Gilbert wrote:
>> * Bernhard M. Wiedemann (bwiedemann@suse.de) wrote:
>>> Without this patch, a VM on a Opteron G3 host will have the svm flag, but
>>> the kvm-amd module fails to load in there, complaining that it needs
>>> cpuid 0x8000000a
>>>
>>> I have successfully built and tested this for 3+ years in production
>>> on Opteron G3 servers.
> 
> Have you reproduced the bug on QEMU 2.8 or newer?  The problem
> you describe should be fixed by the following commit (from ~2.5
> years ago).
> 
> commit 0c3d7c0051576d220e6da0a8ac08f2d8482e2f0b
>     target-i386: Enable CPUID[0x8000000A] if SVM is enabled

I was still on qemu-2.6.2 so it is good to know that this might work out
of the box with 2.8+

Thanks for the pointer.


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

* Re: [Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons
  2019-05-23 18:57 ` Dr. David Alan Gilbert
@ 2019-05-23 21:27   ` Eduardo Habkost
  2019-05-27  7:49     ` Bernhard M. Wiedemann
  0 siblings, 1 reply; 5+ messages in thread
From: Eduardo Habkost @ 2019-05-23 21:27 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: Bernhard M. Wiedemann, bsd, qemu-devel

On Thu, May 23, 2019 at 07:57:38PM +0100, Dr. David Alan Gilbert wrote:
> * Bernhard M. Wiedemann (bwiedemann@suse.de) wrote:
> > Without this patch, a VM on a Opteron G3 host will have the svm flag, but
> > the kvm-amd module fails to load in there, complaining that it needs
> > cpuid 0x8000000a
> > 
> > I have successfully built and tested this for 3+ years in production
> > on Opteron G3 servers.

Have you reproduced the bug on QEMU 2.8 or newer?  The problem
you describe should be fixed by the following commit (from ~2.5
years ago).

commit 0c3d7c0051576d220e6da0a8ac08f2d8482e2f0b
Author: Eduardo Habkost <ehabkost@redhat.com>
Date:   Wed Sep 21 15:01:35 2016 -0300

    target-i386: Enable CPUID[0x8000000A] if SVM is enabled

    SVM needs CPUID[0x8000000A] to be available. So if SVM is enabled
    in a CPU model or explicitly in the command-line, adjust CPUID
    xlevel to expose the CPUID[0x8000000A] leaf.

    Reviewed-by: Richard Henderson <rth@twiddle.net>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo


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

* Re: [Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons
  2019-05-16 12:58 Bernhard M. Wiedemann
@ 2019-05-23 18:57 ` Dr. David Alan Gilbert
  2019-05-23 21:27   ` Eduardo Habkost
  0 siblings, 1 reply; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2019-05-23 18:57 UTC (permalink / raw)
  To: Bernhard M. Wiedemann, ehabkost, bsd; +Cc: qemu-devel

* Bernhard M. Wiedemann (bwiedemann@suse.de) wrote:
> Without this patch, a VM on a Opteron G3 host will have the svm flag, but
> the kvm-amd module fails to load in there, complaining that it needs
> cpuid 0x8000000a
> 
> I have successfully built and tested this for 3+ years in production
> on Opteron G3 servers.
> 
> Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
> ---
>  target/i386/cpu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 722c5514d4..df1d81ded8 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -2723,7 +2723,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
>              CPUID_EXT_SSE3,
>          .features[FEAT_8000_0001_EDX] =
>              CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
> -        .xlevel = 0x80000008,
> +        .xlevel = 0x8000000A,
>          .model_id = "AMD Opteron 240 (Gen 1 Class Opteron)",
>      },
>      {
> @@ -2745,7 +2745,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
>              CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
>          .features[FEAT_8000_0001_ECX] =
>              CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
> -        .xlevel = 0x80000008,
> +        .xlevel = 0x8000000A,
>          .model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)",
>      },
>      {
> @@ -2770,7 +2770,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
>          .features[FEAT_8000_0001_ECX] =
>              CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A |
>              CPUID_EXT3_ABM | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
> -        .xlevel = 0x80000008,
> +        .xlevel = 0x8000000A,
>          .model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)",
>      },
>      {

cc'ing in Bandan and Eduardo,

I suspect these need to have compatibility entries on the machine types
so that old machine types don't notice the improvement.

Dave

> -- 
> 2.16.4
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


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

* [Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons
@ 2019-05-16 12:58 Bernhard M. Wiedemann
  2019-05-23 18:57 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: Bernhard M. Wiedemann @ 2019-05-16 12:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: Bernhard M. Wiedemann

Without this patch, a VM on a Opteron G3 host will have the svm flag, but
the kvm-amd module fails to load in there, complaining that it needs
cpuid 0x8000000a

I have successfully built and tested this for 3+ years in production
on Opteron G3 servers.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
---
 target/i386/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 722c5514d4..df1d81ded8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2723,7 +2723,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT_SSE3,
         .features[FEAT_8000_0001_EDX] =
             CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
-        .xlevel = 0x80000008,
+        .xlevel = 0x8000000A,
         .model_id = "AMD Opteron 240 (Gen 1 Class Opteron)",
     },
     {
@@ -2745,7 +2745,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
         .features[FEAT_8000_0001_ECX] =
             CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-        .xlevel = 0x80000008,
+        .xlevel = 0x8000000A,
         .model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)",
     },
     {
@@ -2770,7 +2770,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .features[FEAT_8000_0001_ECX] =
             CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A |
             CPUID_EXT3_ABM | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-        .xlevel = 0x80000008,
+        .xlevel = 0x8000000A,
         .model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)",
     },
     {
-- 
2.16.4



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

end of thread, other threads:[~2019-05-27  7:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 14:38 [Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons Bernhard M. Wiedemann
  -- strict thread matches above, loose matches on Subject: below --
2019-05-16 12:58 Bernhard M. Wiedemann
2019-05-23 18:57 ` Dr. David Alan Gilbert
2019-05-23 21:27   ` Eduardo Habkost
2019-05-27  7:49     ` Bernhard M. Wiedemann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.