From nobody Thu Nov 14 18:04:45 2024 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708441779; cv=none; d=zohomail.com; s=zohoarc; b=lVl5aXccnJZzd9PdPOji8xGeb44JcCooljmxV4hKIcBemm0FqGob3hO85T3zTK422FHvlkVuOqV6OeCx7kvhl10oRYAwgGxRziaLT1ZPQKoVoZNj+Rb3rO2yZg5h15rSss6WNPc7Zo6/QjrOkHyDwJpPSmPS8eXdBBT8Rb8kVGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708441779; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9BjoHKgBAqJhVWzvihYewG3Mo1EyFTHucbJxjZyHAzY=; b=jHXsaHtUTEPAwoQd0H24Zi1ZMoCoten2Q3r0t/lCVKZJ0nzNW6jw2Mfisblv1HR7NXuSKVewGTnR850eUXAVmXRfZ51RV+aWE5lhUcYrMWLENLxVz9cWfH0KMZXxhA9tR2RsAECjEwDLgHfJakYqyjAU/J+q1HNI88y+A7TStQM= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708441779002896.3107211860023; Tue, 20 Feb 2024 07:09:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcRjs-0004hq-GP; Tue, 20 Feb 2024 10:08:56 -0500 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 1rcRjp-0004bp-Iu for qemu-devel@nongnu.org; Tue, 20 Feb 2024 10:08:53 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcRjn-0003n8-Kx for qemu-devel@nongnu.org; Tue, 20 Feb 2024 10:08:53 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33d375993f4so1577153f8f.1 for ; Tue, 20 Feb 2024 07:08:51 -0800 (PST) Received: from m1x-phil.lan (mek33-h02-176-184-23-7.dsl.sta.abo.bbox.fr. [176.184.23.7]) by smtp.gmail.com with ESMTPSA id 14-20020a056000154e00b0033d10bd6612sm14090980wry.81.2024.02.20.07.08.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 20 Feb 2024 07:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708441729; x=1709046529; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9BjoHKgBAqJhVWzvihYewG3Mo1EyFTHucbJxjZyHAzY=; b=AF+XmJU8/fUgGnqSZvgXti+xcRjoOEmzKEXYzoEXX8ml2TopiLAI4hY9B+EUzWxZwC XX5qqKBICmOCl7znej2swDKPfbWhJbkBurQR39gScvF4F9hPnJbun7UMfkfI5w5Ir8s1 Jq7DBfbiLvZ9v2+/qjZa89cNYojP6IG0IWUlKgEONicpaIoEi/cirphZg0QURl7TZzFc 8iJCZPILL7iBjl4hHGeJzXTCSXKC6MkOjTe+EjrjWSlsP7EEMlsuy1x7zvmk6uaQiyGb 8ismPWGXnRCEdLNoLD43PlN7U3Wb4xCCVDQF9xWUeen0CPRx1C6USsDVHdugqS2bVmMB /FTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708441729; x=1709046529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9BjoHKgBAqJhVWzvihYewG3Mo1EyFTHucbJxjZyHAzY=; b=o8nURtsClWlt6IgDEa3CZEXlpxzTDfUnV2R2PuL/goJIGUtbhzPQSW8KoN3XBoHtWH fWDAXFPxNda235+jrseUR3CpcTYPoqdT7/EmWKzuCiSBhRN+cwk5Cdu3chVbGHN3QDZ+ Zlvi+BlGKAUxN2B+23SmOwUu3sKKWcSSuuKwW4aukWlSmDEw5tZqbfpRvXiasdioUHO5 raDTP0V6hJK9hHKDxUo9fcbBuL8pb2ZVL2nmUVv0bP0o1v9dBNy9JEEPaqi3Hrwtb2lo jIQliuczg/DH3kCi9yyJBCwJsk9gasRVszT4UE0eZXlsUxDv1/ZClA7aZZOuRjSeqSAV Q0pQ== X-Gm-Message-State: AOJu0Yzn3oQqWbkRAEDiVJ48feVFl5yJqLhRuSEnwhr90HJSTl9ZvwwR +8qOAavr5Gcid6XGAj72PYGn58eTHEt2mEK27DgIZu9bu+mQtATi86iI/buvy1LfkIn+CPjPpXj y X-Google-Smtp-Source: AGHT+IFhbrq0b+Ii24quknvkw7x8518WJST0xOOA9vnYm4SCMWy0cblWllaVknoPniV2diA8rEdDCA== X-Received: by 2002:a05:6000:887:b0:33d:6bc6:26ef with SMTP id cs7-20020a056000088700b0033d6bc626efmr2045846wrb.14.1708441729095; Tue, 20 Feb 2024 07:08:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Markus Armbruster , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Christian Borntraeger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Halil Pasic , Eric Farman , Eric Blake , Paolo Bonzini Subject: [PATCH 2/4] hw/s390x/virtio-ccw: Always deliver NMI to first CPU Date: Tue, 20 Feb 2024 16:08:31 +0100 Message-ID: <20240220150833.13674-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240220150833.13674-1-philmd@linaro.org> References: <20240220150833.13674-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708441779642100001 We can trigger NMI from HMP or QMP. QEMU maps the NMI to the s390x per-CPU 'RESTART' interrupt. Linux guests usually setup this interrupt to trigger kdump or crash. Such crashdump can be triggered in QEMU by HMP "nmi" or QMP "inject-nmi" commands. Using QMP, since we can not select a particular CPU, the first CPU is used (CPU#0). See the documentation from commit 795dc6e4 ("watchdog: Add new Virtual Watchdog action INJECT-NMI"): @inject-nmi: a non-maskable interrupt is injected into the first VCPU (all VCPUS on x86) (since 2.4) While we can select a particular CPU on HMP, the guest behavior is expected to be the same if using CPU #N or CPU #0. Since always using CPU#0 simplifies API maintainance, update s390_nmi() to deliver NMI to the first CPU. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Hildenbrand Reviewed-by: Peter Maydell --- qapi/run-state.json | 5 +++-- hw/s390x/s390-virtio-ccw.c | 4 +--- hmp-commands.hx | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/qapi/run-state.json b/qapi/run-state.json index 08bc99cb85..a2542f1a50 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -320,8 +320,9 @@ # # @none: nothing is done # -# @inject-nmi: a non-maskable interrupt is injected into the first -# VCPU (all VCPUS on x86) (since 2.4) +# @inject-nmi: a non-maskable interrupt is injected (architecture +# specific: on s390x only the first vCPU receive the NMI, on +# other architectures all vCPUs receive it). (since 2.4) # # Since: 2.1 ## diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 62804cc228..ba1fa6472f 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -605,9 +605,7 @@ static HotplugHandler *s390_get_hotplug_handler(Machine= State *machine, =20 static void s390_nmi(NMIState *n, int cpu_index, Error **errp) { - CPUState *cs =3D qemu_get_cpu(cpu_index); - - s390_cpu_restart(S390_CPU(cs)); + s390_cpu_restart(S390_CPU(first_cpu)); } =20 static ram_addr_t s390_fixup_ram_size(ram_addr_t sz) diff --git a/hmp-commands.hx b/hmp-commands.hx index 17b5ea839d..2b01bb5926 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -851,7 +851,7 @@ ERST }, SRST ``nmi`` *cpu* - Inject an NMI on the default CPU (x86/s390) or all CPUs (ppc64). + Inject an NMI. ERST =20 { --=20 2.41.0