qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3
@ 2021-04-09 20:22 Eduardo Habkost
  2021-04-09 20:22 ` [PULL 1/2] i386: Add missing cpu feature bits in EPYC-Rome model Eduardo Habkost
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eduardo Habkost @ 2021-04-09 20:22 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell
  Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost, Richard Henderson

The following changes since commit 471387aa1446e2583f372f79327cc0a8c802b4b4:

  Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210409' into staging (2021-04-09 17:21:18 +0100)

are available in the Git repository at:

  https://gitlab.com/ehabkost/qemu.git tags/x86-next-pull-request

for you to fetch changes up to 0b47ec4b95ad1952e55e639711d442f8ec6e1345:

  cpu/core: Fix "help" of CPU core device types (2021-04-09 16:05:16 -0400)

----------------------------------------------------------------
x86 and CPU bug fixes for 6.0-rc3

* Add missing features to EPYC-Rome CPU model (Babu Moger)
* Fix crash with "-device ...-cpu-core,help" (Greg Kurz)

----------------------------------------------------------------

Babu Moger (1):
  i386: Add missing cpu feature bits in EPYC-Rome model

Greg Kurz (1):
  cpu/core: Fix "help" of CPU core device types

 hw/cpu/core.c     | 10 ++++++++--
 target/i386/cpu.c | 12 ++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

-- 
2.30.2




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

* [PULL 1/2] i386: Add missing cpu feature bits in EPYC-Rome model
  2021-04-09 20:22 [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3 Eduardo Habkost
@ 2021-04-09 20:22 ` Eduardo Habkost
  2021-04-09 20:22 ` [PULL 2/2] cpu/core: Fix "help" of CPU core device types Eduardo Habkost
  2021-04-11 12:00 ` [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2021-04-09 20:22 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell
  Cc: Eduardo Habkost, Richard Henderson, David Edmondson, Babu Moger,
	Pankaj Gupta, Paolo Bonzini, Richard Henderson

From: Babu Moger <babu.moger@amd.com>

Found the following cpu feature bits missing from EPYC-Rome model.
ibrs    : Indirect Branch Restricted Speculation
ssbd    : Speculative Store Bypass Disable

These new features will be added in EPYC-Rome-v2. The -cpu help output
after the change.

x86 EPYC-Rome             (alias configured by machine type)
x86 EPYC-Rome-v1          AMD EPYC-Rome Processor
x86 EPYC-Rome-v2          AMD EPYC-Rome Processor

Reported-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
Message-Id: <161478622280.16275.6399866734509127420.stgit@bmoger-ubuntu>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 6b3e9467f17..ad99cad0e7c 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4179,6 +4179,18 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .xlevel = 0x8000001E,
         .model_id = "AMD EPYC-Rome Processor",
         .cache_info = &epyc_rome_cache_info,
+        .versions = (X86CPUVersionDefinition[]) {
+            { .version = 1 },
+            {
+                .version = 2,
+                .props = (PropValue[]) {
+                    { "ibrs", "on" },
+                    { "amd-ssbd", "on" },
+                    { /* end of list */ }
+                }
+            },
+            { /* end of list */ }
+        }
     },
     {
         .name = "EPYC-Milan",
-- 
2.30.2



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

* [PULL 2/2] cpu/core: Fix "help" of CPU core device types
  2021-04-09 20:22 [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3 Eduardo Habkost
  2021-04-09 20:22 ` [PULL 1/2] i386: Add missing cpu feature bits in EPYC-Rome model Eduardo Habkost
@ 2021-04-09 20:22 ` Eduardo Habkost
  2021-04-11 12:00 ` [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2021-04-09 20:22 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell
  Cc: Thomas Huth, Eduardo Habkost, Richard Henderson, Greg Kurz,
	Paolo Bonzini, Richard Henderson

From: Greg Kurz <groug@kaod.org>

Calling qdev_get_machine() from a QOM instance_init function is
fragile because we can't be sure the machine object actually
exists. And this happens to break when passing ",help" on the
command line to get the list of properties for a CPU core
device types :

$ ./qemu-system-ppc64 -device power8_v2.0-spapr-cpu-core,help
qemu-system-ppc64: ../../hw/core/machine.c:1290:
 qdev_get_machine: Assertion `machine != NULL' failed.
Aborted (core dumped)

This used to work before QEMU 5.0, but commit 3df261b6676b
unwillingly introduced a subtle regression : the above command
line needs to create an instance but the instance_init function
of the base class calls qdev_get_machine() before
qemu_create_machine() has been called, which is a programming bug.

Use current_machine instead. It is okay to skip the setting of
nr_thread in this case since only its type is displayed.

Fixes: 3df261b6676b ("softmmu/vl.c: Handle '-cpu help' and '-device help' before 'no default machine'")
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
Cc: peter.maydell@linaro.org
Message-Id: <20210409160339.500167-3-groug@kaod.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/cpu/core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/cpu/core.c b/hw/cpu/core.c
index 92d3b2fbad6..98760751557 100644
--- a/hw/cpu/core.c
+++ b/hw/cpu/core.c
@@ -66,10 +66,16 @@ static void core_prop_set_nr_threads(Object *obj, Visitor *v, const char *name,
 
 static void cpu_core_instance_init(Object *obj)
 {
-    MachineState *ms = MACHINE(qdev_get_machine());
     CPUCore *core = CPU_CORE(obj);
 
-    core->nr_threads = ms->smp.threads;
+    /*
+     * Only '-device something-cpu-core,help' can get us there before
+     * the machine has been created. We don't care to set nr_threads
+     * in this case since it isn't used afterwards.
+     */
+    if (current_machine) {
+        core->nr_threads = current_machine->smp.threads;
+    }
 }
 
 static void cpu_core_class_init(ObjectClass *oc, void *data)
-- 
2.30.2



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

* Re: [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3
  2021-04-09 20:22 [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3 Eduardo Habkost
  2021-04-09 20:22 ` [PULL 1/2] i386: Add missing cpu feature bits in EPYC-Rome model Eduardo Habkost
  2021-04-09 20:22 ` [PULL 2/2] cpu/core: Fix "help" of CPU core device types Eduardo Habkost
@ 2021-04-11 12:00 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-04-11 12:00 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Richard Henderson, QEMU Developers, Richard Henderson

On Fri, 9 Apr 2021 at 21:22, Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> The following changes since commit 471387aa1446e2583f372f79327cc0a8c802b4b4:
>
>   Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210409' into staging (2021-04-09 17:21:18 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/ehabkost/qemu.git tags/x86-next-pull-request
>
> for you to fetch changes up to 0b47ec4b95ad1952e55e639711d442f8ec6e1345:
>
>   cpu/core: Fix "help" of CPU core device types (2021-04-09 16:05:16 -0400)
>
> ----------------------------------------------------------------
> x86 and CPU bug fixes for 6.0-rc3
>
> * Add missing features to EPYC-Rome CPU model (Babu Moger)
> * Fix crash with "-device ...-cpu-core,help" (Greg Kurz)
>
> ----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2021-04-11 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 20:22 [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3 Eduardo Habkost
2021-04-09 20:22 ` [PULL 1/2] i386: Add missing cpu feature bits in EPYC-Rome model Eduardo Habkost
2021-04-09 20:22 ` [PULL 2/2] cpu/core: Fix "help" of CPU core device types Eduardo Habkost
2021-04-11 12:00 ` [PULL 0/2] x86 and CPU bug fixes for 6.0-rc3 Peter Maydell

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).