There is no use for this platform parameter beyond Intel VT-d support.

Signed-off-by: Jan Kiszka <[email protected]>
---
 configs/f2a88xm-hd3.c                      |  1 -
 configs/h87i.c                             |  2 +-
 configs/qemu-vm.c                          |  2 +-
 hypervisor/arch/x86/vtd.c                  | 17 ++++++++++-------
 hypervisor/include/jailhouse/cell-config.h |  3 +--
 tools/root-cell-config.c.tmpl              |  2 +-
 6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/configs/f2a88xm-hd3.c b/configs/f2a88xm-hd3.c
index 4963ee0..f1957fa 100644
--- a/configs/f2a88xm-hd3.c
+++ b/configs/f2a88xm-hd3.c
@@ -57,7 +57,6 @@ struct {
                                },
                        },
                },
-               .interrupt_limit = 256,
                .root_cell = {
                        .name = "F2A88XM-HD3",
                        .cpu_set_size = sizeof(config.cpus),
diff --git a/configs/h87i.c b/configs/h87i.c
index 7aed2cf..5678c3d 100644
--- a/configs/h87i.c
+++ b/configs/h87i.c
@@ -40,6 +40,7 @@ struct {
                        .pci_mmconfig_end_bus = 0x3f,
                        .x86 = {
                                .pm_timer_address = 0x1808,
+                               .vtd_interrupt_limit = 256,
                                .iommu_units = {
                                        {
                                                .base = 0xfed90000,
@@ -52,7 +53,6 @@ struct {
                                },
                        },
                },
-               .interrupt_limit = 256,
                .root_cell = {
                        .name = "H87I-PLUS",
 
diff --git a/configs/qemu-vm.c b/configs/qemu-vm.c
index 3bc7625..0849f4a 100644
--- a/configs/qemu-vm.c
+++ b/configs/qemu-vm.c
@@ -54,6 +54,7 @@ struct {
                        .pci_mmconfig_end_bus = 0xff,
                        .x86 = {
                                .pm_timer_address = 0x608,
+                               .vtd_interrupt_limit = 256,
                                .iommu_units = {
                                        {
                                                .base = 0xfed90000,
@@ -62,7 +63,6 @@ struct {
                                },
                        },
                },
-               .interrupt_limit = 256,
                .root_cell = {
                        .name = "QEMU-VM",
 
diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c
index 39e0d89..2fc0dc6 100644
--- a/hypervisor/arch/x86/vtd.c
+++ b/hypervisor/arch/x86/vtd.c
@@ -25,6 +25,9 @@
 #include <asm/ioapic.h>
 #include <asm/spinlock.h>
 
+#define VTD_INTERRUPT_LIMIT()  \
+       system_config->platform_info.x86.vtd_interrupt_limit
+
 #define VTD_ROOT_PRESENT               0x00000001
 
 #define VTD_CTX_PRESENT                        0x00000001
@@ -593,8 +596,8 @@ int iommu_init(void)
        void *reg_base;
        int err;
 
-       /* n = roundup(log2(system_config->interrupt_limit)) */
-       for (n = 0; (1UL << n) < (system_config->interrupt_limit); n++)
+       /* n = roundup(log2(VTD_INTERRUPT_LIMIT())) */
+       for (n = 0; (1UL << n) < VTD_INTERRUPT_LIMIT(); n++)
                ; /* empty loop */
        if (n >= 16)
                return trace_error(-EINVAL);
@@ -731,8 +734,8 @@ static int vtd_find_int_remap_region(u16 device_id)
 {
        int n;
 
-       /* interrupt_limit is < 2^16, see vtd_init */
-       for (n = 0; n < system_config->interrupt_limit; n++)
+       /* VTD_INTERRUPT_LIMIT() is < 2^16, see vtd_init */
+       for (n = 0; n < VTD_INTERRUPT_LIMIT(); n++)
                if (int_remap_table[n].field.assigned &&
                    int_remap_table[n].field.sid == device_id)
                        return n;
@@ -747,7 +750,7 @@ static int vtd_reserve_int_remap_region(u16 device_id, 
unsigned int length)
        if (length == 0 || vtd_find_int_remap_region(device_id) >= 0)
                return 0;
 
-       for (n = 0; n < system_config->interrupt_limit; n++) {
+       for (n = 0; n < VTD_INTERRUPT_LIMIT(); n++) {
                if (int_remap_table[n].field.assigned) {
                        start = -E2BIG;
                        continue;
@@ -960,8 +963,8 @@ int iommu_map_interrupt(struct cell *cell, u16 device_id, 
unsigned int vector,
        if (base_index < 0)
                return base_index;
 
-       if (vector >= system_config->interrupt_limit ||
-           base_index >= system_config->interrupt_limit - vector)
+       if (vector >= VTD_INTERRUPT_LIMIT() ||
+           base_index >= VTD_INTERRUPT_LIMIT() - vector)
                return -ERANGE;
 
        irte = int_remap_table[base_index + vector];
diff --git a/hypervisor/include/jailhouse/cell-config.h 
b/hypervisor/include/jailhouse/cell-config.h
index 4056300..76931a5 100644
--- a/hypervisor/include/jailhouse/cell-config.h
+++ b/hypervisor/include/jailhouse/cell-config.h
@@ -184,7 +184,7 @@ struct jailhouse_system {
                union {
                        struct {
                                __u16 pm_timer_address;
-                               __u8 padding[4];
+                               __u32 vtd_interrupt_limit;
                                struct jailhouse_iommu
                                        iommu_units[JAILHOUSE_MAX_IOMMU_UNITS];
                        } __attribute__((packed)) x86;
@@ -199,7 +199,6 @@ struct jailhouse_system {
                        } __attribute__((packed)) arm;
                } __attribute__((packed));
        } __attribute__((packed)) platform_info;
-       __u32 interrupt_limit;
        struct jailhouse_cell_desc root_cell;
 } __attribute__((packed));
 
diff --git a/tools/root-cell-config.c.tmpl b/tools/root-cell-config.c.tmpl
index 6a271c7..59686d3 100644
--- a/tools/root-cell-config.c.tmpl
+++ b/tools/root-cell-config.c.tmpl
@@ -67,6 +67,7 @@ struct {
                        .pci_mmconfig_end_bus = ${hex(mmconfig.end_bus)},
                        .x86 = {
                                .pm_timer_address = ${hex(pm_timer_base)},
+                               .vtd_interrupt_limit = 256,
                                % if iommu_units:
                                .iommu_units = {
                                        % for unit in iommu_units:
@@ -85,7 +86,6 @@ struct {
                                % endif
                        },
                },
-               .interrupt_limit = 256,
                .root_cell = {
                        .name = "RootCell",
                        .cpu_set_size = sizeof(config.cpus),
-- 
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