From mboxrd@z Thu Jan 1 00:00:00 1970 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 9CECCC00528 for ; Thu, 27 Jul 2023 18:28:55 +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=6IqOP8uoi3sNTOCt73w5xiyGxgFQHUuwlWSGzD/Lryk=; b=IWbuKU2TQ+KpagKSETp+z5FQOs M8wX08qoCF+VHzZTcp/hOJu5YfqQcnSvTU9oVttULh4oO+iWvjKmoGEcgZhdvhAu55+zO3+7teZw/ iieh+O8XN7H6AyS9hpXu+1uoSebxd9QAWJBIAR3rh23E0c0QBG7xZY0TWrHR3njUvQ5CRjeDVPaR/ y4U3vq65P5F4/qm0VRtLzQLHrqfxZDLQ+ELexZJzT0k8YNfem5QVHWlqG1qulNtzzSJ1VPb79oOUs 6DfPkpTIL4DaGZ4c3vOq5MoUGZBWYAji2V3yUGBivOUcILEUHEORkwC0GYF0HnvKXzSoAyhEII4Sa oc5QCP7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qP5iw-0008hX-04; Thu, 27 Jul 2023 18:28:30 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qP5is-0008fO-0e for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 18:28:27 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-56942667393so12096787b3.2 for ; Thu, 27 Jul 2023 11:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690482503; x=1691087303; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=PEh6KP4aD9iwA1DEGVvIcvZM3EWGNO1aoyAMRV7Ud6k=; b=6UcibgH0/zkffRBM6W84mD4r9DVL/EtI4FlBWtfqBvSbi1VSiG3wp4YrHKqt6vHzYy FL2MbFxp1EGvbGO+4xMF+Ul6VUNY2qOz2r/geRKlZD+qda8WvOAL7HYPQh8TOidzSazK ugJ5I4UQGtFngty3B18HAjEslZ+idyUlbjflYpyFNa3plRr5FfAbtctMGDLnPyoxNtOS 6FpT5ZB9Jv8/aYoHlojDjfdRmscKtknpjtYPCMOM1aExka6V6NlW7gpkcVVBw3bcM7s9 XWOUE4qG2ZfyKwTuf1ifFEXLDfyme1jV/1Zat6c3zg9AQzQapm8MKOFJccHdzSEtbJSG 2hNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690482503; x=1691087303; 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=PEh6KP4aD9iwA1DEGVvIcvZM3EWGNO1aoyAMRV7Ud6k=; b=RVKC+9Ht9rN/mjYLCEMNNr57eE+8m+9gyvKbgunRJTLZAQmG8i6bQ3dO5/vhcTTqAb fTu/KKm7IDzxiuOs8IwgBc3Vyi5DnYySDIAVmeWne2MnP1DsRzqAFn4EeRMUlWNUb0Q0 YgTsHLfpzkK/laGSM0GSh0W6TTyA5EMWlAY3YsP9KTDr7VorqG56C1OnmuZE0BT7NGmm QtfvkYQ8RO25ZqiWAQ2+uj7nYI5MDqqWkkYvWnhSgOl4Y+U9DYwSO4V0UTs1q5BT4xiL jmdUkp5MdWyE3ZIfqyvsY7F4rE8hC1l8udqxLM2e3zBZ6C2tUfxiTzQNw7LziavddIf6 mXjQ== X-Gm-Message-State: ABy/qLZTXo/jI+d+sYX6cKGahtoCmwRnzYUag3pvP8O5TCdM7dzxDtDL xbcukpbGThjx04jky533VyuIBsasqvaz X-Google-Smtp-Source: APBJJlE+KrNhoTJJuR379XpaV6B7mKSWJjpW1knp6z874M4nN41DJV5EsUO4z96yxRFrVrr4Pv89Se9VQOSG X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:780f:26da:d952:3463]) (user=mshavit job=sendgmr) by 2002:a25:5012:0:b0:d0d:c74a:a6c0 with SMTP id e18-20020a255012000000b00d0dc74aa6c0mr907ybb.2.1690482503457; Thu, 27 Jul 2023 11:28:23 -0700 (PDT) Date: Fri, 28 Jul 2023 02:26:19 +0800 In-Reply-To: <20230727182647.4106140-1-mshavit@google.com> Mime-Version: 1.0 References: <20230727182647.4106140-1-mshavit@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230727182647.4106140-4-mshavit@google.com> Subject: [PATCH v1 3/7] iommu/arm-smmu-v3: Encapsulate ctx_desc_cfg init in alloc_cd_tables From: Michael Shavit To: Will Deacon , Robin Murphy , Joerg Roedel Cc: Michael Shavit , jean-philippe@linaro.org, nicolinc@nvidia.com, jgg@nvidia.com, baolu.lu@linux.intel.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_112826_239898_DD51F6AB X-CRM114-Status: GOOD ( 12.24 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is slighlty cleaner: arm_smmu_ctx_desc_cfg is initialized in a single function instead of having pieces set ahead-of time by its caller. Signed-off-by: Michael Shavit --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 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 8cf4987dd9ec7..8a286e3838d70 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1132,7 +1132,8 @@ int arm_smmu_write_ctx_desc(struct arm_smmu_domain *smmu_domain, int ssid, return 0; } -static int arm_smmu_alloc_cd_tables(struct arm_smmu_domain *smmu_domain) +static int arm_smmu_alloc_cd_tables(struct arm_smmu_domain *smmu_domain, + struct arm_smmu_master *master) { int ret; size_t l1size; @@ -1140,6 +1141,7 @@ static int arm_smmu_alloc_cd_tables(struct arm_smmu_domain *smmu_domain) struct arm_smmu_device *smmu = smmu_domain->smmu; struct arm_smmu_ctx_desc_cfg *cdcfg = &smmu_domain->cd_table; + cdcfg->max_cds_bits = master->ssid_bits; max_contexts = 1 << cdcfg->max_cds_bits; if (!(smmu->features & ARM_SMMU_FEAT_2_LVL_CDTAB) || @@ -2107,7 +2109,6 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_domain *smmu_domain, int ret; u32 asid; struct arm_smmu_device *smmu = smmu_domain->smmu; - struct arm_smmu_ctx_desc_cfg *cdcfg = &smmu_domain->cd_table; 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; @@ -2120,11 +2121,9 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_domain *smmu_domain, if (ret) goto out_unlock; - cdcfg->max_cds_bits = master->ssid_bits; - smmu_domain->stall_enabled = master->stall_enabled; - ret = arm_smmu_alloc_cd_tables(smmu_domain); + ret = arm_smmu_alloc_cd_tables(smmu_domain, master); if (ret) goto out_free_asid; -- 2.41.0.585.gd2178a4bd4-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel