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 5952BC61DBD for ; Wed, 26 Aug 2026 13:48:28 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From: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=PTXj1XhNbRzNdSYhUQpvFj6zV/RwElqbXeLUIhnw1BA=; b=eCvEct8lvvXGAf8LnaTXHt4woH slzVQe9Sn4klXz3mliW/aZv/VnZ/46fkOP3EetTVpcyJXf/DrUu8Dj8D9Z63m5HRc0lMU0mf8EXY9 C022SaYkSEtT53scDKf0Y4qDocFIhnU8URqGweDckwzvIwn3wQrNLNlFXO3i/OP0LgITYMxng47PK pvqYvlCPquLnPFVPQQnOjYLMqVQy79rNyNjVdtee5CIzyK/vW1MaF+31y/cuQODU287jfUo+0m3Ak e+s+QdBjzYfEW8SwWwdHv/T454a8uGpUi4W6Oy4SxenJU0XDGM6wL98clYaExw0OGmOZA8ccJuMM3 V34YNYIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wzDzF-00000002XsM-1puG; Wed, 26 Aug 2026 13:48:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wzDzA-00000002Xrm-3NFV for linux-arm-kernel@lists.infradead.org; Wed, 26 Aug 2026 13:48:15 +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 02461165C; Wed, 26 Aug 2026 06:48:07 -0700 (PDT) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FD233F66F; Wed, 26 Aug 2026 06:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1787752090; bh=0UXHHnY9sWi5Mt+TALLKcMNNYkDUWfNr6VdZ1KNid5w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FKZ1g40YgIUhhK26pv8YfaYOFuKL+lh5KcBOKAfI2xbETnvre0C6fth7ioPNi9wo9 lEWFLDPGA3ZXoJfrwTH9xmy43U7i4OsL8VuDNuFduM7mDX5wdbX2vaGcF9gf1MfiLt xqxwDicZT+yK1gJt6GTYKZBpwR5kfnwJ2aUCv8s0= Date: Wed, 26 Aug 2026 14:48:01 +0100 From: Catalin Marinas To: Fuad Tabba Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, Marc Zyngier , Oliver Upton , Mark Rutland , Suzuki K Poulose , Mark Brown , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Fuad Tabba Subject: Re: [PATCH v4 2/2] arm64: Don't read GMID_EL1 when MTE is disabled Message-ID: References: <20260825164219.3347229-1-fuad.tabba@linux.dev> <20260825164219.3347229-3-fuad.tabba@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260825164219.3347229-3-fuad.tabba@linux.dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260826_064813_600541_5E878E8B X-CRM114-Status: GOOD ( 14.41 ) 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, Aug 25, 2026 at 05:42:19PM +0100, Fuad Tabba wrote: > __cpuinfo_store_cpu() gates the GMID_EL1 read on the raw > ID_AA64PFR1_EL1, so it reads the register even when the kernel has > disabled MTE (CONFIG_ARM64_MTE=n or arm64.nomte). KVM sets HCR_EL2.TID5 > in that case, and pKVM injects an UNDEF the host cannot handle: > > Internal error: Oops - Undefined instruction: 0000000002000000 [#1] SMP > pc : __cpuinfo_store_cpu+0xf4/0x264 > Kernel panic - not syncing: Attempted to kill the idle task! > > Only pKVM reaches it, and only after a CPU is offlined and brought back > online: its CPU_ON relay sets the host HCR before the CPU enters EL1, > while plain nVHE sets it at CPUHP_AP_KVM_ONLINE. > > Gate the read on __read_sysreg_by_encoding(), which applies the cmdline > override, and on CONFIG_ARM64_MTE, which no register reflects. > > Fixes: f35abcbb8a084 ("KVM: arm64: Trap MTE access and discovery when MTE is disabled") > Cc: stable@vger.kernel.org # needs "arm64: Apply overrides to CPU local capabilities" > Signed-off-by: Fuad Tabba Reviewed-by: Catalin Marinas