Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp374185rdb; Thu, 22 Feb 2024 06:31:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWTkYqySjhNyIAe/EfQbyycaqBq6zTM59z/YIOw3I7UmKIIitXtIi/cl0Q6cZiEtBFkBl+e/oJhG2Hm2hYpy+mpb+9wdS4j65HS4TreuA== X-Google-Smtp-Source: AGHT+IFlOWhh0PRVzy/C/ESH0Hoi1aD58SylLaBS5um51JmMmutZeG4qAvykdnhql0Dpv8wIhBY9 X-Received: by 2002:a05:6e02:b4a:b0:365:1b7c:670 with SMTP id f10-20020a056e020b4a00b003651b7c0670mr18170723ilu.8.1708612315852; Thu, 22 Feb 2024 06:31:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708612315; cv=pass; d=google.com; s=arc-20160816; b=dNLfZ+l0aDP8dtktm1iohNGSGBAqt3yjEtAsurIlsVY09Qhu+JJ9yNrhwn2Ve5Xnyk 464aC6aCSqwujntL1vyGxc/2iYYUF8UvqkW6NE+m4IHDUvrt7oRKt2zakGeN7rVVqO76 KfhyfxjgYq6Qch0JvexCgvvs2matGiDYeHcmzcQ+ZQ9wtDB6+iHEonN4b9PYJSPC7zYs ArSrJVFGrl6RfMHuWH16X6g0WIHVGT8GBqim/NexPSstH5jBOLEFy/pwM5T9IkJFcHlC cNEutsqXy6MivBoU1D8bB1HM2c8U1I8xO3dIG/AfDJbenKIpL2I35eq1Qc8YoDN7xc3S Abpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=LZFCyWIfLFRTvNSSNagTnoP8OT9U5CcrUyXm7/ftQn0=; fh=8JpXDNFx8sNuwfYjsoyXe5q/hO4eww05KHXf4V/14+4=; b=QplVa6b7a3tyCJNF98EtvyLp/RQg/PIR4UfY93mch80kDP+XuzpEhCIPn3h1Dazole QXG4y352oX8kZwvsXw+3uYwDHWDqey/59I1/T8kzVHzUEO4YLSTAyn/OURx+VOXsfBkD R61vbN5jzam6H8itfWFAocWEHVT2MhXFqKeK/x586/LTwwX8e8SZ4wxMinTdE07OzXHj 0YBW/+PUGxXx+uoX98nhMCoSit67uNiu52qKg2A6c1ly4kIXKj7Pi19rDH22wixLyQYR bugHMRC+4eLI25TfKKcXnCHux4Dp3roU0935T/w4HVUBnb2pEQbC4v9XW+TgBlC4I2rX 688w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="St/l5Cmf"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76703-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m23-20020a637117000000b005df59056fd8si9768569pgc.517.2024.02.22.06.31.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 06:31:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="St/l5Cmf"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76703-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7C1E8282502 for ; Thu, 22 Feb 2024 14:31:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CD941482E9; Thu, 22 Feb 2024 14:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="St/l5Cmf" 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 9F066134CC2; Thu, 22 Feb 2024 14:31:43 +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=1708612303; cv=none; b=ffNDwqUYrmG7yGBc0JCVWnEowoPKmFCDN3T3Y6JQJluBM2VwNyTjjok9hsUZm+7Xh4+aTe4I+Y9KWQeNC4fJkCbVH+YhYSKIhgeUGBETzOwVpv3/aYFk0vIuILPqjcfprMu6KIjcisG9p+vC2nPOVHk4urNia9h2c1lZ9UBRQ9U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708612303; c=relaxed/simple; bh=fWM5/IIptB8qiMmDicnhEXv1YrCPrUbI/y/AmEvYnR4=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=BH4Nsr2YwQvlvpiUSz3/hzma+aOugas5djYAmWsYWSvmx7NW+0414PTHRD+I7guhGdcJ+EwdFNBDB84C2ytxatYRes47GilVoEX/Hs6NRhDBZ8NRO0CxkDHl0PQV5mOIUulQXHw7gUBtYt4W7xZEnZVl0PGbQttMxCHGeZPbQXU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=St/l5Cmf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F57C433C7; Thu, 22 Feb 2024 14:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708612303; bh=fWM5/IIptB8qiMmDicnhEXv1YrCPrUbI/y/AmEvYnR4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=St/l5Cmfq8JVGWmQlPPDcs0go0XirWQniOnrthUt/k7WDo+z5s8LNdUj8+m7PHqix rw+j0GpJNSUYfBgYUmlOliR2QN5VROEjgj4GKOOVoBED2LD8mcZ9kO9zSOKt9fv2Jp Mw4P8onpPP8o6enDqdvXx9qvD9IzbPVSjLCqloIDMgWsf6iuhLoa1pvjaNmcU9/im/ Iv3ZJ6KqOs2JDB20SflQKX8YdCQF6x8USnsGMmSQlWVUtDkS0/O4LHaZO4/An25niG GEmXXg8hWckXwyAJ5uSKM0A2jQdnqq8kQsXKhIx9w9bsvgCwLbFOiTYOWxE/rypZyW mnD1YIh8oHTXg== Received: from 82-132-212-42.dab.02.net ([82.132.212.42] 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 1rdA6u-005lAs-PH; Thu, 22 Feb 2024 14:31:40 +0000 Date: Thu, 22 Feb 2024 14:31:38 +0000 Message-ID: <87frxka7ud.wl-maz@kernel.org> From: Marc Zyngier To: Paolo Bonzini , Oliver Upton Cc: Stephen Rothwell , Joey Gouly , Christoffer Dall , KVM , Linux Kernel Mailing List , Linux Next Mailing List Subject: Re: linux-next: build failure after merge of the kvm-arm tree In-Reply-To: References: <20240222220349.1889c728@canb.auug.org.au> <20240222111129.GA946362@e124191.cambridge.arm.com> <20240222224041.782761fd@canb.auug.org.au> 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: linux-kernel@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 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 82.132.212.42 X-SA-Exim-Rcpt-To: pbonzini@redhat.com, oliver.upton@linux.dev, sfr@canb.auug.org.au, joey.gouly@arm.com, cdall@cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-next@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 On Thu, 22 Feb 2024 13:11:59 +0000, Paolo Bonzini wrote: >=20 > On 2/22/24 12:40, Stephen Rothwell wrote: > >> This fails because https://git.kernel.org/pub/scm/linux/kernel/git/arm= 64/linux.git/commit/?id=3Dfdd867fe9b32 > >> added new fields to that register (ID_AA64DFR1_EL1) > >>=20 > >> and commit b80b701d5a6 ("KVM: arm64: Snapshot all non-zero RES0/RES1 s= ysreg fields for later checking") > >> took a snapshot of the fields, so the RES0 (reserved 0) bits don't mat= ch anymore. > >>=20 > >> Not sure how to resolve it in the git branches though. > >=20 > > Thanks. I will apply this patch to the merge of the kvm-arm tree from > > tomorrow (and at the end of today's tree). >=20 > Marc, Oliver, can you get a topic branch from Catalin and friends for > this sysreg patch, and apply the fixup directly to the kvm-arm branch > in the merge commit? >=20 > Not _necessary_, as I can always ask Linus to do the fixup, but > generally he prefers to have this sorted out by the maintainers if it > is detected by linux-next. I think that's not the correct thing to do at this time. I should have timed the introduction of these checks a bit later, after the merge window. But more to the point, the proposed patch is also not the best thing to merge, because it hides that there is a discrepancy between what the architecture describes, and what KVM knows. I really want to know about it, or it will be yet another bug that we wont detect easily. Specially for ID_AA64DFR*_EL1 which are a bloody mine-field. So I'd rather we make the check optional, and we'll play catch up for a bit longer. Something like the patch below. Oliver, do you mind queuing this ASAP (also pushed out to my dev branch)? Thanks, M. =46rom 85d861a6ca055c7681c826c580e7c90d74c26ac5 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Thu, 22 Feb 2024 14:12:09 +0000 Subject: [PATCH] KVM: arm64: Make build-time check of RES0/RES1 bits option= al In order to ease the transition towards a state of absolute paranoia where all RES0/RES1 bits gets checked against what KVM know of them, make the checks optional and garded by a config symbol (CONFIG_KVM_ARM64_RES_BITS_PARANOIA) default to n. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/Kconfig | 11 +++++++++++ arch/arm64/kvm/check-res-bits.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig index 5c2a672c06a8..fa9389270cfe 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -67,4 +67,15 @@ config PROTECTED_NVHE_STACKTRACE =20 If unsure, or not using protected nVHE (pKVM), say N. =20 +config KVM_ARM64_RES_BITS_PARANOIA + bool "Build-time check of RES0/RES1 bits" + depends on KVM + default n + help + Say Y here to validate that KVM's knowledge of most system + registers' RES0/RES1 bits matches when the rest of the kernel + defines. Expect the build to fail badly if you enable this. + + Just say N. + endif # VIRTUALIZATION diff --git a/arch/arm64/kvm/check-res-bits.h b/arch/arm64/kvm/check-res-bit= s.h index 967b5d171d53..2d98e60efc3c 100644 --- a/arch/arm64/kvm/check-res-bits.h +++ b/arch/arm64/kvm/check-res-bits.h @@ -21,6 +21,8 @@ */ static inline void check_res_bits(void) { +#ifdef CONFIG_KVM_ARM64_RES_BITS_PARANOIA + BUILD_BUG_ON(OSDTRRX_EL1_RES0 !=3D (GENMASK_ULL(63, 32))); BUILD_BUG_ON(MDCCINT_EL1_RES0 !=3D (GENMASK_ULL(63, 31) | GENMASK_ULL(28= , 0))); BUILD_BUG_ON(MDSCR_EL1_RES0 !=3D (GENMASK_ULL(63, 36) | GENMASK_ULL(28, = 28) | GENMASK_ULL(25, 24) | GENMASK_ULL(20, 20) | GENMASK_ULL(18, 16) | GEN= MASK_ULL(11, 7) | GENMASK_ULL(5, 1))); @@ -118,4 +120,6 @@ static inline void check_res_bits(void) BUILD_BUG_ON(TRBMAR_EL1_RES0 !=3D (GENMASK_ULL(63, 12))); BUILD_BUG_ON(TRBTRG_EL1_RES0 !=3D (GENMASK_ULL(63, 32))); BUILD_BUG_ON(TRBIDR_EL1_RES0 !=3D (GENMASK_ULL(63, 12) | GENMASK_ULL(7, = 6))); + +#endif } --=20 2.39.2 --=20 Without deviation from the norm, progress is not possible.