[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230312120157.452859-2-ray.huang@amd.com>
Date: Sun, 12 Mar 2023 20:01:53 +0800
From: Huang Rui <ray.huang@....com>
To: Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Roger Pau Monné <roger.pau@...rix.com>,
<xen-devel@...ts.xenproject.org>, <linux-kernel@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>, <amd-gfx@...ts.freedesktop.org>
CC: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Stewart Hildebrand" <Stewart.Hildebrand@....com>,
Xenia Ragiadakou <burzalodowa@...il.com>,
Honglei Huang <honglei1.huang@....com>,
Julia Zhang <julia.zhang@....com>,
Chen Jiqian <Jiqian.Chen@....com>,
Huang Rui <ray.huang@....com>
Subject: [RFC PATCH 1/5] x86/xen: disable swiotlb for xen pvh
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@....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
Powered by blists - more mailing lists