mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
ioport: Switch dispatching to memory core layer
The current ioport dispatcher is a complex beast, mostly due to the need to deal with old portio interface users. But we can overcome it without converting all portio users by embedding the required base address of a MemoryRegionPortio access into that data structure. That removes the need to have the additional MemoryRegionIORange structure in the loop on every access. To handle old portio memory ops, we simply install dispatching handlers for portio memory regions when registering them with the memory core. This removes the need for the old_portio field. We can drop the additional aliasing of ioport regions and also the special address space listener. cpu_in and cpu_out now simply call address_space_read/write. And we can concentrate portio handling in a single source file. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
962b03fcf5
commit
b40acf99be
6 changed files with 102 additions and 159 deletions
27
exec.c
27
exec.c
|
@ -1752,26 +1752,6 @@ static void core_log_global_stop(MemoryListener *listener)
|
|||
cpu_physical_memory_set_dirty_tracking(0);
|
||||
}
|
||||
|
||||
static void io_region_add(MemoryListener *listener,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
MemoryRegionIORange *mrio = g_new(MemoryRegionIORange, 1);
|
||||
|
||||
mrio->mr = section->mr;
|
||||
mrio->offset = section->offset_within_region;
|
||||
iorange_init(&mrio->iorange, &memory_region_iorange_ops,
|
||||
section->offset_within_address_space,
|
||||
int128_get64(section->size));
|
||||
ioport_register(&mrio->iorange);
|
||||
}
|
||||
|
||||
static void io_region_del(MemoryListener *listener,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
isa_unassign_ioport(section->offset_within_address_space,
|
||||
int128_get64(section->size));
|
||||
}
|
||||
|
||||
static MemoryListener core_memory_listener = {
|
||||
.begin = core_begin,
|
||||
.log_global_start = core_log_global_start,
|
||||
|
@ -1779,12 +1759,6 @@ static MemoryListener core_memory_listener = {
|
|||
.priority = 1,
|
||||
};
|
||||
|
||||
static MemoryListener io_memory_listener = {
|
||||
.region_add = io_region_add,
|
||||
.region_del = io_region_del,
|
||||
.priority = 0,
|
||||
};
|
||||
|
||||
static MemoryListener tcg_memory_listener = {
|
||||
.commit = tcg_commit,
|
||||
};
|
||||
|
@ -1826,7 +1800,6 @@ static void memory_map_init(void)
|
|||
address_space_init(&address_space_io, system_io, "I/O");
|
||||
|
||||
memory_listener_register(&core_memory_listener, &address_space_memory);
|
||||
memory_listener_register(&io_memory_listener, &address_space_io);
|
||||
memory_listener_register(&tcg_memory_listener, &address_space_memory);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue