SDM Interface
v3 cover SDM Interface
This patch series introduces a new device to QEMU, the SDM (Signal Distribution Module),
intended to route inter-processor signals intra and inter QEMU instances.
To be as modular as possible, the device is split between the interface (virtio/platform) and the communication channel (local/socket).
A platform interface has been implemented to allow non-linux operating system (FreeRTOS for example) to use the SDM.
Also, various signals can be defined with hardware operations.
Those signals can be used, for example, to route interrupts or to trigger the boot of another QEMU instance.
When a signal is received on a SDM, it will check if the signal ID is associate to a hardware action that will be executed if found. The hardware action allows the signal to perform some actions (e.g triggering boot) before being forwarded to the operating system.
You can test thoses patches using modules and test application available on https://git.virtualopensystems.com/dev/qemu-het-tools :
- Platform module on branch sdm_test_mod_v1
- Virtio module on branch sdm-dev-v3
- Test application on branch sdm_test_app
QEMU code is avalaible here on [email protected]:dev/qemu-het.git branch sdm-dev-v3.
Run QEMU instance:
./qemu-system-arm -nographic \
-kernel zImage \
-M virt -m 512M \
-initrd busybox.cpio \
-object sdm-communication-local,id=localcomm \
-object sdm-signal,id=interrupt \
-device sdm-platform,comm=localcomm,master,num-slaves=1,len-signals=1,signals[0]="interrupt" \
-device sdm-platform,comm=localcomm,len-signals=1,len-signals=1,signals[0]="interrupt"After loading the corresponding module (insmod sdm_test_mod.ko), you can send signal
accross instances using the sdm-test application:
./sdm-test -s 0 0 0x0 0x0 0x0
This patch series is a follow-up of "[Qemu-devel] [RFC v2 0/6] SDM Interface":
https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg04492.html
This work has been sponsored by Huawei Technologies Duesseldorf GmbH.
---
Changes since v2:
- added virtio device configuration space
- added configuration accessory methods
- fixed bug in local communication channel
- aligned virto device ID with specification RFC
---
Baptiste Reynal (6):
hw/misc: sdm interface
hw/misc: sdm platform device
hw/arm: sysbus-fdt
hw/misc: sdm virtio device
hw/misc: sdm communication local
hw/misc: sdm communication socket
default-configs/arm-softmmu.mak | 1 + hw/arm/sysbus-fdt.c | 62 ++++++ hw/misc/Makefile.objs | 7 + hw/misc/sdm-communication-local.c | 116 +++++++++++ hw/misc/sdm-communication-socket.c | 160 +++++++++++++++ hw/misc/sdm-communication.c | 68 +++++++ hw/misc/sdm-device.c | 78 ++++++++ hw/misc/sdm-platform.c | 231 ++++++++++++++++++++++ hw/misc/sdm-signal.c | 52 +++++ hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-sdm.c | 303 +++++++++++++++++++++++++++++ include/hw/misc/sdm-communication-local.h | 35 ++++ include/hw/misc/sdm-communication-socket.h | 42 ++++ include/hw/misc/sdm-communication.h | 60 ++++++ include/hw/misc/sdm-device.h | 61 ++++++ include/hw/misc/sdm-platform.h | 65 +++++++ include/hw/misc/sdm-signal.h | 61 ++++++ include/hw/virtio/virtio-sdm.h | 58 ++++++ linux-headers/linux/virtio_sdm.h | 58 ++++++ 19 files changed, 1519 insertions(+) create mode 100644 hw/misc/sdm-communication-local.c create mode 100644 hw/misc/sdm-communication-socket.c create mode 100644 hw/misc/sdm-communication.c create mode 100644 hw/misc/sdm-device.c create mode 100644 hw/misc/sdm-platform.c create mode 100644 hw/misc/sdm-signal.c create mode 100644 hw/virtio/virtio-sdm.c create mode 100644 include/hw/misc/sdm-communication-local.h create mode 100644 include/hw/misc/sdm-communication-socket.h create mode 100644 include/hw/misc/sdm-communication.h create mode 100644 include/hw/misc/sdm-device.h create mode 100644 include/hw/misc/sdm-platform.h create mode 100644 include/hw/misc/sdm-signal.h create mode 100644 include/hw/virtio/virtio-sdm.h create mode 100644 linux-headers/linux/virtio_sdm.h
Signature · 1 line
1.9.1
RFC v3 1/6 hw/misc: sdm interface
From: Baptiste Reynal <[email protected]>
This patch forms the common skeleton code for the SDM interface.
The SDMDevice represents the interface with the machine, the SDMCommunication the communication channel and the SDMSignal represents an action to perform when a signal is received (for example to boot the machine).
---
v2 -> v3:
- Added sdm_device_set_num_slaves function to sdm-device class
- Added sdm_communication_update_num_slaves to sdm-communication class
---
--- default-configs/arm-softmmu.mak | 1 + hw/misc/Makefile.objs | 4 ++ hw/misc/sdm-communication.c | 68 ++++++++++++++++++++++++++++++++ hw/misc/sdm-device.c | 78 +++++++++++++++++++++++++++++++++++++ hw/misc/sdm-signal.c | 51 ++++++++++++++++++++++++ include/hw/misc/sdm-communication.h | 60 ++++++++++++++++++++++++++++ include/hw/misc/sdm-device.h | 61 +++++++++++++++++++++++++++++ include/hw/misc/sdm-signal.h | 60 ++++++++++++++++++++++++++++ 8 files changed, 383 insertions(+) create mode 100644 hw/misc/sdm-communication.c create mode 100644 hw/misc/sdm-device.c create mode 100644 hw/misc/sdm-signal.c create mode 100644 include/hw/misc/sdm-communication.h create mode 100644 include/hw/misc/sdm-device.h create mode 100644 include/hw/misc/sdm-signal.h
default-configs/arm-softmmu.mak +1 -0
@@ -109,3 +109,4 @@ CONFIG_IOH3420=y CONFIG_I82801B11=y CONFIG_ACPI=y CONFIG_SMBIOS=y +CONFIG_SDM=y
hw/misc/Makefile.objs +4 -0
@@ -21,6 +21,10 @@ common-obj-$(CONFIG_MACIO) += macio/ obj-$(CONFIG_IVSHMEM) += ivshmem.o +obj-$(CONFIG_SDM) += sdm-device.o +obj-$(CONFIG_SDM) += sdm-communication.o +obj-$(CONFIG_SDM) += sdm-signal.o + obj-$(CONFIG_REALVIEW) += arm_sysctl.o obj-$(CONFIG_NSERIES) += cbus.o obj-$(CONFIG_ECCMEMCTL) += eccmemctl.o
hw/misc/sdm-communication.c new file +68 -0
68 lines not on this page · raw message
hw/misc/sdm-device.c new file +78 -0
78 lines not on this page · raw message
hw/misc/sdm-signal.c new file +51 -0
51 lines not on this page · raw message
include/hw/misc/sdm-communication.h new file +60 -0
60 lines not on this page · raw message
include/hw/misc/sdm-device.h new file +61 -0
61 lines not on this page · raw message
include/hw/misc/sdm-signal.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC v3 2/6 hw/misc: sdm platform device
In reply to Christian PintoFrom: Baptiste Reynal <[email protected]>
This is the platform implementation for an SDM device.
Parameters are:
comm=[sdm_communication_id] specifies the communication channel master=[true/false] - configure the SDM device as master or slave num_slaves=[slave_number] - if master is true, specifies the number
of slaves
len-signals=[signals_number] - specifies the number of signals signals[x]=[signal_id] - add a signal to the device, with the ID x
--- hw/misc/Makefile.objs | 1 + hw/misc/sdm-platform.c | 231 +++++++++++++++++++++++++++++++++++++++++ hw/misc/sdm-signal.c | 1 + include/hw/misc/sdm-platform.h | 65 ++++++++++++ include/hw/misc/sdm-signal.h | 1 + 5 files changed, 299 insertions(+) create mode 100644 hw/misc/sdm-platform.c create mode 100644 include/hw/misc/sdm-platform.h
hw/misc/Makefile.objs +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_IVSHMEM) += ivshmem.o obj-$(CONFIG_SDM) += sdm-device.o obj-$(CONFIG_SDM) += sdm-communication.o obj-$(CONFIG_SDM) += sdm-signal.o +obj-$(CONFIG_SDM) += sdm-platform.o obj-$(CONFIG_REALVIEW) += arm_sysctl.o obj-$(CONFIG_NSERIES) += cbus.o
hw/misc/sdm-platform.c new file +231 -0
231 lines not on this page · raw message
hw/misc/sdm-signal.c +1 -0
@@ -4,6 +4,7 @@* Copyright (C) 2016 - Virtual Open Systems * * Author: Baptiste Reynal <[email protected]> +* Christian Pinto <[email protected]> * * This work is licensed under the terms of the GNU GPL, version 2. See * the COPYING file in the top-level directory.
include/hw/misc/sdm-platform.h new file +65 -0
65 lines not on this page · raw message
include/hw/misc/sdm-signal.h +1 -0
@@ -4,6 +4,7 @@* Copyright (C) 2016 - Virtual Open Systems * * Author: Baptiste Reynal <[email protected]> +* Christian Pinto <[email protected]> * * This work is licensed under the terms of the GNU GPL, version 2. See * the COPYING file in the top-level directory.
Signature · 1 line
1.9.1
RFC v3 3/6 hw/arm: sysbus-fdt
In reply to Christian PintoFrom: Baptiste Reynal <[email protected]>
Added node creation for dynamically instantiated sysbus SDM device. Support added for all ARM machines modeling dynamic sysbus devices instantiation.
--- hw/arm/sysbus-fdt.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
hw/arm/sysbus-fdt.c +62 -0
@@ -28,6 +28,7 @@#include "sysemu/sysemu.h" #include "hw/vfio/vfio-platform.h" #include "hw/vfio/vfio-calxeda-xgmac.h" +#include "hw/misc/sdm-platform.h" #include "hw/arm/fdt.h" /*
@@ -123,9 +124,70 @@ fail_reg:return ret; } +/** +* add_sdm_fdt_node +* +* Generates a node with following properties: +* compatible string, regs, interrupts +* +*/ +static int add_sdm_fdt_node (SysBusDevice *sbdev,void *opaque) +{ +PlatformBusFDTData *data = opaque; +PlatformBusDevice *pbus = data->pbus; +const char sdm_compat[] ="sdm-ipi" ; +void *fdt = data->fdt; +const char *parent_node = data->pbus_node_name; +char *nodename; +int ret =-1 ; +uint32_t *irq_attr, *reg_attr; +uint64_t mmio_base, irq_number; + + mmio_base =platform_bus_get_mmio_addr (pbus, sbdev,0 ); + nodename =g_strdup_printf ("%s/%s@%" PRIx64, parent_node, +TYPE_SDM_PLATFORM , mmio_base); +qemu_fdt_add_subnode (fdt, nodename); + +qemu_fdt_setprop (fdt, nodename,"compatible" , sdm_compat, +sizeof (sdm_compat)); + +/** +* There is only one MMIO region defined for the SDM device +*/ + reg_attr =g_new (uint32_t,2 ); + mmio_base =platform_bus_get_mmio_addr (pbus, sbdev,0 ); + reg_attr[0 ] =cpu_to_be32 (mmio_base); + reg_attr[1 ] =cpu_to_be32 (SDM_PLATFORM_SIZE ); + ret =qemu_fdt_setprop (fdt, nodename,"reg" , reg_attr, +2 *sizeof (uint32_t )); +if (ret) { +error_report ("could not set reg property of node %s" , nodename); + goto fail; + } + + irq_attr =g_new (uint32_t,3 ); + irq_number =platform_bus_get_irqn (pbus, sbdev ,0 ) + + data->irq_start; + irq_attr[0 ] =cpu_to_be32 (GIC_FDT_IRQ_TYPE_SPI ); + irq_attr[1 ] =cpu_to_be32 (irq_number); + irq_attr[2 ] =cpu_to_be32 (GIC_FDT_IRQ_FLAGS_EDGE_LO_HI ); + ret =qemu_fdt_setprop (fdt, nodename,"interrupts" , + irq_attr,3 *sizeof (uint32_t )); +if (ret) { +error_report ("could not set interrupts property of node %s" , + nodename); + } +g_free (irq_attr); +fail: +g_free (reg_attr); +g_free (nodename); +return ret; +} +/* list of supported dynamic sysbus devices */ static const NodeCreationPair add_fdt_node_functions[] = { {TYPE_VFIO_CALXEDA_XGMAC , add_calxeda_midway_xgmac_fdt_node}, + {TYPE_SDM_PLATFORM , add_sdm_fdt_node}, {"" ,NULL },/* last element */ };
Signature · 1 line
1.9.1
RFC v3 4/6 hw/misc: sdm virtio device
In reply to Christian PintoFrom: Baptiste Reynal <[email protected]>
This is the virtio implementation for an SDM device.
Parameters are:
comm=[sdm_communication_id] specifies the communication channel master=[true/false] - configure the SDM device as master or slave num_slaves=[slave_number] - if master is true, specifies the number of slaves
len-signals=[signals_number] - specifies the number of signals signals[x]=[signal_id] - add a signal to the device, with the ID x
---
v2 -> v3
- add configuration space to virtio sdm device
- add accessor methods (get, set) to sdm virtio device model
- max num_slave changes propagated to communication channel to realloc slaves array
- align virtio device ID to device specification RFC submitted to virtio-dev
---
--- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-sdm.c | 303 +++++++++++++++++++++++++++++++++++++++ include/hw/virtio/virtio-sdm.h | 58 ++++++++ linux-headers/linux/virtio_sdm.h | 58 ++++++++ 4 files changed, 420 insertions(+) create mode 100644 hw/virtio/virtio-sdm.c create mode 100644 include/hw/virtio/virtio-sdm.h create mode 100644 linux-headers/linux/virtio_sdm.h
hw/virtio/Makefile.objs +1 -0
@@ -2,6 +2,7 @@ common-obj-y += virtio-rng.o common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o common-obj-y += virtio-bus.o common-obj-y += virtio-mmio.o +obj-$(CONFIG_SDM) += virtio-sdm.o obj-$(CONFIG_VIRTIO) += dataplane/ obj-y += virtio.o virtio-balloon.o
hw/virtio/virtio-sdm.c new file +303 -0
303 lines not on this page · raw message
include/hw/virtio/virtio-sdm.h new file +58 -0
58 lines not on this page · raw message
linux-headers/linux/virtio_sdm.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC v3 5/6 hw/misc: sdm communication local
In reply to Christian PintoFrom: Baptiste Reynal <[email protected]>
This patch introduces local implementation for SDM devices. It allows a master to communicate with a slave on the same QEMU instance.
Instantiation:
-object sdm-communication-local,id=<id>
---
v2 -> v3:
- added sdm_local_update_num_slaves to local communication channel
- realloc slaves array in case of max slaves change
- fixed bug: signal notifications not sent to correct sdm device instance
---
--- hw/misc/Makefile.objs | 1 + hw/misc/sdm-communication-local.c | 116 ++++++++++++++++++++++++++++++ include/hw/misc/sdm-communication-local.h | 35 +++++++++ 3 files changed, 152 insertions(+) create mode 100644 hw/misc/sdm-communication-local.c create mode 100644 include/hw/misc/sdm-communication-local.h
hw/misc/Makefile.objs +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_SDM) += sdm-device.o obj-$(CONFIG_SDM) += sdm-communication.o obj-$(CONFIG_SDM) += sdm-signal.o obj-$(CONFIG_SDM) += sdm-platform.o +obj-$(CONFIG_SDM) += sdm-communication-local.o obj-$(CONFIG_REALVIEW) += arm_sysctl.o obj-$(CONFIG_NSERIES) += cbus.o
hw/misc/sdm-communication-local.c new file +116 -0
116 lines not on this page · raw message
include/hw/misc/sdm-communication-local.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* SDM Communication Local +* +* Copyright (C) 2016 - Virtual Open Systems +* +* Author: Baptiste Reynal <[email protected]> +* +* This works is licensed under the terms of the GNU GPL, version 2. See +* the COPYING file un the top-level directory. +*/ +#ifndef HW_SDM_COMM_LOCAL_H +#define HW_SDM_COMM_LOCAL_H + +#include "hw/misc/sdm-communication.h" + +#define TYPE_SDM_COMMUNICATION_LOCAL "sdm-communication-local" +#define SDM_COMMUNICATION_LOCAL (obj) \ + OBJECT_CHECK(SDMCommunicationLocal, (obj), \ + TYPE_SDM_COMMUNICATION_LOCAL) + +typedef struct SDMCommunicationLocal SDMCommunicationLocal ; + +/** +* @SDMCommunicationLocal +* +* @parent: opaque parent object container +*/ +struct SDMCommunicationLocal { +/* private */ +SDMCommunication parent; + +int num_slaves; +SDMDevice **slaves; +}; +#endif
Signature · 1 line
1.9.1
RFC v3 6/6 hw/misc: sdm communication socket
In reply to Christian PintoFrom: Baptiste Reynal <[email protected]>
This is the socket implementation of an SDM communication channel. A master device can communicate with a slave over a socket.
Parameters:
socket=[socket_id] - specifies the multi-client socket
This patch depends on "[RFC v2 1/1] backend: multi-client-socket"
---
v2 -> v3:
- added sdm_socket_update_num_slaves to socket based communication channel
- realloc slaves array in case of max slaves num change
--- hw/misc/Makefile.objs | 1 + hw/misc/sdm-communication-socket.c | 160 +++++++++++++++++++++++++++++ include/hw/misc/sdm-communication-socket.h | 42 ++++++++ 3 files changed, 203 insertions(+) create mode 100644 hw/misc/sdm-communication-socket.c create mode 100644 include/hw/misc/sdm-communication-socket.h
hw/misc/Makefile.objs +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_SDM) += sdm-communication.o obj-$(CONFIG_SDM) += sdm-signal.o obj-$(CONFIG_SDM) += sdm-platform.o obj-$(CONFIG_SDM) += sdm-communication-local.o +obj-$(CONFIG_SDM) += sdm-communication-socket.o obj-$(CONFIG_REALVIEW) += arm_sysctl.o obj-$(CONFIG_NSERIES) += cbus.o
hw/misc/sdm-communication-socket.c new file +160 -0
160 lines not on this page · raw message
include/hw/misc/sdm-communication-socket.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.9.1
Ping...
are there any comments?
Thanks,
Christian
Quoted 115 lines · Christian Pinto
This patch series introduces a new device to QEMU, the SDM (Signal Distribution
Module),
intended to route inter-processor signals intra and inter QEMU instances.To be as modular as possible, the device is split between the interface (virtio/platform) and the communication channel (local/socket).
A platform interface has been implemented to allow non-linux operating system (FreeRTOS for example) to use the SDM.
Also, various signals can be defined with hardware operations.
Those signals can be used, for example, to route interrupts or to trigger the boot of another QEMU instance.
When a signal is received on a SDM, it will check if the signal ID is associate to a hardware action that will be executed if found. The hardware action allows the signal to perform some actions (e.g triggering boot) before being forwarded to the operating system.
You can test thoses patches using modules and test application available on https://git.virtualopensystems.com/dev/qemu-het-tools :
- Platform module on branch
sdm_test_mod_v1
- Virtio module on branch sdm-dev-v3
- Test application on branchsdm_test_appQEMU code is avalaible here on [email protected]:
dev/qemu-het.git
branch sdm-dev-v3.Run QEMU instance:
./qemu-system-arm -nographic \ -kernel zImage \ -M virt -m 512M \ -initrd busybox.cpio \ -object sdm-communication-local,id=localcomm \ -object sdm-signal,id=interrupt \ -devicesdm-platform,comm=localcomm,master,num-slaves=1,len-signals=1,signals[0]="interrupt" \
-device
sdm-platform,comm=localcomm,len-signals=1,len-signals=1,signals[0]="interrupt"After loading the corresponding module (insmod sdm_test_mod.ko), you can send
signal
accross instances using the sdm-test application:
./sdm-test -s 0 00x00x00x0This patch series is a follow-up of "[Qemu-devel] [RFC v2 0/6] SDM Interface":
https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg04492.htmlThis work has been sponsored by Huawei Technologies Duesseldorf GmbH.
---
Changes since v2:
- added virtio device configuration space
- added configuration accessory methods
- fixed bug in local communication channel
- aligned virto device ID with specification RFC
---Baptiste Reynal (6):
hw/misc: sdm interface
hw/misc: sdm platform device
hw/arm: sysbus-fdt
hw/misc: sdm virtio device
hw/misc: sdm communication local
hw/misc: sdm communication socketdefault-configs/arm-softmmu.mak | 1 + hw/arm/sysbus-fdt.c | 62 ++++++ hw/misc/Makefile.objs | 7 + hw/misc/sdm-communication-local.c | 116 +++++++++++ hw/misc/sdm-communication-socket.c | 160 +++++++++++++++ hw/misc/sdm-communication.c | 68 +++++++ hw/misc/sdm-device.c | 78 ++++++++ hw/misc/sdm-platform.c | 231 ++++++++++++++++++++++ hw/misc/sdm-signal.c | 52 +++++ hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-sdm.c | 303 +++++++++++++++++++++++++++++ include/hw/misc/sdm-communication-local.h | 35 ++++ include/hw/misc/sdm-communication-socket.h | 42 ++++ include/hw/misc/sdm-communication.h | 60 ++++++ include/hw/misc/sdm-device.h | 61 ++++++ include/hw/misc/sdm-platform.h | 65 +++++++ include/hw/misc/sdm-signal.h | 61 ++++++ include/hw/virtio/virtio-sdm.h | 58 ++++++ linux-headers/linux/virtio_sdm.h | 58 ++++++ 19 files changed, 1519 insertions(+) create mode 100644 hw/misc/sdm-communication-local.c create mode 100644 hw/misc/sdm-communication-socket.c create mode 100644 hw/misc/sdm-communication.c create mode 100644 hw/misc/sdm-device.c create mode 100644 hw/misc/sdm-platform.c create mode 100644 hw/misc/sdm-signal.c create mode 100644 hw/virtio/virtio-sdm.c create mode 100644 include/hw/misc/sdm-communication-local.h create mode 100644 include/hw/misc/sdm-communication-socket.h create mode 100644 include/hw/misc/sdm-communication.h create mode 100644 include/hw/misc/sdm-device.h create mode 100644 include/hw/misc/sdm-platform.h create mode 100644 include/hw/misc/sdm-signal.h create mode 100644 include/hw/virtio/virtio-sdm.h create mode 100644 linux-headers/linux/virtio_sdm.h--
1.9.1
Quoted 3 lines · Christian Pinto
Ping...
are there any comments?
Hi Christian,
I will be away until Thursday and focussed on the virtio device specification first. Maybe others can give you feedback on the QEMU patches in the meantime.
Stefan
Thanks a lot Stefan.
Looking forward for your feedback.
Christian
Quoted 12 lines · Stefan Hajnoczi
Quoted 3 lines · Christian Pinto
Ping...
are there any comments?
Hi Christian,
I will be away until Thursday and focussed on the virtio device specification first. Maybe others can give you feedback on the QEMU patches in the meantime.Stefan