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

[XEN RFC PATCH 04/40] xen/arm: return default DMA bit width when platform is not set

  • To: <wei.chen@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, <jbeulich@xxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Wed, 11 Aug 2021 18:23:47 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.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-SenderADCheck; bh=+ONilfRs6Yw0UA5hM/jo7ynBsRjRbTUFfphDgQCzBbE=; b=PhXzIFORhgqofwHOWrOwO72YBB1SKJStLJK1SKEKmMR0AbpmlBC/yc9lZcwr6z+J2UBrIecjRb5KrTtMwFgXhsTX5zs8d9ZX2cMtmHh13iJWzkypHcHIjPEqVhoOmDezkTpaQcPffui/5ZdSrhJPK+JCu3hZ6D5VNI5xhFL/1SBnSOOvZ+x95DZ9I3L58FvwYpK88Bh1CeGtimNcam2zmkBZ0WMMuiF8Qujg4Oaj6DDuLD+3V3BXgmmOr8BNcGfgFA+P1X15FkG4VYtFNquJIAY2w4GkrGmriEgj9dsEwA0WPG2sVJ1GeBzFdNqz5orKXGkCRM5Nhnr4pxwHV7jHkw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VH0VQPASUcZTHYsvG5ERQ2pcL2rjFW2JpPh36q7TbFRNzF3arULhtxzMzzt6a/Jtdo7IvQ4oNGC8K/x3EGAp6+G2QUHOl31zVHDfWZPP0gDmjnur12YptZzzNst0RCFFw5r1aYbJuOuhVO0vs57zRYdu6/fMHXErZFXPNLCyJh++deKpefxepKOJbuee70xMkSLEmZn+sLQvIJ8t5H+MWGqKTqop5E380lepNpm9co3AdTQUDjVtbCi2m5uMXRfj+xwI1QXffdlxPSLBQzcJdLIqfHFBGgrRSCNbLojV/nsM24vIqqPoLUtAMNjcPjbJcIc4P3EVvKUKmUNEl9D6Cg==
  • Cc: <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Wed, 11 Aug 2021 10:25:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

From: Hongda Deng <Hongda.Deng@xxxxxxx>

In current code, arch_get_dma_bitsize will return 32 when platorm
or platform->dma_bitsize is not set. It's not resonable, for Arm,
we don't require to reserve DMA memory. So we set dma_bitsize always
be 0. In NO-NUMA system, arch_get_dma_bitsize will not be invoked,
so dma_bitsize will not be overrided by this function. But in NUMA
system, once the online nodes are greater than 1, this function will
be invoked. The dma_bitsize will be limited to 32. That means, only
first 4GB memory can be used for DMA. But that's against our hardware
design. We don't have that kind of restriction on hardware. Only
platform setting can override dma_bitsize. So in this patch, we
return default dma_bitsize, when platform and platorm->dma_bitsize
are not set.

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
Signed-off-by: Hongda Deng <Hongda.Deng@xxxxxxx>
 xen/arch/arm/platform.c | 4 +++-
 xen/common/page_alloc.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
index 4db5bbb4c5..0a27fef9a4 100644
--- a/xen/arch/arm/platform.c
+++ b/xen/arch/arm/platform.c
@@ -27,6 +27,7 @@ extern const struct platform_desc _splatform[], _eplatform[];
 /* Pointer to the current platform description */
 static const struct platform_desc *platform;
+extern unsigned int dma_bitsize;
 static bool __init platform_is_compatible(const struct platform_desc *plat)
@@ -157,7 +158,8 @@ bool platform_device_is_blacklisted(const struct 
dt_device_node *node)
 unsigned int arch_get_dma_bitsize(void)
-    return ( platform && platform->dma_bitsize ) ? platform->dma_bitsize : 32;
+    return ( platform && platform->dma_bitsize ) ? platform->dma_bitsize
+                                                 : dma_bitsize;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 958ba0cd92..0f0cae5a4e 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -227,7 +227,7 @@ static bool __read_mostly scrub_debug;
  * Bit width of the DMA heap -- used to override NUMA-node-first.
  * allocation strategy, which can otherwise exhaust low memory.
-static unsigned int dma_bitsize;
+unsigned int dma_bitsize;
 integer_param("dma_bits", dma_bitsize);
 /* Offlined page list, protected by heap_lock. */



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