diff options
author | Jean-Philippe Brucker <jean-philippe@linaro.org> | 2023-06-06 14:04:15 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2023-06-08 22:39:03 +0100 |
commit | 145a86fedfe8321e857e1370a42b2a24b0bcda2c (patch) | |
tree | 04113044891f9b5da70046cb90040a9bf1277f6b | |
parent | 13e7d626e00fb723b9f469b7b5bc12193dba9835 (diff) | |
download | kvmtool-145a86fedfe8321e857e1370a42b2a24b0bcda2c.tar.gz |
virtio/scsi: Fix and simplify command-line
Fix and simplify the command-line parameter for virtio-scsi. Currently
passing a "scsi:xxxx" parameter without the second "tpgt" argument
causes kvmtool to segfault. But only the "wwpn" parameter is necessary.
The tpgt parameter is ignored and was never used upstream. See
linux/vhost_types.h:
* ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
* RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
* ABI Rev 1: January 2013. Ignore vhost_tpgt field in struct vhost_scsi_target.
* All the targets under vhost_wwpn can be seen and used by guset.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Link: https://lore.kernel.org/r/20230606130426.978945-7-jean-philippe@linaro.org
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | disk/core.c | 11 | ||||
-rw-r--r-- | include/kvm/disk-image.h | 7 | ||||
-rw-r--r-- | virtio/scsi.c | 2 |
3 files changed, 6 insertions, 14 deletions
diff --git a/disk/core.c b/disk/core.c index f69095d9..652fcd1a 100644 --- a/disk/core.c +++ b/disk/core.c @@ -25,14 +25,14 @@ int disk_img_name_parser(const struct option *opt, const char *arg, int unset) if (strncmp(arg, "scsi:", 5) == 0) { sep = strstr(arg, ":"); - if (sep) - kvm->cfg.disk_image[kvm->nr_disks].wwpn = sep + 1; + kvm->cfg.disk_image[kvm->nr_disks].wwpn = sep + 1; + + /* Old invocation had two parameters. Ignore the second one. */ sep = strstr(sep + 1, ":"); if (sep) { *sep = 0; - kvm->cfg.disk_image[kvm->nr_disks].tpgt = sep + 1; + cur = sep + 1; } - cur = sep + 1; } do { @@ -147,7 +147,6 @@ static struct disk_image **disk_image__open_all(struct kvm *kvm) struct disk_image **disks; const char *filename; const char *wwpn; - const char *tpgt; bool readonly; bool direct; void *err; @@ -169,14 +168,12 @@ static struct disk_image **disk_image__open_all(struct kvm *kvm) readonly = params[i].readonly; direct = params[i].direct; wwpn = params[i].wwpn; - tpgt = params[i].tpgt; if (wwpn) { disks[i] = malloc(sizeof(struct disk_image)); if (!disks[i]) return ERR_PTR(-ENOMEM); disks[i]->wwpn = wwpn; - disks[i]->tpgt = tpgt; continue; } diff --git a/include/kvm/disk-image.h b/include/kvm/disk-image.h index b2123838..bf602b58 100644 --- a/include/kvm/disk-image.h +++ b/include/kvm/disk-image.h @@ -48,12 +48,8 @@ struct disk_image_operations { struct disk_image_params { const char *filename; - /* - * wwpn == World Wide Port Number - * tpgt == Target Portal Group Tag - */ + /* wwpn == World Wide Port Number */ const char *wwpn; - const char *tpgt; bool readonly; bool direct; }; @@ -74,7 +70,6 @@ struct disk_image { u64 aio_inflight; #endif /* CONFIG_HAS_AIO */ const char *wwpn; - const char *tpgt; int debug_iodelay; }; diff --git a/virtio/scsi.c b/virtio/scsi.c index 8249a9cd..db4adc75 100644 --- a/virtio/scsi.c +++ b/virtio/scsi.c @@ -197,7 +197,7 @@ static int virtio_scsi_init_one(struct kvm *kvm, struct disk_image *disk) .kvm = kvm, }; strlcpy((char *)&sdev->target.vhost_wwpn, disk->wwpn, sizeof(sdev->target.vhost_wwpn)); - sdev->target.vhost_tpgt = strtol(disk->tpgt, NULL, 0); + sdev->target.abi_version = VHOST_SCSI_ABI_VERSION; list_add_tail(&sdev->list, &sdevs); |