diff mbox

[RFC,v2,17/34] HACK: globalise TCG page size variables

Message ID dc3af20cd46cfda6f7b849b71b62f31b404c7fce.1433052532.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite May 31, 2015, 6:11 a.m. UTC
This is almost certainly wrong but it should work for my test case
where TARGET_PAGE_SIZE is cross-arch consistent. This is needed to get
vfio/pci.c to compile due to it's use of HOST_PAGE_ALIGN.

Cc: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 translate-all.c    | 4 ----
 translate-common.c | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Richard Henderson June 1, 2015, 6:52 p.m. UTC | #1
On 05/30/2015 11:11 PM, Peter Crosthwaite wrote:
> This is almost certainly wrong but it should work for my test case
> where TARGET_PAGE_SIZE is cross-arch consistent. This is needed to get
> vfio/pci.c to compile due to it's use of HOST_PAGE_ALIGN.
> 
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> ---
>  translate-all.c    | 4 ----
>  translate-common.c | 4 ++++
>  2 files changed, 4 insertions(+), 4 deletions(-)

Actually, this isn't a hack at all, since here we're talking about the HOST
page size.  Which is of course completely independent of the TARGET page sizes.


r~
Peter Crosthwaite June 1, 2015, 6:58 p.m. UTC | #2
On Mon, Jun 1, 2015 at 11:52 AM, Richard Henderson <rth@twiddle.net> wrote:
> On 05/30/2015 11:11 PM, Peter Crosthwaite wrote:
>> This is almost certainly wrong but it should work for my test case
>> where TARGET_PAGE_SIZE is cross-arch consistent. This is needed to get
>> vfio/pci.c to compile due to it's use of HOST_PAGE_ALIGN.
>>
>> Cc: Alex Williamson <alex.williamson@redhat.com>
>> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
>> ---
>>  translate-all.c    | 4 ----
>>  translate-common.c | 4 ++++
>>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> Actually, this isn't a hack at all, since here we're talking about the HOST
> page size.  Which is of course completely independent of the TARGET page sizes.
>

So the real_host_page_size is completely independent, but the
host_page_size (and mask) are clamped with TARGET_PAGE_SIZE. This is
why I am considering this target-arch specific:

 312     if (qemu_host_page_size < TARGET_PAGE_SIZE) {
 313         qemu_host_page_size = TARGET_PAGE_SIZE;
 314     }
 315     qemu_host_page_mask = ~(qemu_host_page_size - 1);

Regards,
Peter

>
> r~
>
diff mbox

Patch

diff --git a/translate-all.c b/translate-all.c
index bf0d689..4854828 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -117,10 +117,6 @@  typedef struct PageDesc {
 
 #define V_L1_SHIFT (L1_MAP_ADDR_SPACE_BITS - TARGET_PAGE_BITS - V_L1_BITS)
 
-uintptr_t qemu_real_host_page_size;
-uintptr_t qemu_host_page_size;
-uintptr_t qemu_host_page_mask;
-
 /* This is a multi-level map on the virtual address space.
    The bottom level has pointers to PageDesc.  */
 static void *l1_map[V_L1_SIZE];
diff --git a/translate-common.c b/translate-common.c
index 806b36e..586d89a 100644
--- a/translate-common.c
+++ b/translate-common.c
@@ -21,6 +21,10 @@ 
 #include "qemu-common.h"
 #include "qom/cpu.h"
 
+uintptr_t qemu_real_host_page_size;
+uintptr_t qemu_host_page_size;
+uintptr_t qemu_host_page_mask;
+
 #ifndef CONFIG_USER_ONLY
 /* mask must never be zero, except for A20 change call */
 static void tcg_handle_interrupt(CPUState *cpu, int mask)