Skip to content

RFC Declare device little or big endian

Tony Nguyen qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest17 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17hw/audio: Declare device little or big endianhw/audio/cs4231.c hw/audio/marvell_88w8618.c hw/audio/milkymist-ac97.c +1 more+4 -40 replies
2/17hw/block: Declare device little or big endianhw/block/onenand.c+1 -10 replies
3/17hw/char: Declare device little or big endianhw/char/cadence_uart.c hw/char/escc.c hw/char/etraxfs_ser.c +5 more+8 -80 replies
4/17hw/display: Declare device little or big endianhw/display/pl110.c hw/display/tc6393xb.c+2 -20 replies
5/17hw/dma: Declare device little or big endianhw/dma/bcm2835_dma.c hw/dma/etraxfs_dma.c hw/dma/pl080.c +3 more+7 -70 replies
6/17hw/gpio: Declare device little or big endianhw/gpio/pl061.c hw/gpio/zaurus.c+2 -20 replies
7/17hw/i2c: Declare device little or big endianhw/i2c/imx_i2c.c hw/i2c/mpc_i2c.c hw/i2c/versatile_i2c.c+3 -31 reply
8/17hw/input: Declare device little or big endianhw/input/pl050.c+1 -10 replies
9/17hw/intc: Declare device little or big endianhw/intc/arm_gic.c hw/intc/arm_gicv3.c hw/intc/etraxfs_pic.c +4 more+13 -130 replies
10/17hw/isa: Declare device little or big endianhw/isa/vt82c686.c+1 -10 replies
11/17hw/misc: Declare device little or big endianhw/misc/a9scu.c hw/misc/applesmc.c hw/misc/arm11scu.c +2 more+7 -70 replies
12/17hw/net: Declare device little or big endianhw/net/allwinner_emac.c hw/net/imx_fec.c hw/net/lan9118.c +3 more+7 -70 replies
13/17hw/pci-host: Declare device little or big endianhw/pci-host/q35.c hw/pci-host/versatile.c+3 -30 replies
14/17hw/sd: Declare device little or big endianhw/sd/pl181.c+1 -10 replies
15/17hw/ssi: Declare device little or big endianhw/ssi/mss-spi.c hw/ssi/pl022.c hw/ssi/stm32f2xx_spi.c +1 more+4 -40 replies
16/17hw/timer: Declare device little or big endianhw/timer/a9gtimer.c hw/timer/arm_mptimer.c hw/timer/arm_timer.c +13 more+19 -190 replies
17/17build: Correct non-common common-obj-* to obj-*hw/audio/Makefile.objs hw/block/Makefile.objs hw/char/Makefile.objs +15 more+34 -331 reply

Reviews trailers per patch

1 of 17 patches has a Reviewed-by or Acked-by.

PatchDavid Gibson
1/17
2/17
3/17
4/17
5/17
6/17
7/17A-b
8/17
9/17
10/17
11/17
12/17
13/17
14/17
15/17
16/17
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [RFC PATCH 00/17] Declare device little or big endian

This series is an attempt to re-declare devices with DEVICE_NATIVE_ENDIAN as DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN.

This clean up was split out from an earlier series which collapsed byte swaps along the I/O path.

Quoted 11 lines · Paolo Bonzini
Quoted 7 lines · On 07/08/19 10:31, tony.nguyen@bt wrote:

Device realizing code with MemorRegionOps endianness as DEVICE_NATIVE_ENDIAN is not common code.

Corrected devices were identified by making the declaration of DEVICE_NATIVE_ENDIAN conditional upon NEED_CPU_H and then listing what failed to compile.

The general approach makes sense. However, most of these should not be DEVICE_NATIVE_ENDIAN. I can help with some of them.

An RFC as most devices I have never heard of... a collective effort is needed =)

Quoted 4 lines · Peter Maydell

OTOH it's worth noting that it's quite likely that most of the implementations of these DEVICE_NATIVE_ENDIAN devices picked it in an equally naive way, by just copying some other device's code...

I am starting off with the following *naive* approach.

For each device declared with DEVICE_NATIVE_ENDIAN, find the set of targets from the set of target/hw/*/device.o.

If the set of targets are all little or all big endian, re-declare the device endianness as DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN respectively.

This *naive* deduction may result in genuinely native endian devices being incorrectly declared as little or big endian, but should not introduce regressions for current targets.

Please help spot devices which are genuinely native endian.

Thanks!

Tony Nguyen (17):
hw/audio: Declare device little or big endian hw/block: Declare device little or big endian hw/char: Declare device little or big endian hw/display: Declare device little or big endian hw/dma: Declare device little or big endian hw/gpio: Declare device little or big endian hw/i2c: Declare device little or big endian hw/input: Declare device little or big endian hw/intc: Declare device little or big endian hw/isa: Declare device little or big endian hw/misc: Declare device little or big endian hw/net: Declare device little or big endian hw/pci-host: Declare device little or big endian hw/sd: Declare device little or big endian hw/ssi: Declare device little or big endian hw/timer: Declare device little or big endian
build: Correct non-common common-obj-* to obj-*

 hw/audio/Makefile.objs      |  3 ++-
 hw/audio/cs4231.c           |  2 +-
 hw/audio/marvell_88w8618.c  |  2 +-
 hw/audio/milkymist-ac97.c   |  2 +-
 hw/audio/pl041.c            |  2 +-
 hw/block/Makefile.objs      |  6 +++---
 hw/block/onenand.c          |  2 +-
 hw/char/Makefile.objs       |  4 ++--
 hw/char/cadence_uart.c      |  2 +-
 hw/char/escc.c              |  2 +-
 hw/char/etraxfs_ser.c       |  2 +-
 hw/char/grlib_apbuart.c     |  2 +-
 hw/char/imx_serial.c        |  2 +-
 hw/char/lm32_uart.c         |  2 +-
 hw/char/milkymist-uart.c    |  2 +-
 hw/char/pl011.c             |  2 +-
 hw/core/Makefile.objs       |  2 +-
 hw/display/Makefile.objs    |  6 +++---
 hw/display/pl110.c          |  2 +-
 hw/display/tc6393xb.c       |  2 +-
 hw/dma/Makefile.objs        |  6 +++---
 hw/dma/bcm2835_dma.c        |  4 ++--
 hw/dma/etraxfs_dma.c        |  2 +-
 hw/dma/pl080.c              |  2 +-
 hw/dma/pl330.c              |  2 +-
 hw/dma/puv3_dma.c           |  2 +-
 hw/dma/sparc32_dma.c        |  2 +-
 hw/gpio/Makefile.objs       |  2 +-
 hw/gpio/pl061.c             |  2 +-
 hw/gpio/zaurus.c            |  2 +-
 hw/i2c/Makefile.objs        |  2 +-
 hw/i2c/imx_i2c.c            |  2 +-
 hw/i2c/mpc_i2c.c            |  2 +-
 hw/i2c/versatile_i2c.c      |  2 +-
 hw/input/Makefile.objs      |  2 +-
 hw/input/pl050.c            |  2 +-
 hw/intc/Makefile.objs       |  6 +++---
 hw/intc/arm_gic.c           | 12 ++++++------
 hw/intc/arm_gicv3.c         |  4 ++--
 hw/intc/etraxfs_pic.c       |  2 +-
 hw/intc/imx_avic.c          |  2 +-
 hw/intc/imx_gpcv2.c         |  2 +-
 hw/intc/pl190.c             |  2 +-
 hw/intc/puv3_intc.c         |  2 +-
 hw/ipack/Makefile.objs      |  2 +-
 hw/isa/vt82c686.c           |  2 +-
 hw/misc/Makefile.objs       | 10 +++++-----
 hw/misc/a9scu.c             |  2 +-
 hw/misc/applesmc.c          |  6 +++---
 hw/misc/arm11scu.c          |  2 +-
 hw/misc/arm_l2x0.c          |  2 +-
 hw/misc/puv3_pm.c           |  2 +-
 hw/net/Makefile.objs        |  2 +-
 hw/net/allwinner_emac.c     |  2 +-
 hw/net/imx_fec.c            |  2 +-
 hw/net/lan9118.c            |  4 ++--
 hw/net/lance.c              |  2 +-
 hw/net/smc91c111.c          |  2 +-
 hw/net/stellaris_enet.c     |  2 +-
 hw/pci-host/Makefile.objs   |  2 +-
 hw/pci-host/q35.c           |  2 +-
 hw/pci-host/versatile.c     |  4 ++--
 hw/scsi/Makefile.objs       |  2 +-
 hw/sd/pl181.c               |  2 +-
 hw/ssi/Makefile.objs        |  2 +-
 hw/ssi/mss-spi.c            |  2 +-
 hw/ssi/pl022.c              |  2 +-
 hw/ssi/stm32f2xx_spi.c      |  2 +-
 hw/ssi/xilinx_spips.c       |  2 +-
 hw/timer/Makefile.objs      |  6 +++---
 hw/timer/a9gtimer.c         |  4 ++--
 hw/timer/arm_mptimer.c      |  4 ++--
 hw/timer/arm_timer.c        |  4 ++--
 hw/timer/armv7m_systick.c   |  2 +-
 hw/timer/aspeed_rtc.c       |  2 +-
 hw/timer/cadence_ttc.c      |  2 +-
 hw/timer/grlib_gptimer.c    |  2 +-
 hw/timer/hpet.c             |  2 +-
 hw/timer/imx_epit.c         |  2 +-
 hw/timer/imx_gpt.c          |  2 +-
 hw/timer/lm32_timer.c       |  2 +-
 hw/timer/milkymist-sysctl.c |  2 +-
 hw/timer/mss-timer.c        |  2 +-
 hw/timer/pl031.c            |  2 +-
 hw/timer/stm32f2xx_timer.c  |  2 +-
 hw/timer/sun4v-rtc.c        |  2 +-
 hw/virtio/Makefile.objs     |  2 +-
 87 files changed, 117 insertions(+), 116 deletions(-)
Signature · 1 line
2.23.0