From: Jan Kiszka <jan.kiszka@web.de>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v2 07/16] ioapic: Convert to memory API
Date: Sun, 4 Dec 2011 15:46:21 +0100 [thread overview]
Message-ID: <47f435c93104220d93c7cc73a9648c4534b11e3c.1323009989.git.jan.kiszka@web.de> (raw)
In-Reply-To: <cover.1323009989.git.jan.kiszka@web.de>
In-Reply-To: <cover.1323009989.git.jan.kiszka@web.de>
From: Jan Kiszka <jan.kiszka@siemens.com>
This maintains the old imprecise access size handling.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/ioapic.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/hw/ioapic.c b/hw/ioapic.c
index 61991d7..56b1612 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -86,6 +86,7 @@ typedef struct IOAPICState IOAPICState;
struct IOAPICState {
SysBusDevice busdev;
+ MemoryRegion io_memory;
uint8_t id;
uint8_t ioregsel;
uint32_t irr;
@@ -195,7 +196,8 @@ void ioapic_eoi_broadcast(int vector)
}
}
-static uint32_t ioapic_mem_readl(void *opaque, target_phys_addr_t addr)
+static uint64_t
+ioapic_mem_read(void *opaque, target_phys_addr_t addr, unsigned int size)
{
IOAPICState *s = opaque;
int index;
@@ -234,7 +236,8 @@ static uint32_t ioapic_mem_readl(void *opaque, target_phys_addr_t addr)
}
static void
-ioapic_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
+ioapic_mem_write(void *opaque, target_phys_addr_t addr, uint64_t val,
+ unsigned int size)
{
IOAPICState *s = opaque;
int index;
@@ -309,32 +312,23 @@ static void ioapic_reset(DeviceState *d)
}
}
-static CPUReadMemoryFunc * const ioapic_mem_read[3] = {
- ioapic_mem_readl,
- ioapic_mem_readl,
- ioapic_mem_readl,
-};
-
-static CPUWriteMemoryFunc * const ioapic_mem_write[3] = {
- ioapic_mem_writel,
- ioapic_mem_writel,
- ioapic_mem_writel,
+static const MemoryRegionOps ioapic_io_ops = {
+ .read = ioapic_mem_read,
+ .write = ioapic_mem_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static int ioapic_init1(SysBusDevice *dev)
{
IOAPICState *s = FROM_SYSBUS(IOAPICState, dev);
- int io_memory;
static int ioapic_no;
if (ioapic_no >= MAX_IOAPICS) {
return -1;
}
- io_memory = cpu_register_io_memory(ioapic_mem_read,
- ioapic_mem_write, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, 0x1000, io_memory);
+ memory_region_init_io(&s->io_memory, &ioapic_io_ops, s, "ioapic", 0x1000);
+ sysbus_init_mmio_region(dev, &s->io_memory);
qdev_init_gpio_in(&dev->qdev, ioapic_set_irq, IOAPIC_NUM_PINS);
--
1.7.3.4
next prev parent reply other threads:[~2011-12-04 14:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-04 14:46 [Qemu-devel] [PATCH v2 00/16] uq/master: Introduce basic irqchip support Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 01/16] msi: Generalize msix_supported to msi_supported Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 02/16] kvm: Move kvmclock into hw/kvm folder Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 03/16] apic: Stop timer on reset Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 04/16] apic: Factor out core for KVM reuse Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 05/16] apic: Open-code timer save/restore Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 06/16] i8259: Factor out core for KVM reuse Jan Kiszka
2011-12-04 14:46 ` Jan Kiszka [this message]
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 08/16] ioapic: Reject non-dword accesses to IOWIN register Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 09/16] ioapic: Factor out core for KVM reuse Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 10/16] memory: Introduce memory_region_init_reservation Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 11/16] kvm: Introduce core services for in-kernel irqchip support Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 12/16] kvm: x86: Establish IRQ0 override control Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 13/16] kvm: x86: Add user space part for in-kernel APIC Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 14/16] kvm: x86: Add user space part for in-kernel i8259 Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 15/16] kvm: x86: Add user space part for in-kernel IOAPIC Jan Kiszka
2011-12-04 14:46 ` [Qemu-devel] [PATCH v2 16/16] kvm: Arm in-kernel irqchip support Jan Kiszka
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=47f435c93104220d93c7cc73a9648c4534b11e3c.1323009989.git.jan.kiszka@web.de \
--to=jan.kiszka@web.de \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@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).