aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/grant_table.h
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-08-24 09:48:55 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-08-24 09:48:55 +0000
commita51ed685b8017af8857fc76a4f3a7e1bc0599ebb (patch)
treee92a1e56008bfa05261bc930e9c672cf1da46510 /xen/include/xen/grant_table.h
parent23bb5ee5188adeb6a37b8294c14aff5f4256d8d8 (diff)
downloadxen-a51ed685b8017af8857fc76a4f3a7e1bc0599ebb.tar.gz
xen-a51ed685b8017af8857fc76a4f3a7e1bc0599ebb.tar.bz2
xen-a51ed685b8017af8857fc76a4f3a7e1bc0599ebb.zip
bitkeeper revision 1.1159.45.17 (412b0f07nrZVpzBQ0MnEcFNcQUolbw)
More grant-table code. Various cleanups and speedups.
Diffstat (limited to 'xen/include/xen/grant_table.h')
-rw-r--r--xen/include/xen/grant_table.h42
1 files changed, 39 insertions, 3 deletions
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 92a81de929..1421486410 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -24,9 +24,45 @@
#ifndef __XEN_GRANT_H__
#define __XEN_GRANT_H__
-#ifndef __GRANT_TABLE_IMPLEMENTATION__
-typedef void grant_table_t;
-#endif
+#include <hypervisor-ifs/grant_table.h>
+
+/* Active grant entry - used for shadowing GTF_permit_access grants. */
+typedef struct {
+ u32 status; /* Reference count information. */
+ u32 tlbflush_timestamp; /* Flush avoidance. */
+ u16 next; /* Mapping hash chain. */
+ domid_t domid; /* Domain being granted access. */
+ unsigned long frame; /* Frame being granted. */
+} active_grant_entry_t;
+
+/*
+ * Bitfields in active_grant_entry_t:counts.
+ * NB. Some other GNTPIN_xxx definitions are in hypervisor-ifs/grant_table.h.
+ */
+ /* Count of writable host-CPU mappings. */
+#define GNTPIN_wmap_shift (4)
+#define GNTPIN_wmap_mask (0x3FFFU << GNTPIN_wmap_shift)
+ /* Count of read-only host-CPU mappings. */
+#define GNTPIN_rmap_shift (18)
+#define GNTPIN_rmap_mask (0x3FFFU << GNTPIN_rmap_shift)
+
+#define GNT_MAPHASH_SZ (256)
+#define GNT_MAPHASH(_k) ((_k) & (GNT_MAPHASH_SZ-1))
+#define GNT_MAPHASH_INVALID (0xFFFFU)
+
+#define NR_GRANT_ENTRIES (PAGE_SIZE / sizeof(grant_entry_t))
+
+/* Per-domain grant information. */
+typedef struct {
+ /* Shared grant table (see include/hypervisor-ifs/grant_table.h). */
+ grant_entry_t *shared;
+ /* Active grant table. */
+ active_grant_entry_t *active;
+ /* Lock protecting updates to maphash and shared grant table. */
+ spinlock_t lock;
+ /* Hash table: frame -> active grant entry. */
+ u16 maphash[GNT_MAPHASH_SZ];
+} grant_table_t;
/* Start-of-day system initialisation. */
void grant_table_init(void);