All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chalios, Babis" <bchalios@amazon.es>
To: "mst@redhat.com" <mst@redhat.com>,
	"imammedo@redhat.com" <imammedo@redhat.com>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"dwmw2@infradead.org" <dwmw2@infradead.org>,
	"Chalios, Babis" <bchalios@amazon.es>, "Graf (AWS),
	Alexander" <graf@amazon.de>,
	"mzxreary@0pointer.de" <mzxreary@0pointer.de>
Subject: [RFC PATCH 1/4] acpi: fix acpi_send_gpe_event() to handle more events
Date: Mon, 1 Dec 2025 12:50:47 +0000	[thread overview]
Message-ID: <20251201125023.18344-3-bchalios@amazon.es> (raw)
In-Reply-To: <20251201125023.18344-1-bchalios@amazon.es>

acpi_send_gpe_events() sends events encoded in the AcpiEventStatusBits
enum. The maximum bit used so far in the latter was 128, hence a single
byte (ACPIGPE.sts[0]) is currently enough to hold the set bits.

When we add an extra one, we will need a second byte to encode the state
and casting from AcpiEventStatusBits to uint8_t will silently ignore the
higher bits.

Fix this, by taking into account the length value inside ACPIGPE.

Signed-off-by: Babis Chalios <bchalios@amazon.es>
---
 hw/acpi/core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index ff16582803..48694eca54 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -730,7 +730,13 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
 void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
                          AcpiEventStatusBits status)
 {
-    ar->gpe.sts[0] |= status;
+    int i;
+
+    for (i = 0; i < ar->gpe.len; i++) {
+        ar->gpe.sts[i] |= (status & 0xff);
+        status >>= 8;
+    }
+
     acpi_update_sci(ar, irq);
 }
 
-- 
2.34.1



  parent reply	other threads:[~2025-12-01 12:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 12:50 [RFC PATCH 0/4] vmclock: add support for VM generation counter and notifications Chalios, Babis
2025-12-01 12:50 ` Chalios, Babis
2025-12-01 12:52   ` Babis Chalios
2025-12-01 12:50 ` Chalios, Babis [this message]
2026-02-04  0:07   ` [RFC PATCH 1/4] acpi: fix acpi_send_gpe_event() to handle more events David Woodhouse
2025-12-01 12:50 ` [RFC PATCH 2/4] hw/acpi: add new fields in VMClock ABI Chalios, Babis
2025-12-01 13:04   ` Cornelia Huck
2025-12-01 13:11     ` Babis Chalios
2025-12-01 13:36       ` Cornelia Huck
2025-12-01 13:24     ` David Woodhouse
2025-12-01 13:38       ` Cornelia Huck
2025-12-01 14:27         ` David Woodhouse
2025-12-01 15:05           ` Babis Chalios
2025-12-01 15:21             ` David Woodhouse
2025-12-01 15:10           ` Cornelia Huck
2025-12-01 12:51 ` [RFC PATCH 3/4] hw/acpi: add VM generation counter field to VMClock Chalios, Babis
2025-12-01 14:12   ` Daniel P. Berrangé
2025-12-01 14:29     ` David Woodhouse
2025-12-01 14:41       ` Daniel P. Berrangé
2025-12-01 15:01         ` Babis Chalios
2025-12-01 15:28           ` David Woodhouse
2025-12-01 12:51 ` [RFC PATCH 4/4] hw/acpi: add ACPI notification to VMClock device Chalios, Babis
2025-12-01 15:10 ` [RFC PATCH 0/4] vmclock: add support for VM generation counter and notifications Daniel P. Berrangé
2025-12-01 15:23   ` David Woodhouse
2025-12-01 15:46   ` Babis Chalios

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251201125023.18344-3-bchalios@amazon.es \
    --to=bchalios@amazon.es \
    --cc=cohuck@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=graf@amazon.de \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=mzxreary@0pointer.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.