[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [patch v4 16/16] e1000: implement MemoryRegionOps's ref&loc
From: |
Liu Ping Fan |
Subject: |
[Qemu-devel] [patch v4 16/16] e1000: implement MemoryRegionOps's ref&lock interface |
Date: |
Mon, 22 Oct 2012 17:23:59 +0800 |
With this, e1000 tells memory core that it can be protected by
refcnt, and can protected by local lock
Signed-off-by: Liu Ping Fan <address@hidden>
---
hw/e1000.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 72c2324..9929fe6 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1082,9 +1082,40 @@ e1000_mmio_read(void *opaque, target_phys_addr_t addr,
unsigned size)
return ret;
}
+static void e1000_mmio_lock(MemoryRegion *mr)
+{
+ E1000State *d = container_of(mr, E1000State, mmio);
+ qemu_mutex_lock(&d->e1000_lock);
+}
+
+static void e1000_mmio_unlock(MemoryRegion *mr)
+{
+ E1000State *d = container_of(mr, E1000State, mmio);
+ qemu_mutex_unlock(&d->e1000_lock);
+}
+
+static int e1000_mmio_ref(MemoryRegion *mr)
+{
+ E1000State *e1000 = container_of(mr, E1000State, mmio);
+
+ object_ref(OBJECT(e1000));
+ return 1;
+}
+
+static void e1000_mmio_unref(MemoryRegion *mr)
+{
+ E1000State *e1000 = container_of(mr, E1000State, mmio);
+
+ object_unref(OBJECT(e1000));
+}
+
static const MemoryRegionOps e1000_mmio_ops = {
.read = e1000_mmio_read,
.write = e1000_mmio_write,
+ .ref = e1000_mmio_ref,
+ .unref = e1000_mmio_unref,
+ .lock = e1000_mmio_lock,
+ .unlock = e1000_mmio_unlock,
.endianness = DEVICE_LITTLE_ENDIAN,
.impl = {
.min_access_size = 4,
--
1.7.4.4
- Re: [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state, (continued)
- Re: [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state, liu ping fan, 2012/10/25
- Re: [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state, liu ping fan, 2012/10/25
- Re: [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state, Jan Kiszka, 2012/10/26
- Re: [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state, liu ping fan, 2012/10/29
- Re: [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state, Peter Maydell, 2012/10/29
[Qemu-devel] [patch v4 11/16] vcpu: push mmio dispatcher out of big lock, Liu Ping Fan, 2012/10/22
[Qemu-devel] [patch v4 15/16] e1000: introduce unmap() to fix unplug issue, Liu Ping Fan, 2012/10/22
[Qemu-devel] [patch v4 02/16] qom: apply atomic on object's refcount, Liu Ping Fan, 2012/10/22
[Qemu-devel] [patch v4 16/16] e1000: implement MemoryRegionOps's ref&lock interface,
Liu Ping Fan <=
Re: [Qemu-devel] [patch v4 00/16] push mmio dispatch out of big lock, Peter Maydell, 2012/10/25
Re: [Qemu-devel] [patch v4 00/16] push mmio dispatch out of big lock, Avi Kivity, 2012/10/29