qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/vfio/helpers: Check base architecture at runtime
@ 2025-10-20 22:23 Philippe Mathieu-Daudé
  2025-10-20 23:01 ` Pierrick Bouvier
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-20 22:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Avihai Horon, Fabiano Rosas, Alex Williamson,
	Maciej S . Szmigiero, Pierrick Bouvier, Anton Johansson,
	Cédric Le Goater, Zhao Liu, Luc Michel,
	Philippe Mathieu-Daudé

Replace the compile time check of the TARGET_ARM definition
by a runtime call to target_base_arm().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Based-on: <20251020220941.65269-1-philmd@linaro.org>
---
 hw/vfio/helpers.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c
index 23d13e5db5f..007c37b28b8 100644
--- a/hw/vfio/helpers.c
+++ b/hw/vfio/helpers.c
@@ -20,6 +20,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/target-info.h"
 #include <sys/ioctl.h>
 
 #include "system/kvm.h"
@@ -220,9 +221,5 @@ bool vfio_arch_wants_loading_config_after_iter(void)
      * See commit d329f5032e17 ("vfio: Move the saving of the config space to
      * the right place in VFIO migration").
      */
-#if defined(TARGET_ARM)
-    return true;
-#else
-    return false;
-#endif
+    return target_base_arm();
 }
-- 
2.51.0



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

* Re: [PATCH] hw/vfio/helpers: Check base architecture at runtime
  2025-10-20 22:23 [PATCH] hw/vfio/helpers: Check base architecture at runtime Philippe Mathieu-Daudé
@ 2025-10-20 23:01 ` Pierrick Bouvier
  2025-10-21  7:05 ` Cédric Le Goater
  2025-10-21 15:24 ` Maciej S. Szmigiero
  2 siblings, 0 replies; 5+ messages in thread
From: Pierrick Bouvier @ 2025-10-20 23:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Avihai Horon, Fabiano Rosas, Alex Williamson,
	Maciej S . Szmigiero, Anton Johansson, Cédric Le Goater,
	Zhao Liu, Luc Michel

On 2025-10-20 15:23, Philippe Mathieu-Daudé wrote:
> Replace the compile time check of the TARGET_ARM definition
> by a runtime call to target_base_arm().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Based-on: <20251020220941.65269-1-philmd@linaro.org>
> ---
>   hw/vfio/helpers.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



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

* Re: [PATCH] hw/vfio/helpers: Check base architecture at runtime
  2025-10-20 22:23 [PATCH] hw/vfio/helpers: Check base architecture at runtime Philippe Mathieu-Daudé
  2025-10-20 23:01 ` Pierrick Bouvier
@ 2025-10-21  7:05 ` Cédric Le Goater
  2025-10-21  7:56   ` Philippe Mathieu-Daudé
  2025-10-21 15:24 ` Maciej S. Szmigiero
  2 siblings, 1 reply; 5+ messages in thread
From: Cédric Le Goater @ 2025-10-21  7:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Avihai Horon, Fabiano Rosas, Alex Williamson,
	Maciej S . Szmigiero, Pierrick Bouvier, Anton Johansson, Zhao Liu,
	Luc Michel

On 10/21/25 00:23, Philippe Mathieu-Daudé wrote:
> Replace the compile time check of the TARGET_ARM definition
> by a runtime call to target_base_arm().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Based-on: <20251020220941.65269-1-philmd@linaro.org>
> ---
>   hw/vfio/helpers.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c
> index 23d13e5db5f..007c37b28b8 100644
> --- a/hw/vfio/helpers.c
> +++ b/hw/vfio/helpers.c
> @@ -20,6 +20,7 @@
>    */
>   
>   #include "qemu/osdep.h"
> +#include "qemu/target-info.h"
>   #include <sys/ioctl.h>
>   
>   #include "system/kvm.h"
> @@ -220,9 +221,5 @@ bool vfio_arch_wants_loading_config_after_iter(void)
>        * See commit d329f5032e17 ("vfio: Move the saving of the config space to
>        * the right place in VFIO migration").
>        */
> -#if defined(TARGET_ARM)
> -    return true;
> -#else
> -    return false;
> -#endif
> +    return target_base_arm();


is that a new helper ? I don't see it being used anywhere else.

Thanks,

C.



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

* Re: [PATCH] hw/vfio/helpers: Check base architecture at runtime
  2025-10-21  7:05 ` Cédric Le Goater
@ 2025-10-21  7:56   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21  7:56 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-devel
  Cc: Avihai Horon, Fabiano Rosas, Alex Williamson,
	Maciej S . Szmigiero, Pierrick Bouvier, Anton Johansson, Zhao Liu,
	Luc Michel

On 21/10/25 09:05, Cédric Le Goater wrote:
> On 10/21/25 00:23, Philippe Mathieu-Daudé wrote:
>> Replace the compile time check of the TARGET_ARM definition
>> by a runtime call to target_base_arm().
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> Based-on: <20251020220941.65269-1-philmd@linaro.org>
>> ---
>>   hw/vfio/helpers.c | 7 ++-----
>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c
>> index 23d13e5db5f..007c37b28b8 100644
>> --- a/hw/vfio/helpers.c
>> +++ b/hw/vfio/helpers.c
>> @@ -20,6 +20,7 @@
>>    */
>>   #include "qemu/osdep.h"
>> +#include "qemu/target-info.h"
>>   #include <sys/ioctl.h>
>>   #include "system/kvm.h"
>> @@ -220,9 +221,5 @@ bool vfio_arch_wants_loading_config_after_iter(void)
>>        * See commit d329f5032e17 ("vfio: Move the saving of the config 
>> space to
>>        * the right place in VFIO migration").
>>        */
>> -#if defined(TARGET_ARM)
>> -    return true;
>> -#else
>> -    return false;
>> -#endif
>> +    return target_base_arm();
> 
> 
> is that a new helper ? I don't see it being used anywhere else.

Linked in the Based-on tag after the S-o-b:
https://lore.kernel.org/qemu-devel/20251020221508.67413-5-philmd@linaro.org/


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

* Re: [PATCH] hw/vfio/helpers: Check base architecture at runtime
  2025-10-20 22:23 [PATCH] hw/vfio/helpers: Check base architecture at runtime Philippe Mathieu-Daudé
  2025-10-20 23:01 ` Pierrick Bouvier
  2025-10-21  7:05 ` Cédric Le Goater
@ 2025-10-21 15:24 ` Maciej S. Szmigiero
  2 siblings, 0 replies; 5+ messages in thread
From: Maciej S. Szmigiero @ 2025-10-21 15:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Avihai Horon, Fabiano Rosas, Alex Williamson, Pierrick Bouvier,
	Anton Johansson, Cédric Le Goater, Zhao Liu, Luc Michel

On 21.10.2025 00:23, Philippe Mathieu-Daudé wrote:
> Replace the compile time check of the TARGET_ARM definition
> by a runtime call to target_base_arm().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Based-on: <20251020220941.65269-1-philmd@linaro.org>
> ---
>   hw/vfio/helpers.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c
> index 23d13e5db5f..007c37b28b8 100644
> --- a/hw/vfio/helpers.c
> +++ b/hw/vfio/helpers.c
> @@ -20,6 +20,7 @@
>    */
>   
>   #include "qemu/osdep.h"
> +#include "qemu/target-info.h"
>   #include <sys/ioctl.h>
>   
>   #include "system/kvm.h"
> @@ -220,9 +221,5 @@ bool vfio_arch_wants_loading_config_after_iter(void)
>        * See commit d329f5032e17 ("vfio: Move the saving of the config space to
>        * the right place in VFIO migration").
>        */
> -#if defined(TARGET_ARM)
> -    return true;
> -#else
> -    return false;
> -#endif
> +    return target_base_arm();
>   }

The only reason why vfio_arch_wants_loading_config_after_iter() was
introduced is that its only caller (vfio_load_config_after_iter())
lives in a target-independent file (migration-multifd.c) so it could
not test TARGET_ARM directly, see:
https://lore.kernel.org/qemu-devel/8a541c48-15d9-4609-bad7-a1606eeff22e@maciej.szmigiero.name/

If target-independent-safe target_base_arm() were to be used instead
I think this helper won't make sense anymore and so this target_base_arm()
call (and the associated comment) should be moved to vfio_load_config_after_iter().

Thanks,
Maciej



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

end of thread, other threads:[~2025-10-21 15:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 22:23 [PATCH] hw/vfio/helpers: Check base architecture at runtime Philippe Mathieu-Daudé
2025-10-20 23:01 ` Pierrick Bouvier
2025-10-21  7:05 ` Cédric Le Goater
2025-10-21  7:56   ` Philippe Mathieu-Daudé
2025-10-21 15:24 ` Maciej S. Szmigiero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).