blob: 9ddac2f0a97ce6292042f50fe55d3fa55e086d15 [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__
Jes Sorensen47aee452007-10-22 11:03:33 +10007#include <linux/time.h>
Rusty Russell07ad1572007-07-19 01:49:22 -07008#include <asm/irq.h>
Jes Sorensenc37ae932007-10-22 10:56:26 +10009#include <asm/lguest_hcall.h>
Rusty Russell07ad1572007-07-19 01:49:22 -070010
Rusty Russelld7e28ff2007-07-19 01:49:23 -070011#define LG_CLOCK_MIN_DELTA 100UL
12#define LG_CLOCK_MAX_DELTA ULONG_MAX
13
Rusty Russellb2b47c22007-07-26 10:41:02 -070014/*G:032 The second method of communicating with the Host is to via "struct
15 * lguest_data". The Guest's very first hypercall is to tell the Host where
16 * this is, and then the Guest and Host both publish information in it. :*/
Rusty Russell07ad1572007-07-19 01:49:22 -070017struct lguest_data
18{
Rusty Russellb2b47c22007-07-26 10:41:02 -070019 /* 512 == enabled (same as eflags in normal hardware). The Guest
20 * changes interrupts so often that a hypercall is too slow. */
Rusty Russell07ad1572007-07-19 01:49:22 -070021 unsigned int irq_enabled;
Rusty Russellb2b47c22007-07-26 10:41:02 -070022 /* Fine-grained interrupt disabling by the Guest */
Rusty Russell07ad1572007-07-19 01:49:22 -070023 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
24
Rusty Russellb2b47c22007-07-26 10:41:02 -070025 /* The Host writes the virtual address of the last page fault here,
26 * which saves the Guest a hypercall. CR2 is the native register where
27 * this address would normally be found. */
Rusty Russell07ad1572007-07-19 01:49:22 -070028 unsigned long cr2;
29
Rusty Russell6c8dca52007-07-27 13:42:52 +100030 /* Wallclock time set by the Host. */
31 struct timespec time;
32
Rusty Russellb2b47c22007-07-26 10:41:02 -070033 /* Async hypercall ring. Instead of directly making hypercalls, we can
34 * place them in here for processing the next time the Host wants.
35 * This batching can be quite efficient. */
36
37 /* 0xFF == done (set by Host), 0 == pending (set by Guest). */
Rusty Russell07ad1572007-07-19 01:49:22 -070038 u8 hcall_status[LHCALL_RING_SIZE];
Rusty Russellb2b47c22007-07-26 10:41:02 -070039 /* The actual registers for the hypercalls. */
Jes Sorensenb410e7b2007-10-22 11:03:31 +100040 struct hcall_args hcalls[LHCALL_RING_SIZE];
Rusty Russell07ad1572007-07-19 01:49:22 -070041
Rusty Russellb2b47c22007-07-26 10:41:02 -070042/* Fields initialized by the Host at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070043 /* Memory not to try to access */
44 unsigned long reserve_mem;
Rusty Russelld7e28ff2007-07-19 01:49:23 -070045 /* KHz for the TSC clock. */
46 u32 tsc_khz;
Rusty Russell07ad1572007-07-19 01:49:22 -070047
Rusty Russellb2b47c22007-07-26 10:41:02 -070048/* Fields initialized by the Guest at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070049 /* Instruction range to suppress interrupts even if enabled */
50 unsigned long noirq_start, noirq_end;
51};
52extern struct lguest_data lguest_data;
53#endif /* __ASSEMBLY__ */
Jes Sorensenc37ae932007-10-22 10:56:26 +100054#endif /* _LINUX_LGUEST_H */