mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Si-Wei Liu <si-wei.liu@oracle.com>
To: Jason Wang <jasowang@redhat.com>
Cc: eperezma@redhat.com, gal@nvidia.com,
	linux-kernel@vger.kernel.org, mst@redhat.com,
	virtualization@lists.linux-foundation.org,
	xuanzhuo@linux.alibaba.com
Subject: Re: [PATCH RFC 1/4] vdpa: introduce .reset_map operation callback
Date: Tue, 15 Aug 2023 12:49:15 -0700	[thread overview]
Message-ID: <ebc38dc4-ed43-6a1d-5368-ae75269e6b43@oracle.com> (raw)
In-Reply-To: <CACGkMEuGeXYo3s6Ytd-Nvp7EXU6td1NY6LrLcVgntprXJwBEhQ@mail.gmail.com>



On 8/14/2023 7:21 PM, Jason Wang wrote:
> On Tue, Aug 15, 2023 at 9:46 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote:
>> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
>> ---
>>   include/linux/vdpa.h | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
>> index db1b0ea..3a3878d 100644
>> --- a/include/linux/vdpa.h
>> +++ b/include/linux/vdpa.h
>> @@ -314,6 +314,12 @@ struct vdpa_map_file {
>>    *                             @iova: iova to be unmapped
>>    *                             @size: size of the area
>>    *                             Returns integer: success (0) or error (< 0)
>> + * @reset_map:                 Reset device memory mapping (optional)
>> + *                             Needed for device that using device
>> + *                             specific DMA translation (on-chip IOMMU)
> This exposes the device internal to the upper layer which is not optimal.
Not sure what does it mean by "device internal", but this op callback 
just follows existing convention to describe what vdpa parent this API 
targets.

  * @set_map:                    Set device memory mapping (optional)
  *                              Needed for device that using device
  *                              specific DMA translation (on-chip IOMMU)
:
:
  * @dma_map:                    Map an area of PA to IOVA (optional)
  *                              Needed for device that using device
  *                              specific DMA translation (on-chip IOMMU)
  *                              and preferring incremental map.
:
:
  * @dma_unmap:                  Unmap an area of IOVA (optional but
  *                              must be implemented with dma_map)
  *                              Needed for device that using device
  *                              specific DMA translation (on-chip IOMMU)
  *                              and preferring incremental unmap.


> Btw, what's the difference between this and a simple
>
> set_map(NULL)?
I don't think parent drivers support this today - they can accept 
non-NULL iotlb containing empty map entry, but not a NULL iotlb. The 
behavior is undefined or it even causes panic when a NULL iotlb is 
passed in. Further this doesn't work with .dma_map parent drivers.

The reason why a new op is needed or better is because it allows 
userspace to tell apart different reset behavior from the older kernel 
(via the F_IOTLB_PERSIST feature bit in patch 4), while this behavior 
could vary between parent drivers.

Regards,
-Siwei

>
> Thanks
>
>> + *                             @vdev: vdpa device
>> + *                             @asid: address space identifier
>> + *                             Returns integer: success (0) or error (< 0)
>>    * @get_vq_dma_dev:            Get the dma device for a specific
>>    *                             virtqueue (optional)
>>    *                             @vdev: vdpa device
>> @@ -390,6 +396,7 @@ struct vdpa_config_ops {
>>                         u64 iova, u64 size, u64 pa, u32 perm, void *opaque);
>>          int (*dma_unmap)(struct vdpa_device *vdev, unsigned int asid,
>>                           u64 iova, u64 size);
>> +       int (*reset_map)(struct vdpa_device *vdev, unsigned int asid);
>>          int (*set_group_asid)(struct vdpa_device *vdev, unsigned int group,
>>                                unsigned int asid);
>>          struct device *(*get_vq_dma_dev)(struct vdpa_device *vdev, u16 idx);
>> --
>> 1.8.3.1
>>


  reply	other threads:[~2023-08-15 19:50 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 17:12 [PATCH 0/2] vdpa/mlx5: Fixes for ASID handling Dragos Tatulea
2023-08-02 17:12 ` [PATCH 1/2] vdpa/mlx5: Fix mr->initialized semantics Dragos Tatulea
2023-08-03  8:03   ` Jason Wang
2023-08-03 11:40     ` Dragos Tatulea
2023-08-08  2:57       ` Jason Wang
2023-08-08  7:24         ` Dragos Tatulea
2023-08-09  1:42           ` Jason Wang
2023-08-14 14:15             ` Dragos Tatulea
2023-08-15  1:28               ` Jason Wang
2023-08-03 17:57     ` Si-Wei Liu
2023-08-08  3:00       ` Jason Wang
2023-08-08 22:58         ` Si-Wei Liu
2023-08-09  6:52           ` Jason Wang
2023-08-10  0:40             ` Si-Wei Liu
2023-08-10  3:10               ` Jason Wang
2023-08-10 22:20                 ` Si-Wei Liu
2023-08-14  2:59                   ` Jason Wang
2023-08-15  1:43                     ` [PATCH RFC 0/4] vdpa: decouple reset of iotlb mapping from device reset Si-Wei Liu
2023-08-15  1:43                       ` [PATCH RFC 1/4] vdpa: introduce .reset_map operation callback Si-Wei Liu
2023-08-15  2:21                         ` Jason Wang
2023-08-15 19:49                           ` Si-Wei Liu [this message]
2023-08-16  1:55                             ` Jason Wang
2023-08-17  0:05                               ` Si-Wei Liu
2023-08-17 15:28                                 ` Eugenio Perez Martin
2023-08-21 22:31                                   ` Si-Wei Liu
2023-08-15  1:43                       ` [PATCH RFC 2/4] vdpa/mlx5: implement .reset_map driver op Si-Wei Liu
2023-08-15  8:26                         ` Dragos Tatulea
2023-08-15 23:11                           ` Si-Wei Liu
2023-08-15  1:43                       ` [PATCH RFC 3/4] vhost-vdpa: should restore 1:1 dma mapping before detaching driver Si-Wei Liu
2023-08-15  2:32                         ` Jason Wang
2023-08-15 23:09                           ` Si-Wei Liu
2023-08-15  1:43                       ` [PATCH RFC 4/4] vhost-vdpa: introduce IOTLB_PERSIST backend feature bit Si-Wei Liu
2023-08-15  2:25                         ` Jason Wang
2023-08-15 22:30                           ` Si-Wei Liu
2023-08-16  1:48                             ` Jason Wang
2023-08-16 23:43                               ` Si-Wei Liu
2023-08-22  8:54                                 ` Jason Wang
2023-08-28 23:46                                   ` Si-Wei Liu
2023-08-02 17:12 ` [PATCH 2/2] vdpa/mlx5: Delete control vq iotlb in destroy_mr only when necessary Dragos Tatulea
2023-08-10  8:54 ` [PATCH 0/2] vdpa/mlx5: Fixes for ASID handling Michael S. Tsirkin
2023-08-10  8:59   ` Jason Wang
2023-08-10  9:04   ` Dragos Tatulea

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=ebc38dc4-ed43-6a1d-5368-ae75269e6b43@oracle.com \
    --to=si-wei.liu@oracle.com \
    --cc=eperezma@redhat.com \
    --cc=gal@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.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

all inboxes | Powered by JetHome®