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 7D7BAC3DA54 for ; Thu, 17 Aug 2023 16:36: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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pxOejOF2Ngo8iPnAMRyFz4zZ/yrbfIBalCmLv/p33mo=; b=em1+j9dvD2xsrQ ZygHrTXTi1ei4cNh8YS4Zi72dwwpvOVdyJbSp0n+q3F2ASoUij4DTkb+FbauNllcE+nhyoqO09IGb aTf1VcQpXDeweRct3EzDxoGsVxp31R3vbfLnJgtlliY5Dw3T3HzDpJU81bDlDEO86GxBzNnC5oym6 mz84SUpgyJeOuJEbGadXc8RW4sIjjCBWHzcRlPPteTAPoi5pC+iwRowTx7jbzmsUpHygxsF2el6M0 yOmGU18pFKrVD6iVaYT429ejETUVI5qUR8BOqC4WEFqH/cPbMrd8PY3ohQ1ylA26drJ42wh8DcOiT xOl0g66QIMdkP68qYNrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWfyL-006nWZ-0c; Thu, 17 Aug 2023 16:35:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWfyI-006nVx-1w for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2023 16:35:44 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C016AD75; Thu, 17 Aug 2023 09:36:21 -0700 (PDT) Received: from [10.57.90.41] (unknown [10.57.90.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D6A793F64C; Thu, 17 Aug 2023 09:35:38 -0700 (PDT) Message-ID: <928822fd-642a-5ca7-7b42-dc7885f3cf51@arm.com> Date: Thu, 17 Aug 2023 17:35:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH] iommu/arm-smmu-v3: Simplify stage selection logic Content-Language: en-GB To: Michael Shavit , iommu@lists.linux.dev Cc: Jason Gunthorpe , Jean-Philippe Brucker , Joerg Roedel , Lu Baolu , Nicolin Chen , Tomas Krcka , Will Deacon , Yicong Yang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230818000321.1.Ibca43cc8d1bcad3ac3deef5726b9745128aea634@changeid> From: Robin Murphy In-Reply-To: <20230818000321.1.Ibca43cc8d1bcad3ac3deef5726b9745128aea634@changeid> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230817_093542_682184_1AAD29F3 X-CRM114-Status: GOOD ( 16.33 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2023-08-17 17:03, Michael Shavit wrote: > It is invalid for an arm-smmu-v3 to have neither FEAT_TRANS_S1 nor > FEAT_TRANS_S2 bits set, and this is even checked in the probe. > > Only set ARM_SMMU_DOMAIN_S2 if FEAT_TRANS_S1 isn't supported, otherwise set > ARM_SMMU_DOMAIN_S1. This is clearer as the existing code implies that > something more sophisticated is going on with the stage selection logic. The reason it's like this is because of arm_smmu_enable_nesting(), which *is* the additional thing that's going on with the stage selection logic. Thanks, Robin. > Signed-off-by: Michael Shavit > --- > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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 9b0dc35056019..e74c8c630adfa 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -2206,7 +2206,7 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain, > /* Restrict the stage to what we can actually support */ > if (!(smmu->features & ARM_SMMU_FEAT_TRANS_S1)) > smmu_domain->stage = ARM_SMMU_DOMAIN_S2; > - if (!(smmu->features & ARM_SMMU_FEAT_TRANS_S2)) > + else > smmu_domain->stage = ARM_SMMU_DOMAIN_S1; > > switch (smmu_domain->stage) { > > base-commit: 6eaae198076080886b9e7d57f4ae06fa782f90ef _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel