[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1d433a50-9ff9-aef5-fcef-8ccaffc859a8@linux.ibm.com>
Date: Thu, 20 Sep 2018 16:35:07 -0400
From: Tony Krowiak <akrowiak@...ux.ibm.com>
To: Cornelia Huck <cohuck@...hat.com>,
Tony Krowiak <akrowiak@...ux.vnet.ibm.com>
Cc: linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, freude@...ibm.com, schwidefsky@...ibm.com,
heiko.carstens@...ibm.com, borntraeger@...ibm.com,
kwankhede@...dia.com, bjsdjshi@...ux.vnet.ibm.com,
pbonzini@...hat.com, alex.williamson@...hat.com,
pmorel@...ux.vnet.ibm.com, alifm@...ux.vnet.ibm.com,
mjrosato@...ux.vnet.ibm.com, jjherne@...ux.vnet.ibm.com,
thuth@...hat.com, pasic@...ux.vnet.ibm.com, berrange@...hat.com,
fiuczy@...ux.vnet.ibm.com, buendgen@...ibm.com,
frankja@...ux.ibm.com
Subject: Re: [PATCH v10 05/26] s390: vfio-ap: register matrix device with VFIO
mdev framework
On 09/20/2018 11:50 AM, Cornelia Huck wrote:
> On Wed, 12 Sep 2018 15:42:55 -0400
> Tony Krowiak <akrowiak@...ux.vnet.ibm.com> wrote:
>
>> From: Tony Krowiak <akrowiak@...ux.ibm.com>
>>
>> Registers the matrix device created by the VFIO AP device
>> driver with the VFIO mediated device framework.
>> Registering the matrix device will create the sysfs
>> structures needed to create mediated matrix devices
>> each of which will be used to configure the AP matrix
>> for a guest and connect it to the VFIO AP device driver.
>>
>> Registering the matrix device with the VFIO mediated device
>> framework will create the following sysfs structures:
>>
>> /sys/devices/vfio_ap/matrix/
>> ...... [mdev_supported_types]
>> ......... [vfio_ap-passthrough]
>> ............ create
>>
>> To create a mediated device for the AP matrix device, write a UUID
>> to the create file:
>>
>> uuidgen > create
>>
>> A symbolic link to the mediated device's directory will be created in the
>> devices subdirectory named after the generated $uuid:
>>
>> /sys/devices/vfio_ap/matrix/
>> ...... [mdev_supported_types]
>> ......... [vfio_ap-passthrough]
>> ............ [devices]
>> ............... [$uuid]
>>
>> A symbolic link to the mediated device will also be created
>> in the vfio_ap matrix's directory:
>>
>> /sys/devices/vfio_ap/matrix/[$uuid]
>>
>> Signed-off-by: Tony Krowiak <akrowiak@...ux.ibm.com>
>> Reviewed-by: Halil Pasic <pasic@...ux.ibm.com>
>> Tested-by: Michael Mueller <mimu@...ux.ibm.com>
>> Tested-by: Farhan Ali <alifm@...ux.ibm.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@...ibm.com>
>> ---
>> MAINTAINERS | 1 +
>> drivers/s390/crypto/Makefile | 2 +-
>> drivers/s390/crypto/vfio_ap_drv.c | 19 +++++
>> drivers/s390/crypto/vfio_ap_ops.c | 126 +++++++++++++++++++++++++++++++++
>> drivers/s390/crypto/vfio_ap_private.h | 49 +++++++++++++
>> include/uapi/linux/vfio.h | 1 +
>> 6 files changed, 197 insertions(+), 1 deletions(-)
>> create mode 100644 drivers/s390/crypto/vfio_ap_ops.c
> (...)
>
>> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
>> index 3e635f0..75f8bdc 100644
>> --- a/drivers/s390/crypto/vfio_ap_drv.c
>> +++ b/drivers/s390/crypto/vfio_ap_drv.c
>> @@ -76,6 +76,16 @@ static int vfio_ap_matrix_dev_create(void)
>> goto matrix_alloc_err;
>> }
>>
>> + /* Test if PQAP(QCI) instruction is available */
> /* Fill in config info via PQAP(QCI), if available */
Okay
>
> ?
>
>> + if (test_facility(12)) {
>> + ret = ap_qci(&matrix_dev->info);
>> + if (ret)
>> + goto matrix_alloc_err;
>> + }
>> +
>> + mutex_init(&matrix_dev->lock);
>> + INIT_LIST_HEAD(&matrix_dev->mdev_list);
>> +
>> matrix_dev->device.type = &vfio_ap_dev_type;
>> dev_set_name(&matrix_dev->device, "%s", VFIO_AP_DEV_NAME);
>> matrix_dev->device.parent = root_device;
> (...)
>
>> diff --git a/drivers/s390/crypto/vfio_ap_private.h b/drivers/s390/crypto/vfio_ap_private.h
>> index 6141420..a2eab78 100644
>> --- a/drivers/s390/crypto/vfio_ap_private.h
>> +++ b/drivers/s390/crypto/vfio_ap_private.h
>> @@ -3,6 +3,7 @@
>> * Private data and functions for adjunct processor VFIO matrix driver.
>> *
>> * Author(s): Tony Krowiak <akrowiak@...ux.ibm.com>
>> + * Halil Pasic <pasic@...ux.ibm.com>
>> *
>> * Copyright IBM Corp. 2018
>> */
>> @@ -24,11 +25,59 @@
>> /**
>> * ap_matrix_dev - the AP matrix device structure
>> * @device: generic device structure associated with the AP matrix device
>> + * @available_instances: number of mediated matrix devices that can be created
>> + * @info: the struct containing the output from the PQAP(TAPQ) instruction
> Hm, isn't that rather PQAP(QCI)?
Yes it is!
>
>> + * mdev_list: the list of mediated matrix devices created
>> + * lock: mutex for locking the AP matrix device. This lock will be
>> + * taken every time we fiddle with state managed by the vfio_ap
>> + * driver, be it using @mdev_list or writing the state of a
>> + * single ap_matrix_mdev device. It's quite coarse but we don't
>> + * expect much contention.
>> */
>> struct ap_matrix_dev {
>> struct device device;
>> + atomic_t available_instances;
>> + struct ap_config_info info;
>> + struct list_head mdev_list;
>> + struct mutex lock;
>> };
> Otherwise:
> Reviewed-by: Cornelia Huck <cohuck@...hat.com>
>
Powered by blists - more mailing lists