Re: [PATCH-for-10.1 v7 5/8] qemu: Convert target_words_bigendian() to TargetInfo API
On 8/7/25 22:51, Philippe Mathieu-Daudé wrote: On 8/7/25 19:39, Richard Henderson wrote: On 7/8/25 11:19, Philippe Mathieu-Daudé wrote: -/** - * target_big_endian: - * Returns true if the (default) endianness of the target is big endian, - * false otherwise. Common code should normally never need to know about the - * endianness of the target, so please do *not* use this function unless you - * know very well what you are doing! - */ ... +/** + * target_big_endian: + * + * Returns: %true if the (default) endianness of the target is big endian, + * %false otherwise. + */ +bool target_big_endian(void); Perhaps retain the warning about not using this unless necessary. This is what I did in a previous version, but Thomas (or Pierrick?) said something about this method now being safe, so the comment obsolete. Bah I'm mixing various conversations, what Pierrick said is different: https://lore.kernel.org/qemu-devel/[email protected]/ I told Pierrick this method doesn't make sense to me in a heterogeneous context, he said to not make change with the current behavior, when run on a vCPU we'll eventually infer via TargetInfo on the vCPU TLS area, and otherwise (I/O thread) this method shouldn't be called so we should abort. Such change LGTM. I can start updating the documentation mentioning "the (default) endianness of the current vCPU." Currently on I/O thread this is the endianness of the binary. Reviewed-by: Richard Henderson r~
Re: [PATCH-for-10.1 v7 5/8] qemu: Convert target_words_bigendian() to TargetInfo API
On 8/7/25 19:39, Richard Henderson wrote: On 7/8/25 11:19, Philippe Mathieu-Daudé wrote: -/** - * target_big_endian: - * Returns true if the (default) endianness of the target is big endian, - * false otherwise. Common code should normally never need to know about the - * endianness of the target, so please do *not* use this function unless you - * know very well what you are doing! - */ ... +/** + * target_big_endian: + * + * Returns: %true if the (default) endianness of the target is big endian, + * %false otherwise. + */ +bool target_big_endian(void); Perhaps retain the warning about not using this unless necessary. This is what I did in a previous version, but Thomas (or Pierrick?) said something about this method now being safe, so the comment obsolete. I told Pierrick this method doesn't make sense to me in a heterogeneous context, he said to not make change with the current behavior, when run on a vCPU we'll eventually infer via TargetInfo on the vCPU TLS area, and otherwise (I/O thread) this method shouldn't be called so we should abort. Such change LGTM. I can start updating the documentation mentioning "the (default) endianness of the current vCPU." Currently on I/O thread this is the endianness of the binary. Reviewed-by: Richard Henderson r~
Re: [PATCH-for-10.1 v7 5/8] qemu: Convert target_words_bigendian() to TargetInfo API
On 7/8/25 10:19 AM, Philippe Mathieu-Daudé wrote: Reviewed-by: Pierrick Bouvier Signed-off-by: Philippe Mathieu-Daudé --- include/exec/tswap.h | 13 + include/qemu/target-info.h | 8 cpu-target.c | 7 --- hw/core/cpu-system.c | 2 +- hw/display/vga.c | 2 +- hw/virtio/virtio.c | 2 +- system/memory.c| 1 + system/qtest.c | 1 + target-info.c | 5 + 9 files changed, 19 insertions(+), 22 deletions(-) Reviewed-by: Pierrick Bouvier
Re: [PATCH-for-10.1 v7 5/8] qemu: Convert target_words_bigendian() to TargetInfo API
On 7/8/25 11:19, Philippe Mathieu-Daudé wrote: -/** - * target_big_endian: - * Returns true if the (default) endianness of the target is big endian, - * false otherwise. Common code should normally never need to know about the - * endianness of the target, so please do *not* use this function unless you - * know very well what you are doing! - */ ... +/** + * target_big_endian: + * + * Returns: %true if the (default) endianness of the target is big endian, + * %false otherwise. + */ +bool target_big_endian(void); Perhaps retain the warning about not using this unless necessary. Reviewed-by: Richard Henderson r~
