[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1395083909.28843.33.camel@haakon3.risingtidesystems.com>
Date: Mon, 17 Mar 2014 12:18:29 -0700
From: "Nicholas A. Bellinger" <nab@...ux-iscsi.org>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: "Nicholas A. Bellinger" <nab@...erainc.com>,
target-devel <target-devel@...r.kernel.org>,
linux-scsi <linux-scsi@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
kvm-devel <kvm@...r.kernel.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Christoph Hellwig <hch@....de>, Hannes Reinecke <hare@...e.de>,
Sagi Grimberg <sagig@...lanox.com>,
"H. Peter Anvin" <hpa@...or.com>,
Sagi Grimberg <sagig@....mellanox.co.il>
Subject: Re: [RFCv2 5/7] vhost/scsi: Enable T10 PI IOV -> SGL memory mapping
On Mon, 2014-03-17 at 12:02 +0100, Paolo Bonzini wrote:
> Il 17/03/2014 06:32, Nicholas A. Bellinger ha scritto:
> > + if (vq->iov[0].iov_len == sizeof(v_req_pi)) {
> > + req = (unsigned char *)&v_req_pi;
> > + target = &v_req_pi.lun[1];
> > + req_size = sizeof(v_req_pi);
> > + hdr_pi = true;
> > + } else if (vq->iov[0].iov_len == sizeof(v_req)) {
> > + req = (unsigned char *)&v_req;
> > + target = &v_req.lun[1];
> > + req_size = sizeof(v_req);
> > + hdr_pi = false;
>
> The right check here is on the negotiated features.
>
Mmmm, so this had been making the assumption that the PI enabled header
would only be used when the CDB itself had an associated PI SGL.
I agree it's cleaner to always use the PI enabled header when the
feature bit has been negotiated. Fixing this up for -v3.
> You need a matching QEMU patch to enable the protection information
> feature, like this (untested):
>
<nod>
Thanks Paolo!
--nab
> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> index 3983a5b..4c8d5cd 100644
> --- a/hw/scsi/vhost-scsi.c
> +++ b/hw/scsi/vhost-scsi.c
> @@ -154,6 +154,9 @@ static uint32_t vhost_scsi_get_features(VirtIODevice *vdev,
> if (!(s->dev.features & (1 << VIRTIO_SCSI_F_HOTPLUG))) {
> features &= ~(1 << VIRTIO_SCSI_F_HOTPLUG);
> }
> + if (!(s->dev.features & (1 << VIRTIO_SCSI_F_T10_PI))) {
> + features &= ~(1 << VIRTIO_SCSI_F_T10_PI);
> + }
>
> return features;
> }
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 6610b3a..4a551e9 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -629,6 +629,9 @@ static void virtio_scsi_device_realize(DeviceState *dev, Error **errp)
> return;
> }
>
> + /* Protection information is not supported yet. */
> + dev->guest_features &= ~VIRTIO_SCSI_F_T10_PI;
> +
> scsi_bus_new(&s->bus, sizeof(s->bus), dev,
> &virtio_scsi_scsi_info, vdev->bus_name);
>
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 9010246..8621fbf 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -267,6 +267,16 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
> .value = "no",\
> },\
> {\
> + .driver = "virtio-scsi-pci",\
> + .property = "prot_info",\
> + .value = "off",\
> + },\
> + {\
> + .driver = "vhost-scsi-pci",\
> + .property = "prot_info",\
> + .value = "off",\
> + },\
> + {\
> .driver = "PIIX4_PM",\
> .property = "acpi-pci-hotplug-with-bridge-support",\
> .value = "off",\
> diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
> index 42b1024..a555f49 100644
> --- a/include/hw/virtio/virtio-scsi.h
> +++ b/include/hw/virtio/virtio-scsi.h
> @@ -34,6 +34,7 @@
> #define VIRTIO_SCSI_F_INOUT 0
> #define VIRTIO_SCSI_F_HOTPLUG 1
> #define VIRTIO_SCSI_F_CHANGE 2
> +#define VIRTIO_SCSI_F_T10_PI 3
>
> #define VIRTIO_SCSI_VQ_SIZE 128
> #define VIRTIO_SCSI_CDB_SIZE 32
> @@ -184,7 +185,9 @@ typedef struct {
> DEFINE_PROP_BIT("hotplug", _state, _feature_field, VIRTIO_SCSI_F_HOTPLUG, \
> true), \
> DEFINE_PROP_BIT("param_change", _state, _feature_field, \
> - VIRTIO_SCSI_F_CHANGE, true)
> + VIRTIO_SCSI_F_CHANGE, true) \
> + DEFINE_PROP_BIT("prot_info", _state, _feature_field, \
> + VIRTIO_SCSI_F_T10_PI, true)
>
> void virtio_scsi_common_realize(DeviceState *dev, Error **errp);
> void virtio_scsi_common_unrealize(DeviceState *dev, Error **errp);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists