memory: remove qemu_get_ram_fd, qemu_set_ram_fd, qemu_ram_block_host_ptr

Remove direct uses of ram_addr_t and optimize memory_region_{get,set}_fd
now that a MemoryRegion knows its RAMBlock directly.

Backports commit 4ff87573df3606856a92c14eef3393a63d736d11 from qemu
This commit is contained in:
Paolo Bonzini 2018-02-24 03:33:42 -05:00 committed by Lioncash
parent ab569f5cde
commit f26f1f123c
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
17 changed files with 9 additions and 49 deletions

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_aarch64
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_aarch64
#define qemu_get_ram_block qemu_get_ram_block_aarch64
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_aarch64
#define qemu_get_ram_fd qemu_get_ram_fd_aarch64
#define qemu_get_ram_ptr qemu_get_ram_ptr_aarch64
#define qemu_host_page_mask qemu_host_page_mask_aarch64
#define qemu_host_page_size qemu_host_page_size_aarch64

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_aarch64eb
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_aarch64eb
#define qemu_get_ram_block qemu_get_ram_block_aarch64eb
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_aarch64eb
#define qemu_get_ram_fd qemu_get_ram_fd_aarch64eb
#define qemu_get_ram_ptr qemu_get_ram_ptr_aarch64eb
#define qemu_host_page_mask qemu_host_page_mask_aarch64eb
#define qemu_host_page_size qemu_host_page_size_aarch64eb

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_arm
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_arm
#define qemu_get_ram_block qemu_get_ram_block_arm
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_arm
#define qemu_get_ram_fd qemu_get_ram_fd_arm
#define qemu_get_ram_ptr qemu_get_ram_ptr_arm
#define qemu_host_page_mask qemu_host_page_mask_arm
#define qemu_host_page_size qemu_host_page_size_arm

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_armeb
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_armeb
#define qemu_get_ram_block qemu_get_ram_block_armeb
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_armeb
#define qemu_get_ram_fd qemu_get_ram_fd_armeb
#define qemu_get_ram_ptr qemu_get_ram_ptr_armeb
#define qemu_host_page_mask qemu_host_page_mask_armeb
#define qemu_host_page_size qemu_host_page_size_armeb

View file

@ -1361,20 +1361,6 @@ void qemu_ram_remap(struct uc_struct *uc, ram_addr_t addr, ram_addr_t length)
}
#endif /* !_WIN32 */
int qemu_get_ram_fd(struct uc_struct *uc, ram_addr_t addr)
{
RAMBlock *block = qemu_get_ram_block(uc, addr);
return block->fd;
}
void *qemu_get_ram_block_host_ptr(struct uc_struct *uc, ram_addr_t addr)
{
RAMBlock *block = qemu_get_ram_block(uc, addr);
return ramblock_ptr(block, 0);
}
/* Return a host pointer to ram allocated with qemu_ram_alloc.
With the exception of the softmmu code in this file, this should
only be used for local memory (e.g. video ram) that the device owns,

View file

@ -2431,8 +2431,6 @@ symbols = (
'qemu_get_guest_memory_mapping',
'qemu_get_guest_simple_memory_mapping',
'qemu_get_ram_block',
'qemu_get_ram_block_host_ptr',
'qemu_get_ram_fd',
'qemu_get_ram_ptr',
'qemu_host_page_mask',
'qemu_host_page_size',

View file

@ -61,8 +61,6 @@ RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t max_size,
uint64_t length,
void *host),
MemoryRegion *mr, Error **errp);
int qemu_get_ram_fd(struct uc_struct *uc, ram_addr_t addr);
void *qemu_get_ram_block_host_ptr(struct uc_struct *uc, ram_addr_t addr);
void qemu_ram_free(struct uc_struct *c, ram_addr_t addr);
int qemu_ram_resize(struct uc_struct *c, RAMBlock *block, ram_addr_t newsize, Error **errp);

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_m68k
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_m68k
#define qemu_get_ram_block qemu_get_ram_block_m68k
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_m68k
#define qemu_get_ram_fd qemu_get_ram_fd_m68k
#define qemu_get_ram_ptr qemu_get_ram_ptr_m68k
#define qemu_host_page_mask qemu_host_page_mask_m68k
#define qemu_host_page_size qemu_host_page_size_m68k

View file

@ -1331,13 +1331,17 @@ void memory_region_rom_device_set_romd(MemoryRegion *mr, bool romd_mode)
int memory_region_get_fd(MemoryRegion *mr)
{
if (mr->alias) {
return memory_region_get_fd(mr->alias);
int fd;
// Unicorn: commented out
//rcu_read_lock();
while (mr->alias) {
mr = mr->alias;
}
fd = mr->ram_block->fd;
//rcu_read_unlock();
assert(mr->ram_block);
return qemu_get_ram_fd(mr->uc, memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK);
return fd;
}
void *memory_region_get_ram_ptr(MemoryRegion *mr)

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_mips
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_mips
#define qemu_get_ram_block qemu_get_ram_block_mips
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_mips
#define qemu_get_ram_fd qemu_get_ram_fd_mips
#define qemu_get_ram_ptr qemu_get_ram_ptr_mips
#define qemu_host_page_mask qemu_host_page_mask_mips
#define qemu_host_page_size qemu_host_page_size_mips

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_mips64
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_mips64
#define qemu_get_ram_block qemu_get_ram_block_mips64
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_mips64
#define qemu_get_ram_fd qemu_get_ram_fd_mips64
#define qemu_get_ram_ptr qemu_get_ram_ptr_mips64
#define qemu_host_page_mask qemu_host_page_mask_mips64
#define qemu_host_page_size qemu_host_page_size_mips64

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_mips64el
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_mips64el
#define qemu_get_ram_block qemu_get_ram_block_mips64el
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_mips64el
#define qemu_get_ram_fd qemu_get_ram_fd_mips64el
#define qemu_get_ram_ptr qemu_get_ram_ptr_mips64el
#define qemu_host_page_mask qemu_host_page_mask_mips64el
#define qemu_host_page_size qemu_host_page_size_mips64el

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_mipsel
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_mipsel
#define qemu_get_ram_block qemu_get_ram_block_mipsel
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_mipsel
#define qemu_get_ram_fd qemu_get_ram_fd_mipsel
#define qemu_get_ram_ptr qemu_get_ram_ptr_mipsel
#define qemu_host_page_mask qemu_host_page_mask_mipsel
#define qemu_host_page_size qemu_host_page_size_mipsel

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_powerpc
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_powerpc
#define qemu_get_ram_block qemu_get_ram_block_powerpc
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_powerpc
#define qemu_get_ram_fd qemu_get_ram_fd_powerpc
#define qemu_get_ram_ptr qemu_get_ram_ptr_powerpc
#define qemu_host_page_mask qemu_host_page_mask_powerpc
#define qemu_host_page_size qemu_host_page_size_powerpc

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_sparc
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_sparc
#define qemu_get_ram_block qemu_get_ram_block_sparc
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_sparc
#define qemu_get_ram_fd qemu_get_ram_fd_sparc
#define qemu_get_ram_ptr qemu_get_ram_ptr_sparc
#define qemu_host_page_mask qemu_host_page_mask_sparc
#define qemu_host_page_size qemu_host_page_size_sparc

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_sparc64
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_sparc64
#define qemu_get_ram_block qemu_get_ram_block_sparc64
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_sparc64
#define qemu_get_ram_fd qemu_get_ram_fd_sparc64
#define qemu_get_ram_ptr qemu_get_ram_ptr_sparc64
#define qemu_host_page_mask qemu_host_page_mask_sparc64
#define qemu_host_page_size qemu_host_page_size_sparc64

View file

@ -2425,8 +2425,6 @@
#define qemu_get_guest_memory_mapping qemu_get_guest_memory_mapping_x86_64
#define qemu_get_guest_simple_memory_mapping qemu_get_guest_simple_memory_mapping_x86_64
#define qemu_get_ram_block qemu_get_ram_block_x86_64
#define qemu_get_ram_block_host_ptr qemu_get_ram_block_host_ptr_x86_64
#define qemu_get_ram_fd qemu_get_ram_fd_x86_64
#define qemu_get_ram_ptr qemu_get_ram_ptr_x86_64
#define qemu_host_page_mask qemu_host_page_mask_x86_64
#define qemu_host_page_size qemu_host_page_size_x86_64