Rusty Russell | 7334492 | 2007-10-25 14:12:20 +1000 | [diff] [blame] | 1 | #ifndef _LINUX_LGUEST_LAUNCHER |
| 2 | #define _LINUX_LGUEST_LAUNCHER |
Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 3 | /* Everything the "lguest" userspace program needs to know. */ |
Rusty Russell | b45d8cb | 2007-10-22 10:56:24 +1000 | [diff] [blame] | 4 | #include <linux/types.h> |
Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 5 | |
Rusty Russell | e2c9784 | 2007-07-26 10:41:03 -0700 | [diff] [blame] | 6 | /*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 Russell | b3e28b6 | 2015-02-11 15:22:01 +1030 | [diff] [blame] | 11 | * 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 Russell | e2c9784 | 2007-07-26 10:41:03 -0700 | [diff] [blame] | 13 | * |
Rusty Russell | a6bd8e1 | 2008-03-28 11:05:53 -0500 | [diff] [blame] | 14 | * 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 Russell | e2c9784 | 2007-07-26 10:41:03 -0700 | [diff] [blame] | 17 | */ |
Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 18 | |
| 19 | /* Write command first word is a request. */ |
| 20 | enum lguest_req |
| 21 | { |
Matias Zabaljauregui | 58a2456 | 2008-09-29 01:40:07 -0300 | [diff] [blame] | 22 | LHREQ_INITIALIZE, /* + base, pfnlimit, start */ |
Rusty Russell | 1504527 | 2007-10-22 11:24:10 +1000 | [diff] [blame] | 23 | LHREQ_GETDMA, /* No longer used */ |
Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 24 | LHREQ_IRQ, /* + irq */ |
Rusty Russell | 5dac051 | 2009-06-12 22:27:10 -0600 | [diff] [blame] | 25 | LHREQ_BREAK, /* No longer used */ |
Rusty Russell | d9bab50 | 2015-02-11 15:28:01 +1030 | [diff] [blame] | 26 | LHREQ_EVENTFD, /* No longer used. */ |
Rusty Russell | 18c1373 | 2015-02-11 15:15:09 +1030 | [diff] [blame] | 27 | LHREQ_GETREG, /* + offset within struct pt_regs (then read value). */ |
| 28 | LHREQ_SETREG, /* + offset within struct pt_regs, value. */ |
Rusty Russell | 8ed3130 | 2015-02-11 15:15:09 +1030 | [diff] [blame] | 29 | LHREQ_TRAP, /* + trap number to deliver to guest. */ |
Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 30 | }; |
Rusty Russell | 2966af7 | 2008-12-30 09:25:58 -0600 | [diff] [blame] | 31 | |
Rusty Russell | 2e04ef7 | 2009-07-30 16:03:45 -0600 | [diff] [blame] | 32 | /* |
Rusty Russell | 69a09dc | 2015-02-11 15:15:09 +1030 | [diff] [blame] | 33 | * 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 | */ |
| 39 | struct lguest_pending { |
| 40 | __u8 trap; |
| 41 | __u8 insn[7]; |
| 42 | __u32 addr; |
| 43 | }; |
Rusty Russell | 7334492 | 2007-10-25 14:12:20 +1000 | [diff] [blame] | 44 | #endif /* _LINUX_LGUEST_LAUNCHER */ |