Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 1 | /* Things the lguest guest needs to know. Note: like all lguest interfaces, |
| 2 | * this is subject to wild and random change between versions. */ |
Jes Sorensen | c37ae93 | 2007-10-22 10:56:26 +1000 | [diff] [blame^] | 3 | #ifndef _LINUX_LGUEST_H |
| 4 | #define _LINUX_LGUEST_H |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 5 | |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 6 | #ifndef __ASSEMBLY__ |
| 7 | #include <asm/irq.h> |
Jes Sorensen | c37ae93 | 2007-10-22 10:56:26 +1000 | [diff] [blame^] | 8 | #include <asm/lguest_hcall.h> |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 9 | |
Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 10 | #define LG_CLOCK_MIN_DELTA 100UL |
| 11 | #define LG_CLOCK_MAX_DELTA ULONG_MAX |
| 12 | |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 13 | /*G:032 The second method of communicating with the Host is to via "struct |
| 14 | * lguest_data". The Guest's very first hypercall is to tell the Host where |
| 15 | * this is, and then the Guest and Host both publish information in it. :*/ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 16 | struct lguest_data |
| 17 | { |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 18 | /* 512 == enabled (same as eflags in normal hardware). The Guest |
| 19 | * changes interrupts so often that a hypercall is too slow. */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 20 | unsigned int irq_enabled; |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 21 | /* Fine-grained interrupt disabling by the Guest */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 22 | DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS); |
| 23 | |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 24 | /* The Host writes the virtual address of the last page fault here, |
| 25 | * which saves the Guest a hypercall. CR2 is the native register where |
| 26 | * this address would normally be found. */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 27 | unsigned long cr2; |
| 28 | |
Rusty Russell | 6c8dca5 | 2007-07-27 13:42:52 +1000 | [diff] [blame] | 29 | /* Wallclock time set by the Host. */ |
| 30 | struct timespec time; |
| 31 | |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 32 | /* Async hypercall ring. Instead of directly making hypercalls, we can |
| 33 | * place them in here for processing the next time the Host wants. |
| 34 | * This batching can be quite efficient. */ |
| 35 | |
| 36 | /* 0xFF == done (set by Host), 0 == pending (set by Guest). */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 37 | u8 hcall_status[LHCALL_RING_SIZE]; |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 38 | /* The actual registers for the hypercalls. */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 39 | struct hcall_ring hcalls[LHCALL_RING_SIZE]; |
| 40 | |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 41 | /* Fields initialized by the Host at boot: */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 42 | /* Memory not to try to access */ |
| 43 | unsigned long reserve_mem; |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 44 | /* ID of this Guest (used by network driver to set ethernet address) */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 45 | u16 guestid; |
Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 46 | /* KHz for the TSC clock. */ |
| 47 | u32 tsc_khz; |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 48 | |
Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 49 | /* Fields initialized by the Guest at boot: */ |
Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 50 | /* Instruction range to suppress interrupts even if enabled */ |
| 51 | unsigned long noirq_start, noirq_end; |
| 52 | }; |
| 53 | extern struct lguest_data lguest_data; |
| 54 | #endif /* __ASSEMBLY__ */ |
Jes Sorensen | c37ae93 | 2007-10-22 10:56:26 +1000 | [diff] [blame^] | 55 | #endif /* _LINUX_LGUEST_H */ |