[PATCH 01/19] configs: x86: Add multi-peer ivshmem demo

4 views
Skip to first unread message

Jan Kiszka

unread,
Jan 6, 2020, 9:20:37 AM1/6/20
to jailho...@googlegroups.com
From: Jan Kiszka <jan.k...@siemens.com>

Add the demo ivshmem device also to the linux-x86-demo and make it
3-peers (root, ivshmem-demo, linux-x86-demo). This allows to test and
demonstrate the new multi-peer feature. For that, we need to move
ivshmem-demo on the 2nd CPU and shrink the RAM of the linux-x86-demo by
2 MB.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
configs/x86/ivshmem-demo.c | 12 ++++++---
configs/x86/linux-x86-demo.c | 58 ++++++++++++++++++++++++++++++++++++++------
configs/x86/qemu-x86.c | 10 ++++++--
3 files changed, 68 insertions(+), 12 deletions(-)

diff --git a/configs/x86/ivshmem-demo.c b/configs/x86/ivshmem-demo.c
index cea555c9..ce05b6b5 100644
--- a/configs/x86/ivshmem-demo.c
+++ b/configs/x86/ivshmem-demo.c
@@ -19,7 +19,7 @@
struct {
struct jailhouse_cell_desc cell;
__u64 cpus[1];
- struct jailhouse_memory mem_regions[6];
+ struct jailhouse_memory mem_regions[7];
struct jailhouse_pio pio_regions[2];
struct jailhouse_pci_device pci_devices[1];
struct jailhouse_pci_capability pci_caps[0];
@@ -46,7 +46,7 @@ struct {
},

.cpus = {
- 0b0100,
+ 0b0010,
},

.mem_regions = {
@@ -77,6 +77,12 @@ struct {
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_ROOTSHARED,
},
+ {
+ .phys_start = 0x3f0fe000,
+ .virt_start = 0x3f0fe000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
/* RAM */ {
.phys_start = 0x3ee00000,
.virt_start = 0,
@@ -106,7 +112,7 @@ struct {
.num_msix_vectors = 16,
.shmem_regions_start = 0,
.shmem_dev_id = 1,
- .shmem_peers = 2,
+ .shmem_peers = 3,
.shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
},
},
diff --git a/configs/x86/linux-x86-demo.c b/configs/x86/linux-x86-demo.c
index 5f9d8ed8..7a6f1efd 100644
--- a/configs/x86/linux-x86-demo.c
+++ b/configs/x86/linux-x86-demo.c
@@ -19,17 +19,17 @@ struct {
struct jailhouse_cell_desc cell;
__u64 cpus[1];
#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT
- struct jailhouse_memory mem_regions[11];
+ struct jailhouse_memory mem_regions[16];
#else
- struct jailhouse_memory mem_regions[7];
+ struct jailhouse_memory mem_regions[12];
#endif
struct jailhouse_cache cache_regions[1];
struct jailhouse_irqchip irqchips[1];
struct jailhouse_pio pio_regions[3];
#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT
- struct jailhouse_pci_device pci_devices[2];
+ struct jailhouse_pci_device pci_devices[3];
#else
- struct jailhouse_pci_device pci_devices[1];
+ struct jailhouse_pci_device pci_devices[2];
#endif
struct jailhouse_pci_capability pci_caps[6];
} __attribute__((packed)) config = {
@@ -50,10 +50,43 @@ struct {
},

.cpus = {
- 0xe,
+ 0b1100,
},

.mem_regions = {
+ /* IVSHMEM shared memory regions (demo) */
+ {
+ .phys_start = 0x3f0f0000,
+ .virt_start = 0x3f0f0000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x3f0f1000,
+ .virt_start = 0x3f0f1000,
+ .size = 0x9000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x3f0fa000,
+ .virt_start = 0x3f0fa000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x3f0fc000,
+ .virt_start = 0x3f0fc000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x3f0fe000,
+ .virt_start = 0x3f0fe000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_ROOTSHARED,
+ },
/* IVSHMEM shared memory regions (networking) */
JAILHOUSE_SHMEM_NET_REGIONS(0x3f100000, 1),
/* low RAM */ {
@@ -73,7 +106,7 @@ struct {
/* high RAM */ {
.phys_start = 0x3a700000,
.virt_start = 0x00200000,
- .size = 0x4900000,
+ .size = 0x4700000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA |
JAILHOUSE_MEM_LOADABLE,
@@ -135,13 +168,24 @@ struct {
},

.pci_devices = {
+ {
+ .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+ .domain = 0x0,
+ .bdf = 0x0e << 3,
+ .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
+ .num_msix_vectors = 16,
+ .shmem_regions_start = 0,
+ .shmem_dev_id = 2,
+ .shmem_peers = 3,
+ .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
+ },
{
.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
.domain = 0x0,
.bdf = 0x0f << 3,
.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
.num_msix_vectors = 2,
- .shmem_regions_start = 0,
+ .shmem_regions_start = 5,
.shmem_dev_id = 1,
.shmem_peers = 2,
.shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
diff --git a/configs/x86/qemu-x86.c b/configs/x86/qemu-x86.c
index d5ba1764..fe069773 100644
--- a/configs/x86/qemu-x86.c
+++ b/configs/x86/qemu-x86.c
@@ -22,7 +22,7 @@
struct {
struct jailhouse_system header;
__u64 cpus[1];
- struct jailhouse_memory mem_regions[22];
+ struct jailhouse_memory mem_regions[23];
struct jailhouse_irqchip irqchips[1];
struct jailhouse_pio pio_regions[12];
struct jailhouse_pci_device pci_devices[9];
@@ -99,6 +99,12 @@ struct {
.size = 0x2000,
.flags = JAILHOUSE_MEM_READ,
},
+ {
+ .phys_start = 0x3f0fe000,
+ .virt_start = 0x3f0fe000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ,
+ },
/* IVSHMEM shared memory regions (networking) */
JAILHOUSE_SHMEM_NET_REGIONS(0x3f100000, 0),
/* RAM */ {
@@ -297,7 +303,7 @@ struct {
.num_msix_vectors = 16,
.shmem_regions_start = 0,
.shmem_dev_id = 0,
- .shmem_peers = 2,
+ .shmem_peers = 3,
.shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
},
{ /* IVSHMEM (networking) */
--
2.16.4

Reply all
Reply to author
Forward
0 new messages