All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mika Penttilä" <mika.penttila@nextfour.com>
To: Jason Wang <jasowang@redhat.com>, Eli Cohen <elic@nvidia.com>,
	mst@redhat.com
Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vdpa/mlx5: Add support for doorbell bypassing
Date: Thu, 22 Apr 2021 06:27:02 +0300	[thread overview]
Message-ID: <a77efb06-b2ae-c94a-96bc-290b8b7332ba@nextfour.com> (raw)
In-Reply-To: <e1885255-34f2-9e90-6478-ff0850a5a3d4@redhat.com>



On 22.4.2021 5.37, Jason Wang wrote:
>
> 在 2021/4/21 下午6:41, Eli Cohen 写道:
>> Implement mlx5_get_vq_notification() to return the doorbell address.
>> Size is set to one system page as required.
>>
>> Signed-off-by: Eli Cohen <elic@nvidia.com>
>> ---
>>   drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 +
>>   drivers/vdpa/mlx5/core/resources.c | 1 +
>>   drivers/vdpa/mlx5/net/mlx5_vnet.c  | 6 ++++++
>>   3 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h 
>> b/drivers/vdpa/mlx5/core/mlx5_vdpa.h
>> index b6cc53ba980c..49de62cda598 100644
>> --- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h
>> +++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h
>> @@ -41,6 +41,7 @@ struct mlx5_vdpa_resources {
>>       u32 pdn;
>>       struct mlx5_uars_page *uar;
>>       void __iomem *kick_addr;
>> +    u64 phys_kick_addr;
>>       u16 uid;
>>       u32 null_mkey;
>>       bool valid;
>> diff --git a/drivers/vdpa/mlx5/core/resources.c 
>> b/drivers/vdpa/mlx5/core/resources.c
>> index 6521cbd0f5c2..665f8fc1710f 100644
>> --- a/drivers/vdpa/mlx5/core/resources.c
>> +++ b/drivers/vdpa/mlx5/core/resources.c
>> @@ -247,6 +247,7 @@ int mlx5_vdpa_alloc_resources(struct 
>> mlx5_vdpa_dev *mvdev)
>>           goto err_key;
>>         kick_addr = mdev->bar_addr + offset;
>> +    res->phys_kick_addr = kick_addr;
>>         res->kick_addr = ioremap(kick_addr, PAGE_SIZE);
>>       if (!res->kick_addr) {
>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c 
>> b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> index 10c5fef3c020..680751074d2a 100644
>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> @@ -1865,8 +1865,14 @@ static void mlx5_vdpa_free(struct vdpa_device 
>> *vdev)
>>     static struct vdpa_notification_area 
>> mlx5_get_vq_notification(struct vdpa_device *vdev, u16 idx)
>>   {
>> +    struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
>>       struct vdpa_notification_area ret = {};
>> +    struct mlx5_vdpa_net *ndev;
>> +
>> +    ndev = to_mlx5_vdpa_ndev(mvdev);
>>   +    ret.addr = (phys_addr_t)ndev->mvdev.res.phys_kick_addr;
>> +    ret.size = PAGE_SIZE;
>
>
> Note that the page will be mapped in to guest, so it's only safe if 
> the doorbeel exclusively own the page. This means if there're other 
> registers in the page, we can not let the doorbell bypass to work.
>
> So this is suspicious at least in the case of subfunction where we 
> calculate the bar length in mlx5_sf_dev_table_create() as:
>
> table->sf_bar_length = 1 << (MLX5_CAP_GEN(dev, log_min_sf_size) + 12);
>
> It looks to me this can only work for the arch with PAGE_SIZE = 4096, 
> otherwise we can map more into the userspace(guest).
>
> Thanks
>
>
Is there support as of today (in qemu  or elsewhere) to use this mmap 
doorbell instead of the traditional kick.

--Mika



>
>>       return ret;
>>   }
>


  reply	other threads:[~2021-04-22  3:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 10:41 [PATCH] vdpa/mlx5: Add support for doorbell bypassing Eli Cohen
2021-04-22  2:37 ` Jason Wang
2021-04-22  2:37   ` Jason Wang
2021-04-22  3:27   ` Mika Penttilä [this message]
2021-04-22  4:52     ` Jason Wang
2021-04-22  4:52       ` Jason Wang
2021-04-22  6:03   ` Eli Cohen
2021-04-22  8:07     ` Eli Cohen
2021-04-22  8:21       ` Jason Wang
2021-04-22  8:21         ` Jason Wang
2021-04-22  8:39         ` Eli Cohen
2021-04-22  8:59           ` Jason Wang
2021-04-22  8:59             ` Jason Wang
2021-04-25 13:25             ` Eli Cohen
2021-04-26  2:35               ` Jason Wang
2021-04-26  2:35                 ` Jason Wang
2021-04-28 20:53                 ` Si-Wei Liu
2021-04-29  2:43                   ` Jason Wang
2021-04-29  2:43                     ` Jason Wang
2021-04-29 10:00             ` Eli Cohen
2021-04-30  4:40               ` Jason Wang
2021-04-30  4:40                 ` Jason Wang
2021-04-30  6:31                 ` Zhu, Lingshan
2021-04-30  7:03                   ` Jason Wang
2021-04-30  7:03                     ` Jason Wang
2021-04-30  9:25                     ` Zhu, Lingshan
2021-04-30 13:49                       ` Jason Wang
2021-04-30 13:49                         ` 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=a77efb06-b2ae-c94a-96bc-290b8b7332ba@nextfour.com \
    --to=mika.penttila@nextfour.com \
    --cc=elic@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.