memory: inline a few small accessors

These are used in the address_space_* fast paths.

Backports commit 1619d1fe737d2af068aefe134386a69b76164794 from qemu
This commit is contained in:
Paolo Bonzini 2018-02-17 20:34:27 -05:00 committed by Lioncash
parent 9a78c61145
commit 712c300639
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
16 changed files with 16 additions and 94 deletions

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_aarch64
#define memory_region_get_may_overlap memory_region_get_may_overlap_aarch64
#define memory_region_get_priority memory_region_get_priority_aarch64
#define memory_region_get_ram_addr memory_region_get_ram_addr_aarch64
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_aarch64
#define memory_region_get_size memory_region_get_size_aarch64
#define memory_region_info memory_region_info_aarch64
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_aarch64
#define memory_region_init_reservation memory_region_init_reservation_aarch64
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_aarch64
#define memory_region_is_iommu memory_region_is_iommu_aarch64
#define memory_region_is_logging memory_region_is_logging_aarch64
#define memory_region_is_mapped memory_region_is_mapped_aarch64
#define memory_region_is_ram memory_region_is_ram_aarch64
#define memory_region_is_rom memory_region_is_rom_aarch64
#define memory_region_is_romd memory_region_is_romd_aarch64
#define memory_region_is_skip_dump memory_region_is_skip_dump_aarch64
#define memory_region_is_unassigned memory_region_is_unassigned_aarch64
#define memory_region_name memory_region_name_aarch64

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_aarch64eb
#define memory_region_get_may_overlap memory_region_get_may_overlap_aarch64eb
#define memory_region_get_priority memory_region_get_priority_aarch64eb
#define memory_region_get_ram_addr memory_region_get_ram_addr_aarch64eb
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_aarch64eb
#define memory_region_get_size memory_region_get_size_aarch64eb
#define memory_region_info memory_region_info_aarch64eb
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_aarch64eb
#define memory_region_init_reservation memory_region_init_reservation_aarch64eb
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_aarch64eb
#define memory_region_is_iommu memory_region_is_iommu_aarch64eb
#define memory_region_is_logging memory_region_is_logging_aarch64eb
#define memory_region_is_mapped memory_region_is_mapped_aarch64eb
#define memory_region_is_ram memory_region_is_ram_aarch64eb
#define memory_region_is_rom memory_region_is_rom_aarch64eb
#define memory_region_is_romd memory_region_is_romd_aarch64eb
#define memory_region_is_skip_dump memory_region_is_skip_dump_aarch64eb
#define memory_region_is_unassigned memory_region_is_unassigned_aarch64eb
#define memory_region_name memory_region_name_aarch64eb

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_arm
#define memory_region_get_may_overlap memory_region_get_may_overlap_arm
#define memory_region_get_priority memory_region_get_priority_arm
#define memory_region_get_ram_addr memory_region_get_ram_addr_arm
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_arm
#define memory_region_get_size memory_region_get_size_arm
#define memory_region_info memory_region_info_arm
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_arm
#define memory_region_init_reservation memory_region_init_reservation_arm
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_arm
#define memory_region_is_iommu memory_region_is_iommu_arm
#define memory_region_is_logging memory_region_is_logging_arm
#define memory_region_is_mapped memory_region_is_mapped_arm
#define memory_region_is_ram memory_region_is_ram_arm
#define memory_region_is_rom memory_region_is_rom_arm
#define memory_region_is_romd memory_region_is_romd_arm
#define memory_region_is_skip_dump memory_region_is_skip_dump_arm
#define memory_region_is_unassigned memory_region_is_unassigned_arm
#define memory_region_name memory_region_name_arm

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_armeb
#define memory_region_get_may_overlap memory_region_get_may_overlap_armeb
#define memory_region_get_priority memory_region_get_priority_armeb
#define memory_region_get_ram_addr memory_region_get_ram_addr_armeb
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_armeb
#define memory_region_get_size memory_region_get_size_armeb
#define memory_region_info memory_region_info_armeb
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_armeb
#define memory_region_init_reservation memory_region_init_reservation_armeb
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_armeb
#define memory_region_is_iommu memory_region_is_iommu_armeb
#define memory_region_is_logging memory_region_is_logging_armeb
#define memory_region_is_mapped memory_region_is_mapped_armeb
#define memory_region_is_ram memory_region_is_ram_armeb
#define memory_region_is_rom memory_region_is_rom_armeb
#define memory_region_is_romd memory_region_is_romd_armeb
#define memory_region_is_skip_dump memory_region_is_skip_dump_armeb
#define memory_region_is_unassigned memory_region_is_unassigned_armeb
#define memory_region_name memory_region_name_armeb

View file

@ -2083,7 +2083,6 @@ symbols = (
'memory_region_get_fd',
'memory_region_get_may_overlap',
'memory_region_get_priority',
'memory_region_get_ram_addr',
'memory_region_get_ram_ptr',
'memory_region_get_size',
'memory_region_info',
@ -2095,12 +2094,8 @@ symbols = (
'memory_region_init_ram_ptr',
'memory_region_init_reservation',
'memory_region_init_resizeable_ram',
'memory_region_is_iommu',
'memory_region_is_logging',
'memory_region_is_mapped',
'memory_region_is_ram',
'memory_region_is_rom',
'memory_region_is_romd',
'memory_region_is_skip_dump',
'memory_region_is_unassigned',
'memory_region_name',

View file

@ -477,7 +477,10 @@ uint64_t memory_region_size(MemoryRegion *mr);
*
* @mr: the memory region being queried
*/
bool memory_region_is_ram(MemoryRegion *mr);
static inline bool memory_region_is_ram(MemoryRegion *mr)
{
return mr->ram;
}
/**
* memory_region_is_skip_dump: check whether a memory region should not be
@ -517,7 +520,10 @@ static inline bool memory_region_is_romd(MemoryRegion *mr)
*
* @mr: the memory region being queried
*/
bool memory_region_is_iommu(MemoryRegion *mr);
static inline bool memory_region_is_iommu(MemoryRegion *mr)
{
return mr->iommu_ops;
}
/**
* memory_region_notify_iommu: notify a change in an IOMMU translation entry.
@ -567,7 +573,10 @@ uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr);
*
* @mr: the memory region being queried
*/
bool memory_region_is_rom(MemoryRegion *mr);
static inline bool memory_region_is_rom(MemoryRegion *mr)
{
return mr->ram && mr->readonly;
}
/**
* memory_region_get_fd: Get a file descriptor backing a RAM memory region.
@ -703,7 +712,10 @@ void memory_region_add_subregion_overlap(MemoryRegion *mr,
* DO NOT USE THIS FUNCTION. This is a temporary workaround while the Xen
* code is being reworked.
*/
ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr);
static inline ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr)
{
return mr->ram_addr;
}
uint64_t memory_region_get_alignment(const MemoryRegion *mr);

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_m68k
#define memory_region_get_may_overlap memory_region_get_may_overlap_m68k
#define memory_region_get_priority memory_region_get_priority_m68k
#define memory_region_get_ram_addr memory_region_get_ram_addr_m68k
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_m68k
#define memory_region_get_size memory_region_get_size_m68k
#define memory_region_info memory_region_info_m68k
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_m68k
#define memory_region_init_reservation memory_region_init_reservation_m68k
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_m68k
#define memory_region_is_iommu memory_region_is_iommu_m68k
#define memory_region_is_logging memory_region_is_logging_m68k
#define memory_region_is_mapped memory_region_is_mapped_m68k
#define memory_region_is_ram memory_region_is_ram_m68k
#define memory_region_is_rom memory_region_is_rom_m68k
#define memory_region_is_romd memory_region_is_romd_m68k
#define memory_region_is_skip_dump memory_region_is_skip_dump_m68k
#define memory_region_is_unassigned memory_region_is_unassigned_m68k
#define memory_region_name memory_region_name_m68k

View file

@ -1294,11 +1294,6 @@ const char *memory_region_name(const MemoryRegion *mr)
return mr->name;
}
bool memory_region_is_ram(MemoryRegion *mr)
{
return mr->ram;
}
bool memory_region_is_skip_dump(MemoryRegion *mr)
{
return mr->skip_dump;
@ -1314,16 +1309,6 @@ bool memory_region_is_logging(MemoryRegion *mr, uint8_t client)
return memory_region_get_dirty_log_mask(mr) & (1 << client);
}
bool memory_region_is_rom(MemoryRegion *mr)
{
return mr->ram && mr->readonly;
}
bool memory_region_is_iommu(MemoryRegion *mr)
{
return mr->iommu_ops != 0;
}
void memory_region_set_readonly(MemoryRegion *mr, bool readonly)
{
if (mr->readonly != readonly) {
@ -1538,11 +1523,6 @@ void memory_region_set_alias_offset(MemoryRegion *mr, hwaddr offset)
memory_region_transaction_commit(mr->uc);
}
ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr)
{
return mr->ram_addr;
}
uint64_t memory_region_get_alignment(const MemoryRegion *mr)
{
return mr->align;

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_mips
#define memory_region_get_may_overlap memory_region_get_may_overlap_mips
#define memory_region_get_priority memory_region_get_priority_mips
#define memory_region_get_ram_addr memory_region_get_ram_addr_mips
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_mips
#define memory_region_get_size memory_region_get_size_mips
#define memory_region_info memory_region_info_mips
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_mips
#define memory_region_init_reservation memory_region_init_reservation_mips
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_mips
#define memory_region_is_iommu memory_region_is_iommu_mips
#define memory_region_is_logging memory_region_is_logging_mips
#define memory_region_is_mapped memory_region_is_mapped_mips
#define memory_region_is_ram memory_region_is_ram_mips
#define memory_region_is_rom memory_region_is_rom_mips
#define memory_region_is_romd memory_region_is_romd_mips
#define memory_region_is_skip_dump memory_region_is_skip_dump_mips
#define memory_region_is_unassigned memory_region_is_unassigned_mips
#define memory_region_name memory_region_name_mips

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_mips64
#define memory_region_get_may_overlap memory_region_get_may_overlap_mips64
#define memory_region_get_priority memory_region_get_priority_mips64
#define memory_region_get_ram_addr memory_region_get_ram_addr_mips64
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_mips64
#define memory_region_get_size memory_region_get_size_mips64
#define memory_region_info memory_region_info_mips64
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_mips64
#define memory_region_init_reservation memory_region_init_reservation_mips64
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_mips64
#define memory_region_is_iommu memory_region_is_iommu_mips64
#define memory_region_is_logging memory_region_is_logging_mips64
#define memory_region_is_mapped memory_region_is_mapped_mips64
#define memory_region_is_ram memory_region_is_ram_mips64
#define memory_region_is_rom memory_region_is_rom_mips64
#define memory_region_is_romd memory_region_is_romd_mips64
#define memory_region_is_skip_dump memory_region_is_skip_dump_mips64
#define memory_region_is_unassigned memory_region_is_unassigned_mips64
#define memory_region_name memory_region_name_mips64

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_mips64el
#define memory_region_get_may_overlap memory_region_get_may_overlap_mips64el
#define memory_region_get_priority memory_region_get_priority_mips64el
#define memory_region_get_ram_addr memory_region_get_ram_addr_mips64el
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_mips64el
#define memory_region_get_size memory_region_get_size_mips64el
#define memory_region_info memory_region_info_mips64el
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_mips64el
#define memory_region_init_reservation memory_region_init_reservation_mips64el
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_mips64el
#define memory_region_is_iommu memory_region_is_iommu_mips64el
#define memory_region_is_logging memory_region_is_logging_mips64el
#define memory_region_is_mapped memory_region_is_mapped_mips64el
#define memory_region_is_ram memory_region_is_ram_mips64el
#define memory_region_is_rom memory_region_is_rom_mips64el
#define memory_region_is_romd memory_region_is_romd_mips64el
#define memory_region_is_skip_dump memory_region_is_skip_dump_mips64el
#define memory_region_is_unassigned memory_region_is_unassigned_mips64el
#define memory_region_name memory_region_name_mips64el

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_mipsel
#define memory_region_get_may_overlap memory_region_get_may_overlap_mipsel
#define memory_region_get_priority memory_region_get_priority_mipsel
#define memory_region_get_ram_addr memory_region_get_ram_addr_mipsel
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_mipsel
#define memory_region_get_size memory_region_get_size_mipsel
#define memory_region_info memory_region_info_mipsel
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_mipsel
#define memory_region_init_reservation memory_region_init_reservation_mipsel
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_mipsel
#define memory_region_is_iommu memory_region_is_iommu_mipsel
#define memory_region_is_logging memory_region_is_logging_mipsel
#define memory_region_is_mapped memory_region_is_mapped_mipsel
#define memory_region_is_ram memory_region_is_ram_mipsel
#define memory_region_is_rom memory_region_is_rom_mipsel
#define memory_region_is_romd memory_region_is_romd_mipsel
#define memory_region_is_skip_dump memory_region_is_skip_dump_mipsel
#define memory_region_is_unassigned memory_region_is_unassigned_mipsel
#define memory_region_name memory_region_name_mipsel

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_powerpc
#define memory_region_get_may_overlap memory_region_get_may_overlap_powerpc
#define memory_region_get_priority memory_region_get_priority_powerpc
#define memory_region_get_ram_addr memory_region_get_ram_addr_powerpc
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_powerpc
#define memory_region_get_size memory_region_get_size_powerpc
#define memory_region_info memory_region_info_powerpc
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_powerpc
#define memory_region_init_reservation memory_region_init_reservation_powerpc
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_powerpc
#define memory_region_is_iommu memory_region_is_iommu_powerpc
#define memory_region_is_logging memory_region_is_logging_powerpc
#define memory_region_is_mapped memory_region_is_mapped_powerpc
#define memory_region_is_ram memory_region_is_ram_powerpc
#define memory_region_is_rom memory_region_is_rom_powerpc
#define memory_region_is_romd memory_region_is_romd_powerpc
#define memory_region_is_skip_dump memory_region_is_skip_dump_powerpc
#define memory_region_is_unassigned memory_region_is_unassigned_powerpc
#define memory_region_name memory_region_name_powerpc

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_sparc
#define memory_region_get_may_overlap memory_region_get_may_overlap_sparc
#define memory_region_get_priority memory_region_get_priority_sparc
#define memory_region_get_ram_addr memory_region_get_ram_addr_sparc
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_sparc
#define memory_region_get_size memory_region_get_size_sparc
#define memory_region_info memory_region_info_sparc
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_sparc
#define memory_region_init_reservation memory_region_init_reservation_sparc
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_sparc
#define memory_region_is_iommu memory_region_is_iommu_sparc
#define memory_region_is_logging memory_region_is_logging_sparc
#define memory_region_is_mapped memory_region_is_mapped_sparc
#define memory_region_is_ram memory_region_is_ram_sparc
#define memory_region_is_rom memory_region_is_rom_sparc
#define memory_region_is_romd memory_region_is_romd_sparc
#define memory_region_is_skip_dump memory_region_is_skip_dump_sparc
#define memory_region_is_unassigned memory_region_is_unassigned_sparc
#define memory_region_name memory_region_name_sparc

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_sparc64
#define memory_region_get_may_overlap memory_region_get_may_overlap_sparc64
#define memory_region_get_priority memory_region_get_priority_sparc64
#define memory_region_get_ram_addr memory_region_get_ram_addr_sparc64
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_sparc64
#define memory_region_get_size memory_region_get_size_sparc64
#define memory_region_info memory_region_info_sparc64
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_sparc64
#define memory_region_init_reservation memory_region_init_reservation_sparc64
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_sparc64
#define memory_region_is_iommu memory_region_is_iommu_sparc64
#define memory_region_is_logging memory_region_is_logging_sparc64
#define memory_region_is_mapped memory_region_is_mapped_sparc64
#define memory_region_is_ram memory_region_is_ram_sparc64
#define memory_region_is_rom memory_region_is_rom_sparc64
#define memory_region_is_romd memory_region_is_romd_sparc64
#define memory_region_is_skip_dump memory_region_is_skip_dump_sparc64
#define memory_region_is_unassigned memory_region_is_unassigned_sparc64
#define memory_region_name memory_region_name_sparc64

View file

@ -2077,7 +2077,6 @@
#define memory_region_get_fd memory_region_get_fd_x86_64
#define memory_region_get_may_overlap memory_region_get_may_overlap_x86_64
#define memory_region_get_priority memory_region_get_priority_x86_64
#define memory_region_get_ram_addr memory_region_get_ram_addr_x86_64
#define memory_region_get_ram_ptr memory_region_get_ram_ptr_x86_64
#define memory_region_get_size memory_region_get_size_x86_64
#define memory_region_info memory_region_info_x86_64
@ -2089,12 +2088,8 @@
#define memory_region_init_ram_ptr memory_region_init_ram_ptr_x86_64
#define memory_region_init_reservation memory_region_init_reservation_x86_64
#define memory_region_init_resizeable_ram memory_region_init_resizeable_ram_x86_64
#define memory_region_is_iommu memory_region_is_iommu_x86_64
#define memory_region_is_logging memory_region_is_logging_x86_64
#define memory_region_is_mapped memory_region_is_mapped_x86_64
#define memory_region_is_ram memory_region_is_ram_x86_64
#define memory_region_is_rom memory_region_is_rom_x86_64
#define memory_region_is_romd memory_region_is_romd_x86_64
#define memory_region_is_skip_dump memory_region_is_skip_dump_x86_64
#define memory_region_is_unassigned memory_region_is_unassigned_x86_64
#define memory_region_name memory_region_name_x86_64