From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Thomas Huth" <thuth@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Jason Wang" <jasowang@redhat.com>,
"Aleksandar Rikalo" <arikalo@gmail.com>,
"Anton Johansson" <anjo@rev.ng>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Sven Schnelle" <svens@stackframe.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
qemu-arm@nongnu.org, "Aurelien Jarno" <aurelien@aurel32.net>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Paul Burton" <paulburton@kernel.org>
Subject: Re: [PATCH 05/13] hw/mips: Add cpu_is_bigendian field to BlCpuCfg structure
Date: Tue, 1 Oct 2024 09:50:27 -0700 [thread overview]
Message-ID: <ea167bba-5677-48aa-b755-a6e5d87b8399@linaro.org> (raw)
In-Reply-To: <20240930073450.33195-6-philmd@linaro.org>
On 9/30/24 00:34, Philippe Mathieu-Daudé wrote:
> Add the BlCpuCfg::cpu_is_bigendian field, initialize it in
> machine code. Bootloader API use the ld/st_endian_p() to
> dispatch to target endianness.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/mips/bootloader.h | 1 +
> hw/mips/bootloader.c | 10 +++++-----
> hw/mips/boston.c | 2 +-
> hw/mips/fuloong2e.c | 2 +-
> hw/mips/malta.c | 2 +-
> 5 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/include/hw/mips/bootloader.h b/include/hw/mips/bootloader.h
> index 744eb11d0e..ef778a38d0 100644
> --- a/include/hw/mips/bootloader.h
> +++ b/include/hw/mips/bootloader.h
> @@ -13,6 +13,7 @@
> #include "exec/target_long.h"
>
> typedef struct bl_cpu_cfg {
> + bool cpu_is_bigendian;
> } BlCpuCfg;
>
> void bl_gen_jump_to(const BlCpuCfg *cfg, void **p, target_ulong jump_addr);
> diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c
> index ee1a1c4f20..258cc5d8c8 100644
> --- a/hw/mips/bootloader.c
> +++ b/hw/mips/bootloader.c
> @@ -58,9 +58,9 @@ static void st_nm32_p(const BlCpuCfg *cfg, void **ptr, uint32_t insn)
> {
> uint16_t *p = *ptr;
>
> - stw_p(p, insn >> 16);
> + stw_endian_p(cfg->cpu_is_bigendian, p, insn >> 16);
> p++;
> - stw_p(p, insn >> 0);
> + stw_endian_p(cfg->cpu_is_bigendian, p, insn >> 0);
> p++;
>
> *ptr = p;
> @@ -74,7 +74,7 @@ static void bl_gen_nop(const BlCpuCfg *cfg, void **ptr)
> } else {
> uint32_t *p = *ptr;
>
> - stl_p(p, 0);
> + stl_endian_p(cfg->cpu_is_bigendian, p, 0);
> p++;
> *ptr = p;
> }
> @@ -95,7 +95,7 @@ static void bl_gen_r_type(const BlCpuCfg *cfg,
> insn = deposit32(insn, 6, 5, shift);
> insn = deposit32(insn, 0, 6, funct);
>
> - stl_p(p, insn);
> + stl_endian_p(cfg->cpu_is_bigendian, p, insn);
> p++;
>
> *ptr = p;
> @@ -113,7 +113,7 @@ static void bl_gen_i_type(const BlCpuCfg *cfg,
> insn = deposit32(insn, 16, 5, rt);
> insn = deposit32(insn, 0, 16, imm);
>
> - stl_p(p, insn);
> + stl_endian_p(cfg->cpu_is_bigendian, p, insn);
> p++;
>
> *ptr = p;
> diff --git a/hw/mips/boston.c b/hw/mips/boston.c
> index 8e210876e1..d4dd242d0d 100644
> --- a/hw/mips/boston.c
> +++ b/hw/mips/boston.c
> @@ -325,7 +325,7 @@ type_init(boston_register_types)
>
> static void gen_firmware(void *p, hwaddr kernel_entry, hwaddr fdt_addr)
> {
> - const BlCpuCfg bl_cfg = { };
> + const BlCpuCfg bl_cfg = { .cpu_is_bigendian = TARGET_BIG_ENDIAN };
> uint64_t regaddr;
>
> /* Move CM GCRs */
> diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
> index a989637d3b..4fe5108845 100644
> --- a/hw/mips/fuloong2e.c
> +++ b/hw/mips/fuloong2e.c
> @@ -165,7 +165,7 @@ static uint64_t load_kernel(MIPSCPU *cpu)
> static void write_bootloader(CPUMIPSState *env, uint8_t *base,
> uint64_t kernel_addr)
> {
> - const BlCpuCfg bl_cfg = { };
> + const BlCpuCfg bl_cfg = { .cpu_is_bigendian = false };
> uint32_t *p;
>
> /* Small bootloader */
> diff --git a/hw/mips/malta.c b/hw/mips/malta.c
> index fc485cc884..6e73c896ff 100644
> --- a/hw/mips/malta.c
> +++ b/hw/mips/malta.c
> @@ -624,7 +624,7 @@ static void bl_setup_gt64120_jump_kernel(void **p, uint64_t run_addr,
> static const char pci_pins_cfg[PCI_NUM_PINS] = {
> 10, 10, 11, 11 /* PIIX IRQRC[A:D] */
> };
> - const BlCpuCfg bl_cfg = { };
> + const BlCpuCfg bl_cfg = { .cpu_is_bigendian = TARGET_BIG_ENDIAN };
>
> /* Bus endianness is always reversed */
> #if TARGET_BIG_ENDIAN
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
next prev parent reply other threads:[~2024-10-01 16:51 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 7:34 [PATCH 00/13] hw: Add ld/st_endian() APIs Philippe Mathieu-Daudé
2024-09-30 7:34 ` [PATCH 01/13] qemu/bswap: Introduce ld/st_endian_p() API Philippe Mathieu-Daudé
2024-10-01 16:45 ` Pierrick Bouvier
2024-10-03 20:50 ` Philippe Mathieu-Daudé
2024-10-03 21:28 ` Richard Henderson
2024-10-03 21:34 ` Philippe Mathieu-Daudé
2024-10-03 21:37 ` Richard Henderson
2024-10-03 21:46 ` Philippe Mathieu-Daudé
2024-09-30 7:34 ` [PATCH 02/13] hw/virtio/virtio-access: Use the " Philippe Mathieu-Daudé
2024-10-01 16:46 ` Pierrick Bouvier
2024-09-30 7:34 ` [PATCH 03/13] target/arm/ptw: " Philippe Mathieu-Daudé
2024-10-01 16:46 ` Pierrick Bouvier
2024-09-30 7:34 ` [PATCH 04/13] hw/mips: Pass BlCpuCfg argument to bootloader API Philippe Mathieu-Daudé
2024-10-01 16:49 ` Pierrick Bouvier
2024-09-30 7:34 ` [PATCH 05/13] hw/mips: Add cpu_is_bigendian field to BlCpuCfg structure Philippe Mathieu-Daudé
2024-10-01 16:50 ` Pierrick Bouvier [this message]
2024-09-30 7:34 ` [PATCH 06/13] tests/tcg/plugins: Use the ld/st_endian_p() API Philippe Mathieu-Daudé
2024-10-01 16:50 ` Pierrick Bouvier
2024-10-02 12:18 ` Alex Bennée
2024-09-30 7:34 ` [PATCH 07/13] hw/xtensa/xtfpga: Remove TARGET_BIG_ENDIAN #ifdef'ry Philippe Mathieu-Daudé
2024-09-30 14:28 ` Thomas Huth
2024-10-01 16:51 ` Pierrick Bouvier
2024-10-03 21:35 ` Richard Henderson
2024-10-10 18:08 ` Philippe Mathieu-Daudé
2024-09-30 7:34 ` [PATCH 08/13] hw/xtensa/xtfpga: Replace memcpy()+tswap32() by stl_endian_p() Philippe Mathieu-Daudé
2024-09-30 14:32 ` Thomas Huth
2024-10-03 16:02 ` Philippe Mathieu-Daudé
2024-10-03 16:04 ` Pierrick Bouvier
2024-10-03 20:48 ` Philippe Mathieu-Daudé
2024-10-03 21:31 ` Pierrick Bouvier
2024-10-03 21:34 ` Pierrick Bouvier
2024-10-03 21:40 ` Philippe Mathieu-Daudé
2024-10-04 6:44 ` Thomas Huth
2024-10-04 14:08 ` Richard Henderson
2024-09-30 7:34 ` [PATCH 09/13] exec/memory_ldst_phys: Introduce ld/st_endian_phys() API Philippe Mathieu-Daudé
2024-10-01 16:54 ` Pierrick Bouvier
2024-10-03 21:39 ` Richard Henderson
2024-10-03 21:47 ` Richard Henderson
2024-09-30 7:34 ` [PATCH 10/13] hw/virtio/virtio-access: Use " Philippe Mathieu-Daudé
2024-10-01 16:54 ` Pierrick Bouvier
2024-09-30 7:34 ` [PATCH 11/13] hw/pci/pci_device: Add PCI_DMA_DEFINE_LDST_END() macro Philippe Mathieu-Daudé
2024-10-01 16:56 ` Pierrick Bouvier
2024-09-30 7:34 ` [PATCH 12/13] hw/pci/pci_device: Introduce ld/st_endian_pci_dma() API Philippe Mathieu-Daudé
2024-10-01 16:57 ` Pierrick Bouvier
2024-10-03 22:04 ` Richard Henderson
2024-09-30 7:34 ` [PATCH 13/13] hw/net/tulip: Use " Philippe Mathieu-Daudé
2024-10-01 16:57 ` Pierrick Bouvier
2024-10-03 22:10 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea167bba-5677-48aa-b755-a6e5d87b8399@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=anjo@rev.ng \
--cc=arikalo@gmail.com \
--cc=aurelien@aurel32.net \
--cc=chenhuacai@kernel.org \
--cc=erdnaxe@crans.org \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=ma.mandourr@gmail.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=paulburton@kernel.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=svens@stackframe.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).