diff mbox

[for-1.6,1/2] memory: export target page size

Message ID 1376295742-28528-2-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin Aug. 12, 2013, 8:49 a.m. UTC
Add symbol to make it possible to use target page size
in target-independent code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 exec.c                | 2 ++
 include/exec/memory.h | 2 ++
 2 files changed, 4 insertions(+)

Comments

Peter Maydell Aug. 12, 2013, 9:17 a.m. UTC | #1
On 12 August 2013 09:49, Michael S. Tsirkin <mst@redhat.com> wrote:
> Add symbol to make it possible to use target page size
> in target-independent code.

Given that TARGET_PAGE_SIZE is "smallest page size the
TCG implementation currently supports for this core"
(ie it is a TCG internal implementation detail as much
as a property of the target CPU and it may well not
match the actual page size being used by the guest)
I would be very suspicious of any target-independent
code that uses it.

-- PMM
Michael S. Tsirkin Aug. 12, 2013, 9:25 a.m. UTC | #2
On Mon, Aug 12, 2013 at 10:17:46AM +0100, Peter Maydell wrote:
> On 12 August 2013 09:49, Michael S. Tsirkin <mst@redhat.com> wrote:
> > Add symbol to make it possible to use target page size
> > in target-independent code.
> 
> Given that TARGET_PAGE_SIZE is "smallest page size the
> TCG implementation currently supports for this core"
> (ie it is a TCG internal implementation detail as much
> as a property of the target CPU and it may well not
> match the actual page size being used by the guest)
> I would be very suspicious of any target-independent
> code that uses it.
> 
> -- PMM

Look at the next patch and the comment justifying its use please.
Point is migration works in units of TARGET_PAGE_SIZE
and expects all RAM blocks to be a multiple of that.

What if we rename this to qemu_migration_page_size ?
Will this address your comment?
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 3ca9381..965076e 100644
--- a/exec.c
+++ b/exec.c
@@ -2659,6 +2659,8 @@  bool virtio_is_big_endian(void)
 
 #endif
 
+uint64_t qemu_target_page_size = TARGET_PAGE_SIZE;
+
 #ifndef CONFIG_USER_ONLY
 bool cpu_physical_memory_is_io(hwaddr phys_addr)
 {
diff --git a/include/exec/memory.h b/include/exec/memory.h
index ebe0d24..3ed747c 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1056,6 +1056,8 @@  void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
                          int is_write, hwaddr access_len);
 
 
+extern uint64_t qemu_target_page_size;
+
 #endif
 
 #endif