From nobody Sun Feb 8 04:18:08 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.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 38072181B9A for ; Wed, 3 Jul 2024 15:37:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720021065; cv=none; b=PTEtTR/CTfRs1aSBkVFViUArlM+laOdMc6YTSHwE5COfIB6eUC8q2r6EAFEHvJtfuyyhLOQA/lpMxdFuvmvkOeXSNdfT7L97owljrSPY5WGUlaPJ5SBliEIkfHEQDglpTkjt73f6u9uCUOzwXO9vF4tx/7oIWZ0+DgKMUpSqMNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720021065; c=relaxed/simple; bh=4tm4poGH1Qp2f/Ekw2ZcGWDQwJwexwXTaGlBJ4EKROU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=MMSgHXnL437ZbtCC3/EpFuMuykDR3SGIZFZK8VFuHT/9hqiwZ1QKegkeTfCPfu2UIIfTferPtF2HnepRGhOv7eFvTgfK72i9H+sWWVuJIAtsh/qLfRI6/+a6wi9wxt6cz9vTO/Catb8hCnIyo4xEK3IV+JtWxzu6ub+/BPo+zM4= 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=ncXIeeVq; arc=none smtp.client-ip=209.85.128.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="ncXIeeVq" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-424a5a5f024so36337695e9.3 for ; Wed, 03 Jul 2024 08:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720021063; x=1720625863; 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=QXlYYR1UR9cqAQ1pIZHR6lAQLRa2deLFoE8lo+c+kks=; b=ncXIeeVqNqg88UIN/ehLAdSxkKC+IvoAmhuPMGRtbM5tpCyMVrEUK5qCz+J44iPXgi lz43z066uLCtJBcbSrskIi00U/2eGxkfKoyY5TaV4RTBs79l1Ib16TrCj3H32TOwxEKI 1ElkXZdegGxdElyW5AVymiAOvBNRZfPf7/176/LFG10SyxnVumd75lCb9xPzEwR2Lhry vKQEM7qW4/iZ391d9kXxb4ev0TMTcdKcUiVxMqgW0uEjyMzP2PCtTswCJOP1nwT/Xvt4 E7iC8Xm8QBOUqt41xBew9Q1TVCxlAZDjnaM46XIEiBg8rNlkh4Z+g1s2mHSoL7jP+tmU ln4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720021063; x=1720625863; 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=QXlYYR1UR9cqAQ1pIZHR6lAQLRa2deLFoE8lo+c+kks=; b=xQ7sEIo0SipBUUjQOOMXf+h6hXcqDp2dsh3bsNBfCuJMDXhH2ee/wlao1pOC2eEQ14 4VFM9Cp+xX9GNfSkchJZRZcLgVbLpN+NJBy32d0OddxeKV1COqTcF2raKyAtDcdO51rJ tiXpWv0v1y1dPU68egr4nqQtXoMqvxWE5UMF2OJwCgDo0DAlf2qQ3yNybs6WKK7AuM2D qRLpqUcyo24rVy0BW771iB0K99g/zFb2PI77X01CgSQskv0hwy91Vym/selD2VrassJb nyL1FbiElNei7kBeQ5favWXjdsx+A7vsqxrZ00KxA9Umg/0G6uMGIz7iXY4J8LaE46Qg q6VQ== X-Gm-Message-State: AOJu0YxerfXRPDWK8o3zus6FPVoTAoKiCBI2UDpzE/2r1w/P1Z63LE+Z Q2PYjSRZ9c5/rCuSi3qFw6C6bIwi0QBClekhh3eoZEl+/h8TTzTNRxZhJn7I7Sfsbh4x6hGB94j Sux/e2oW2wdQVZZqNEZX3STwWkg== X-Google-Smtp-Source: AGHT+IFK31UsAzUApygH4p1vn9PaZfFSeq5R9qd5sAlUzx8hcFcelv/46dvTQSMU89/uRNfJ9fru0q36VeOeQRptLhU= X-Received: from sebkvm.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:cd5]) (user=sebastianene job=sendgmr) by 2002:a05:600c:3ba6:b0:425:6c3d:36cd with SMTP id 5b1f17b1804b1-42579fed62cmr919245e9.0.1720021062606; Wed, 03 Jul 2024 08:37:42 -0700 (PDT) Date: Wed, 3 Jul 2024 15:37:31 +0000 In-Reply-To: <20240703153732.3214238-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: <20240703153732.3214238-1-sebastianene@google.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Message-ID: <20240703153732.3214238-2-sebastianene@google.com> Subject: [PATCH v3 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. Acked-by: Conor Dooley Signed-off-by: Sebastian Ene --- .../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.803.g4e1b14247a-goog From nobody Sun Feb 8 04:18:08 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (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 DC95D181D0B for ; Wed, 3 Jul 2024 15:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720021068; cv=none; b=BGs7nX5Lv8Joae5ZF6NBdr5AHjra0YU9dNn30KMTxln7WRb+1FK2XNAB3VjEO8AoKgzpPYxVsmTOBopF2DLOm22aAE6sNWAYX/Jnkn0OqDUBmwbcojQjyl9FHGrrZrR/z+dbonVpZZ7enFtTYiTa3SUxjnQehFZNqdW7gt6W8LY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720021068; c=relaxed/simple; bh=wWQnGurz34dVjbYa9e51gztmmwliLAPDPJ50ZxG9qgA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OtMy1/5XBnpCkRvKzGnz/LEV5WaOvTOVYJo/cUszUG4CHYkjh0bO/4YBsMDMUAhLwrqkMh2Sah11C9RVIz4f2MOo19IEl8KrVTKNCMqCuAb6xVCOitmnlQl6xfiCCxcW/rZpTFKgP9ge0VUlprAKvjzPUK75vvvS4SbN3K1xo+U= 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=vB447qfW; arc=none smtp.client-ip=209.85.221.74 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="vB447qfW" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-36710f4d5c9so3659313f8f.3 for ; Wed, 03 Jul 2024 08:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720021065; x=1720625865; 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=0VgYma1pZNwjgQS0gGYLtcG95OpDEpiYchTd4dd1CUU=; b=vB447qfWA+QqAReHdJNZ6pANeyk610uYUMJas++wzJz0l8thIZWaLmY3lOGRaMDbdl 3x8pINYgZQpnfPz4oTUy9hHA6F8bQY24WDV1lBuIfHcZb1Bf4HxcsyYY1exSeAYf9Uut YrCKWqWk/F75yiXjcqpS611pjQ3qSB0a82xO/iYMhPrUECSpBGZ95ZI+BpxHQAeBaufh /4e4rQooSl64Q8gR++CKkt4DJH1B4CfjHtevJjCQEKIKYoaSeO/rbk4KVQWvSxEtNaxA mk9OddIYcXDezGG8WA7L2rkesLhlOCo8pIRik5USrbHTWxcaxMPdhsdv8aqW0qLRZMfk OIqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720021065; x=1720625865; 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=0VgYma1pZNwjgQS0gGYLtcG95OpDEpiYchTd4dd1CUU=; b=ULqDC4DmDbJJulFyKwRgpHKMyEbTD/QiHwWAicfgg9ge8H7Tcjv/PCRa0U73FKQBDA a3HeqXosZIW558L6JPdwHI00v24CddoQ23EroWCzb7MiS+BzaiKQq/acU/iop0jWkNLj Opychd2kvsRq54UlpPUiRjdvbs6s0QrAPns3Il7dWD8Jop8Kh3IAR/qiaZm6AbvwpnHt E5ZXM7GNIL1iqMG+upXwT8UjWLXTICnQsf+AlDGb1eI85yrAUtWZRyJymenjSCqqtFEb sS4BG2f8kQAovQfbwtsUgMIO88A8rWtlHDYt9kwtzQmg3J652RlAtQSe+WR/d+w8AJyn DWtw== X-Gm-Message-State: AOJu0YxTfvGq1F7/fbl3PMFbntW3kqZ3fLMf45hYYS95HZxP0Gd9HfLq HHvg79+zRvUmczE7SWHVbu7+MIHCKbpXi1CxbYv3D6wyK1uO5BS9+A++s9m6J3ikrCk9CyeAgYs A0ry8HLJQnVQu1C3xkhW9sjh9rg== X-Google-Smtp-Source: AGHT+IFtkau4PUrPfaFpoWT9WZrMlwkJ6nzWXCWyNHWwfM9MaDp702lOc0joHAm0FFW3M+zr4hwKVhi/sAR/SkVIlZA= X-Received: from sebkvm.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:cd5]) (user=sebastianene job=sendgmr) by 2002:a5d:6447:0:b0:362:b9a0:1cdc with SMTP id ffacd0b85a97d-367756b2babmr19658f8f.5.1720021065201; Wed, 03 Jul 2024 08:37:45 -0700 (PDT) Date: Wed, 3 Jul 2024 15:37:32 +0000 In-Reply-To: <20240703153732.3214238-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: <20240703153732.3214238-1-sebastianene@google.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Message-ID: <20240703153732.3214238-3-sebastianene@google.com> Subject: [PATCH v3 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.803.g4e1b14247a-goog