From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EF8F1FB4; Sat, 13 Jul 2024 08:04:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720857874; cv=none; b=akn3rQlT+nw0hSwWwoi43u52x+Vvs29wIkmvNzEeaG6zv6yWAo6hgL0vRGiXxh9D2ef/xyF1ochSsPz5vkSBIDykHdsFTxRZ7+orZOK05aXjaR/Ewr+qqrI1p1cfEScSEjat9wPRpjPqgS5BihWtKpCobtQZYMJWExA428LVXkY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720857874; c=relaxed/simple; bh=nE2mhPrr3YyGaYn+mzlgQmFx15z5pUfHCBByh86gxOk=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=Mz0TvpnNVHbHUwzo7sC0obA0CKDLxY6KOSaasWBQHvM2B9a5F625KvIhIuYuaALFwOAPeUvooXXjJvEbZZfmC5q4ooV3hERvyb4E7p+W/vbvU9fTmQwWTegkhKf1kU7Ewun1AuRsukozQbhDOwdbXcT+841tLnVFZLX85rOPJLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OX0Jmdnk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OX0Jmdnk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DAB3C32781; Sat, 13 Jul 2024 08:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720857874; bh=nE2mhPrr3YyGaYn+mzlgQmFx15z5pUfHCBByh86gxOk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OX0JmdnkJFAa+BQKjT0NqWPU5cIoM74Fgg+QN1RahO5zV6AaScHeun3TJiJJQ0gyP 4HLq145Jy6oGUBX3rqnW4SUWX8J5KlU8KKLxVGpWUNvtgvz2EixtVyq2YqrFnbzLgZ B5Cb+g5sudZyXrHw2NRKN1sr65Im9VWBWO9fOV9OLptz9dr9UxHFtNH6To2bfkI5F4 QLG39dwikya+iJqSFcBkSnLzdgQlGMiy+kUg3dCS9cH4QL8mWiSRT24uYwH6MMGncl Fdx8OQG3nxWwFYBfCVKCe3TLCp4AbBObkvBgbK1yYMwR5Ie/EqyDb+cwk7KUP8gmiQ TliyR2l+YFrAA== Received: from [213.208.208.122] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sSXk7-00C3ly-SZ; Sat, 13 Jul 2024 09:04:32 +0100 Date: Sat, 13 Jul 2024 09:04:31 +0100 Message-ID: <87zfqlogz4.wl-maz@kernel.org> From: Marc Zyngier To: Anshuman Khandual Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly Subject: Re: [PATCH 01/12] arm64: Add missing APTable and TCR_ELx.HPD masks In-Reply-To: <3fc8eccd-21a7-40d8-9851-24941c8414da@arm.com> References: <20240625133508.259829-1-maz@kernel.org> <20240625133508.259829-2-maz@kernel.org> <3fc8eccd-21a7-40d8-9851-24941c8414da@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 213.208.208.122 X-SA-Exim-Rcpt-To: anshuman.khandual@arm.com, 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 On Fri, 12 Jul 2024 09:32:12 +0100, Anshuman Khandual wrote: > > > > On 6/25/24 19:05, Marc Zyngier wrote: > > 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) > > APTable bits are also present in all table descriptors at each non-L3 > level. Should not corresponding corresponding macros i.e PUD_TABLE_AP, > P4D_TABLE_AP, and PGD_TABLE_AP be added as well ? My problem with that is that it doesn't make much sense from an architecture perspective. It doesn't define any of these, because these names make no sense. Maybe I should just drop the PMD prefix and write it as S1_TABLE_AP, so that it can be reused if we ever need the P*D names. > > > > > /* > > * 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) > > Should not these new register fields follow the current ascending bit > order in the listing i.e get added after TCR_HD (bit 40). Yup, I'll move them up. Thanks, M. -- Without deviation from the norm, progress is not possible.