kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: borntraeger@de.ibm.com, alex.williamson@redhat.com,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	kvm@vger.kernel.org, frankja@linux.ibm.com,
	akrowiak@linux.ibm.com, pasic@linux.ibm.com, david@redhat.com,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	freude@linux.ibm.com, mimu@linux.ibm.com
Subject: Re: [PATCH v2 3/3] vfio: ap: AP Queue Interrupt Control VFIO ioctl calls
Date: Thu, 29 Nov 2018 13:44:51 +0100	[thread overview]
Message-ID: <8a0946c9-5c43-2f06-1ed0-c9ea9aeaa5fb@linux.ibm.com> (raw)
In-Reply-To: <20181129123726.62b04690.cohuck@redhat.com>

On 29/11/2018 12:37, Cornelia Huck wrote:
> On Thu, 22 Nov 2018 18:11:15 +0100
> Pierre Morel <pmorel@linux.ibm.com> wrote:
> 
>> This is the implementation of the VFIO ioctl calls to handle
>> the AQIC interception and use GISA to handle interrupts.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>>   drivers/s390/crypto/vfio_ap_ops.c | 110 +++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 109 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
>> index 272ef42..f6e942f 100644
>> --- a/drivers/s390/crypto/vfio_ap_ops.c
>> +++ b/drivers/s390/crypto/vfio_ap_ops.c
>> @@ -895,12 +895,121 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg)
>>   	return copy_to_user((void __user *)arg, &info, minsz);
>>   }
>>   
>> +static unsigned long vfio_ap_get_nib(struct kvm *kvm, struct vfio_ap_aqic *parm)
>> +{
>> +	struct s390_io_adapter *adapter;
>> +	struct s390_map_info *map;
>> +	unsigned long nib;
>> +	int found = 0;
>> +
>> +	/* find the adapter */
>> +	if (parm->adapter_id > MAX_S390_IO_ADAPTERS)
>> +		return 0;
>> +
>> +	adapter = kvm->arch.adapters[parm->adapter_id];
>> +	if (!adapter)
>> +		return 0;
>> +
>> +	down_write(&adapter->maps_lock);
>> +	list_for_each_entry(map, &adapter->maps, list) {
>> +		if (map->guest_addr == parm->nib) {
>> +			found = 1;
>> +			break;
>> +		}
>> +	}
>> +	up_write(&adapter->maps_lock);
> 
> Regardless of which user space interface you ultimately use: I think
> you should leave poking the adapter handling innards to the adapter
> code and instead create and use an interface to look up the mapping
> from the guest address.

Right...
Thanks

Pierre

> 
>> +
>> +	if (!found)
>> +		return 0;
>> +
>> +	nib = (unsigned long) page_address(map->page);
>> +	nib += (map->guest_addr & 0x0fff);
>> +
>> +	return nib;
>> +}
> 


-- 
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany

  reply	other threads:[~2018-11-29 12:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-22 17:11 [PATCH v2 0/3] s390: vfio: ap: Using GISA for AP Interrupt Pierre Morel
2018-11-22 17:11 ` [PATCH v2 1/3] vfio: ap: Add AP Queue Interruption Control facility Pierre Morel
2018-11-22 17:11 ` [PATCH v2 2/3] vfio: ap: ioctl definitions for AP Queue Interrupt Control Pierre Morel
2018-11-27 17:22   ` Alex Williamson
2018-11-27 17:46     ` Pierre Morel
2018-11-22 17:11 ` [PATCH v2 3/3] vfio: ap: AP Queue Interrupt Control VFIO ioctl calls Pierre Morel
2018-11-29 11:37   ` Cornelia Huck
2018-11-29 12:44     ` Pierre Morel [this message]
2018-12-03 10:04   ` Cornelia Huck
2018-12-03 10:20     ` Pierre Morel

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=8a0946c9-5c43-2f06-1ed0-c9ea9aeaa5fb@linux.ibm.com \
    --to=pmorel@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mimu@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=schwidefsky@de.ibm.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).