[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161128141244.4defcfa1.cornelia.huck@de.ibm.com>
Date: Mon, 28 Nov 2016 14:12:44 +0100
From: Cornelia Huck <cornelia.huck@...ibm.com>
To: Gonglei <arei.gonglei@...wei.com>
Cc: <linux-kernel@...r.kernel.org>, <qemu-devel@...gnu.org>,
<virtio-dev@...ts.oasis-open.org>,
<virtualization@...ts.linux-foundation.org>,
<linux-crypto@...r.kernel.org>, <luonengjun@...wei.com>,
<mst@...hat.com>, <stefanha@...hat.com>,
<weidong.huang@...wei.com>, <wu.wubin@...wei.com>,
<xin.zeng@...el.com>, <claudio.fontana@...wei.com>,
<herbert@...dor.apana.org.au>, <pasic@...ux.vnet.ibm.com>,
<davem@...emloft.net>, <jianjay.zhou@...wei.com>,
<hanweidong@...wei.com>, <arei.gonglei@...mail.com>,
<xuquan8@...wei.com>, <longpeng2@...wei.com>,
<salvatore.benedetto@...el.com>
Subject: Re: [PATCH v3] crypto: add virtio-crypto driver
On Mon, 28 Nov 2016 20:08:23 +0800
Gonglei <arei.gonglei@...wei.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;
> +}
> +
Powered by blists - more mailing lists