All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] exec/cpu: Make host pages variables / macros 'target agnostic'
@ 2022-01-20  0:08 Philippe Mathieu-Daudé via
  2022-01-20 10:18 ` David Hildenbrand
  2022-01-20 13:28 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-01-20  0:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Hildenbrand, Peter Xu, Richard Henderson, Thomas Huth,
	Paolo Bonzini, Peter Maydell, Philippe Mathieu-Daudé

"host" pages are related to the *host* not the *target*,
thus the qemu_host_page_size / qemu_host_page_mask variables
and the HOST_PAGE_ALIGN() / REAL_HOST_PAGE_ALIGN() macros
can be moved to "exec/cpu-common.h" which is target agnostic.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/exec/cpu-all.h    | 9 ---------
 include/exec/cpu-common.h | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index bb37239efa3..84caf5c3d9f 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -234,15 +234,6 @@ extern const TargetPageBits target_page;
 
 #define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
 
-/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
- * when intptr_t is 32-bit and we are aligning a long long.
- */
-extern uintptr_t qemu_host_page_size;
-extern intptr_t qemu_host_page_mask;
-
-#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
-#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
-
 /* same as PROT_xxx */
 #define PAGE_READ      0x0001
 #define PAGE_WRITE     0x0002
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 039d422bf4c..de5f444b193 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -7,6 +7,15 @@
 #include "exec/hwaddr.h"
 #endif
 
+/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
+ * when intptr_t is 32-bit and we are aligning a long long.
+ */
+extern uintptr_t qemu_host_page_size;
+extern intptr_t qemu_host_page_mask;
+
+#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
+#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
+
 /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
 void qemu_init_cpu_list(void);
 void cpu_list_lock(void);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] exec/cpu: Make host pages variables / macros 'target agnostic'
  2022-01-20  0:08 [PATCH] exec/cpu: Make host pages variables / macros 'target agnostic' Philippe Mathieu-Daudé via
@ 2022-01-20 10:18 ` David Hildenbrand
  2022-01-20 13:28 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2022-01-20 10:18 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Thomas Huth, Richard Henderson, Peter Xu, Peter Maydell

On 20.01.22 01:08, Philippe Mathieu-Daudé wrote:
> "host" pages are related to the *host* not the *target*,
> thus the qemu_host_page_size / qemu_host_page_mask variables
> and the HOST_PAGE_ALIGN() / REAL_HOST_PAGE_ALIGN() macros
> can be moved to "exec/cpu-common.h" which is target agnostic.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/exec/cpu-all.h    | 9 ---------
>  include/exec/cpu-common.h | 9 +++++++++
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index bb37239efa3..84caf5c3d9f 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -234,15 +234,6 @@ extern const TargetPageBits target_page;
>  
>  #define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
>  
> -/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
> - * when intptr_t is 32-bit and we are aligning a long long.
> - */
> -extern uintptr_t qemu_host_page_size;
> -extern intptr_t qemu_host_page_mask;
> -
> -#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
> -#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
> -
>  /* same as PROT_xxx */
>  #define PAGE_READ      0x0001
>  #define PAGE_WRITE     0x0002
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index 039d422bf4c..de5f444b193 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -7,6 +7,15 @@
>  #include "exec/hwaddr.h"
>  #endif
>  
> +/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
> + * when intptr_t is 32-bit and we are aligning a long long.
> + */
> +extern uintptr_t qemu_host_page_size;
> +extern intptr_t qemu_host_page_mask;
> +
> +#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
> +#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
> +
>  /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
>  void qemu_init_cpu_list(void);
>  void cpu_list_lock(void);

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] exec/cpu: Make host pages variables / macros 'target agnostic'
  2022-01-20  0:08 [PATCH] exec/cpu: Make host pages variables / macros 'target agnostic' Philippe Mathieu-Daudé via
  2022-01-20 10:18 ` David Hildenbrand
@ 2022-01-20 13:28 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-01-20 13:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Thomas Huth, Richard Henderson, Peter Xu,
	David Hildenbrand

On 1/20/22 01:08, Philippe Mathieu-Daudé via wrote:
> "host" pages are related to the *host* not the *target*,
> thus the qemu_host_page_size / qemu_host_page_mask variables
> and the HOST_PAGE_ALIGN() / REAL_HOST_PAGE_ALIGN() macros
> can be moved to "exec/cpu-common.h" which is target agnostic.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Queued, thanks.

Paolo

> ---
>   include/exec/cpu-all.h    | 9 ---------
>   include/exec/cpu-common.h | 9 +++++++++
>   2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index bb37239efa3..84caf5c3d9f 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -234,15 +234,6 @@ extern const TargetPageBits target_page;
>   
>   #define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
>   
> -/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
> - * when intptr_t is 32-bit and we are aligning a long long.
> - */
> -extern uintptr_t qemu_host_page_size;
> -extern intptr_t qemu_host_page_mask;
> -
> -#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
> -#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
> -
>   /* same as PROT_xxx */
>   #define PAGE_READ      0x0001
>   #define PAGE_WRITE     0x0002
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index 039d422bf4c..de5f444b193 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -7,6 +7,15 @@
>   #include "exec/hwaddr.h"
>   #endif
>   
> +/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
> + * when intptr_t is 32-bit and we are aligning a long long.
> + */
> +extern uintptr_t qemu_host_page_size;
> +extern intptr_t qemu_host_page_mask;
> +
> +#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
> +#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
> +
>   /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
>   void qemu_init_cpu_list(void);
>   void cpu_list_lock(void);



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-20 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20  0:08 [PATCH] exec/cpu: Make host pages variables / macros 'target agnostic' Philippe Mathieu-Daudé via
2022-01-20 10:18 ` David Hildenbrand
2022-01-20 13:28 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.