fw_cfg: the I/O port variant expects little-endian
PATCH 1/1 fw_cfg: the I/O port variant expects little-endian
The I/O port variant of fw_cfg is used by sparc64, which is a big-endian machine. Firmware swaps bytes before sending them to fw_cfg, so we need to unswap them in the device.
This is only used on sparc64 and on (little-endian) x86, so it does not affect any other target. 32-bit Sparc and PPC all use memory-mapped fw_cfg.
--- hw/nvram/fw_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvram/fw_cfg.c +1 -1
@@ -324,7 +324,7 @@ static const MemoryRegionOps fw_cfg_data_mem_ops = {static const MemoryRegionOps fw_cfg_comb_mem_ops = { .read = fw_cfg_comb_read, .write = fw_cfg_comb_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_LITTLE_ENDIAN , .valid.accepts = fw_cfg_comb_valid, };
Signature · 1 line
1.8.1.4
Quoted 18 lines · Paolo Bonzini
The I/O port variant of
fw_cfgis used by sparc64, which is a big-endian machine. Firmware swaps bytes before sending them tofw_cfg, so we need to unswap them in the device.This is only used on sparc64 and on (little-endian) x86, so it does not affect any other target. 32-bit Sparc and PPC all use memory-mapped
fw_cfg.Reported-by Mark Cave-Ayland<[email protected]>Signed-off-by Paolo Bonzini<[email protected]>--- hw/nvram/fw_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/nvram/fw_cfg.c +0
-0
hw/nvram/fw_cfg.c static const MemoryRegionOps fw_cfg_data_mem_ops = { · line 329
Quoted 7 lines
hw/nvram/fw_cfg.c +1
-1@@ -324,7 +324,7 @@ static const MemoryRegionOps fw_cfg_data_mem_ops = {static const MemoryRegionOps fw_cfg_comb_mem_ops = { .read = fw_cfg_comb_read, .write = fw_cfg_comb_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_LITTLE_ENDIAN , .valid.accepts = fw_cfg_comb_valid, };
Hi Paolo,
I can confirm that this fixes SPARC64 boot for me - thanks!
ATB,
Mark.
[Qemu-devel] PING for-1.6 Re: [PATCH for-1.6] fw_cfg: the I/O port variant expects little-endian
In reply to Paolo BonziniQuoted 19 lines · Paolo Bonzini
The I/O port variant of
fw_cfgis used by sparc64, which is a big-endian machine. Firmware swaps bytes before sending them tofw_cfg, so we need to unswap them in the device.This is only used on sparc64 and on (little-endian) x86, so it does not affect any other target. 32-bit Sparc and PPC all use memory-mapped
fw_cfg.Reported-by Mark Cave-Ayland <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- hw/nvram/fw_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/nvram/fw_cfg.c +0
-0
hw/nvram/fw_cfg.c static const MemoryRegionOps fw_cfg_data_mem_ops = { · line 330
Quoted 8 lines
hw/nvram/fw_cfg.c +1
-1@@ -324,7 +324,7 @@ static const MemoryRegionOps fw_cfg_data_mem_ops = {static const MemoryRegionOps fw_cfg_comb_mem_ops = { .read = fw_cfg_comb_read, .write = fw_cfg_comb_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_LITTLE_ENDIAN , .valid.accepts = fw_cfg_comb_valid, };
Ping.
Laszlo Ersek
Reviewed-byRe: [Qemu-devel] PING for-1.6 Re: [PATCH for-1.6] fw_cfg: the I/O port variant expects little-endian
Quoted 17 lines · Paolo Bonzini
Quoted 16 lines · Paolo Bonzini
The I/O port variant of
fw_cfgis used by sparc64, which is a big-endian machine.
Firmware swaps bytes before sending them tofw_cfg, so we need to unswap them in
the device.This is only used on sparc64 and on (little-endian) x86, so it does not affect
any other target. 32-bit Sparc and PPC all use memory-mappedfw_cfg.Reported-by Mark Cave-Ayland <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- hw/nvram/fw_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 6 lines
hw/nvram/fw_cfg.c +0
-0hw/nvram/fw_cfg.c static const MemoryRegionOps fw_cfg_data_mem_ops = { · line 330
Quoted 8 lines
hw/nvram/fw_cfg.c +1
-1@@ -324,7 +324,7 @@ static const MemoryRegionOps fw_cfg_data_mem_ops = {static const MemoryRegionOps fw_cfg_comb_mem_ops = { .read = fw_cfg_comb_read, .write = fw_cfg_comb_write, - .endianness =DEVICE_NATIVE_ENDIAN , + .endianness =DEVICE_LITTLE_ENDIAN , .valid.accepts = fw_cfg_comb_valid, };Ping.
Not sure if you were asking for a review, but the patch and the argument in the commit msg look sane to me.
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori