mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, rob.miller@broadcom.com,
	lingshan.zhu@intel.com, eperezma@redhat.com, lulu@redhat.com,
	shahafs@mellanox.com, hanand@xilinx.com, mhabets@solarflare.com,
	gdawar@xilinx.com, saugatm@xilinx.com, vmireyno@marvell.com,
	zhangweining@ruijie.com.cn, eli@mellanox.com
Subject: Re: [PATCH 3/4] vdpa: get_iova_range() is mandatory for device specific DMA translation
Date: Thu, 6 Aug 2020 11:27:16 +0800	[thread overview]
Message-ID: <d371771e-b17a-8ccb-e185-4762b9ac0914@redhat.com> (raw)
In-Reply-To: <20200805085217-mutt-send-email-mst@kernel.org>


On 2020/8/5 下午8:55, Michael S. Tsirkin wrote:
> On Wed, Jun 17, 2020 at 11:29:46AM +0800, Jason Wang wrote:
>> In order to let userspace work correctly, get_iova_range() is a must
>> for the device that has its own DMA translation logic.
> I guess you mean for a device.
>
> However in absence of ths op, I don't see what is wrong with just
> assuming device can access any address.


It's just for safe, if you want, we can assume any address without this op.


>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>>   drivers/vdpa/vdpa.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>> index de211ef3738c..ab7af978ef70 100644
>> --- a/drivers/vdpa/vdpa.c
>> +++ b/drivers/vdpa/vdpa.c
>> @@ -82,6 +82,10 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent,
>>   	if (!!config->dma_map != !!config->dma_unmap)
>>   		goto err;
>>   
>> +	if ((config->dma_map || config->set_map) &&
>> +	    !config->get_iova_range)
>> +		goto err;
>> +
>>   	err = -ENOMEM;
>>   	vdev = kzalloc(size, GFP_KERNEL);
>>   	if (!vdev)
> What about devices using an IOMMU for translation?
> IOMMUs generally have a limited IOVA range too, right?


See patch 4 which query the IOMMU geometry in this case:

+        iommu_domain_get_attr(v->domain,
+                      DOMAIN_ATTR_GEOMETRY, &geo);
+        range.start = geo.aperture_start;
+        range.end = geo.aperture_end;

Thanks


>
>
>
>> -- 
>> 2.20.1


  reply	other threads:[~2020-08-06  3:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17  3:29 [PATCH 0/4] vDPA: API for reporting IOVA range Jason Wang
2020-06-17  3:29 ` [PATCH 1/4] vdpa: introduce config op to get valid iova range Jason Wang
2020-08-05 12:51   ` Michael S. Tsirkin
2020-08-06  3:25     ` Jason Wang
2020-08-06  5:54       ` Michael S. Tsirkin
2020-08-06 12:03     ` Eli Cohen
2020-08-06 12:29       ` Michael S. Tsirkin
2020-08-06 12:43         ` Eli Cohen
2020-08-10 12:05           ` Michael S. Tsirkin
2020-08-11  2:53             ` Jason Wang
2020-08-11  8:29               ` Michael S. Tsirkin
2020-08-12  2:02                 ` Jason Wang
2020-08-07  3:23         ` Jason Wang
2020-08-06 12:10   ` Eli Cohen
2020-08-07  3:04     ` Jason Wang
2020-06-17  3:29 ` [PATCH 2/4] vdpa_sim: implement get_iova_range bus operation Jason Wang
2020-06-17  3:29 ` [PATCH 3/4] vdpa: get_iova_range() is mandatory for device specific DMA translation Jason Wang
2020-08-05 12:55   ` Michael S. Tsirkin
2020-08-06  3:27     ` Jason Wang [this message]
2020-06-17  3:29 ` [PATCH 4/4] vhost: vdpa: report iova range Jason Wang
2020-08-05 12:58   ` Michael S. Tsirkin
2020-08-06  3:29     ` Jason Wang
2020-08-06  5:55       ` Michael S. Tsirkin
2020-10-21 14:45 ` [PATCH 0/4] vDPA: API for reporting IOVA range Michael S. Tsirkin
2020-10-22  5:47   ` Jason Wang

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=d371771e-b17a-8ccb-e185-4762b9ac0914@redhat.com \
    --to=jasowang@redhat.com \
    --cc=eli@mellanox.com \
    --cc=eperezma@redhat.com \
    --cc=gdawar@xilinx.com \
    --cc=hanand@xilinx.com \
    --cc=lingshan.zhu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lulu@redhat.com \
    --cc=mhabets@solarflare.com \
    --cc=mst@redhat.com \
    --cc=rob.miller@broadcom.com \
    --cc=saugatm@xilinx.com \
    --cc=shahafs@mellanox.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vmireyno@marvell.com \
    --cc=zhangweining@ruijie.com.cn \
    /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

Powered by JetHome