From patchwork Tue Jun 4 00:15:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13684530 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 224ABC25B75 for ; Tue, 4 Jun 2024 01:31:26 +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=RwsDOXxUkvnaRkBk28purQtGgAtDhemKb/OqIAqMA5A=; b=0Icj/IuofrQLLe 8d2+z8ko9vAfvLngX31dYeMe//iOsj8GohIM9+Da1cVx8/FqrWnIpMbUa6PTVoCiaAF/SwXn22J77 1X9yVqjZ5yez99o/fsg1iVAYGpkVoO9y2gnGHVGOpMmafTWRV+jp38yOpGKZwRbGNKZwru5QN74PJ 1V2fUPZAqzUCD1yElAl1Ej48PKPy6JV0LzYOMbbFP9k6WKa+gMhzNdR33wKRznHGlxSKIQ1FtwL8z EYpdfpSDT1UmKw+eyC637U/B/+QdTBqPAPkRB0WAnRPnq3NK1jaz0Xk/HokNGIcefPYZFVuwKTLH9 tNHCK/JOJlbkt8BsMpsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEJ1B-00000000ovI-0BRd; Tue, 04 Jun 2024 01:31:17 +0000 Received: from mail-co1nam11on20601.outbound.protection.outlook.com ([2a01:111:f403:2416::601] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEHqc-00000000hYh-1Sue for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2024 00:16:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P1+yxjMwur7U+nH73TDhNIAgd56XVdn4729z9kRHVJGBAFlp/eNJkNjlM28jAzgnemH6W0aZgAmaFkjqVH+zrsm/cYZY4wCjVbTH645wkidYw9S6UNx9CggHyt0S0jw2LJ29dgW6uhyjpnvIMkHX5VAcN2u5J+WLoMt0hPHKmlpZ4TORwTgXaG8IuLCHouOWwIL1Wxtak3pO8fZAg7mTVioTXNKG8zgA2EzSLdo9GAtic0Mvn45QzowV3MktlU4aLh8ESomWwIbUmY7q8mtS9/FFdZJGLpn3CeY3RHCj1TQ7dtP0th3QpUGs0CdMRM+GR8aALGja9mudSE/5mi6IBg== 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=4bSNGu6tQCzzJLAcHFS1wQqKfLhgXoSFyjeA6C5JJTg=; b=loomH1yF1R94fdFp8VLzL6//60mUGthc5rhLHy40h4Rf1QlRDTCF2b7fFSTiLUdA4jiiXYn+Fv8x8vIbOm5tNVo9xr8EGkuxZeqKH7+hA4+zQt1u/vEPYK6x+62GXZNj7bbeZP8gO7ts1BP9Db+GPZ492YbHkjTQj7QzWo8J7W3nR/4kjQCAD8Q/+uBSEWJi8RO4BoXc4/aQxvCJawvK9uNvfRkgNK+JargvvWn4j/106PFJwVT8kv13Pu6uGC1q7gbPjb5e6EftT4KNP0hTIdoy3tCsjj1i9ijUdsjjTMYAYjxLKr09Bs3lkluk0V+1ag1fZLO4143CE2OfgJuaTQ== 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=4bSNGu6tQCzzJLAcHFS1wQqKfLhgXoSFyjeA6C5JJTg=; b=Kakmpo2njG9rEtyz/Rubp7sJKejPnSsCjJmI8+k9kPHRzJlWEMx7PFRwv0Il9WH8bHzEpVM3uIva+spYj1x4Zb83A70MMXXVuOqpZjl5PxKexCcqLLV1RrxlRoJ7xB+jNSPd07gizlGFI8fy1bLqeU/KeWfL9Yr++5xhxBc5uZUufjimhhJSquGMlqPa+NFP12ElycJwT13uIr+6M+8ED4DHP7hn3jpGotsSoz1gpyCvRtN7envCIU5lHqop1VGxM6UVqD2u42KQgSe3jFt7T982UyCX/Y2canX9ugpdjTAm7NgqPbhLDdc0aGVjLW7RhM2K83MqDHyH98Nn6MXhBg== 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 BL3PR12MB6451.namprd12.prod.outlook.com (2603:10b6:208:3ba::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.24; Tue, 4 Jun 2024 00:16:07 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e%4]) with mapi id 15.20.7633.021; Tue, 4 Jun 2024 00:16:07 +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, Shameer Kolothum Subject: [PATCH v8 03/14] iommu/arm-smmu-v3: Make smmu_domain->devices into an allocated list Date: Mon, 3 Jun 2024 21:15:48 -0300 Message-ID: <3-v8-6f85cdc10ce7+563e-smmuv3_newapi_p2b_jgg@nvidia.com> In-Reply-To: <0-v8-6f85cdc10ce7+563e-smmuv3_newapi_p2b_jgg@nvidia.com> References: X-ClientProxiedBy: BL1PR13CA0429.namprd13.prod.outlook.com (2603:10b6:208:2c3::14) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|BL3PR12MB6451:EE_ X-MS-Office365-Filtering-Correlation-Id: 31a869fc-9546-4ad0-133d-08dc842b85b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|1800799015|366007|376005; X-Microsoft-Antispam-Message-Info: Ir+D3UHNv+iUk31d6pufabtrCuBz2rGcNVQ8C0xjwdwfES7LBJceU517MoNgXvRbvDkp+v5G/7uvkLsEesJDLjip1NrqyokTPaJeCjLhZRYelPv6mEWRQsUYHkPT2AGbT+f2t2h0FVDVqbKanSakn8Fn0KDWxQ27pB/vUjk+SJnpGunoSdoTi9VX3Jp46tsVWNsppv1fgjRDCUIzwLzWJghIpJKpAM3msXR5yQWUXQq107fmgtcS5PRgTaxhwLF+rHmbyQUuq7jfWMgacVhBFilSJ7PKahiMz0TwtdTdjysuvSmsRrKoYhGjYIDKYGQ3FTXGuV9QDOOzG8SCtdv+FdC9vLm64JvP+faF4LL5LlBZVR17jc/ZIpRqiyWhnMHbGs3IbsFwNzf9vUkKEz/RSsYd0D10rTUWyCR4jY6nMIJb0frWXDclAfEONZsWPjZiir8uAykTbmVRxeKm8wmqAPKlp5pBrCkV9chgLhI++AOtlhmVDQywFTdk7vyjy2yYsEh2eVDiKd/KnQNDDLzYqkdgm8PkJWB8UAZNZBgwKj8yxsaL6jIni72caiFc6vEMlKQngux3++orLkcT3AfIiH1nvAUcdAJ589n1EUfFHvkQ9GvGebkEIDtzLzBou2VCGSbwgH42mdWxQmYyd9fIjXl15Qu9pH5/9aVL8dhVvzce4AwQ6vbxZ7MNALalBctJJ+FAo8852ByDXFpRQKynJno6SV8P6ZVhFoJ26r0vFKVGsxuLFx+1BdNOrAP3tjCcuYZBtG1qgECsMQv2BO6ihf9ialHixTxJiI18k0gJICG3L0DWWDMGhjzkTSubGNUwWlTnqo8hbhBbph3mfRPLAAggk276qfmU8JIGXcY9g5KzNBRQw0KCvqvYjEeOJQ9fjjmNLuZw2WxaCTvbVITNv/poFKpWkcixGFIh/uHkPFYB47WWiUpwn28zRjMIpRWSsAk9saQrQDqI3QfKy42iEgmL0yYLVNNwj71llxMVKujg178k1qwKxe+OxdIjchd0ROv3J2SB54uzxhAKdX9CdGhJe6tiGRlR4tfJ/i1Gdo7LMd2rr8+/7wt03c2GamSWEoAU8ZvulT1HYFiuoHNrtbj9YsnUta375eF7UeQOc13SDcZARRzbHFe45krf9LHiOIp1PF3LTWMP4FhbPeh+MRImBZ9efgvpwcUJeT8LdzMh0kGfM++QiVCjJCZIQxTXAc8RwBgZBDh15j+wJkXz388qrP9agS/dQwiXiwkxaJ1+IZX/pEp0bExfDcCvlHUfhovcmb0U/tvR2goRXS9Dgw== 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)(7416005)(1800799015)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uoDPsxXReYF2gZgejRQrpdE5ckTVqM9KRqPd/N6ATv4kb3WKHG0sHlQGAt2n5UFjjFHjKp+SlCkxWgtLC/X2/LhGamf9T5L4hD/u8exfGxEZZoQIqytNk9/nXmp8aezy7hAQmWsfBpzR81CsfcYCUVDKYYKi46qXMuNBY85EQj2cXXoVyeeEImSVUvsRHxo5xG9YXTSG1XVDK37RSshlZ/rneG6UFOLHghR5rmhLsc4qhqzPFcTwwBPG8/W85mdrtxlXlF/APpF+OgHeF51C33cfkw5a+4ROxoBs8v5IVpW1VrW5IMCy7lXMw/Hrl07zbqUFcPZ/wa7GfLIDZxAwR8+NSsU8VaPB5VFNXachsTSri8RnoPf14wpLfLiLKBFPOsjG6a8D5ANhp9/eb6YXSTVmLyVsTRi9KZqI9NTuNrWFaeCLg0FHvGj338q9aofUbQOsTEmzfYKvK6uvEscnOGlGfWPABz3LrC9KCEINT7xIAQZ02VYsHDQT18/HfERGRl/DUEsQ1oaFLhlEeJ1s9g60d65Bn7H3Zv2B9X4GxlHYdXy/yryk2pHuduKxGp6xvmvskNuYSP7Q450WpOgl7KxDzDAHCpUv7LAqkIS+nHIsFpBcEHDuwHRmly/wqSdyqalyiPbR1lA14EQJHVs8tMnPgrqcjrFHzcTwCB3qgfm+nlGy8V9Ey0rw61LgiuZXW+y5+zu6VzkZYo4iV4o06tVWc2fktXZm/rqppA2uMljOJ4oJ9GOt2LnmAyF4eWfHjeuGpky6N+Uve6QV5lmqQKco1ONis25KxJh5P2CIBv8YU5k6yFm+sPVhoN0m5slIQt60mmfX5Wicu7HBd6Le7mmHHS5BUMgesj3T5JSQKSKW+B0Od0N3BwIR3jvb4N5Dsx1/4DG/njibBCVUYpmCrU1Z+3PG74UpONUh7EzwBAIR93U39xRj8K5A+InofYOslC51fMxqCjFKuoBKUSKI3nT8QVm3bcwNzl5OS3kZbD0u4r495jeXVbr9djUfLLyJ51D9bp4bb92UxK1rOaALaN+JeLH2MvOSE9226q2BH9WMLSxCsxEqR2MIb8312TPYf9YbyJ2AfuluiiY7D9AdVOu/6+w/q7EgcthrqM3YyOHmW33USxCLAgU7rCRGjuEdCLv+H4osc6JUl0TZTyALAu7w+tfx1ibBgEdeWvd90/nNOfYruqndmnXAMhLC32kF1F4tj2ipxCtHY1seAjbTNrPsMheqzO31h138wwo4oMyby9wNBX1ieLALWUn93C/gCUj5LEiCpLZGphHrftHb698gHpTB3vL95KnLWQTvDADzvlOX01qvj8iRRfiurwQ3ZogwEpvIyupW3uXJGltXgZCoBm8ZEnHZ5iP3gNcfMpKDWX8fA7ikcBOz7QHPwL/Y6EvuT5G5D5OUlHI7NGn8cP7c/czk2dBUm3HDO7wg8sPr4F1DIVPAXGBOhBkdhSCyZ0cgIK0jiaiNtIg5vqQcacJEnku2sgP6Yasb+MECn0PRkzer44vVot5kmdIkyiCU0zQlKQl876mju5GVlBHdSORqJmbtompfIs4j+/WpKrc= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31a869fc-9546-4ad0-133d-08dc842b85b5 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 00:16:04.3613 (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: y7Fjtomy25QGsiFuKGrYkqLC65wtNriGzWPkKVXKDQwsb4DqeqyeloEagkKlkZaB X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6451 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240603_171618_631087_0502CCBA X-CRM114-Status: GOOD ( 16.53 ) 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 Reviewed-by: Nicolin Chen Signed-off-by: Jason Gunthorpe --- .../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 6a74d3d884fe8d..01769b5286a83a 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);