Message ID | 20230111062809.25020-6-jasowang@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3158165wrt; Tue, 10 Jan 2023 22:32:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXsmQuWXEcIgbNmj4JFOk590mCCHblQkxIjZFhxzPpKS8utjTSZ0LmgYfDmV6OQssAcKR791 X-Received: by 2002:a05:6a00:e16:b0:581:12c5:1356 with SMTP id bq22-20020a056a000e1600b0058112c51356mr48896065pfb.30.1673418730535; Tue, 10 Jan 2023 22:32:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673418730; cv=none; d=google.com; s=arc-20160816; b=tZ7cMidd59Olu6kuwVBTIqAq5unGDv2Kjt+yzYPp0yWd8brgeRSZCx4qq4mB0u+kAL PuBwfVfEii9tpB6dFGRMKkvYiuxKF6yYtbuJzNo7fVErMcfJ0ypMRdILgHWUGEpfzNky 8jR9G4gq4ZpYD/Co+gRTtqVkherA95h1Z80YP/eqyfQ6zZqXP9zROmceVushWi1W3qCl iRr8Hw8yrGOOhWHyP3NhuHlgmwVKqsfZUseymD3qDSQo1GngIDU5DkbU85NeckPCFYFX zrNffro/TboWVSd0ljHL3BhyGUFuIgd2FBW+6Bb+Akyp/kTzj6Jw6dirvjn9HZMsYQr4 KN9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=epqvlkhFZV9FVfYN+D7bGXQ6MN72AZjZPKTBXiU7FN4=; b=GssfN724aJI7FwFuVbrQw6oOoaFiY9/ou8EOgw9fF66pvBJs/RjSFsSHH8XMtGWL91 Bn8RMQtO/++Kbqt3LYg6ICCfuXPBKODssK0mDBt2vFkSMafCllpj+Y1Ek+0UCMbv0Ozl Ar94NJ+dQtXArlWhqlCZ9YTAAa5KGB/caKXdlfNHgbGpjP2ZijEc3qop4QcepcEEvMJR ldeOs2M88oN0jeMmzMeMNo7jA14qB9BDffWHmdddgMQn0esItEfVxNSD/WTEL6hV1AsH 30mvX3mxfp4ds4uOWI+9Q44r+TNEAV117rq5DC3dbqXL/vUvUSsxeDLZx4JSshs7EuWz WoWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fD4tnag5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a056a0021c900b005778bad9750si13861006pfj.17.2023.01.10.22.31.57; Tue, 10 Jan 2023 22:32:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fD4tnag5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235385AbjAKGaB (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Wed, 11 Jan 2023 01:30:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235753AbjAKG32 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Jan 2023 01:29:28 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CB5299 for <linux-kernel@vger.kernel.org>; Tue, 10 Jan 2023 22:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673418517; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=epqvlkhFZV9FVfYN+D7bGXQ6MN72AZjZPKTBXiU7FN4=; b=fD4tnag5YRV8ayVliASTsVNeShVBqfA7k30SJmgNm5f6nsucWRkT9gs22kCyUnS6CXttlh cL2Sa2PI/UFZ/IvlXAjWooo+tJ0xrXe5H1EQG51LsopqoACWkAW8P2BzfkepfwdyNl6PXz 2FTKOHSt72kj4myY4SU+9vOau25Tf0I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-199-XCW145yROKq1MFbhN6r2iw-1; Wed, 11 Jan 2023 01:28:35 -0500 X-MC-Unique: XCW145yROKq1MFbhN6r2iw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE7E4801779; Wed, 11 Jan 2023 06:28:34 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-175.pek2.redhat.com [10.72.13.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2AAB4078904; Wed, 11 Jan 2023 06:28:31 +0000 (UTC) From: Jason Wang <jasowang@redhat.com> To: mst@redhat.com, jasowang@redhat.com Cc: elic@nvidia.com, gdawar@amd.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, tanuj.kamde@amd.com Subject: [PATCH 5/5] vdpa: mlx5: support per virtqueue dma device Date: Wed, 11 Jan 2023 14:28:09 +0800 Message-Id: <20230111062809.25020-6-jasowang@redhat.com> In-Reply-To: <20230111062809.25020-1-jasowang@redhat.com> References: <20230111062809.25020-1-jasowang@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754706718883321774?= X-GMAIL-MSGID: =?utf-8?q?1754706718883321774?= |
Series |
virtio_ring: per virtqueue DMA device
|
|
Commit Message
Jason Wang
Jan. 11, 2023, 6:28 a.m. UTC
This patch implements per virtqueue dma device for mlx5_vdpa. This is
needed for virtio_vdpa to work for CVQ which is backed by vringh but
not DMA. We simply advertise the vDPA device itself as the DMA device
for CVQ then DMA API can simply use PA so the identical mapping for
CVQ can still be used. Otherwise the identical (1:1) mapping won't
work when platform IOMMU is enabled since the IOVA is allocated on
demand which is not necessarily the PA.
This fixes the following crash when mlx5 vDPA device is bound to
virtio-vdpa with platform IOMMU enabled but not in passthrough mode:
BUG: unable to handle page fault for address: ff2fb3063deb1002
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 1393001067 P4D 1393002067 PUD 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
CPU: 55 PID: 8923 Comm: kworker/u112:3 Kdump: loaded Not tainted 6.1.0+ #7
Hardware name: Dell Inc. PowerEdge R750/0PJ80M, BIOS 1.5.4 12/17/2021
Workqueue: mlx5_vdpa_wq mlx5_cvq_kick_handler [mlx5_vdpa]
RIP: 0010:vringh_getdesc_iotlb+0x93/0x1d0 [vringh]
Code: 14 25 40 ef 01 00 83 82 c0 0a 00 00 01 48 2b 05 93 5a 1b ea 8b 4c 24 14 48 c1 f8 06 48 c1 e0 0c 48 03 05 90 5a 1b ea 48 01 c8 <0f> b7 00 83 aa c0 0a 00 00 01 65 ff 0d bc e4 41 3f 0f 84 05 01 00
RSP: 0018:ff46821ba664fdf8 EFLAGS: 00010282
RAX: ff2fb3063deb1002 RBX: 0000000000000a20 RCX: 0000000000000002
RDX: ff2fb318d2f94380 RSI: 0000000000000002 RDI: 0000000000000001
RBP: ff2fb3065e832410 R08: ff46821ba664fe00 R09: 0000000000000001
R10: 0000000000000000 R11: 000000000000000d R12: ff2fb3065e832488
R13: ff2fb3065e8324a8 R14: ff2fb3065e8324c8 R15: ff2fb3065e8324a8
FS: 0000000000000000(0000) GS:ff2fb3257fac0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ff2fb3063deb1002 CR3: 0000001392010006 CR4: 0000000000771ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
mlx5_cvq_kick_handler+0x89/0x2b0 [mlx5_vdpa]
process_one_work+0x1e2/0x3b0
? rescuer_thread+0x390/0x390
worker_thread+0x50/0x3a0
? rescuer_thread+0x390/0x390
kthread+0xd6/0x100
? kthread_complete_and_exit+0x20/0x20
ret_from_fork+0x1f/0x30
</TASK>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 11 +++++++++++
1 file changed, 11 insertions(+)
Comments
Hi Jason, I love your patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v6.2-rc3 next-20230111] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jason-Wang/virtio_ring-per-virtqueue-dma-device/20230111-143052 patch link: https://lore.kernel.org/r/20230111062809.25020-6-jasowang%40redhat.com patch subject: [PATCH 5/5] vdpa: mlx5: support per virtqueue dma device config: s390-allyesconfig compiler: s390-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/b7278272b70c83d953ebb0e5334dfc15c0b5c385 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Jason-Wang/virtio_ring-per-virtqueue-dma-device/20230111-143052 git checkout b7278272b70c83d953ebb0e5334dfc15c0b5c385 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/vdpa/mlx5/net/mlx5_vnet.c:2658:16: warning: no previous prototype for 'mlx5_get_vq_dma_dev' [-Wmissing-prototypes] 2658 | struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) | ^~~~~~~~~~~~~~~~~~~ vim +/mlx5_get_vq_dma_dev +2658 drivers/vdpa/mlx5/net/mlx5_vnet.c 2657 > 2658 struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) 2659 { 2660 struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); 2661 2662 if (is_ctrl_vq_idx(mvdev, idx)) 2663 return &vdev->dev; 2664 2665 return mvdev->vdev.dma_dev; 2666 } 2667
Hi Jason, I love your patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v6.2-rc3 next-20230111] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jason-Wang/virtio_ring-per-virtqueue-dma-device/20230111-143052 patch link: https://lore.kernel.org/r/20230111062809.25020-6-jasowang%40redhat.com patch subject: [PATCH 5/5] vdpa: mlx5: support per virtqueue dma device config: x86_64-allmodconfig compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/b7278272b70c83d953ebb0e5334dfc15c0b5c385 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Jason-Wang/virtio_ring-per-virtqueue-dma-device/20230111-143052 git checkout b7278272b70c83d953ebb0e5334dfc15c0b5c385 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/ drivers/vdpa/mlx5/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/vdpa/mlx5/net/mlx5_vnet.c:2658:16: warning: no previous prototype for function 'mlx5_get_vq_dma_dev' [-Wmissing-prototypes] struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) ^ drivers/vdpa/mlx5/net/mlx5_vnet.c:2658:1: note: declare 'static' if the function is not intended to be used outside of this translation unit struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) ^ static 1 warning generated. vim +/mlx5_get_vq_dma_dev +2658 drivers/vdpa/mlx5/net/mlx5_vnet.c 2657 > 2658 struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) 2659 { 2660 struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); 2661 2662 if (is_ctrl_vq_idx(mvdev, idx)) 2663 return &vdev->dev; 2664 2665 return mvdev->vdev.dma_dev; 2666 } 2667
> From: Jason Wang <jasowang@redhat.com> > Sent: Wednesday, 11 January 2023 8:28 > To: mst@redhat.com; jasowang@redhat.com > Cc: Eli Cohen <elic@nvidia.com>; gdawar@amd.com; > virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org; > tanuj.kamde@amd.com > Subject: [PATCH 5/5] vdpa: mlx5: support per virtqueue dma device > > This patch implements per virtqueue dma device for mlx5_vdpa. This is > needed for virtio_vdpa to work for CVQ which is backed by vringh but > not DMA. We simply advertise the vDPA device itself as the DMA device > for CVQ then DMA API can simply use PA so the identical mapping for > CVQ can still be used. Otherwise the identical (1:1) mapping won't > work when platform IOMMU is enabled since the IOVA is allocated on > demand which is not necessarily the PA. > > This fixes the following crash when mlx5 vDPA device is bound to > virtio-vdpa with platform IOMMU enabled but not in passthrough mode: > > BUG: unable to handle page fault for address: ff2fb3063deb1002 > #PF: supervisor read access in kernel mode > #PF: error_code(0x0000) - not-present page > PGD 1393001067 P4D 1393002067 PUD 0 > Oops: 0000 [#1] PREEMPT SMP NOPTI > CPU: 55 PID: 8923 Comm: kworker/u112:3 Kdump: loaded Not tainted 6.1.0+ > #7 > Hardware name: Dell Inc. PowerEdge R750/0PJ80M, BIOS 1.5.4 12/17/2021 > Workqueue: mlx5_vdpa_wq mlx5_cvq_kick_handler [mlx5_vdpa] > RIP: 0010:vringh_getdesc_iotlb+0x93/0x1d0 [vringh] > Code: 14 25 40 ef 01 00 83 82 c0 0a 00 00 01 48 2b 05 93 5a 1b ea 8b 4c 24 > 14 48 c1 f8 06 48 c1 e0 0c 48 03 05 90 5a 1b ea 48 01 c8 <0f> b7 00 83 aa c0 > 0a 00 00 01 65 ff 0d bc e4 41 3f 0f 84 05 01 00 > RSP: 0018:ff46821ba664fdf8 EFLAGS: 00010282 > RAX: ff2fb3063deb1002 RBX: 0000000000000a20 RCX: 0000000000000002 > RDX: ff2fb318d2f94380 RSI: 0000000000000002 RDI: 0000000000000001 > RBP: ff2fb3065e832410 R08: ff46821ba664fe00 R09: 0000000000000001 > R10: 0000000000000000 R11: 000000000000000d R12: ff2fb3065e832488 > R13: ff2fb3065e8324a8 R14: ff2fb3065e8324c8 R15: ff2fb3065e8324a8 > FS: 0000000000000000(0000) GS:ff2fb3257fac0000(0000) > knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: ff2fb3063deb1002 CR3: 0000001392010006 CR4: 0000000000771ee0 > DR0: 0000000000000000 DR1: 0000000000000000 DR2: > 0000000000000000 > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > PKRU: 55555554 > Call Trace: > <TASK> > mlx5_cvq_kick_handler+0x89/0x2b0 [mlx5_vdpa] > process_one_work+0x1e2/0x3b0 > ? rescuer_thread+0x390/0x390 > worker_thread+0x50/0x3a0 > ? rescuer_thread+0x390/0x390 > kthread+0xd6/0x100 > ? kthread_complete_and_exit+0x20/0x20 > ret_from_fork+0x1f/0x30 > </TASK> > > Signed-off-by: Jason Wang <jasowang@redhat.com> mlx5_get_vq_dma_dev needs to made static. Other than that: Reviewed-by: Eli Cohen <elic@nvidia.com> Tested-by: <elic@nvidia.com> Reviewed-by: Eli Cohen <elic@nvidia.com> Tested-by: <elic@nvidia.com> > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c > b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index 6632651b1e54..b0e74c25bf48 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -2682,6 +2682,16 @@ static int mlx5_vdpa_set_map(struct vdpa_device > *vdev, unsigned int asid, > return err; > } > > +struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) > +{ > + struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); > + > + if (is_ctrl_vq_idx(mvdev, idx)) > + return &vdev->dev; > + > + return mvdev->vdev.dma_dev; > +} > + > static void mlx5_vdpa_free(struct vdpa_device *vdev) > { > struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); > @@ -2897,6 +2907,7 @@ static const struct vdpa_config_ops mlx5_vdpa_ops > = { > .get_generation = mlx5_vdpa_get_generation, > .set_map = mlx5_vdpa_set_map, > .set_group_asid = mlx5_set_group_asid, > + .get_vq_dma_dev = mlx5_get_vq_dma_dev, > .free = mlx5_vdpa_free, > .suspend = mlx5_vdpa_suspend, > }; > -- > 2.25.1
On Sun, Jan 15, 2023 at 7:08 PM Eli Cohen <elic@nvidia.com> wrote: > > > From: Jason Wang <jasowang@redhat.com> > > Sent: Wednesday, 11 January 2023 8:28 > > To: mst@redhat.com; jasowang@redhat.com > > Cc: Eli Cohen <elic@nvidia.com>; gdawar@amd.com; > > virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org; > > tanuj.kamde@amd.com > > Subject: [PATCH 5/5] vdpa: mlx5: support per virtqueue dma device > > > > This patch implements per virtqueue dma device for mlx5_vdpa. This is > > needed for virtio_vdpa to work for CVQ which is backed by vringh but > > not DMA. We simply advertise the vDPA device itself as the DMA device > > for CVQ then DMA API can simply use PA so the identical mapping for > > CVQ can still be used. Otherwise the identical (1:1) mapping won't > > work when platform IOMMU is enabled since the IOVA is allocated on > > demand which is not necessarily the PA. > > > > This fixes the following crash when mlx5 vDPA device is bound to > > virtio-vdpa with platform IOMMU enabled but not in passthrough mode: > > > > BUG: unable to handle page fault for address: ff2fb3063deb1002 > > #PF: supervisor read access in kernel mode > > #PF: error_code(0x0000) - not-present page > > PGD 1393001067 P4D 1393002067 PUD 0 > > Oops: 0000 [#1] PREEMPT SMP NOPTI > > CPU: 55 PID: 8923 Comm: kworker/u112:3 Kdump: loaded Not tainted 6.1.0+ > > #7 > > Hardware name: Dell Inc. PowerEdge R750/0PJ80M, BIOS 1.5.4 12/17/2021 > > Workqueue: mlx5_vdpa_wq mlx5_cvq_kick_handler [mlx5_vdpa] > > RIP: 0010:vringh_getdesc_iotlb+0x93/0x1d0 [vringh] > > Code: 14 25 40 ef 01 00 83 82 c0 0a 00 00 01 48 2b 05 93 5a 1b ea 8b 4c 24 > > 14 48 c1 f8 06 48 c1 e0 0c 48 03 05 90 5a 1b ea 48 01 c8 <0f> b7 00 83 aa c0 > > 0a 00 00 01 65 ff 0d bc e4 41 3f 0f 84 05 01 00 > > RSP: 0018:ff46821ba664fdf8 EFLAGS: 00010282 > > RAX: ff2fb3063deb1002 RBX: 0000000000000a20 RCX: 0000000000000002 > > RDX: ff2fb318d2f94380 RSI: 0000000000000002 RDI: 0000000000000001 > > RBP: ff2fb3065e832410 R08: ff46821ba664fe00 R09: 0000000000000001 > > R10: 0000000000000000 R11: 000000000000000d R12: ff2fb3065e832488 > > R13: ff2fb3065e8324a8 R14: ff2fb3065e8324c8 R15: ff2fb3065e8324a8 > > FS: 0000000000000000(0000) GS:ff2fb3257fac0000(0000) > > knlGS:0000000000000000 > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > > CR2: ff2fb3063deb1002 CR3: 0000001392010006 CR4: 0000000000771ee0 > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: > > 0000000000000000 > > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > > PKRU: 55555554 > > Call Trace: > > <TASK> > > mlx5_cvq_kick_handler+0x89/0x2b0 [mlx5_vdpa] > > process_one_work+0x1e2/0x3b0 > > ? rescuer_thread+0x390/0x390 > > worker_thread+0x50/0x3a0 > > ? rescuer_thread+0x390/0x390 > > kthread+0xd6/0x100 > > ? kthread_complete_and_exit+0x20/0x20 > > ret_from_fork+0x1f/0x30 > > </TASK> > > > > Signed-off-by: Jason Wang <jasowang@redhat.com> > > mlx5_get_vq_dma_dev needs to made static. Right, I will fix it in v2. > Other than that: > Reviewed-by: Eli Cohen <elic@nvidia.com> > Tested-by: <elic@nvidia.com> Thanks > > Reviewed-by: Eli Cohen <elic@nvidia.com> > Tested-by: <elic@nvidia.com> > > --- > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > index 6632651b1e54..b0e74c25bf48 100644 > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > @@ -2682,6 +2682,16 @@ static int mlx5_vdpa_set_map(struct vdpa_device > > *vdev, unsigned int asid, > > return err; > > } > > > > +struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) > > +{ > > + struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); > > + > > + if (is_ctrl_vq_idx(mvdev, idx)) > > + return &vdev->dev; > > + > > + return mvdev->vdev.dma_dev; > > +} > > + > > static void mlx5_vdpa_free(struct vdpa_device *vdev) > > { > > struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); > > @@ -2897,6 +2907,7 @@ static const struct vdpa_config_ops mlx5_vdpa_ops > > = { > > .get_generation = mlx5_vdpa_get_generation, > > .set_map = mlx5_vdpa_set_map, > > .set_group_asid = mlx5_set_group_asid, > > + .get_vq_dma_dev = mlx5_get_vq_dma_dev, > > .free = mlx5_vdpa_free, > > .suspend = mlx5_vdpa_suspend, > > }; > > -- > > 2.25.1 >
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 6632651b1e54..b0e74c25bf48 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2682,6 +2682,16 @@ static int mlx5_vdpa_set_map(struct vdpa_device *vdev, unsigned int asid, return err; } +struct device *mlx5_get_vq_dma_dev(struct vdpa_device *vdev, u16 idx) +{ + struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); + + if (is_ctrl_vq_idx(mvdev, idx)) + return &vdev->dev; + + return mvdev->vdev.dma_dev; +} + static void mlx5_vdpa_free(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); @@ -2897,6 +2907,7 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = { .get_generation = mlx5_vdpa_get_generation, .set_map = mlx5_vdpa_set_map, .set_group_asid = mlx5_set_group_asid, + .get_vq_dma_dev = mlx5_get_vq_dma_dev, .free = mlx5_vdpa_free, .suspend = mlx5_vdpa_suspend, };