From patchwork Tue Jun 25 13:35:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13711172 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 07D32C2BBCA for ; Tue, 25 Jun 2024 13:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Rxg4W5wWmOuJroyPITc8wL5mGujxvjAAYfPVq5lzJtM=; b=o2U3jObAUtX1ZSWTZIV18SQN0O XTCU+FoFb0fVnkzGkbqyTaT5mO1BsM/b5ihTpu8CIUpU5TY557q0W5tAdSG9quctatmtJVMIoaeMr TocMu0hIP92OCMShF3fouAKwmEUL/7gtWQbTiG6U3eQIwn90/nDLFMNpLIVkU/umRlCBtGXuS8i7+ Rn4j1kR0xBRosWjM8fDLtiS0gCcTGfxbvQkZtirTGUZDqZCeLeeCCL6XgNT2j94o9y6bQxoG4G67C ufOkx+TrTeUB/Uh7m1p7qw98p5RVm0n9ILm9lEZPaEkxDHaOMmCJxJh8A8kJp57AJR9t4xkxEjDZw Eyls9dNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM6MZ-000000030wO-0le6; Tue, 25 Jun 2024 13:37:35 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM6KU-00000002zxF-2y9C for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 13:35:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id DBB53CE1AEE; Tue, 25 Jun 2024 13:35:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E79F8C32786; Tue, 25 Jun 2024 13:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719322523; bh=Z5W8y2Ri1k0XaNhTI73pukGuPrGrEy3whjorOmdnemc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MApEtANP/FQVQfIUI2nuQag+jwmsncFPyFRDcdPyGXjAMcgMpTt8QIzkMcXEr2mDO 1/kCTvx0/RNm5bja4P1fvJTEE8C9P7S2nKp/F9c92hWdKKf/9AahPWRwrOmyhjuaqn vfWYUfvIEctLk1YGV4EAkwyleIEFNKcx4/5lM4PNfWICx73AhHoOxrGIdAMGIcwaH7 JesC22GdBAglMZt8sTuRq6zr1vg5iQ9cnYUve3ouWOs4Y+1m5XgltfUngqkxhzQlU3 M4MH2xGh+Tcizng5SO7Me1IqWYdL2hDuVuIAPPFMWeXXMEfr8WfGdtespgQdJsCl0m KfwazE7tvZTFw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sM6KQ-007A6l-1I; Tue, 25 Jun 2024 14:35:22 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly Subject: [PATCH 01/12] arm64: Add missing APTable and TCR_ELx.HPD masks Date: Tue, 25 Jun 2024 14:35:00 +0100 Message-Id: <20240625133508.259829-2-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625133508.259829-1-maz@kernel.org> References: <20240625133508.259829-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_063527_166901_F3B4CCF3 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Although Linux doesn't make use of hierarchical permissions (TFFT!), KVM needs to know where the various bits related to this feature live in the TCR_ELx registers as well as in the page tables. Add the missing bits. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_arm.h | 1 + arch/arm64/include/asm/pgtable-hwdef.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index b2adc2c6c82a5..c93ee1036cb09 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h @@ -108,6 +108,7 @@ /* TCR_EL2 Registers bits */ #define TCR_EL2_DS (1UL << 32) #define TCR_EL2_RES1 ((1U << 31) | (1 << 23)) +#define TCR_EL2_HPD (1 << 24) #define TCR_EL2_TBI (1 << 20) #define TCR_EL2_PS_SHIFT 16 #define TCR_EL2_PS_MASK (7 << TCR_EL2_PS_SHIFT) diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index 9943ff0af4c96..f75c9a7e6bd68 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h @@ -146,6 +146,7 @@ #define PMD_SECT_UXN (_AT(pmdval_t, 1) << 54) #define PMD_TABLE_PXN (_AT(pmdval_t, 1) << 59) #define PMD_TABLE_UXN (_AT(pmdval_t, 1) << 60) +#define PMD_TABLE_AP (_AT(pmdval_t, 3) << 61) /* * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers). @@ -307,6 +308,12 @@ #define TCR_TCMA1 (UL(1) << 58) #define TCR_DS (UL(1) << 59) +#define TCR_HPD0_SHIFT 41 +#define TCR_HPD0 BIT(TCR_HPD0_SHIFT) + +#define TCR_HPD1_SHIFT 42 +#define TCR_HPD1 BIT(TCR_HPD1_SHIFT) + /* * TTBR. */