blob: acd5b12565cc2725724ed8a65692df9142634fae [file] [log] [blame]
Rusty Russell73344922007-10-25 14:12:20 +10001#ifndef _LINUX_LGUEST_LAUNCHER
2#define _LINUX_LGUEST_LAUNCHER
Rusty Russelld7e28ff2007-07-19 01:49:23 -07003/* Everything the "lguest" userspace program needs to know. */
Rusty Russellb45d8cb2007-10-22 10:56:24 +10004#include <linux/types.h>
Rusty Russelld7e28ff2007-07-19 01:49:23 -07005
Rusty Russelle2c97842007-07-26 10:41:03 -07006/*D:010
7 * Drivers
8 *
9 * The Guest needs devices to do anything useful. Since we don't let it touch
10 * real devices (think of the damage it could do!) we provide virtual devices.
Rusty Russellb3e28b62015-02-11 15:22:01 +103011 * We emulate a PCI bus with virtio devices on it; we used to have our own
12 * lguest bus which was far simpler, but this tests the virtio 1.0 standard.
Rusty Russelle2c97842007-07-26 10:41:03 -070013 *
Rusty Russella6bd8e12008-03-28 11:05:53 -050014 * Virtio devices are also used by kvm, so we can simply reuse their optimized
15 * device drivers. And one day when everyone uses virtio, my plan will be
16 * complete. Bwahahahah!
Rusty Russelle2c97842007-07-26 10:41:03 -070017 */
Rusty Russelld7e28ff2007-07-19 01:49:23 -070018
19/* Write command first word is a request. */
20enum lguest_req
21{
Matias Zabaljauregui58a24562008-09-29 01:40:07 -030022 LHREQ_INITIALIZE, /* + base, pfnlimit, start */
Rusty Russell15045272007-10-22 11:24:10 +100023 LHREQ_GETDMA, /* No longer used */
Rusty Russelld7e28ff2007-07-19 01:49:23 -070024 LHREQ_IRQ, /* + irq */
Rusty Russell5dac0512009-06-12 22:27:10 -060025 LHREQ_BREAK, /* No longer used */
Rusty Russelld9bab502015-02-11 15:28:01 +103026 LHREQ_EVENTFD, /* No longer used. */
Rusty Russell18c13732015-02-11 15:15:09 +103027 LHREQ_GETREG, /* + offset within struct pt_regs (then read value). */
28 LHREQ_SETREG, /* + offset within struct pt_regs, value. */
Rusty Russell8ed31302015-02-11 15:15:09 +103029 LHREQ_TRAP, /* + trap number to deliver to guest. */
Rusty Russelld7e28ff2007-07-19 01:49:23 -070030};
Rusty Russell2966af72008-12-30 09:25:58 -060031
Rusty Russell2e04ef72009-07-30 16:03:45 -060032/*
Rusty Russell69a09dc2015-02-11 15:15:09 +103033 * This is what read() of the lguest fd populates. trap ==
34 * LGUEST_TRAP_ENTRY for an LHCALL_NOTIFY (addr is the
35 * argument), 14 for a page fault in the MMIO region (addr is
36 * the trap address, insn is the instruction), or 13 for a GPF
37 * (insn is the instruction).
38 */
39struct lguest_pending {
40 __u8 trap;
41 __u8 insn[7];
42 __u32 addr;
43};
Rusty Russell73344922007-10-25 14:12:20 +100044#endif /* _LINUX_LGUEST_LAUNCHER */