|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH 02/27] xen: Allow unprivileged Xen domains to create
From: Alex Nixon <alex.nixon@xxxxxxxxxx>
PV DomU domains are allowed to map hardware MFNs for PCI passthrough,
but are not generally allowed to map raw machine pages. In particular,
various pieces of code try to map DMI and ACPI tables in the ISA ROM
range. We disallow _PAGE_IOMAP for those mappings, so that they are
redirected to a set of local zeroed pages we reserve for that purpose.
Signed-off-by: Alex Nixon <alex.nixon@xxxxxxxxxx>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
arch/x86/xen/enlighten.c | 6 +++---
arch/x86/xen/mmu.c | 18 +++++++++++++++---
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f673cd8..0605f19 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -998,11 +998,11 @@ asmlinkage void __init xen_start_kernel(void)
/* Prevent unwanted bits from being set in PTEs. */
__supported_pte_mask &= ~_PAGE_GLOBAL;
- if (xen_initial_domain())
- __supported_pte_mask |= _PAGE_IOMAP;
- else
+ if (!xen_initial_domain())
__supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
+ __supported_pte_mask |= _PAGE_IOMAP;
+
/* Don't do the full vcpu_info placement stuff until we have a
possible map and a non-dummy shared_info. */
per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 0a0cd61..58af0b0 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -49,6 +49,7 @@
#include <asm/mmu_context.h>
#include <asm/setup.h>
#include <asm/paravirt.h>
+#include <asm/e820.h>
#include <asm/linkage.h>
#include <asm/xen/hypercall.h>
@@ -398,7 +399,7 @@ static bool xen_page_pinned(void *ptr)
static bool xen_iomap_pte(pte_t pte)
{
- return xen_initial_domain() && (pte_flags(pte) & _PAGE_IOMAP);
+ return pte_flags(pte) & _PAGE_IOMAP;
}
static void xen_set_iomap_pte(pte_t *ptep, pte_t pteval)
@@ -600,10 +601,21 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
pte_t xen_make_pte(pteval_t pte)
{
- if (unlikely(xen_initial_domain() && (pte & _PAGE_IOMAP)))
+ phys_addr_t addr = (pte & PTE_PFN_MASK);
+
+ /*
+ * Unprivileged domains are allowed to do IOMAPpings for
+ * PCI passthrough, but not map ISA space. The ISA
+ * mappings are just dummy local mappings to keep other
+ * parts of the kernel happy.
+ */
+ if (unlikely(pte & _PAGE_IOMAP) &&
+ (xen_initial_domain() || addr >= ISA_END_ADDRESS)) {
pte = iomap_pte(pte);
- else
+ } else {
+ pte &= ~_PAGE_IOMAP;
pte = pte_pfn_to_mfn(pte);
+ }
return native_make_pte(pte);
}
--
1.6.0.6
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-devel] [PATCH 15/27] xen/swiotlb: use dma_alloc_from_coherent to get device coherent memory, (continued)
- [Xen-devel] [PATCH 15/27] xen/swiotlb: use dma_alloc_from_coherent to get device coherent memory, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 20/27] xen mtrr: Use specific cpu_has_foo macros instead of generic cpu_has(), Jeremy Fitzhardinge
- [Xen-devel] [PATCH 24/27] xen mtrr: Kill some unneccessary includes, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 25/27] x86: define arch_vm_get_page_prot to set _PAGE_IOMAP on VM_IO vmas, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 26/27] agp: use more dma-ops-like operations for agp memory, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 21/27] xen mtrr: Use generic_validate_add_page(), Jeremy Fitzhardinge
- [Xen-devel] [PATCH 22/27] xen mtrr: Implement xen_get_free_region(), Jeremy Fitzhardinge
- [Xen-devel] [PATCH 23/27] xen mtrr: Add xen_{get, set}_mtrr() implementations, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 27/27] agp/intel: use dma_alloc_coherent for special cursor memory, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 13/27] xen/swiotlb: add hook for swiotlb_arch_range_needs_mapping, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 02/27] xen: Allow unprivileged Xen domains to create iomap pages,
Jeremy Fitzhardinge <=
|
|
|
|
|