[PATCH 2/3] include/exec/target_page.h: move page-target.c to header

Pierrick Bouvier posted 3 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH 2/3] include/exec/target_page.h: move page-target.c to header
Posted by Pierrick Bouvier 2 months, 3 weeks ago
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 meson.build                |  2 +-
 include/exec/target_page.h | 11 ++++++++++-
 page-target.c              | 10 ----------
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/meson.build b/meson.build
index d0ae602c2ee..71c253ba135 100644
--- a/meson.build
+++ b/meson.build
@@ -3910,7 +3910,7 @@ if get_option('b_lto')
   pagevary = declare_dependency(link_with: pagevary)
 endif
 common_ss.add(pagevary)
-specific_ss.add(files('page-target.c', 'page-vary-target.c'))
+specific_ss.add(files('page-vary-target.c'))
 
 common_ss.add(files('target-info.c'))
 specific_ss.add(files('target-info-stub.c'))
diff --git a/include/exec/target_page.h b/include/exec/target_page.h
index ca0ebbc8bbd..813591c9b51 100644
--- a/include/exec/target_page.h
+++ b/include/exec/target_page.h
@@ -62,6 +62,15 @@ static inline int qemu_target_page_bits(void)
     return TARGET_PAGE_BITS;
 }
 
-size_t qemu_target_pages_to_MiB(size_t pages);
+/* Convert target pages to MiB (2**20). */
+static inline size_t qemu_target_pages_to_MiB(size_t pages)
+{
+    int page_bits = TARGET_PAGE_BITS;
+
+    /* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
+    g_assert(page_bits < 20);
+
+    return pages >> (20 - page_bits);
+}
 
 #endif
diff --git a/page-target.c b/page-target.c
index 8fcd5443b52..66f03c61cd4 100644
--- a/page-target.c
+++ b/page-target.c
@@ -9,13 +9,3 @@
 #include "qemu/osdep.h"
 #include "exec/target_page.h"
 
-/* Convert target pages to MiB (2**20). */
-size_t qemu_target_pages_to_MiB(size_t pages)
-{
-    int page_bits = TARGET_PAGE_BITS;
-
-    /* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
-    g_assert(page_bits < 20);
-
-    return pages >> (20 - page_bits);
-}
-- 
2.47.2
Re: [PATCH 2/3] include/exec/target_page.h: move page-target.c to header
Posted by Richard Henderson 2 months, 3 weeks ago
On 7/25/25 10:20, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   meson.build                |  2 +-
>   include/exec/target_page.h | 11 ++++++++++-
>   page-target.c              | 10 ----------
>   3 files changed, 11 insertions(+), 12 deletions(-)

> diff --git a/page-target.c b/page-target.c
> index 8fcd5443b52..66f03c61cd4 100644
> --- a/page-target.c
> +++ b/page-target.c
> @@ -9,13 +9,3 @@
>   #include "qemu/osdep.h"
>   #include "exec/target_page.h"
>   
> -/* Convert target pages to MiB (2**20). */
> -size_t qemu_target_pages_to_MiB(size_t pages)
> -{
> -    int page_bits = TARGET_PAGE_BITS;
> -
> -    /* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
> -    g_assert(page_bits < 20);
> -
> -    return pages >> (20 - page_bits);
> -}

You didn't completely remove the file, though you clearly intended to do so.

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
Re: [PATCH 2/3] include/exec/target_page.h: move page-target.c to header
Posted by Pierrick Bouvier 2 months, 3 weeks ago
On 7/25/25 1:38 PM, Richard Henderson wrote:
> On 7/25/25 10:20, Pierrick Bouvier wrote:
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    meson.build                |  2 +-
>>    include/exec/target_page.h | 11 ++++++++++-
>>    page-target.c              | 10 ----------
>>    3 files changed, 11 insertions(+), 12 deletions(-)
> 
>> diff --git a/page-target.c b/page-target.c
>> index 8fcd5443b52..66f03c61cd4 100644
>> --- a/page-target.c
>> +++ b/page-target.c
>> @@ -9,13 +9,3 @@
>>    #include "qemu/osdep.h"
>>    #include "exec/target_page.h"
>>    
>> -/* Convert target pages to MiB (2**20). */
>> -size_t qemu_target_pages_to_MiB(size_t pages)
>> -{
>> -    int page_bits = TARGET_PAGE_BITS;
>> -
>> -    /* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
>> -    g_assert(page_bits < 20);
>> -
>> -    return pages >> (20 - page_bits);
>> -}
> 
> You didn't completely remove the file, though you clearly intended to do so.
>

Right, thanks.

> Otherwise,
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> 
> r~