blob: ea335c8f86c330b9d343b118cf4e8526d01ea0c3 [file] [log] [blame]
Rusty Russell07ad1572007-07-19 01:49:22 -07001/* Things the lguest guest needs to know. Note: like all lguest interfaces,
2 * this is subject to wild and random change between versions. */
Jes Sorensenc37ae932007-10-22 10:56:26 +10003#ifndef _LINUX_LGUEST_H
4#define _LINUX_LGUEST_H
Rusty Russell07ad1572007-07-19 01:49:22 -07005
Rusty Russell07ad1572007-07-19 01:49:22 -07006#ifndef __ASSEMBLY__
7#include <asm/irq.h>
Jes Sorensenc37ae932007-10-22 10:56:26 +10008#include <asm/lguest_hcall.h>
Rusty Russell07ad1572007-07-19 01:49:22 -07009
Rusty Russelld7e28ff2007-07-19 01:49:23 -070010#define LG_CLOCK_MIN_DELTA 100UL
11#define LG_CLOCK_MAX_DELTA ULONG_MAX
12
Rusty Russellb2b47c22007-07-26 10:41:02 -070013/*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 Russell07ad1572007-07-19 01:49:22 -070016struct lguest_data
17{
Rusty Russellb2b47c22007-07-26 10:41:02 -070018 /* 512 == enabled (same as eflags in normal hardware). The Guest
19 * changes interrupts so often that a hypercall is too slow. */
Rusty Russell07ad1572007-07-19 01:49:22 -070020 unsigned int irq_enabled;
Rusty Russellb2b47c22007-07-26 10:41:02 -070021 /* Fine-grained interrupt disabling by the Guest */
Rusty Russell07ad1572007-07-19 01:49:22 -070022 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
23
Rusty Russellb2b47c22007-07-26 10:41:02 -070024 /* 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 Russell07ad1572007-07-19 01:49:22 -070027 unsigned long cr2;
28
Rusty Russell6c8dca52007-07-27 13:42:52 +100029 /* Wallclock time set by the Host. */
30 struct timespec time;
31
Rusty Russellb2b47c22007-07-26 10:41:02 -070032 /* 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 Russell07ad1572007-07-19 01:49:22 -070037 u8 hcall_status[LHCALL_RING_SIZE];
Rusty Russellb2b47c22007-07-26 10:41:02 -070038 /* The actual registers for the hypercalls. */
Jes Sorensenb410e7b2007-10-22 11:03:31 +100039 struct hcall_args hcalls[LHCALL_RING_SIZE];
Rusty Russell07ad1572007-07-19 01:49:22 -070040
Rusty Russellb2b47c22007-07-26 10:41:02 -070041/* Fields initialized by the Host at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070042 /* Memory not to try to access */
43 unsigned long reserve_mem;
Rusty Russelld7e28ff2007-07-19 01:49:23 -070044 /* KHz for the TSC clock. */
45 u32 tsc_khz;
Rusty Russell07ad1572007-07-19 01:49:22 -070046
Rusty Russellb2b47c22007-07-26 10:41:02 -070047/* Fields initialized by the Guest at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070048 /* Instruction range to suppress interrupts even if enabled */
49 unsigned long noirq_start, noirq_end;
50};
51extern struct lguest_data lguest_data;
52#endif /* __ASSEMBLY__ */
Jes Sorensenc37ae932007-10-22 10:56:26 +100053#endif /* _LINUX_LGUEST_H */