mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 01:05:36 +00:00
memory: Add global-locking property to memory regions
This introduces the memory region property "global_locking". It is true by default. By setting it to false, a device model can request BQL-free dispatching of region accesses to its r/w handlers. The actual BQL break-up will be provided in a separate patch. Backports commit 196ea13104f802c508e57180b2a0d2b3418989a3 from qemu
This commit is contained in:
parent
92cd41d78e
commit
b93c24ba31
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_aarch64
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_aarch64
|
||||
#define memory_region_big_endian memory_region_big_endian_aarch64
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_aarch64
|
||||
#define memory_region_clear_pending memory_region_clear_pending_aarch64
|
||||
#define memory_region_del_subregion memory_region_del_subregion_aarch64
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_aarch64
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_aarch64
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_aarch64
|
||||
#define memory_region_set_enabled memory_region_set_enabled_aarch64
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_aarch64
|
||||
#define memory_region_set_readonly memory_region_set_readonly_aarch64
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_aarch64
|
||||
#define memory_region_size memory_region_size_aarch64
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_aarch64eb
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_aarch64eb
|
||||
#define memory_region_big_endian memory_region_big_endian_aarch64eb
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_aarch64eb
|
||||
#define memory_region_clear_pending memory_region_clear_pending_aarch64eb
|
||||
#define memory_region_del_subregion memory_region_del_subregion_aarch64eb
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_aarch64eb
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_aarch64eb
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_aarch64eb
|
||||
#define memory_region_set_enabled memory_region_set_enabled_aarch64eb
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_aarch64eb
|
||||
#define memory_region_set_readonly memory_region_set_readonly_aarch64eb
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_aarch64eb
|
||||
#define memory_region_size memory_region_size_aarch64eb
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_arm
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_arm
|
||||
#define memory_region_big_endian memory_region_big_endian_arm
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_arm
|
||||
#define memory_region_clear_pending memory_region_clear_pending_arm
|
||||
#define memory_region_del_subregion memory_region_del_subregion_arm
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_arm
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_arm
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_arm
|
||||
#define memory_region_set_enabled memory_region_set_enabled_arm
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_arm
|
||||
#define memory_region_set_readonly memory_region_set_readonly_arm
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_arm
|
||||
#define memory_region_size memory_region_size_arm
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_armeb
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_armeb
|
||||
#define memory_region_big_endian memory_region_big_endian_armeb
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_armeb
|
||||
#define memory_region_clear_pending memory_region_clear_pending_armeb
|
||||
#define memory_region_del_subregion memory_region_del_subregion_armeb
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_armeb
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_armeb
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_armeb
|
||||
#define memory_region_set_enabled memory_region_set_enabled_armeb
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_armeb
|
||||
#define memory_region_set_readonly memory_region_set_readonly_armeb
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_armeb
|
||||
#define memory_region_size memory_region_size_armeb
|
||||
|
|
|
@ -2058,6 +2058,7 @@ symbols = (
|
|||
'memory_region_add_subregion_common',
|
||||
'memory_region_add_subregion_overlap',
|
||||
'memory_region_big_endian',
|
||||
'memory_region_clear_global_locking',
|
||||
'memory_region_clear_pending',
|
||||
'memory_region_del_subregion',
|
||||
'memory_region_destructor_alias',
|
||||
|
@ -2110,6 +2111,7 @@ symbols = (
|
|||
'memory_region_set_address',
|
||||
'memory_region_set_alias_offset',
|
||||
'memory_region_set_enabled',
|
||||
'memory_region_set_global_locking',
|
||||
'memory_region_set_readonly',
|
||||
'memory_region_set_skip_dump',
|
||||
'memory_region_size',
|
||||
|
|
|
@ -169,6 +169,7 @@ struct MemoryRegion {
|
|||
bool enabled;
|
||||
bool rom_device;
|
||||
bool warning_printed; /* For reservations */
|
||||
bool global_locking;
|
||||
MemoryRegion *alias;
|
||||
hwaddr alias_offset;
|
||||
int32_t priority;
|
||||
|
@ -587,6 +588,31 @@ bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
|
|||
*/
|
||||
void memory_region_set_readonly(MemoryRegion *mr, bool readonly);
|
||||
|
||||
/**
|
||||
* memory_region_set_global_locking: Declares the access processing requires
|
||||
* QEMU's global lock.
|
||||
*
|
||||
* When this is invoked, accesses to the memory region will be processed while
|
||||
* holding the global lock of QEMU. This is the default behavior of memory
|
||||
* regions.
|
||||
*
|
||||
* @mr: the memory region to be updated.
|
||||
*/
|
||||
void memory_region_set_global_locking(MemoryRegion *mr);
|
||||
|
||||
/**
|
||||
* memory_region_clear_global_locking: Declares that access processing does
|
||||
* not depend on the QEMU global lock.
|
||||
*
|
||||
* By clearing this property, accesses to the memory region will be processed
|
||||
* outside of QEMU's global lock (unless the lock is held on when issuing the
|
||||
* access request). In this case, the device model implementing the access
|
||||
* handlers is responsible for synchronization of concurrency.
|
||||
*
|
||||
* @mr: the memory region to be updated.
|
||||
*/
|
||||
void memory_region_clear_global_locking(MemoryRegion *mr);
|
||||
|
||||
/**
|
||||
* memory_region_rom_device_set_romd: enable/disable ROMD mode
|
||||
*
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_m68k
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_m68k
|
||||
#define memory_region_big_endian memory_region_big_endian_m68k
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_m68k
|
||||
#define memory_region_clear_pending memory_region_clear_pending_m68k
|
||||
#define memory_region_del_subregion memory_region_del_subregion_m68k
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_m68k
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_m68k
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_m68k
|
||||
#define memory_region_set_enabled memory_region_set_enabled_m68k
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_m68k
|
||||
#define memory_region_set_readonly memory_region_set_readonly_m68k
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_m68k
|
||||
#define memory_region_size memory_region_size_m68k
|
||||
|
|
|
@ -953,6 +953,7 @@ static void memory_region_initfn(struct uc_struct *uc, Object *obj, void *opaque
|
|||
mr->ram_addr = RAM_ADDR_INVALID;
|
||||
mr->enabled = true;
|
||||
mr->romd_mode = true;
|
||||
mr->global_locking = true;
|
||||
mr->destructor = memory_region_destructor_none;
|
||||
QTAILQ_INIT(&mr->subregions);
|
||||
|
||||
|
@ -1313,6 +1314,16 @@ void memory_region_set_readonly(MemoryRegion *mr, bool readonly)
|
|||
}
|
||||
}
|
||||
|
||||
void memory_region_set_global_locking(MemoryRegion *mr)
|
||||
{
|
||||
mr->global_locking = true;
|
||||
}
|
||||
|
||||
void memory_region_clear_global_locking(MemoryRegion *mr)
|
||||
{
|
||||
mr->global_locking = false;
|
||||
}
|
||||
|
||||
void memory_region_rom_device_set_romd(MemoryRegion *mr, bool romd_mode)
|
||||
{
|
||||
if (mr->romd_mode != romd_mode) {
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_mips
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_mips
|
||||
#define memory_region_big_endian memory_region_big_endian_mips
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_mips
|
||||
#define memory_region_clear_pending memory_region_clear_pending_mips
|
||||
#define memory_region_del_subregion memory_region_del_subregion_mips
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_mips
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_mips
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_mips
|
||||
#define memory_region_set_enabled memory_region_set_enabled_mips
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_mips
|
||||
#define memory_region_set_readonly memory_region_set_readonly_mips
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_mips
|
||||
#define memory_region_size memory_region_size_mips
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_mips64
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_mips64
|
||||
#define memory_region_big_endian memory_region_big_endian_mips64
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_mips64
|
||||
#define memory_region_clear_pending memory_region_clear_pending_mips64
|
||||
#define memory_region_del_subregion memory_region_del_subregion_mips64
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_mips64
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_mips64
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_mips64
|
||||
#define memory_region_set_enabled memory_region_set_enabled_mips64
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_mips64
|
||||
#define memory_region_set_readonly memory_region_set_readonly_mips64
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_mips64
|
||||
#define memory_region_size memory_region_size_mips64
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_mips64el
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_mips64el
|
||||
#define memory_region_big_endian memory_region_big_endian_mips64el
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_mips64el
|
||||
#define memory_region_clear_pending memory_region_clear_pending_mips64el
|
||||
#define memory_region_del_subregion memory_region_del_subregion_mips64el
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_mips64el
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_mips64el
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_mips64el
|
||||
#define memory_region_set_enabled memory_region_set_enabled_mips64el
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_mips64el
|
||||
#define memory_region_set_readonly memory_region_set_readonly_mips64el
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_mips64el
|
||||
#define memory_region_size memory_region_size_mips64el
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_mipsel
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_mipsel
|
||||
#define memory_region_big_endian memory_region_big_endian_mipsel
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_mipsel
|
||||
#define memory_region_clear_pending memory_region_clear_pending_mipsel
|
||||
#define memory_region_del_subregion memory_region_del_subregion_mipsel
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_mipsel
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_mipsel
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_mipsel
|
||||
#define memory_region_set_enabled memory_region_set_enabled_mipsel
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_mipsel
|
||||
#define memory_region_set_readonly memory_region_set_readonly_mipsel
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_mipsel
|
||||
#define memory_region_size memory_region_size_mipsel
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_powerpc
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_powerpc
|
||||
#define memory_region_big_endian memory_region_big_endian_powerpc
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_powerpc
|
||||
#define memory_region_clear_pending memory_region_clear_pending_powerpc
|
||||
#define memory_region_del_subregion memory_region_del_subregion_powerpc
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_powerpc
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_powerpc
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_powerpc
|
||||
#define memory_region_set_enabled memory_region_set_enabled_powerpc
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_powerpc
|
||||
#define memory_region_set_readonly memory_region_set_readonly_powerpc
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_powerpc
|
||||
#define memory_region_size memory_region_size_powerpc
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_sparc
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_sparc
|
||||
#define memory_region_big_endian memory_region_big_endian_sparc
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_sparc
|
||||
#define memory_region_clear_pending memory_region_clear_pending_sparc
|
||||
#define memory_region_del_subregion memory_region_del_subregion_sparc
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_sparc
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_sparc
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_sparc
|
||||
#define memory_region_set_enabled memory_region_set_enabled_sparc
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_sparc
|
||||
#define memory_region_set_readonly memory_region_set_readonly_sparc
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_sparc
|
||||
#define memory_region_size memory_region_size_sparc
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_sparc64
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_sparc64
|
||||
#define memory_region_big_endian memory_region_big_endian_sparc64
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_sparc64
|
||||
#define memory_region_clear_pending memory_region_clear_pending_sparc64
|
||||
#define memory_region_del_subregion memory_region_del_subregion_sparc64
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_sparc64
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_sparc64
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_sparc64
|
||||
#define memory_region_set_enabled memory_region_set_enabled_sparc64
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_sparc64
|
||||
#define memory_region_set_readonly memory_region_set_readonly_sparc64
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_sparc64
|
||||
#define memory_region_size memory_region_size_sparc64
|
||||
|
|
|
@ -2052,6 +2052,7 @@
|
|||
#define memory_region_add_subregion_common memory_region_add_subregion_common_x86_64
|
||||
#define memory_region_add_subregion_overlap memory_region_add_subregion_overlap_x86_64
|
||||
#define memory_region_big_endian memory_region_big_endian_x86_64
|
||||
#define memory_region_clear_global_locking memory_region_clear_global_locking_x86_64
|
||||
#define memory_region_clear_pending memory_region_clear_pending_x86_64
|
||||
#define memory_region_del_subregion memory_region_del_subregion_x86_64
|
||||
#define memory_region_destructor_alias memory_region_destructor_alias_x86_64
|
||||
|
@ -2104,6 +2105,7 @@
|
|||
#define memory_region_set_address memory_region_set_address_x86_64
|
||||
#define memory_region_set_alias_offset memory_region_set_alias_offset_x86_64
|
||||
#define memory_region_set_enabled memory_region_set_enabled_x86_64
|
||||
#define memory_region_set_global_locking memory_region_set_global_locking_x86_64
|
||||
#define memory_region_set_readonly memory_region_set_readonly_x86_64
|
||||
#define memory_region_set_skip_dump memory_region_set_skip_dump_x86_64
|
||||
#define memory_region_size memory_region_size_x86_64
|
||||
|
|
Loading…
Reference in a new issue