qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	"Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH 1/3] spapr/xive: EQ page should be naturally aligned
Date: Wed,  8 May 2019 19:19:44 +0200	[thread overview]
Message-ID: <20190508171946.657-2-clg@kaod.org> (raw)
In-Reply-To: <20190508171946.657-1-clg@kaod.org>

When the OS configures the EQ page in which to receive event
notifications from the XIVE interrupt controller, the page should be
naturally aligned. Add this check.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/intc/spapr_xive.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index 097f88d4608d..666e24e9b447 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -993,6 +993,12 @@ static target_ulong h_int_set_queue_config(PowerPCCPU *cpu,
     case 16:
     case 21:
     case 24:
+        if (!QEMU_IS_ALIGNED(qpage, 1ul << qsize)) {
+            qemu_log_mask(LOG_GUEST_ERROR, "XIVE: EQ @0x%" HWADDR_PRIx
+                          " is not naturally aligned with %" HWADDR_PRIx "\n",
+                          qpage, 1ul << qsize);
+            return H_P4;
+        }
         end.w2 = cpu_to_be32((qpage >> 32) & 0x0fffffff);
         end.w3 = cpu_to_be32(qpage & 0xffffffff);
         end.w0 |= cpu_to_be32(END_W0_ENQUEUE);
-- 
2.20.1



  reply	other threads:[~2019-05-08 17:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 17:19 [Qemu-devel] [PATCH 0/3] spapr/xive: fixes on EQ page addresses Cédric Le Goater
2019-05-08 17:19 ` Cédric Le Goater [this message]
2019-05-09  5:37   ` [Qemu-devel] [PATCH 1/3] spapr/xive: EQ page should be naturally aligned David Gibson
2019-05-09  8:48   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2019-05-08 17:19 ` [Qemu-devel] [PATCH 2/3] spapr/xive: fix EQ page addresses above 64GB Cédric Le Goater
2019-05-09  5:40   ` David Gibson
2019-05-09  8:51   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2019-05-08 17:19 ` [Qemu-devel] [PATCH 3/3] spapr/xive: print out the EQ page address in the monitor Cédric Le Goater
2019-05-09  5:40   ` David Gibson
2019-05-09  8:52   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz

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=20190508171946.657-2-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).