]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/jailhouse.git/commitdiff
inmates: x86: Enhance Linux setup data structure
authorJan Kiszka <jan.kiszka@siemens.com>
Fri, 24 Nov 2017 07:01:12 +0000 (08:01 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Mon, 27 Nov 2017 07:36:23 +0000 (08:36 +0100)
Expand the Jailhouse-specific setup data structure we pass to the Linux
kernel on boot by the calibrated TSC and APIC timer frequencies. Also
switch the type to a value we are going to reserve officially in the
upstream kernel, rather than using the large magic value.

Although this is a change that should normally increase the version of
the struct, we keep it untouched as we didn't release the previous
structure version yet. Specifically, there is no official kernel out
there expecting the old structure.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates/tools/x86/linux-loader.c
tools/jailhouse-cell-linux

index b621b07609c0d38c57ea8164ffeadf1118d50c05..cca6056ba0f88736d99811e3eaf5a05c82fff123 100644 (file)
@@ -21,7 +21,7 @@ struct boot_params {
        u64     setup_data;
        u8      padding3[8];
        u32     init_size;
-};
+} __attribute__((packed));
 
 struct setup_data {
        u64     next;
@@ -32,9 +32,11 @@ struct setup_data {
        u16     pm_timer_address;
        u16     num_cpus;
        u64     pci_mmconfig_base;
+       u32     tsc_khz;
+       u32     apic_khz;
        u8      standard_ioapic;
        u8      cpu_ids[SMP_MAX_CPUS];
-};
+} __attribute__((packed));
 
 void inmate_main(void)
 {
@@ -50,6 +52,8 @@ void inmate_main(void)
        setup_data = (struct setup_data *)boot_params->setup_data;
        setup_data->pm_timer_address = comm_region->pm_timer_address;
        setup_data->pci_mmconfig_base = comm_region->pci_mmconfig_base;
+       setup_data->tsc_khz = comm_region->tsc_khz;
+       setup_data->apic_khz = comm_region->apic_khz;
        setup_data->num_cpus = comm_region->num_cpus;
 
        smp_wait_for_all_cpus();
index e693bd0293ec24787938ef8e3dd16c12ed4aea5d..086d5982b80707c085b223d38c199b644247237c 100755 (executable)
@@ -718,13 +718,14 @@ class JailhouseCell:
 
 
 def x86_gen_setup_data(config):
+    SETUP_TYPE_JAILHOUSE = 6
     MAX_CPUS = 255
     SETUP_DATA_VERSION = 1
     standard_ioapic = 0
     for irqchip in config.irqchips:
         if irqchip.is_standard():
             standard_ioapic = 1
-    return struct.pack('8x4sIHH12xB', b'JLHS', 17 + MAX_CPUS,
+    return struct.pack('8xIIHH12x8xB', SETUP_TYPE_JAILHOUSE, 25 + MAX_CPUS,
                        SETUP_DATA_VERSION, SETUP_DATA_VERSION,
                        standard_ioapic) + \
         bytearray(MAX_CPUS)