* [Qemu-devel] [PATCH V10 1/8] isa: add isa_address_space_io
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-11-25 12:39 ` Andreas Färber
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport* Julien Grall
` (8 subsequent siblings)
9 siblings, 1 reply; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This function permits to retrieve ISA IO address space.
It will be usefull when we need to pass IO address space as argument.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/isa-bus.c | 9 +++++++++
hw/isa.h | 1 +
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index f9b2373..c1d8309 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -244,4 +244,13 @@ MemoryRegion *isa_address_space(ISADevice *dev)
return get_system_memory();
}
+MemoryRegion *isa_address_space_io(ISADevice *dev)
+{
+ if (dev) {
+ return isa_bus_from_device(dev)->address_space_io;
+ }
+
+ return isabus->address_space_io;
+}
+
type_init(isabus_register_types)
diff --git a/hw/isa.h b/hw/isa.h
index dc97052..3891c1f 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -43,6 +43,7 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
qemu_irq isa_get_irq(ISADevice *dev, int isairq);
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
MemoryRegion *isa_address_space(ISADevice *dev);
+MemoryRegion *isa_address_space_io(ISADevice *dev);
ISADevice *isa_create(ISABus *bus, const char *name);
ISADevice *isa_try_create(ISABus *bus, const char *name);
ISADevice *isa_create_simple(ISABus *bus, const char *name);
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 1/8] isa: add isa_address_space_io
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 1/8] isa: add isa_address_space_io Julien Grall
@ 2012-11-25 12:39 ` Andreas Färber
0 siblings, 0 replies; 27+ messages in thread
From: Andreas Färber @ 2012-11-25 12:39 UTC (permalink / raw)
To: Julien Grall; +Cc: qemu-devel, jan.kiszka, kraxel, avi, Stefano.Stabellini
Am 19.09.2012 13:50, schrieb Julien Grall:
> This function permits to retrieve ISA IO address space.
> It will be usefull when we need to pass IO address space as argument.
>
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
A note below:
> ---
> hw/isa-bus.c | 9 +++++++++
> hw/isa.h | 1 +
> 2 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/hw/isa-bus.c b/hw/isa-bus.c
> index f9b2373..c1d8309 100644
> --- a/hw/isa-bus.c
> +++ b/hw/isa-bus.c
> @@ -244,4 +244,13 @@ MemoryRegion *isa_address_space(ISADevice *dev)
> return get_system_memory();
> }
>
> +MemoryRegion *isa_address_space_io(ISADevice *dev)
> +{
> + if (dev) {
> + return isa_bus_from_device(dev)->address_space_io;
This assumes that the device is attached to an ISABus already...
> + }
> +
> + return isabus->address_space_io;
...and that the ISABus has been set globally, which I think is an
assumption we make elsewhere as well, i.e. it cannot be used at
instance_init time but in qdev initfn/realizefn.
Andreas
> +}
> +
> type_init(isabus_register_types)
> diff --git a/hw/isa.h b/hw/isa.h
> index dc97052..3891c1f 100644
> --- a/hw/isa.h
> +++ b/hw/isa.h
> @@ -43,6 +43,7 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
> qemu_irq isa_get_irq(ISADevice *dev, int isairq);
> void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
> MemoryRegion *isa_address_space(ISADevice *dev);
> +MemoryRegion *isa_address_space_io(ISADevice *dev);
> ISADevice *isa_create(ISABus *bus, const char *name);
> ISADevice *isa_try_create(ISABus *bus, const char *name);
> ISADevice *isa_create_simple(ISABus *bus, const char *name);
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport*
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 1/8] isa: add isa_address_space_io Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-11-25 12:51 ` Andreas Färber
2012-11-27 0:10 ` Andreas Färber
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 3/8] smb: replace_register_ioport* Julien Grall
` (7 subsequent siblings)
9 siblings, 2 replies; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This patch replaces all register_ioport* by a MemorySection.
It permits to use the new Memory stuff like listener.
Moreover, the PCI is added as an argument for apm_init, so we
can register IO inside the pci IO address space.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/acpi_piix4.c | 2 +-
hw/apm.c | 24 +++++++++++++++++++-----
hw/apm.h | 5 ++++-
hw/vt82c686.c | 2 +-
4 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index c56220b..fd2fc33 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -395,7 +395,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
pci_conf[0x3d] = 0x01; // interrupt pin 1
/* APM */
- apm_init(&s->apm, apm_ctrl_changed, s);
+ apm_init(dev, &s->apm, apm_ctrl_changed, s);
register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
diff --git a/hw/apm.c b/hw/apm.c
index 2aead52..fe7bc21 100644
--- a/hw/apm.c
+++ b/hw/apm.c
@@ -22,6 +22,7 @@
#include "apm.h"
#include "hw.h"
+#include "pci.h"
//#define DEBUG
@@ -35,7 +36,8 @@
#define APM_CNT_IOPORT 0xb2
#define APM_STS_IOPORT 0xb3
-static void apm_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
+static void apm_ioport_writeb(void *opaque, target_phys_addr_t addr,
+ uint64_t val, unsigned size)
{
APMState *apm = opaque;
addr &= 1;
@@ -51,7 +53,8 @@ static void apm_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
}
}
-static uint32_t apm_ioport_readb(void *opaque, uint32_t addr)
+static uint64_t apm_ioport_readb(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
APMState *apm = opaque;
uint32_t val;
@@ -78,12 +81,23 @@ const VMStateDescription vmstate_apm = {
}
};
-void apm_init(APMState *apm, apm_ctrl_changed_t callback, void *arg)
+static const MemoryRegionOps apm_ops = {
+ .read = apm_ioport_readb,
+ .write = apm_ioport_writeb,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
+void apm_init(PCIDevice *dev, APMState *apm, apm_ctrl_changed_t callback,
+ void *arg)
{
apm->callback = callback;
apm->arg = arg;
/* ioport 0xb2, 0xb3 */
- register_ioport_write(APM_CNT_IOPORT, 2, 1, apm_ioport_writeb, apm);
- register_ioport_read(APM_CNT_IOPORT, 2, 1, apm_ioport_readb, apm);
+ memory_region_init_io(&apm->io, &apm_ops, apm, "apm-io", 2);
+ memory_region_add_subregion(pci_address_space_io(dev), APM_CNT_IOPORT,
+ &apm->io);
}
diff --git a/hw/apm.h b/hw/apm.h
index f7c741e..5431b6d 100644
--- a/hw/apm.h
+++ b/hw/apm.h
@@ -4,6 +4,7 @@
#include <stdint.h>
#include "qemu-common.h"
#include "hw.h"
+#include "memory.h"
typedef void (*apm_ctrl_changed_t)(uint32_t val, void *arg);
@@ -13,9 +14,11 @@ typedef struct APMState {
apm_ctrl_changed_t callback;
void *arg;
+ MemoryRegion io;
} APMState;
-void apm_init(APMState *s, apm_ctrl_changed_t callback, void *arg);
+void apm_init(PCIDevice *dev, APMState *s, apm_ctrl_changed_t callback,
+ void *arg);
extern const VMStateDescription vmstate_apm;
diff --git a/hw/vt82c686.c b/hw/vt82c686.c
index 5d7c00c..7f11dbe 100644
--- a/hw/vt82c686.c
+++ b/hw/vt82c686.c
@@ -427,7 +427,7 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
register_ioport_write(s->smb_io_base, 0xf, 1, smb_ioport_writeb, &s->smb);
register_ioport_read(s->smb_io_base, 0xf, 1, smb_ioport_readb, &s->smb);
- apm_init(&s->apm, NULL, s);
+ apm_init(dev, &s->apm, NULL, s);
acpi_pm_tmr_init(&s->ar, pm_tmr_timer);
acpi_pm1_cnt_init(&s->ar);
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport*
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport* Julien Grall
@ 2012-11-25 12:51 ` Andreas Färber
2012-11-27 0:10 ` Andreas Färber
1 sibling, 0 replies; 27+ messages in thread
From: Andreas Färber @ 2012-11-25 12:51 UTC (permalink / raw)
To: Julien Grall; +Cc: qemu-devel, jan.kiszka, kraxel, avi, Stefano.Stabellini
Am 19.09.2012 13:50, schrieb Julien Grall:
> This patch replaces all register_ioport* by a MemorySection.
MemoryRegion fwiw. No need to resend.
Andreas
> It permits to use the new Memory stuff like listener.
>
> Moreover, the PCI is added as an argument for apm_init, so we
> can register IO inside the pci IO address space.
>
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport*
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport* Julien Grall
2012-11-25 12:51 ` Andreas Färber
@ 2012-11-27 0:10 ` Andreas Färber
2012-11-27 20:46 ` Jason Baron
1 sibling, 1 reply; 27+ messages in thread
From: Andreas Färber @ 2012-11-27 0:10 UTC (permalink / raw)
To: Julien Grall, Jason Baron
Cc: qemu-devel, jan.kiszka, kraxel, avi, Stefano.Stabellini
Am 19.09.2012 13:50, schrieb Julien Grall:
> This patch replaces all register_ioport* by a MemorySection.
> It permits to use the new Memory stuff like listener.
>
> Moreover, the PCI is added as an argument for apm_init, so we
> can register IO inside the pci IO address space.
>
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
Following today's q35 merge I needed the following diff to fix the build:
diff --git a/hw/lpc_ich9.c b/hw/lpc_ich9.c
index 2fc83a4..7de5427 100644
--- a/hw/lpc_ich9.c
+++ b/hw/lpc_ich9.c
@@ -472,7 +472,7 @@ static int ich9_lpc_initfn(PCIDevice *d)
lpc->isa_bus = isa_bus;
ich9_cc_init(lpc);
- apm_init(&lpc->apm, ich9_apm_ctrl_changed, lpc);
+ apm_init(d, &lpc->apm, ich9_apm_ctrl_changed, lpc);
return 0;
}
Julien/Jason, can you please verify that this is the correct device to pass?
Thanks,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport*
2012-11-27 0:10 ` Andreas Färber
@ 2012-11-27 20:46 ` Jason Baron
2012-12-03 16:29 ` Julien Grall
0 siblings, 1 reply; 27+ messages in thread
From: Jason Baron @ 2012-11-27 20:46 UTC (permalink / raw)
To: Andreas Färber
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, Julien Grall, kraxel,
avi
On Tue, Nov 27, 2012 at 01:10:16AM +0100, Andreas Färber wrote:
> Am 19.09.2012 13:50, schrieb Julien Grall:
> > This patch replaces all register_ioport* by a MemorySection.
> > It permits to use the new Memory stuff like listener.
> >
> > Moreover, the PCI is added as an argument for apm_init, so we
> > can register IO inside the pci IO address space.
> >
> > Signed-off-by: Julien Grall <julien.grall@citrix.com>
>
> Following today's q35 merge I needed the following diff to fix the build:
>
> diff --git a/hw/lpc_ich9.c b/hw/lpc_ich9.c
> index 2fc83a4..7de5427 100644
> --- a/hw/lpc_ich9.c
> +++ b/hw/lpc_ich9.c
> @@ -472,7 +472,7 @@ static int ich9_lpc_initfn(PCIDevice *d)
> lpc->isa_bus = isa_bus;
>
> ich9_cc_init(lpc);
> - apm_init(&lpc->apm, ich9_apm_ctrl_changed, lpc);
> + apm_init(d, &lpc->apm, ich9_apm_ctrl_changed, lpc);
> return 0;
> }
>
> Julien/Jason, can you please verify that this is the correct device to pass?
>
Looks correct to me.
Thanks,
-Jason
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport*
2012-11-27 20:46 ` Jason Baron
@ 2012-12-03 16:29 ` Julien Grall
0 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-12-03 16:29 UTC (permalink / raw)
To: Jason Baron, Andreas Färber
Cc: qemu-devel@nongnu.org, jan.kiszka@siemens.com, kraxel@redhat.com,
avi@redhat.com, Stefano Stabellini
On 11/27/2012 08:46 PM, Jason Baron wrote:
> On Tue, Nov 27, 2012 at 01:10:16AM +0100, Andreas Färber wrote:
>> Am 19.09.2012 13:50, schrieb Julien Grall:
>>> This patch replaces all register_ioport* by a MemorySection.
>>> It permits to use the new Memory stuff like listener.
>>>
>>> Moreover, the PCI is added as an argument for apm_init, so we
>>> can register IO inside the pci IO address space.
>>>
>>> Signed-off-by: Julien Grall <julien.grall@citrix.com>
>>
>> Following today's q35 merge I needed the following diff to fix the build:
>>
>> diff --git a/hw/lpc_ich9.c b/hw/lpc_ich9.c
>> index 2fc83a4..7de5427 100644
>> --- a/hw/lpc_ich9.c
>> +++ b/hw/lpc_ich9.c
>> @@ -472,7 +472,7 @@ static int ich9_lpc_initfn(PCIDevice *d)
>> lpc->isa_bus = isa_bus;
>>
>> ich9_cc_init(lpc);
>> - apm_init(&lpc->apm, ich9_apm_ctrl_changed, lpc);
>> + apm_init(d, &lpc->apm, ich9_apm_ctrl_changed, lpc);
>> return 0;
>> }
>>
>> Julien/Jason, can you please verify that this is the correct device to pass?
>>
>
> Looks correct to me.
It's ok for me.
Thanks,
Julien
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH V10 3/8] smb: replace_register_ioport*
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 1/8] isa: add isa_address_space_io Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport* Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 4/8] hw/acpi_piix4.c: replace register_ioport* Julien Grall
` (6 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This patch fix smb_ioport_* to be compliant with read/write memory callback.
Moreover it replaces all register_ioport* which use theses functions by
the new Memory API.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/acpi_piix4.c | 18 ++++++++++++++++--
hw/pm_smbus.c | 7 ++++---
hw/pm_smbus.h | 6 ++++--
hw/vt82c686.c | 18 ++++++++++++++++--
4 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index fd2fc33..0b4ad24 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -63,6 +63,8 @@ typedef struct PIIX4PMState {
PMSMBus smb;
uint32_t smb_io_base;
+ MemoryRegion smb_io;
+
qemu_irq irq;
qemu_irq smi_irq;
int kvm_enabled;
@@ -383,6 +385,16 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque)
}
+static const MemoryRegionOps smb_io_ops = {
+ .read = smb_ioport_readb,
+ .write = smb_ioport_writeb,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
static int piix4_pm_initfn(PCIDevice *dev)
{
PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, dev);
@@ -410,8 +422,10 @@ static int piix4_pm_initfn(PCIDevice *dev)
pci_conf[0x90] = s->smb_io_base | 1;
pci_conf[0x91] = s->smb_io_base >> 8;
pci_conf[0xd2] = 0x09;
- register_ioport_write(s->smb_io_base, 64, 1, smb_ioport_writeb, &s->smb);
- register_ioport_read(s->smb_io_base, 64, 1, smb_ioport_readb, &s->smb);
+
+ memory_region_init_io(&s->smb_io, &smb_io_ops, &s->smb, "piix4-smb", 64);
+ memory_region_add_subregion(pci_address_space_io(dev), s->smb_io_base,
+ &s->smb_io);
acpi_pm_tmr_init(&s->ar, pm_tmr_timer);
acpi_gpe_init(&s->ar, GPE_LEN);
diff --git a/hw/pm_smbus.c b/hw/pm_smbus.c
index 5d6046d..fe59ca6 100644
--- a/hw/pm_smbus.c
+++ b/hw/pm_smbus.c
@@ -94,7 +94,8 @@ static void smb_transaction(PMSMBus *s)
s->smb_stat |= 0x04;
}
-void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
+void smb_ioport_writeb(void *opaque, target_phys_addr_t addr, uint64_t val,
+ unsigned size)
{
PMSMBus *s = opaque;
addr &= 0x3f;
@@ -131,10 +132,10 @@ void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
}
}
-uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
+uint64_t smb_ioport_readb(void *opaque, target_phys_addr_t addr, unsigned size)
{
PMSMBus *s = opaque;
- uint32_t val;
+ uint64_t val;
addr &= 0x3f;
switch(addr) {
diff --git a/hw/pm_smbus.h b/hw/pm_smbus.h
index 4750a40..45b4330 100644
--- a/hw/pm_smbus.h
+++ b/hw/pm_smbus.h
@@ -15,7 +15,9 @@ typedef struct PMSMBus {
} PMSMBus;
void pm_smbus_init(DeviceState *parent, PMSMBus *smb);
-void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val);
-uint32_t smb_ioport_readb(void *opaque, uint32_t addr);
+void smb_ioport_writeb(void *opaque, target_phys_addr_t addr, uint64_t val,
+ unsigned size);
+uint64_t smb_ioport_readb(void *opaque, target_phys_addr_t addr,
+ unsigned size);
#endif /* !PM_SMBUS_H */
diff --git a/hw/vt82c686.c b/hw/vt82c686.c
index 7f11dbe..f8d79d5 100644
--- a/hw/vt82c686.c
+++ b/hw/vt82c686.c
@@ -163,6 +163,7 @@ typedef struct VT686PMState {
APMState apm;
PMSMBus smb;
uint32_t smb_io_base;
+ MemoryRegion smb_io;
} VT686PMState;
typedef struct VT686AC97State {
@@ -405,6 +406,16 @@ static TypeInfo via_mc97_info = {
.class_init = via_mc97_class_init,
};
+static const MemoryRegionOps smb_io_ops = {
+ .read = smb_ioport_readb,
+ .write = smb_ioport_writeb,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
/* vt82c686 pm init */
static int vt82c686b_pm_initfn(PCIDevice *dev)
{
@@ -424,8 +435,11 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
pci_conf[0x90] = s->smb_io_base | 1;
pci_conf[0x91] = s->smb_io_base >> 8;
pci_conf[0xd2] = 0x90;
- register_ioport_write(s->smb_io_base, 0xf, 1, smb_ioport_writeb, &s->smb);
- register_ioport_read(s->smb_io_base, 0xf, 1, smb_ioport_readb, &s->smb);
+
+ memory_region_init_io(&s->smb_io, &smb_io_ops, &s->smb, "vt82c686b-smb",
+ 0xf);
+ memory_region_add_subregion(pci_address_space_io(dev), s->smb_io_base,
+ &s->smb_io);
apm_init(dev, &s->apm, NULL, s);
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH V10 4/8] hw/acpi_piix4.c: replace register_ioport*
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
` (2 preceding siblings ...)
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 3/8] smb: replace_register_ioport* Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 5/8] hw/cirrus_vga.c: " Julien Grall
` (5 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This patch replaces all register_ioport* with the new memory API. It permits
to use the new Memory stuff like listener.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/acpi_piix4.c | 154 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 116 insertions(+), 38 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 0b4ad24..942943c 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -41,10 +41,10 @@
#define GPE_BASE 0xafe0
#define GPE_LEN 4
-#define PCI_UP_BASE 0xae00
-#define PCI_DOWN_BASE 0xae04
+#define PCI_BASE 0xae00
#define PCI_EJ_BASE 0xae08
#define PCI_RMV_BASE 0xae0c
+#define PM_BASE 0x00
#define PIIX4_PCI_HOTPLUG_STATUS 2
@@ -55,7 +55,7 @@ struct pci_status {
typedef struct PIIX4PMState {
PCIDevice dev;
- IORange ioport;
+ MemoryRegion pm_io;
ACPIREGS ar;
APMState apm;
@@ -64,6 +64,11 @@ typedef struct PIIX4PMState {
uint32_t smb_io_base;
MemoryRegion smb_io;
+ MemoryRegion acpi_io;
+ MemoryRegion acpi_hot_io;
+ PortioList pci_hot_port_list;
+ MemoryRegion pciej_hot_io;
+ MemoryRegion pcirmv_hot_io;
qemu_irq irq;
qemu_irq smi_irq;
@@ -110,10 +115,10 @@ static void pm_tmr_timer(ACPIREGS *ar)
pm_update_sci(s);
}
-static void pm_ioport_write(IORange *ioport, uint64_t addr, unsigned width,
- uint64_t val)
+static void pm_ioport_write(void *opaque, target_phys_addr_t addr,
+ uint64_t val, unsigned width)
{
- PIIX4PMState *s = container_of(ioport, PIIX4PMState, ioport);
+ PIIX4PMState *s = opaque;
if (width != 2) {
PIIX4_DPRINTF("PM write port=0x%04x width=%d val=0x%08x\n",
@@ -139,11 +144,11 @@ static void pm_ioport_write(IORange *ioport, uint64_t addr, unsigned width,
(unsigned int)val);
}
-static void pm_ioport_read(IORange *ioport, uint64_t addr, unsigned width,
- uint64_t *data)
+static uint64_t pm_ioport_read(void *opaque, target_phys_addr_t addr,
+ unsigned width)
{
- PIIX4PMState *s = container_of(ioport, PIIX4PMState, ioport);
- uint32_t val;
+ PIIX4PMState *s = opaque;
+ uint64_t val;
switch(addr) {
case 0x00:
@@ -163,12 +168,18 @@ static void pm_ioport_read(IORange *ioport, uint64_t addr, unsigned width,
break;
}
PIIX4_DPRINTF("PM readw port=0x%04x val=0x%04x\n", (unsigned int)addr, val);
- *data = val;
+
+ return val;
}
-static const IORangeOps pm_iorange_ops = {
+static const MemoryRegionOps pm_io_ops = {
.read = pm_ioport_read,
.write = pm_ioport_write,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 4,
+ },
};
static void apm_ctrl_changed(uint32_t val, void *arg)
@@ -185,7 +196,8 @@ static void apm_ctrl_changed(uint32_t val, void *arg)
}
}
-static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
+static void acpi_dbg_writel(void *opaque, target_phys_addr_t addr,
+ uint64_t val, unsigned size)
{
PIIX4_DPRINTF("ACPI: DBG: 0x%08x\n", val);
}
@@ -194,15 +206,15 @@ static void pm_io_space_update(PIIX4PMState *s)
{
uint32_t pm_io_base;
- if (s->dev.config[0x80] & 1) {
- pm_io_base = le32_to_cpu(*(uint32_t *)(s->dev.config + 0x40));
- pm_io_base &= 0xffc0;
+ pm_io_base = le32_to_cpu(*(uint32_t *)(s->dev.config + 0x40));
+ pm_io_base &= 0xffc0;
+ PIIX4_DPRINTF("PM: mapping ot 0x%x enabled = %d\n", pm_io_base,
+ s->dev.config[0x80] & 1);
- /* XXX: need to improve memory and ioport allocation */
- PIIX4_DPRINTF("PM: mapping to 0x%x\n", pm_io_base);
- iorange_init(&s->ioport, &pm_iorange_ops, pm_io_base, 64);
- ioport_register(&s->ioport);
- }
+ memory_region_transaction_begin();
+ memory_region_set_enabled(&s->pm_io, s->dev.config[0x80] & 1);
+ memory_region_set_address(&s->pm_io, pm_io_base);
+ memory_region_transaction_commit();
}
static void pm_write_config(PCIDevice *d,
@@ -395,6 +407,15 @@ static const MemoryRegionOps smb_io_ops = {
},
};
+static const MemoryRegionOps acpi_io_ops = {
+ .write = acpi_dbg_writel,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+};
+
static int piix4_pm_initfn(PCIDevice *dev)
{
PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, dev);
@@ -409,7 +430,9 @@ static int piix4_pm_initfn(PCIDevice *dev)
/* APM */
apm_init(dev, &s->apm, apm_ctrl_changed, s);
- register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
+ memory_region_init_io(&s->acpi_io, &acpi_io_ops, s, "piix4-acpi", 4);
+ memory_region_add_subregion(pci_address_space_io(dev), ACPI_DBG_IO_ADDR,
+ &s->acpi_io);
if (s->kvm_enabled) {
/* Mark SMM as already inited to prevent SMM from running. KVM does not
@@ -427,6 +450,12 @@ static int piix4_pm_initfn(PCIDevice *dev)
memory_region_add_subregion(pci_address_space_io(dev), s->smb_io_base,
&s->smb_io);
+ /* PM */
+ memory_region_init_io(&s->pm_io, &pm_io_ops, s, "piix4-pm", 64);
+ memory_region_set_enabled(&s->pm_io, false);
+ memory_region_add_subregion(pci_address_space_io(&s->dev),
+ PM_BASE, &s->pm_io);
+
acpi_pm_tmr_init(&s->ar, pm_tmr_timer);
acpi_gpe_init(&s->ar, GPE_LEN);
@@ -510,16 +539,17 @@ static void piix4_pm_register_types(void)
type_init(piix4_pm_register_types)
-static uint32_t gpe_readb(void *opaque, uint32_t addr)
+static uint64_t gpe_readb(void *opaque, target_phys_addr_t addr, unsigned size)
{
PIIX4PMState *s = opaque;
- uint32_t val = acpi_gpe_ioport_readb(&s->ar, addr);
+ uint64_t val = acpi_gpe_ioport_readb(&s->ar, addr);
PIIX4_DPRINTF("gpe read %x == %x\n", addr, val);
return val;
}
-static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val)
+static void gpe_writeb(void *opaque, target_phys_addr_t addr, uint64_t val,
+ unsigned size)
{
PIIX4PMState *s = opaque;
@@ -551,21 +581,24 @@ static uint32_t pci_down_read(void *opaque, uint32_t addr)
return val;
}
-static uint32_t pci_features_read(void *opaque, uint32_t addr)
+static uint64_t pci_features_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
/* No feature defined yet */
PIIX4_DPRINTF("pci_features_read %x\n", 0);
return 0;
}
-static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
+static void pciej_write(void *opaque, target_phys_addr_t addr, uint64_t val,
+ unsigned size)
{
acpi_piix_eject_slot(opaque, val);
PIIX4_DPRINTF("pciej write %x <== %d\n", addr, val);
}
-static uint32_t pcirmv_read(void *opaque, uint32_t addr)
+static uint64_t pcirmv_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
PIIX4PMState *s = opaque;
@@ -575,20 +608,65 @@ static uint32_t pcirmv_read(void *opaque, uint32_t addr)
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev,
PCIHotplugState state);
-static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
-{
+static const MemoryRegionOps acpi_hot_io_ops = {
+ .read = gpe_readb,
+ .write = gpe_writeb,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
- register_ioport_write(GPE_BASE, GPE_LEN, 1, gpe_writeb, s);
- register_ioport_read(GPE_BASE, GPE_LEN, 1, gpe_readb, s);
- acpi_gpe_blk(&s->ar, GPE_BASE);
+/* PCI hot plug registers */
+static const MemoryRegionPortio pci_hot_portio_list[] = {
+ { 0x00, 4, 4, .read = pci_up_read, }, /* 0xae00 */
+ { 0x04, 4, 4, .read = pci_down_read, }, /* 0xae04 */
+ PORTIO_END_OF_LIST(),
+};
- register_ioport_read(PCI_UP_BASE, 4, 4, pci_up_read, s);
- register_ioport_read(PCI_DOWN_BASE, 4, 4, pci_down_read, s);
+static const MemoryRegionOps pciej_hot_io_ops = {
+ .read = pci_features_read,
+ .write = pciej_write,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+};
+
+static const MemoryRegionOps pcirmv_hot_io_ops = {
+ .read = pcirmv_read,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+};
- register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, s);
- register_ioport_read(PCI_EJ_BASE, 4, 4, pci_features_read, s);
+static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
+{
- register_ioport_read(PCI_RMV_BASE, 4, 4, pcirmv_read, s);
+ memory_region_init_io(&s->acpi_hot_io, &acpi_hot_io_ops, s,
+ "piix4-acpi-hot", GPE_LEN);
+ memory_region_add_subregion(pci_address_space_io(&s->dev), GPE_BASE,
+ &s->acpi_hot_io);
+ acpi_gpe_blk(&s->ar, 0);
+
+ portio_list_init(&s->pci_hot_port_list, pci_hot_portio_list, s,
+ "piix4-pci-hot");
+ portio_list_add(&s->pci_hot_port_list, pci_address_space_io(&s->dev),
+ PCI_BASE);
+
+ memory_region_init_io(&s->pciej_hot_io, &pciej_hot_io_ops, s,
+ "piix4-pciej-hot", 4);
+ memory_region_add_subregion(pci_address_space_io(&s->dev), PCI_EJ_BASE,
+ &s->pciej_hot_io);
+
+ memory_region_init_io(&s->pcirmv_hot_io, &pcirmv_hot_io_ops, s,
+ "piix4-pcirmv-hot", 4);
+ memory_region_add_subregion(pci_address_space_io(&s->dev), PCI_RMV_BASE,
+ &s->pcirmv_hot_io);
pci_bus_hotplug(bus, piix4_device_hotplug, &s->dev.qdev);
}
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH V10 5/8] hw/cirrus_vga.c: replace register_ioport*
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
` (3 preceding siblings ...)
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 4/8] hw/acpi_piix4.c: replace register_ioport* Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 6/8] hw/serial.c: " Julien Grall
` (4 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This patch replaces all register_ioport* with portio_*. It permits to
use the new Memory stuff like listener.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/cirrus_vga.c | 48 ++++++++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 9a0a565..5905750 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -200,6 +200,7 @@ typedef void (*cirrus_fill_t)(struct CirrusVGAState *s,
typedef struct CirrusVGAState {
VGACommonState vga;
+ MemoryRegion cirrus_vga_io;
MemoryRegion cirrus_linear_io;
MemoryRegion cirrus_linear_bitblt_io;
MemoryRegion cirrus_mmio_io;
@@ -2435,13 +2436,15 @@ static void cirrus_update_memory_access(CirrusVGAState *s)
/* I/O ports */
-static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)
+static uint64_t cirrus_vga_ioport_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
CirrusVGAState *c = opaque;
VGACommonState *s = &c->vga;
int val, index;
qemu_flush_coalesced_mmio_buffer();
+ addr += 0x3b0;
if (vga_ioport_invalid(s, addr)) {
val = 0xff;
@@ -2530,13 +2533,15 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)
return val;
}
-static void cirrus_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
+static void cirrus_vga_ioport_write(void *opaque, target_phys_addr_t addr,
+ uint64_t val, unsigned size)
{
CirrusVGAState *c = opaque;
VGACommonState *s = &c->vga;
int index;
qemu_flush_coalesced_mmio_buffer();
+ addr += 0x3b0;
/* check port range access depending on color/monochrome mode */
if (vga_ioport_invalid(s, addr)) {
@@ -2649,7 +2654,7 @@ static uint64_t cirrus_mmio_read(void *opaque, target_phys_addr_t addr,
if (addr >= 0x100) {
return cirrus_mmio_blt_read(s, addr - 0x100);
} else {
- return cirrus_vga_ioport_read(s, addr + 0x3c0);
+ return cirrus_vga_ioport_read(s, addr + 0x10, size);
}
}
@@ -2661,7 +2666,7 @@ static void cirrus_mmio_write(void *opaque, target_phys_addr_t addr,
if (addr >= 0x100) {
cirrus_mmio_blt_write(s, addr - 0x100, val);
} else {
- cirrus_vga_ioport_write(s, addr + 0x3c0, val);
+ cirrus_vga_ioport_write(s, addr + 0x10, val, size);
}
}
@@ -2787,8 +2792,19 @@ static const MemoryRegionOps cirrus_linear_io_ops = {
},
};
+static const MemoryRegionOps cirrus_vga_io_ops = {
+ .read = cirrus_vga_ioport_read,
+ .write = cirrus_vga_ioport_write,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci,
- MemoryRegion *system_memory)
+ MemoryRegion *system_memory,
+ MemoryRegion *system_io)
{
int i;
static int inited;
@@ -2820,19 +2836,10 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci,
s->bustype = CIRRUS_BUSTYPE_ISA;
}
- register_ioport_write(0x3c0, 16, 1, cirrus_vga_ioport_write, s);
-
- register_ioport_write(0x3b4, 2, 1, cirrus_vga_ioport_write, s);
- register_ioport_write(0x3d4, 2, 1, cirrus_vga_ioport_write, s);
- register_ioport_write(0x3ba, 1, 1, cirrus_vga_ioport_write, s);
- register_ioport_write(0x3da, 1, 1, cirrus_vga_ioport_write, s);
-
- register_ioport_read(0x3c0, 16, 1, cirrus_vga_ioport_read, s);
-
- register_ioport_read(0x3b4, 2, 1, cirrus_vga_ioport_read, s);
- register_ioport_read(0x3d4, 2, 1, cirrus_vga_ioport_read, s);
- register_ioport_read(0x3ba, 1, 1, cirrus_vga_ioport_read, s);
- register_ioport_read(0x3da, 1, 1, cirrus_vga_ioport_read, s);
+ /* Register ioport 0x3b0 - 0x3df */
+ memory_region_init_io(&s->cirrus_vga_io, &cirrus_vga_io_ops, s,
+ "cirrus-io", 0x30);
+ memory_region_add_subregion(system_io, 0x3b0, &s->cirrus_vga_io);
memory_region_init(&s->low_mem_container,
"cirrus-lowmem-container",
@@ -2903,7 +2910,7 @@ static int vga_initfn(ISADevice *dev)
s->vram_size_mb = VGA_RAM_SIZE >> 20;
vga_common_init(s);
cirrus_init_common(&d->cirrus_vga, CIRRUS_ID_CLGD5430, 0,
- isa_address_space(dev));
+ isa_address_space(dev), isa_address_space_io(dev));
s->ds = graphic_console_init(s->update, s->invalidate,
s->screen_dump, s->text_update,
s);
@@ -2945,7 +2952,8 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
/* setup VGA */
s->vga.vram_size_mb = VGA_RAM_SIZE >> 20;
vga_common_init(&s->vga);
- cirrus_init_common(s, device_id, 1, pci_address_space(dev));
+ cirrus_init_common(s, device_id, 1, pci_address_space(dev),
+ pci_address_space_io(dev));
s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate,
s->vga.screen_dump, s->vga.text_update,
&s->vga);
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH V10 6/8] hw/serial.c: replace register_ioport*
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
` (4 preceding siblings ...)
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 5/8] hw/cirrus_vga.c: " Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 7/8] hw/pc.c: " Julien Grall
` (3 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This patch replaces all register_ioport* with a MemoryRegion. It permits to
use the new Memory stuff like listener.
For more flexibility, the IO address space is passed as an argument.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/mips_mipssim.c | 3 ++-
hw/pc.h | 2 +-
hw/serial.c | 8 +++++---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/mips_mipssim.c b/hw/mips_mipssim.c
index 830f635..a204ab1 100644
--- a/hw/mips_mipssim.c
+++ b/hw/mips_mipssim.c
@@ -215,7 +215,8 @@ mips_mipssim_init (ram_addr_t ram_size,
/* A single 16450 sits at offset 0x3f8. It is attached to
MIPS CPU INT2, which is interrupt 4. */
if (serial_hds[0])
- serial_init(0x3f8, env->irq[4], 115200, serial_hds[0]);
+ serial_init(0x3f8, env->irq[4], 115200, serial_hds[0],
+ get_system_io());
if (nd_table[0].used)
/* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */
diff --git a/hw/pc.h b/hw/pc.h
index e4db071..f2b7af5 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -15,7 +15,7 @@
/* serial.c */
SerialState *serial_init(int base, qemu_irq irq, int baudbase,
- CharDriverState *chr);
+ CharDriverState *chr, MemoryRegion *system_io);
SerialState *serial_mm_init(MemoryRegion *address_space,
target_phys_addr_t base, int it_shift,
qemu_irq irq, int baudbase,
diff --git a/hw/serial.c b/hw/serial.c
index a421d1e..4ed20c0 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -28,6 +28,7 @@
#include "pc.h"
#include "qemu-timer.h"
#include "sysemu.h"
+#include "exec-memory.h"
//#define DEBUG_SERIAL
@@ -810,7 +811,7 @@ static const VMStateDescription vmstate_isa_serial = {
};
SerialState *serial_init(int base, qemu_irq irq, int baudbase,
- CharDriverState *chr)
+ CharDriverState *chr, MemoryRegion *system_io)
{
SerialState *s;
@@ -823,8 +824,9 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,
vmstate_register(NULL, base, &vmstate_serial, s);
- register_ioport_write(base, 8, 1, serial_ioport_write, s);
- register_ioport_read(base, 8, 1, serial_ioport_read, s);
+ memory_region_init_io(&s->io, &serial_io_ops, s, "serial", 8);
+ memory_region_add_subregion(system_io, base, &s->io);
+
return s;
}
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH V10 7/8] hw/pc.c: replace register_ioport*
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
` (5 preceding siblings ...)
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 6/8] hw/serial.c: " Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 8/8] hw/dma.c: " Julien Grall
` (2 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This patch replaces all register_ioport* with portio_* or
isa_register_portio_list. It permits to use the new Memory
stuff like listener.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/pc.c | 49 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 7e7e0e2..ef2e617 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -101,7 +101,8 @@ void gsi_handler(void *opaque, int n, int level)
qemu_set_irq(s->ioapic_irq[n], level);
}
-static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
+static void ioport80_write(void *opaque, target_phys_addr_t addr,
+ uint64_t data, unsigned size)
{
}
@@ -119,7 +120,8 @@ void cpu_set_ferr(CPUX86State *s)
qemu_irq_raise(ferr_irq);
}
-static void ioportF0_write(void *opaque, uint32_t addr, uint32_t data)
+static void ioportF0_write(void *opaque, target_phys_addr_t addr,
+ uint64_t data, unsigned size)
{
qemu_irq_lower(ferr_irq);
}
@@ -567,6 +569,14 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
return index;
}
+static const MemoryRegionPortio bochs_bios_portio_list[] = {
+ { 0x500, 1, 1, .write = bochs_bios_write, }, /* 0x500 */
+ { 0x501, 1, 1, .write = bochs_bios_write, }, /* 0x501 */
+ { 0x501, 2, 2, .write = bochs_bios_write, }, /* 0x501 */
+ { 0x8900, 1, 1, .write = bochs_bios_write, }, /* 0x8900 */
+ PORTIO_END_OF_LIST(),
+};
+
static void *bochs_bios_init(void)
{
void *fw_cfg;
@@ -574,12 +584,11 @@ static void *bochs_bios_init(void)
size_t smbios_len;
uint64_t *numa_fw_cfg;
int i, j;
+ PortioList *bochs_bios_port_list = g_new(PortioList, 1);
- register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL);
-
- register_ioport_write(0x501, 1, 1, bochs_bios_write, NULL);
- register_ioport_write(0x501, 1, 2, bochs_bios_write, NULL);
- register_ioport_write(0x502, 1, 2, bochs_bios_write, NULL);
+ portio_list_init(bochs_bios_port_list, bochs_bios_portio_list,
+ NULL, "bochs-bios");
+ portio_list_add(bochs_bios_port_list, get_system_io(), 0x0);
fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
@@ -1032,6 +1041,24 @@ static void cpu_request_exit(void *opaque, int irq, int level)
}
}
+static const MemoryRegionOps ioport80_io_ops = {
+ .write = ioport80_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
+static const MemoryRegionOps ioportF0_io_ops = {
+ .write = ioportF0_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
ISADevice **rtc_state,
ISADevice **floppy,
@@ -1046,10 +1073,14 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
qemu_irq *a20_line;
ISADevice *i8042, *port92, *vmmouse, *pit = NULL;
qemu_irq *cpu_exit_irq;
+ MemoryRegion *ioport80_io = g_new(MemoryRegion, 1);
+ MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
- register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
+ memory_region_init_io(ioport80_io, &ioport80_io_ops, NULL, "ioport80", 1);
+ memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
- register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
+ memory_region_init_io(ioportF0_io, &ioportF0_io_ops, NULL, "ioportF0", 1);
+ memory_region_add_subregion(isa_bus->address_space_io, 0xf0, ioportF0_io);
/*
* Check if an HPET shall be created.
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH V10 8/8] hw/dma.c: replace register_ioport*
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
` (6 preceding siblings ...)
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 7/8] hw/pc.c: " Julien Grall
@ 2012-09-19 11:50 ` Julien Grall
2012-10-08 16:53 ` [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
2012-11-25 9:10 ` Avi Kivity
9 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-09-19 11:50 UTC (permalink / raw)
To: jan.kiszka, avi
Cc: Julien Grall, Stefano.Stabellini, qemu-devel, afaerber, kraxel
This patch replaces all register_ioport* be the new memory API functions.
It permits to use the new Memory stuff like listener.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
hw/dma.c | 108 +++++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 72 insertions(+), 36 deletions(-)
diff --git a/hw/dma.c b/hw/dma.c
index 0a9322d..00a6acb 100644
--- a/hw/dma.c
+++ b/hw/dma.c
@@ -58,6 +58,8 @@ static struct dma_cont {
int dshift;
struct dma_regs regs[4];
qemu_irq *cpu_request_exit;
+ MemoryRegion channel_io;
+ MemoryRegion cont_io;
} dma_controllers[2];
enum {
@@ -149,7 +151,8 @@ static inline int getff (struct dma_cont *d)
return ff;
}
-static uint32_t read_chan (void *opaque, uint32_t nport)
+static uint64_t read_chan(void *opaque, target_phys_addr_t nport,
+ unsigned size)
{
struct dma_cont *d = opaque;
int ichan, nreg, iport, ff, val, dir;
@@ -171,7 +174,8 @@ static uint32_t read_chan (void *opaque, uint32_t nport)
return (val >> (d->dshift + (ff << 3))) & 0xff;
}
-static void write_chan (void *opaque, uint32_t nport, uint32_t data)
+static void write_chan(void *opaque, target_phys_addr_t nport, uint64_t data,
+ unsigned size)
{
struct dma_cont *d = opaque;
int iport, ichan, nreg;
@@ -189,22 +193,23 @@ static void write_chan (void *opaque, uint32_t nport, uint32_t data)
}
}
-static void write_cont (void *opaque, uint32_t nport, uint32_t data)
+static void write_cont(void *opaque, target_phys_addr_t nport, uint64_t data,
+ unsigned size)
{
struct dma_cont *d = opaque;
int iport, ichan = 0;
iport = (nport >> d->dshift) & 0x0f;
switch (iport) {
- case 0x08: /* command */
+ case 0x01: /* command */
if ((data != 0) && (data & CMD_NOT_SUPPORTED)) {
- dolog ("command %#x not supported\n", data);
+ dolog("command %"PRIx64" not supported\n", data);
return;
}
d->command = data;
break;
- case 0x09:
+ case 0x02:
ichan = data & 3;
if (data & 4) {
d->status |= 1 << (ichan + 4);
@@ -216,7 +221,7 @@ static void write_cont (void *opaque, uint32_t nport, uint32_t data)
DMA_run();
break;
- case 0x0a: /* single mask */
+ case 0x03: /* single mask */
if (data & 4)
d->mask |= 1 << (data & 3);
else
@@ -224,7 +229,7 @@ static void write_cont (void *opaque, uint32_t nport, uint32_t data)
DMA_run();
break;
- case 0x0b: /* mode */
+ case 0x04: /* mode */
{
ichan = data & 3;
#ifdef DEBUG_DMA
@@ -243,23 +248,23 @@ static void write_cont (void *opaque, uint32_t nport, uint32_t data)
break;
}
- case 0x0c: /* clear flip flop */
+ case 0x05: /* clear flip flop */
d->flip_flop = 0;
break;
- case 0x0d: /* reset */
+ case 0x06: /* reset */
d->flip_flop = 0;
d->mask = ~0;
d->status = 0;
d->command = 0;
break;
- case 0x0e: /* clear mask for all channels */
+ case 0x07: /* clear mask for all channels */
d->mask = 0;
DMA_run();
break;
- case 0x0f: /* write mask for all channels */
+ case 0x08: /* write mask for all channels */
d->mask = data;
DMA_run();
break;
@@ -277,7 +282,8 @@ static void write_cont (void *opaque, uint32_t nport, uint32_t data)
#endif
}
-static uint32_t read_cont (void *opaque, uint32_t nport)
+static uint64_t read_cont(void *opaque, target_phys_addr_t nport,
+ unsigned size)
{
struct dma_cont *d = opaque;
int iport, val;
@@ -463,7 +469,7 @@ void DMA_schedule(int nchan)
static void dma_reset(void *opaque)
{
struct dma_cont *d = opaque;
- write_cont (d, (0x0d << d->dshift), 0);
+ write_cont(d, (0x06 << d->dshift), 0, 1);
}
static int dma_phony_handler (void *opaque, int nchan, int dma_pos, int dma_len)
@@ -473,38 +479,68 @@ static int dma_phony_handler (void *opaque, int nchan, int dma_pos, int dma_len)
return dma_pos;
}
+
+static const MemoryRegionOps channel_io_ops = {
+ .read = read_chan,
+ .write = write_chan,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
+/* IOport from page_base */
+static const MemoryRegionPortio page_portio_list[] = {
+ { 0x01, 3, 1, .write = write_page, .read = read_page, },
+ { 0x07, 1, 1, .write = write_page, .read = read_page, },
+ PORTIO_END_OF_LIST(),
+};
+
+/* IOport from pageh_base */
+static const MemoryRegionPortio pageh_portio_list[] = {
+ { 0x01, 3, 1, .write = write_pageh, .read = read_pageh, },
+ { 0x07, 3, 1, .write = write_pageh, .read = read_pageh, },
+ PORTIO_END_OF_LIST(),
+};
+
+static const MemoryRegionOps cont_io_ops = {
+ .read = read_cont,
+ .write = write_cont,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
/* dshift = 0: 8 bit DMA, 1 = 16 bit DMA */
static void dma_init2(struct dma_cont *d, int base, int dshift,
int page_base, int pageh_base,
qemu_irq *cpu_request_exit)
{
- static const int page_port_list[] = { 0x1, 0x2, 0x3, 0x7 };
int i;
d->dshift = dshift;
d->cpu_request_exit = cpu_request_exit;
- for (i = 0; i < 8; i++) {
- register_ioport_write (base + (i << dshift), 1, 1, write_chan, d);
- register_ioport_read (base + (i << dshift), 1, 1, read_chan, d);
- }
- for (i = 0; i < ARRAY_SIZE (page_port_list); i++) {
- register_ioport_write (page_base + page_port_list[i], 1, 1,
- write_page, d);
- register_ioport_read (page_base + page_port_list[i], 1, 1,
- read_page, d);
- if (pageh_base >= 0) {
- register_ioport_write (pageh_base + page_port_list[i], 1, 1,
- write_pageh, d);
- register_ioport_read (pageh_base + page_port_list[i], 1, 1,
- read_pageh, d);
- }
- }
- for (i = 0; i < 8; i++) {
- register_ioport_write (base + ((i + 8) << dshift), 1, 1,
- write_cont, d);
- register_ioport_read (base + ((i + 8) << dshift), 1, 1,
- read_cont, d);
+
+ memory_region_init_io(&d->channel_io, &channel_io_ops, d,
+ "dma-chan", 8 << d->dshift);
+ memory_region_add_subregion(isa_address_space_io(NULL),
+ base, &d->channel_io);
+
+ isa_register_portio_list(NULL, page_base, page_portio_list, d,
+ "dma-page");
+ if (pageh_base >= 0) {
+ isa_register_portio_list(NULL, pageh_base, pageh_portio_list, d,
+ "dma-pageh");
}
+
+ memory_region_init_io(&d->cont_io, &cont_io_ops, d, "dma-cont",
+ 8 << d->dshift);
+ memory_region_add_subregion(isa_address_space_io(NULL),
+ base + (8 << d->dshift), &d->cont_io);
+
qemu_register_reset(dma_reset, d);
dma_reset(d);
for (i = 0; i < ARRAY_SIZE (d->regs); ++i) {
--
Julien Grall
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
` (7 preceding siblings ...)
2012-09-19 11:50 ` [Qemu-devel] [PATCH V10 8/8] hw/dma.c: " Julien Grall
@ 2012-10-08 16:53 ` Julien Grall
2012-11-24 1:09 ` Julien Grall
2012-11-25 9:10 ` Avi Kivity
9 siblings, 1 reply; 27+ messages in thread
From: Julien Grall @ 2012-10-08 16:53 UTC (permalink / raw)
To: jan.kiszka@siemens.com, avi@redhat.com
Cc: Julien Grall, Stefano Stabellini, qemu-devel@nongnu.org,
afaerber@suse.de, kraxel@redhat.com
On 09/19/2012 12:50 PM, Julien Grall wrote:
> This is the tenth version of patch series about ioport registration.
>
> Some part of QEMU still use register_ioport* functions to register ioport.
> These functions doesn't allow to use Memory Listener on it.
>
> Modifications between V1 and V2:
> - Remove the use of get_system_io. Instead of use isa and pci IO
> address space;
> - Avoid allocation of PortioList. Use the different device
> structure;
> - Still remove register_ioport* (hw/dma.c, hw/apm.c, hw/acpi_piix4.c);
> - Use MemoryRegion when we have only a range of ioport;
> - For some functions, add IO address space as argument;
> - Add isa_address_space_io function.
>
> Modifications between V2 and V3:
> - Remove some register_ioport_* on hw/vt82c686.c;
> - Split smb ioport part in new patch;
> - Still replace MemoryRegion when we have only a range of ioport;
> - Fix read/write ioports prototype to be compliant with memory callback.
>
> Modifications between V3 and V4:
> - Fix compilation in hw/dma.c;
> - Fix address conversion (hw/dma.c, hw/acpi_piix4.c) with MemorySection.
> Indeed the new version use offset from MemorySection start instead of 0.
>
> Modifications between V4 and V5:
> - Rebase on qemu upstream;
> - Forget some ioport_register_* in acpi_piix4.c;
> - Register 0x3b0 - 0x3df range for cirrus instead of ioport by ioport.
>
> Modifications between V5 and V6:
> - Add read function on cirrus ioport (forget on the previous patch);
> - Rework PM memory range handling;
> - Fix PCI_BASE in acpi_piix4.c (wrong conversion during port);
> - Rewrite isa_address_space_io to use ISA bus address space;
> - Fix compilation in vt82c686.c.
>
> Modifications between V6 and V7:
> - acpi_piix4: use memory_region_set_enabled instead of a boolean. I'm not
> sure about this modification (adviced by Avi);
> - Fix device endianness in acpi_piix4 (reported by Avi);
> - Avoid dependencies between patches and reorder it (reported by Jan).
> Some code moved from acpi_piix4 patch to smb/apm patches;
>
> Modifications between V7 and V8:
> - Fix device endianness in smb patch, I forgot some on previous version;
> - Register pm io region at initialization with default value instead
> of at first call to pm_io_space_update (reported by Jan).
>
> Modifications between V8 and V9:
> - Fix size constraint in pm_io_ops (reported by Jan).
>
> Modifications between V9 and V10:
> - Fix compile error with format string in hw/dma.c;
> - Rebase on master as hw/pc.c and hw/cirrus_vga.c was modified.
>
> Julien Grall (8):
> isa: add isa_address_space_io
> hw/apm.c: replace register_ioport*
> smb: replace_register_ioport*
> hw/acpi_piix4.c: replace register_ioport*
> hw/cirrus_vga.c: replace register_ioport*
> hw/serial.c: replace register_ioport*
> hw/pc.c: replace register_ioport*
> hw/dma.c: replace register_ioport*
>
> hw/acpi_piix4.c | 174 ++++++++++++++++++++++++++++++++++++++++-------------
> hw/apm.c | 24 ++++++--
> hw/apm.h | 5 +-
> hw/cirrus_vga.c | 48 +++++++++------
> hw/dma.c | 108 ++++++++++++++++++++++-----------
> hw/isa-bus.c | 9 +++
> hw/isa.h | 1 +
> hw/mips_mipssim.c | 3 +-
> hw/pc.c | 49 ++++++++++++---
> hw/pc.h | 2 +-
> hw/pm_smbus.c | 7 +-
> hw/pm_smbus.h | 6 +-
> hw/serial.c | 8 ++-
> hw/vt82c686.c | 20 +++++-
> 14 files changed, 339 insertions(+), 125 deletions(-)
>
Hello,
Is there any plan to apply this patch series in QEMU upstream?
Sincerely yours,
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-10-08 16:53 ` [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
@ 2012-11-24 1:09 ` Julien Grall
2012-11-25 9:10 ` Avi Kivity
0 siblings, 1 reply; 27+ messages in thread
From: Julien Grall @ 2012-11-24 1:09 UTC (permalink / raw)
To: avi, kraxel
Cc: Julien Grall, jan.kiszka@siemens.com, qemu-devel@nongnu.org,
afaerber@suse.de, Stefano Stabellini
[-- Attachment #1: Type: text/plain, Size: 3985 bytes --]
ping ?
On Mon, Oct 8, 2012 at 5:53 PM, Julien Grall <julien.grall@citrix.com>wrote:
> On 09/19/2012 12:50 PM, Julien Grall wrote:
>
> > This is the tenth version of patch series about ioport registration.
> >
> > Some part of QEMU still use register_ioport* functions to register
> ioport.
> > These functions doesn't allow to use Memory Listener on it.
> >
> > Modifications between V1 and V2:
> > - Remove the use of get_system_io. Instead of use isa and pci IO
> > address space;
> > - Avoid allocation of PortioList. Use the different device
> > structure;
> > - Still remove register_ioport* (hw/dma.c, hw/apm.c, hw/acpi_piix4.c);
> > - Use MemoryRegion when we have only a range of ioport;
> > - For some functions, add IO address space as argument;
> > - Add isa_address_space_io function.
> >
> > Modifications between V2 and V3:
> > - Remove some register_ioport_* on hw/vt82c686.c;
> > - Split smb ioport part in new patch;
> > - Still replace MemoryRegion when we have only a range of ioport;
> > - Fix read/write ioports prototype to be compliant with memory
> callback.
> >
> > Modifications between V3 and V4:
> > - Fix compilation in hw/dma.c;
> > - Fix address conversion (hw/dma.c, hw/acpi_piix4.c) with
> MemorySection.
> > Indeed the new version use offset from MemorySection start instead
> of 0.
> >
> > Modifications between V4 and V5:
> > - Rebase on qemu upstream;
> > - Forget some ioport_register_* in acpi_piix4.c;
> > - Register 0x3b0 - 0x3df range for cirrus instead of ioport by ioport.
> >
> > Modifications between V5 and V6:
> > - Add read function on cirrus ioport (forget on the previous patch);
> > - Rework PM memory range handling;
> > - Fix PCI_BASE in acpi_piix4.c (wrong conversion during port);
> > - Rewrite isa_address_space_io to use ISA bus address space;
> > - Fix compilation in vt82c686.c.
> >
> > Modifications between V6 and V7:
> > - acpi_piix4: use memory_region_set_enabled instead of a boolean. I'm
> not
> > sure about this modification (adviced by Avi);
> > - Fix device endianness in acpi_piix4 (reported by Avi);
> > - Avoid dependencies between patches and reorder it (reported by Jan).
> > Some code moved from acpi_piix4 patch to smb/apm patches;
> >
> > Modifications between V7 and V8:
> > - Fix device endianness in smb patch, I forgot some on previous
> version;
> > - Register pm io region at initialization with default value instead
> > of at first call to pm_io_space_update (reported by Jan).
> >
> > Modifications between V8 and V9:
> > - Fix size constraint in pm_io_ops (reported by Jan).
> >
> > Modifications between V9 and V10:
> > - Fix compile error with format string in hw/dma.c;
> > - Rebase on master as hw/pc.c and hw/cirrus_vga.c was modified.
> >
> > Julien Grall (8):
> > isa: add isa_address_space_io
> > hw/apm.c: replace register_ioport*
> > smb: replace_register_ioport*
> > hw/acpi_piix4.c: replace register_ioport*
> > hw/cirrus_vga.c: replace register_ioport*
> > hw/serial.c: replace register_ioport*
> > hw/pc.c: replace register_ioport*
> > hw/dma.c: replace register_ioport*
> >
> > hw/acpi_piix4.c | 174
> ++++++++++++++++++++++++++++++++++++++++-------------
> > hw/apm.c | 24 ++++++--
> > hw/apm.h | 5 +-
> > hw/cirrus_vga.c | 48 +++++++++------
> > hw/dma.c | 108 ++++++++++++++++++++++-----------
> > hw/isa-bus.c | 9 +++
> > hw/isa.h | 1 +
> > hw/mips_mipssim.c | 3 +-
> > hw/pc.c | 49 ++++++++++++---
> > hw/pc.h | 2 +-
> > hw/pm_smbus.c | 7 +-
> > hw/pm_smbus.h | 6 +-
> > hw/serial.c | 8 ++-
> > hw/vt82c686.c | 20 +++++-
> > 14 files changed, 339 insertions(+), 125 deletions(-)
> >
>
>
> Hello,
>
> Is there any plan to apply this patch series in QEMU upstream?
>
> Sincerely yours,
>
>
>
>
--
Grall Julien
[-- Attachment #2: Type: text/html, Size: 5053 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-09-19 11:50 [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
` (8 preceding siblings ...)
2012-10-08 16:53 ` [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration Julien Grall
@ 2012-11-25 9:10 ` Avi Kivity
2012-11-25 12:42 ` Andreas Färber
2012-11-25 15:01 ` Andreas Färber
9 siblings, 2 replies; 27+ messages in thread
From: Avi Kivity @ 2012-11-25 9:10 UTC (permalink / raw)
To: Julien Grall
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, kraxel,
Anthony Liguori, afaerber
On 09/19/2012 02:50 PM, Julien Grall wrote:
> This is the tenth version of patch series about ioport registration.
>
> Some part of QEMU still use register_ioport* functions to register ioport.
> These functions doesn't allow to use Memory Listener on it.
Acked-by: Avi Kivity <avi@redhat.com>
Unfortunately, I no longer have the time to maintain the memory patches.
Anthony, please apply directly.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-25 9:10 ` Avi Kivity
@ 2012-11-25 12:42 ` Andreas Färber
2012-11-25 12:44 ` Avi Kivity
2012-11-25 15:01 ` Andreas Färber
1 sibling, 1 reply; 27+ messages in thread
From: Andreas Färber @ 2012-11-25 12:42 UTC (permalink / raw)
To: Avi Kivity
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, Julien Grall, kraxel,
Anthony Liguori
Am 25.11.2012 10:10, schrieb Avi Kivity:
> On 09/19/2012 02:50 PM, Julien Grall wrote:
>> This is the tenth version of patch series about ioport registration.
>>
>> Some part of QEMU still use register_ioport* functions to register ioport.
>> These functions doesn't allow to use Memory Listener on it.
>
> Acked-by: Avi Kivity <avi@redhat.com>
>
> Unfortunately, I no longer have the time to maintain the memory patches.
> Anthony, please apply directly.
Are they for 1.3? If not, I can offer to handle them since I have an
upcoming qdev/QOM series that I would have to rebase on this.
Good luck with your new project, Avi!
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-25 12:42 ` Andreas Färber
@ 2012-11-25 12:44 ` Avi Kivity
0 siblings, 0 replies; 27+ messages in thread
From: Avi Kivity @ 2012-11-25 12:44 UTC (permalink / raw)
To: Andreas Färber
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, Julien Grall, kraxel,
Anthony Liguori
On 11/25/2012 02:42 PM, Andreas Färber wrote:
> Am 25.11.2012 10:10, schrieb Avi Kivity:
>> On 09/19/2012 02:50 PM, Julien Grall wrote:
>>> This is the tenth version of patch series about ioport registration.
>>>
>>> Some part of QEMU still use register_ioport* functions to register ioport.
>>> These functions doesn't allow to use Memory Listener on it.
>>
>> Acked-by: Avi Kivity <avi@redhat.com>
>>
>> Unfortunately, I no longer have the time to maintain the memory patches.
>> Anthony, please apply directly.
>
> Are they for 1.3?
They are not.
> If not, I can offer to handle them since I have an
> upcoming qdev/QOM series that I would have to rebase on this.
>
Great, thanks.
> Good luck with your new project, Avi!
Thanks for that as well!
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-25 9:10 ` Avi Kivity
2012-11-25 12:42 ` Andreas Färber
@ 2012-11-25 15:01 ` Andreas Färber
2012-11-25 15:40 ` Avi Kivity
` (2 more replies)
1 sibling, 3 replies; 27+ messages in thread
From: Andreas Färber @ 2012-11-25 15:01 UTC (permalink / raw)
To: Julien Grall
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, kraxel,
Anthony Liguori, Avi Kivity
Am 25.11.2012 10:10, schrieb Avi Kivity:
> On 09/19/2012 02:50 PM, Julien Grall wrote:
>> This is the tenth version of patch series about ioport registration.
>>
>> Some part of QEMU still use register_ioport* functions to register ioport.
>> These functions doesn't allow to use Memory Listener on it.
>
> Acked-by: Avi Kivity <avi@redhat.com>
Thanks, queued for the v1.4 merge window:
https://github.com/afaerber/qemu-cpu/commits/memory-ioport
Julien: When pinging a patch series, please make sure it actually still
applies. This needed to be rebased both onto the target_phys_addr_t ->
hwaddr change and onto the serial file split and cirrus-vga didn't apply
cleanly. Fixed that myself now.
I also massaged the commit messages a bit; if a native English speaker
wants to take a second look that would be appreciated (AFAIK "replaced
by Julien with Memory API").
Note that there are still some register_ioport_*() usages left:
$ git grep register_ioport -- hw/ | grep -v isa_register_ioport | wc --lines
32
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-25 15:01 ` Andreas Färber
@ 2012-11-25 15:40 ` Avi Kivity
2012-11-25 16:00 ` Jan Kiszka
2012-11-25 22:33 ` Julien Grall
2012-11-26 14:25 ` Gerd Hoffmann
2 siblings, 1 reply; 27+ messages in thread
From: Avi Kivity @ 2012-11-25 15:40 UTC (permalink / raw)
To: Andreas Färber
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, Julien Grall, kraxel,
Anthony Liguori
On 11/25/2012 05:01 PM, Andreas Färber wrote:
>
> Note that there are still some register_ioport_*() usages left:
> $ git grep register_ioport -- hw/ | grep -v isa_register_ioport | wc --lines
> 32
>
For the record, my plan for when that number drops to zero was to use
address_space_rw() (or friends) directly from the ioport helpers or kvm
code. There should not be an address_space_io for non-x86; the I/O
address space would be just a memory region under a bridge somewhere.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-25 15:40 ` Avi Kivity
@ 2012-11-25 16:00 ` Jan Kiszka
0 siblings, 0 replies; 27+ messages in thread
From: Jan Kiszka @ 2012-11-25 16:00 UTC (permalink / raw)
To: Avi Kivity
Cc: Stefano.Stabellini, qemu-devel, Julien Grall, kraxel,
Anthony Liguori, Andreas Färber
[-- Attachment #1: Type: text/plain, Size: 735 bytes --]
On 2012-11-25 16:40, Avi Kivity wrote:
> On 11/25/2012 05:01 PM, Andreas Färber wrote:
>>
>> Note that there are still some register_ioport_*() usages left:
>> $ git grep register_ioport -- hw/ | grep -v isa_register_ioport | wc --lines
>> 32
>>
>
> For the record, my plan for when that number drops to zero was to use
> address_space_rw() (or friends) directly from the ioport helpers or kvm
> code. There should not be an address_space_io for non-x86; the I/O
> address space would be just a memory region under a bridge somewhere.
I have patches to reach that zero line. Needs rebasing, and I will have
to rework the dispatching alternative I once wrote in the absence of
address spaces. Post 1.4 work.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-25 15:01 ` Andreas Färber
2012-11-25 15:40 ` Avi Kivity
@ 2012-11-25 22:33 ` Julien Grall
2012-11-26 14:25 ` Gerd Hoffmann
2 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-11-25 22:33 UTC (permalink / raw)
To: Andreas Färber
Cc: Stefano Stabellini, jan.kiszka@siemens.com, qemu-devel@nongnu.org,
Julien Grall, Gerd Hoffmann, Anthony Liguori, Avi Kivity
[-- Attachment #1: Type: text/plain, Size: 788 bytes --]
On Sun, Nov 25, 2012 at 3:01 PM, Andreas Färber <afaerber@suse.de> wrote:
> Thanks, queued for the v1.4 merge window:
> https://github.com/afaerber/qemu-cpu/commits/memory-ioport
>
> Julien: When pinging a patch series, please make sure it actually still
> applies. This needed to be rebased both onto the target_phys_addr_t ->
> hwaddr change and onto the serial file split and cirrus-vga didn't apply
> cleanly. Fixed that myself now.
>
> I also massaged the commit messages a bit; if a native English speaker
> wants to take a second look that would be appreciated (AFAIK "replaced
> by Julien with Memory API").
Thanks for the modifications. Next time I will pay attention to rebase my
patch
on the lastest qemu version.
Sincerely yours,
--
Grall Julien
[-- Attachment #2: Type: text/html, Size: 1335 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-25 15:01 ` Andreas Färber
2012-11-25 15:40 ` Avi Kivity
2012-11-25 22:33 ` Julien Grall
@ 2012-11-26 14:25 ` Gerd Hoffmann
2012-11-27 1:14 ` Andreas Färber
2 siblings, 1 reply; 27+ messages in thread
From: Gerd Hoffmann @ 2012-11-26 14:25 UTC (permalink / raw)
To: Andreas Färber
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, Julien Grall,
Avi Kivity, Anthony Liguori
On 11/25/12 16:01, Andreas Färber wrote:
> Am 25.11.2012 10:10, schrieb Avi Kivity:
>> On 09/19/2012 02:50 PM, Julien Grall wrote:
>>> This is the tenth version of patch series about ioport registration.
>>>
>>> Some part of QEMU still use register_ioport* functions to register ioport.
>>> These functions doesn't allow to use Memory Listener on it.
>>
>> Acked-by: Avi Kivity <avi@redhat.com>
>
> Thanks, queued for the v1.4 merge window:
> https://github.com/afaerber/qemu-cpu/commits/memory-ioport
I'd like to veto the acpi/smbus bits of this series. I've waded through
that last week from q35 point of view. Alot of the memory region stuff
can be moved to acpi.c, and then easily be shared between piix4,
vt82c686 and the upcoming ich9. See the "acpi: switch to memory api"
patch series posted last friday.
cheers.
Gerd
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-26 14:25 ` Gerd Hoffmann
@ 2012-11-27 1:14 ` Andreas Färber
2012-11-30 16:28 ` Julien Grall
0 siblings, 1 reply; 27+ messages in thread
From: Andreas Färber @ 2012-11-27 1:14 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: Stefano.Stabellini, jan.kiszka, qemu-devel, Julien Grall,
Avi Kivity, Anthony Liguori
Am 26.11.2012 15:25, schrieb Gerd Hoffmann:
> On 11/25/12 16:01, Andreas Färber wrote:
>> Am 25.11.2012 10:10, schrieb Avi Kivity:
>>> On 09/19/2012 02:50 PM, Julien Grall wrote:
>>>> This is the tenth version of patch series about ioport registration.
>>>>
>>>> Some part of QEMU still use register_ioport* functions to register ioport.
>>>> These functions doesn't allow to use Memory Listener on it.
>>>
>>> Acked-by: Avi Kivity <avi@redhat.com>
>>
>> Thanks, queued for the v1.4 merge window:
>> https://github.com/afaerber/qemu-cpu/commits/memory-ioport
>
> I'd like to veto the acpi/smbus bits of this series.
Dropped from queue, q35 caused some breakage anyway. As long as we get
it converted some way I am happy and I guess Julien, too.
https://github.com/afaerber/qemu-cpu/commits/memory-ioport
Cheers,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Qemu-devel] [PATCH V10 0/8] memory: unify ioport registration
2012-11-27 1:14 ` Andreas Färber
@ 2012-11-30 16:28 ` Julien Grall
0 siblings, 0 replies; 27+ messages in thread
From: Julien Grall @ 2012-11-30 16:28 UTC (permalink / raw)
To: Andreas Färber
Cc: Stefano Stabellini, jan.kiszka@siemens.com, qemu-devel@nongnu.org,
Avi Kivity, Anthony Liguori, Gerd Hoffmann
On 11/27/2012 01:14 AM, Andreas Färber wrote:
> Am 26.11.2012 15:25, schrieb Gerd Hoffmann:
>> On 11/25/12 16:01, Andreas Färber wrote:
>>> Am 25.11.2012 10:10, schrieb Avi Kivity:
>>>> On 09/19/2012 02:50 PM, Julien Grall wrote:
>>>>> This is the tenth version of patch series about ioport registration.
>>>>>
>>>>> Some part of QEMU still use register_ioport* functions to register ioport.
>>>>> These functions doesn't allow to use Memory Listener on it.
>>>>
>>>> Acked-by: Avi Kivity <avi@redhat.com>
>>>
>>> Thanks, queued for the v1.4 merge window:
>>> https://github.com/afaerber/qemu-cpu/commits/memory-ioport
>>
>> I'd like to veto the acpi/smbus bits of this series.
>
> Dropped from queue, q35 caused some breakage anyway. As long as we get
> it converted some way I am happy and I guess Julien, too.
>
> https://github.com/afaerber/qemu-cpu/commits/memory-ioport
I don't see any problem if Gerd will replace the ioport_register* by
Memory region on this 2 parts.
Thanks,
Julien
^ permalink raw reply [flat|nested] 27+ messages in thread