Introduce Xlnx ZynqMP CAN controller for QEMU
v2 cover Introduce Xlnx ZynqMP CAN controller for QEMU
Example for single CAN:
-object can-bus,id=canbus0 \
-global driver=xlnx.zynqmp-can,property=canbus0,value=canbus0 \
-object can-host-socketcan,id=socketcan0,if=vcan0,canbus=canbus0Example for connecting both CAN:
-object can-bus,id=canbus0 -object can-bus,id=canbus1 \
-global driver=xlnx.zynqmp-can,property=canbus0,value=canbus0 \
-global driver=xlnx.zynqmp-can,property=canbus1,value=canbus1 \
-object can-host-socketcan,id=socketcan0,if=vcan0,canbus=canbus0 \
-object can-host-socChangelog:
v1 -> v2:
Rename the CAN device state and address code style issues. Connect the CAN device to Xlnx-ZCU102 board.
Add maintainer entry.
Add QTEST for the CAN device.
Vikram Garhwal (4):
MAINTAINERS: Add maintainer entry for Xilinx CAN hw/net/can: Introduce Xlnx ZynqMP CAN controller for QEMU hw/net/can: Connect Xlnx ZynqMP CAN controller to ZCU102 machine hw/net/can: Introduce QTEST for Xlnx CAN controller
MAINTAINERS | 7 + hw/arm/xlnx-zynqmp.c | 26 + hw/net/can/Makefile.objs | 1 + hw/net/can/xlnx-zynqmp-can.c | 1113 ++++++++++++++++++++++++++++++++++++++ include/hw/arm/xlnx-zynqmp.h | 3 + include/hw/net/xlnx-zynqmp-can.h | 76 +++ tests/qtest/Makefile.include | 1 + tests/qtest/xlnx-can-test.c | 367 +++++++++++++ 8 files changed, 1594 insertions(+) create mode 100644 hw/net/can/xlnx-zynqmp-can.c create mode 100644 include/hw/net/xlnx-zynqmp-can.h create mode 100644 tests/qtest/xlnx-can-test.c
--
2.7.4
PATCH v2 1/4 MAINTAINERS: Add maintainer entry for Xilinx CAN
Add myself as Xilinx CAN maintainer.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -1433,6 +1433,13 @@ F: hw/net/opencores_eth.c Devices ------- +Xilinx CAN +M: Vikram Garhwal <[email protected]> +S: Maintained +F: hw/net/can/xlnx-* +F: include/hw/net/xlnx-* +F: tests/qtest/xlnx-can-test* + EDU M: Jiri Slaby <[email protected]> S: Maintained
Signature · 1 line
2.7.4
PATCH v2 2/4 hw/net/can: Introduce Xlnx ZynqMP CAN controller for QEMU
In reply to Vikram GarhwalXlnxCAN is developed based on SocketCAN, QEMU CAN bus implementation. Bus connection and socketCAN connection for each CAN module can be set through command lines.
--- hw/net/can/Makefile.objs | 1 + hw/net/can/xlnx-zynqmp-can.c | 1113 ++++++++++++++++++++++++++++++++++++++ include/hw/net/xlnx-zynqmp-can.h | 76 +++ 3 files changed, 1190 insertions(+) create mode 100644 hw/net/can/xlnx-zynqmp-can.c create mode 100644 include/hw/net/xlnx-zynqmp-can.h
hw/net/can/Makefile.objs +1 -0
@@ -2,3 +2,4 @@ common-obj-$(CONFIG_CAN_SJA1000) += can_sja1000.o common-obj-$(CONFIG_CAN_PCI) += can_kvaser_pci.o common-obj-$(CONFIG_CAN_PCI) += can_pcm3680_pci.o common-obj-$(CONFIG_CAN_PCI) += can_mioe3680_pci.o +common-obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp-can.o
hw/net/can/xlnx-zynqmp-can.c new file +1113 -0
1,113 lines not on this page · raw message
include/hw/net/xlnx-zynqmp-can.h new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 3/4 hw/net/can: Connect Xlnx ZynqMP CAN controller to ZCU102 machine
In reply to Vikram GarhwalConnect CAN0 and CAN1 to ZCU102 board.
--- hw/arm/xlnx-zynqmp.c | 26 ++++++++++++++++++++++++++ include/hw/arm/xlnx-zynqmp.h | 3 +++ 2 files changed, 29 insertions(+)
hw/arm/xlnx-zynqmp.c +26 -0
@@ -81,6 +81,14 @@ static const int uart_intr[XLNX_ZYNQMP_NUM_UARTS] = { 21, 22, }; +static const uint64_t can_addr[XLNX_ZYNQMP_NUM_CAN ] = { +0xFF060000 ,0xFF070000 , +}; + +static const int can_intr[XLNX_ZYNQMP_NUM_CAN ] = { +23 ,24 , +}; +static const uint64_t sdhci_addr[XLNX_ZYNQMP_NUM_SDHCI ] = {0xFF160000 ,0xFF170000 , };
@@ -254,6 +262,11 @@ static void xlnx_zynqmp_init(Object *obj) TYPE_CADENCE_UART); } +for (i =0 ; i <XLNX_ZYNQMP_NUM_CAN ; i++) { +sysbus_init_child_obj (obj,"can[*]" , &s->can[i],sizeof (s->can[i]), +TYPE_XLNX_ZYNQMP_CAN ); + } +sysbus_init_child_obj (obj,"sata" , &s->sata,sizeof (s->sata),TYPE_SYSBUS_AHCI );
@@ -508,6 +521,19 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) gic_spi[uart_intr[i]]); } +for (i =0 ; i <XLNX_ZYNQMP_NUM_CAN ; i++) { +object_property_set_int (OBJECT (&s->can[i]), i,"ctrl-idx" , + &error_abort); +object_property_set_bool (OBJECT (&s->can[i]), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->can[i]),0 , can_addr[i]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->can[i]),0 , + gic_spi[can_intr[i]]); + } +object_property_set_int (OBJECT (&s->sata),SATA_NUM_PORTS ,"num-ports" , &error_abort);object_property_set_bool (OBJECT (&s->sata), true,"realized" , &err);
include/hw/arm/xlnx-zynqmp.h +3 -0
@@ -22,6 +22,7 @@#include "hw/intc/arm_gic.h" #include "hw/net/cadence_gem.h" #include "hw/char/cadence_uart.h" +#include "hw/net/xlnx-zynqmp-can.h" #include "hw/ide/ahci.h" #include "hw/sd/sdhci.h" #include "hw/ssi/xilinx_spips.h"
@@ -41,6 +42,7 @@#define XLNX_ZYNQMP_NUM_RPU_CPUS 2#define XLNX_ZYNQMP_NUM_GEMS 4#define XLNX_ZYNQMP_NUM_UARTS 2 +#define XLNX_ZYNQMP_NUM_CAN 2#define XLNX_ZYNQMP_NUM_SDHCI 2#define XLNX_ZYNQMP_NUM_SPIS 2#define XLNX_ZYNQMP_NUM_GDMA_CH 8
@@ -92,6 +94,7 @@ typedef struct XlnxZynqMPState {CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS ];CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS ]; +XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN ];SysbusAHCIState sata;SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI ];XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS ];
Signature · 1 line
2.7.4
PATCH v2 4/4 hw/net/can: Introduce QTEST for Xlnx CAN controller
In reply to Vikram GarhwalQtest performs five tests on Xlnx-CAN controller:
It checks communication between CAN0 and CAN1 via can-bus. Tests CAN in loopback, sleep and snoop mode. Tests CAN filtering for incoming messages.
--- tests/qtest/Makefile.include | 1 + tests/qtest/xlnx-can-test.c | 367 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 368 insertions(+) create mode 100644 tests/qtest/xlnx-can-test.c
tests/qtest/Makefile.include +1 -0
@@ -136,6 +136,7 @@ check-qtest-aarch64-$(CONFIG_TPM_TIS_SYSBUS) += tpm-tis-device-swtpm-test check-qtest-aarch64-y += numa-test check-qtest-aarch64-y += boot-serial-test check-qtest-aarch64-y += migration-test +check-qtest-aarch64-y += xlnx-can-test # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make test unconditional ifneq ($(ARCH),arm)
tests/qtest/xlnx-can-test.c new file +367 -0
367 lines not on this page · raw message
Signature · 1 line
2.7.4
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===
CC tests/qtest/cdrom-test.o
CC test_a_f32_z_i32_rx.o
CC tests/qtest/device-introspect-test.o
/tmp/qemu-test/src/tests/qtest/xlnx-can-test.c:27:24: fatal error: qemu/osdep.h: No such file or directory
#include "qemu/osdep.h"
^
compilation terminated.
---
CC test_a_f32_z_f16.o
CC tests/qtest/qmp-cmd-test.o
CC tests/qtest/qom-test.omake: *** [tests/qtest/xlnx-can-test] Error 1
make: *** Waiting for unfinished jobs....
CC test_a_f32_z_f64.o
CC test_a_f32_z_extF80.o
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=a5394c1481bc45a8a5c498304329935e', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-6fmtq36p/src/docker-src.2020-04-17-15.52.50.14267:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=a5394c1481bc45a8a5c498304329935e
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-6fmtq36p/src'
make: *** [docker-run-test-quick@centos7] Error 2
real 2m53.145s
user 0m8.553s
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]