From nobody Mon Feb 9 01:54:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1642089928; cv=none; d=zohomail.com; s=zohoarc; b=WOjcppwvChllqSbfb3Zq0LtgwWUK/St+sDJCpbtEQ13socch7cjFYRuDPvYZbXraq6c+IS7MJTWeNdpeLY9QBEbxWu8LXTFIxRGcVJdD1ZqaeQyx5AxTzVuWmsZi0hEC9R3Qy54Aj7P+6gxJwS+otWEtrSi0eKHjds3YMCKCc6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642089928; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RRjphleUIqLoOTBWPa4kIgEwVvOePPoVPrFG6Zq3duI=; b=OERBgUxG5ZwGjwo0c6Mk/m59Fwdh8tlOtcyl4mKi1/sWIQbxrzYsc/7DOXF0GCdnkY0Z/xSjN4B1nc62zpCx9OTwDQl8jAMPbiUuFV7RBYjjRvr9jDfIXdOax3z63nCHO25WYOyOmXK9hFCRYs5fU19ydTo1JyqzjdfJ+ZA/Teg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1642089928487784.8029797241298; Thu, 13 Jan 2022 08:05:28 -0800 (PST) Received: from localhost ([::1]:55280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n82bG-00084w-58 for importer@patchew.org; Thu, 13 Jan 2022 11:05:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n81tC-0007Aw-T6; Thu, 13 Jan 2022 10:19:46 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:44120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n81tB-0006iP-DP; Thu, 13 Jan 2022 10:19:46 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BAEF6210EC; Thu, 13 Jan 2022 15:19:43 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A85F713DD1; Thu, 13 Jan 2022 15:19:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +KhyKA9D4GEwFAAAMHmgww (envelope-from ); Thu, 13 Jan 2022 15:19:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642087183; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RRjphleUIqLoOTBWPa4kIgEwVvOePPoVPrFG6Zq3duI=; b=wu+kcCgWYsDFlRKXNVr4blE23J1E+AAMmvjH+i0f8HYC4YfOhiYZptN+bjHLFat6edDde7 25AFaMOvwiV9wMv5lQyOZSHQpjupS5duHtVnyb4DkW9Ko/p+68IefggE3oT+vuRs0ILq8d iueh69Yt9DvLOy2wT9FmoxyRkLNO4bU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642087183; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RRjphleUIqLoOTBWPa4kIgEwVvOePPoVPrFG6Zq3duI=; b=SpSTO3P2PL7PO5aQ0fYDldoJiXhBO5uvVSIQ/n1ZAkW5iIWsSEV5k9e04cMiheUdwiWC0Z mH/vgO3hb3g6MVDw== From: Petr Pavlu To: peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 1/2] hw/intc/arm_gic: Implement read of GICC_IIDR Date: Thu, 13 Jan 2022 16:19:15 +0100 Message-Id: <20220113151916.17978-2-ppavlu@suse.cz> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220113151916.17978-1-ppavlu@suse.cz> References: <20220113151916.17978-1-ppavlu@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.28; envelope-from=ppavlu@suse.cz; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 13 Jan 2022 10:59:52 -0500 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: , Cc: petr.pavlu@suse.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @suse.cz) X-ZM-MESSAGEID: 1642089931164100001 Content-Type: text/plain; charset="utf-8" From: Petr Pavlu Implement support for reading GICC_IIDR. This register is used by the Linux kernel to recognize that GICv2 with GICC_APRn is present. Signed-off-by: Petr Pavlu --- hw/intc/arm_gic.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index a994b1f024..0cd9ceca8d 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -1662,6 +1662,15 @@ static MemTxResult gic_cpu_read(GICState *s, int cpu= , int offset, } break; } + case 0xfc: + if (s->revision =3D=3D REV_11MPCORE) { + /* Reserved on 11MPCore */ + *data =3D 0; + } else { + /* GICv1 or v2; Arm implementation */ + *data =3D (s->revision << 16) | 0x43b; + } + break; default: qemu_log_mask(LOG_GUEST_ERROR, "gic_cpu_read: Bad offset %x\n", (int)offset); --=20 2.34.1 From nobody Mon Feb 9 01:54:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1642090200; cv=none; d=zohomail.com; s=zohoarc; b=SagFUbX7XVUQ6UMWuLnCpw++7Dl1v6MrGhFMJuwyQgmUUSdD5NhBDJzO4sKrJQdo12PzvBkrTDivufiqJF6ncjQyRGPxTOxG0PnzilgJDOwG5DYeaY60EHMpW7qsApyX04YA7p8A1COzvwXD1zO/11eNAy1B8DGS86WXBGu96BM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642090200; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=L57YS6lcpOAlRLBLnhaZCF8uOjfOPhMnDq4J4As9pms=; b=dkdG+/gY5iQz/freUWCWgFQrTVVARknFLz6kvWziODGfJNv7XCvetb4dBywvxEfaV2ugBGN5c4ytPdK/EPLBCxmhBUKqnQsDuyTr5t1XEfpU2+VIUgiffNyOhFk5pdPAdcH81XZFNtNdedoqhVzGZZNdAjY4g5bsZJnLKQF3O7M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1642090200844757.0592363915271; Thu, 13 Jan 2022 08:10:00 -0800 (PST) Received: from localhost ([::1]:60468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n82fn-0003e1-MB for importer@patchew.org; Thu, 13 Jan 2022 11:09:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n81tF-0007Bb-HX; Thu, 13 Jan 2022 10:19:49 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:44126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n81tD-0006ii-UN; Thu, 13 Jan 2022 10:19:49 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7BBC9218B1; Thu, 13 Jan 2022 15:19:46 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 695DB13DD1; Thu, 13 Jan 2022 15:19:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8JkvGRJD4GEwFAAAMHmgww (envelope-from ); Thu, 13 Jan 2022 15:19:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642087186; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L57YS6lcpOAlRLBLnhaZCF8uOjfOPhMnDq4J4As9pms=; b=1tk74+8wru5P3a+0tZToxRnvaEIcup8E5apTLnkF/8Lq/09JcJrR/oGUip71+IadBkrwW+ 7WZp9rfcAsGOuCQ4vRfRVled6OdJR4eaWeYUBwhUOXyDB9j4Ekx3MXSWll3WBewQimpDjX 1SmPhQrwQJLhCnmS+W9kbrZ99qeqcO4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642087186; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L57YS6lcpOAlRLBLnhaZCF8uOjfOPhMnDq4J4As9pms=; b=7lIZyfYXcWK8VN9k+DSmCC8Ik96jpnfR1+qWI3VaflnnjXeoe4joBiORbFRi862A4un16p ftU0PAjVCxHgRHAg== From: Petr Pavlu To: peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 2/2] hw/intc/arm_gic: Allow reset of the running priority Date: Thu, 13 Jan 2022 16:19:16 +0100 Message-Id: <20220113151916.17978-3-ppavlu@suse.cz> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220113151916.17978-1-ppavlu@suse.cz> References: <20220113151916.17978-1-ppavlu@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.28; envelope-from=ppavlu@suse.cz; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 13 Jan 2022 10:59:52 -0500 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: , Cc: petr.pavlu@suse.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @suse.cz) X-ZM-MESSAGEID: 1642090202637100001 Content-Type: text/plain; charset="utf-8" From: Petr Pavlu When running Linux on a machine with GICv2, the kernel can crash while processing an interrupt and can subsequently start a kdump kernel from the active interrupt handler. In such a case, the crashed kernel might not gracefully signal the end of interrupt to the GICv2 hardware. The kdump kernel will however try to reset the GIC state on startup to get the controller into a sane state, in particular the kernel writes ones to GICD_ICACTIVERn and wipes out GICC_APRn to make sure that no interrupt is active. The patch adds a logic to recalculate the running priority when GICC_APRn/GICC_NSAPRn is written which makes sure that the mentioned reset works with the GICv2 emulation in QEMU too and the kdump kernel starts receiving interrupts. The described scenario can be reproduced on an AArch64 QEMU virt machine with a kdump-enabled Linux system by using the softdog module. The kdump kernel will hang at some point because QEMU still thinks the running priority is that of the timer interrupt and asserts no new interrupts to the system: $ modprobe softdog soft_margin=3D10 soft_panic=3D1 $ cat > /dev/watchdog [Press Enter to start the watchdog, wait for its timeout and observe that the kdump kernel hangs on startup.] Signed-off-by: Petr Pavlu --- hw/intc/arm_gic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index 0cd9ceca8d..492b2421ab 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -1736,6 +1736,7 @@ static MemTxResult gic_cpu_write(GICState *s, int cpu= , int offset, } else { s->apr[regno][cpu] =3D value; } + s->running_priority[cpu] =3D gic_get_prio_from_apr_bits(s, cpu); break; } case 0xe0: case 0xe4: case 0xe8: case 0xec: @@ -1752,6 +1753,7 @@ static MemTxResult gic_cpu_write(GICState *s, int cpu= , int offset, return MEMTX_OK; } s->nsapr[regno][cpu] =3D value; + s->running_priority[cpu] =3D gic_get_prio_from_apr_bits(s, cpu); break; } case 0x1000: --=20 2.34.1