From nobody Thu Feb 12 09:21:43 2026 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B326F146018 for ; Thu, 13 Jun 2024 14:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718288028; cv=none; b=LVmpD05DJ+wAbkcCvGm5togeWG3qbTNkTg/5iU+7brd1pnTv8MwLLPPCwPelzCbGEpLnBOsUuoh3jhhKBPXscKyzDDMRdH5DYFNsF7au6TBwuesbuLxlf3s9uPoQ/FpA68EC3KbPnisSw1dmPHE8k5pdnXx+/BiZNDV71kcF8tg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718288028; c=relaxed/simple; bh=ERjV5BJYroAXFIaG6FmVQOy7+GFyAqC/Q40IjLgdSn0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oqzxDCvZeqoePWU+fFdRC9vDTu6fu62OxqyXs8MYnv0Fz6OYMHfZKGsxtz1x/kCl3lfGYiBbtwnb9P1Y5flvxmKjrlRCuA654CKlEiLZGYlvbmbE4GmqrCDpmJqmULkwCPEaUrylnxM4x6txu7/uoGncZ575YToWYUrzG/78y2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sebastianene.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=fJvG1WGD; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--sebastianene.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fJvG1WGD" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-63128f5eb5bso12531207b3.2 for ; Thu, 13 Jun 2024 07:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718288025; x=1718892825; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=4xD4B/30d59fgI1TQcHmQ/HHM3gNeD0CWu+CBJTxBNY=; b=fJvG1WGDnhRDHzpu+eZ9gNG7a6k2i7yrK76/2EK4GUj6ojle9CMNoZJsSMWzRzLTgl tkUYdnhFIVKQESN0/Ez5bQSzfyQfsyj6hEh1a6w8+8WkwW3elKzD+2OL7cHDsR3iVIkg CzfIQigi3kmcXQWF3pRbjEt2nKwxXHH1Womz0qcToeIMd3QXZ/nfd0eN1Yft1FiYcQCI kTZf7iSzUD/miGWQwJ4khpMkMLR+Zh4o1Si1C1/zEDP0VLGuVQPfj1w5sPlB8EadZSbz nuNn4jVRit0aUVTeRJaTFNSLP6NbKioZTuuCwJqnfkFta3OleD4UxBkTBq8Q80epWhnZ hlJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718288025; x=1718892825; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4xD4B/30d59fgI1TQcHmQ/HHM3gNeD0CWu+CBJTxBNY=; b=XulLYkJiFHnQwS1IOTGXCxMGN+emK3H61Bw3rRM9kiz+CKYn5GtO396L6IIjNJNfHw 07c3YJipa60PaYXq3AilPhghV1olE+D7Wudcd2vMTzK55NfoGs70lniiRLCbwEX5BAd3 9skQIIpct1yOYJ3CJlDyEMXfdFIZEFcDWgx5XJ87/28ENd6v3I9gY8uDLrTyBnld8030 Aa4beKTMcfyCBdbQBPJaKLcZwNmHRA6os2QfJ9+9s5F1dXHHcgby1HomkDh1kpLOwlxW jJND3qPsndBaW2vwaT2UMaPvrDjIUo1zS2ecfkQOzqQxIbs0ecgXZXV1QiZVGn1/Ctyv dloA== X-Gm-Message-State: AOJu0YyI+rCKbuSzSI2DMfsK/mm9cmgfRf/UHaDgKnxuHQZIqDqdoY/2 O5UrnMdyLAqKck6RLPnnkbKb6LxvvIvjvxhiwwdn3aPMfxVNp9JVO8sBv6O/WEn4GyvlwvKbRx2 Ehta727mJ+/dA5l5eEEJoikFRtA== X-Google-Smtp-Source: AGHT+IE4GGKM2aTl6lWB2KY+Wdp3WNUVj4Ae+A0AMzyGnV4UVuSwDQxm/tAmKK1qBnTgqzTNbtfDQPyFW+GwABUCxZU= X-Received: from sebkvm.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:cd5]) (user=sebastianene job=sendgmr) by 2002:a05:690c:25c7:b0:627:a962:4252 with SMTP id 00721157ae682-62fba47067dmr11954057b3.7.1718288024746; Thu, 13 Jun 2024 07:13:44 -0700 (PDT) Date: Thu, 13 Jun 2024 14:13:34 +0000 In-Reply-To: <20240613141335.1134341-1-sebastianene@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240613141335.1134341-1-sebastianene@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240613141335.1134341-2-sebastianene@google.com> Subject: [PATCH v2 1/2] dt-bindings: vcpu_stall_detector: Add a PPI interrupt to the virtual device From: Sebastian Ene To: arnd@arndb.de, gregkh@linuxfoundation.org, will@kernel.org, maz@kernel.org, Rob Herring , Dragan Cvetic , Guenter Roeck Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel-team@android.com, Sebastian Ene , Conor Dooley Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The vcpu stall detector allows the host to monitor the availability of a guest VM. Introduce a PPI interrupt which can be injected from the host into the virtual gic to let the guest reboot itself. Signed-off-by: Sebastian Ene Acked-by: Conor Dooley --- .../devicetree/bindings/misc/qemu,vcpu-stall-detector.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/misc/qemu,vcpu-stall-detecto= r.yaml b/Documentation/devicetree/bindings/misc/qemu,vcpu-stall-detector.ya= ml index 1aebeb696ee0..e12d80be00cd 100644 --- a/Documentation/devicetree/bindings/misc/qemu,vcpu-stall-detector.yaml +++ b/Documentation/devicetree/bindings/misc/qemu,vcpu-stall-detector.yaml @@ -29,6 +29,9 @@ properties: Defaults to 10 if unset. default: 10 =20 + interrupts: + maxItems: 1 + timeout-sec: description: | The stall detector expiration timeout measured in seconds. @@ -43,9 +46,12 @@ additionalProperties: false =20 examples: - | + #include + vmwdt@9030000 { compatible =3D "qemu,vcpu-stall-detector"; reg =3D <0x9030000 0x10000>; clock-frequency =3D <10>; timeout-sec =3D <8>; + interrupts =3D ; }; --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 09:21:43 2026 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A56DE146A7C for ; Thu, 13 Jun 2024 14:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718288031; cv=none; b=I0g8FV/VQQ5YZxWRgCdLlkoTYxixtnbYfh/vSSCSWpKCuUbwqwMcYA8DIyY5Qn+IQrse8PsyPu6/xH1nIB1km8Sy5Cx/a8zi8QP2ajR5VE4VSSWE9aYCMqC73xQMZUooqz7TnCKu0iy+6N9bJuStl/eM+jJc2OGIa8ACEJFP/zc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718288031; c=relaxed/simple; bh=aghr2MGo+eWlZkTOaZiyMRhjN7zE3f7gxvto8w/AHuU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JSQDj9UQJB/CZv48yFSWq2Ddqf8WzHw3htwI9gmUy8Fw+lAkqAB6HnK8v/Rj+RGeDJLMSblAPJsMzSuO0lcOdM9RS1TdYbWNeZGZgOqH8MRo4uqwlOkKEJ/djISu8NFqGLnj2Zw1sjW8kI+snTASxL4uHbW0mCnMgw0d8D1I+Bs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sebastianene.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=my73vdYd; arc=none smtp.client-ip=209.85.221.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--sebastianene.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="my73vdYd" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-35f1f358e59so596847f8f.0 for ; Thu, 13 Jun 2024 07:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718288028; x=1718892828; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kksLUlRbd518rfKCwHFZPSF7kwu3hMJcK/JCkJY2+7A=; b=my73vdYdnqc65jYN9oebJJ7GYlRZPQgC5oEf3gj2oDxN9L1cYDBfPVq+N8DE9ErGix TnkZ73FoUEh1g+SrjnECUmcM7U99IJamRtgAsCfUnGrn7cPjug2VkKHWjSQn8e2zN/Th oR1UuHowE8cgeV9lXWZcrWXtykPuMnAn2MC7+2H4r0JMZ25LkjxnPgcJsWfU6fjDDwpq h8ctCxTHf3bOLFGVGhEBVDU7rfOpF0nAYCIXmjdaxVs4gH8siGmHaWd+FZewChl0zuvp p97i4uqnUGrmPCsEubleADE4b8l//iND5zC5Plp5RGIUdoFTIhqORpU/NGgOum8m7ugC xsqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718288028; x=1718892828; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kksLUlRbd518rfKCwHFZPSF7kwu3hMJcK/JCkJY2+7A=; b=vxvJnrFTHVN6VbfK9oDMUulTomKs3pSHJjdouIHdtt6iIvFJRBgvOqQvv/k/TTBx0V SNir2wdQOMx/nRHSYCf2TgyOXPcu8oFERHVB6vrnYBGHQidwGYwmNlRTevqhW7F/8mCY o767KGvQ5bP/naWaFXLt1lm27xuBqG0zmRo5hz3o/6wDu0fk6uCj1KtVjGkkENz9yXjj p6NmdZ8xp4Kill5Z1TK6SZL3muTGPJ1iDf9am/aWXDw8agSMRTfyXM2jlrP0BfDF/2eH HUSKjKcAaKaBQK9uRO9nidU0yI2/yC9N0bdCY19uHgpPOlBvoKDXTxNuZoAvaJkErXzJ 4J5g== X-Gm-Message-State: AOJu0Yx+8oswP2Wn/J70nmzpXGzk0CpQjUdsZjB24gJ21Mbuc9X+LnYo tS6HxPZ6x4J5FW0lxTjR3YUDp+6/i5jpFggMu+EZfFnEAfRswqCLBXCL+J6Z9lHTvDxtR58O1qz iCwwE+i6OkG8rPDT9NTWI+y+iow== X-Google-Smtp-Source: AGHT+IHuswEJb7oIquzqOhBvgv9Z59GPcV52lF3ic+t+3cipg6Pa0yko9Q21ZgfWd0Q/mtGyojHMm0568F248lH5Cxk= X-Received: from sebkvm.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:cd5]) (user=sebastianene job=sendgmr) by 2002:a5d:6104:0:b0:35f:2f69:4246 with SMTP id ffacd0b85a97d-360718be27amr6841f8f.0.1718288028118; Thu, 13 Jun 2024 07:13:48 -0700 (PDT) Date: Thu, 13 Jun 2024 14:13:35 +0000 In-Reply-To: <20240613141335.1134341-1-sebastianene@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240613141335.1134341-1-sebastianene@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240613141335.1134341-3-sebastianene@google.com> Subject: [PATCH v2 2/2] misc: Register a PPI for the vcpu stall detection virtual device From: Sebastian Ene To: arnd@arndb.de, gregkh@linuxfoundation.org, will@kernel.org, maz@kernel.org, Rob Herring , Dragan Cvetic , Guenter Roeck Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel-team@android.com, Sebastian Ene Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Request a PPI for each vCPU during probe which will be used by the host to communicate a stall detected event on the vCPU. When the host raises this interrupt from the virtual machine monitor, the guest is expected to handle the interrupt and panic. Signed-off-by: Sebastian Ene --- drivers/misc/vcpu_stall_detector.c | 31 ++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/misc/vcpu_stall_detector.c b/drivers/misc/vcpu_stall_d= etector.c index e2015c87f03f..41b8c2119e20 100644 --- a/drivers/misc/vcpu_stall_detector.c +++ b/drivers/misc/vcpu_stall_detector.c @@ -32,6 +32,7 @@ struct vcpu_stall_detect_config { u32 clock_freq_hz; u32 stall_timeout_sec; + int ppi_irq; =20 void __iomem *membase; struct platform_device *dev; @@ -77,6 +78,12 @@ vcpu_stall_detect_timer_fn(struct hrtimer *hrtimer) return HRTIMER_RESTART; } =20 +static irqreturn_t vcpu_stall_detector_irq(int irq, void *dev) +{ + panic("vCPU stall detector"); + return IRQ_HANDLED; +} + static int start_stall_detector_cpu(unsigned int cpu) { u32 ticks, ping_timeout_ms; @@ -132,7 +139,7 @@ static int stop_stall_detector_cpu(unsigned int cpu) =20 static int vcpu_stall_detect_probe(struct platform_device *pdev) { - int ret; + int ret, irq; struct resource *r; void __iomem *membase; u32 clock_freq_hz =3D VCPU_STALL_DEFAULT_CLOCK_HZ; @@ -169,9 +176,22 @@ static int vcpu_stall_detect_probe(struct platform_dev= ice *pdev) vcpu_stall_config =3D (struct vcpu_stall_detect_config) { .membase =3D membase, .clock_freq_hz =3D clock_freq_hz, - .stall_timeout_sec =3D stall_timeout_sec + .stall_timeout_sec =3D stall_timeout_sec, + .ppi_irq =3D -1, }; =20 + irq =3D platform_get_irq_optional(pdev, 0); + if (irq > 0) { + ret =3D request_percpu_irq(irq, + vcpu_stall_detector_irq, + "vcpu_stall_detector", + vcpu_stall_detectors); + if (ret) + goto err; + + vcpu_stall_config.ppi_irq =3D irq; + } + ret =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "virt/vcpu_stall_detector:online", start_stall_detector_cpu, @@ -184,6 +204,9 @@ static int vcpu_stall_detect_probe(struct platform_devi= ce *pdev) vcpu_stall_config.hp_online =3D ret; return 0; err: + if (vcpu_stall_config.ppi_irq > 0) + free_percpu_irq(vcpu_stall_config.ppi_irq, + vcpu_stall_detectors); return ret; } =20 @@ -193,6 +216,10 @@ static void vcpu_stall_detect_remove(struct platform_d= evice *pdev) =20 cpuhp_remove_state(vcpu_stall_config.hp_online); =20 + if (vcpu_stall_config.ppi_irq > 0) + free_percpu_irq(vcpu_stall_config.ppi_irq, + vcpu_stall_detectors); + for_each_possible_cpu(cpu) stop_stall_detector_cpu(cpu); } --=20 2.45.2.505.gda0bf45e8d-goog