Message ID | 19-v3-d794f8d934da+411a-smmuv3_newapi_p1_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 A3682C4167B for <linux-arm-kernel@archiver.kernel.org>; Tue, 5 Dec 2023 19:16:16 +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=QePs6EpQ21+5kQ6EHDw/Kv5k6QrOMcGYdPz6A0cGDDA=; b=Kci2nT5v3IJHBU EkJmMzk120opExqSTd8lgKYEu6AGGC6leBnVB2IZnh5mQnP6i8/Pl3czOTvmvXCh3gBJque5o9SuV a9cxaCzvBON1kAJ3H1YHbW2GXjVG0HlQIo7AJYR5uYltguh7/9NOVt/v3NjT7jB+XaghrBvPc1LS/ FBbL1Dqf4Rag0rqaFLCFld87yuATd8pFrOVEQO7450ifoGeve2DbHTW9AA3ASW17rEU2pgczbW/F7 HiFTq5h7GAKk9mlsCE6RaQS2ArUZIJ2DYEeNKjJsW9CPA/hvsNK3BbGmwo4rdl497lrB7sg0+TdxD C6+gpbLb81KuZ0F94rFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAatc-008Fk7-2U; Tue, 05 Dec 2023 19:15:52 +0000 Received: from mail-mw2nam12on2061f.outbound.protection.outlook.com ([2a01:111:f400:fe5a::61f] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAat0-008Ewd-2E for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 19:15:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GMaNdD//RzfMzeKK/EbZrsn3qHL7cp4FFliomqkCca8DZJxJaHIkeb3aIHXxZSUQgscBgX2zz+M2Qpvsskyqjl++hm8/CRXoQ7Jrr80R999jHotrgkmKZtBepw5g6xyhAwOR0qDN5lbqttIPB6IOJqGWJEIxlqodvXSODVvWbPzPdoKior3bikV74LNaACSfpv9EaJ1cVrusq9VQlN2IwZ+DRdaQXcPdKnE79Z7FDpEXbw1j8j3OkauHS6cNXRShbI4EDjQj+ZObShpgJL1wofpbblULTv5ffhaXGbKrs5vETJ6N+bEOR1UkoN8Ra6nGCTj0Zi6NvD+ehJZ2naprIQ== 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=g296EJYrj9g5IN5mXbHv0rQs+6ATv/JtBT87ORnunIg=; b=H3xE9cMkijFUu9yDdcAvrDRc+4VKUd9HGjeTg16PccpKzBVRckz16xg1qgaJgVIggMMlm4M8EG2ukJESzsV2Od33UAj/tJ6DsLTz65ICpBm3Uakt3h1boS8xpLDMSjsJp9d/XTqLfc1gaPf3w2MZ0rIxklmLOaZMUzw4xd/fyroWc7csI1tx2yyg+1WEUkxYnvO7ZYhFr3Dry6R158/qnKTiSCHLnYAL8gZHSoAskCInbTk8FKLYY4rQka5x81Utx9xGTIv/8FHwh2qj5WBC3qi+DEwEe4mdWLxvdHvPAToUDqRnuoJi/d6oVa/j2IwAGJyGrUdiMZDZV5TblfAHEw== 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=g296EJYrj9g5IN5mXbHv0rQs+6ATv/JtBT87ORnunIg=; b=eG8UiXd1cOBVfg7f2oXLX1OJ6dfwDFnytgzx/Pla04td1sSUXH+CXpA50FCJvIQjwXNKJQugZLMjtFk+XQSPosNKrXCTQHKythnEKebZC1RcjzLbyBracqAOHD453gtS2FtpU/IPZTYBJzojyWcUZJeS2I5FfaQWXmm0F3uDVYZSsBomryrGk3A2IoJYUAzTwMXkRVKRZDssEkPmo8l0yRSucX4+KANjVh08IyZMz+QH/S3WpTFw5ogSfBpfPk57HGiFNvfB9MLOhkJ9qG1fQHAQuLlWtNRD82JgPcs07YFGpWUPwlErnGc6XtJBAmYLFTDKknJBvsmfIp3pX+UhSw== 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 PH7PR12MB6588.namprd12.prod.outlook.com (2603:10b6:510:210::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec 2023 19:15:00 +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; Tue, 5 Dec 2023 19:15:00 +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>, Moritz Fischer <mdf@kernel.org>, Michael Shavit <mshavit@google.com>, Nicolin Chen <nicolinc@nvidia.com>, patches@lists.linux.dev, Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Subject: [PATCH v3 19/19] iommu/arm-smmu-v3: Convert to domain_alloc_paging() Date: Tue, 5 Dec 2023 15:14:51 -0400 Message-ID: <19-v3-d794f8d934da+411a-smmuv3_newapi_p1_jgg@nvidia.com> In-Reply-To: <0-v3-d794f8d934da+411a-smmuv3_newapi_p1_jgg@nvidia.com> References: X-ClientProxiedBy: BL1P222CA0026.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::31) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH7PR12MB6588:EE_ X-MS-Office365-Filtering-Correlation-Id: 6daa4126-9bd4-446d-33d6-08dbf5c675e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PtzTsFaKyVEEVMH/DOmbtC2zPnPBfZ8Ni/zNnmY261EX9qcO/f5d/zHF/oC7cWs4YlrRt+B0HAjlCrAXm6kWXSurrAM6GCGo8mNGqRO7wsQc9b5IIQHmKRmY0rnX6O6+O+aucCWYEVcQ5ytob5+rcGJUwGz89a0JpKahU/XKLrfzilel8ayrnfcafqurpuCz2qpsXBEAYK2WK58GoJWUWEHKho2D7okwY6ZbuLyrIC+X7dyrnXHYR/VmaLiH68pLNJJ/hab2U6P6/wJ46VflBh01bkmYPqF86R19JgBTk44Fo+c53hbQj09tV2pbQBz9t4JQpUJ8U5xx0c6O6x3EvGR7dCfD78x/KZw2I169M34GFhQnrWaL2L7wfiHMVdWKYvSbXsyxHEEeeqoO5yTLBuRmzhRF7V2chK1+GshgNn36lEif8wHg5LDHyVSNpU+rYRkqoXH5qwYtqCeKPJaw+mrunRo/N8uv7EGwd/ly80KdmQujrWZ51p7boBk9omMnEuOgmSR5YGxon4+Tojl/jyhPWWu1uzV5Az+GXoQ4Ciit0GrvxLsK4jThUvUINJnB 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)(366004)(136003)(396003)(346002)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(478600001)(6512007)(6506007)(8936002)(6486002)(2616005)(26005)(6666004)(54906003)(66476007)(110136005)(66556008)(8676002)(66946007)(4326008)(316002)(83380400001)(38100700002)(7416002)(36756003)(5660300002)(2906002)(86362001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lNb6R2g8HtU5oX4Qt/+R9BwAtiROwtutGSMBV8ZpyIJ4pzDMGA9QHwYBgBFEDgcUtBd5b5hVQP/1htVZC5DFPwJk95CCkqBxOdKqfzUMVrvhXnVJquWONdyQj0B/g5RNe2X+2514lh4iNqjPlegZ+WKmDuJfvyjFv18+lG8QSXZG9Y3MWX2Y/PEIvRF2bdIQvwBYBCOaYlplazJwWSx7+pmOLjFMZgrtlxwsQ3zyCi38oITLFe531w6YUJ5ioHoaKkgi/WUkmLR0XyGfNjH9VkrhTTVxuLzjbFZaktK3t7Zim7xS+GTatdhnl+vrwsZXhyHLADO+1tWG8ZY5RVTnfYevBueXZTGMhsL0NLWDpSG8ouwJmpr2UrO+aDybOs2aXAhC3ZGefoPI2XyQHIxSHaKnl+gFSaOP5abYDpKR7c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ERj2crWtcRfxoW+JZgsLv3qGCBmI8yShvzpApKO3oTepWrycES2AvlBNj1VDeUHiAKU7+XZo/hEooF+OrMrAgbLriIlodglNPqd X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6daa4126-9bd4-446d-33d6-08dbf5c675e7 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 19:14:53.4390 (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: rYdetab/MEl8K3AO23YOeXmTf6FZ3M0x34JZW/9WzSrleurgTFCGtqOwhShHB/PP X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6588 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_111514_762162_47A48878 X-CRM114-Status: GOOD ( 12.12 ) 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 1/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 873343109a90bb..f3900a3d52524a 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2169,14 +2169,15 @@ static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap) static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) { - struct arm_smmu_domain *smmu_domain; if (type == IOMMU_DOMAIN_SVA) return arm_smmu_sva_domain_alloc(); + return NULL; +} - if (type != IOMMU_DOMAIN_UNMANAGED && - type != IOMMU_DOMAIN_DMA) - return NULL; +static struct iommu_domain *arm_smmu_domain_alloc_paging(struct device *dev) +{ + struct arm_smmu_domain *smmu_domain; /* * Allocate the domain and initialise some of its data structures. @@ -2192,6 +2193,14 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) spin_lock_init(&smmu_domain->devices_lock); INIT_LIST_HEAD(&smmu_domain->mmu_notifiers); + if (dev) { + struct arm_smmu_master *master = dev_iommu_priv_get(dev); + + if (arm_smmu_domain_finalise(smmu_domain, master->smmu)) { + kfree(smmu_domain); + return NULL; + } + } return &smmu_domain->domain; } @@ -3059,6 +3068,7 @@ static struct iommu_ops arm_smmu_ops = { .blocked_domain = &arm_smmu_blocked_domain, .capable = arm_smmu_capable, .domain_alloc = arm_smmu_domain_alloc, + .domain_alloc_paging = arm_smmu_domain_alloc_paging, .probe_device = arm_smmu_probe_device, .release_device = arm_smmu_release_device, .device_group = arm_smmu_device_group,