Merge tag 'v4.2-rc8' into x86/mm, before applying new changes
authorIngo Molnar <mingo@kernel.org>
Tue, 25 Aug 2015 07:59:19 +0000 (09:59 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 25 Aug 2015 07:59:19 +0000 (09:59 +0200)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
17 files changed:
arch/avr32/include/asm/io.h
arch/frv/include/asm/io.h
arch/m32r/include/asm/io.h
arch/m68k/include/asm/io_mm.h
arch/mn10300/include/asm/io.h
arch/powerpc/include/asm/io.h
arch/sh/include/asm/io.h
arch/tile/include/asm/io.h
arch/x86/include/asm/io.h
arch/x86/kernel/check.c
arch/x86/mm/init.c
arch/x86/mm/init_32.c
arch/x86/mm/pageattr-test.c
arch/x86/mm/pageattr.c
drivers/video/fbdev/aty/atyfb.h
drivers/video/fbdev/aty/atyfb_base.c
include/asm-generic/io.h

index e998ff5d8e1a540aa8274e07c9bc8f7443ed7633..f855646e0db7c12b95749242cf567ffd2fa6342d 100644 (file)
@@ -297,6 +297,7 @@ extern void __iounmap(void __iomem *addr);
 
 #define ioremap_wc ioremap_nocache
 #define ioremap_wt ioremap_nocache
+#define ioremap_uc ioremap_nocache
 
 #define cached(addr) P1SEGADDR(addr)
 #define uncached(addr) P2SEGADDR(addr)
index a31b63ec4930547d306a94bebcb28b9bce48364f..70dfbea8c8d7c23d70449217de0d4f100e92dc3a 100644 (file)
@@ -278,6 +278,7 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l
 }
 
 #define ioremap_wc ioremap_nocache
+#define ioremap_uc ioremap_nocache
 
 extern void iounmap(void volatile __iomem *addr);
 
index f8de767ce2bcc763979ef6e08d4ef4f862a89efb..61b8931bc19250df3af7b42b4e667749332b6be1 100644 (file)
@@ -69,6 +69,7 @@ extern void iounmap(volatile void __iomem *addr);
 #define ioremap_nocache(off,size) ioremap(off,size)
 #define ioremap_wc ioremap_nocache
 #define ioremap_wt ioremap_nocache
+#define ioremap_uc ioremap_nocache
 
 /*
  * IO bus memory addresses are also 1:1 with the physical address
index f55cad529400f65eb38832cce8c96760a44f1aad..c98ac81582ac5c967d7bddb04ae6325bc230f8b1 100644 (file)
@@ -468,6 +468,7 @@ static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned lon
 {
        return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
+#define ioremap_uc ioremap_nocache
 static inline void __iomem *ioremap_wt(unsigned long physaddr,
                                         unsigned long size)
 {
index 07c5b4a3903ba61ede14417e63f0d9b7a630f7db..62189353d2f62544ffd19ff6f895c8d0076350fb 100644 (file)
@@ -283,6 +283,7 @@ static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long
 
 #define ioremap_wc ioremap_nocache
 #define ioremap_wt ioremap_nocache
+#define ioremap_uc ioremap_nocache
 
 static inline void iounmap(void __iomem *addr)
 {
index a8d2ef30d473a12486659c7a2109eaa09fe1665a..5879fde56f3c91080a585685f42ca6b411b39d24 100644 (file)
@@ -721,6 +721,7 @@ extern void __iomem *ioremap_prot(phys_addr_t address, unsigned long size,
                                  unsigned long flags);
 extern void __iomem *ioremap_wc(phys_addr_t address, unsigned long size);
 #define ioremap_nocache(addr, size)    ioremap((addr), (size))
+#define ioremap_uc(addr, size)         ioremap((addr), (size))
 
 extern void iounmap(volatile void __iomem *addr);
 
index 728c4c571f40ee20d879bd097c259fd274a37c29..93ec9066dbef307d46e4111cf572306ee5d013c8 100644 (file)
@@ -368,6 +368,7 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
 #endif
 
 #define ioremap_nocache        ioremap
+#define ioremap_uc     ioremap
 #define iounmap                __iounmap
 
 /*
index dc61de15c1f936d4990d5b8d06b1e0d4ab0eb913..322b5fe947815d4261dab448209b6f81b8a1deb1 100644 (file)
@@ -55,6 +55,7 @@ extern void iounmap(volatile void __iomem *addr);
 #define ioremap_nocache(physaddr, size)                ioremap(physaddr, size)
 #define ioremap_wc(physaddr, size)             ioremap(physaddr, size)
 #define ioremap_wt(physaddr, size)             ioremap(physaddr, size)
+#define ioremap_uc(physaddr, size)             ioremap(physaddr, size)
 #define ioremap_fullcache(physaddr, size)      ioremap(physaddr, size)
 
 #define mmiowb()
index cc9c61bc1abed1a661b88410512cb1e34d7ea8ae..7cfc085b6879babbc47695352835852b4846e650 100644 (file)
@@ -180,6 +180,8 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
  */
 extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
 extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
+#define ioremap_uc ioremap_uc
+
 extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
 extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size,
                                unsigned long prot_val);
index 58118e207a69c4b5a249c6e9458f6b54f6295e52..145863d4d343c4138c167228550e4a0a6a9363a4 100644 (file)
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/kthread.h>
 #include <linux/workqueue.h>
@@ -163,6 +163,5 @@ static int start_periodic_check_for_corruption(void)
        schedule_delayed_work(&bios_check_work, 0);
        return 0;
 }
-
-module_init(start_periodic_check_for_corruption);
+device_initcall(start_periodic_check_for_corruption);
 
index 8533b46e6bee565e242f8ea339d892b65206c97d..1d8a83df153af10a150baf44cd7fd85adf0bbcf4 100644 (file)
 /*
  * Tables translating between page_cache_type_t and pte encoding.
  *
- * Minimal supported modes are defined statically, they are modified
- * during bootup if more supported cache modes are available.
+ * The default values are defined statically as minimal supported mode;
+ * WC and WT fall back to UC-.  pat_init() updates these values to support
+ * more cache modes, WC and WT, when it is safe to do so.  See pat_init()
+ * for the details.  Note, __early_ioremap() used during early boot-time
+ * takes pgprot_t (pte encoding) and does not use these tables.
  *
  *   Index into __cachemode2pte_tbl[] is the cachemode.
  *
index 8340e45c891a1dc879a6e23ab95fe0e2e82b5eec..68aec42545c2a3e90d3731b217f2cc097cbd8045 100644 (file)
@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end)
 
        vaddr = start;
        pgd_idx = pgd_index(vaddr);
+       pmd_idx = pmd_index(vaddr);
 
        for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) {
                for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);
index 8ff686aa7e8c23d8faec2bd0ff27491114897854..5f169d5d76a889cf1c489f6f1c8a0f7a40c10c4a 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/kthread.h>
 #include <linux/random.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
 
@@ -256,5 +257,4 @@ static int start_pageattr_test(void)
 
        return 0;
 }
-
-module_init(start_pageattr_test);
+device_initcall(start_pageattr_test);
index 727158cb3b3c91111f7bfe63a3b2fd9744972c1a..2c44c07923012a58e9f430bf4754910984771556 100644 (file)
@@ -4,7 +4,6 @@
  */
 #include <linux/highmem.h>
 #include <linux/bootmem.h>
-#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 1f39a62f899be953384320f9bb25da13427c4374..63c4842eb2243ab0e73790776e7b7ec26abd806a 100644 (file)
@@ -182,10 +182,7 @@ struct atyfb_par {
        unsigned long irq_flags;
        unsigned int irq;
        spinlock_t int_lock;
-#ifdef CONFIG_MTRR
-       int mtrr_aper;
-       int mtrr_reg;
-#endif
+       int wc_cookie;
        u32 mem_cntl;
        struct crtc saved_crtc;
        union aty_pll saved_pll;
index 8789e487b96e98f12d639530d21b792c15d1e60b..f34ed47fcaf82e71b1fa25386226389a9bfbe670 100644 (file)
@@ -98,9 +98,6 @@
 #ifdef CONFIG_PMAC_BACKLIGHT
 #include <asm/backlight.h>
 #endif
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
 
 /*
  * Debug flags.
@@ -303,9 +300,7 @@ static struct fb_ops atyfb_ops = {
 };
 
 static bool noaccel;
-#ifdef CONFIG_MTRR
 static bool nomtrr;
-#endif
 static int vram;
 static int pll;
 static int mclk;
@@ -427,6 +422,20 @@ static struct {
 #endif /* CONFIG_FB_ATY_CT */
 };
 
+/*
+ * Last page of 8 MB (4 MB on ISA) aperture is MMIO,
+ * unless the auxiliary register aperture is used.
+ */
+static void aty_fudge_framebuffer_len(struct fb_info *info)
+{
+       struct atyfb_par *par = (struct atyfb_par *) info->par;
+
+       if (!par->aux_start &&
+           (info->fix.smem_len == 0x800000 ||
+            (par->bus_type == ISA && info->fix.smem_len == 0x400000)))
+               info->fix.smem_len -= GUI_RESERVE;
+}
+
 static int correct_chipset(struct atyfb_par *par)
 {
        u8 rev;
@@ -2603,14 +2612,7 @@ static int aty_init(struct fb_info *info)
        if (par->pll_ops->resume_pll)
                par->pll_ops->resume_pll(info, &par->pll);
 
-       /*
-        * Last page of 8 MB (4 MB on ISA) aperture is MMIO,
-        * unless the auxiliary register aperture is used.
-        */
-       if (!par->aux_start &&
-           (info->fix.smem_len == 0x800000 ||
-            (par->bus_type == ISA && info->fix.smem_len == 0x400000)))
-               info->fix.smem_len -= GUI_RESERVE;
+       aty_fudge_framebuffer_len(info);
 
        /*
         * Disable register access through the linear aperture
@@ -2621,25 +2623,13 @@ static int aty_init(struct fb_info *info)
                aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL, par) |
                            BUS_APER_REG_DIS, par);
 
-#ifdef CONFIG_MTRR
-       par->mtrr_aper = -1;
-       par->mtrr_reg = -1;
-       if (!nomtrr) {
-               /* Cover the whole resource. */
-               par->mtrr_aper = mtrr_add(par->res_start, par->res_size,
-                                         MTRR_TYPE_WRCOMB, 1);
-               if (par->mtrr_aper >= 0 && !par->aux_start) {
-                       /* Make a hole for mmio. */
-                       par->mtrr_reg = mtrr_add(par->res_start + 0x800000 -
-                                                GUI_RESERVE, GUI_RESERVE,
-                                                MTRR_TYPE_UNCACHABLE, 1);
-                       if (par->mtrr_reg < 0) {
-                               mtrr_del(par->mtrr_aper, 0, 0);
-                               par->mtrr_aper = -1;
-                       }
-               }
-       }
-#endif
+       if (!nomtrr)
+               /*
+                * Only the ioremap_wc()'d area will get WC here
+                * since ioremap_uc() was used on the entire PCI BAR.
+                */
+               par->wc_cookie = arch_phys_wc_add(par->res_start,
+                                                 par->res_size);
 
        info->fbops = &atyfb_ops;
        info->pseudo_palette = par->pseudo_palette;
@@ -2767,17 +2757,8 @@ aty_init_exit:
        /* restore video mode */
        aty_set_crtc(par, &par->saved_crtc);
        par->pll_ops->set_pll(info, &par->saved_pll);
+       arch_phys_wc_del(par->wc_cookie);
 
-#ifdef CONFIG_MTRR
-       if (par->mtrr_reg >= 0) {
-               mtrr_del(par->mtrr_reg, 0, 0);
-               par->mtrr_reg = -1;
-       }
-       if (par->mtrr_aper >= 0) {
-               mtrr_del(par->mtrr_aper, 0, 0);
-               par->mtrr_aper = -1;
-       }
-#endif
        return ret;
 }
 
@@ -3459,7 +3440,11 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
        }
 
        info->fix.mmio_start = raddr;
-       par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000);
+       /*
+        * By using strong UC we force the MTRR to never have an
+        * effect on the MMIO region on both non-PAT and PAT systems.
+        */
+       par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000);
        if (par->ati_regbase == NULL)
                return -ENOMEM;
 
@@ -3482,7 +3467,24 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
 
        /* Map in frame buffer */
        info->fix.smem_start = addr;
-       info->screen_base = ioremap(addr, 0x800000);
+
+       /*
+        * The framebuffer is not always 8 MiB, that's just the size of the
+        * PCI BAR. We temporarily abuse smem_len here to store the size
+        * of the BAR. aty_init() will later correct it to match the actual
+        * framebuffer size.
+        *
+        * On devices that don't have the auxiliary register aperture, the
+        * registers are housed at the top end of the framebuffer PCI BAR.
+        * aty_fudge_framebuffer_len() is used to reduce smem_len to not
+        * overlap with the registers.
+        */
+       info->fix.smem_len = 0x800000;
+
+       aty_fudge_framebuffer_len(info);
+
+       info->screen_base = ioremap_wc(info->fix.smem_start,
+                                      info->fix.smem_len);
        if (info->screen_base == NULL) {
                ret = -ENOMEM;
                goto atyfb_setup_generic_fail;
@@ -3554,6 +3556,7 @@ static int atyfb_pci_probe(struct pci_dev *pdev,
                return -ENOMEM;
        }
        par = info->par;
+       par->bus_type = PCI;
        info->fix = atyfb_fix;
        info->device = &pdev->dev;
        par->pci_id = pdev->device;
@@ -3655,7 +3658,8 @@ static int __init atyfb_atari_probe(void)
                 * Map the video memory (physical address given)
                 * to somewhere in the kernel address space.
                 */
-               info->screen_base = ioremap(phys_vmembase[m64_num], phys_size[m64_num]);
+               info->screen_base = ioremap_wc(phys_vmembase[m64_num],
+                                              phys_size[m64_num]);
                info->fix.smem_start = (unsigned long)info->screen_base; /* Fake! */
                par->ati_regbase = ioremap(phys_guiregbase[m64_num], 0x10000) +
                                                0xFC00ul;
@@ -3721,17 +3725,8 @@ static void atyfb_remove(struct fb_info *info)
        if (M64_HAS(MOBIL_BUS))
                aty_bl_exit(info->bl_dev);
 #endif
+       arch_phys_wc_del(par->wc_cookie);
 
-#ifdef CONFIG_MTRR
-       if (par->mtrr_reg >= 0) {
-               mtrr_del(par->mtrr_reg, 0, 0);
-               par->mtrr_reg = -1;
-       }
-       if (par->mtrr_aper >= 0) {
-               mtrr_del(par->mtrr_aper, 0, 0);
-               par->mtrr_aper = -1;
-       }
-#endif
 #ifndef __sparc__
        if (par->ati_regbase)
                iounmap(par->ati_regbase);
@@ -3847,10 +3842,8 @@ static int __init atyfb_setup(char *options)
        while ((this_opt = strsep(&options, ",")) != NULL) {
                if (!strncmp(this_opt, "noaccel", 7)) {
                        noaccel = 1;
-#ifdef CONFIG_MTRR
                } else if (!strncmp(this_opt, "nomtrr", 6)) {
                        nomtrr = 1;
-#endif
                } else if (!strncmp(this_opt, "vram:", 5))
                        vram = simple_strtoul(this_opt + 5, NULL, 0);
                else if (!strncmp(this_opt, "pll:", 4))
@@ -4020,7 +4013,5 @@ module_param(comp_sync, int, 0);
 MODULE_PARM_DESC(comp_sync, "Set composite sync signal to low (0) or high (1)");
 module_param(mode, charp, 0);
 MODULE_PARM_DESC(mode, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");
-#ifdef CONFIG_MTRR
 module_param(nomtrr, bool, 0);
 MODULE_PARM_DESC(nomtrr, "bool: disable use of MTRR registers");
-#endif
index f56094cfdeff0e0f312045212bcf19e8a99882db..eed3bbe88c8a440d380f535e1980efca2188ae92 100644 (file)
@@ -736,6 +736,35 @@ static inline void *phys_to_virt(unsigned long address)
 }
 #endif
 
+/**
+ * DOC: ioremap() and ioremap_*() variants
+ *
+ * If you have an IOMMU your architecture is expected to have both ioremap()
+ * and iounmap() implemented otherwise the asm-generic helpers will provide a
+ * direct mapping.
+ *
+ * There are ioremap_*() call variants, if you have no IOMMU we naturally will
+ * default to direct mapping for all of them, you can override these defaults.
+ * If you have an IOMMU you are highly encouraged to provide your own
+ * ioremap variant implementation as there currently is no safe architecture
+ * agnostic default. To avoid possible improper behaviour default asm-generic
+ * ioremap_*() variants all return NULL when an IOMMU is available. If you've
+ * defined your own ioremap_*() variant you must then declare your own
+ * ioremap_*() variant as defined to itself to avoid the default NULL return.
+ */
+
+#ifdef CONFIG_MMU
+
+#ifndef ioremap_uc
+#define ioremap_uc ioremap_uc
+static inline void __iomem *ioremap_uc(phys_addr_t offset, size_t size)
+{
+       return NULL;
+}
+#endif
+
+#else /* !CONFIG_MMU */
+
 /*
  * Change "struct page" to physical address.
  *
@@ -743,7 +772,6 @@ static inline void *phys_to_virt(unsigned long address)
  * you'll need to provide your own definitions.
  */
 
-#ifndef CONFIG_MMU
 #ifndef ioremap
 #define ioremap ioremap
 static inline void __iomem *ioremap(phys_addr_t offset, size_t size)