diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 20:11:17 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 20:11:17 -0400 |
| commit | 18cb657ca1bafe635f368346a1676fb04c512edf (patch) | |
| tree | b0eb6a4ceddf98e7bf820be7ff24bf131ff56b0c /include | |
| parent | 2301b65b86df8b80e6779ce9885ad62a5c4adc38 (diff) | |
| parent | e28c31a96b1570f17731b18e8efabb7308d0c22c (diff) | |
Merge branch 'stable/xen-pcifront-0.8.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
and branch 'for-linus' of git://xenbits.xen.org/people/sstabellini/linux-pvhvm
* 'for-linus' of git://xenbits.xen.org/people/sstabellini/linux-pvhvm:
xen: register xen pci notifier
xen: initialize cpu masks for pv guests in xen_smp_init
xen: add a missing #include to arch/x86/pci/xen.c
xen: mask the MTRR feature from the cpuid
xen: make hvc_xen console work for dom0.
xen: add the direct mapping area for ISA bus access
xen: Initialize xenbus for dom0.
xen: use vcpu_ops to setup cpu masks
xen: map a dummy page for local apic and ioapic in xen_set_fixmap
xen: remap MSIs into pirqs when running as initial domain
xen: remap GSIs as pirqs when running as initial domain
xen: introduce XEN_DOM0 as a silent option
xen: map MSIs into pirqs
xen: support GSI -> pirq remapping in PV on HVM guests
xen: add xen hvm acpi_register_gsi variant
acpi: use indirect call to register gsi in different modes
xen: implement xen_hvm_register_pirq
xen: get the maximum number of pirqs from xen
xen: support pirq != irq
* 'stable/xen-pcifront-0.8.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: (27 commits)
X86/PCI: Remove the dependency on isapnp_disable.
xen: Update Makefile with CONFIG_BLOCK dependency for biomerge.c
MAINTAINERS: Add myself to the Xen Hypervisor Interface and remove Chris Wright.
x86: xen: Sanitse irq handling (part two)
swiotlb-xen: On x86-32 builts, select SWIOTLB instead of depending on it.
MAINTAINERS: Add myself for Xen PCI and Xen SWIOTLB maintainer.
xen/pci: Request ACS when Xen-SWIOTLB is activated.
xen-pcifront: Xen PCI frontend driver.
xenbus: prevent warnings on unhandled enumeration values
xenbus: Xen paravirtualised PCI hotplug support.
xen/x86/PCI: Add support for the Xen PCI subsystem
x86: Introduce x86_msi_ops
msi: Introduce default_[teardown|setup]_msi_irqs with fallback.
x86/PCI: Export pci_walk_bus function.
x86/PCI: make sure _PAGE_IOMAP it set on pci mappings
x86/PCI: Clean up pci_cache_line_size
xen: fix shared irq device passthrough
xen: Provide a variant of xen_poll_irq with timeout.
xen: Find an unbound irq number in reverse order (high to low).
xen: statically initialize cpu_evtchn_mask_p
...
Fix up trivial conflicts in drivers/pci/Makefile
Diffstat (limited to 'include')
| -rw-r--r-- | include/xen/events.h | 26 | ||||
| -rw-r--r-- | include/xen/interface/features.h | 3 | ||||
| -rw-r--r-- | include/xen/interface/io/pciif.h | 112 | ||||
| -rw-r--r-- | include/xen/interface/io/xenbus.h | 8 | ||||
| -rw-r--r-- | include/xen/interface/physdev.h | 67 |
5 files changed, 215 insertions, 1 deletions
diff --git a/include/xen/events.h b/include/xen/events.h index a15d93262e30..646dd17d3aa4 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); |
| 15 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu); | ||
| 15 | int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, | 16 | int 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, |
| @@ -53,6 +54,10 @@ bool xen_test_irq_pending(int irq); | |||
| 53 | irq will be disabled so it won't deliver an interrupt. */ | 54 | irq will be disabled so it won't deliver an interrupt. */ |
| 54 | void xen_poll_irq(int irq); | 55 | void xen_poll_irq(int irq); |
| 55 | 56 | ||
| 57 | /* Poll waiting for an irq to become pending with a timeout. In the usual case, | ||
| 58 | * the irq will be disabled so it won't deliver an interrupt. */ | ||
| 59 | void xen_poll_irq_timeout(int irq, u64 timeout); | ||
| 60 | |||
| 56 | /* Determine the IRQ which is bound to an event channel */ | 61 | /* Determine the IRQ which is bound to an event channel */ |
| 57 | unsigned irq_from_evtchn(unsigned int evtchn); | 62 | unsigned irq_from_evtchn(unsigned int evtchn); |
| 58 | 63 | ||
| @@ -63,4 +68,25 @@ int xen_set_callback_via(uint64_t via); | |||
| 63 | void xen_evtchn_do_upcall(struct pt_regs *regs); | 68 | void xen_evtchn_do_upcall(struct pt_regs *regs); |
| 64 | void xen_hvm_evtchn_do_upcall(void); | 69 | void xen_hvm_evtchn_do_upcall(void); |
| 65 | 70 | ||
| 71 | /* Allocate an irq for a physical interrupt, given a gsi. "Legacy" | ||
| 72 | * GSIs are identity mapped; others are dynamically allocated as | ||
| 73 | * usual. */ | ||
| 74 | int xen_allocate_pirq(unsigned gsi, int shareable, char *name); | ||
| 75 | int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); | ||
| 76 | |||
| 77 | #ifdef CONFIG_PCI_MSI | ||
| 78 | /* Allocate an irq and a pirq to be used with MSIs. */ | ||
| 79 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq); | ||
| 80 | int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); | ||
| 81 | #endif | ||
| 82 | |||
| 83 | /* De-allocates the above mentioned physical interrupt. */ | ||
| 84 | int xen_destroy_irq(int irq); | ||
| 85 | |||
| 86 | /* Return vector allocated to pirq */ | ||
| 87 | int xen_vector_from_irq(unsigned pirq); | ||
| 88 | |||
| 89 | /* Return gsi allocated to pirq */ | ||
| 90 | int xen_gsi_from_irq(unsigned pirq); | ||
| 91 | |||
| 66 | #endif /* _XEN_EVENTS_H */ | 92 | #endif /* _XEN_EVENTS_H */ |
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/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 | |||
| 65 | struct xen_msix_entry { | ||
| 66 | uint16_t vector; | ||
| 67 | uint16_t entry; | ||
| 68 | }; | ||
| 69 | struct 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*/ | ||
| 94 | struct 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 | }; | ||
| 105 | struct 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/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/physdev.h b/include/xen/interface/physdev.h index cd6939147cb6..2b2c66c3df00 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 | ||
| 114 | struct 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 | ||
| 133 | struct 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 | ||
| 141 | struct physdev_manage_pci { | ||
| 142 | /* IN */ | ||
| 143 | uint8_t bus; | ||
| 144 | uint8_t devfn; | ||
| 145 | }; | ||
| 146 | |||
| 147 | #define PHYSDEVOP_manage_pci_add_ext 20 | ||
| 148 | struct 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,22 @@ struct physdev_op { | |||
| 121 | } u; | 172 | } u; |
| 122 | }; | 173 | }; |
| 123 | 174 | ||
| 175 | #define PHYSDEVOP_setup_gsi 21 | ||
| 176 | struct 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 | ||
| 186 | struct physdev_nr_pirqs { | ||
| 187 | /* OUT */ | ||
| 188 | uint32_t nr_pirqs; | ||
| 189 | }; | ||
| 190 | |||
| 124 | /* | 191 | /* |
| 125 | * Notify that some PIRQ-bound event channels have been unmasked. | 192 | * Notify that some PIRQ-bound event channels have been unmasked. |
| 126 | * ** This command is obsolete since interface version 0x00030202 and is ** | 193 | * ** This command is obsolete since interface version 0x00030202 and is ** |
