All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hu Tao <hutao@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Yasuaki Isimatu <isimatu.yasuaki@jp.fujitsu.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Yasunori Goto <y-goto@jp.fujitsu.com>
Subject: [Qemu-devel] [PATCH v7 RESEND 4/8] memory: add parameter errp to memory_region_init_rom_device
Date: Tue, 9 Sep 2014 13:27:57 +0800	[thread overview]
Message-ID: <78be9bf0b4be81bf9e810e42a115e86a199241d2.1410240131.git.hutao@cn.fujitsu.com> (raw)
In-Reply-To: <cover.1410240131.git.hutao@cn.fujitsu.com>

Add parameter errp to memory_region_init_rom_device and update all call
sites to pass in &error_abort.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/block/pflash_cfi01.c | 2 +-
 hw/block/pflash_cfi02.c | 2 +-
 include/exec/memory.h   | 4 +++-
 memory.c                | 5 +++--
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 593fbc5..4d51bfd 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -773,7 +773,7 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp)
     memory_region_init_rom_device(
         &pfl->mem, OBJECT(dev),
         pfl->be ? &pflash_cfi01_ops_be : &pflash_cfi01_ops_le, pfl,
-        pfl->name, total_len);
+        pfl->name, total_len, &error_abort);
     vmstate_register_ram(&pfl->mem, DEVICE(pfl));
     pfl->storage = memory_region_get_ram_ptr(&pfl->mem);
     sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem);
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index e196f4d..29bb0dc 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -608,7 +608,7 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp)
 
     memory_region_init_rom_device(&pfl->orig_mem, OBJECT(pfl), pfl->be ?
                                   &pflash_cfi02_ops_be : &pflash_cfi02_ops_le,
-                                  pfl, pfl->name, chip_len);
+                                  pfl, pfl->name, chip_len, &error_abort);
     vmstate_register_ram(&pfl->orig_mem, DEVICE(pfl));
     pfl->storage = memory_region_get_ram_ptr(&pfl->orig_mem);
     pfl->chip_len = chip_len;
diff --git a/include/exec/memory.h b/include/exec/memory.h
index dcb35a2..4921d27 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -388,13 +388,15 @@ void memory_region_init_alias(MemoryRegion *mr,
  * @ops: callbacks for write access handling.
  * @name: the name of the region.
  * @size: size of the region.
+ * @errp: pointer to Error*, to store an error if it happens.
  */
 void memory_region_init_rom_device(MemoryRegion *mr,
                                    struct Object *owner,
                                    const MemoryRegionOps *ops,
                                    void *opaque,
                                    const char *name,
-                                   uint64_t size);
+                                   uint64_t size,
+                                   Error **errp);
 
 /**
  * memory_region_init_reservation: Initialize a memory region that reserves
diff --git a/memory.c b/memory.c
index ffe24ff..38c29df 100644
--- a/memory.c
+++ b/memory.c
@@ -1202,7 +1202,8 @@ void memory_region_init_rom_device(MemoryRegion *mr,
                                    const MemoryRegionOps *ops,
                                    void *opaque,
                                    const char *name,
-                                   uint64_t size)
+                                   uint64_t size,
+                                   Error **errp)
 {
     memory_region_init(mr, owner, name, size);
     mr->ops = ops;
@@ -1210,7 +1211,7 @@ void memory_region_init_rom_device(MemoryRegion *mr,
     mr->terminates = true;
     mr->rom_device = true;
     mr->destructor = memory_region_destructor_rom_device;
-    mr->ram_addr = qemu_ram_alloc(size, mr, &error_abort);
+    mr->ram_addr = qemu_ram_alloc(size, mr, errp);
 }
 
 void memory_region_init_iommu(MemoryRegion *mr,
-- 
1.9.3

  parent reply	other threads:[~2014-09-09  5:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09  5:27 [Qemu-devel] [PATCH v7 RESEND 0/8] memory API improvements and bug fixes for memory backends Hu Tao
2014-09-09  5:27 ` [Qemu-devel] [PATCH v7 RESEND 1/8] exec: add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr Hu Tao
2014-09-09  5:27 ` [Qemu-devel] [PATCH v7 RESEND 2/8] memory: add parameter errp to memory_region_init_ram Hu Tao
2014-09-09 11:28   ` Paolo Bonzini
2014-09-09  5:27 ` [Qemu-devel] [PATCH v7 RESEND 3/8] memory: add parameter errp to memory_region_init_ram_ptr Hu Tao
2014-09-09 11:18   ` Paolo Bonzini
2014-09-09  5:27 ` Hu Tao [this message]
2014-09-09 11:20   ` [Qemu-devel] [PATCH v7 RESEND 4/8] memory: add parameter errp to memory_region_init_rom_device Paolo Bonzini
2014-09-10  2:05     ` Hu Tao
2014-09-10  9:11       ` Paolo Bonzini
2014-09-09  5:27 ` [Qemu-devel] [PATCH v7 RESEND 5/8] hostmem-ram: don't exit qemu if size of memory-backend-ram is way too big Hu Tao
2014-09-09  5:27 ` [Qemu-devel] [PATCH v7 RESEND 6/8] exec: file_ram_alloc: don't exit if failed to preallocate memory Hu Tao
2014-09-09 11:23   ` Paolo Bonzini
2014-09-09  5:28 ` [Qemu-devel] [PATCH v7 RESEND 7/8] exec: report error when memory < hpagesize Hu Tao
2014-09-09  5:28 ` [Qemu-devel] [PATCH v7 RESEND 8/8] exec: add parameter errp to gethugepagesize Hu Tao
2014-09-09 11:29 ` [Qemu-devel] [PATCH v7 RESEND 0/8] memory API improvements and bug fixes for memory backends Paolo Bonzini
2014-09-10  2:09   ` Hu Tao

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=78be9bf0b4be81bf9e810e42a115e86a199241d2.1410240131.git.hutao@cn.fujitsu.com \
    --to=hutao@cn.fujitsu.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=y-goto@jp.fujitsu.com \
    /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.