On 2020/12/29 ??7:41, Eli Cohen wrote:> On Wed, Dec 16, 2020 at 02:48:08PM +0800, Jason Wang wrote:
>> This patch converts the vhost-vDPA device to support multiple IOTLBs
>> tagged via ASID via hlist. This will be used for supporting multiple
>> address spaces in the following patches.
>>
>> Signed-off-by: Jason Wang <jasowang at redhat.com>
>> ---
>> drivers/vhost/vdpa.c | 106
++++++++++++++++++++++++++++++++-----------
>> 1 file changed, 80 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
>> index feb6a58df22d..060d5b5b7e64 100644
>> --- a/drivers/vhost/vdpa.c
>> +++ b/drivers/vhost/vdpa.c
>> @@ -33,13 +33,21 @@ enum {
>>
>> #define VHOST_VDPA_DEV_MAX (1U << MINORBITS)
>>
>> +#define VHOST_VDPA_IOTLB_BUCKETS 16
>> +
>> +struct vhost_vdpa_as {
>> + struct hlist_node hash_link;
>> + struct vhost_iotlb iotlb;
>> + u32 id;
>> +};
>> +
>> struct vhost_vdpa {
>> struct vhost_dev vdev;
>> struct iommu_domain *domain;
>> struct vhost_virtqueue *vqs;
>> struct completion completion;
>> struct vdpa_device *vdpa;
>> - struct vhost_iotlb *iotlb;
>> + struct hlist_head as[VHOST_VDPA_IOTLB_BUCKETS];
>> struct device dev;
>> struct cdev cdev;
>> atomic_t opened;
>> @@ -49,12 +57,64 @@ struct vhost_vdpa {
>> struct eventfd_ctx *config_ctx;
>> int in_batch;
>> struct vdpa_iova_range range;
>> + int used_as;
> This is not really used. Not in this patch and later removed.
Right, will remove this.
Thanks