From patchwork Tue Aug 22 10:57:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13360485 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 3E859EE49A3 for ; Tue, 22 Aug 2023 10:58:53 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mg1ysmLHQLzlEGTPmoIRE+FGcGHgvF5IIvbTEkGQ+BU=; b=pIau4/C1SMou7VhUQ+/yvNnmqI 6A9WDvD1Di+fyLycNNifa+9GDq9BLndIvsG9S8303mill6C47/kD6LslS77Q0WD3fvURYjaIEA2UO QGmKBtKG/62tAr67H8nLeESD4Y0Wh5w2VpEU+vHxZECgkLLKP5AAb06EhqHwzK0xonCoJ4srTQdCX +gKG003Lf62EbAC09bTg0jt+gtnTpRW+JSUfEvgDjwPWfmwS6aOg6n+5ikg75fQXiB92pKDuPJkt0 km/JD+2zFvHzA+kmWddmcrs1SsQIKG7fMePMRu0WJDoMiQHMgEERW2xcHjuBnUvywgB+u45HSs9UC nLRE9gOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYP5a-00FmTM-35; Tue, 22 Aug 2023 10:58:22 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYP5V-00FmPy-2g for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2023 10:58:19 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d745094c496so4896670276.1 for ; Tue, 22 Aug 2023 03:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692701896; x=1693306696; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=058zW3MOZIvxq/mgODQOiyKY2M7mNXQxp9+nR9ONw0Q=; b=5+nwyDRA1YhgcC7yjP/COkXuoeJIFR4fcF0iWpy2ZNNXf8pimuDQ+Wg6wMUM9kj+Iz 5OshLB8QIVkkY8xBnDADhvwc6uHg4TbudkHRhB/4IJvfmI4bMthiQCvT0JTbZuQDK5XK 7f/HrmpTPN1Ey8I+KKWg/cCg1Ox7Uej1GYkIN3ifW0TswxfZP8/rkpURgtIKxDCgzrvn wsS367nGc/4hAJW+24oYrz93c7KISdatf9XahRnybxm827ZkXqCFboEcxSXHaYeT5DQo BKoGRlKQkQGWgY4RiXphhqDQpi6yuADPwuiiCowqsOERml0+jSE8e1ibveXKTH6ujlQX Kzdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692701896; x=1693306696; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=058zW3MOZIvxq/mgODQOiyKY2M7mNXQxp9+nR9ONw0Q=; b=R8dlGj07tQ2TkTBsXaZqHXGe+VpfZ/7LaMUgtffukkNrYa9NW343XiP4CHCQ3BTcBB rLzmnv49yEuBGRVbdhQ9zkn3ANAoiyvR9wv+l70OauNmIk7ET3JqGZPMqUfBPvotfiuC ZnosbSj9NYPWIZwma16GXWYNQ5hLXNRgloeaCTj1cmBBOfgokzwycVyvQILHJlKDNLcy m+OzRMNNSGe9qm2tQi74B7u+vyAN8B1zqykviZuFb4Z8heWJn3fZJN+Tu2R/A+UhwVT1 YRSLp+RFEQIAsrC6iroGfFbEgn7esg5WVlBIRZg1iP+O3lkNAm517S85AhzvHFj0SNIx vkUg== X-Gm-Message-State: AOJu0Yys2Npr6GCDANCOJBOnN166kfuImMKLgO+Ged6uQ4MLnKcObLvy nvx3VE01aY1IlpX12T5LVm8izaR/vx5b X-Google-Smtp-Source: AGHT+IHIKqF9VBejqCdz69o9Z+MqzhDnO89Uie4GHPeRpguVq2z8h+BipHm6eAM5P0OGBfj4WYuHrcJO+NHT X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:44ad:3968:8aaa:c4fe]) (user=mshavit job=sendgmr) by 2002:a25:81c5:0:b0:d63:8364:328 with SMTP id n5-20020a2581c5000000b00d6383640328mr77169ybm.5.1692701896632; Tue, 22 Aug 2023 03:58:16 -0700 (PDT) Date: Tue, 22 Aug 2023 18:57:03 +0800 In-Reply-To: <20230822105738.1607365-1-mshavit@google.com> Mime-Version: 1.0 References: <20230822105738.1607365-1-mshavit@google.com> X-Mailer: git-send-email 2.42.0.rc1.204.g551eb34607-goog Message-ID: <20230822185632.RFC.v2.7.Ia591869e7a4b88af16a57e09c92df21599d3312c@changeid> Subject: [RFC PATCH v2 7/9] iommu/arm-smmu-v3: Add arm_smmu_device as a parameter to domain_finalise From: Michael Shavit To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: nicolinc@nvidia.com, tina.zhang@intel.com, jean-philippe@linaro.org, will@kernel.org, robin.murphy@arm.com, jgg@nvidia.com, Michael Shavit , Dawei Li , Jason Gunthorpe , Joerg Roedel , "Kirill A. Shutemov" , Lu Baolu , Mark Brown X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_035817_866918_14B7B631 X-CRM114-Status: GOOD ( 15.10 ) 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 Remove the usage of arm_smmu_domain->smmu in arm_smmu_domain_finalise as it will be removed in a subsequent commit. Signed-off-by: Michael Shavit --- (no changes since v1) drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 2f305037b9250..7c9897702bcde 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2150,11 +2150,11 @@ static void arm_smmu_domain_free(struct iommu_domain *domain) } static int arm_smmu_domain_finalise_s1(struct arm_smmu_domain *smmu_domain, + struct arm_smmu_device *smmu, struct io_pgtable_cfg *pgtbl_cfg) { int ret; u32 asid; - struct arm_smmu_device *smmu = smmu_domain->smmu; struct arm_smmu_ctx_desc *cd = &smmu_domain->cd; typeof(&pgtbl_cfg->arm_lpae_s1_cfg.tcr) tcr = &pgtbl_cfg->arm_lpae_s1_cfg.tcr; @@ -2187,10 +2187,10 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_domain *smmu_domain, } static int arm_smmu_domain_finalise_s2(struct arm_smmu_domain *smmu_domain, + struct arm_smmu_device *smmu, struct io_pgtable_cfg *pgtbl_cfg) { int vmid; - struct arm_smmu_device *smmu = smmu_domain->smmu; struct arm_smmu_s2_cfg *cfg = &smmu_domain->s2_cfg; typeof(&pgtbl_cfg->arm_lpae_s2_cfg.vtcr) vtcr; @@ -2245,16 +2245,17 @@ static int arm_smmu_prepare_pgtbl_cfg(struct arm_smmu_device *smmu, return 0; } -static int arm_smmu_domain_finalise(struct iommu_domain *domain) +static int arm_smmu_domain_finalise(struct iommu_domain *domain, + struct arm_smmu_device *smmu) { int ret; enum io_pgtable_fmt fmt; struct io_pgtable_cfg pgtbl_cfg; struct io_pgtable_ops *pgtbl_ops; int (*finalise_stage_fn)(struct arm_smmu_domain *, + struct arm_smmu_device *, struct io_pgtable_cfg *); struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); - struct arm_smmu_device *smmu = smmu_domain->smmu; if (domain->type == IOMMU_DOMAIN_IDENTITY) { smmu_domain->stage = ARM_SMMU_DOMAIN_BYPASS; @@ -2293,7 +2294,7 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain) domain->geometry.aperture_end = (1UL << pgtbl_cfg.ias) - 1; domain->geometry.force_aperture = true; - ret = finalise_stage_fn(smmu_domain, &pgtbl_cfg); + ret = finalise_stage_fn(smmu_domain, smmu, &pgtbl_cfg); if (ret < 0) { free_io_pgtable_ops(pgtbl_ops); return ret; @@ -2565,7 +2566,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) if (!smmu_domain->smmu) { smmu_domain->smmu = smmu; - ret = arm_smmu_domain_finalise(domain); + ret = arm_smmu_domain_finalise(domain, smmu); if (ret) smmu_domain->smmu = NULL; } else if (smmu_domain->smmu != smmu ||