peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0008-exec-allows-8-byte-accesses-in-subpage_ops.patch

391fb8
From cdea522fe22d3996228c1b5a80b8d6e959da91aa Mon Sep 17 00:00:00 2001
391fb8
From: Paolo Bonzini <pbonzini@redhat.com>
391fb8
Date: Mon, 22 Dec 2014 13:11:39 +0100
391fb8
Subject: [PATCH 08/15] exec: allows 8-byte accesses in subpage_ops
391fb8
391fb8
Otherwise fw_cfg accesses are split into 4-byte ones before they reach the
391fb8
fw_cfg ops / handlers.
391fb8
391fb8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
391fb8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
391fb8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
391fb8
Message-id: 1419250305-31062-6-git-send-email-pbonzini@redhat.com
391fb8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
391fb8
(cherry picked from commit ff6cff7554be06e95f8d712f66cd16bd6681c746)
391fb8
---
391fb8
 exec.c | 13 +++++++++++--
391fb8
 1 file changed, 11 insertions(+), 2 deletions(-)
391fb8
391fb8
diff --git a/exec.c b/exec.c
391fb8
index 71ac104..dee9543 100644
391fb8
--- a/exec.c
391fb8
+++ b/exec.c
391fb8
@@ -1768,7 +1768,7 @@ static uint64_t subpage_read(void *opaque, hwaddr addr,
391fb8
                              unsigned len)
391fb8
 {
391fb8
     subpage_t *subpage = opaque;
391fb8
-    uint8_t buf[4];
391fb8
+    uint8_t buf[8];
391fb8
 
391fb8
 #if defined(DEBUG_SUBPAGE)
391fb8
     printf("%s: subpage %p len %u addr " TARGET_FMT_plx "\n", __func__,
391fb8
@@ -1782,6 +1782,8 @@ static uint64_t subpage_read(void *opaque, hwaddr addr,
391fb8
         return lduw_p(buf);
391fb8
     case 4:
391fb8
         return ldl_p(buf);
391fb8
+    case 8:
391fb8
+        return ldq_p(buf);
391fb8
     default:
391fb8
         abort();
391fb8
     }
391fb8
@@ -1791,7 +1793,7 @@ static void subpage_write(void *opaque, hwaddr addr,
391fb8
                           uint64_t value, unsigned len)
391fb8
 {
391fb8
     subpage_t *subpage = opaque;
391fb8
-    uint8_t buf[4];
391fb8
+    uint8_t buf[8];
391fb8
 
391fb8
 #if defined(DEBUG_SUBPAGE)
391fb8
     printf("%s: subpage %p len %u addr " TARGET_FMT_plx
391fb8
@@ -1808,6 +1810,9 @@ static void subpage_write(void *opaque, hwaddr addr,
391fb8
     case 4:
391fb8
         stl_p(buf, value);
391fb8
         break;
391fb8
+    case 8:
391fb8
+        stq_p(buf, value);
391fb8
+        break;
391fb8
     default:
391fb8
         abort();
391fb8
     }
391fb8
@@ -1830,6 +1835,10 @@ static bool subpage_accepts(void *opaque, hwaddr addr,
391fb8
 static const MemoryRegionOps subpage_ops = {
391fb8
     .read = subpage_read,
391fb8
     .write = subpage_write,
391fb8
+    .impl.min_access_size = 1,
391fb8
+    .impl.max_access_size = 8,
391fb8
+    .valid.min_access_size = 1,
391fb8
+    .valid.max_access_size = 8,
391fb8
     .valid.accepts = subpage_accepts,
391fb8
     .endianness = DEVICE_NATIVE_ENDIAN,
391fb8
 };
391fb8
-- 
391fb8
2.1.0
391fb8