aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-28 20:11:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-28 20:11:17 -0400
commit18cb657ca1bafe635f368346a1676fb04c512edf (patch)
treeb0eb6a4ceddf98e7bf820be7ff24bf131ff56b0c /arch/x86/xen
parent2301b65b86df8b80e6779ce9885ad62a5c4adc38 (diff)
parente28c31a96b1570f17731b18e8efabb7308d0c22c (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 'arch/x86/xen')
-rw-r--r--arch/x86/xen/Kconfig10
-rw-r--r--arch/x86/xen/enlighten.c5
-rw-r--r--arch/x86/xen/mmu.c47
-rw-r--r--arch/x86/xen/pci-swiotlb-xen.c4
-rw-r--r--arch/x86/xen/setup.c5
-rw-r--r--arch/x86/xen/smp.c26
6 files changed, 92 insertions, 5 deletions
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 90a7f5ad6916..5b54892e4bc3 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -13,6 +13,16 @@ config XEN
13 kernel to boot in a paravirtualized environment under the 13 kernel to boot in a paravirtualized environment under the
14 Xen hypervisor. 14 Xen hypervisor.
15 15
16config XEN_DOM0
17 def_bool y
18 depends on XEN && PCI_XEN && SWIOTLB_XEN
19 depends on X86_LOCAL_APIC && X86_IO_APIC && ACPI && PCI
20
21# Dummy symbol since people have come to rely on the PRIVILEGED_GUEST
22# name in tools.
23config XEN_PRIVILEGED_GUEST
24 def_bool XEN_DOM0
25
16config XEN_PVHVM 26config XEN_PVHVM
17 def_bool y 27 def_bool y
18 depends on XEN 28 depends on XEN
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 70ddeaeb1ef3..235c0f4d3861 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -46,6 +46,7 @@
46#include <asm/paravirt.h> 46#include <asm/paravirt.h>
47#include <asm/apic.h> 47#include <asm/apic.h>
48#include <asm/page.h> 48#include <asm/page.h>
49#include <asm/xen/pci.h>
49#include <asm/xen/hypercall.h> 50#include <asm/xen/hypercall.h>
50#include <asm/xen/hypervisor.h> 51#include <asm/xen/hypervisor.h>
51#include <asm/fixmap.h> 52#include <asm/fixmap.h>
@@ -236,6 +237,7 @@ static __init void xen_init_cpuid_mask(void)
236 cpuid_leaf1_edx_mask = 237 cpuid_leaf1_edx_mask =
237 ~((1 << X86_FEATURE_MCE) | /* disable MCE */ 238 ~((1 << X86_FEATURE_MCE) | /* disable MCE */
238 (1 << X86_FEATURE_MCA) | /* disable MCA */ 239 (1 << X86_FEATURE_MCA) | /* disable MCA */
240 (1 << X86_FEATURE_MTRR) | /* disable MTRR */
239 (1 << X86_FEATURE_ACC)); /* thermal monitoring */ 241 (1 << X86_FEATURE_ACC)); /* thermal monitoring */
240 242
241 if (!xen_initial_domain()) 243 if (!xen_initial_domain())
@@ -1184,6 +1186,7 @@ asmlinkage void __init xen_start_kernel(void)
1184 1186
1185 xen_raw_console_write("mapping kernel into physical memory\n"); 1187 xen_raw_console_write("mapping kernel into physical memory\n");
1186 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages); 1188 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
1189 xen_ident_map_ISA();
1187 1190
1188 /* Allocate and initialize top and mid mfn levels for p2m structure */ 1191 /* Allocate and initialize top and mid mfn levels for p2m structure */
1189 xen_build_mfn_list_list(); 1192 xen_build_mfn_list_list();
@@ -1222,6 +1225,8 @@ asmlinkage void __init xen_start_kernel(void)
1222 add_preferred_console("xenboot", 0, NULL); 1225 add_preferred_console("xenboot", 0, NULL);
1223 add_preferred_console("tty", 0, NULL); 1226 add_preferred_console("tty", 0, NULL);
1224 add_preferred_console("hvc", 0, NULL); 1227 add_preferred_console("hvc", 0, NULL);
1228 if (pci_xen)
1229 x86_init.pci.arch_init = pci_xen_init;
1225 } else { 1230 } else {
1226 /* Make sure ACS will be enabled */ 1231 /* Make sure ACS will be enabled */
1227 pci_request_acs(); 1232 pci_request_acs();
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 9631c90907eb..c237b810b03f 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1975,6 +1975,7 @@ static void *m2v(phys_addr_t maddr)
1975 return __ka(m2p(maddr)); 1975 return __ka(m2p(maddr));
1976} 1976}
1977 1977
1978/* Set the page permissions on an identity-mapped pages */
1978static void set_page_prot(void *addr, pgprot_t prot) 1979static void set_page_prot(void *addr, pgprot_t prot)
1979{ 1980{
1980 unsigned long pfn = __pa(addr) >> PAGE_SHIFT; 1981 unsigned long pfn = __pa(addr) >> PAGE_SHIFT;
@@ -2159,6 +2160,8 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
2159} 2160}
2160#endif /* CONFIG_X86_64 */ 2161#endif /* CONFIG_X86_64 */
2161 2162
2163static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss;
2164
2162static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) 2165static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2163{ 2166{
2164 pte_t pte; 2167 pte_t pte;
@@ -2179,15 +2182,28 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2179#else 2182#else
2180 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE: 2183 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE:
2181#endif 2184#endif
2182#ifdef CONFIG_X86_LOCAL_APIC
2183 case FIX_APIC_BASE: /* maps dummy local APIC */
2184#endif
2185 case FIX_TEXT_POKE0: 2185 case FIX_TEXT_POKE0:
2186 case FIX_TEXT_POKE1: 2186 case FIX_TEXT_POKE1:
2187 /* All local page mappings */ 2187 /* All local page mappings */
2188 pte = pfn_pte(phys, prot); 2188 pte = pfn_pte(phys, prot);
2189 break; 2189 break;
2190 2190
2191#ifdef CONFIG_X86_LOCAL_APIC
2192 case FIX_APIC_BASE: /* maps dummy local APIC */
2193 pte = pfn_pte(PFN_DOWN(__pa(dummy_mapping)), PAGE_KERNEL);
2194 break;
2195#endif
2196
2197#ifdef CONFIG_X86_IO_APIC
2198 case FIX_IO_APIC_BASE_0 ... FIX_IO_APIC_BASE_END:
2199 /*
2200 * We just don't map the IO APIC - all access is via
2201 * hypercalls. Keep the address in the pte for reference.
2202 */
2203 pte = pfn_pte(PFN_DOWN(__pa(dummy_mapping)), PAGE_KERNEL);
2204 break;
2205#endif
2206
2191 case FIX_PARAVIRT_BOOTMAP: 2207 case FIX_PARAVIRT_BOOTMAP:
2192 /* This is an MFN, but it isn't an IO mapping from the 2208 /* This is an MFN, but it isn't an IO mapping from the
2193 IO domain */ 2209 IO domain */
@@ -2212,6 +2228,29 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2212#endif 2228#endif
2213} 2229}
2214 2230
2231__init void xen_ident_map_ISA(void)
2232{
2233 unsigned long pa;
2234
2235 /*
2236 * If we're dom0, then linear map the ISA machine addresses into
2237 * the kernel's address space.
2238 */
2239 if (!xen_initial_domain())
2240 return;
2241
2242 xen_raw_printk("Xen: setup ISA identity maps\n");
2243
2244 for (pa = ISA_START_ADDRESS; pa < ISA_END_ADDRESS; pa += PAGE_SIZE) {
2245 pte_t pte = mfn_pte(PFN_DOWN(pa), PAGE_KERNEL_IO);
2246
2247 if (HYPERVISOR_update_va_mapping(PAGE_OFFSET + pa, pte, 0))
2248 BUG();
2249 }
2250
2251 xen_flush_tlb();
2252}
2253
2215static __init void xen_post_allocator_init(void) 2254static __init void xen_post_allocator_init(void)
2216{ 2255{
2217 pv_mmu_ops.set_pte = xen_set_pte; 2256 pv_mmu_ops.set_pte = xen_set_pte;
@@ -2320,6 +2359,8 @@ void __init xen_init_mmu_ops(void)
2320 pv_mmu_ops = xen_mmu_ops; 2359 pv_mmu_ops = xen_mmu_ops;
2321 2360
2322 vmap_lazy_unmap = false; 2361 vmap_lazy_unmap = false;
2362
2363 memset(dummy_mapping, 0xff, PAGE_SIZE);
2323} 2364}
2324 2365
2325/* Protected by xen_reservation_lock. */ 2366/* Protected by xen_reservation_lock. */
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c
index 22471001b74c..bfd0632fe65e 100644
--- a/arch/x86/xen/pci-swiotlb-xen.c
+++ b/arch/x86/xen/pci-swiotlb-xen.c
@@ -1,6 +1,7 @@
1/* Glue code to lib/swiotlb-xen.c */ 1/* Glue code to lib/swiotlb-xen.c */
2 2
3#include <linux/dma-mapping.h> 3#include <linux/dma-mapping.h>
4#include <linux/pci.h>
4#include <xen/swiotlb-xen.h> 5#include <xen/swiotlb-xen.h>
5 6
6#include <asm/xen/hypervisor.h> 7#include <asm/xen/hypervisor.h>
@@ -55,6 +56,9 @@ void __init pci_xen_swiotlb_init(void)
55 if (xen_swiotlb) { 56 if (xen_swiotlb) {
56 xen_swiotlb_init(1); 57 xen_swiotlb_init(1);
57 dma_ops = &xen_swiotlb_dma_ops; 58 dma_ops = &xen_swiotlb_dma_ops;
59
60 /* Make sure ACS will be enabled */
61 pci_request_acs();
58 } 62 }
59} 63}
60IOMMU_INIT_FINISH(pci_xen_swiotlb_detect, 64IOMMU_INIT_FINISH(pci_xen_swiotlb_detect,
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 105db2501050..b1dbdaa23ecc 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -204,6 +204,9 @@ char * __init xen_memory_setup(void)
204 * Even though this is normal, usable memory under Xen, reserve 204 * Even though this is normal, usable memory under Xen, reserve
205 * ISA memory anyway because too many things think they can poke 205 * ISA memory anyway because too many things think they can poke
206 * about in there. 206 * about in there.
207 *
208 * In a dom0 kernel, this region is identity mapped with the
209 * hardware ISA area, so it really is out of bounds.
207 */ 210 */
208 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, 211 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
209 E820_RESERVED); 212 E820_RESERVED);
@@ -367,7 +370,5 @@ void __init xen_arch_setup(void)
367 370
368 pm_idle = xen_idle; 371 pm_idle = xen_idle;
369 372
370 paravirt_disable_iospace();
371
372 fiddle_vdso(); 373 fiddle_vdso();
373} 374}
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index f4d010031465..72a4c7959045 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -28,6 +28,7 @@
28#include <asm/xen/interface.h> 28#include <asm/xen/interface.h>
29#include <asm/xen/hypercall.h> 29#include <asm/xen/hypercall.h>
30 30
31#include <xen/xen.h>
31#include <xen/page.h> 32#include <xen/page.h>
32#include <xen/events.h> 33#include <xen/events.h>
33 34
@@ -156,11 +157,35 @@ static void __init xen_fill_possible_map(void)
156{ 157{
157 int i, rc; 158 int i, rc;
158 159
160 if (xen_initial_domain())
161 return;
162
163 for (i = 0; i < nr_cpu_ids; i++) {
164 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
165 if (rc >= 0) {
166 num_processors++;
167 set_cpu_possible(i, true);
168 }
169 }
170}
171
172static void __init xen_filter_cpu_maps(void)
173{
174 int i, rc;
175
176 if (!xen_initial_domain())
177 return;
178
179 num_processors = 0;
180 disabled_cpus = 0;
159 for (i = 0; i < nr_cpu_ids; i++) { 181 for (i = 0; i < nr_cpu_ids; i++) {
160 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); 182 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
161 if (rc >= 0) { 183 if (rc >= 0) {
162 num_processors++; 184 num_processors++;
163 set_cpu_possible(i, true); 185 set_cpu_possible(i, true);
186 } else {
187 set_cpu_possible(i, false);
188 set_cpu_present(i, false);
164 } 189 }
165 } 190 }
166} 191}
@@ -174,6 +199,7 @@ static void __init xen_smp_prepare_boot_cpu(void)
174 old memory can be recycled */ 199 old memory can be recycled */
175 make_lowmem_page_readwrite(xen_initial_gdt); 200 make_lowmem_page_readwrite(xen_initial_gdt);
176 201
202 xen_filter_cpu_maps();
177 xen_setup_vcpu_info_placement(); 203 xen_setup_vcpu_info_placement();
178} 204}
179 205