neu-ece-7368 / qemu-xlnx

Other
0 stars 0 forks source link

[ZPanel DIP] switches not working, need check return val. #2

Closed jiangqucheng closed 1 year ago

jiangqucheng commented 1 year ago

Raised from neu-ece-4534-sp23/discussions#9

The following line sends "OK" back to ZCmdClient(located at .../site-packages/zmon/zcli.py) without checking the return value at first. https://github.com/neu-ece-7368/qemu-xlnx/blob/9c71cd3b909b78347c1f7f61ce8c4e104ec40a24/zedmon/zedmon.c#L213

jiangqucheng commented 1 year ago

I start to realize that the ZPanel problem may be caused by the incorrect reaction of QEMU HW, which always returns 0, whatever we wrote to it.

jiangqucheng commented 1 year ago

Probably not the previous hypothesis ...

I start to realize that the ZPanel problem may be caused by the incorrect reaction of QEMU HW, which always returns 0, whatever we wrote to it.

Found a weird thing: https://github.com/neu-ece-7368/qemu-xlnx/blob/9c71cd3b909b78347c1f7f61ce8c4e104ec40a24/hw/gpio/xilinx-axi-gpio.c#L388 The size (param#3) is set to 0, which will pass through the: https://github.com/neu-ece-7368/qemu-xlnx/blob/9c71cd3b909b78347c1f7f61ce8c4e104ec40a24/hw/gpio/xilinx-axi-gpio.c#L296 https://github.com/neu-ece-7368/qemu-xlnx/blob/9c71cd3b909b78347c1f7f61ce8c4e104ec40a24/hw/core/register.c#L212 https://github.com/neu-ece-7368/qemu-xlnx/blob/9c71cd3b909b78347c1f7f61ce8c4e104ec40a24/hw/core/register.c#L68 https://github.com/neu-ece-7368/qemu-xlnx/blob/9c71cd3b909b78347c1f7f61ce8c4e104ec40a24/include/qemu/bitops.h#L28

Finally, the macro definition gets the write enabling mask we as 0. Which will probably cause nothing to write in reg. (Have not investigated further)

brunosmmm commented 1 year ago

@jiangqucheng current QEMU is built from virtual-hw branch, not the default eece4534-sp21 branch.

brunosmmm commented 1 year ago

Fixed in 7ba4e4de1e103370ca61638e2c04a0ba66802632. Problem was caused by original code not properly passing in a RegisterInfoArray struct into the main GPIO write function, which leads to calculation of an invalid memory mapped register region, and write completely fails.