From nobody Sat Apr 20 09:13:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559614554; cv=none; d=zoho.com; s=zohoarc; b=I9grXo1YgnhOKOi7N3Sk66+0OZGefkBqbTZFUkkH6rGjfVVPSsIAa2kkeZbv6GYARk57JqK37eLqiizNfh+xbS5npJzA+uwsxo8N1OdwXhKF6/mYWNQTEo+xazckVtmtCG/7OIdLD6YJQPd5V/Mau3hSslcMI3cWV1uyD0TS7Ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559614554; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=qFcEjabZXZAS1JMzZYXqkHDbmNZSgxmGuDsKYOdl3NM=; b=iDR7P64nNf2slkjDdmzx4NWaTlDjJdKM3xd31/qtMFhP0FsBJTuYD+6Xu5XN8H54MydfSmWB+KZ/HbY3DuA79O4t/7YTJRNIK7end4V9rQuYw97fM8pC515sK4A0yI5eJ3LpH6GFY+44RSPJbjnHSAvq29Bu8y81Hu4Bd27BqF8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559614552835783.983814151709; Mon, 3 Jun 2019 19:15:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5C0358E33; Tue, 4 Jun 2019 02:15:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F4685D739; Tue, 4 Jun 2019 02:15:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3D32C1806B18; Tue, 4 Jun 2019 02:15:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x542FheV005143 for ; Mon, 3 Jun 2019 22:15:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4BB8F5D9D2; Tue, 4 Jun 2019 02:15:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27F995D9CC; Tue, 4 Jun 2019 02:15:41 +0000 (UTC) Received: from ozlabs.org (ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0FCA3001451; Tue, 4 Jun 2019 02:15:38 +0000 (UTC) Received: by ozlabs.org (Postfix, from userid 1007) id 45HwWD4fGGz9sBr; Tue, 4 Jun 2019 12:15:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1559614536; bh=GGJrkCvNlU8CVDMiz3Cv7Eks8Ucx3qbwDF5I+LyFNwc=; h=From:To:Cc:Subject:Date:From; b=ZRuMMT22rAcJpCLy7Y935y0yIkZV5N1kv4icCLTg88vJFp3aFSiZPiYAyIieVI0Rt sVFMKYm1zhYbDQFQxRMGECpsj9ouqYfYc8CpmjYio3SQPz5CgjkTKrO3Unri9YlWV2 1OIAUrUl4ZNQJkP1Ul32X3kqmGOmgskiG/+CTfzE= From: David Gibson To: libvir-list@redhat.com, abologna@redhat.com Date: Tue, 4 Jun 2019 11:38:40 +1000 Message-Id: <20190604013840.20291-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 04 Jun 2019 02:15:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 04 Jun 2019 02:15:40 +0000 (UTC) for IP:'203.11.71.1' DOMAIN:'ozlabs.org' HELO:'ozlabs.org' FROM:'dgibson@ozlabs.org' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS) 203.11.71.1 ozlabs.org 203.11.71.1 ozlabs.org X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: David Gibson Subject: [libvirt] [PATCH] SpaprVio addresses are 32-bit, not 64-bit X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 04 Jun 2019 02:15:50 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" spapr-vio addresses are used on POWER platform qemu guests, which are based on the PAPR specification. PAPR specifies a number of virtual devices (but not virtio protocol) which are addressed in an abstract namespace. Currently, libvirt encodes these addresses as 64-bit values. This is not correct: spapr-vio addresses are, and always have been 32-bit. That's true both by the PAPR specification and the qemu implementation. Therefore, change this in libvirt. This looks like it would be a breaking change, but it actually isn't. Because these have always been 32-bit at the lower levels, any attempt to use a value here > 0xffffffff would always have failed in any case, this will just make it fail earlier and more clearly. Signed-off-by: David Gibson --- src/conf/device_conf.c | 2 +- src/conf/device_conf.h | 2 +- src/conf/domain_conf.c | 2 +- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_domain_address.c | 2 +- src/qemu/qemu_parse_command.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 2f82bdc2a7..42f83b0344 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -582,7 +582,7 @@ virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node, =20 reg =3D virXMLPropString(node, "reg"); if (reg) { - if (virStrToLong_ull(reg, NULL, 16, &addr->reg) < 0) { + if (virStrToLong_ul(reg, NULL, 16, &addr->reg) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot parse
'reg' attribute")); ret =3D -1; diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index b3299ac69d..02cf8c70ad 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -101,7 +101,7 @@ struct _virDomainDeviceUSBAddress { typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddr= ess; typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr; struct _virDomainDeviceSpaprVioAddress { - unsigned long long reg; + unsigned long reg; bool has_reg; }; =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 97ba8bd53a..02e58dc54d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7135,7 +7135,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf, =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO: if (info->addr.spaprvio.has_reg) - virBufferAsprintf(&attrBuf, " reg=3D'0x%llx'", info->addr.spap= rvio.reg); + virBufferAsprintf(&attrBuf, " reg=3D'0x%lx'", info->addr.spapr= vio.reg); break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 59dc134785..fab622f533 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -395,7 +395,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, } } else if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { if (info->addr.spaprvio.has_reg) - virBufferAsprintf(buf, ",reg=3D0x%llx", info->addr.spaprvio.re= g); + virBufferAsprintf(buf, ",reg=3D0x%lx", info->addr.spaprvio.reg= ); } else if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { if (info->addr.ccw.assigned) virBufferAsprintf(buf, ",devno=3D%x.%x.%04x", @@ -4332,7 +4332,7 @@ qemuBuildNVRAMDevStr(virDomainNVRAMDefPtr dev) =20 if (dev->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && dev->info.addr.spaprvio.has_reg) { - virBufferAsprintf(&buf, "spapr-nvram.reg=3D0x%llx", + virBufferAsprintf(&buf, "spapr-nvram.reg=3D0x%lx", dev->info.addr.spaprvio.reg); } else { virReportError(VIR_ERR_XML_ERROR, "%s", diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 4b99e8ca93..19562c9311 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -204,7 +204,7 @@ qemuDomainAssignSpaprVIOAddress(virDomainDefPtr def, while (ret !=3D 0) { if (user_reg) { virReportError(VIR_ERR_XML_ERROR, - _("spapr-vio address %#llx already in use"), + _("spapr-vio address %#lx already in use"), info->addr.spaprvio.reg); return -EEXIST; } diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index fc3f70fcde..35d1df8ceb 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2549,8 +2549,8 @@ qemuParseCommandLine(virFileCachePtr capsCache, def->nvram->info.addr.spaprvio.has_reg =3D true; =20 val +=3D strlen("spapr-nvram.reg=3D"); - if (virStrToLong_ull(val, NULL, 16, - &def->nvram->info.addr.spaprvio.reg) < 0)= { + if (virStrToLong_ul(val, NULL, 16, + &def->nvram->info.addr.spaprvio.reg) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot parse nvram's address '%s'"), val= ); goto error; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list