qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Gonglei <arei.gonglei@huawei.com>
Cc: linux-kernel@vger.kernel.org, qemu-devel@nongnu.org,
	virtio-dev@lists.oasis-open.org,
	virtualization@lists.linux-foundation.org,
	linux-crypto@vger.kernel.org, luonengjun@huawei.com,
	mst@redhat.com, stefanha@redhat.com, weidong.huang@huawei.com,
	wu.wubin@huawei.com, xin.zeng@intel.com,
	claudio.fontana@huawei.com, herbert@gondor.apana.org.au,
	pasic@linux.vnet.ibm.com, davem@davemloft.net,
	jianjay.zhou@huawei.com, hanweidong@huawei.com,
	arei.gonglei@hotmail.com, xuquan8@huawei.com,
	longpeng2@huawei.com, salvatore.benedetto@intel.com
Subject: Re: [Qemu-devel] [PATCH v3] crypto: add virtio-crypto driver
Date: Mon, 28 Nov 2016 14:12:44 +0100	[thread overview]
Message-ID: <20161128141244.4defcfa1.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1480334903-6672-2-git-send-email-arei.gonglei@huawei.com>

On Mon, 28 Nov 2016 20:08:23 +0800
Gonglei <arei.gonglei@huawei.com> wrote:

> +static int virtcrypto_update_status(struct virtio_crypto *vcrypto)
> +{
> +	u32 status;
> +	int err;
> +
> +	virtio_cread(vcrypto->vdev,
> +	    struct virtio_crypto_config, status, &status);
> +
> +	/* Ignore unknown (future) status bits */
> +	status &= VIRTIO_CRYPTO_S_HW_READY;

I'm wondering what the driver really should do if it encounters unknown
status bits.

I'd expect that new status bits are guarded by a feature bit and that
the device should not set status bits if the respective feature bit has
not been negotiated. Therefore, unknown status bits would be a host
error and the driver should consider the device to be broken.

Thoughts?

> +
> +	if (vcrypto->status == status)
> +		return 0;
> +
> +	vcrypto->status = status;
> +
> +	if (vcrypto->status & VIRTIO_CRYPTO_S_HW_READY) {
> +		err = virtcrypto_dev_start(vcrypto);
> +		if (err) {
> +			dev_err(&vcrypto->vdev->dev,
> +				"Failed to start virtio crypto device.\n");
> +			virtcrypto_dev_stop(vcrypto);
> +			return -EPERM;
> +		}
> +		dev_info(&vcrypto->vdev->dev, "Accelerator is ready\n");
> +	} else {
> +		virtcrypto_dev_stop(vcrypto);
> +		dev_info(&vcrypto->vdev->dev, "Accelerator is not ready\n");
> +	}
> +
> +	return 0;
> +}
> +

  reply	other threads:[~2016-11-28 13:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28 12:08 [Qemu-devel] [PATCH v3] virtio-crypto: add Linux driver Gonglei
2016-11-28 12:08 ` [Qemu-devel] [PATCH v3] crypto: add virtio-crypto driver Gonglei
2016-11-28 13:12   ` Cornelia Huck [this message]
2016-11-29  1:37     ` [Qemu-devel] [virtio-dev] " Gonglei (Arei)
2016-11-29  9:44       ` Cornelia Huck
2016-11-29 11:50         ` Gonglei (Arei)
2016-11-28 16:02   ` [Qemu-devel] " kbuild test robot
2016-11-28 16:20   ` Stefan Hajnoczi
2016-11-28 17:19     ` Michael S. Tsirkin
2016-11-28 17:37       ` Halil Pasic
2016-11-29  3:40         ` Gonglei (Arei)
2016-11-29  3:32       ` Gonglei (Arei)
2016-11-29  6:47       ` Gonglei (Arei)
2016-11-29  8:22       ` Gonglei (Arei)
2016-11-29  9:25         ` Stefan Hajnoczi
2016-11-29  9:29           ` Cornelia Huck
2016-11-29 11:46             ` Gonglei (Arei)
2016-11-29  9:31           ` 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=20161128141244.4defcfa1.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=arei.gonglei@hotmail.com \
    --cc=arei.gonglei@huawei.com \
    --cc=claudio.fontana@huawei.com \
    --cc=davem@davemloft.net \
    --cc=hanweidong@huawei.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jianjay.zhou@huawei.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longpeng2@huawei.com \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=salvatore.benedetto@intel.com \
    --cc=stefanha@redhat.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=weidong.huang@huawei.com \
    --cc=wu.wubin@huawei.com \
    --cc=xin.zeng@intel.com \
    --cc=xuquan8@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).