From 56a7b340cd016c03daa212b5f343a76b3d6734b9 Mon Sep 17 00:00:00 2001 From: Pritesh Raithatha Date: Thu, 17 Apr 2025 03:04:36 -0700 Subject: [PATCH] [DOWNSTREAM]iommu/arm-smmu-v3: use reserved memory for allocations CMA allocations are reusable. When not allocated, it can be used for temporary allocations. When there is allocation request, temporary allocations will be reclaimed and that takes time. SMMU uses CMA allocations and causing boot time increase. To avoid this, add reserved memory pool and use for SMMU allocations instead of CMA. With reserved memory 1MB allocation time is reduced from 17999343ns to 166037ns. Bug 5115195 Change-Id: I34febac4235da68027908969b9348cbfd2feffc4 Signed-off-by: Pritesh Raithatha Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/canonical/linux-noble/+/3446227 Reviewed-by: svcacv GVS: buildbot_gerritrpt Reviewed-by: Bharat Nihalani Tested-by: Bharat Nihalani --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 77c0cc385295..d33280db0c3a 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2,7 +2,8 @@ /* * IOMMU API for ARM architected SMMUv3 implementations. * - * Copyright (C) 2015 ARM Limited + * SPDX-FileCopyrightText: Copyright (C) 2015 ARM Limited + * SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION. All rights reserved. * * Author: Will Deacon * @@ -23,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -3814,6 +3816,9 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, u32 cells; int ret = -EINVAL; + if (!of_reserved_mem_device_init(dev)) + dev_info(dev, "using device-specific reserved memory\n"); + if (of_property_read_u32(dev->of_node, "#iommu-cells", &cells)) dev_err(dev, "missing #iommu-cells property\n"); else if (cells != 1)