OSDN Git Service

hw/net/can/xlnx-zynqmp: Avoid underflow while popping TX FIFOs
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 24 Nov 2023 18:33:24 +0000 (19:33 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 27 Nov 2023 15:27:37 +0000 (15:27 +0000)
commit75d0e6b5c6deb08dd6cc184adba3668055680e7b
treef0da56fc605118a994f1ca6ded0856d5c7c0161d
parent8d37a1425b9954d7e445615dcad23456515e24c0
hw/net/can/xlnx-zynqmp: Avoid underflow while popping TX FIFOs

Per https://docs.xilinx.com/r/en-US/ug1085-zynq-ultrascale-trm/Message-Format

  Message Format

  The same message format is used for RXFIFO, TXFIFO, and TXHPB.
  Each message includes four words (16 bytes). Software must read
  and write all four words regardless of the actual number of data
  bytes and valid fields in the message.

There is no mention in this reference manual about what the
hardware does when not all four words are written. To fix the
reported underflow behavior when DATA2 register is written,
I choose to fill the data with the previous content of the
ID / DLC / DATA1 registers, which is how I expect hardware
would do.

Note there is no hardware flag raised under such condition.

Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
Reviewed-by: Vikram Garhwal <vikram.garhwal@amd.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231124183325.95392-2-philmd@linaro.org
Fixes: 98e5d7a2b7 ("hw/net/can: Introduce Xilinx ZynqMP CAN controller")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1425
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
Reviewed-by: Vikram Garhwal <vikram.garhwal@amd.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
hw/net/can/xlnx-zynqmp-can.c