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 6480CC88E72 for ; Thu, 17 Sep 2026 10:59:31 +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-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8pvb3DrQTOeiip8i/IQe7dJP7/pPWH7CBfuHAq/9GoM=; b=nyM5gl8gvaU39cuoCR7hdAb1mN VBxUrZeCEDa2WXvryUtX502SSh3SlAgOJcXSroi29dmrprCf8ACVOdLtIhHwdcQzYtPL/5QFLtzNR hJ9Ux8eRyNW/Aw3P2g9vjJnF5iOvb7uQQSRMhlQ1+EQiuPoP4bxKVnj2RtdguxG2US0PW0WozGyKU lXrFRI/vwppS89Lz4WIUiHK2OGndcqVkgj75vyldW3KiPy/unvOVG9Ly6VmLPob/yrdMpgS35FnQX aQoHJFUUaceW8XbUG1VpLB32vI5WTUvc1boODxm6Bv8ozciwSnyh48p7kqRv5SnkZfZ/sKoWGfZ0S S99p8F9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x79ps-0000000B9KR-0FRB; Thu, 17 Sep 2026 10:59:24 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x79pn-0000000B9KG-2HFm for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2026 10:59:20 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 0BF3E41380; Thu, 17 Sep 2026 10:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E157A1F00898; Thu, 17 Sep 2026 10:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789642756; bh=8pvb3DrQTOeiip8i/IQe7dJP7/pPWH7CBfuHAq/9GoM=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=CFkfgEEAfb4TssHRW4txBICPiBcbUS2rNEE8waAlHV0plSW9FG1AHr93v902SYLd8 A0pdE3yBg01GQAl2o07+sJdflrXa2lPLrDbFxps1XpXURChdVNzIh0Tl0X965+Gtgo M3qPMJBoOMT6dyXJeIpGTkN/D9AETxVrMExYoh9/SdrO9lN1oDfqfXQhesBz43QJ0Y JLGbfBpnROj/zhvuM3iX+iWJAyb5sq0eXlDLcrSuxLuptHtNVD4mlZ9kclveLVa2kP TUF/GbihNlluTkfPtBe2rIOhr8cdNEfEHSzNu8sFmMtk8SC6Y64rago8pTSOuV2YW+ IHF8p3JH4SzoA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x79pi-0000000A32Y-1qZt; Thu, 17 Sep 2026 10:59:14 +0000 Date: Thu, 17 Sep 2026 11:59:14 +0100 Message-ID: <864ifo5ekd.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Oliver Upton , Catalin Marinas , Will Deacon , James Morse , Ben Horgan , Xi Ruoyao , Mark Rutland , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Steffen Eiden , Gavin Shan , Yuan Yao , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] KVM: arm64: Trap guest MPAM accesses whenever MPAM is implemented In-Reply-To: References: <20260911104715.307500-1-fuad.tabba@linux.dev> <868q5579ol.wl-maz@kernel.org> 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/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: fuad.tabba@linux.dev, oupton@kernel.org, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, ben.horgan@arm.com, xry111@xry111.site, mark.rutland@arm.com, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, seiden@linux.ibm.com, gshan@redhat.com, yaoyuan@linux.alibaba.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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 On Tue, 15 Sep 2026 19:51:00 +0100, Fuad Tabba wrote: > > Hi Marc, > > On Sun, 13 Sept 2026 at 11:00, Marc Zyngier wrote: > [...] > > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > [...] > > > static void cpu_hyp_init_context(void) > > > { > > > + u64 pfr0 = __read_sysreg_by_encoding(SYS_ID_AA64PFR0_EL1); > > > + u64 pfr1 = __read_sysreg_by_encoding(SYS_ID_AA64PFR1_EL1); > > > + > > > > Why not directly read_sysreg(id_aa64pfr0_el1) and co? > > __read_sysreg_by_encoding() is useful when the encoding comes from a > > variable, but it looks odd in the case of a literal sysreg. > > It applies the arm64.nompam override, which is what > finalise_el2_state() tests. With the override set, EL2 setup leaves > the MPAM traps alone, and a raw read_sysreg() would still see MPAM in > the ID registers, so KVM would write MPAM2_EL2 on exactly the firmware > the option exists for. I'll add a comment. Ah, good point. A comment would help indeed. Thanks, M. -- Without deviation from the norm, progress is not possible.