Re: [PATCH v8 09/22] s390: vfio-ap: register matrix device with VFIO mdev framework
From: Cornelia Huck
Date: Thu Aug 09 2018 - 07:06:15 EST
On Wed, 8 Aug 2018 10:44:19 -0400
Tony Krowiak <akrowiak@xxxxxxxxxxxxxxxxxx> wrote:
> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
> index d7e39ad..6a827f3 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -12,6 +12,7 @@
> #include <linux/mod_devicetable.h>
> #include <linux/slab.h>
> #include <linux/string.h>
> +#include <asm/zcrypt.h>
> #include "vfio_ap_private.h"
>
> #define VFIO_AP_ROOT_NAME "vfio_ap"
> @@ -68,6 +69,18 @@ static int vfio_ap_matrix_dev_create(void)
> {
> int ret;
>
> + mutex_init(&matrix_dev.lock);
> + INIT_LIST_HEAD(&matrix_dev.mdev_list);
> +
> + /* Test if PQAP(QCI) instruction is available */
> + if (test_facility(12)) {
> + ret = ap_qci(&matrix_dev.info);
> + if (ret)
> + return ret;
> + }
> +
> + atomic_set(&matrix_dev.available_instances, MAX_ZDEV_ENTRIES_EXT);
> +
> ret = misc_register(&matrix_dev.misc_dev);
OK, you are adding more stuff other than the miscdevice after all...
still, I don't think that this is a good idea.
I think I had already asked this for a previous version: Why has this
been turned into a miscdevice? (I think my reaction to the answer was
'meh'... but I think more and more that we should not do that.)
> if (ret)
> return ret;