From: Peng Fan <peng....@nxp.com>

Support virtio console

Signed-off-by: Peng Fan <peng....@nxp.com>
---
 configs/arm64/imx8mp-linux-demo.c | 81 ++++++++++++++++++++++++++-----
 configs/arm64/imx8mp.c            | 80 ++++++++++++++++++++++++------
 2 files changed, 134 insertions(+), 27 deletions(-)

diff --git a/configs/arm64/imx8mp-linux-demo.c 
b/configs/arm64/imx8mp-linux-demo.c
index ff0cdffb..1e0a9f1c 100644
--- a/configs/arm64/imx8mp-linux-demo.c
+++ b/configs/arm64/imx8mp-linux-demo.c
@@ -21,9 +21,9 @@
 struct {
        struct jailhouse_cell_desc cell;
        __u64 cpus[1];
-       struct jailhouse_memory mem_regions[15];
+       struct jailhouse_memory mem_regions[23];
        struct jailhouse_irqchip irqchips[2];
-       struct jailhouse_pci_device pci_devices[2];
+       struct jailhouse_pci_device pci_devices[4];
 } __attribute__((packed)) config = {
        .cell = {
                .signature = JAILHOUSE_CELL_DESC_SIGNATURE,
@@ -43,7 +43,8 @@ struct {
        },
 
        .mem_regions = {
-               /* IVHSMEM shared memory region for 00:00.0 (demo )*/ {
+               /* IVSHMEM shared memory region (virtio-blk front) */
+               {
                        .phys_start = 0xfd900000,
                        .virt_start = 0xfd900000,
                        .size = 0x1000,
@@ -52,25 +53,57 @@ struct {
                {
                        .phys_start = 0xfd901000,
                        .virt_start = 0xfd901000,
+                       .size = 0xdf000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+                               JAILHOUSE_MEM_ROOTSHARED,
+               },
+               { 0 },
+               { 0 },
+               /* IVSHMEM shared memory region (virtio-con front) */
+               {
+                       .phys_start = 0xfd9e0000,
+                       .virt_start = 0xfd9e0000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+               },
+               {
+                       .phys_start = 0xfd9e1000,
+                       .virt_start = 0xfd9e1000,
+                       .size = 0xf000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+                               JAILHOUSE_MEM_ROOTSHARED,
+               },
+               { 0 },
+               { 0 },
+               /* IVHSMEM shared memory region for 00:00.0 (demo )*/
+               {
+                       .phys_start = 0xfd9f0000,
+                       .virt_start = 0xfd9f0000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+               },
+               {
+                       .phys_start = 0xfd9f1000,
+                       .virt_start = 0xfd9f1000,
                        .size = 0x9000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                                JAILHOUSE_MEM_ROOTSHARED,
                },
                {
-                       .phys_start = 0xfd90a000,
-                       .virt_start = 0xfd90a000,
+                       .phys_start = 0xfd9fa000,
+                       .virt_start = 0xfd9fa000,
                        .size = 0x2000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
                },
                {
-                       .phys_start = 0xfd90c000,
-                       .virt_start = 0xfd90c000,
+                       .phys_start = 0xfd9fc000,
+                       .virt_start = 0xfd9fc000,
                        .size = 0x2000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
                },
                {
-                       .phys_start = 0xfd90e000,
-                       .virt_start = 0xfd90e000,
+                       .phys_start = 0xfd9fe000,
+                       .virt_start = 0xfd9fe000,
                        .size = 0x2000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                                JAILHOUSE_MEM_ROOTSHARED,
@@ -143,22 +176,44 @@ struct {
        },
 
        .pci_devices = {
+               {
+                       .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+                       .domain = 1,
+                       .bdf = 2 << 3,
+                       .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
+                       .shmem_regions_start = 0,
+                       .shmem_dev_id = 1,
+                       .shmem_peers = 2,
+                       .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_FRONT +
+                               VIRTIO_DEV_BLOCK,
+               },
+               {
+                       .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+                       .domain = 1,
+                       .bdf = 3 << 3,
+                       .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
+                       .shmem_regions_start = 4,
+                       .shmem_dev_id = 1,
+                       .shmem_peers = 2,
+                       .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_FRONT +
+                               VIRTIO_DEV_CONSOLE,
+               },
                { /* IVSHMEM 00:00.0 (demo) */
                        .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
-                       .domain = 0,
+                       .domain = 1,
                        .bdf = 0 << 3,
                        .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
-                       .shmem_regions_start = 0,
+                       .shmem_regions_start = 8,
                        .shmem_dev_id = 2,
                        .shmem_peers = 3,
                        .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
                },
                { /* IVSHMEM 00:01.0 (networking) */
                        .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
-                       .domain = 0,
+                       .domain = 1,
                        .bdf = 1 << 3,
                        .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
-                       .shmem_regions_start = 5,
+                       .shmem_regions_start = 13,
                        .shmem_dev_id = 1,
                        .shmem_peers = 2,
                        .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
diff --git a/configs/arm64/imx8mp.c b/configs/arm64/imx8mp.c
index a1e221f9..3f758980 100644
--- a/configs/arm64/imx8mp.c
+++ b/configs/arm64/imx8mp.c
@@ -18,9 +18,9 @@
 struct {
        struct jailhouse_system header;
        __u64 cpus[1];
-       struct jailhouse_memory mem_regions[15];
+       struct jailhouse_memory mem_regions[23];
        struct jailhouse_irqchip irqchips[3];
-       struct jailhouse_pci_device pci_devices[2];
+       struct jailhouse_pci_device pci_devices[4];
 } __attribute__((packed)) config = {
        .header = {
                .signature = JAILHOUSE_SYSTEM_SIGNATURE,
@@ -42,7 +42,7 @@ struct {
                        .pci_mmconfig_base = 0xfd700000,
                        .pci_mmconfig_end_bus = 0,
                        .pci_is_virtual = 1,
-                       .pci_domain = 0,
+                       .pci_domain = 1,
 
                        .arm = {
                                .gic_version = 3,
@@ -68,7 +68,8 @@ struct {
        },
 
        .mem_regions = {
-               /* IVHSMEM shared memory region for 00:00.0 (demo )*/ {
+               /* IVSHMEM shared memory region (virtio-blk back-end) */
+               {
                        .phys_start = 0xfd900000,
                        .virt_start = 0xfd900000,
                        .size = 0x1000,
@@ -77,24 +78,53 @@ struct {
                {
                        .phys_start = 0xfd901000,
                        .virt_start = 0xfd901000,
+                       .size = 0xdf000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+               },
+               { 0 },
+               { 0 },
+               /* IVSHMEM shared memory region (virtio-con back-end) */
+               {
+                       .phys_start = 0xfd9e0000,
+                       .virt_start = 0xfd9e0000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ,
+               },
+               {
+                       .phys_start = 0xfd9e1000,
+                       .virt_start = 0xfd9e1000,
+                       .size = 0xf000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+               },
+               { 0 },
+               { 0 },
+               /* IVHSMEM shared memory region for 00:00.0 (demo )*/ {
+                       .phys_start = 0xfd9f0000,
+                       .virt_start = 0xfd9f0000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ,
+               },
+               {
+                       .phys_start = 0xfd9f1000,
+                       .virt_start = 0xfd9f1000,
                        .size = 0x9000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE ,
                },
                {
-                       .phys_start = 0xfd90a000,
-                       .virt_start = 0xfd90a000,
+                       .phys_start = 0xfd9fa000,
+                       .virt_start = 0xfd9fa000,
                        .size = 0x2000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE ,
                },
                {
-                       .phys_start = 0xfd90c000,
-                       .virt_start = 0xfd90c000,
+                       .phys_start = 0xfd9fc000,
+                       .virt_start = 0xfd9fc000,
                        .size = 0x2000,
                        .flags = JAILHOUSE_MEM_READ,
                },
                {
-                       .phys_start = 0xfd90e000,
-                       .virt_start = 0xfd90e000,
+                       .phys_start = 0xfd9fe000,
+                       .virt_start = 0xfd9fe000,
                        .size = 0x2000,
                        .flags = JAILHOUSE_MEM_READ,
                },
@@ -167,22 +197,44 @@ struct {
        },
 
        .pci_devices = {
+               {
+                       .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+                       .domain = 1,
+                       .bdf = 2 << 3,
+                       .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
+                       .shmem_regions_start = 0,
+                       .shmem_dev_id = 0,
+                       .shmem_peers = 2,
+                       .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_BACK +
+                               VIRTIO_DEV_BLOCK,
+               },
+               {
+                       .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+                       .domain = 1,
+                       .bdf = 3 << 3,
+                       .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
+                       .shmem_regions_start = 4,
+                       .shmem_dev_id = 0,
+                       .shmem_peers = 2,
+                       .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_BACK +
+                               VIRTIO_DEV_CONSOLE,
+               },
                { /* IVSHMEM 0000:00:00.0 (demo) */
                        .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
-                       .domain = 0,
+                       .domain = 1,
                        .bdf = 0 << 3,
                        .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
-                       .shmem_regions_start = 0,
+                       .shmem_regions_start = 8,
                        .shmem_dev_id = 0,
                        .shmem_peers = 3,
                        .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
                },
                { /* IVSHMEM 0000:00:01.0 (networking) */
                        .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
-                       .domain = 0,
+                       .domain = 1,
                        .bdf = 1 << 3,
                        .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
-                       .shmem_regions_start = 5,
+                       .shmem_regions_start = 13,
                        .shmem_dev_id = 0,
                        .shmem_peers = 2,
                        .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
-- 
2.30.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20210323062536.3888-4-peng.fan%40nxp.com.

Reply via email to