Message ID | 8-v2-16665a652079+5947-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 50E85C4332F for <linux-arm-kernel@archiver.kernel.org>; Wed, 1 Nov 2023 23:37:34 +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=FdU+V/RJX3F1/OJ4MgzHGzsOzc4J9CiS2qYcKjkXMDQ=; b=Uo0WFbHjv4pK9Y 4ppoRy/D/1fhFZ8R8vy2eZIjAleLRDB3Mn3RzmVAc0AqFARlWNiHMXOGgTY3YjfBEkOiHekQD2lMD H3FxOrduYeGSsL1gdK935posDn0oqpH8cxZY+uh7mPQKFT5Rpul96UBaFSnvW3lYtet2NtuC1+UjV V7bUq42y1O0NS+z3hrvEI3wjnOiH6DPFveCh7UTb7/d8b1y9kOFRZ5B+abVuU9IG5fmHqVLVofpt+ kbk88Pzva3S6hTtQ95nPx6l68RCVUqqD4brHBCeuATwHDrs2X0gj6lsbI5SySKqrw4v6hcO0ie0p4 9AjH22tKh1gNN5D7acYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyKli-008JXZ-07; Wed, 01 Nov 2023 23:37:02 +0000 Received: from mail-bn8nam04on2062d.outbound.protection.outlook.com ([2a01:111:f400:7e8d::62d] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyKlb-008JUF-2s for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 23:36:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cpIttk+C4FoCNWBPGsJdJebRDZFh/+lcWylsFhLHGx5YHObRoXPtEYLR58pM8ZRncPZ1dLM3J24VSboQGtucB9SE0tjLSrInN4sriC0Cli2FT8Sh7A2fkII6c6Fm/9zW0O1y0jhoXw7mrbB9FZyvGf7G6mWK6pIYOty8DqPDgicRfu8owRS7+Z+UrOdyIMEWxZSan+gwskz/djRRoRUmchCFPN2XDV2H/UpVRiz44UBVNtOqIyCEZWkOtYgE0wCbwCkABD+XN76oYnm3AJdpA+KoKig1ntQCoo18ntxFWh9ZSNM0McBCIsQF+qvu79feLl5/cPcU01DKzz79sKsyUw== 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=65NYd3HCXKH0KM4+CqaRxz3OgMK5ow93sI2dKYbHvXE=; b=W9u1U7RCfqM499d0GyJyzU8UUmgV9cCkanZhMM+8EkBUQrWAgfFtD8j495nYt7jZUfs08PmipU/5+HjiRywc01SUdss+cWrUahwMKPIQB7nTK+iiyasSfPaN2oSvbQJF4a34uaJxuqOJX7W5m2CSFTlYe0TdJ//z+o6OYevRN1ZgAc7dKs5tWs0AA4pm5GU0yT0jxxIsAT3ppNOudowBl0XeLYHRp+/vvKgemre8I8QPYPXTln3n9XshuWNa+xL4jVUhFwqu4DeELqIYMbw7LLyvnnOumvBaA7Eyn/vKLxJ9oJm4W2eL5Mg6CVmyFULV/4Tqv/qQh1dgvk6GcVjUUQ== 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=65NYd3HCXKH0KM4+CqaRxz3OgMK5ow93sI2dKYbHvXE=; b=CwVLAovWndPvLdCOiys4ULt5FNiZavUW1VPZMxLCEwfbX+Y55IsFN3Z1qgp65v6kbpPG+YykLzovtXLsIXzyxBSsW7CJuWJ/zP8MtcXfNCj8Dctql/A2qQSF2MTCnT5lcSDQHcpwa2sMnaMV7BBi+hh8AXbZqU62N+PZ9XKx1q5Z4HzcMzsXCFstTld38gDMqoUEMzDKM7So+jssBItWXUshROIkhGedcjv52PfEANTTeob/0uY1SP8m39fTaiGBlMejpKzGP3PPuVHb28ycSfh3dX0tBGZ2gMQZPRItGCf90h7shj63ttPj/t/k6rAFo9lG/IygAiU42Lyt3gSiMA== 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 BN9PR12MB5338.namprd12.prod.outlook.com (2603:10b6:408:103::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Wed, 1 Nov 2023 23:36:47 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::b53a:1092:9be2:cfb9]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::b53a:1092:9be2:cfb9%4]) with mapi id 15.20.6933.027; Wed, 1 Nov 2023 23:36:47 +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: Jean-Philippe Brucker <jean-philippe@linaro.org>, Michael Shavit <mshavit@google.com>, Nicolin Chen <nicolinc@nvidia.com> Subject: [PATCH v2 08/27] iommu/arm-smmu-v3: Move allocation of the cdtable into arm_smmu_get_cd_ptr() Date: Wed, 1 Nov 2023 20:36:26 -0300 Message-ID: <8-v2-16665a652079+5947-smmuv3_newapi_p2_jgg@nvidia.com> In-Reply-To: <0-v2-16665a652079+5947-smmuv3_newapi_p2_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR19CA0044.namprd19.prod.outlook.com (2603:10b6:208:19b::21) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|BN9PR12MB5338:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a0d0f35-84e0-452a-6e11-08dbdb33697a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gGLrm4S25mvmfYPss3dvaP3q7yS5v8k3lFkL20VFBwKQDd/84Jc1RrVDMg5uwbSAjkAP0Cx9FSsx30YatzlJxDXobSeVAPvmO/3NIbhI8Xe8jsRy6UgzvDanwt7V+Y2egtPh7Vj+pKVi++rRM57FHya00NskKnsZqa+ZkusLuJ+8/AExWPspbsv8YtmGofHoloL+WpFQEM7xEQAgI86ZjxikJ2mk8gqKLqC1ver7jBx3V3rDa4GUL50Y1TOSvrrWrIi2EHwY14O5wO3z5/Z66WrQaYsInZm43stZJkPsiah5ElpFTqDs0sM0GbvBgd2SKmcUc4RXODRx2RZL/lxEfyAu/+jWrRwD89OAaRxqC4wZ9ubBhRZXQUvMK6+yl7ZEeu/JNDjZHsyRC8Y4olX1X6vhQ7Mz8JaCmxPKg1XGqyY/L6My9vsxCF5dTMf/y3YUCSuRQzryd9pnHpE/hX6BRsS3YHz8CuCug6caPSbqr1zDwIpIelV1F4Sxo0hzQBNKCZxVHKhlGAzGYahK8SwThE5MAZWdJmjsMZ8HzvYjP0RJrqFKDKJB8YIhwRwiAcfGMYFiPeAdGfTyEu5DkZ/2yvT5J0KYFIjWBG8Rxwcn3SYdN9n0Eca/jrCmgh30rNM8tkOfUYzC4ul9WjBw65leFA== 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)(366004)(396003)(39860400002)(136003)(346002)(376002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(6486002)(2906002)(478600001)(36756003)(54906003)(66476007)(86362001)(110136005)(66556008)(66946007)(5660300002)(41300700001)(26005)(107886003)(2616005)(38100700002)(83380400001)(8936002)(8676002)(4326008)(6506007)(316002)(6666004)(6512007)(4216001)(473944003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G8QbF/J/x+b/lkw9kpGQWw15rRqihadfrimVwLBQJ0ixCm3sgc2+jlKQhEuQMwHagnYMZAFiRaRNg8NkNzDglqDzwkcfAU6SLdOrD4HadM7/g08mkzFYNvc9M/pM/qTsa/h1oRQvNx4/7Z3Su4x2etffoGbKnTaM/B+TznygzmY6wRx4Nd7AZ3gZb6wW8YcqFM4VklP5pmZIwaRvD44x1kzq9woxDT/hiCySjBbVCXZFDKedUPa1cF8+C20+Occqd6kFUBtPOGe859GEWd8Zk/klmix9GHma7YP1XSuqApcHt5CN+Ib9SRo37cFaAdw8c0FWgRR86bXA5a3QGwA+AV6kEko1wDy9NYIV2SiKVT+arTEnEkmYNsv4FRJeCYCh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Y8EQbA18yh9F75gggytXw/XXT7UQLZAFhna+OOEj+lo8KKX9Uc/V5h9g/2tvYzq0zvM9ND0AaS2dRqd/+ft3fwLSuKRNzDlU8Yp9Advk1r8xZCqRfu3nvLtLl1boxVXPt69Uv X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a0d0f35-84e0-452a-6e11-08dbdb33697a X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2023 23:36:46.4329 (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: oz3a5kjcCGZCrRmcL+40Qxqp3nXjKsLaMIMjkB4SFBlJe9814ApF04pC8h52+MQ5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5338 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231101_163655_948606_490EB0FD X-CRM114-Status: GOOD ( 12.84 ) 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 46d0a45fb0f525..a95e16a83f0196 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(-)