[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 1/5] x86/xen: disable swiotlb for xen pvh


  • To: Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>, <dri-devel@xxxxxxxxxxxxxxxxxxxxx>, <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
  • From: Huang Rui <ray.huang@xxxxxxx>
  • Date: Sun, 12 Mar 2023 20:01:53 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qEv7WzFyAvZ7dlaf6PHictVoky/OV/XaCF4pEssIZF0=; b=MBGi1mSmmJckLHpboYEI4H07AsPEBRGMSUZpzcKC9q1W3t2d2d2qdlWVwo3ZMbTjDRwob1zQyed8oUHsFHc/ZpaGSiybPmIbprst/5Gp6b3T/bhA0OTldMelffZPaaLDhlqa8dwSKi+eJM8Zm7a9CtNkyrMviB7xO2JsF6poz3ZtZSVSEJDulgIvcvvh7uzZELdBjZ7LMtVnfau5uCgaYapsjPcCKbYXMaP4Ren3aZrFWktEgXMJanOS88aLU+eg627EBHfqFQoSbtIxT2Y1OVh2CuZzVWjwoVqEqATArcwa2eFuTuo4CWmmWT+5v4b+s7Ycbi7v7Xhqks75ARnJqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BfZPUJ/B3HJSaWZSAN6avLqq+vfV2HR7hyAjwVdrXWeu/UOleniCAO7sGRz9rkWiMkd5WLKN0XqmGmNDw+UAnmbC7YoC6V1Y1uw7jXvOu55pw331yyEwjTNdATlxPETpqnlJ+/LyQK/lt2QRoKKyqATZ8LtmSp6Q5pKlTtAYAJpf7Fb0bO7ty/9f/EhS8dXoPlgLZvNxVMjGMSRBa062EfO1rwN+57E6fKRivvbcr0bNkZOgwnBnXc8xZZ7tzhorMw8WAgDf0WH/8laLjLjUcOk47gZM2ZxmXnYogbvy10N74O5r8Igiu+0Y+8KXWM8AR30oTkS6dDNEMvV9VgW6Xw==
  • Cc: Alex Deucher <alexander.deucher@xxxxxxx>, Christian König <christian.koenig@xxxxxxx>, "Stewart Hildebrand" <Stewart.Hildebrand@xxxxxxx>, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, Honglei Huang <honglei1.huang@xxxxxxx>, Julia Zhang <julia.zhang@xxxxxxx>, Chen Jiqian <Jiqian.Chen@xxxxxxx>, Huang Rui <ray.huang@xxxxxxx>
  • Delivery-date: Sun, 12 Mar 2023 12:02:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxx>
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.