Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1460908

Summary: qemu-kvm: POWER9 CPU model not usable on POWER9 machine
Product: Red Hat Enterprise Linux 7 Reporter: Andrea Bolognani <abologna>
Component: qemu-kvmAssignee: Laurent Vivier <lvivier>
Status: CLOSED ERRATA QA Contact: Xujun Ma <xuma>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4-AltCC: alukiano, bugproxy, dgibson, hannsj_uhl, knoel, lvivier, michen, qzhang, rbalakri, thuth, virt-maint, xuma
Target Milestone: rcKeywords: Patch
Target Release: 7.4-Alt   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-2.9.0-18.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-09 11:28:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1440030    

Description Andrea Bolognani 2017-06-13 06:16:51 UTC
On a POWER9 machine, I would expect to be able to use the
POWER9 CPU model just like I can use the POWER8 CPU model
on a POWER8 machine, but it doesn't work with upstream
QEMU:

  $ /usr/local/bin/qemu-system-ppc64 \
    -nodefaults \
    -M pseries,accel=kvm \
    -cpu POWER9
  qemu-system-ppc64: Register sync failed...
  If you're using kvm-hv.ko, only "-cpu host" is possible
  kvm_init_vcpu failed: Invalid argument

With downstream QEMU the error is different:

  $ /usr/local/bin/qemu-system-ppc64 \
    -nodefaults \
    -M pseries,accel=kvm \
    -cpu POWER9
  qemu-kvm: Unable to find sPAPR CPU Core definition

Note that the downstream package is qemu-kvm-2.9.0-7.p1.el7,
which includes the fix for Bug 1449969, so I would have
expected the behavior to be the same.

Comment 1 Andrea Bolognani 2017-06-13 06:27:58 UTC
It's also worth noting that the same error as upstream
is displayed when using '-cpu POWER9' with
qemu-kvm-rhev-2.9.0-7.el7 on a POWER*8* machine.

Comment 2 David Gibson 2017-06-16 04:20:45 UTC
*** Bug 1461686 has been marked as a duplicate of this bug. ***

Comment 3 Laurent Vivier 2017-06-21 12:59:20 UTC
I think this is because host has POWER9 DD1 (pvr 004e 0100) and QEMU defines only  POWER9 v1.0 (pvr 004e 0000). So QEMU complains it is not able to find  the POWER9 DD1 definition.

Comment 4 Andrea Bolognani 2017-06-21 14:09:05 UTC
(In reply to Laurent Vivier from comment #3)
> I think this is because host has POWER9 DD1 (pvr 004e 0100) and QEMU defines
> only  POWER9 v1.0 (pvr 004e 0000). So QEMU complains it is not able to find 
> the POWER9 DD1 definition.

IIUC the POWER8 CPU model is created dynamically so that its
PVR matches the host, without requiring QEMU to have any
knowledge of the specific PVR; the POWER9 CPU model should
do the same.

Comment 5 Laurent Vivier 2017-06-21 15:02:14 UTC
(In reply to Andrea Bolognani from comment #4)
> (In reply to Laurent Vivier from comment #3)
> > I think this is because host has POWER9 DD1 (pvr 004e 0100) and QEMU defines
> > only  POWER9 v1.0 (pvr 004e 0000). So QEMU complains it is not able to find 
> > the POWER9 DD1 definition.
> 
> IIUC the POWER8 CPU model is created dynamically so that its
> PVR matches the host, without requiring QEMU to have any
> knowledge of the specific PVR; the POWER9 CPU model should
> do the same.

I think it is true for "-cpu host", but for "-cpu POWER9" QEMU must has the knowledge of the PVR of the host CPU to know if it is compatible with the QEMU one.

Thomas, as you have worked on the CPU properties, any idea on this?

BTW, the following patch fixes the problem:

diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
index 4d3e635..a22363c 100644
--- a/target/ppc/cpu-models.c
+++ b/target/ppc/cpu-models.c
@@ -1144,7 +1144,7 @@
     POWERPC_DEF("970_v2.2",      CPU_POWERPC_970_v22,                970,
                 "PowerPC 970 v2.2")
 
-    POWERPC_DEF("POWER9_v1.0",   CPU_POWERPC_POWER9_BASE,            POWER9,
+    POWERPC_DEF("POWER9_v1.0",   CPU_POWERPC_POWER9_DD1,             POWER9,
                 "POWER9 v1.0")
 
     POWERPC_DEF("970fx_v1.0",    CPU_POWERPC_970FX_v10,              970,

Comment 6 Thomas Huth 2017-06-21 18:18:47 UTC
I slightly remember having suggested that change in cpu-models.c some time ago already, too (but my comment got lost somehow), so I think this is the right fix, Laurent. Could you submit the patch upstream, please?

Comment 7 Laurent Vivier 2017-06-22 17:39:27 UTC
Patch sent:
https://lists.gnu.org/archive/html/qemu-devel/2017-06/msg05022.html

Comment 8 Laurent Vivier 2017-07-05 10:31:08 UTC
Greg Kurz has proposed a better fix for this problem:

https://lists.nongnu.org/archive/html/qemu-ppc/2017-07/msg00070.html

Comment 9 Miroslav Rezanina 2017-07-18 07:57:08 UTC
Fix included in qemu-kvm-2.9.0-18.el7

Comment 10 Qunfang Zhang 2017-08-01 06:18:54 UTC
Reproduced the bug in qemu-kvm-2.9.0-17.el7a.ppc64le:

# /usr/libexec/qemu-kvm -nodefaults -M pseries,accel=kvm -cpu POWER9
qemu-kvm: Unable to find sPAPR CPU Core definition

Failed to boot up.

Verified pass in qemu-kvm-2.9.0-17.el7a.ppc64le:

# /usr/libexec/qemu-kvm -nodefaults -M pseries,accel=kvm -cpu POWER9
VNC server running on ::1:5900

Boot up a pre-installed guest image with "-cpu POWER9", Guest boots up successfully.

# /usr/libexec/qemu-kvm -name test -cpu POWER9 -machine pseries,accel=kvm,usb=off -nodefaults -m 4G -smp 4,sockets=1,cores=4,threads=1 -uuid 8aeab7e2-f341-4f8c-80e8-59e2968d85c2 -realtime mlock=off  -rtc base=utc -device virtio-scsi-pci,bus=pci.0,id=scsi0,addr=0x3 -drive file=rhel7.4-alt-EA3-20170626.4-blk.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none -device scsi-hd,bus=scsi0.0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1  -drive if=none,id=drive-scsi0-0-1-0,readonly=on -device scsi-cd,bus=scsi0.0,drive=drive-scsi0-0-1-0,bootindex=2,id=scsi0-0-1  -msg timestamp=on -device nec-usb-xhci -device usb-tablet,id=tablet1   -qmp tcp:0:5566,server,nowait -serial stdio

Based on above, this bug is fixed.

Comment 18 Artyom 2017-08-28 07:22:08 UTC
I opened the new bug https://bugzilla.redhat.com/show_bug.cgi?id=1485816

Comment 20 errata-xmlrpc 2017-11-09 11:28:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:3169