Merge tag 'stable/for-linus-3.13-rc0-tag' of git://git.kernel.org/pub/scm/linux/kerne...
[firefly-linux-kernel-4.4.55.git] / arch / x86 / xen / mmu.c
index 49c962fe7e626adc52e11c6c82539354a2a7011a..ce563be09cc19ebe97b499804c4d2a765d6d7fb3 100644 (file)
@@ -468,8 +468,8 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
  * 3        PCD PWT      UC       UC     UC
  * 4    PAT              WB       WC     WB
  * 5    PAT     PWT      WC       WP     WT
- * 6    PAT PCD          UC-      UC     UC-
- * 7    PAT PCD PWT      UC       UC     UC
+ * 6    PAT PCD          UC-      rsv    UC-
+ * 7    PAT PCD PWT      UC       rsv    UC
  */
 
 void xen_set_pat(u64 pat)
@@ -2328,12 +2328,14 @@ static int xen_exchange_memory(unsigned long extents_in, unsigned int order_in,
        return success;
 }
 
-int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
-                                unsigned int address_bits)
+int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
+                                unsigned int address_bits,
+                                dma_addr_t *dma_handle)
 {
        unsigned long *in_frames = discontig_frames, out_frame;
        unsigned long  flags;
        int            success;
+       unsigned long vstart = (unsigned long)phys_to_virt(pstart);
 
        /*
         * Currently an auto-translated guest will not perform I/O, nor will
@@ -2368,15 +2370,17 @@ int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
 
        spin_unlock_irqrestore(&xen_reservation_lock, flags);
 
+       *dma_handle = virt_to_machine(vstart).maddr;
        return success ? 0 : -ENOMEM;
 }
 EXPORT_SYMBOL_GPL(xen_create_contiguous_region);
 
-void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
+void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
 {
        unsigned long *out_frames = discontig_frames, in_frame;
        unsigned long  flags;
        int success;
+       unsigned long vstart;
 
        if (xen_feature(XENFEAT_auto_translated_physmap))
                return;
@@ -2384,6 +2388,7 @@ void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
        if (unlikely(order > MAX_CONTIG_ORDER))
                return;
 
+       vstart = (unsigned long)phys_to_virt(pstart);
        memset((void *) vstart, 0, PAGE_SIZE << order);
 
        spin_lock_irqsave(&xen_reservation_lock, flags);