All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Rui <ray.huang@amd.com>
To: "Juergen Gross" <jgross@suse.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: "Honglei Huang" <honglei1.huang@amd.com>,
	"Stewart Hildebrand" <Stewart.Hildebrand@amd.com>,
	"Huang Rui" <ray.huang@amd.com>,
	"Chen Jiqian" <Jiqian.Chen@amd.com>,
	"Xenia Ragiadakou" <burzalodowa@gmail.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Julia Zhang" <julia.zhang@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [RFC PATCH 1/5] x86/xen: disable swiotlb for xen pvh
Date: Sun, 12 Mar 2023 20:01:53 +0800	[thread overview]
Message-ID: <20230312120157.452859-2-ray.huang@amd.com> (raw)
In-Reply-To: <20230312120157.452859-1-ray.huang@amd.com>

Xen PVH is the paravirtualized mode and takes advantage of hardware
virtualization support when possible. It will using the hardware IOMMU
support instead of xen-swiotlb, so disable swiotlb if current domain is
Xen PVH.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 arch/x86/kernel/pci-dma.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 30bbe4abb5d6..f5c73dd18f2a 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -74,6 +74,12 @@ static inline void __init pci_swiotlb_detect(void)
 #ifdef CONFIG_SWIOTLB_XEN
 static void __init pci_xen_swiotlb_init(void)
 {
+	/* Xen PVH domain won't use swiotlb */
+	if (xen_pvh_domain()) {
+		x86_swiotlb_enable = false;
+		return;
+	}
+
 	if (!xen_initial_domain() && !x86_swiotlb_enable)
 		return;
 	x86_swiotlb_enable = true;
@@ -86,7 +92,7 @@ static void __init pci_xen_swiotlb_init(void)
 
 int pci_xen_swiotlb_init_late(void)
 {
-	if (dma_ops == &xen_swiotlb_dma_ops)
+	if (xen_pvh_domain() || dma_ops == &xen_swiotlb_dma_ops)
 		return 0;
 
 	/* we can work with the default swiotlb */
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Huang Rui <ray.huang@amd.com>
To: "Juergen Gross" <jgross@suse.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Stewart Hildebrand" <Stewart.Hildebrand@amd.com>,
	"Xenia Ragiadakou" <burzalodowa@gmail.com>,
	"Honglei Huang" <honglei1.huang@amd.com>,
	"Julia Zhang" <julia.zhang@amd.com>,
	"Chen Jiqian" <Jiqian.Chen@amd.com>,
	"Huang Rui" <ray.huang@amd.com>
Subject: [RFC PATCH 1/5] x86/xen: disable swiotlb for xen pvh
Date: Sun, 12 Mar 2023 20:01:53 +0800	[thread overview]
Message-ID: <20230312120157.452859-2-ray.huang@amd.com> (raw)
In-Reply-To: <20230312120157.452859-1-ray.huang@amd.com>

Xen PVH is the paravirtualized mode and takes advantage of hardware
virtualization support when possible. It will using the hardware IOMMU
support instead of xen-swiotlb, so disable swiotlb if current domain is
Xen PVH.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 arch/x86/kernel/pci-dma.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 30bbe4abb5d6..f5c73dd18f2a 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -74,6 +74,12 @@ static inline void __init pci_swiotlb_detect(void)
 #ifdef CONFIG_SWIOTLB_XEN
 static void __init pci_xen_swiotlb_init(void)
 {
+	/* Xen PVH domain won't use swiotlb */
+	if (xen_pvh_domain()) {
+		x86_swiotlb_enable = false;
+		return;
+	}
+
 	if (!xen_initial_domain() && !x86_swiotlb_enable)
 		return;
 	x86_swiotlb_enable = true;
@@ -86,7 +92,7 @@ static void __init pci_xen_swiotlb_init(void)
 
 int pci_xen_swiotlb_init_late(void)
 {
-	if (dma_ops == &xen_swiotlb_dma_ops)
+	if (xen_pvh_domain() || dma_ops == &xen_swiotlb_dma_ops)
 		return 0;
 
 	/* we can work with the default swiotlb */
-- 
2.25.1



  reply	other threads:[~2023-03-12 12:02 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12 12:01 [RFC PATCH 0/5] Add Xen PVH dom0 support for GPU Huang Rui
2023-03-12 12:01 ` Huang Rui
2023-03-12 12:01 ` Huang Rui [this message]
2023-03-12 12:01   ` [RFC PATCH 1/5] x86/xen: disable swiotlb for xen pvh Huang Rui
2023-03-13  8:56   ` Jan Beulich
2023-03-13  8:56     ` Jan Beulich
2023-03-15  0:52     ` Stefano Stabellini
2023-03-15  0:52       ` Stefano Stabellini
2023-03-15  4:14       ` Huang Rui
2023-03-15  4:14         ` Huang Rui
2023-03-15  6:52         ` Jan Beulich
2023-03-15  6:52           ` Jan Beulich
2023-03-15  6:49       ` Jan Beulich
2023-03-15  6:49         ` Jan Beulich
2023-03-15 23:25         ` Stefano Stabellini
2023-03-15 23:25           ` Stefano Stabellini
2023-03-16  7:50           ` Jan Beulich
2023-03-16  7:50             ` Jan Beulich
2023-03-16 13:45             ` Alex Deucher
2023-03-16 13:45               ` Alex Deucher
2023-03-16 13:48               ` Juergen Gross
2023-03-16 13:48                 ` Juergen Gross
2023-03-16 13:53                 ` Alex Deucher
2023-03-16 13:53                   ` Alex Deucher
2023-03-16 13:58                   ` Jan Beulich
2023-03-16 13:58                     ` Jan Beulich
2023-03-16 14:20                   ` Juergen Gross
2023-03-16 14:20                     ` Juergen Gross
2023-03-16 23:09                     ` Stefano Stabellini
2023-03-16 23:09                       ` Stefano Stabellini
2023-03-16 23:09                       ` Stefano Stabellini
2023-03-17 10:19                       ` Roger Pau Monné
2023-03-17 10:19                         ` Roger Pau Monné
2023-03-17 10:19                         ` Roger Pau Monné
2023-03-17 14:45                       ` Alex Deucher
2023-03-17 14:45                         ` Alex Deucher
2023-03-21 18:55                         ` Christian König
2023-03-21 18:55                           ` Christian König
2023-03-16 16:28   ` Roger Pau Monné
2023-03-16 16:28     ` Roger Pau Monné
2023-03-12 12:01 ` [RFC PATCH 2/5] xen/grants: update initialization order of xen grant table Huang Rui
2023-03-12 12:01   ` Huang Rui
2023-03-15 12:31   ` Roger Pau Monné
2023-03-15 12:31     ` Roger Pau Monné
2023-03-12 12:01 ` [RFC PATCH 3/5] drm/amdgpu: set passthrough mode for xen pvh/hvm Huang Rui
2023-03-12 12:01   ` Huang Rui
2023-03-15 12:42   ` Roger Pau Monné
2023-03-15 12:42     ` Roger Pau Monné
2023-03-12 12:01 ` [RFC PATCH 4/5] x86/xen: acpi registers gsi for xen pvh Huang Rui
2023-03-12 12:01   ` Huang Rui
2023-03-15 14:00   ` Roger Pau Monné
2023-03-15 14:00     ` Roger Pau Monné
2023-03-12 12:01 ` [RFC PATCH 5/5] xen/privcmd: add IOCTL_PRIVCMD_GSI_FROM_IRQ Huang Rui
2023-03-12 12:01   ` Huang Rui
2023-03-15 14:26   ` Roger Pau Monné
2023-03-15 14:26     ` Roger Pau Monné

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=20230312120157.452859-2-ray.huang@amd.com \
    --to=ray.huang@amd.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=Stewart.Hildebrand@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=burzalodowa@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=honglei1.huang@amd.com \
    --cc=jgross@suse.com \
    --cc=julia.zhang@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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.