diff options
Diffstat (limited to 'arch/x86/xen/mmu.c')
-rw-r--r-- | arch/x86/xen/mmu.c | 47 |
1 files changed, 44 insertions, 3 deletions
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 */ | ||
1978 | static void set_page_prot(void *addr, pgprot_t prot) | 1979 | static 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 | ||
2163 | static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss; | ||
2164 | |||
2162 | static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) | 2165 | static 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 | |||
2215 | static __init void xen_post_allocator_init(void) | 2254 | static __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. */ |