Skip to contentSkip to conversation

I2C/IPMI bug fixes for QEMU 6.1

GIT PULL Corey Minyard 3 participants 5 messages Jul 6, 2021 – Jul 8, 2021

lore
Share & tools
lore
#0 lore raw

The following changes since commit 38848ce565849e5b867a5e08022b3c755039c11a:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210616' into staging (2021-06-16 17:02:30 +0100)

are available in the Git repository at:

https://github.com/cminyard/qemu.git tags/for-qemu-6.1-1

for you to fetch changes up to 7051d605e6b03259e0185dd574f760b93d15fa10:

ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct (2021-06-25 08:54:57 -0500)

----------------------------------------------------------------
Some qemu updates for IPMI and I2C

Move some ADC file to where they belong and move some sensors to a sensor directory, since with new BMCs coming in lots of different sensors should be coming in. Keep from cluttering things up.

Add support for I2C PMBus devices.

Replace the confusing and error-prone i2c_send_recv and i2c_transfer with specific send and receive functions. Several errors have already been made with these, avoid any new errors.

Fix the watchdog_expired field in the IPMI watchdog, it's not a bool, it's a u8. After a vmstate transfer, the new value could be wrong.

----------------------------------------------------------------
BALATON Zoltan (1):
hw/i2c: Make i2c_start_transfer() direction argument a boolean

Corey Minyard (3):
adc: Move the zynq-xadc file to the adc directories
adc: Move the max111x driver to the adc directory
sensor: Move hardware sensors from misc to a sensor directory

Jinhua Cao (1):
ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct

Philippe Mathieu-Daudé (14):
hw/input/lm832x: Move lm832x_key_event() declaration to "lm832x.h" hw/input/lm832x: Define TYPE_LM8323 in public header hw/display/sm501: Simplify sm501_i2c_write() logic hw/display/sm501: Replace i2c_send_recv() by i2c_recv() & i2c_send() hw/i2c/ppc4xx_i2c: Add reference to datasheet hw/i2c/ppc4xx_i2c: Replace i2c_send_recv() by i2c_recv() & i2c_send() hw/misc/auxbus: Fix MOT/classic I2C mode
hw/misc/auxbus: Explode READ_I2C / WRITE_I2C_MOT cases hw/misc/auxbus: Replace 'is_write' boolean by its value hw/misc/auxbus: Replace i2c_send_recv() by i2c_recv() & i2c_send() hw/i2c: Remove confusing i2c_send_recv()
hw/i2c: Rename i2c_set_slave_address() -> i2c_slave_set_address() hw/i2c: Extract i2c_do_start_transfer() from i2c_start_transfer() hw/i2c: Introduce i2c_start_recv() and i2c_start_send()

Titus Rwantare (5):
hw/i2c: add support for PMBus hw/sensor: add ADM1272 device tests/qtest: add tests for ADM1272 device model hw/sensor: add MAX34451 device tests/qtest: add tests for MAX34451 device model

 MAINTAINERS                                |   11 +-
 hw/Kconfig                                 |    1 +
 hw/adc/Kconfig                             |    3 +
 hw/{misc => adc}/max111x.c                 |    2 +-
 hw/adc/meson.build                         |    2 +
 hw/{misc => adc}/zynq-xadc.c               |    2 +-
 hw/arm/Kconfig                             |    3 +
 hw/arm/aspeed.c                            |    2 +-
 hw/arm/nseries.c                           |    5 +-
 hw/arm/pxa2xx.c                            |    2 +-
 hw/arm/spitz.c                             |    6 +-
 hw/arm/xilinx_zynq.c                       |    2 +-
 hw/display/ati.c                           |    2 +-
 hw/display/sm501.c                         |   16 +-
 hw/display/xlnx_dp.c                       |    2 +-
 hw/i2c/Kconfig                             |    4 +
 hw/i2c/core.c                              |   76 +-
 hw/i2c/imx_i2c.c                           |    2 +-
 hw/i2c/meson.build                         |    1 +
 hw/i2c/pm_smbus.c                          |    4 +-
 hw/i2c/pmbus_device.c                      | 1612 ++++++++++++++++++++++++++++
 hw/i2c/ppc4xx_i2c.c                        |   15 +-
 hw/i2c/smbus_master.c                      |   22 +-
 hw/input/lm832x.c                          |    2 +-
 hw/ipmi/ipmi_bmc_sim.c                     |    4 +-
 hw/meson.build                             |    1 +
 hw/misc/Kconfig                            |   15 -
 hw/misc/auxbus.c                           |   68 +-
 hw/misc/meson.build                        |    6 +-
 hw/sensor/Kconfig                          |   19 +
 hw/sensor/adm1272.c                        |  543 ++++++++++
 hw/{misc => sensor}/emc141x.c              |    2 +-
 hw/sensor/max34451.c                       |  775 +++++++++++++
 hw/sensor/meson.build                      |    5 +
 hw/{misc => sensor}/tmp105.c               |    2 +-
 hw/{misc => sensor}/tmp421.c               |    0
 include/hw/{misc => adc}/max111x.h         |    0
 include/hw/{misc => adc}/zynq-xadc.h       |    0
 include/hw/i2c/i2c.h                       |   46 +-
 include/hw/i2c/pmbus_device.h              |  517 +++++++++
 include/hw/input/lm832x.h                  |   28 +
 include/hw/{misc => sensor}/emc141x_regs.h |    0
 {hw/misc => include/hw/sensor}/tmp105.h    |    2 +-
 include/hw/{misc => sensor}/tmp105_regs.h  |    0
 tests/qtest/adm1272-test.c                 |  445 ++++++++
 tests/qtest/emc141x-test.c                 |    2 +-
 tests/qtest/max34451-test.c                |  336 ++++++
 tests/qtest/meson.build                    |    2 +
 tests/qtest/npcm7xx_smbus-test.c           |    2 +-
 tests/qtest/tmp105-test.c                  |    2 +-
 50 files changed, 4496 insertions(+), 125 deletions(-)
 rename hw/{misc => adc}/max111x.c (99%)
 rename hw/{misc => adc}/zynq-xadc.c (99%)
 create mode 100644 hw/i2c/pmbus_device.c
 create mode 100644 hw/sensor/Kconfig
 create mode 100644 hw/sensor/adm1272.c
 rename hw/{misc => sensor}/emc141x.c (99%)
 create mode 100644 hw/sensor/max34451.c
 create mode 100644 hw/sensor/meson.build
 rename hw/{misc => sensor}/tmp105.c (99%)
 rename hw/{misc => sensor}/tmp421.c (100%)
 rename include/hw/{misc => adc}/max111x.h (100%)
 rename include/hw/{misc => adc}/zynq-xadc.h (100%)
 create mode 100644 include/hw/i2c/pmbus_device.h
 create mode 100644 include/hw/input/lm832x.h
 rename include/hw/{misc => sensor}/emc141x_regs.h (100%)
 rename {hw/misc => include/hw/sensor}/tmp105.h (97%)
 rename include/hw/{misc => sensor}/tmp105_regs.h (100%)
 create mode 100644 tests/qtest/adm1272-test.c
 create mode 100644 tests/qtest/max34451-test.c
#1 lore raw
Quoted 20 lines · Corey Minyard

The following changes since commit 38848ce565849e5b867a5e08022b3c755039c11a:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210616' into staging (2021-06-16 17:02:30 +0100)

are available in the Git repository at:

https://github.com/cminyard/qemu.git tags/for-qemu-6.1-1

for you to fetch changes up to 7051d605e6b03259e0185dd574f760b93d15fa10:

ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct (2021-06-25 08:54:57 -0500)

----------------------------------------------------------------
Some qemu updates for IPMI and I2C

Move some ADC file to where they belong and move some sensors to a sensor directory, since with new BMCs coming in lots of different sensors should be coming in. Keep from cluttering things up.

Quoted 9 lines

Add support for I2C PMBus devices.

Replace the confusing and error-prone i2c_send_recv and i2c_transfer with specific send and receive functions. Several errors have already been made with these, avoid any new errors.

Fix the watchdog_expired field in the IPMI watchdog, it's not a bool, it's a u8. After a vmstate transfer, the new value could be wrong.

Hi; this fails to compile on 32-bit hosts:

../../hw/sensor/max34451.c: In function 'max34451_init':
/home/peter.maydell/qemu/include/qemu/bitops.h:22:38: error: left shift count >= width of type [-Werror=shift-count-overflow]

 #define BIT(nr)                 (1UL << (nr))
                                      ^
/home/peter.maydell/qemu/include/hw/i2c/pmbus_device.h:253:36: note:
in expansion of macro 'BIT'
 #define PB_HAS_TEMPERATURE         BIT(40)
                                    ^~~
../../hw/sensor/max34451.c:725:37: note: in expansion of macro
'PB_HAS_TEMPERATURE'
         pmbus_page_config(pmdev, i, PB_HAS_TEMPERATURE | PB_HAS_VOUT_MODE);
                                     ^~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

You probably wanted to define PB_HAS_TEMPERATURE using BIT_ULL().

Sample gitlab CI job failure with this error:
https://gitlab.com/qemu-project/qemu/-/jobs/1403927147

thanks
-- PMM

#2 lore raw

Hmm, it compiled for me, I wonder if there are some compiler differences, but I don't see how.

Anyway, copying the original patch source so they know.

Thanks for checking.

-corey

Quoted 56 lines · Peter Maydell
Quoted 20 lines · Corey Minyard

The following changes since commit 38848ce565849e5b867a5e08022b3c755039c11a:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210616' into staging (2021-06-16 17:02:30 +0100)

are available in the Git repository at:

https://github.com/cminyard/qemu.git tags/for-qemu-6.1-1

for you to fetch changes up to 7051d605e6b03259e0185dd574f760b93d15fa10:

ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct (2021-06-25 08:54:57 -0500)

----------------------------------------------------------------
Some qemu updates for IPMI and I2C

Move some ADC file to where they belong and move some sensors to a sensor directory, since with new BMCs coming in lots of different sensors should be coming in. Keep from cluttering things up.

Quoted 9 lines

Add support for I2C PMBus devices.

Replace the confusing and error-prone i2c_send_recv and i2c_transfer with specific send and receive functions. Several errors have already been made with these, avoid any new errors.

Fix the watchdog_expired field in the IPMI watchdog, it's not a bool, it's a u8. After a vmstate transfer, the new value could be wrong.

Hi; this fails to compile on 32-bit hosts:

../../hw/sensor/max34451.c: In function 'max34451_init':
/home/peter.maydell/qemu/include/qemu/bitops.h:22:38: error: left shift count >= width of type [-Werror=shift-count-overflow]

 #define BIT(nr)                 (1UL << (nr))
                                      ^
/home/peter.maydell/qemu/include/hw/i2c/pmbus_device.h:253:36: note:
in expansion of macro 'BIT'
 #define PB_HAS_TEMPERATURE         BIT(40)
                                    ^~~
../../hw/sensor/max34451.c:725:37: note: in expansion of macro
'PB_HAS_TEMPERATURE'
         pmbus_page_config(pmdev, i, PB_HAS_TEMPERATURE | PB_HAS_VOUT_MODE);
                                     ^~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

You probably wanted to define PB_HAS_TEMPERATURE using BIT_ULL().

Sample gitlab CI job failure with this error:
https://gitlab.com/qemu-project/qemu/-/jobs/1403927147

thanks
-- PMM

#3 lore raw
Quoted 3 lines · Corey Minyard

Hmm, it compiled for me, I wonder if there are some compiler differences, but I don't see how.

I'd expect it to fail when compiling for any target where 'unsigned long' is 32 bits...

-- PMM

#4 lore raw

I've sent out some patches using BIT_ULL(). Hopefully it's fixed. -Titus

Quoted 10 lines · Peter Maydell
Quoted 3 lines · Corey Minyard

Hmm, it compiled for me, I wonder if there are some compiler differences, but I don't see how.

I'd expect it to fail when compiling for any target where 'unsigned long' is 32 bits...

-- PMM