qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: agraf@suse.de
Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	david@gibson.dropbear.id.au
Subject: [Qemu-devel] [PATCH 1/4] pseries: Factor out check for out-of-bounds LIOBN
Date: Tue, 30 Apr 2013 14:33:51 +1000	[thread overview]
Message-ID: <1367296434-15453-2-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1367296434-15453-1-git-send-email-aik@ozlabs.ru>

From: David Gibson <david@gibson.dropbear.id.au>

PAPR defines LIOBNs (Logical IO Bus Numbers) to be 32-bit, and we check for
values that aren't in the code for H_PUT_TCE.  This patch factors the check
into spapr_tce_find_by_liobn(), which already checks if a 32-bit LIOBN
actually exists.  This will become more important as future patches add
other hypercalls which need to look up a LIOBN.

At the same time we fix the typo in the message.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr_iommu.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index d2782cf..c6aa4fe 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -55,6 +55,12 @@ static sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn)
 {
     sPAPRTCETable *tcet;
 
+    if (liobn & 0xFFFFFFFF00000000ULL) {
+        hcall_dprintf("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx "\n",
+                      liobn);
+        return NULL;
+    }
+
     QLIST_FOREACH(tcet, &spapr_tce_tables, list) {
         if (tcet->liobn == liobn) {
             return tcet;
@@ -218,12 +224,6 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
     target_ulong tce = args[2];
     sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
 
-    if (liobn & 0xFFFFFFFF00000000ULL) {
-        hcall_dprintf("spapr_vio_put_tce on out-of-boundsw LIOBN "
-                      TARGET_FMT_lx "\n", liobn);
-        return H_PARAMETER;
-    }
-
     ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
 
     if (tcet) {
-- 
1.7.10.4

  reply	other threads:[~2013-04-30  4:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30  4:33 [Qemu-devel] [0/4] General updates for pseries Alexey Kardashevskiy
2013-04-30  4:33 ` Alexey Kardashevskiy [this message]
2013-04-30  4:33 ` [Qemu-devel] [PATCH 2/4] pseries: Fix debug message for out-of-bounds address in H_PUT_TCE Alexey Kardashevskiy
2013-04-30  4:33 ` [Qemu-devel] [PATCH 3/4] spapr: Code more defensively against lack of primary PCI bus Alexey Kardashevskiy
2013-04-30  9:45   ` Alexander Graf
2013-04-30 11:15     ` Alexey Kardashevskiy
2013-04-30 11:30       ` Alexander Graf
2013-04-30 11:52         ` Alexey Kardashevskiy
2013-04-30 11:56           ` Alexander Graf
2013-04-30 12:07             ` Alexey Kardashevskiy
2013-04-30 12:29               ` Alexander Graf
2013-04-30  4:33 ` [Qemu-devel] [PATCH 4/4] pseries: Update SLOF firmware image Alexey Kardashevskiy
2013-04-30  9:39 ` [Qemu-devel] [0/4] General updates for pseries Alexander Graf
2013-04-30  9:46   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2013-04-30 11:17   ` [Qemu-devel] " Alexey Kardashevskiy

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=1367296434-15453-2-git-send-email-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --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).