All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Gonglei <arei.gonglei@huawei.com>
Cc: qemu-devel@nongnu.org, virtio-dev@lists.oasis-open.org,
	luonengjun@huawei.com, stefanha@redhat.com, pbonzini@redhat.com,
	berrange@redhat.com, weidong.huang@huawei.com,
	wu.wubin@huawei.com, mike.caraman@nxp.com, agraf@suse.de,
	xin.zeng@intel.com, claudio.fontana@huawei.com, nmorey@kalray.eu,
	vincent.jardin@6wind.com, jianjay.zhou@huawei.com,
	hanweidong@huawei.com, peter.huangpeng@huawei.com,
	arei.gonglei@hotmail.com
Subject: Re: [Qemu-devel] [PATCH v5 11/14] virtio-crypto: emulate virtio crypto as a legacy device by default
Date: Mon, 10 Oct 2016 02:48:13 +0300	[thread overview]
Message-ID: <20161010024421-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1475753807-37624-12-git-send-email-arei.gonglei@huawei.com>

On Thu, Oct 06, 2016 at 07:36:44PM +0800, Gonglei wrote:
> the scenario of virtio crypto device is mostly NFV, which require
> the existing Guest can't need to do any changes to support virtio
> crypto, so that they can easily migrate the existing network units
> to VM. That's also a basic requirement came from our customers
> in production environment.
> 
> For virtio crypto driver, we can both support virtio-1.0 or earlier. But
> Virtio pci driver module can't discovery the virtio-1.0 devices in most
> existing Guests. If we want do this, we have to require the customers
> change the virtio pci module for existing guests influence all virtio
> devices, which is impossible.
>
> So, let's emulate the virtio crypto device as a legacy virtio
> device by default. Using 0x1014 as virtio crypto pci device ID
> because virtio crypto ID is 20 (0x14).
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>

Sorry, I don't think this makes any sense.

You certainly can have two drivers: one for legacy and one for modern
devices.  It only gets difficult if you try to support transitional
devices.

Pls drop this patch.

> ---
>  docs/specs/pci-ids.txt        | 2 ++
>  hw/virtio/virtio-crypto-pci.c | 4 +++-
>  include/hw/pci/pci.h          | 2 ++
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt
> index fd27c67..662d4f8 100644
> --- a/docs/specs/pci-ids.txt
> +++ b/docs/specs/pci-ids.txt
> @@ -22,6 +22,7 @@ maintained as part of the virtio specification.
>  1af4:1004  SCSI host bus adapter device (legacy)
>  1af4:1005  entropy generator device (legacy)
>  1af4:1009  9p filesystem device (legacy)
> +1af4:1014  crypto device (legacy)
>  
>  1af4:1041  network device (modern)
>  1af4:1042  block device (modern)
> @@ -32,6 +33,7 @@ maintained as part of the virtio specification.
>  1af4:1049  9p filesystem device (modern)
>  1af4:1050  virtio gpu device (modern)
>  1af4:1052  virtio input device (modern)
> +1af4:1054  crypto device (modern)
>  
>  1af4:10f0  Available for experimental usage without registration.  Must get
>     to      official ID when the code leaves the test lab (i.e. when seeking
> diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c
> index 21d9984..30c10f0 100644
> --- a/hw/virtio/virtio-crypto-pci.c
> +++ b/hw/virtio/virtio-crypto-pci.c
> @@ -32,7 +32,6 @@ static void virtio_crypto_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
>      DeviceState *vdev = DEVICE(&vcrypto->vdev);
>  
>      qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
> -    virtio_pci_force_virtio_1(vpci_dev);
>      object_property_set_bool(OBJECT(vdev), true, "realized", errp);
>      object_property_set_link(OBJECT(vcrypto),
>                   OBJECT(vcrypto->vdev.conf.cryptodev), "cryptodev",
> @@ -49,6 +48,9 @@ static void virtio_crypto_pci_class_init(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>      dc->props = virtio_crypto_pci_properties;
>  
> +    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> +    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_CRYPTO;
> +    pcidev_k->revision = 0;
>      pcidev_k->class_id = PCI_CLASS_OTHERS;
>  }
>  
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index 772692f..5881101 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -83,6 +83,8 @@
>  #define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
>  #define PCI_DEVICE_ID_VIRTIO_9P          0x1009
>  #define PCI_DEVICE_ID_VIRTIO_VSOCK       0x1012
> +#define PCI_DEVICE_ID_VIRTIO_CRYPTO      0x1014
> +
>  
>  #define PCI_VENDOR_ID_REDHAT             0x1b36
>  #define PCI_DEVICE_ID_REDHAT_BRIDGE      0x0001
> -- 
> 1.7.12.4
> 

  reply	other threads:[~2016-10-09 23:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 11:36 [Qemu-devel] [PATCH v5 00/14] virtio-crypto: introduce framework and device emulation Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 01/14] cryptodev: introduce cryptodev backend interface Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 02/14] cryptodev: add symmetric algorithm operation stuff Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 03/14] virtio-crypto: introduce virtio_crypto.h Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 04/14] cryptodev: introduce a new cryptodev backend Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 05/14] virtio-crypto: add virtio crypto device emulation Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 06/14] virtio-crypto-pci: add virtio crypto pci support Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 07/14] virtio-crypto: set capacity of algorithms supported Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 08/14] virtio-crypto: add control queue handler Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 09/14] virtio-crypto: add data queue processing handler Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 10/14] cryptodev: introduce an unified wrapper for crypto operation Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 11/14] virtio-crypto: emulate virtio crypto as a legacy device by default Gonglei
2016-10-09 23:48   ` Michael S. Tsirkin [this message]
2016-10-10  0:24     ` Gonglei (Arei)
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 12/14] virtio-crypto-test: add qtest case for virtio-crypto Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 13/14] virtio-crypto: add myself as virtio-crypto and cryptodev backends maintainer Gonglei
2016-10-06 11:36 ` [Qemu-devel] [PATCH v5 14/14] cryptodev: rename cryptodev stuff Gonglei
2016-10-06 19:47   ` Eric Blake
2016-10-08  1:30     ` Gonglei (Arei)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161010024421-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=arei.gonglei@hotmail.com \
    --cc=arei.gonglei@huawei.com \
    --cc=berrange@redhat.com \
    --cc=claudio.fontana@huawei.com \
    --cc=hanweidong@huawei.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=luonengjun@huawei.com \
    --cc=mike.caraman@nxp.com \
    --cc=nmorey@kalray.eu \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vincent.jardin@6wind.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=weidong.huang@huawei.com \
    --cc=wu.wubin@huawei.com \
    --cc=xin.zeng@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.