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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 E8589C71130 for ; Mon, 7 Jul 2025 16:04:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uYoK7-0002az-JH; Mon, 07 Jul 2025 12:04:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uYo0u-0000kO-PV; Mon, 07 Jul 2025 11:44:16 -0400 Received: from dfw.source.kernel.org ([139.178.84.217]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uYo0p-0005fS-Ri; Mon, 07 Jul 2025 11:44:16 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 72AB65C2306; Mon, 7 Jul 2025 15:44:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 225FCC4CEE3; Mon, 7 Jul 2025 15:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751903046; bh=lLSEL8/sur7u2mfpw6EQ7KerztC4bRgvA+QK8lO/0ss=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iITXCUGsKdSYUBFWrNALhfhsXo3h3pKxWI7e2KQw/7ZEgUWSYqYTvSYoimpWiMSg0 xO+UQSUviCC8+5JL2ycKbdgHtAN5BYcWu/omz2Ddq7mK/+8nETjrBTa3nG/qZ31kfE 0hd6+kLQ6J+UJLZxSAk+c577VEpE4YvFQLT/5B0PQTKsvnXQLewusNZd/IST6yXUVM A6us6AEAdGT8Aq5dt0enmUlwkJyFIyUGHbEckCN23aO1FraQjejooXVhTfkv8BaHQO AN9irCI6VGeM9YKceBb7g1ifmBDv6IRGD99ySAjM2v/0sSKb0FI3wCdzVgezR4tiqT xGyGUTXeXbqfg== 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.95) (envelope-from ) id 1uYo0h-00DSK8-W6; Mon, 07 Jul 2025 16:44:04 +0100 Date: Mon, 07 Jul 2025 16:44:03 +0100 Message-ID: <86wm8k9fb0.wl-maz@kernel.org> From: Marc Zyngier To: Peter Maydell Cc: eric.auger@redhat.com, eric.auger.pro@gmail.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, miguel.luis@oracle.com, richard.henderson@linaro.org, gkulkarni@amperecomputing.com, gankulkarni@os.amperecomputing.com, hi@alyssa.is Subject: Re: [PATCH v7 4/4] hw/arm/virt: Allow virt extensions with KVM In-Reply-To: References: <20250702163115.251445-1-eric.auger@redhat.com> <20250702163115.251445-5-eric.auger@redhat.com> <9c78f7c0-88ce-4c4d-b6c0-5b77b4d83367@redhat.com> <86y0t09im1.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: peter.maydell@linaro.org, eric.auger@redhat.com, eric.auger.pro@gmail.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, miguel.luis@oracle.com, richard.henderson@linaro.org, gkulkarni@amperecomputing.com, gankulkarni@os.amperecomputing.com, hi@alyssa.is X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Received-SPF: pass client-ip=139.178.84.217; envelope-from=maz@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -70 X-Spam_score: -7.1 X-Spam_bar: ------- X-Spam_report: (-7.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Mon, 07 Jul 2025 15:46:04 +0100, Peter Maydell wrote: > > On Mon, 7 Jul 2025 at 15:32, Marc Zyngier wrote: > > > > On Mon, 07 Jul 2025 10:53:38 +0100, > > Peter Maydell wrote: > > > > > > On Mon, 7 Jul 2025 at 10:30, Eric Auger wrote: > > > > > > > > Hi Peter, Marc, > > > > > > > > On 7/4/25 2:22 PM, Peter Maydell wrote: > > > > > I suppose the system registers probably generally Just Work > > > > > via the sysreg GET/SET_ONE_REG API, but won't the in-kernel > > > > > GICv3 have extra state that we need to migrate in > > > > > hw/intc/arm_gicv3_kvm.c ? > > > > Do you see some specific registers/resources that would need attention? > > > > > > All the EL2-only-accessible GIC registers: ICH_AP*R_EL2, > > > ICH_EISR_EL2, ICH_ELRSR_EL2, ICH_HCR_EL2, ICH_LR_EL2, > > > etc etc. > > > > It isn't obvious to me why we'd expose any of the status registers to > > userspace. ICH_{EISR,ELRSR,MISR}_EL2 are entirely synthetic, and are > > directly generated by the emulation from the rest of the state. > > > > Save/restoring this state would make things pointlessly complicated, > > unless I'm missing something obvious. > > Good point: we don't need to expose those, only the actual > state-holding registers. I was rather mindlessly going through > and listing all the ICH_ registers out of the spec... > > So should the list be: > ICH_AP*R_EL2, ICH_HCR_EL2, ICH_HR_EL2, ICH_VMCR_EL2 > ? > (Those are the ones the TCG GICv3 has state for in its data > structures.) Yup, this matches my own expectations. > How about ICH_VTR_EL2 ? I guess we should handle it the same > way we do other existing ID registers (migrate it > and write value back to kernel so it can validate that > the destination hardware supports the same config) ? Indeed. Specially as this contains the number of LRs, which could otherwise lead to UNDEF exceptions if migrating in the wrong direction. What of ICC_SRE_EL2? We have it as RAO/WI for all the non-RES0 fields. It could be saved/restored as well for the same purposes... > Speaking of GIC ID registers, we never updated QEMU to > handle the GICv4.1 GICD_TYPER2 register, so we don't try > to send and sanity check that on migration at the moment. KVM only exposes a virtual GICv3 to the guest, even in the host can do GICv4.0+. The only nit is the "nASSGIcap" bit, which is always advertised to the guest when the host if v4.1-capable. We have a patch series in progress to address this and make it controllable. Thanks, M. -- Without deviation from the norm, progress is not possible.