diff mbox series

[v9,18/22] s390: vfio-ap: implement VFIO_DEVICE_RESET ioctl

Message ID 1534196899-16987-19-git-send-email-akrowiak@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show
Series guest dedicated crypto adapters | expand

Commit Message

Tony Krowiak Aug. 13, 2018, 9:48 p.m. UTC
From: Tony Krowiak <akrowiak@linux.ibm.com>

Implements the VFIO_DEVICE_RESET ioctl. This ioctl zeroizes
all of the AP queues assigned to the guest.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Michael Mueller <mimu@linux.ibm.com>
Tested-by: Farhan Ali <alifm@linux.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 drivers/s390/crypto/vfio_ap_ops.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Cornelia Huck Aug. 15, 2018, 4:38 p.m. UTC | #1
On Mon, 13 Aug 2018 17:48:15 -0400
Tony Krowiak <akrowiak@linux.vnet.ibm.com> wrote:

> From: Tony Krowiak <akrowiak@linux.ibm.com>
> 
> Implements the VFIO_DEVICE_RESET ioctl. This ioctl zeroizes
> all of the AP queues assigned to the guest.
> 
> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
> Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
> Tested-by: Michael Mueller <mimu@linux.ibm.com>
> Tested-by: Farhan Ali <alifm@linux.ibm.com>
> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
> Tested-by: Pierre Morel <pmorel@linux.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  drivers/s390/crypto/vfio_ap_ops.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index cc90323..d4a065b 100644
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -832,7 +832,7 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg)
>  	if (info.argsz < minsz)
>  		return -EINVAL;
>  
> -	info.flags = VFIO_DEVICE_FLAGS_AP;
> +	info.flags = VFIO_DEVICE_FLAGS_AP | VFIO_DEVICE_FLAGS_RESET;
>  	info.num_regions = 0;
>  	info.num_irqs = 0;
>  
> @@ -848,6 +848,9 @@ static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,
>  	case VFIO_DEVICE_GET_INFO:
>  		ret = vfio_ap_mdev_get_device_info(arg);
>  		break;
> +	case VFIO_DEVICE_RESET:
> +		ret = vfio_ap_mdev_reset_queues(mdev, true);

If I see it correctly, you call this function only ever with force ==
true (here and in the previous patch). Is that what you intended?

> +		break;
>  	default:
>  		ret = -EOPNOTSUPP;
>  		break;
Anthony Krowiak Aug. 15, 2018, 9:05 p.m. UTC | #2
On 08/15/2018 12:38 PM, Cornelia Huck wrote:
> On Mon, 13 Aug 2018 17:48:15 -0400
> Tony Krowiak <akrowiak@linux.vnet.ibm.com> wrote:
>
>> From: Tony Krowiak <akrowiak@linux.ibm.com>
>>
>> Implements the VFIO_DEVICE_RESET ioctl. This ioctl zeroizes
>> all of the AP queues assigned to the guest.
>>
>> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
>> Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
>> Tested-by: Michael Mueller <mimu@linux.ibm.com>
>> Tested-by: Farhan Ali <alifm@linux.ibm.com>
>> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
>> Tested-by: Pierre Morel <pmorel@linux.ibm.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>   drivers/s390/crypto/vfio_ap_ops.c |    5 ++++-
>>   1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
>> index cc90323..d4a065b 100644
>> --- a/drivers/s390/crypto/vfio_ap_ops.c
>> +++ b/drivers/s390/crypto/vfio_ap_ops.c
>> @@ -832,7 +832,7 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg)
>>   	if (info.argsz < minsz)
>>   		return -EINVAL;
>>   
>> -	info.flags = VFIO_DEVICE_FLAGS_AP;
>> +	info.flags = VFIO_DEVICE_FLAGS_AP | VFIO_DEVICE_FLAGS_RESET;
>>   	info.num_regions = 0;
>>   	info.num_irqs = 0;
>>   
>> @@ -848,6 +848,9 @@ static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,
>>   	case VFIO_DEVICE_GET_INFO:
>>   		ret = vfio_ap_mdev_get_device_info(arg);
>>   		break;
>> +	case VFIO_DEVICE_RESET:
>> +		ret = vfio_ap_mdev_reset_queues(mdev, true);
> If I see it correctly, you call this function only ever with force ==
> true (here and in the previous patch). Is that what you intended?

That does seem to be the case now; however, I think at one time there were
additional calls to this function. For some reason of which I am not aware,
those were removed, so there is probably no need for it now.

>
>> +		break;
>>   	default:
>>   		ret = -EOPNOTSUPP;
>>   		break;
Cornelia Huck Aug. 17, 2018, 9:38 a.m. UTC | #3
On Wed, 15 Aug 2018 17:05:48 -0400
Tony Krowiak <akrowiak@linux.ibm.com> wrote:

> On 08/15/2018 12:38 PM, Cornelia Huck wrote:
> > On Mon, 13 Aug 2018 17:48:15 -0400
> > Tony Krowiak <akrowiak@linux.vnet.ibm.com> wrote:

> >> +	case VFIO_DEVICE_RESET:
> >> +		ret = vfio_ap_mdev_reset_queues(mdev, true);  
> > If I see it correctly, you call this function only ever with force ==
> > true (here and in the previous patch). Is that what you intended?  
> 
> That does seem to be the case now; however, I think at one time there were
> additional calls to this function. For some reason of which I am not aware,
> those were removed, so there is probably no need for it now.

If you don't see a need for it anymore, I'd just remove the parameter.
Even makes vfio_ap_mdev_reset_queues() a bit nicer :)
Anthony Krowiak Aug. 17, 2018, 7:03 p.m. UTC | #4
On 08/17/2018 05:38 AM, Cornelia Huck wrote:
> On Wed, 15 Aug 2018 17:05:48 -0400
> Tony Krowiak <akrowiak@linux.ibm.com> wrote:
>
>> On 08/15/2018 12:38 PM, Cornelia Huck wrote:
>>> On Mon, 13 Aug 2018 17:48:15 -0400
>>> Tony Krowiak <akrowiak@linux.vnet.ibm.com> wrote:
>>>> +	case VFIO_DEVICE_RESET:
>>>> +		ret = vfio_ap_mdev_reset_queues(mdev, true);
>>> If I see it correctly, you call this function only ever with force ==
>>> true (here and in the previous patch). Is that what you intended?
>> That does seem to be the case now; however, I think at one time there were
>> additional calls to this function. For some reason of which I am not aware,
>> those were removed, so there is probably no need for it now.
> If you don't see a need for it anymore, I'd just remove the parameter.
> Even makes vfio_ap_mdev_reset_queues() a bit nicer :)

I guess I wasn't clear, I intended to remove it.

>
diff mbox series

Patch

diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index cc90323..d4a065b 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -832,7 +832,7 @@  static int vfio_ap_mdev_get_device_info(unsigned long arg)
 	if (info.argsz < minsz)
 		return -EINVAL;
 
-	info.flags = VFIO_DEVICE_FLAGS_AP;
+	info.flags = VFIO_DEVICE_FLAGS_AP | VFIO_DEVICE_FLAGS_RESET;
 	info.num_regions = 0;
 	info.num_irqs = 0;
 
@@ -848,6 +848,9 @@  static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,
 	case VFIO_DEVICE_GET_INFO:
 		ret = vfio_ap_mdev_get_device_info(arg);
 		break;
+	case VFIO_DEVICE_RESET:
+		ret = vfio_ap_mdev_reset_queues(mdev, true);
+		break;
 	default:
 		ret = -EOPNOTSUPP;
 		break;