From patchwork Wed May 8 18:57:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13659138 Return-Path: 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 A3CFBC04FFE for ; Wed, 8 May 2024 20:01:39 +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=sLMSdOi75raJLVAvM4uu+4z1Z4+BSYOke2rBiB4+5uY=; b=liPP9/IJuNOKfQ 13fAPwsuSQqEetZZK3awDRyXOJKm5qU78MWPpsAx37syi0vq/OZ63PjiJ0pcqX+oU5HDMSHPJxW76 s6JmVZDbvimj5oV/yZpGcBrqclN0dHQiA4wmfiQHYrlKFZyXocxTXVpQmXwT2qG7LoKOVmEACqLaT ZELKFeX65tw6Ywoy5FDvkn7i5YSu7Xm0hvTA+ymYHTVun4GPYPQqP/YjhPcG3z65LtUSCLr1UO42Q kQRvilbBKZUGncLwqSKlylYy90ShJenmXlvl/TZ4uhEuhjSewjt59XKPxHkEbiQDttwkdBSm58a87 DGjHMOBa1GttnYz1FmIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4nTf-0000000Gp1L-24hy; Wed, 08 May 2024 20:01:23 +0000 Received: from mail-dm6nam11on20600.outbound.protection.outlook.com ([2a01:111:f403:2415::600] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4mUJ-0000000Gc7U-3AXv for linux-arm-kernel@lists.infradead.org; Wed, 08 May 2024 18:58:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d3yXwJ1+7HkoBotx4gFjdkrDOmXICBqQ3LSWgGXjVkrvqYXcKuxbB/uYd5kr9PRvrqdhF0+SQXBdraoX+1z1v0qSyz7loGDzT4Dwn128q6CC8NHHf/DpQ3ZwrH0RixoOFWOwiVfvURJ8qAyVhwoA/clgsKLxKJAWyW7n88zzmJeNB1Rz5FjD3oF8Ooa387UOLHFmr6oEeAkPmo4b7yWpn5rrfkwVOgJG8kjYNGZjaOPelxNeAk1fu8waRgWx/7e6w0ymL+AdyViPz7RdTnQQrNjfRqh75q/IVDo8opP1Ldz5CI+GhUx8KgUZE5jV99GKWkLVsXuSa/brlNyLQNWllA== 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=rHrDdFn03CQuhDxPeEhiYssYd1GLkbrfxQW7fV56mbw=; b=RtPNvZ6Rm8EZyH/R6apwuYY2trrifF2OqVFEPIxG3cmVO6H03UYyzVqqg7o8Ak/bq4py66UEYsSOwt1cxSX58ndIFDlJ8W18Xv8+a7rounF8xNeA5AUBjQyR3AQv1jAVRcL4YpgmjMtcdENjEQ0UzgNyadJb4YR29NhWL4aor7ygnQk6Sd8XERwHCzHrDlYOBEp2DeNgqvjWWRfjSynM1py50+RIOVFWB37XWk/CM39fXvGgjX7/KtEnVkqih/XqR+N5sM+gr0yg0SN52Oc107V/z9lUvMfASR0gTNxDnFvCx8r5oZvMG7ragz2IMH/Bp07FfTp1QJeMvg6XY+a94Q== 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=rHrDdFn03CQuhDxPeEhiYssYd1GLkbrfxQW7fV56mbw=; b=lj2ZiNwi3w+d9u5jrrbKNMAufuiWmW3m8AJVQ6lUDUlZ/4husuv8BQ6GDWQu5rECcmAFyR0G4Mp2n2SVV1y55JJW5YQoCRU10l4qIVPAly/nVXHxs9KgTOgpwN/n8i30dH1wYtyFHCPGEQZiTk9t1RGxLyD0YpcLV9mi5X9ud38TUoiAjAg2SRI4oDRFpfqiDHPXMjSWKJ4OwnTxUIFpx1q1/+IfkU91odgs6p694lOvomc+OAstMAS1CsRMuYL7QXEcTqMY/WJnGuShXfKuq3aQA2GyBguQAsxYklg0cPRKniIdMy3pPLnm1gnMWEyrJpNyzxi4RxqDrGoGeNXUWw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) by CY8PR12MB7514.namprd12.prod.outlook.com (2603:10b6:930:92::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46; Wed, 8 May 2024 18:57:28 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e%3]) with mapi id 15.20.7544.045; Wed, 8 May 2024 18:57:28 +0000 From: Jason Gunthorpe To: iommu@lists.linux.dev, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Robin Murphy , Will Deacon Cc: Eric Auger , Jean-Philippe Brucker , Moritz Fischer , Michael Shavit , Nicolin Chen , patches@lists.linux.dev, Shameerali Kolothum Thodi Subject: [PATCH v7 03/14] iommu/arm-smmu-v3: Make smmu_domain->devices into an allocated list Date: Wed, 8 May 2024 15:57:11 -0300 Message-ID: <3-v7-9597c885796c+d2-smmuv3_newapi_p2b_jgg@nvidia.com> In-Reply-To: <0-v7-9597c885796c+d2-smmuv3_newapi_p2b_jgg@nvidia.com> References: X-ClientProxiedBy: BL1P222CA0019.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::24) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|CY8PR12MB7514:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a8b830b-0119-483b-0b3e-08dc6f90b4ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|7416005|1800799015|376005; X-Microsoft-Antispam-Message-Info: UtzU34EGnFMsrT7sciCUnzpPdQSoY7na+OCmGat+Zb3IrSt3pCO7nrjzRW/rzTRu2KWMe8oh2/38cADVOUfwZKSDZVDwFfaqTQJKlX3fp5OStGJ9hqdkWNkyHrbYU+C4gh9Ogq5w/3wYuj33l2zNVvoVombhY1MpKWa2ViSOG7+nIvnIBS5QrdBqZWKHurAqtu2xhMIcgNSilXjw/pibe8cbSsdefRHFr/MhbQYyzYt67m871pTbSuJmHyquczSyIBacUcFC4tCVr04gqvVBu1sFIoX7KlZljhrqNwDBscPa5Z3zgqhoffVg5m+tLQzyo4eXBiAFTAZNfsbLIz9xqtR7lHL0OaEeH+/tm1u8gmccaCTfKdlM/GrDhq6qS58w7APw89gqcMYNEyHt4hJtod6K7MJHoYc2xmSqgkShA/rj/LdBJdxTSbQYRYBlfAeKmC9ukufZT0UuD/jQg5Rif5vDdcLZdH+sCQ69MtqbvuYxowX1O1LmFWKVcIaxTgxXxYmQJ7GxK45mXNjk9B143xZ0i5AOcTQpUOLk4iyfHXREgQpKdogITxEAzm91kKd2d8GEuFtjLLjTUHwLetlbK2oLXURnSH4xJk6aRvMXESGvNv2KvqU9mQQzwmVNo1662HRAEgZAzJtRF09/Hot4+Is6R/L3vDSjPtGg+5k+T6IexbNlwvBm8AES7i53rfHY+4uFUFMj7fat34L3UMkVu4WKtlsI+up1DbFcqhq6dZZ8UkIhfzdcuCuIi36ZaGSzozZo0OcGHnR3UUGSbKurNwxI4LDPgelYX7gpSgBvo6/vsqvEbCZS95pYcXEV6Vw6EoxGiptUAcBIUWk7flo3a1yY2vs53CBuvctrTuvFK6/PgTBvsYq9ViianmtPUhgDLWrM/6BJaHmByP4FxzX4MdytLJ10cDTMQMa5s/D2ABEGZxZ6be08sOm75XpT9o5nTY9YDZnzXnk7/C9hr1BJFSWxB7xfH2l6SyVxgfaEVB5LHCAvXVQdxMHynlq0gsY2J6UIGnD4EmfWxaHkQsEnfO2EgS1s5Odd4NUaSIoe+jlK4uphO46i4pItSJBctQRbsZ/cXiWsocwhUY8Y7iwUgMVQXt+1eIlH3R6+YK5C0wf5tKnxRO4/IEdoEc6sfTe7tLTlpaJy9APZXy2pgB89rzQOcMGhf+xrqjjj+mFutxHrL4JGkZrd8EehV64JXymBwPdouH7UwJ+CuUDPy9s8xbGmikq4srSieFrLp1pmh9tGvgax0TXcmVka3Pv7HdRmHDsp/TnGSoIyWkrUPrSEyA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(7416005)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yLk8VkRKbWos/R3PU8gnzSs1x7jhRGM23WavjnvtVj7onrMU/BDQed9RPKu3YeMZs6VZSYnVoWt2Z1Frk3H159zAz0GLqzPTfnxXqIw0DEcCiHOpuJRn+oqqWvSuhK61lATMXJiKyy9NZ+5nv5ad2MnIpHO12toHaO6LCpHCWtybU59OQOAhu+ckrIYUIL1P1+JGiJajdaXk/z634t7KncVSd3JIXE82zYhIBRpBhG0AoDIDJ9IgF0f1M/ACU34Lf9y1+Ot1Wfah9hZiYDKTPcF5cKNyF+iW924lA1IrMOWL1OtUtOgMUKHeeQ89BcTZj73x9BIkTWQ3TMXhKEIZ/PZnGdt5osiD73mkRGCKreSflg/JNK+SUX+UB2TaJzUN53gZ9g0DrHXwHBXTKG8GAg6P89u8+y9LPwRwTzvyrwV2pE/Y9N2QBYgAS4IvE5DZTwVVepPqyV/TUXsdd56nNkR+iyX7ofefVV3qLo+0qHVJjq89/El050MZfRujsrqMOT4Sv25udmBwwJdsCTZiskfwGvefBYhI8qzauternNeGUQ+2/xfAa+fsDrT+cfosx6ojgoNF6x684vEbBcGlipC2CSKxdLa0QO7BSb4Xn4GpY2jeoMdAXNkzPQNLnhyU8afWZKifsCXiZMopG9F+r8VtPPx1B+VQ+evZ9Zd6Fp+4z1hypw9qhmN/mBWmBqF0keGXQZQixm2xRy7yy6vBtfvVPOCcUdDHZL2MDEqTuATbEMkxZZEKqFiM+MCIyLJLo3ZV7WGGorfRAsDr269tdsUTPxQc2CjvHi1fU3pQqf2Qh4VoOcSMdZ5YnB90sUGN5jurrA5K+aeDAkEflmfFXk5d1zseVxfuqhZhBgldCJh+29UaP02yiGOZeBmzkEAmQ2MU8AilmJTO9BPCSh7nxfk1zbxkOTtV2lUgwFyE9HQ7gnJMtk4MDgmi381QFkFjzKpjRDSfc4kRRPe5xSf2mir73Iyd1Wn82sNoWiiqL36AQo+xSElS9kwalVJuriOndKDPpuW3ZgkF542jblWRn0AOxA/50md2JsQtvQRc3pZOOk7gMYv+IcP9cbhRj+71wvZS/QLMqroTvpsibaZDmoAR1fT59ZrQSPECWwKfx9wManawsrUrdkH1FM5mD37Fr/mIwhxS+e/yMo1F6OmfRMo4wKcudZI+YOkFGMSxrSVMqZT6WkFqHq1A2PB/psRIsFqs+9liTtHMLHUiVte0ZWKlkltPK6CyFbkv1nFIDP6YbxhqW+Xg2Nc6a6mAqUy1lO3ceQGDT8pMORlaSfjOy3da4kDkIV5PPGhsLYB908G3LY/TWEeI4+crgXDtx4HQWjdFol6euwKP/yClOdzNhC+kNAVqJjFnkT0SayTh8D3/Dwu7sBUPtsjeOXKRnTzh8hxhJFV/KC6Eorb9yLVF84P6DYQquehKyP2rJNeqdn6qE0Dem7akBqLIXGQTCCDn8FxTp/rn9kfpuBoVzcBs/nWqXhW+WGuFN/Nx4Yw4XVDuPjXK0KyOAIxUT5sGdalJugcR4a85xOnHLHoMZwEPFYPXJ37QZvfi6fCI1PcFjnz8gEqNo2vjmoxzDO7mCmw/ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a8b830b-0119-483b-0b3e-08dc6f90b4ac X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 18:57:27.8613 (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: cL/LDchzLo52h4Rp32bmnnC7H+OZSwbV66+xxXQcPv3hhLemq3sf3a7FlZL8VRxK X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7514 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240508_115759_984645_B3B54FD4 X-CRM114-Status: GOOD ( 16.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The next patch will need to store the same master twice (with different SSIDs), so allocate memory for each list element. Tested-by: Nicolin Chen Tested-by: Shameer Kolothum Reviewed-by: Michael Shavit Signed-off-by: Jason Gunthorpe Reviewed-by: Nicolin Chen --- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 11 ++++-- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 39 ++++++++++++++++--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 7 +++- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c index 71ca87c2c5c3b6..cb3a0e4143c84a 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c @@ -38,12 +38,13 @@ static DEFINE_MUTEX(sva_lock); static void arm_smmu_update_s1_domain_cd_entry(struct arm_smmu_domain *smmu_domain) { - struct arm_smmu_master *master; + struct arm_smmu_master_domain *master_domain; struct arm_smmu_cd target_cd; unsigned long flags; spin_lock_irqsave(&smmu_domain->devices_lock, flags); - list_for_each_entry(master, &smmu_domain->devices, domain_head) { + list_for_each_entry(master_domain, &smmu_domain->devices, devices_elm) { + struct arm_smmu_master *master = master_domain->master; struct arm_smmu_cd *cdptr; /* S1 domains only support RID attachment right now */ @@ -301,7 +302,7 @@ static void arm_smmu_mm_release(struct mmu_notifier *mn, struct mm_struct *mm) { struct arm_smmu_mmu_notifier *smmu_mn = mn_to_smmu(mn); struct arm_smmu_domain *smmu_domain = smmu_mn->domain; - struct arm_smmu_master *master; + struct arm_smmu_master_domain *master_domain; unsigned long flags; mutex_lock(&sva_lock); @@ -315,7 +316,9 @@ static void arm_smmu_mm_release(struct mmu_notifier *mn, struct mm_struct *mm) * but disable translation. */ spin_lock_irqsave(&smmu_domain->devices_lock, flags); - list_for_each_entry(master, &smmu_domain->devices, domain_head) { + list_for_each_entry(master_domain, &smmu_domain->devices, + devices_elm) { + struct arm_smmu_master *master = master_domain->master; struct arm_smmu_cd target; struct arm_smmu_cd *cdptr; 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 3f19436fe86a37..532fe17f28bfe5 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2015,10 +2015,10 @@ static int arm_smmu_atc_inv_master(struct arm_smmu_master *master) int arm_smmu_atc_inv_domain(struct arm_smmu_domain *smmu_domain, int ssid, unsigned long iova, size_t size) { + struct arm_smmu_master_domain *master_domain; int i; unsigned long flags; struct arm_smmu_cmdq_ent cmd; - struct arm_smmu_master *master; struct arm_smmu_cmdq_batch cmds; if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_ATS)) @@ -2046,7 +2046,10 @@ int arm_smmu_atc_inv_domain(struct arm_smmu_domain *smmu_domain, int ssid, cmds.num = 0; spin_lock_irqsave(&smmu_domain->devices_lock, flags); - list_for_each_entry(master, &smmu_domain->devices, domain_head) { + list_for_each_entry(master_domain, &smmu_domain->devices, + devices_elm) { + struct arm_smmu_master *master = master_domain->master; + if (!master->ats_enabled) continue; @@ -2534,9 +2537,26 @@ static void arm_smmu_disable_pasid(struct arm_smmu_master *master) pci_disable_pasid(pdev); } +static struct arm_smmu_master_domain * +arm_smmu_find_master_domain(struct arm_smmu_domain *smmu_domain, + struct arm_smmu_master *master) +{ + struct arm_smmu_master_domain *master_domain; + + lockdep_assert_held(&smmu_domain->devices_lock); + + list_for_each_entry(master_domain, &smmu_domain->devices, + devices_elm) { + if (master_domain->master == master) + return master_domain; + } + return NULL; +} + static void arm_smmu_detach_dev(struct arm_smmu_master *master) { struct iommu_domain *domain = iommu_get_domain_for_dev(master->dev); + struct arm_smmu_master_domain *master_domain; struct arm_smmu_domain *smmu_domain; unsigned long flags; @@ -2547,7 +2567,11 @@ static void arm_smmu_detach_dev(struct arm_smmu_master *master) arm_smmu_disable_ats(master, smmu_domain); spin_lock_irqsave(&smmu_domain->devices_lock, flags); - list_del_init(&master->domain_head); + master_domain = arm_smmu_find_master_domain(smmu_domain, master); + if (master_domain) { + list_del(&master_domain->devices_elm); + kfree(master_domain); + } spin_unlock_irqrestore(&smmu_domain->devices_lock, flags); master->ats_enabled = false; @@ -2561,6 +2585,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); struct arm_smmu_device *smmu; struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); + struct arm_smmu_master_domain *master_domain; struct arm_smmu_master *master; struct arm_smmu_cd *cdptr; @@ -2597,6 +2622,11 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) return -ENOMEM; } + master_domain = kzalloc(sizeof(*master_domain), GFP_KERNEL); + if (!master_domain) + return -ENOMEM; + master_domain->master = master; + /* * Prevent arm_smmu_share_asid() from trying to change the ASID * of either the old or new domain while we are working on it. @@ -2610,7 +2640,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) master->ats_enabled = arm_smmu_ats_supported(master); spin_lock_irqsave(&smmu_domain->devices_lock, flags); - list_add(&master->domain_head, &smmu_domain->devices); + list_add(&master_domain->devices_elm, &smmu_domain->devices); spin_unlock_irqrestore(&smmu_domain->devices_lock, flags); switch (smmu_domain->stage) { @@ -2925,7 +2955,6 @@ static struct iommu_device *arm_smmu_probe_device(struct device *dev) master->dev = dev; master->smmu = smmu; INIT_LIST_HEAD(&master->bonds); - INIT_LIST_HEAD(&master->domain_head); dev_iommu_priv_set(dev, master); ret = arm_smmu_insert_master(smmu, master); diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h index a1b400e3e41878..125b52ea5ad71c 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -697,7 +697,6 @@ struct arm_smmu_stream { struct arm_smmu_master { struct arm_smmu_device *smmu; struct device *dev; - struct list_head domain_head; struct arm_smmu_stream *streams; /* Locked by the iommu core using the group mutex */ struct arm_smmu_ctx_desc_cfg cd_table; @@ -731,6 +730,7 @@ struct arm_smmu_domain { struct iommu_domain domain; + /* List of struct arm_smmu_master_domain */ struct list_head devices; spinlock_t devices_lock; @@ -767,6 +767,11 @@ void arm_smmu_make_sva_cd(struct arm_smmu_cd *target, u16 asid); #endif +struct arm_smmu_master_domain { + struct list_head devices_elm; + struct arm_smmu_master *master; +}; + static inline struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) { return container_of(dom, struct arm_smmu_domain, domain);