I have two questions: 

1) For Jailhouse images: is there any way I can rebuild Jailhouse one inside 
the x86 image? When I clone jailhouse inside the image and try to make it, the 
necessary linux-header stuff isn't there, and there doesn't seem to be a 
linux-header package for 4.14.50.

2) For running Jailhouse on my real x86 machine: I'm trying to run a basic 
inmate based off of the apic-demo, but my workflow doesn't seem to work. My 
machine hangs when I try to load the cell. Here is what I am doing on an x86 
Ubuntu 18.04 (kernel 4.15.0-34-generic). Is the following correct? (Bazooka is 
the name of my machine):

<set intel_iommu=on in the kernel command line and reboot>
cd ~ 
git clone https://github.com/siemens/jailhouse 
cd ~/jailhouse 
make 
sudo ./tools/jailhouse config create ./configs/x86/bazooka.c 
make 
<set intel_iommu=off in the kernel command line and reboot> 
cd ~/jailhouse 
sudo insmod ./driver/jailhouse.ko 
sudo ./tools/jailhouse enable ./configs/x86/bazooka.cell 
sudo ./tools/jailhouse cell create ./configs/x86/bazooka-demo.cell 
sudo ./tools/jailhouse cell load bazooka-demo 
./inmates/demos/x86/bazooka-demo.bin 
<**This is where Jailhouse hangs and my Linux starts to crash**> 
sudo ./tools/jailhouse cell start bazooka-demo 
sudo ./tools/jailhouse cell destroy bazooka-demo 
sudo ./tools/jailhouse disable 

My inmate "bazooka-demo" is defined by ./inmates/demos/x86/bazooka-demo.c. I 
stripped down the "apic-demo.c" file to create a basic inmate. 

#include <inmate.h> 
void inmate_main(void) 
{ 
    bool terminate = false; 
    comm_region->cell_state = JAILHOUSE_CELL_RUNNING_LOCKED; 
    while (!terminate) { 
        switch (comm_region->msg_to_cell) { 
        case JAILHOUSE_MSG_SHUTDOWN_REQUEST: 
            printk("MGH: Shutting down bazooka-demo cell"); 
            terminate = true; 
            break; 
        default: 
            printk("MGH: Sending reply from bazooka-demo cell"); 
            jailhouse_send_reply_from_cell(comm_region, 
                    JAILHOUSE_MSG_UNKNOWN); 
            break; 
        } 
    } 
 
    printk("MGH: Stopped APIC demo\n"); 
    comm_region->cell_state = JAILHOUSE_CELL_SHUT_DOWN; 
} 

And here is ./configs/x86/bazooka-demo.c (based off of apic-demo.c):

#include <jailhouse/types.h>
#include <jailhouse/cell-config.h>

#define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])

struct {
        struct jailhouse_cell_desc cell;
        __u64 cpus[1];
        struct jailhouse_memory mem_regions[2];
        struct jailhouse_cache cache_regions[1];
        __u8 pio_bitmap[0x2000];
} __attribute__((packed)) config = {
        .cell = {
                .signature = JAILHOUSE_CELL_DESC_SIGNATURE,
                .revision = JAILHOUSE_CONFIG_REVISION,
                .name = "bazooka-demo",

                .cpu_set_size = sizeof(config.cpus),
                .num_memory_regions = ARRAY_SIZE(config.mem_regions),
                .num_cache_regions = ARRAY_SIZE(config.cache_regions),
                .num_irqchips = 0,
                .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
                .num_pci_devices = 0,

                .console = {
                        .type = JAILHOUSE_CON_TYPE_8250,
                        .flags = JAILHOUSE_CON_ACCESS_PIO,
                        .address = 0x3f8,
                },
        },

        .cpus = {
                0x8,
        },

        .mem_regions = {
                /* RAM */ {
                        .phys_start = 0x3f000000,
                        .virt_start = 0,
                        .size = 0x00100000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                                JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
                },
                /* communication region */ {
                        .virt_start = 0x00100000,
                        .size = 0x00001000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                                JAILHOUSE_MEM_COMM_REGION,
                },
        },

        .cache_regions = {
                {
                        .start = 0,
                        .size = 2,
                        .type = JAILHOUSE_CACHE_L3,
                },
        },

        .pio_bitmap = {
                [     0/8 ...  0x2f7/8] = -1,
                [ 0x2f8/8 ...  0x2ff/8] = 0, /* serial2 */
                [ 0x300/8 ...  0x3f7/8] = -1,
                [ 0x3f8/8 ...  0x3ff/8] = 0, /* serial1 */
                [ 0x400/8 ... 0xe00f/8] = -1,
                [0xe010/8 ... 0xe017/8] = 0, /* OXPCIe952 serial1 */
                [0xe018/8 ... 0xffff/8] = -1,
        },
};


What am I doing wrong? I'm guessing that I need to change the bazooka-demo 
config somehow, but I'm not sure where to begin.

Thanks, 
Michael

-- 
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