[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/17] dump: eliminate DumpState.page_shift ("guest's
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 03/17] dump: eliminate DumpState.page_shift ("guest's page shift") |
Date: |
Wed, 11 Jun 2014 10:50:48 -0400 |
From: Laszlo Ersek <address@hidden>
Just use TARGET_PAGE_BITS.
"DumpState.page_shift" used to have type "uint32_t", while the replacement
TARGET_PAGE_BITS has type "int". Since "DumpState.page_shift" was only
used as bit shift counts in the paddr_to_pfn() and pfn_to_paddr() macros,
this is safe.
Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
dump.c | 10 ++++------
include/sysemu/dump.h | 8 ++++----
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/dump.c b/dump.c
index 6dec8d2..cde14d9 100644
--- a/dump.c
+++ b/dump.c
@@ -91,7 +91,6 @@ typedef struct DumpState {
size_t note_buf_offset; /* the writing place in note_buf */
uint32_t nr_cpus; /* number of guest's cpu */
size_t page_size; /* guest's page size */
- uint32_t page_shift; /* guest's page shift */
uint64_t max_mapnr; /* the biggest guest's phys-mem's number */
size_t len_dump_bitmap; /* the size of the place used to store
dump_bitmap in vmcore */
@@ -1086,7 +1085,7 @@ static bool get_next_page(GuestPhysBlock **blockptr,
uint64_t *pfnptr,
*blockptr = block;
assert(block->target_start % s->page_size == 0);
assert(block->target_end % s->page_size == 0);
- *pfnptr = paddr_to_pfn(block->target_start, s->page_shift);
+ *pfnptr = paddr_to_pfn(block->target_start);
if (bufptr) {
*bufptr = block->host_addr;
}
@@ -1094,7 +1093,7 @@ static bool get_next_page(GuestPhysBlock **blockptr,
uint64_t *pfnptr,
}
*pfnptr = *pfnptr + 1;
- addr = pfn_to_paddr(*pfnptr, s->page_shift);
+ addr = pfn_to_paddr(*pfnptr);
if ((addr >= block->target_start) &&
(addr + s->page_size <= block->target_end)) {
@@ -1108,7 +1107,7 @@ static bool get_next_page(GuestPhysBlock **blockptr,
uint64_t *pfnptr,
}
assert(block->target_start % s->page_size == 0);
assert(block->target_end % s->page_size == 0);
- *pfnptr = paddr_to_pfn(block->target_start, s->page_shift);
+ *pfnptr = paddr_to_pfn(block->target_start);
buf = block->host_addr;
}
@@ -1534,7 +1533,7 @@ static void get_max_mapnr(DumpState *s)
GuestPhysBlock *last_block;
last_block = QTAILQ_LAST(&s->guest_phys_blocks.head, GuestPhysBlockHead);
- s->max_mapnr = paddr_to_pfn(last_block->target_end, s->page_shift);
+ s->max_mapnr = paddr_to_pfn(last_block->target_end);
}
static int dump_init(DumpState *s, int fd, bool has_format,
@@ -1612,7 +1611,6 @@ static int dump_init(DumpState *s, int fd, bool
has_format,
s->nr_cpus = nr_cpus;
s->page_size = TARGET_PAGE_SIZE;
- s->page_shift = ffs(s->page_size) - 1;
get_max_mapnr(s);
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
index efab7a3..12af557 100644
--- a/include/sysemu/dump.h
+++ b/include/sysemu/dump.h
@@ -22,10 +22,10 @@
#define ARCH_PFN_OFFSET (0)
-#define paddr_to_pfn(X, page_shift) \
- (((unsigned long long)(X) >> (page_shift)) - ARCH_PFN_OFFSET)
-#define pfn_to_paddr(X, page_shift) \
- (((unsigned long long)(X) + ARCH_PFN_OFFSET) << (page_shift))
+#define paddr_to_pfn(X) \
+ (((unsigned long long)(X) >> TARGET_PAGE_BITS) - ARCH_PFN_OFFSET)
+#define pfn_to_paddr(X) \
+ (((unsigned long long)(X) + ARCH_PFN_OFFSET) << TARGET_PAGE_BITS)
/*
* flag for compressed format
--
1.9.3
- [Qemu-devel] [PULL 13/17] readline: Make completion strings always unique, (continued)
- [Qemu-devel] [PULL 13/17] readline: Make completion strings always unique, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 01/17] dump: fill in the flat header signature more pleasingly to the eye, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 08/17] monitor: Add ringbuf_write and ringbuf_read argument completion, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 02/17] dump: simplify write_start_flat_header(), Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 06/17] dump: hoist lzo_init() from get_len_buf_out() to dump_init(), Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 11/17] net: Export valid host network devices list, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 12/17] monitor: Add host_net_add device argument completion, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 05/17] dump: select header bitness based on ELF class, not ELF architecture, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 04/17] dump: eliminate DumpState.page_size ("guest's page size"), Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 10/17] monitor: Add migrate_set_capability completion, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 03/17] dump: eliminate DumpState.page_shift ("guest's page shift"),
Luiz Capitulino <=
- [Qemu-devel] [PULL 16/17] readline: Clear screen on form feed., Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 15/17] monitor: Add delvm and loadvm argument completion, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 14/17] monitor: Add host_net_remove arguments completion, Luiz Capitulino, 2014/06/11
- [Qemu-devel] [PULL 17/17] json-parser: drop superfluous assignment for token variable, Luiz Capitulino, 2014/06/11
- Re: [Qemu-devel] [PULL 00/17] QMP queue, Peter Maydell, 2014/06/11