diff options
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/balloon.h | 6 | ||||
-rw-r--r-- | include/xen/events.h | 7 | ||||
-rw-r--r-- | include/xen/grant_table.h | 37 | ||||
-rw-r--r-- | include/xen/interface/grant_table.h | 167 | ||||
-rw-r--r-- | include/xen/interface/io/blkif.h | 40 | ||||
-rw-r--r-- | include/xen/interface/io/xs_wire.h | 6 | ||||
-rw-r--r-- | include/xen/interface/xen.h | 2 | ||||
-rw-r--r-- | include/xen/xenbus.h | 31 | ||||
-rw-r--r-- | include/xen/xenbus_dev.h | 41 |
9 files changed, 293 insertions, 44 deletions
diff --git a/include/xen/balloon.h b/include/xen/balloon.h index d29c153705bc..cc2e1a7e44ec 100644 --- a/include/xen/balloon.h +++ b/include/xen/balloon.h | |||
@@ -29,11 +29,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages, | |||
29 | bool highmem); | 29 | bool highmem); |
30 | void free_xenballooned_pages(int nr_pages, struct page **pages); | 30 | void free_xenballooned_pages(int nr_pages, struct page **pages); |
31 | 31 | ||
32 | struct sys_device; | 32 | struct device; |
33 | #ifdef CONFIG_XEN_SELFBALLOONING | 33 | #ifdef CONFIG_XEN_SELFBALLOONING |
34 | extern int register_xen_selfballooning(struct sys_device *sysdev); | 34 | extern int register_xen_selfballooning(struct device *dev); |
35 | #else | 35 | #else |
36 | static inline int register_xen_selfballooning(struct sys_device *sysdev) | 36 | static inline int register_xen_selfballooning(struct device *dev) |
37 | { | 37 | { |
38 | return -ENOSYS; | 38 | return -ENOSYS; |
39 | } | 39 | } |
diff --git a/include/xen/events.h b/include/xen/events.h index d287997d3eab..0f773708e02c 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
@@ -37,6 +37,13 @@ int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, | |||
37 | */ | 37 | */ |
38 | void unbind_from_irqhandler(unsigned int irq, void *dev_id); | 38 | void unbind_from_irqhandler(unsigned int irq, void *dev_id); |
39 | 39 | ||
40 | /* | ||
41 | * Allow extra references to event channels exposed to userspace by evtchn | ||
42 | */ | ||
43 | int evtchn_make_refcounted(unsigned int evtchn); | ||
44 | int evtchn_get(unsigned int evtchn); | ||
45 | void evtchn_put(unsigned int evtchn); | ||
46 | |||
40 | void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); | 47 | void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); |
41 | int resend_irq_on_evtchn(unsigned int irq); | 48 | int resend_irq_on_evtchn(unsigned int irq); |
42 | void rebind_evtchn_irq(int evtchn, int irq); | 49 | void rebind_evtchn_irq(int evtchn, int irq); |
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 11e2dfce42f8..15f8a00ff003 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h | |||
@@ -62,6 +62,24 @@ int gnttab_resume(void); | |||
62 | 62 | ||
63 | int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, | 63 | int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, |
64 | int readonly); | 64 | int readonly); |
65 | int gnttab_grant_foreign_access_subpage(domid_t domid, unsigned long frame, | ||
66 | int flags, unsigned page_off, | ||
67 | unsigned length); | ||
68 | int gnttab_grant_foreign_access_trans(domid_t domid, int flags, | ||
69 | domid_t trans_domid, | ||
70 | grant_ref_t trans_gref); | ||
71 | |||
72 | /* | ||
73 | * Are sub-page grants available on this version of Xen? Returns true if they | ||
74 | * are, and false if they're not. | ||
75 | */ | ||
76 | bool gnttab_subpage_grants_available(void); | ||
77 | |||
78 | /* | ||
79 | * Are transitive grants available on this version of Xen? Returns true if they | ||
80 | * are, and false if they're not. | ||
81 | */ | ||
82 | bool gnttab_trans_grants_available(void); | ||
65 | 83 | ||
66 | /* | 84 | /* |
67 | * End access through the given grant reference, iff the grant entry is no | 85 | * End access through the given grant reference, iff the grant entry is no |
@@ -108,6 +126,13 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback); | |||
108 | 126 | ||
109 | void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, | 127 | void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, |
110 | unsigned long frame, int readonly); | 128 | unsigned long frame, int readonly); |
129 | int gnttab_grant_foreign_access_subpage_ref(grant_ref_t ref, domid_t domid, | ||
130 | unsigned long frame, int flags, | ||
131 | unsigned page_off, | ||
132 | unsigned length); | ||
133 | int gnttab_grant_foreign_access_trans_ref(grant_ref_t ref, domid_t domid, | ||
134 | int flags, domid_t trans_domid, | ||
135 | grant_ref_t trans_gref); | ||
111 | 136 | ||
112 | void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, | 137 | void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, |
113 | unsigned long pfn); | 138 | unsigned long pfn); |
@@ -145,9 +170,11 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr, | |||
145 | 170 | ||
146 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | 171 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, |
147 | unsigned long max_nr_gframes, | 172 | unsigned long max_nr_gframes, |
148 | struct grant_entry **__shared); | 173 | void **__shared); |
149 | void arch_gnttab_unmap_shared(struct grant_entry *shared, | 174 | int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, |
150 | unsigned long nr_gframes); | 175 | unsigned long max_nr_gframes, |
176 | grant_status_t **__shared); | ||
177 | void arch_gnttab_unmap(void *shared, unsigned long nr_gframes); | ||
151 | 178 | ||
152 | extern unsigned long xen_hvm_resume_frames; | 179 | extern unsigned long xen_hvm_resume_frames; |
153 | unsigned int gnttab_max_grant_frames(void); | 180 | unsigned int gnttab_max_grant_frames(void); |
@@ -155,9 +182,9 @@ unsigned int gnttab_max_grant_frames(void); | |||
155 | #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) | 182 | #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) |
156 | 183 | ||
157 | int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | 184 | int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, |
158 | struct gnttab_map_grant_ref *kmap_ops, | 185 | struct gnttab_map_grant_ref *kmap_ops, |
159 | struct page **pages, unsigned int count); | 186 | struct page **pages, unsigned int count); |
160 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | 187 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, |
161 | struct page **pages, unsigned int count); | 188 | struct page **pages, unsigned int count, bool clear_pte); |
162 | 189 | ||
163 | #endif /* __ASM_GNTTAB_H__ */ | 190 | #endif /* __ASM_GNTTAB_H__ */ |
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h index 39e571796e32..a17d84433e6a 100644 --- a/include/xen/interface/grant_table.h +++ b/include/xen/interface/grant_table.h | |||
@@ -85,12 +85,22 @@ | |||
85 | */ | 85 | */ |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Reference to a grant entry in a specified domain's grant table. | ||
89 | */ | ||
90 | typedef uint32_t grant_ref_t; | ||
91 | |||
92 | /* | ||
88 | * A grant table comprises a packed array of grant entries in one or more | 93 | * A grant table comprises a packed array of grant entries in one or more |
89 | * page frames shared between Xen and a guest. | 94 | * page frames shared between Xen and a guest. |
90 | * [XEN]: This field is written by Xen and read by the sharing guest. | 95 | * [XEN]: This field is written by Xen and read by the sharing guest. |
91 | * [GST]: This field is written by the guest and read by Xen. | 96 | * [GST]: This field is written by the guest and read by Xen. |
92 | */ | 97 | */ |
93 | struct grant_entry { | 98 | |
99 | /* | ||
100 | * Version 1 of the grant table entry structure is maintained purely | ||
101 | * for backwards compatibility. New guests should use version 2. | ||
102 | */ | ||
103 | struct grant_entry_v1 { | ||
94 | /* GTF_xxx: various type and flag information. [XEN,GST] */ | 104 | /* GTF_xxx: various type and flag information. [XEN,GST] */ |
95 | uint16_t flags; | 105 | uint16_t flags; |
96 | /* The domain being granted foreign privileges. [GST] */ | 106 | /* The domain being granted foreign privileges. [GST] */ |
@@ -108,10 +118,13 @@ struct grant_entry { | |||
108 | * GTF_permit_access: Allow @domid to map/access @frame. | 118 | * GTF_permit_access: Allow @domid to map/access @frame. |
109 | * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame | 119 | * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame |
110 | * to this guest. Xen writes the page number to @frame. | 120 | * to this guest. Xen writes the page number to @frame. |
121 | * GTF_transitive: Allow @domid to transitively access a subrange of | ||
122 | * @trans_grant in @trans_domid. No mappings are allowed. | ||
111 | */ | 123 | */ |
112 | #define GTF_invalid (0U<<0) | 124 | #define GTF_invalid (0U<<0) |
113 | #define GTF_permit_access (1U<<0) | 125 | #define GTF_permit_access (1U<<0) |
114 | #define GTF_accept_transfer (2U<<0) | 126 | #define GTF_accept_transfer (2U<<0) |
127 | #define GTF_transitive (3U<<0) | ||
115 | #define GTF_type_mask (3U<<0) | 128 | #define GTF_type_mask (3U<<0) |
116 | 129 | ||
117 | /* | 130 | /* |
@@ -119,6 +132,9 @@ struct grant_entry { | |||
119 | * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST] | 132 | * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST] |
120 | * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN] | 133 | * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN] |
121 | * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN] | 134 | * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN] |
135 | * GTF_sub_page: Grant access to only a subrange of the page. @domid | ||
136 | * will only be allowed to copy from the grant, and not | ||
137 | * map it. [GST] | ||
122 | */ | 138 | */ |
123 | #define _GTF_readonly (2) | 139 | #define _GTF_readonly (2) |
124 | #define GTF_readonly (1U<<_GTF_readonly) | 140 | #define GTF_readonly (1U<<_GTF_readonly) |
@@ -126,6 +142,8 @@ struct grant_entry { | |||
126 | #define GTF_reading (1U<<_GTF_reading) | 142 | #define GTF_reading (1U<<_GTF_reading) |
127 | #define _GTF_writing (4) | 143 | #define _GTF_writing (4) |
128 | #define GTF_writing (1U<<_GTF_writing) | 144 | #define GTF_writing (1U<<_GTF_writing) |
145 | #define _GTF_sub_page (8) | ||
146 | #define GTF_sub_page (1U<<_GTF_sub_page) | ||
129 | 147 | ||
130 | /* | 148 | /* |
131 | * Subflags for GTF_accept_transfer: | 149 | * Subflags for GTF_accept_transfer: |
@@ -142,15 +160,81 @@ struct grant_entry { | |||
142 | #define _GTF_transfer_completed (3) | 160 | #define _GTF_transfer_completed (3) |
143 | #define GTF_transfer_completed (1U<<_GTF_transfer_completed) | 161 | #define GTF_transfer_completed (1U<<_GTF_transfer_completed) |
144 | 162 | ||
163 | /* | ||
164 | * Version 2 grant table entries. These fulfil the same role as | ||
165 | * version 1 entries, but can represent more complicated operations. | ||
166 | * Any given domain will have either a version 1 or a version 2 table, | ||
167 | * and every entry in the table will be the same version. | ||
168 | * | ||
169 | * The interface by which domains use grant references does not depend | ||
170 | * on the grant table version in use by the other domain. | ||
171 | */ | ||
145 | 172 | ||
146 | /*********************************** | 173 | /* |
147 | * GRANT TABLE QUERIES AND USES | 174 | * Version 1 and version 2 grant entries share a common prefix. The |
175 | * fields of the prefix are documented as part of struct | ||
176 | * grant_entry_v1. | ||
148 | */ | 177 | */ |
178 | struct grant_entry_header { | ||
179 | uint16_t flags; | ||
180 | domid_t domid; | ||
181 | }; | ||
149 | 182 | ||
150 | /* | 183 | /* |
151 | * Reference to a grant entry in a specified domain's grant table. | 184 | * Version 2 of the grant entry structure, here is an union because three |
185 | * different types are suppotted: full_page, sub_page and transitive. | ||
186 | */ | ||
187 | union grant_entry_v2 { | ||
188 | struct grant_entry_header hdr; | ||
189 | |||
190 | /* | ||
191 | * This member is used for V1-style full page grants, where either: | ||
192 | * | ||
193 | * -- hdr.type is GTF_accept_transfer, or | ||
194 | * -- hdr.type is GTF_permit_access and GTF_sub_page is not set. | ||
195 | * | ||
196 | * In that case, the frame field has the same semantics as the | ||
197 | * field of the same name in the V1 entry structure. | ||
198 | */ | ||
199 | struct { | ||
200 | struct grant_entry_header hdr; | ||
201 | uint32_t pad0; | ||
202 | uint64_t frame; | ||
203 | } full_page; | ||
204 | |||
205 | /* | ||
206 | * If the grant type is GTF_grant_access and GTF_sub_page is set, | ||
207 | * @domid is allowed to access bytes [@page_off,@page_off+@length) | ||
208 | * in frame @frame. | ||
209 | */ | ||
210 | struct { | ||
211 | struct grant_entry_header hdr; | ||
212 | uint16_t page_off; | ||
213 | uint16_t length; | ||
214 | uint64_t frame; | ||
215 | } sub_page; | ||
216 | |||
217 | /* | ||
218 | * If the grant is GTF_transitive, @domid is allowed to use the | ||
219 | * grant @gref in domain @trans_domid, as if it was the local | ||
220 | * domain. Obviously, the transitive access must be compatible | ||
221 | * with the original grant. | ||
222 | */ | ||
223 | struct { | ||
224 | struct grant_entry_header hdr; | ||
225 | domid_t trans_domid; | ||
226 | uint16_t pad0; | ||
227 | grant_ref_t gref; | ||
228 | } transitive; | ||
229 | |||
230 | uint32_t __spacer[4]; /* Pad to a power of two */ | ||
231 | }; | ||
232 | |||
233 | typedef uint16_t grant_status_t; | ||
234 | |||
235 | /*********************************** | ||
236 | * GRANT TABLE QUERIES AND USES | ||
152 | */ | 237 | */ |
153 | typedef uint32_t grant_ref_t; | ||
154 | 238 | ||
155 | /* | 239 | /* |
156 | * Handle to track a mapping created via a grant reference. | 240 | * Handle to track a mapping created via a grant reference. |
@@ -322,6 +406,79 @@ struct gnttab_query_size { | |||
322 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size); | 406 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size); |
323 | 407 | ||
324 | /* | 408 | /* |
409 | * GNTTABOP_unmap_and_replace: Destroy one or more grant-reference mappings | ||
410 | * tracked by <handle> but atomically replace the page table entry with one | ||
411 | * pointing to the machine address under <new_addr>. <new_addr> will be | ||
412 | * redirected to the null entry. | ||
413 | * NOTES: | ||
414 | * 1. The call may fail in an undefined manner if either mapping is not | ||
415 | * tracked by <handle>. | ||
416 | * 2. After executing a batch of unmaps, it is guaranteed that no stale | ||
417 | * mappings will remain in the device or host TLBs. | ||
418 | */ | ||
419 | #define GNTTABOP_unmap_and_replace 7 | ||
420 | struct gnttab_unmap_and_replace { | ||
421 | /* IN parameters. */ | ||
422 | uint64_t host_addr; | ||
423 | uint64_t new_addr; | ||
424 | grant_handle_t handle; | ||
425 | /* OUT parameters. */ | ||
426 | int16_t status; /* GNTST_* */ | ||
427 | }; | ||
428 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_unmap_and_replace); | ||
429 | |||
430 | /* | ||
431 | * GNTTABOP_set_version: Request a particular version of the grant | ||
432 | * table shared table structure. This operation can only be performed | ||
433 | * once in any given domain. It must be performed before any grants | ||
434 | * are activated; otherwise, the domain will be stuck with version 1. | ||
435 | * The only defined versions are 1 and 2. | ||
436 | */ | ||
437 | #define GNTTABOP_set_version 8 | ||
438 | struct gnttab_set_version { | ||
439 | /* IN parameters */ | ||
440 | uint32_t version; | ||
441 | }; | ||
442 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_set_version); | ||
443 | |||
444 | /* | ||
445 | * GNTTABOP_get_status_frames: Get the list of frames used to store grant | ||
446 | * status for <dom>. In grant format version 2, the status is separated | ||
447 | * from the other shared grant fields to allow more efficient synchronization | ||
448 | * using barriers instead of atomic cmpexch operations. | ||
449 | * <nr_frames> specify the size of vector <frame_list>. | ||
450 | * The frame addresses are returned in the <frame_list>. | ||
451 | * Only <nr_frames> addresses are returned, even if the table is larger. | ||
452 | * NOTES: | ||
453 | * 1. <dom> may be specified as DOMID_SELF. | ||
454 | * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF. | ||
455 | */ | ||
456 | #define GNTTABOP_get_status_frames 9 | ||
457 | struct gnttab_get_status_frames { | ||
458 | /* IN parameters. */ | ||
459 | uint32_t nr_frames; | ||
460 | domid_t dom; | ||
461 | /* OUT parameters. */ | ||
462 | int16_t status; /* GNTST_* */ | ||
463 | GUEST_HANDLE(uint64_t) frame_list; | ||
464 | }; | ||
465 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_status_frames); | ||
466 | |||
467 | /* | ||
468 | * GNTTABOP_get_version: Get the grant table version which is in | ||
469 | * effect for domain <dom>. | ||
470 | */ | ||
471 | #define GNTTABOP_get_version 10 | ||
472 | struct gnttab_get_version { | ||
473 | /* IN parameters */ | ||
474 | domid_t dom; | ||
475 | uint16_t pad; | ||
476 | /* OUT parameters */ | ||
477 | uint32_t version; | ||
478 | }; | ||
479 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version); | ||
480 | |||
481 | /* | ||
325 | * Bitfield values for update_pin_status.flags. | 482 | * Bitfield values for update_pin_status.flags. |
326 | */ | 483 | */ |
327 | /* Map the grant entry for access by I/O devices. */ | 484 | /* Map the grant entry for access by I/O devices. */ |
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index 9324488f23f0..ee338bfde18b 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
@@ -84,6 +84,21 @@ typedef uint64_t blkif_sector_t; | |||
84 | * e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc | 84 | * e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc |
85 | * http://www.seagate.com/staticfiles/support/disc/manuals/ | 85 | * http://www.seagate.com/staticfiles/support/disc/manuals/ |
86 | * Interface%20manuals/100293068c.pdf | 86 | * Interface%20manuals/100293068c.pdf |
87 | * The backend can optionally provide three extra XenBus attributes to | ||
88 | * further optimize the discard functionality: | ||
89 | * 'discard-aligment' - Devices that support discard functionality may | ||
90 | * internally allocate space in units that are bigger than the exported | ||
91 | * logical block size. The discard-alignment parameter indicates how many bytes | ||
92 | * the beginning of the partition is offset from the internal allocation unit's | ||
93 | * natural alignment. | ||
94 | * 'discard-granularity' - Devices that support discard functionality may | ||
95 | * internally allocate space using units that are bigger than the logical block | ||
96 | * size. The discard-granularity parameter indicates the size of the internal | ||
97 | * allocation unit in bytes if reported by the device. Otherwise the | ||
98 | * discard-granularity will be set to match the device's physical block size. | ||
99 | * 'discard-secure' - All copies of the discarded sectors (potentially created | ||
100 | * by garbage collection) must also be erased. To use this feature, the flag | ||
101 | * BLKIF_DISCARD_SECURE must be set in the blkif_request_trim. | ||
87 | */ | 102 | */ |
88 | #define BLKIF_OP_DISCARD 5 | 103 | #define BLKIF_OP_DISCARD 5 |
89 | 104 | ||
@@ -95,6 +110,12 @@ typedef uint64_t blkif_sector_t; | |||
95 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 | 110 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 |
96 | 111 | ||
97 | struct blkif_request_rw { | 112 | struct blkif_request_rw { |
113 | uint8_t nr_segments; /* number of segments */ | ||
114 | blkif_vdev_t handle; /* only for read/write requests */ | ||
115 | #ifdef CONFIG_X86_64 | ||
116 | uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */ | ||
117 | #endif | ||
118 | uint64_t id; /* private guest value, echoed in resp */ | ||
98 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 119 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
99 | struct blkif_request_segment { | 120 | struct blkif_request_segment { |
100 | grant_ref_t gref; /* reference to I/O buffer frame */ | 121 | grant_ref_t gref; /* reference to I/O buffer frame */ |
@@ -102,23 +123,28 @@ struct blkif_request_rw { | |||
102 | /* @last_sect: last sector in frame to transfer (inclusive). */ | 123 | /* @last_sect: last sector in frame to transfer (inclusive). */ |
103 | uint8_t first_sect, last_sect; | 124 | uint8_t first_sect, last_sect; |
104 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 125 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
105 | }; | 126 | } __attribute__((__packed__)); |
106 | 127 | ||
107 | struct blkif_request_discard { | 128 | struct blkif_request_discard { |
129 | uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */ | ||
130 | #define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */ | ||
131 | blkif_vdev_t _pad1; /* only for read/write requests */ | ||
132 | #ifdef CONFIG_X86_64 | ||
133 | uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/ | ||
134 | #endif | ||
135 | uint64_t id; /* private guest value, echoed in resp */ | ||
108 | blkif_sector_t sector_number; | 136 | blkif_sector_t sector_number; |
109 | uint64_t nr_sectors; | 137 | uint64_t nr_sectors; |
110 | }; | 138 | uint8_t _pad3; |
139 | } __attribute__((__packed__)); | ||
111 | 140 | ||
112 | struct blkif_request { | 141 | struct blkif_request { |
113 | uint8_t operation; /* BLKIF_OP_??? */ | 142 | uint8_t operation; /* BLKIF_OP_??? */ |
114 | uint8_t nr_segments; /* number of segments */ | ||
115 | blkif_vdev_t handle; /* only for read/write requests */ | ||
116 | uint64_t id; /* private guest value, echoed in resp */ | ||
117 | union { | 143 | union { |
118 | struct blkif_request_rw rw; | 144 | struct blkif_request_rw rw; |
119 | struct blkif_request_discard discard; | 145 | struct blkif_request_discard discard; |
120 | } u; | 146 | } u; |
121 | }; | 147 | } __attribute__((__packed__)); |
122 | 148 | ||
123 | struct blkif_response { | 149 | struct blkif_response { |
124 | uint64_t id; /* copied from request */ | 150 | uint64_t id; /* copied from request */ |
diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h index f0b6890370be..7cdfca24eafb 100644 --- a/include/xen/interface/io/xs_wire.h +++ b/include/xen/interface/io/xs_wire.h | |||
@@ -29,8 +29,7 @@ enum xsd_sockmsg_type | |||
29 | XS_IS_DOMAIN_INTRODUCED, | 29 | XS_IS_DOMAIN_INTRODUCED, |
30 | XS_RESUME, | 30 | XS_RESUME, |
31 | XS_SET_TARGET, | 31 | XS_SET_TARGET, |
32 | XS_RESTRICT, | 32 | XS_RESTRICT |
33 | XS_RESET_WATCHES | ||
34 | }; | 33 | }; |
35 | 34 | ||
36 | #define XS_WRITE_NONE "NONE" | 35 | #define XS_WRITE_NONE "NONE" |
@@ -88,4 +87,7 @@ struct xenstore_domain_interface { | |||
88 | XENSTORE_RING_IDX rsp_cons, rsp_prod; | 87 | XENSTORE_RING_IDX rsp_cons, rsp_prod; |
89 | }; | 88 | }; |
90 | 89 | ||
90 | /* Violating this is very bad. See docs/misc/xenstore.txt. */ | ||
91 | #define XENSTORE_PAYLOAD_MAX 4096 | ||
92 | |||
91 | #endif /* _XS_WIRE_H */ | 93 | #endif /* _XS_WIRE_H */ |
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h index 6a6e91449347..a890804945e3 100644 --- a/include/xen/interface/xen.h +++ b/include/xen/interface/xen.h | |||
@@ -523,6 +523,8 @@ struct tmem_op { | |||
523 | } u; | 523 | } u; |
524 | }; | 524 | }; |
525 | 525 | ||
526 | DEFINE_GUEST_HANDLE(u64); | ||
527 | |||
526 | #else /* __ASSEMBLY__ */ | 528 | #else /* __ASSEMBLY__ */ |
527 | 529 | ||
528 | /* In assembly code we cannot use C numeric constant suffixes. */ | 530 | /* In assembly code we cannot use C numeric constant suffixes. */ |
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index b1b6676c1c43..e8c599b237c2 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -85,8 +85,6 @@ struct xenbus_device_id | |||
85 | 85 | ||
86 | /* A xenbus driver. */ | 86 | /* A xenbus driver. */ |
87 | struct xenbus_driver { | 87 | struct xenbus_driver { |
88 | char *name; | ||
89 | struct module *owner; | ||
90 | const struct xenbus_device_id *ids; | 88 | const struct xenbus_device_id *ids; |
91 | int (*probe)(struct xenbus_device *dev, | 89 | int (*probe)(struct xenbus_device *dev, |
92 | const struct xenbus_device_id *id); | 90 | const struct xenbus_device_id *id); |
@@ -101,31 +99,20 @@ struct xenbus_driver { | |||
101 | int (*is_ready)(struct xenbus_device *dev); | 99 | int (*is_ready)(struct xenbus_device *dev); |
102 | }; | 100 | }; |
103 | 101 | ||
104 | static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) | 102 | #define DEFINE_XENBUS_DRIVER(var, drvname, methods...) \ |
105 | { | 103 | struct xenbus_driver var ## _driver = { \ |
106 | return container_of(drv, struct xenbus_driver, driver); | 104 | .driver.name = drvname + 0 ?: var ## _ids->devicetype, \ |
105 | .driver.owner = THIS_MODULE, \ | ||
106 | .ids = var ## _ids, ## methods \ | ||
107 | } | 107 | } |
108 | 108 | ||
109 | int __must_check __xenbus_register_frontend(struct xenbus_driver *drv, | 109 | static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) |
110 | struct module *owner, | ||
111 | const char *mod_name); | ||
112 | |||
113 | static inline int __must_check | ||
114 | xenbus_register_frontend(struct xenbus_driver *drv) | ||
115 | { | 110 | { |
116 | WARN_ON(drv->owner != THIS_MODULE); | 111 | return container_of(drv, struct xenbus_driver, driver); |
117 | return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME); | ||
118 | } | 112 | } |
119 | 113 | ||
120 | int __must_check __xenbus_register_backend(struct xenbus_driver *drv, | 114 | int __must_check xenbus_register_frontend(struct xenbus_driver *); |
121 | struct module *owner, | 115 | int __must_check xenbus_register_backend(struct xenbus_driver *); |
122 | const char *mod_name); | ||
123 | static inline int __must_check | ||
124 | xenbus_register_backend(struct xenbus_driver *drv) | ||
125 | { | ||
126 | WARN_ON(drv->owner != THIS_MODULE); | ||
127 | return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME); | ||
128 | } | ||
129 | 116 | ||
130 | void xenbus_unregister_driver(struct xenbus_driver *drv); | 117 | void xenbus_unregister_driver(struct xenbus_driver *drv); |
131 | 118 | ||
diff --git a/include/xen/xenbus_dev.h b/include/xen/xenbus_dev.h new file mode 100644 index 000000000000..ac5f0fe47ed9 --- /dev/null +++ b/include/xen/xenbus_dev.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /****************************************************************************** | ||
2 | * evtchn.h | ||
3 | * | ||
4 | * Interface to /dev/xen/xenbus_backend. | ||
5 | * | ||
6 | * Copyright (c) 2011 Bastian Blank <waldi@debian.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation; or, when distributed | ||
11 | * separately from the Linux kernel or incorporated into other | ||
12 | * software packages, subject to the following license: | ||
13 | * | ||
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
15 | * of this source file (the "Software"), to deal in the Software without | ||
16 | * restriction, including without limitation the rights to use, copy, modify, | ||
17 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
18 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
19 | * the following conditions: | ||
20 | * | ||
21 | * The above copyright notice and this permission notice shall be included in | ||
22 | * all copies or substantial portions of the Software. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
30 | * IN THE SOFTWARE. | ||
31 | */ | ||
32 | |||
33 | #ifndef __LINUX_XEN_XENBUS_DEV_H__ | ||
34 | #define __LINUX_XEN_XENBUS_DEV_H__ | ||
35 | |||
36 | #include <linux/ioctl.h> | ||
37 | |||
38 | #define IOCTL_XENBUS_BACKEND_EVTCHN \ | ||
39 | _IOC(_IOC_NONE, 'B', 0, 0) | ||
40 | |||
41 | #endif /* __LINUX_XEN_XENBUS_DEV_H__ */ | ||