aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/xen
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/xen')
-rw-r--r--include/xen/Kbuild1
-rw-r--r--include/xen/balloon.h25
-rw-r--r--include/xen/events.h44
-rw-r--r--include/xen/gntalloc.h82
-rw-r--r--include/xen/gntdev.h150
-rw-r--r--include/xen/grant_table.h44
-rw-r--r--include/xen/interface/elfnote.h2
-rw-r--r--include/xen/interface/features.h3
-rw-r--r--include/xen/interface/io/blkif.h50
-rw-r--r--include/xen/interface/io/netif.h80
-rw-r--r--include/xen/interface/io/pciif.h112
-rw-r--r--include/xen/interface/io/ring.h11
-rw-r--r--include/xen/interface/io/xenbus.h8
-rw-r--r--include/xen/interface/memory.h42
-rw-r--r--include/xen/interface/physdev.h77
-rw-r--r--include/xen/interface/sched.h34
-rw-r--r--include/xen/interface/xen.h26
-rw-r--r--include/xen/page.h7
-rw-r--r--include/xen/privcmd.h77
-rw-r--r--include/xen/xen-ops.h11
-rw-r--r--include/xen/xenbus.h4
21 files changed, 832 insertions, 58 deletions
diff --git a/include/xen/Kbuild b/include/xen/Kbuild
index 4e65c16a445b..84ad8f02fee5 100644
--- a/include/xen/Kbuild
+++ b/include/xen/Kbuild
@@ -1 +1,2 @@
1header-y += evtchn.h 1header-y += evtchn.h
2header-y += privcmd.h
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
new file mode 100644
index 000000000000..a2b22f01a51d
--- /dev/null
+++ b/include/xen/balloon.h
@@ -0,0 +1,25 @@
1/******************************************************************************
2 * Xen balloon functionality
3 */
4
5#define RETRY_UNLIMITED 0
6
7struct balloon_stats {
8 /* We aim for 'current allocation' == 'target allocation'. */
9 unsigned long current_pages;
10 unsigned long target_pages;
11 /* Number of pages in high- and low-memory balloons. */
12 unsigned long balloon_low;
13 unsigned long balloon_high;
14 unsigned long schedule_delay;
15 unsigned long max_schedule_delay;
16 unsigned long retry_count;
17 unsigned long max_retry_count;
18};
19
20extern struct balloon_stats balloon_stats;
21
22void balloon_set_new_target(unsigned long target);
23
24int alloc_xenballooned_pages(int nr_pages, struct page** pages);
25void free_xenballooned_pages(int nr_pages, struct page** pages);
diff --git a/include/xen/events.h b/include/xen/events.h
index a15d93262e30..9af21e19545a 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -12,6 +12,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn,
12 irq_handler_t handler, 12 irq_handler_t handler,
13 unsigned long irqflags, const char *devname, 13 unsigned long irqflags, const char *devname,
14 void *dev_id); 14 void *dev_id);
15int bind_virq_to_irq(unsigned int virq, unsigned int cpu);
15int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, 16int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
16 irq_handler_t handler, 17 irq_handler_t handler,
17 unsigned long irqflags, const char *devname, 18 unsigned long irqflags, const char *devname,
@@ -22,6 +23,12 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
22 unsigned long irqflags, 23 unsigned long irqflags,
23 const char *devname, 24 const char *devname,
24 void *dev_id); 25 void *dev_id);
26int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
27 unsigned int remote_port,
28 irq_handler_t handler,
29 unsigned long irqflags,
30 const char *devname,
31 void *dev_id);
25 32
26/* 33/*
27 * Common unbind function for all event sources. Takes IRQ to unbind from. 34 * Common unbind function for all event sources. Takes IRQ to unbind from.
@@ -40,9 +47,9 @@ static inline void notify_remote_via_evtchn(int port)
40 (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send); 47 (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
41} 48}
42 49
43extern void notify_remote_via_irq(int irq); 50void notify_remote_via_irq(int irq);
44 51
45extern void xen_irq_resume(void); 52void xen_irq_resume(void);
46 53
47/* Clear an irq's pending state, in preparation for polling on it */ 54/* Clear an irq's pending state, in preparation for polling on it */
48void xen_clear_irq_pending(int irq); 55void xen_clear_irq_pending(int irq);
@@ -53,14 +60,45 @@ bool xen_test_irq_pending(int irq);
53 irq will be disabled so it won't deliver an interrupt. */ 60 irq will be disabled so it won't deliver an interrupt. */
54void xen_poll_irq(int irq); 61void xen_poll_irq(int irq);
55 62
63/* Poll waiting for an irq to become pending with a timeout. In the usual case,
64 * the irq will be disabled so it won't deliver an interrupt. */
65void xen_poll_irq_timeout(int irq, u64 timeout);
66
56/* Determine the IRQ which is bound to an event channel */ 67/* Determine the IRQ which is bound to an event channel */
57unsigned irq_from_evtchn(unsigned int evtchn); 68unsigned irq_from_evtchn(unsigned int evtchn);
58 69
59/* Xen HVM evtchn vector callback */ 70/* Xen HVM evtchn vector callback */
60extern void xen_hvm_callback_vector(void); 71void xen_hvm_callback_vector(void);
61extern int xen_have_vector_callback; 72extern int xen_have_vector_callback;
62int xen_set_callback_via(uint64_t via); 73int xen_set_callback_via(uint64_t via);
63void xen_evtchn_do_upcall(struct pt_regs *regs); 74void xen_evtchn_do_upcall(struct pt_regs *regs);
64void xen_hvm_evtchn_do_upcall(void); 75void xen_hvm_evtchn_do_upcall(void);
65 76
77/* Allocate a pirq for a physical interrupt, given a gsi. */
78int xen_allocate_pirq_gsi(unsigned gsi);
79/* Bind a pirq for a physical interrupt to an irq. */
80int xen_bind_pirq_gsi_to_irq(unsigned gsi,
81 unsigned pirq, int shareable, char *name);
82
83#ifdef CONFIG_PCI_MSI
84/* Allocate a pirq for a MSI style physical interrupt. */
85int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
86/* Bind an PSI pirq to an irq. */
87int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
88 int pirq, int vector, const char *name,
89 domid_t domid);
90#endif
91
92/* De-allocates the above mentioned physical interrupt. */
93int xen_destroy_irq(int irq);
94
95/* Return irq from pirq */
96int xen_irq_from_pirq(unsigned pirq);
97
98/* Return the pirq allocated to the irq. */
99int xen_pirq_from_irq(unsigned irq);
100
101/* Determine whether to ignore this IRQ if it is passed to a guest. */
102int xen_test_irq_shared(int irq);
103
66#endif /* _XEN_EVENTS_H */ 104#endif /* _XEN_EVENTS_H */
diff --git a/include/xen/gntalloc.h b/include/xen/gntalloc.h
new file mode 100644
index 000000000000..76bd58065f4f
--- /dev/null
+++ b/include/xen/gntalloc.h
@@ -0,0 +1,82 @@
1/******************************************************************************
2 * gntalloc.h
3 *
4 * Interface to /dev/xen/gntalloc.
5 *
6 * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
7 *
8 * This file is in the public domain.
9 */
10
11#ifndef __LINUX_PUBLIC_GNTALLOC_H__
12#define __LINUX_PUBLIC_GNTALLOC_H__
13
14/*
15 * Allocates a new page and creates a new grant reference.
16 */
17#define IOCTL_GNTALLOC_ALLOC_GREF \
18_IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
19struct ioctl_gntalloc_alloc_gref {
20 /* IN parameters */
21 /* The ID of the domain to be given access to the grants. */
22 uint16_t domid;
23 /* Flags for this mapping */
24 uint16_t flags;
25 /* Number of pages to map */
26 uint32_t count;
27 /* OUT parameters */
28 /* The offset to be used on a subsequent call to mmap(). */
29 uint64_t index;
30 /* The grant references of the newly created grant, one per page */
31 /* Variable size, depending on count */
32 uint32_t gref_ids[1];
33};
34
35#define GNTALLOC_FLAG_WRITABLE 1
36
37/*
38 * Deallocates the grant reference, allowing the associated page to be freed if
39 * no other domains are using it.
40 */
41#define IOCTL_GNTALLOC_DEALLOC_GREF \
42_IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
43struct ioctl_gntalloc_dealloc_gref {
44 /* IN parameters */
45 /* The offset returned in the map operation */
46 uint64_t index;
47 /* Number of references to unmap */
48 uint32_t count;
49};
50
51/*
52 * Sets up an unmap notification within the page, so that the other side can do
53 * cleanup if this side crashes. Required to implement cross-domain robust
54 * mutexes or close notification on communication channels.
55 *
56 * Each mapped page only supports one notification; multiple calls referring to
57 * the same page overwrite the previous notification. You must clear the
58 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
59 * to occur.
60 */
61#define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
62_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
63struct ioctl_gntalloc_unmap_notify {
64 /* IN parameters */
65 /* Offset in the file descriptor for a byte within the page (same as
66 * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
67 * be cleared. Otherwise, it can be any byte in the page whose
68 * notification we are adjusting.
69 */
70 uint64_t index;
71 /* Action(s) to take on unmap */
72 uint32_t action;
73 /* Event channel to notify */
74 uint32_t event_channel_port;
75};
76
77/* Clear (set to zero) the byte specified by index */
78#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
79/* Send an interrupt on the indicated event channel */
80#define UNMAP_NOTIFY_SEND_EVENT 0x2
81
82#endif /* __LINUX_PUBLIC_GNTALLOC_H__ */
diff --git a/include/xen/gntdev.h b/include/xen/gntdev.h
new file mode 100644
index 000000000000..5304bd3c84c5
--- /dev/null
+++ b/include/xen/gntdev.h
@@ -0,0 +1,150 @@
1/******************************************************************************
2 * gntdev.h
3 *
4 * Interface to /dev/xen/gntdev.
5 *
6 * Copyright (c) 2007, D G Murray
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_PUBLIC_GNTDEV_H__
34#define __LINUX_PUBLIC_GNTDEV_H__
35
36struct ioctl_gntdev_grant_ref {
37 /* The domain ID of the grant to be mapped. */
38 uint32_t domid;
39 /* The grant reference of the grant to be mapped. */
40 uint32_t ref;
41};
42
43/*
44 * Inserts the grant references into the mapping table of an instance
45 * of gntdev. N.B. This does not perform the mapping, which is deferred
46 * until mmap() is called with @index as the offset.
47 */
48#define IOCTL_GNTDEV_MAP_GRANT_REF \
49_IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
50struct ioctl_gntdev_map_grant_ref {
51 /* IN parameters */
52 /* The number of grants to be mapped. */
53 uint32_t count;
54 uint32_t pad;
55 /* OUT parameters */
56 /* The offset to be used on a subsequent call to mmap(). */
57 uint64_t index;
58 /* Variable IN parameter. */
59 /* Array of grant references, of size @count. */
60 struct ioctl_gntdev_grant_ref refs[1];
61};
62
63/*
64 * Removes the grant references from the mapping table of an instance of
65 * of gntdev. N.B. munmap() must be called on the relevant virtual address(es)
66 * before this ioctl is called, or an error will result.
67 */
68#define IOCTL_GNTDEV_UNMAP_GRANT_REF \
69_IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))
70struct ioctl_gntdev_unmap_grant_ref {
71 /* IN parameters */
72 /* The offset was returned by the corresponding map operation. */
73 uint64_t index;
74 /* The number of pages to be unmapped. */
75 uint32_t count;
76 uint32_t pad;
77};
78
79/*
80 * Returns the offset in the driver's address space that corresponds
81 * to @vaddr. This can be used to perform a munmap(), followed by an
82 * UNMAP_GRANT_REF ioctl, where no state about the offset is retained by
83 * the caller. The number of pages that were allocated at the same time as
84 * @vaddr is returned in @count.
85 *
86 * N.B. Where more than one page has been mapped into a contiguous range, the
87 * supplied @vaddr must correspond to the start of the range; otherwise
88 * an error will result. It is only possible to munmap() the entire
89 * contiguously-allocated range at once, and not any subrange thereof.
90 */
91#define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \
92_IOC(_IOC_NONE, 'G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr))
93struct ioctl_gntdev_get_offset_for_vaddr {
94 /* IN parameters */
95 /* The virtual address of the first mapped page in a range. */
96 uint64_t vaddr;
97 /* OUT parameters */
98 /* The offset that was used in the initial mmap() operation. */
99 uint64_t offset;
100 /* The number of pages mapped in the VM area that begins at @vaddr. */
101 uint32_t count;
102 uint32_t pad;
103};
104
105/*
106 * Sets the maximum number of grants that may mapped at once by this gntdev
107 * instance.
108 *
109 * N.B. This must be called before any other ioctl is performed on the device.
110 */
111#define IOCTL_GNTDEV_SET_MAX_GRANTS \
112_IOC(_IOC_NONE, 'G', 3, sizeof(struct ioctl_gntdev_set_max_grants))
113struct ioctl_gntdev_set_max_grants {
114 /* IN parameter */
115 /* The maximum number of grants that may be mapped at once. */
116 uint32_t count;
117};
118
119/*
120 * Sets up an unmap notification within the page, so that the other side can do
121 * cleanup if this side crashes. Required to implement cross-domain robust
122 * mutexes or close notification on communication channels.
123 *
124 * Each mapped page only supports one notification; multiple calls referring to
125 * the same page overwrite the previous notification. You must clear the
126 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
127 * to occur.
128 */
129#define IOCTL_GNTDEV_SET_UNMAP_NOTIFY \
130_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntdev_unmap_notify))
131struct ioctl_gntdev_unmap_notify {
132 /* IN parameters */
133 /* Offset in the file descriptor for a byte within the page (same as
134 * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
135 * be cleared. Otherwise, it can be any byte in the page whose
136 * notification we are adjusting.
137 */
138 uint64_t index;
139 /* Action(s) to take on unmap */
140 uint32_t action;
141 /* Event channel to notify */
142 uint32_t event_channel_port;
143};
144
145/* Clear (set to zero) the byte specified by index */
146#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
147/* Send an interrupt on the indicated event channel */
148#define UNMAP_NOTIFY_SEND_EVENT 0x2
149
150#endif /* __LINUX_PUBLIC_GNTDEV_H__ */
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 9a731706a016..b1fab6b5b3ef 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -37,10 +37,16 @@
37#ifndef __ASM_GNTTAB_H__ 37#ifndef __ASM_GNTTAB_H__
38#define __ASM_GNTTAB_H__ 38#define __ASM_GNTTAB_H__
39 39
40#include <asm/xen/hypervisor.h> 40#include <asm/page.h>
41
42#include <xen/interface/xen.h>
41#include <xen/interface/grant_table.h> 43#include <xen/interface/grant_table.h>
44
45#include <asm/xen/hypervisor.h>
42#include <asm/xen/grant_table.h> 46#include <asm/xen/grant_table.h>
43 47
48#include <xen/features.h>
49
44/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */ 50/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
45#define NR_GRANT_FRAMES 4 51#define NR_GRANT_FRAMES 4
46 52
@@ -107,6 +113,37 @@ void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
107void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 113void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
108 unsigned long pfn); 114 unsigned long pfn);
109 115
116static inline void
117gnttab_set_map_op(struct gnttab_map_grant_ref *map, phys_addr_t addr,
118 uint32_t flags, grant_ref_t ref, domid_t domid)
119{
120 if (flags & GNTMAP_contains_pte)
121 map->host_addr = addr;
122 else if (xen_feature(XENFEAT_auto_translated_physmap))
123 map->host_addr = __pa(addr);
124 else
125 map->host_addr = addr;
126
127 map->flags = flags;
128 map->ref = ref;
129 map->dom = domid;
130}
131
132static inline void
133gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
134 uint32_t flags, grant_handle_t handle)
135{
136 if (flags & GNTMAP_contains_pte)
137 unmap->host_addr = addr;
138 else if (xen_feature(XENFEAT_auto_translated_physmap))
139 unmap->host_addr = __pa(addr);
140 else
141 unmap->host_addr = addr;
142
143 unmap->handle = handle;
144 unmap->dev_bus_addr = 0;
145}
146
110int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, 147int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
111 unsigned long max_nr_gframes, 148 unsigned long max_nr_gframes,
112 struct grant_entry **__shared); 149 struct grant_entry **__shared);
@@ -118,4 +155,9 @@ unsigned int gnttab_max_grant_frames(void);
118 155
119#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) 156#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
120 157
158int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
159 struct page **pages, unsigned int count);
160int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
161 struct page **pages, unsigned int count);
162
121#endif /* __ASM_GNTTAB_H__ */ 163#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/interface/elfnote.h b/include/xen/interface/elfnote.h
index 7a8262c375cc..0360b15f4883 100644
--- a/include/xen/interface/elfnote.h
+++ b/include/xen/interface/elfnote.h
@@ -51,7 +51,7 @@
51 51
52/* 52/*
53 * The offset of the ELF paddr field from the acutal required 53 * The offset of the ELF paddr field from the acutal required
54 * psuedo-physical address (numeric). 54 * pseudo-physical address (numeric).
55 * 55 *
56 * This is used to maintain backwards compatibility with older kernels 56 * This is used to maintain backwards compatibility with older kernels
57 * which wrote __PAGE_OFFSET into that field. This field defaults to 0 57 * which wrote __PAGE_OFFSET into that field. This field defaults to 0
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
index 70d2563ab166..b6ca39a069d8 100644
--- a/include/xen/interface/features.h
+++ b/include/xen/interface/features.h
@@ -47,6 +47,9 @@
47/* x86: pvclock algorithm is safe to use on HVM */ 47/* x86: pvclock algorithm is safe to use on HVM */
48#define XENFEAT_hvm_safe_pvclock 9 48#define XENFEAT_hvm_safe_pvclock 9
49 49
50/* x86: pirq can be used by HVM guests */
51#define XENFEAT_hvm_pirqs 10
52
50#define XENFEAT_NR_SUBMAPS 1 53#define XENFEAT_NR_SUBMAPS 1
51 54
52#endif /* __XEN_PUBLIC_FEATURES_H__ */ 55#endif /* __XEN_PUBLIC_FEATURES_H__ */
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index c2d1fa4dc1ee..3d5d6db864fe 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -45,17 +45,26 @@ typedef uint64_t blkif_sector_t;
45#define BLKIF_OP_WRITE_BARRIER 2 45#define BLKIF_OP_WRITE_BARRIER 2
46 46
47/* 47/*
48 * Recognised if "feature-flush-cache" is present in backend xenbus
49 * info. A flush will ask the underlying storage hardware to flush its
50 * non-volatile caches as appropriate. The "feature-flush-cache" node
51 * contains a boolean indicating whether flush requests are likely to
52 * succeed or fail. Either way, a flush request may fail at any time
53 * with BLKIF_RSP_EOPNOTSUPP if it is unsupported by the underlying
54 * block-device hardware. The boolean simply indicates whether or not it
55 * is worthwhile for the frontend to attempt flushes. If a backend does
56 * not recognise BLKIF_OP_WRITE_FLUSH_CACHE, it should *not* create the
57 * "feature-flush-cache" node!
58 */
59#define BLKIF_OP_FLUSH_DISKCACHE 3
60/*
48 * Maximum scatter/gather segments per request. 61 * Maximum scatter/gather segments per request.
49 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. 62 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE.
50 * NB. This could be 12 if the ring indexes weren't stored in the same page. 63 * NB. This could be 12 if the ring indexes weren't stored in the same page.
51 */ 64 */
52#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 65#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
53 66
54struct blkif_request { 67struct blkif_request_rw {
55 uint8_t operation; /* BLKIF_OP_??? */
56 uint8_t nr_segments; /* number of segments */
57 blkif_vdev_t handle; /* only for read/write requests */
58 uint64_t id; /* private guest value, echoed in resp */
59 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ 68 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
60 struct blkif_request_segment { 69 struct blkif_request_segment {
61 grant_ref_t gref; /* reference to I/O buffer frame */ 70 grant_ref_t gref; /* reference to I/O buffer frame */
@@ -65,6 +74,16 @@ struct blkif_request {
65 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; 74 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
66}; 75};
67 76
77struct blkif_request {
78 uint8_t operation; /* BLKIF_OP_??? */
79 uint8_t nr_segments; /* number of segments */
80 blkif_vdev_t handle; /* only for read/write requests */
81 uint64_t id; /* private guest value, echoed in resp */
82 union {
83 struct blkif_request_rw rw;
84 } u;
85};
86
68struct blkif_response { 87struct blkif_response {
69 uint64_t id; /* copied from request */ 88 uint64_t id; /* copied from request */
70 uint8_t operation; /* copied from request */ 89 uint8_t operation; /* copied from request */
@@ -91,4 +110,25 @@ DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
91#define VDISK_REMOVABLE 0x2 110#define VDISK_REMOVABLE 0x2
92#define VDISK_READONLY 0x4 111#define VDISK_READONLY 0x4
93 112
113/* Xen-defined major numbers for virtual disks, they look strangely
114 * familiar */
115#define XEN_IDE0_MAJOR 3
116#define XEN_IDE1_MAJOR 22
117#define XEN_SCSI_DISK0_MAJOR 8
118#define XEN_SCSI_DISK1_MAJOR 65
119#define XEN_SCSI_DISK2_MAJOR 66
120#define XEN_SCSI_DISK3_MAJOR 67
121#define XEN_SCSI_DISK4_MAJOR 68
122#define XEN_SCSI_DISK5_MAJOR 69
123#define XEN_SCSI_DISK6_MAJOR 70
124#define XEN_SCSI_DISK7_MAJOR 71
125#define XEN_SCSI_DISK8_MAJOR 128
126#define XEN_SCSI_DISK9_MAJOR 129
127#define XEN_SCSI_DISK10_MAJOR 130
128#define XEN_SCSI_DISK11_MAJOR 131
129#define XEN_SCSI_DISK12_MAJOR 132
130#define XEN_SCSI_DISK13_MAJOR 133
131#define XEN_SCSI_DISK14_MAJOR 134
132#define XEN_SCSI_DISK15_MAJOR 135
133
94#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */ 134#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index 518481c95f18..cb94668f6e9f 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -22,50 +22,50 @@
22 22
23/* 23/*
24 * This is the 'wire' format for packets: 24 * This is the 'wire' format for packets:
25 * Request 1: netif_tx_request -- NETTXF_* (any flags) 25 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
26 * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info) 26 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info)
27 * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE) 27 * [Request 3: xen_netif_extra_info] (only if request 2 has XEN_NETIF_EXTRA_MORE)
28 * Request 4: netif_tx_request -- NETTXF_more_data 28 * Request 4: xen_netif_tx_request -- XEN_NETTXF_more_data
29 * Request 5: netif_tx_request -- NETTXF_more_data 29 * Request 5: xen_netif_tx_request -- XEN_NETTXF_more_data
30 * ... 30 * ...
31 * Request N: netif_tx_request -- 0 31 * Request N: xen_netif_tx_request -- 0
32 */ 32 */
33 33
34/* Protocol checksum field is blank in the packet (hardware offload)? */ 34/* Protocol checksum field is blank in the packet (hardware offload)? */
35#define _NETTXF_csum_blank (0) 35#define _XEN_NETTXF_csum_blank (0)
36#define NETTXF_csum_blank (1U<<_NETTXF_csum_blank) 36#define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank)
37 37
38/* Packet data has been validated against protocol checksum. */ 38/* Packet data has been validated against protocol checksum. */
39#define _NETTXF_data_validated (1) 39#define _XEN_NETTXF_data_validated (1)
40#define NETTXF_data_validated (1U<<_NETTXF_data_validated) 40#define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated)
41 41
42/* Packet continues in the next request descriptor. */ 42/* Packet continues in the next request descriptor. */
43#define _NETTXF_more_data (2) 43#define _XEN_NETTXF_more_data (2)
44#define NETTXF_more_data (1U<<_NETTXF_more_data) 44#define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data)
45 45
46/* Packet to be followed by extra descriptor(s). */ 46/* Packet to be followed by extra descriptor(s). */
47#define _NETTXF_extra_info (3) 47#define _XEN_NETTXF_extra_info (3)
48#define NETTXF_extra_info (1U<<_NETTXF_extra_info) 48#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info)
49 49
50struct xen_netif_tx_request { 50struct xen_netif_tx_request {
51 grant_ref_t gref; /* Reference to buffer page */ 51 grant_ref_t gref; /* Reference to buffer page */
52 uint16_t offset; /* Offset within buffer page */ 52 uint16_t offset; /* Offset within buffer page */
53 uint16_t flags; /* NETTXF_* */ 53 uint16_t flags; /* XEN_NETTXF_* */
54 uint16_t id; /* Echoed in response message. */ 54 uint16_t id; /* Echoed in response message. */
55 uint16_t size; /* Packet size in bytes. */ 55 uint16_t size; /* Packet size in bytes. */
56}; 56};
57 57
58/* Types of netif_extra_info descriptors. */ 58/* Types of xen_netif_extra_info descriptors. */
59#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ 59#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */
60#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ 60#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */
61#define XEN_NETIF_EXTRA_TYPE_MAX (2) 61#define XEN_NETIF_EXTRA_TYPE_MAX (2)
62 62
63/* netif_extra_info flags. */ 63/* xen_netif_extra_info flags. */
64#define _XEN_NETIF_EXTRA_FLAG_MORE (0) 64#define _XEN_NETIF_EXTRA_FLAG_MORE (0)
65#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) 65#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
66 66
67/* GSO types - only TCPv4 currently supported. */ 67/* GSO types - only TCPv4 currently supported. */
68#define XEN_NETIF_GSO_TYPE_TCPV4 (1) 68#define XEN_NETIF_GSO_TYPE_TCPV4 (1)
69 69
70/* 70/*
71 * This structure needs to fit within both netif_tx_request and 71 * This structure needs to fit within both netif_tx_request and
@@ -107,7 +107,7 @@ struct xen_netif_extra_info {
107 107
108struct xen_netif_tx_response { 108struct xen_netif_tx_response {
109 uint16_t id; 109 uint16_t id;
110 int16_t status; /* NETIF_RSP_* */ 110 int16_t status; /* XEN_NETIF_RSP_* */
111}; 111};
112 112
113struct xen_netif_rx_request { 113struct xen_netif_rx_request {
@@ -116,25 +116,29 @@ struct xen_netif_rx_request {
116}; 116};
117 117
118/* Packet data has been validated against protocol checksum. */ 118/* Packet data has been validated against protocol checksum. */
119#define _NETRXF_data_validated (0) 119#define _XEN_NETRXF_data_validated (0)
120#define NETRXF_data_validated (1U<<_NETRXF_data_validated) 120#define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated)
121 121
122/* Protocol checksum field is blank in the packet (hardware offload)? */ 122/* Protocol checksum field is blank in the packet (hardware offload)? */
123#define _NETRXF_csum_blank (1) 123#define _XEN_NETRXF_csum_blank (1)
124#define NETRXF_csum_blank (1U<<_NETRXF_csum_blank) 124#define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank)
125 125
126/* Packet continues in the next request descriptor. */ 126/* Packet continues in the next request descriptor. */
127#define _NETRXF_more_data (2) 127#define _XEN_NETRXF_more_data (2)
128#define NETRXF_more_data (1U<<_NETRXF_more_data) 128#define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data)
129 129
130/* Packet to be followed by extra descriptor(s). */ 130/* Packet to be followed by extra descriptor(s). */
131#define _NETRXF_extra_info (3) 131#define _XEN_NETRXF_extra_info (3)
132#define NETRXF_extra_info (1U<<_NETRXF_extra_info) 132#define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info)
133
134/* GSO Prefix descriptor. */
135#define _XEN_NETRXF_gso_prefix (4)
136#define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix)
133 137
134struct xen_netif_rx_response { 138struct xen_netif_rx_response {
135 uint16_t id; 139 uint16_t id;
136 uint16_t offset; /* Offset in page of start of received packet */ 140 uint16_t offset; /* Offset in page of start of received packet */
137 uint16_t flags; /* NETRXF_* */ 141 uint16_t flags; /* XEN_NETRXF_* */
138 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ 142 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
139}; 143};
140 144
@@ -149,10 +153,10 @@ DEFINE_RING_TYPES(xen_netif_rx,
149 struct xen_netif_rx_request, 153 struct xen_netif_rx_request,
150 struct xen_netif_rx_response); 154 struct xen_netif_rx_response);
151 155
152#define NETIF_RSP_DROPPED -2 156#define XEN_NETIF_RSP_DROPPED -2
153#define NETIF_RSP_ERROR -1 157#define XEN_NETIF_RSP_ERROR -1
154#define NETIF_RSP_OKAY 0 158#define XEN_NETIF_RSP_OKAY 0
155/* No response: used for auxiliary requests (e.g., netif_tx_extra). */ 159/* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */
156#define NETIF_RSP_NULL 1 160#define XEN_NETIF_RSP_NULL 1
157 161
158#endif 162#endif
diff --git a/include/xen/interface/io/pciif.h b/include/xen/interface/io/pciif.h
new file mode 100644
index 000000000000..d9922ae36eb5
--- /dev/null
+++ b/include/xen/interface/io/pciif.h
@@ -0,0 +1,112 @@
1/*
2 * PCI Backend/Frontend Common Data Structures & Macros
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
23 */
24#ifndef __XEN_PCI_COMMON_H__
25#define __XEN_PCI_COMMON_H__
26
27/* Be sure to bump this number if you change this file */
28#define XEN_PCI_MAGIC "7"
29
30/* xen_pci_sharedinfo flags */
31#define _XEN_PCIF_active (0)
32#define XEN_PCIF_active (1<<_XEN_PCIF_active)
33#define _XEN_PCIB_AERHANDLER (1)
34#define XEN_PCIB_AERHANDLER (1<<_XEN_PCIB_AERHANDLER)
35#define _XEN_PCIB_active (2)
36#define XEN_PCIB_active (1<<_XEN_PCIB_active)
37
38/* xen_pci_op commands */
39#define XEN_PCI_OP_conf_read (0)
40#define XEN_PCI_OP_conf_write (1)
41#define XEN_PCI_OP_enable_msi (2)
42#define XEN_PCI_OP_disable_msi (3)
43#define XEN_PCI_OP_enable_msix (4)
44#define XEN_PCI_OP_disable_msix (5)
45#define XEN_PCI_OP_aer_detected (6)
46#define XEN_PCI_OP_aer_resume (7)
47#define XEN_PCI_OP_aer_mmio (8)
48#define XEN_PCI_OP_aer_slotreset (9)
49
50/* xen_pci_op error numbers */
51#define XEN_PCI_ERR_success (0)
52#define XEN_PCI_ERR_dev_not_found (-1)
53#define XEN_PCI_ERR_invalid_offset (-2)
54#define XEN_PCI_ERR_access_denied (-3)
55#define XEN_PCI_ERR_not_implemented (-4)
56/* XEN_PCI_ERR_op_failed - backend failed to complete the operation */
57#define XEN_PCI_ERR_op_failed (-5)
58
59/*
60 * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry))
61 * Should not exceed 128
62 */
63#define SH_INFO_MAX_VEC 128
64
65struct xen_msix_entry {
66 uint16_t vector;
67 uint16_t entry;
68};
69struct xen_pci_op {
70 /* IN: what action to perform: XEN_PCI_OP_* */
71 uint32_t cmd;
72
73 /* OUT: will contain an error number (if any) from errno.h */
74 int32_t err;
75
76 /* IN: which device to touch */
77 uint32_t domain; /* PCI Domain/Segment */
78 uint32_t bus;
79 uint32_t devfn;
80
81 /* IN: which configuration registers to touch */
82 int32_t offset;
83 int32_t size;
84
85 /* IN/OUT: Contains the result after a READ or the value to WRITE */
86 uint32_t value;
87 /* IN: Contains extra infor for this operation */
88 uint32_t info;
89 /*IN: param for msi-x */
90 struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC];
91};
92
93/*used for pcie aer handling*/
94struct xen_pcie_aer_op {
95 /* IN: what action to perform: XEN_PCI_OP_* */
96 uint32_t cmd;
97 /*IN/OUT: return aer_op result or carry error_detected state as input*/
98 int32_t err;
99
100 /* IN: which device to touch */
101 uint32_t domain; /* PCI Domain/Segment*/
102 uint32_t bus;
103 uint32_t devfn;
104};
105struct xen_pci_sharedinfo {
106 /* flags - XEN_PCIF_* */
107 uint32_t flags;
108 struct xen_pci_op op;
109 struct xen_pcie_aer_op aer_op;
110};
111
112#endif /* __XEN_PCI_COMMON_H__ */
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
index e8cbf431c8cc..75271b9a8f61 100644
--- a/include/xen/interface/io/ring.h
+++ b/include/xen/interface/io/ring.h
@@ -24,8 +24,15 @@ typedef unsigned int RING_IDX;
24 * A ring contains as many entries as will fit, rounded down to the nearest 24 * A ring contains as many entries as will fit, rounded down to the nearest
25 * power of two (so we can mask with (size-1) to loop around). 25 * power of two (so we can mask with (size-1) to loop around).
26 */ 26 */
27#define __RING_SIZE(_s, _sz) \ 27#define __CONST_RING_SIZE(_s, _sz) \
28 (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) 28 (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \
29 sizeof(((struct _s##_sring *)0)->ring[0])))
30
31/*
32 * The same for passing in an actual pointer instead of a name tag.
33 */
34#define __RING_SIZE(_s, _sz) \
35 (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
29 36
30/* 37/*
31 * Macros to make the correct C datatypes for a new kind of ring. 38 * Macros to make the correct C datatypes for a new kind of ring.
diff --git a/include/xen/interface/io/xenbus.h b/include/xen/interface/io/xenbus.h
index 46508c7fa399..9fda532973a5 100644
--- a/include/xen/interface/io/xenbus.h
+++ b/include/xen/interface/io/xenbus.h
@@ -27,8 +27,14 @@ enum xenbus_state
27 XenbusStateClosing = 5, /* The device is being closed 27 XenbusStateClosing = 5, /* The device is being closed
28 due to an error or an unplug 28 due to an error or an unplug
29 event. */ 29 event. */
30 XenbusStateClosed = 6 30 XenbusStateClosed = 6,
31 31
32 /*
33 * Reconfiguring: The device is being reconfigured.
34 */
35 XenbusStateReconfiguring = 7,
36
37 XenbusStateReconfigured = 8
32}; 38};
33 39
34#endif /* _XEN_PUBLIC_IO_XENBUS_H */ 40#endif /* _XEN_PUBLIC_IO_XENBUS_H */
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index d3938d3e71f8..eac3ce153719 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -141,6 +141,19 @@ struct xen_machphys_mfn_list {
141DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list); 141DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
142 142
143/* 143/*
144 * Returns the location in virtual address space of the machine_to_phys
145 * mapping table. Architectures which do not have a m2p table, or which do not
146 * map it by default into guest address space, do not implement this command.
147 * arg == addr of xen_machphys_mapping_t.
148 */
149#define XENMEM_machphys_mapping 12
150struct xen_machphys_mapping {
151 unsigned long v_start, v_end; /* Start and end virtual addresses. */
152 unsigned long max_mfn; /* Maximum MFN that can be looked up. */
153};
154DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t);
155
156/*
144 * Sets the GPFN at which a particular page appears in the specified guest's 157 * Sets the GPFN at which a particular page appears in the specified guest's
145 * pseudophysical address space. 158 * pseudophysical address space.
146 * arg == addr of xen_add_to_physmap_t. 159 * arg == addr of xen_add_to_physmap_t.
@@ -186,6 +199,35 @@ struct xen_translate_gpfn_list {
186}; 199};
187DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); 200DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
188 201
202/*
203 * Returns the pseudo-physical memory map as it was when the domain
204 * was started (specified by XENMEM_set_memory_map).
205 * arg == addr of struct xen_memory_map.
206 */
207#define XENMEM_memory_map 9
208struct xen_memory_map {
209 /*
210 * On call the number of entries which can be stored in buffer. On
211 * return the number of entries which have been stored in
212 * buffer.
213 */
214 unsigned int nr_entries;
215
216 /*
217 * Entries in the buffer are in the same format as returned by the
218 * BIOS INT 0x15 EAX=0xE820 call.
219 */
220 GUEST_HANDLE(void) buffer;
221};
222DEFINE_GUEST_HANDLE_STRUCT(xen_memory_map);
223
224/*
225 * Returns the real physical memory map. Passes the same structure as
226 * XENMEM_memory_map.
227 * arg == addr of struct xen_memory_map.
228 */
229#define XENMEM_machine_memory_map 10
230
189 231
190/* 232/*
191 * Prevent the balloon driver from changing the memory reservation 233 * Prevent the balloon driver from changing the memory reservation
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index cd6939147cb6..534cac89a77d 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -106,6 +106,57 @@ struct physdev_irq {
106 uint32_t vector; 106 uint32_t vector;
107}; 107};
108 108
109#define MAP_PIRQ_TYPE_MSI 0x0
110#define MAP_PIRQ_TYPE_GSI 0x1
111#define MAP_PIRQ_TYPE_UNKNOWN 0x2
112
113#define PHYSDEVOP_map_pirq 13
114struct physdev_map_pirq {
115 domid_t domid;
116 /* IN */
117 int type;
118 /* IN */
119 int index;
120 /* IN or OUT */
121 int pirq;
122 /* IN */
123 int bus;
124 /* IN */
125 int devfn;
126 /* IN */
127 int entry_nr;
128 /* IN */
129 uint64_t table_base;
130};
131
132#define PHYSDEVOP_unmap_pirq 14
133struct physdev_unmap_pirq {
134 domid_t domid;
135 /* IN */
136 int pirq;
137};
138
139#define PHYSDEVOP_manage_pci_add 15
140#define PHYSDEVOP_manage_pci_remove 16
141struct physdev_manage_pci {
142 /* IN */
143 uint8_t bus;
144 uint8_t devfn;
145};
146
147#define PHYSDEVOP_manage_pci_add_ext 20
148struct physdev_manage_pci_ext {
149 /* IN */
150 uint8_t bus;
151 uint8_t devfn;
152 unsigned is_extfn;
153 unsigned is_virtfn;
154 struct {
155 uint8_t bus;
156 uint8_t devfn;
157 } physfn;
158};
159
109/* 160/*
110 * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op() 161 * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
111 * hypercall since 0x00030202. 162 * hypercall since 0x00030202.
@@ -121,6 +172,32 @@ struct physdev_op {
121 } u; 172 } u;
122}; 173};
123 174
175#define PHYSDEVOP_setup_gsi 21
176struct physdev_setup_gsi {
177 int gsi;
178 /* IN */
179 uint8_t triggering;
180 /* IN */
181 uint8_t polarity;
182 /* IN */
183};
184
185#define PHYSDEVOP_get_nr_pirqs 22
186struct physdev_nr_pirqs {
187 /* OUT */
188 uint32_t nr_pirqs;
189};
190
191/* type is MAP_PIRQ_TYPE_GSI or MAP_PIRQ_TYPE_MSI
192 * the hypercall returns a free pirq */
193#define PHYSDEVOP_get_free_pirq 23
194struct physdev_get_free_pirq {
195 /* IN */
196 int type;
197 /* OUT */
198 uint32_t pirq;
199};
200
124/* 201/*
125 * Notify that some PIRQ-bound event channels have been unmasked. 202 * Notify that some PIRQ-bound event channels have been unmasked.
126 * ** This command is obsolete since interface version 0x00030202 and is ** 203 * ** This command is obsolete since interface version 0x00030202 and is **
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index 5fec575a800a..dd55dac340de 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -65,6 +65,39 @@ struct sched_poll {
65DEFINE_GUEST_HANDLE_STRUCT(sched_poll); 65DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
66 66
67/* 67/*
68 * Declare a shutdown for another domain. The main use of this function is
69 * in interpreting shutdown requests and reasons for fully-virtualized
70 * domains. A para-virtualized domain may use SCHEDOP_shutdown directly.
71 * @arg == pointer to sched_remote_shutdown structure.
72 */
73#define SCHEDOP_remote_shutdown 4
74struct sched_remote_shutdown {
75 domid_t domain_id; /* Remote domain ID */
76 unsigned int reason; /* SHUTDOWN_xxx reason */
77};
78
79/*
80 * Latch a shutdown code, so that when the domain later shuts down it
81 * reports this code to the control tools.
82 * @arg == as for SCHEDOP_shutdown.
83 */
84#define SCHEDOP_shutdown_code 5
85
86/*
87 * Setup, poke and destroy a domain watchdog timer.
88 * @arg == pointer to sched_watchdog structure.
89 * With id == 0, setup a domain watchdog timer to cause domain shutdown
90 * after timeout, returns watchdog id.
91 * With id != 0 and timeout == 0, destroy domain watchdog timer.
92 * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
93 */
94#define SCHEDOP_watchdog 6
95struct sched_watchdog {
96 uint32_t id; /* watchdog ID */
97 uint32_t timeout; /* timeout */
98};
99
100/*
68 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control 101 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
69 * software to determine the appropriate action. For the most part, Xen does 102 * software to determine the appropriate action. For the most part, Xen does
70 * not care about the shutdown code. 103 * not care about the shutdown code.
@@ -73,5 +106,6 @@ DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
73#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */ 106#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
74#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ 107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
75#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ 108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */
76 110
77#endif /* __XEN_PUBLIC_SCHED_H__ */ 111#endif /* __XEN_PUBLIC_SCHED_H__ */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 2befa3e2f1bc..70213b4515eb 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -30,7 +30,7 @@
30#define __HYPERVISOR_stack_switch 3 30#define __HYPERVISOR_stack_switch 3
31#define __HYPERVISOR_set_callbacks 4 31#define __HYPERVISOR_set_callbacks 4
32#define __HYPERVISOR_fpu_taskswitch 5 32#define __HYPERVISOR_fpu_taskswitch 5
33#define __HYPERVISOR_sched_op 6 33#define __HYPERVISOR_sched_op_compat 6
34#define __HYPERVISOR_dom0_op 7 34#define __HYPERVISOR_dom0_op 7
35#define __HYPERVISOR_set_debugreg 8 35#define __HYPERVISOR_set_debugreg 8
36#define __HYPERVISOR_get_debugreg 9 36#define __HYPERVISOR_get_debugreg 9
@@ -52,12 +52,13 @@
52#define __HYPERVISOR_mmuext_op 26 52#define __HYPERVISOR_mmuext_op 26
53#define __HYPERVISOR_acm_op 27 53#define __HYPERVISOR_acm_op 27
54#define __HYPERVISOR_nmi_op 28 54#define __HYPERVISOR_nmi_op 28
55#define __HYPERVISOR_sched_op_new 29 55#define __HYPERVISOR_sched_op 29
56#define __HYPERVISOR_callback_op 30 56#define __HYPERVISOR_callback_op 30
57#define __HYPERVISOR_xenoprof_op 31 57#define __HYPERVISOR_xenoprof_op 31
58#define __HYPERVISOR_event_channel_op 32 58#define __HYPERVISOR_event_channel_op 32
59#define __HYPERVISOR_physdev_op 33 59#define __HYPERVISOR_physdev_op 33
60#define __HYPERVISOR_hvm_op 34 60#define __HYPERVISOR_hvm_op 34
61#define __HYPERVISOR_tmem_op 38
61 62
62/* Architecture-specific hypercall definitions. */ 63/* Architecture-specific hypercall definitions. */
63#define __HYPERVISOR_arch_0 48 64#define __HYPERVISOR_arch_0 48
@@ -461,6 +462,27 @@ typedef uint8_t xen_domain_handle_t[16];
461#define __mk_unsigned_long(x) x ## UL 462#define __mk_unsigned_long(x) x ## UL
462#define mk_unsigned_long(x) __mk_unsigned_long(x) 463#define mk_unsigned_long(x) __mk_unsigned_long(x)
463 464
465#define TMEM_SPEC_VERSION 1
466
467struct tmem_op {
468 uint32_t cmd;
469 int32_t pool_id;
470 union {
471 struct { /* for cmd == TMEM_NEW_POOL */
472 uint64_t uuid[2];
473 uint32_t flags;
474 } new;
475 struct {
476 uint64_t oid[3];
477 uint32_t index;
478 uint32_t tmem_offset;
479 uint32_t pfn_offset;
480 uint32_t len;
481 GUEST_HANDLE(void) gmfn; /* guest machine page frame */
482 } gen;
483 } u;
484};
485
464#else /* __ASSEMBLY__ */ 486#else /* __ASSEMBLY__ */
465 487
466/* In assembly code we cannot use C numeric constant suffixes. */ 488/* In assembly code we cannot use C numeric constant suffixes. */
diff --git a/include/xen/page.h b/include/xen/page.h
index eaf85fab1263..0be36b976f4b 100644
--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -1 +1,8 @@
1#ifndef _XEN_PAGE_H
2#define _XEN_PAGE_H
3
1#include <asm/xen/page.h> 4#include <asm/xen/page.h>
5
6extern phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
7
8#endif /* _XEN_PAGE_H */
diff --git a/include/xen/privcmd.h b/include/xen/privcmd.h
new file mode 100644
index 000000000000..17857fb4d550
--- /dev/null
+++ b/include/xen/privcmd.h
@@ -0,0 +1,77 @@
1/******************************************************************************
2 * privcmd.h
3 *
4 * Interface to /proc/xen/privcmd.
5 *
6 * Copyright (c) 2003-2005, K A Fraser
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_PUBLIC_PRIVCMD_H__
34#define __LINUX_PUBLIC_PRIVCMD_H__
35
36#include <linux/types.h>
37#include <linux/compiler.h>
38
39typedef unsigned long xen_pfn_t;
40
41struct privcmd_hypercall {
42 __u64 op;
43 __u64 arg[5];
44};
45
46struct privcmd_mmap_entry {
47 __u64 va;
48 __u64 mfn;
49 __u64 npages;
50};
51
52struct privcmd_mmap {
53 int num;
54 domid_t dom; /* target domain */
55 struct privcmd_mmap_entry __user *entry;
56};
57
58struct privcmd_mmapbatch {
59 int num; /* number of pages to populate */
60 domid_t dom; /* target domain */
61 __u64 addr; /* virtual address */
62 xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */
63};
64
65/*
66 * @cmd: IOCTL_PRIVCMD_HYPERCALL
67 * @arg: &privcmd_hypercall_t
68 * Return: Value returned from execution of the specified hypercall.
69 */
70#define IOCTL_PRIVCMD_HYPERCALL \
71 _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall))
72#define IOCTL_PRIVCMD_MMAP \
73 _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap))
74#define IOCTL_PRIVCMD_MMAPBATCH \
75 _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch))
76
77#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 351f4051f6d8..03c85d7387fb 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -5,9 +5,9 @@
5 5
6DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); 6DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
7 7
8void xen_pre_suspend(void); 8void xen_arch_pre_suspend(void);
9void xen_post_suspend(int suspend_cancelled); 9void xen_arch_post_suspend(int suspend_cancelled);
10void xen_hvm_post_suspend(int suspend_cancelled); 10void xen_arch_hvm_post_suspend(int suspend_cancelled);
11 11
12void xen_mm_pin_all(void); 12void xen_mm_pin_all(void);
13void xen_mm_unpin_all(void); 13void xen_mm_unpin_all(void);
@@ -23,4 +23,9 @@ int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
23 23
24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
25 25
26int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
27 unsigned long addr,
28 unsigned long mfn, int nr,
29 pgprot_t prot, unsigned domid);
30
26#endif /* INCLUDE_XEN_OPS_H */ 31#endif /* INCLUDE_XEN_OPS_H */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 43e2d7d33976..5467369e0889 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -92,9 +92,9 @@ struct xenbus_driver {
92 void (*otherend_changed)(struct xenbus_device *dev, 92 void (*otherend_changed)(struct xenbus_device *dev,
93 enum xenbus_state backend_state); 93 enum xenbus_state backend_state);
94 int (*remove)(struct xenbus_device *dev); 94 int (*remove)(struct xenbus_device *dev);
95 int (*suspend)(struct xenbus_device *dev, pm_message_t state); 95 int (*suspend)(struct xenbus_device *dev);
96 int (*resume)(struct xenbus_device *dev); 96 int (*resume)(struct xenbus_device *dev);
97 int (*uevent)(struct xenbus_device *, char **, int, char *, int); 97 int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
98 struct device_driver driver; 98 struct device_driver driver;
99 int (*read_otherend_details)(struct xenbus_device *dev); 99 int (*read_otherend_details)(struct xenbus_device *dev);
100 int (*is_ready)(struct xenbus_device *dev); 100 int (*is_ready)(struct xenbus_device *dev);