[libvirt] [PATCH 0/2] S390: ccw support for virsh attach-disk address parameter

This patch add the ccw support for the optional address parameter of virsh attach-disk. Stefan Zimmermann (2): S390: ccw support for virsh attach-disk address parameter S390: Documentation for ccw address type docs/formatdomain.html.in | 5 ++--- tools/virsh-domain.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- tools/virsh.pod | 3 ++- 3 files changed, 49 insertions(+), 5 deletions(-) -- 2.1.4

Adding ccw bus address support to the optional address parameter of virsh attach-disk. The format used is ccw:cssid. ssid.devno, e.g. ccw:0xfe.0x0.0x0201 Virtio-ccw devices must have their cssid set to 0xfe. Signed-off-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> --- tools/virsh-domain.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- tools/virsh.pod | 3 ++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bab44fe..358d61c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -404,6 +404,7 @@ enum { DISK_ADDR_TYPE_PCI, DISK_ADDR_TYPE_SCSI, DISK_ADDR_TYPE_IDE, + DISK_ADDR_TYPE_CCW, }; struct PCIAddress { @@ -425,12 +426,19 @@ struct IDEAddress { unsigned int unit; }; +struct CCWAddress { + unsigned int cssid; + unsigned int ssid; + unsigned int devno; +}; + struct DiskAddress { int type; union { struct PCIAddress pci; struct SCSIAddress scsi; struct IDEAddress ide; + struct CCWAddress ccw; } addr; }; @@ -513,9 +521,35 @@ static int str2IDEAddress(const char *str, struct IDEAddress *ideAddr) return 0; } +static int str2CCWAddress(const char *str, struct CCWAddress *ccwAddr) +{ + char *cssid, *ssid, *devno; + + if (!ccwAddr) + return -1; + if (!str) + return -1; + + cssid = (char *)str; + + if (virStrToLong_ui(cssid, &ssid, 0, &ccwAddr->cssid) != 0) + return -1; + + ssid++; + if (virStrToLong_ui(ssid, &devno, 0, &ccwAddr->ssid) != 0) + return -1; + + devno++; + if (virStrToLong_ui(devno, NULL, 0, &ccwAddr->devno) != 0) + return -1; + + return 0; +} + /* pci address pci:0000.00.0x0a.0 (domain:bus:slot:function) * ide disk address: ide:00.00.0 (controller:bus:unit) * scsi disk address: scsi:00.00.0 (controller:bus:unit) + * ccw disk address: ccw:0xfe.0.0000 (cssid:ssid:devno) */ static int str2DiskAddress(const char *str, struct DiskAddress *diskAddr) @@ -541,6 +575,9 @@ static int str2DiskAddress(const char *str, struct DiskAddress *diskAddr) } else if (STREQLEN(type, "ide", addr - type)) { diskAddr->type = DISK_ADDR_TYPE_IDE; return str2IDEAddress(addr + 1, &diskAddr->addr.ide); + } else if (STREQLEN(type, "ccw", addr - type)) { + diskAddr->type = DISK_ADDR_TYPE_CCW; + return str2CCWAddress(addr + 1, &diskAddr->addr.ccw); } return -1; @@ -675,8 +712,15 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "multifunction")) virBufferAddLit(&buf, " multifunction='on'"); virBufferAddLit(&buf, "/>\n"); + } else if (diskAddr.type == DISK_ADDR_TYPE_CCW) { + virBufferAsprintf(&buf, + "<address type='ccw' cssid='0x%02x'" + " ssid='0x%01x' devno='0x%04x' />\n", + diskAddr.addr.ccw.cssid, diskAddr.addr.ccw.ssid, + diskAddr.addr.ccw.devno); } else { - vshError(ctl, "%s", _("expecting a pci:0000.00.00.00 address.")); + vshError(ctl, "%s", + _("expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.")); goto cleanup; } } else if (STRPREFIX((const char *)target, "sd")) { diff --git a/tools/virsh.pod b/tools/virsh.pod index e367e04..a3f527f 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -2367,7 +2367,8 @@ this disk may be attached (QEMU only). I<serial> is the serial of disk device. I<wwn> is the wwn of disk device. I<rawio> indicates the disk needs rawio capability. I<address> is the address of disk device in the form of pci:domain.bus.slot.function, -scsi:controller.bus.unit or ide:controller.bus.unit. +scsi:controller.bus.unit, ide:controller.bus.unit or ccw:cssid.ssid.devno. +Virtio-ccw devices must have their cssid set to 0xfe. I<multifunction> indicates specified pci address is a multifunction pci device address. -- 2.1.4

On Wed, Feb 04, 2015 at 03:00:08PM +0100, Stefan Zimmermann wrote:
Adding ccw bus address support to the optional address parameter of virsh attach-disk. The format used is ccw:cssid. ssid.devno, e.g. ccw:0xfe.0x0.0x0201
Virtio-ccw devices must have their cssid set to 0xfe.
Signed-off-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> --- tools/virsh-domain.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- tools/virsh.pod | 3 ++- 2 files changed, 47 insertions(+), 2 deletions(-)
ACK and pushed. Jan

Change the wording in the device-address-part of the docmunentation since the ccw bus address support added to the optional address parameter of virsh attach-disk for S390. Signed-off-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> --- docs/formatdomain.html.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c5ad6f4..181b23e 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2755,9 +2755,8 @@ <code>devno</code> (a hex value between 0 and 0xffff, inclusive). Partially specified bus addresses are not allowed. If omitted, libvirt will assign a free bus address with - cssid=0xfe and ssid=0. Virtio devices for s390 must have their - cssid set to 0xfe in order to be recognized by the guest - operating system. + cssid=0xfe and ssid=0. Virtio-ccw devices must have their cssid + set to 0xfe. <span class="since">Since 1.0.4</span> </dd> <dt><code>type='isa'</code></dt> -- 2.1.4

On Wed, Feb 04, 2015 at 03:00:09PM +0100, Stefan Zimmermann wrote:
Change the wording in the device-address-part of the docmunentation since the ccw bus address support added to the optional address parameter of virsh attach-disk for S390.
Signed-off-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> --- docs/formatdomain.html.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
ACK and pushed. Jan
participants (2)
-
Ján Tomko
-
Stefan Zimmermann