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 A3BD7C7EE31 for ; Thu, 26 Jun 2025 13:33:08 +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=iYLb1wvYbWbWJD/Vv9FBqA8nV99mryJWqws/r7n5kkc=; b=I80udKaJnolstGHYKHGcqAVsGM 7W0QMhAquifQ5105vwcssv+xD0//N+kZlb5HS07eyRuLW4swRMoufCBp9ykOVK1Z3mQLoZsgcTtye dA5KeWcbG6ba7qv7We5fRDeORlF9b+oB3hC6RvWYnT0ReJZQBUJfXzCrbadydRvBas36v3LcczSVH LnIR2r1N8TGyQyT+IRgjtFjB0d3+bifMQX1FvLiJfIlV8m/k5q6nD54/Ru7RKEoCshtuMsM2ajQa2 ch8Jx6Amlko0BbVuO4YhCVvjG3XuHq06uNtJDPxBAdOQDbsdMoYK1t8AoR4a3Gq6UdgXqFsuMdN/G zb3BVDuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uUmit-0000000BgKh-1brR; Thu, 26 Jun 2025 13:33:03 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uUmdz-0000000Bfdd-09Y4 for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2025 13:28:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 39652A51834; Thu, 26 Jun 2025 13:27:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D22C3C4CEEB; Thu, 26 Jun 2025 13:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750944477; bh=fBIEve8FP/YE7Iq/R715WvXVTfrpSD/qYWNCmxcUlmQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p7bZdzrXMwycmZIXNjYpAAmP5+Cxx+FcQn1boX5m386Cr5YZQHoRelMG568JBe8Oj W2lfN0xWB1pkah06qvlTHjVPQ/oEjuNH1PgGNV5uHnp4wNOLSVf/h6Sad0E+JI7scv GcLjcAxhCwmZapf6kJ1yC6tppcSmMESdySBHKp163/9vJJawoH/bOKzyRhh6O+Zlpk +Ncor7OxWpaJGOTDRpsSOp4K/kdVzt/akMBngWVO48+bX0qvW+3+qYvLQjBISB2deh 90i7/Ncz1ty81n/YXPvFfeeXzzOf4ymDqui9TWY1ag/mNcSFcMjYa5M1+UKXY4YsCl ztZLHcUde1LEw== 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 1uUmdv-00AEV3-Ll; Thu, 26 Jun 2025 14:27:55 +0100 Date: Thu, 26 Jun 2025 14:27:54 +0100 Message-ID: <86wm8ybpk5.wl-maz@kernel.org> From: Marc Zyngier To: Zhou Wang Cc: Oliver Upton , "Will Deacon" , Catalin Marinas , , , , Subject: Re: [PATCH] ARM64: errata: Add workaround for HIP10/HIP10C erratum 162200803 In-Reply-To: <20250626124142.2035110-1-wangzhou1@hisilicon.com> References: <20250626124142.2035110-1-wangzhou1@hisilicon.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/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: wangzhou1@hisilicon.com, oliver.upton@linux.dev, will@kernel.org, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, tangnianyao@huawei.com, wangwudi@hisilicon.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250626_062759_215490_D5BC6756 X-CRM114-Status: GOOD ( 28.27 ) 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 Thu, 26 Jun 2025 13:41:42 +0100, Zhou Wang wrote: > > For GICv4.0 of Hip10 and Hip10C, it has a SoC bug with vPE schedule: > when multiple vPEs are sending vpe schedule/deschedule commands > concurrently and repeatedly, some vPE schedule command may not be > scheduled, and it will cause the command timeout. > > The hardware implementation is that there is one GIC hardware in one CPU die, > which handles all vPE schedule operations one by one in all CPUs of this die. > The bug is that if the number of queued vPE schedule operations is more > than a certain value, the last vPE schedule operation will be lost. > > One possible way to solve this problem is to limit the number of vLPIs, so > the hardware could spend less time to scan virtual pending table when it > handles the vPE schedule operations, so the queued vPE schedule operations > will never be more than above certain value. > > Given the number of CPUs of die, and imagine there is 100 vPE schedule > operations per second one CPU, it can be calculated that we can limit > the number of vLPI to 4096 for virtual machine to avoid the issue. > > Signed-off-by: Zhou Wang > --- > Documentation/arch/arm64/silicon-errata.rst | 2 ++ > arch/arm64/Kconfig | 12 ++++++++++++ > arch/arm64/include/asm/cputype.h | 4 ++++ > arch/arm64/kernel/cpu_errata.c | 15 +++++++++++++++ > arch/arm64/kvm/vgic/vgic-mmio-v3.c | 5 +++++ > arch/arm64/tools/cpucaps | 1 + > include/linux/irqchip/arm-gic-v3.h | 1 + > 7 files changed, 40 insertions(+) > [...] > diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c > index ae4c0593d114..495a56e9dc4b 100644 > --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c > +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c > @@ -81,6 +81,11 @@ static unsigned long vgic_mmio_read_v3_misc(struct kvm_vcpu *vcpu, > if (vgic_has_its(vcpu->kvm)) { > value |= (INTERRUPT_ID_BITS_ITS - 1) << 19; > value |= GICD_TYPER_LPIS; > + /* Limit the number of vlpis to 4096 */ > + if (cpus_have_final_cap(ARM64_WORKAROUND_HISI_162200803) && > + kvm_vgic_global_state.has_gicv4 && > + !kvm_vgic_global_state.has_gicv4_1) > + value |= 11 << GICD_TYPER_NUM_LPIS_SHIFT; This really doesn't solve your problem. Yes, the guest *may* honor this limit. But KVM doesn't care and will happily allocate 2^16 vLPIs if the guest asks -- there is no code enforcing this limit. And even if we did. What would we do on a MAPTI command that tries to map a vLPI outside of the allowed range? Do we need to tell the guest it has screwed up? Thanks, M. -- Without deviation from the norm, progress is not possible.