diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-10-07 07:46:36 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-10-07 07:46:36 +0100 |
commit | a98dc13703e091bb94e86a537d5c7a0ef9ffb62f (patch) | |
tree | baddf36a6fe54f4d3ea1bc0238b69a3e5f0de4bc /xen/include/xen/grant_table.h | |
parent | 1766cdc32b025ecea48d880370ddd78ece9bfc71 (diff) | |
download | xen-a98dc13703e091bb94e86a537d5c7a0ef9ffb62f.tar.gz xen-a98dc13703e091bb94e86a537d5c7a0ef9ffb62f.tar.bz2 xen-a98dc13703e091bb94e86a537d5c7a0ef9ffb62f.zip |
Introduce a grant_entry_v2 structure.
Signed-off-by: Steven Smith <steven.smith@citrix.com>
Diffstat (limited to 'xen/include/xen/grant_table.h')
-rw-r--r-- | xen/include/xen/grant_table.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h index c1ea9e0652..5eb44874d5 100644 --- a/xen/include/xen/grant_table.h +++ b/xen/include/xen/grant_table.h @@ -80,7 +80,15 @@ struct grant_table { /* Table size. Number of frames shared with guest */ unsigned int nr_grant_frames; /* Shared grant table (see include/public/grant_table.h). */ - struct grant_entry_v1 **shared; + union { + void **shared_raw; + struct grant_entry_v1 **shared_v1; + union grant_entry_v2 **shared_v2; + }; + /* Number of grant status frames shared with guest (for version 2) */ + unsigned int nr_status_frames; + /* State grant table (see include/public/grant_table.h). */ + grant_status_t **status; /* Active grant table. */ struct active_grant_entry **active; /* Mapping tracking table. */ @@ -89,6 +97,9 @@ struct grant_table { unsigned int maptrack_limit; /* Lock protecting updates to active and shared grant tables. */ spinlock_t lock; + /* The defined versions are 1 and 2. Set to 0 if we don't know + what version to use yet. */ + unsigned gt_version; }; /* Create/destroy per-domain grant table context. */ @@ -114,10 +125,19 @@ static inline unsigned int nr_grant_frames(struct grant_table *gt) return gt->nr_grant_frames; } -/* Number of grant table entries. Caller must hold d's grant table lock. */ -static inline unsigned int nr_grant_entries(struct grant_table *gt) +/* Number of status grant table frames. Caller must hold d's gr. table lock.*/ +static inline unsigned int nr_status_frames(struct grant_table *gt) { - return (nr_grant_frames(gt) << PAGE_SHIFT) / sizeof(grant_entry_v1_t); + return gt->nr_status_frames; +} + +#define GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) +#define GRANT_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) +/* Number of grant table status entries. Caller must hold d's gr. table lock.*/ +static inline unsigned int grant_to_status_frames(int grant_frames) +{ + return (grant_frames * GRANT_PER_PAGE + GRANT_STATUS_PER_PAGE - 1) / + GRANT_STATUS_PER_PAGE; } static inline unsigned int |