Message ID | 8-v3-9083a9368a5c+23fb-smmuv3_newapi_p2_jgg@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2787C4167B for <linux-arm-kernel@archiver.kernel.org>; Wed, 6 Dec 2023 17:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JKIRSrT/ZSIlE9LYeaweMRhMdMNSfwUuIMcL6CFVVic=; b=zj5OD3cqoj/lh1 VJQfgWsb07AByR6rrzVfwOhIAxihieXogFg0YzR7Wp1LPgQFYwEOIvipe5VUjQIulJJbHTfgf1M51 8Ui44utSTpoKzYZGTWlZuZeErUjLanvkeIEBOlRF9lDFMhfWZ389MlyMcX8iJrwuZDUNVXsVKbs5A 0HRIGAka1ss+jxGVU/XFKfQHkiG2tSrWs8S14qAm3/OhKRclTpDYXVj6r6FL7zfFGwd5yGEn/H4gL vN3jUQaJKkEX2wHPiWb+Vu8FPxZSfB6zs2RMxSuGDc4hmespMw8mJbanjY+KDW14bcyr8sC5+VGh0 R6RLysAYfX+wtX/j35zQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAvhl-00AtaP-2t; Wed, 06 Dec 2023 17:29:01 +0000 Received: from mail-dm6nam11on20615.outbound.protection.outlook.com ([2a01:111:f400:7eaa::615] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAvhY-00AtKY-1W for linux-arm-kernel@lists.infradead.org; Wed, 06 Dec 2023 17:28:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hZOuaKdeJsWxyc7ZCRGuwOpUjEGvDRLw89KVAakO/xJW3pprApqjM+ijAmDnXLaw+OLn16cbcI+gRdyFBF84g3nGfUzSZEZjrJ15JX2HyQ58cdibm2IpKpoXQlHCQXjmsH3WlYjVJ/zoDRh8LFM7KXsC+lAoY+J2Fe2NjGe222Wa7/pfQGj1BntYysjcvguHPf+iRm3Hl6r6CS4h44r0RBDbc9SzaVpuLSLdVwvOCWYMIPX5yhaIpefZzNK+Vwm2MTZ3aBkut7UzWhBKfJvto/p3fsXXNQjAuVJeMVPkIV1HLsbDomEq3VXDEFFyHPWfUcZuWC0ExvpSC/4bMd8SVQ== 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=vtrl5dtWYNbmQqQnStN45gQKdSw1hWTiwRqlc7s1JAk=; b=g/IQJ8hFMhUE0djCiFv2gPq0DAc0Mp7e31bQFiRwsYueWdu0G9GA/QAHkLdrmZcLZSuYZQtu6wDpInob41dTRDGpWGD1OxOIx1/++7ROcVIAoCeJVHOK3L6XytHFxfm6bdYMQb3pQH2s23fjklZ+N4CF87pCUBI+4eF0NjkZEHgpBraQCQ3sCnlXpmm3kBNHisTRFLP878A+PUJyfiS85a473on7anQnjBmPhiB5ybhifa9nEU8flEjjhsIeEzGkFP8uOWKuAarAIehvt+v97ytedWW2BI7A4MbK9t5X+rUFP7w0x9M98IIOiXtchk/5ZvbnWu1HEShT88GAqO3uOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vtrl5dtWYNbmQqQnStN45gQKdSw1hWTiwRqlc7s1JAk=; b=fZ+jrTxlTMJxIJeGYIEovE+7TO9qjdHDJUXTLCdfalLyMlXOeW3BounAZsLGAMpY5dEqgsdj2MxNwA01wHXLzbDF4/Ijc6UKrUZIg+y2+vNUAA0GgCmvuNoYhDWw1Ik7wLm95FNtlVl4VNXRknSiSHt46tRUhlVR+4LsYV+5+3B4F5I5AISS8sV7K4hz/Ut+uHh0YRTqx1VnZIapPcm6bZk34TbjyEISTbccUoK3yCQs9YbYaUluLgouWhKGPv5VZlId2aFrG5e0gBchNnemoBG157k2itIjJZieGn0v5p9jJEN16cRnBjefa8dJZiJH6Ibw0cnR2oxrZbI1Ds9oug== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by IA1PR12MB8360.namprd12.prod.outlook.com (2603:10b6:208:3d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Wed, 6 Dec 2023 17:28:40 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93%4]) with mapi id 15.20.7046.034; Wed, 6 Dec 2023 17:28:40 +0000 From: Jason Gunthorpe <jgg@nvidia.com> To: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>, linux-arm-kernel@lists.infradead.org, Robin Murphy <robin.murphy@arm.com>, Will Deacon <will@kernel.org> Cc: Eric Auger <eric.auger@redhat.com>, Jean-Philippe Brucker <jean-philippe@linaro.org>, Moritz Fischer <mdf@kernel.org>, Michael Shavit <mshavit@google.com>, Nicolin Chen <nicolinc@nvidia.com>, patches@lists.linux.dev, Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> Subject: [PATCH v3 08/27] iommu/arm-smmu-v3: Move allocation of the cdtable into arm_smmu_get_cd_ptr() Date: Wed, 6 Dec 2023 13:28:14 -0400 Message-ID: <8-v3-9083a9368a5c+23fb-smmuv3_newapi_p2_jgg@nvidia.com> In-Reply-To: <0-v3-9083a9368a5c+23fb-smmuv3_newapi_p2_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR22CA0002.namprd22.prod.outlook.com (2603:10b6:208:238::7) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|IA1PR12MB8360:EE_ X-MS-Office365-Filtering-Correlation-Id: ae7fab7f-ee34-4ec4-1f58-08dbf680c644 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /oMlTop4DS4zUuizuvzH558I46CHzDScbGaWueR76pF514BnMprJiPc1ov79sDXXcJwLC+G6KikRGRmIma7QqT9lhxOvyvt7ZEYfklWuXDw28H5p9Sfh+svkS2Usnfxp+gkoFFhHz9F5hnaoBDyv8VWYCML6nGV120VmpYueHvxSuzbQpbIOsT6F+CBLCYv0/F4sVyfnK59PsnzYIQFvSBQxAj2JqyU95o7iR40u+OJa9Duftle1RRWaop6U0bb1Y4IyYopuvdzego8hl2MbIfAUZas0ZT6xxzQGg7sc7TBvVZLuDgKtLQIv6CxFt2KM4t0xxnsnZxPR1gRm/lYuLzyayg0sZy+Neq9QkyjkiDjpvFjiYlApeGywEJHxdnjq9UbbhjSmdbIis+8L1F2gaGYIQnQXmnZaqrm7uoAhd/kayTE+sTd3rpzYJqFo0n6Y24d0RaKdj2XcHD4OcfFFnvHLFnuwwdASkqbGJbjHJZ/bekZXu9chmzAg9DnWwfRzSScD2Tzg4mURihSN/Lm0E+VCLHZcgHc5LMV/TvbpPgv6q7xaLbidgCsj4e3d7rSGyYER9SOnqdG3JjNd3nQNCx9vcZPZFFwBHgpQaXtxhe8MaZ5V8dGKRJeF0BAJqsvPyLrGqPZwopJ2h5oK/Ywd4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(6666004)(6486002)(478600001)(38100700002)(83380400001)(66946007)(6512007)(2616005)(66476007)(6506007)(8676002)(2906002)(4326008)(54906003)(7416002)(5660300002)(86362001)(36756003)(41300700001)(66556008)(8936002)(316002)(110136005)(26005)(4216001)(473944003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /bmY6TupidND3Q/lL9IkstpO+q/L+aIHskeYY71fh2yh/ZyYH9WqrC22NaulTbOBouVf+oIwP306MxmXhaBEqDVK5HmhiGDULk8j3t1q32NGngxLWhQeuH8NMTTihWSoAWjOOP5FxaYHtHIk0cRXMrpVWYfum//qixfOHwjSRmJDgvbbJMxP2IPZM5Fxdf8knMvBgHg+h4baEZIaJpJfNACBmxeQGMC6tHXQOXHBDQBqpa+RsNE8ArqQK2ZclzjNZg5IVgEyGvM55ToMQbRfv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oHTpaUAzgxLnqnvdxOTtqrrbtzyZvdxJuZ2h5JeU+fmvX21HIVZ8cYl5t54Gwmjz4JO0wDMVviaAaWudO/F7QMY+Gf34taZsdu6I4ZCPPzmjoXRCDdGbWR6JBi25Qw9cliPoFS/rNTIIbzdE6pc9raRKrBlMJX3AQy6eJeaAeyBE08Z2x0qeJaaDjuPQrxHA3/9WK6Z1mukrPPftI5+cp6UVSBaYaZmMlpk8NpeY3oq16De2yTZS X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae7fab7f-ee34-4ec4-1f58-08dbf680c644 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2023 17:28:34.6973 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VgJyL88QKSls1CNoArxT9E6BEGw21vw7KDpfM/6X0GjXv7p10ZbE+8ul8fRzLY4c X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8360 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_092848_508247_1B9BA62A X-CRM114-Status: GOOD ( 12.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Update SMMUv3 to the modern iommu API (part 2/3)
|
expand
|
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 696f837015771f..a21589f8729176 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -89,6 +89,7 @@ static struct arm_smmu_option_prop arm_smmu_options[] = { static void arm_smmu_rmr_install_bypass_ste(struct arm_smmu_device *smmu); static int arm_smmu_domain_finalise(struct arm_smmu_domain *smmu_domain, struct arm_smmu_device *smmu); +static int arm_smmu_alloc_cd_tables(struct arm_smmu_master *master); static void parse_driver_options(struct arm_smmu_device *smmu) { @@ -1127,6 +1128,11 @@ struct arm_smmu_cd *arm_smmu_get_cd_ptr(struct arm_smmu_master *master, struct arm_smmu_device *smmu = master->smmu; struct arm_smmu_ctx_desc_cfg *cd_table = &master->cd_table; + if (!master->cd_table.cdtab) { + if (arm_smmu_alloc_cd_tables(master)) + return NULL; + } + if (cd_table->s1fmt == STRTAB_STE_0_S1FMT_LINEAR) return (struct arm_smmu_cd *)(cd_table->cdtab + ssid * CTXDESC_CD_DWORDS); @@ -2639,12 +2645,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) struct arm_smmu_cd target_cd; struct arm_smmu_cd *cdptr; - if (!master->cd_table.cdtab) { - ret = arm_smmu_alloc_cd_tables(master); - if (ret) - goto out_list_del; - } - cdptr = arm_smmu_get_cd_ptr(master, IOMMU_NO_PASID); if (!cdptr) { ret = -ENOMEM;
No reason to force callers to do two steps. Make arm_smmu_get_cd_ptr() able to return an entry in all cases except OOM. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)