Yes, it is that simple: For targets without physical PCI support, we can
simply expose an mmconfig region in order to provide ivshmem devices to
the guests. All we need to do is to register the configured MMIO region
but skip the mapping of the region physically. A new flag in the system
config controls this.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/include/jailhouse/cell-config.h | 2 +-
 hypervisor/pci.c                           | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hypervisor/include/jailhouse/cell-config.h 
b/hypervisor/include/jailhouse/cell-config.h
index 75f5ea4..1f88514 100644
--- a/hypervisor/include/jailhouse/cell-config.h
+++ b/hypervisor/include/jailhouse/cell-config.h
@@ -178,7 +178,7 @@ struct jailhouse_system {
        struct {
                __u64 pci_mmconfig_base;
                __u8 pci_mmconfig_end_bus;
-               __u8 padding;
+               __u8 pci_is_virtual;
                union {
                        struct {
                                __u16 pm_timer_address;
diff --git a/hypervisor/pci.c b/hypervisor/pci.c
index 603530f..95ba6e1 100644
--- a/hypervisor/pci.c
+++ b/hypervisor/pci.c
@@ -362,10 +362,10 @@ enum pci_access pci_cfg_write_moderate(struct pci_device 
*device, u16 address,
 int pci_init(void)
 {
        mmcfg_start = system_config->platform_info.pci_mmconfig_base;
-       if (mmcfg_start != 0) {
-               end_bus = system_config->platform_info.pci_mmconfig_end_bus;
-               mmcfg_size = (end_bus + 1) * 256 * 4096;
+       end_bus = system_config->platform_info.pci_mmconfig_end_bus;
+       mmcfg_size = (end_bus + 1) * 256 * 4096;
 
+       if (mmcfg_start != 0 && !system_config->platform_info.pci_is_virtual) {
                pci_space = paging_map_device(mmcfg_start, mmcfg_size);
                if (!pci_space)
                        return -ENOMEM;
@@ -638,7 +638,7 @@ int pci_cell_init(struct cell *cell)
        unsigned int ndev, ncap;
        int err;
 
-       if (pci_space)
+       if (mmcfg_start != 0)
                mmio_region_register(cell, mmcfg_start, mmcfg_size,
                                     pci_mmconfig_access_handler, NULL);
 
-- 
2.1.4

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to