Bug 1598657 - libvirt treats spapr-vio addresses as 64-bit, but they're not
Summary: libvirt treats spapr-vio addresses as 64-bit, but they're not
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.1
Hardware: ppc64le
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Andrea Bolognani
QA Contact: Dan Zheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-06 06:31 UTC by David Gibson
Modified: 2020-11-14 05:54 UTC (History)
6 users (show)

Fixed In Version: libvirt-5.5.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 07:11:37 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:11:52 UTC

Description David Gibson 2018-07-06 06:31:51 UTC
Description of problem:

The "spapr-vio" address type used for PAPR defined virtual devices on IBM POWER machines is treated by libvirt as being a 64-bit value (unsigned long long)

typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
struct _virDomainDeviceSpaprVioAddress {
    unsigned long long reg;
    bool has_reg;
};

However, both in the PAPR spec and the qemu implementation the address is only 32-bit.  64-bit values have never been supported there.

Version-Release number of selected component (if applicable):

Current upstream (d999b6016b4e9e39e23bb8bd043abe576305daf1)

Additional info:

The description in the VDAG is also incorrect

ยง 24.18.3

https://access.qa.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/virtualization_deployment_and_administration_guide/#sect-Devices-Device_addresses

Comment 1 David Gibson 2019-06-04 01:40:06 UTC
I got sick of seeing this bug in my searches, and wrote a patch for it, which I posted to libvir-list upstream (and CCed Andrea).

Andrea, can you help with shepherding that into upstream libvirt?

Comment 2 Andrea Bolognani 2019-06-14 11:24:25 UTC
Alternative approach posted upstream.

  https://www.redhat.com/archives/libvir-list/2019-June/msg00393.html

Comment 3 Andrea Bolognani 2019-06-20 10:51:50 UTC
Fix merged upstream.

  commit 89afb9f594877d9cc105d729143a7b05528570da
  Author: Andrea Bolognani <abologna>
  Date:   Fri Jun 14 12:50:22 2019 +0200

    qemu: Validate spapr-vio addresses
    
    According to sPAPR, addresses are 32-bit rather than 64-bit.
    Update qemuDomainDeviceDefValidateAddress() accordingly.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1598657
    
    Signed-off-by: Andrea Bolognani <abologna>
    Reviewed-by: Michal Privoznik <mprivozn>

  v5.4.0-276-g89afb9f594

Comment 9 Dan Zheng 2019-07-04 02:02:31 UTC
Reproduce:
libvirt-5.4.0-2.module+el8.1.0+3523+b348b848
qemu-kvm-4.0.0-4.module+el8.1.0+3523+b348b848.ppc64le
kernel-4.18.0-109.el8.ppc64le


Edit spapr-vio device's address from 0x30000000 to 0x300000000
    <serial type='pty'>
      <target type='spapr-vio-serial' port='0'>
        <model name='spapr-vty'/>
      </target>
      <address type='spapr-vio' reg='0x300000000'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
      <address type='spapr-vio' reg='0x300000000'/>
    </console>


Start guest
# virsh start avocado-vt-vm1
error: Failed to start domain avocado-vt-vm1
error: internal error: process exited while connecting to monitor: 2019-07-04T00:54:09.488932Z qemu-kvm: -device spapr-vty,chardev=charserial0,id=serial0,reg=0x300000000: Parameter 'reg' expects uint32_t

--- libvirt does not report error for 0x300000000


Retest with:
libvirt-5.5.0-1.module+el8.1.0+3580+d7f6488d.ppc64le
qemu-kvm-4.0.0-4.module+el8.1.0+3523+b348b848.ppc64le
kernel-4.18.0-109.el8.ppc64le

Use same xml as above and start guest
# virsh start avocado-vt-vm1
error: Failed to start domain avocado-vt-vm1
error: unsupported configuration: spapr-vio reg='0x300000000' exceeds maximum possible value (0xffffffff)

--- libvirt report the checking error.

Comment 10 Dan Zheng 2019-07-04 02:04:25 UTC
Based on comment 9, I mark it verified.

Comment 12 errata-xmlrpc 2019-11-06 07:11:37 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/RHBA-2019:3723


Note You need to log in before you can comment on or make changes to this bug.