Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1248491rwo; Wed, 2 Aug 2023 10:52:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4hOCtHploddOL9uL/+xc4uIoxKv0bhB2cte9vWQdbH9Kl9SKbqMIR84AWuXYfkg++uyLt X-Received: by 2002:a05:6a00:194b:b0:677:c5bf:dccc with SMTP id s11-20020a056a00194b00b00677c5bfdcccmr16985126pfk.19.1690998760666; Wed, 02 Aug 2023 10:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690998760; cv=none; d=google.com; s=arc-20160816; b=SsS0cQq2EHxcMXRJSQJjUx6OLRws2bpvJ8GOum9HPGsgLjZ6M44MzMfBBsZ+oXhKgJ 8iAMf1FS1VNkWYPD//5Ptr/XRh8isIFatKbs/g59YAZ0O6d8MMwKfZKOTVoVO1cvRz3D hhDIQqaqQB7eB1q79zKGgIM1mdlT4crYIivW9+awI6kvggVjZa2eeOV4RjDiuSZh3Syp b6dj8wIH8/nxr50L2ROjnzaDmTwqrRx6Gzdg3kaj2rDZPpiBVA452psxY5tNKexaAySO XJEQrm31EBKvEMrzlF8CSD8NidT5DCIe3Ds3NpGlGEHgxcm34ADQJ+7TdpGsg72KyGSQ A9Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=veFcr7QIuujJbF+cPPo/BT02ofZ8XtwDGisaF+dPAVs=; fh=3mK31xGL8jA+Im55XpA3sxhpxQEv2yMiAaiNF8VPuek=; b=OGnsKrl+SndiZymgwlIG3p/ouu8zOGwDiAeEM17uoUu9KPC054tgtKtUrV9DLzfllH Nr2/TSuJGZmYrkScDgAE8w9M5FdQjvKPzsTUeiluQYDffntMqO94ElPWXchGA63ZHRcp ERKX7xR8xc5+VGfoYGJQvq93RBJfsADh1y2WgDmGLpb1JU+w883w3/o/JYHoT1cRju45 1Ah5HHQ4y2p4SJD0x+TKFTN0xlbKFmicAmagSfPHkp4cRzQbO6EgILWUxiH23fUiAck5 D7g2Jdz6ylsR5hVqocZMxqZeuW1suSfLt6I9yE3GE9NpHw+xuuYr4Q/mQhLUdFlHMzHH MvSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=gdZywKBX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch4-20020a056a00288400b00670db3b5032si3405311pfb.333.2023.08.02.10.52.28; Wed, 02 Aug 2023 10:52:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=gdZywKBX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232569AbjHBR1C (ORCPT + 99 others); Wed, 2 Aug 2023 13:27:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232438AbjHBR0p (ORCPT ); Wed, 2 Aug 2023 13:26:45 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CB779273D; Wed, 2 Aug 2023 10:26:41 -0700 (PDT) Received: from rrs24-12-35.corp.microsoft.com (unknown [131.107.147.181]) by linux.microsoft.com (Postfix) with ESMTPSA id 09BB3238C432; Wed, 2 Aug 2023 10:26:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 09BB3238C432 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1690997201; bh=veFcr7QIuujJbF+cPPo/BT02ofZ8XtwDGisaF+dPAVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdZywKBXcJCK6VmK09jSnkr53SbRVbm33OMn7ckJ1BFTax9jOLcoSlRWx3mRAqoaO +Lk5pOWEnmpGqJC+aNFs+H97H1eY6aSs7fD8xuACXB7oNVbKJjHIlYm8vK1aypl0b7 UvAsS+vajWhqUPbUxPhM6RI7Gem9Eq6KQz5i+8jc= From: Easwar Hariharan To: stable@vger.kernel.org Cc: easwar.hariharan@microsoft.com, Robin Murphy , Nicolin Chen , Will Deacon , Joerg Roedel , Lu Baolu , Jean-Philippe Brucker , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Vladimir Oltean , Yicong Yang , Tomas Krcka , "Kirill A. Shutemov" , linux-arm-kernel@lists.infradead.org (moderated list:ARM SMMU DRIVERS), iommu@lists.linux.dev (open list:IOMMU SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 6.4 3/4] iommu/arm-smmu-v3: Add explicit feature for nesting Date: Wed, 2 Aug 2023 17:26:19 +0000 Message-Id: <20230802172620.1628017-4-eahariha@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230802172620.1628017-1-eahariha@linux.microsoft.com> References: <20230802172620.1628017-1-eahariha@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robin Murphy commit 1d9777b9f3d55b4b6faf186ba4f1d6fb560c0523 upstream In certain cases we may want to refuse to allow nested translation even when both stages are implemented, so let's add an explicit feature for nesting support which we can control in its own right. For now this merely serves as documentation, but it means a nice convenient check will be ready and waiting for the future nesting code. Signed-off-by: Robin Murphy Reviewed-by: Nicolin Chen Link: https://lore.kernel.org/r/136c3f4a3a84cc14a5a1978ace57dfd3ed67b688.1683731256.git.robin.murphy@arm.com Signed-off-by: Will Deacon Signed-off-by: Easwar Hariharan --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 + 2 files changed, 5 insertions(+) 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 b0ccd735f8bb..7e08ec55df2a 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3674,6 +3674,10 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) smmu->ias = max(smmu->ias, smmu->oas); + if ((smmu->features & ARM_SMMU_FEAT_TRANS_S1) && + (smmu->features & ARM_SMMU_FEAT_TRANS_S2)) + smmu->features |= ARM_SMMU_FEAT_NESTING; + arm_smmu_device_iidr_probe(smmu); if (arm_smmu_sva_supported(smmu)) 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 1555c8220381..dcab85698a4e 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -645,6 +645,7 @@ struct arm_smmu_device { #define ARM_SMMU_FEAT_BTM (1 << 16) #define ARM_SMMU_FEAT_SVA (1 << 17) #define ARM_SMMU_FEAT_E2H (1 << 18) +#define ARM_SMMU_FEAT_NESTING (1 << 19) u32 features; #define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0) -- 2.25.1