- vexpress platform clocks initialisation moved earlier following the

arm64 move of of_clk_init() call in a previous commit
 - Default DMA ops changed to non-coherent to preserve compatibility with
   32-bit ARM DT files. The "dma-coherent" property can be used to
   explicitly mark a device coherent. The Applied Micro DT file has been
   updated to avoid DMA cache maintenance for the X-Gene SATA controller
   (the only arm64 related driver with such assumption in -rc mainline)
 - Fixmap correction for earlyprintk
 - kern_addr_valid() fix for huge pages
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (GNU/Linux)
 
 iQIcBAABAgAGBQJTZhiPAAoJEGvWsS0AyF7xGBUQAIthlCZGjq3yFh+P3YbZBbfh
 8HEg3xQIEunaUTMLxrZ9c32rHdOwWMivmaStb7XfIzYc6XIGGnFwk0VFnxlBtOS/
 yOw6khNy3d5b+R2yVVXJdOwGDvUJ7ZlZ4G35RbpFXqmHVOiT2JP5Pv/8hp/Ct3UE
 eBoLjLYkvrnBgZyjBafTjc+ExjtViMdACNUCZ+fPfvWVF2pWesB72P9/+QT4DZ4Q
 g+QXmtTviysFJPzi2LqVukPL5HzxrOcJql9F0lPEdCVypRHDQtNZfMf7aftZVRue
 8z6IaqgwQuOkHko50RFcrPF1AbEnQWbbA//Mfm1YaJLtlaUwgEXS8jryP4MVGM/s
 wjJD42tY80ysTFFiWjlqYx6wumtSjkZzLQIo7K+MjvleGaciRMsM5u2OyQJ6o8sR
 GMLButOfZj1GOFPE56Xn6R27MzONS1eiCFR99dsnPPwNlqGuY7KEacAHGYRfEe75
 g0Qwzj1sM6d+RHQKidWFRvvMQg5bxAENt1rpFJJ1cCge/jL2QqgbPhVPzMCM4nrW
 xGQzSKO+5L1CLtH4gRd7Jdyg7tUrRBFzC8HXk/o6moO+lOebKzCpq4tNiW/MOwPG
 sGCzmr2TpN6ImEjOhjYUByqa+XGUsz1n7d53Itkz8+pxsXhYHvd8iC1hOpNwakVM
 h/0rfXwD782k1N3S++MH
 =kRLA
 -----END PGP SIGNATURE-----

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Catalin Marinas:
 "These are mostly arm64 fixes with an additional arm(64) platform fix
  for the initialisation of vexpress clocks (the latter only affecting
  arm64; the arch/arm64 code is SoC agnostic and does not rely on early
  SoC-specific calls)

   - vexpress platform clocks initialisation moved earlier following the
     arm64 move of of_clk_init() call in a previous commit
   - Default DMA ops changed to non-coherent to preserve compatibility
     with 32-bit ARM DT files.  The "dma-coherent" property can be used
     to explicitly mark a device coherent.  The Applied Micro DT file
     has been updated to avoid DMA cache maintenance for the X-Gene SATA
     controller (the only arm64 related driver with such assumption in
     -rc mainline)
   - Fixmap correction for earlyprintk
   - kern_addr_valid() fix for huge pages"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  vexpress: Initialise the sysregs before setting up the clocks
  arm64: Mark the Applied Micro X-Gene SATA controller as DMA coherent
  arm64: Use bus notifiers to set per-device coherent DMA ops
  arm64: Make default dma_ops to be noncoherent
  arm64: fixmap: fix missing sub-page offset for earlyprintk
  arm64: Fix for the arm64 kern_addr_valid() function
This commit is contained in:
Linus Torvalds 2014-05-04 14:34:50 -07:00
commit 8a9f5ecd48
8 changed files with 50 additions and 7 deletions

View File

@ -24,6 +24,7 @@ Required properties:
* "sata-phy" for the SATA 6.0Gbps PHY * "sata-phy" for the SATA 6.0Gbps PHY
Optional properties: Optional properties:
- dma-coherent : Present if dma operations are coherent
- status : Shall be "ok" if enabled or "disabled" if disabled. - status : Shall be "ok" if enabled or "disabled" if disabled.
Default is "ok". Default is "ok".
@ -55,6 +56,7 @@ Example:
<0x0 0x1f22e000 0x0 0x1000>, <0x0 0x1f22e000 0x0 0x1000>,
<0x0 0x1f227000 0x0 0x1000>; <0x0 0x1f227000 0x0 0x1000>;
interrupts = <0x0 0x87 0x4>; interrupts = <0x0 0x87 0x4>;
dma-coherent;
status = "ok"; status = "ok";
clocks = <&sataclk 0>; clocks = <&sataclk 0>;
phys = <&phy2 0>; phys = <&phy2 0>;
@ -69,6 +71,7 @@ Example:
<0x0 0x1f23e000 0x0 0x1000>, <0x0 0x1f23e000 0x0 0x1000>,
<0x0 0x1f237000 0x0 0x1000>; <0x0 0x1f237000 0x0 0x1000>;
interrupts = <0x0 0x88 0x4>; interrupts = <0x0 0x88 0x4>;
dma-coherent;
status = "ok"; status = "ok";
clocks = <&sataclk 0>; clocks = <&sataclk 0>;
phys = <&phy3 0>; phys = <&phy3 0>;

View File

@ -307,6 +307,7 @@
<0x0 0x1f21e000 0x0 0x1000>, <0x0 0x1f21e000 0x0 0x1000>,
<0x0 0x1f217000 0x0 0x1000>; <0x0 0x1f217000 0x0 0x1000>;
interrupts = <0x0 0x86 0x4>; interrupts = <0x0 0x86 0x4>;
dma-coherent;
status = "disabled"; status = "disabled";
clocks = <&sata01clk 0>; clocks = <&sata01clk 0>;
phys = <&phy1 0>; phys = <&phy1 0>;
@ -321,6 +322,7 @@
<0x0 0x1f22e000 0x0 0x1000>, <0x0 0x1f22e000 0x0 0x1000>,
<0x0 0x1f227000 0x0 0x1000>; <0x0 0x1f227000 0x0 0x1000>;
interrupts = <0x0 0x87 0x4>; interrupts = <0x0 0x87 0x4>;
dma-coherent;
status = "ok"; status = "ok";
clocks = <&sata23clk 0>; clocks = <&sata23clk 0>;
phys = <&phy2 0>; phys = <&phy2 0>;
@ -334,6 +336,7 @@
<0x0 0x1f23d000 0x0 0x1000>, <0x0 0x1f23d000 0x0 0x1000>,
<0x0 0x1f23e000 0x0 0x1000>; <0x0 0x1f23e000 0x0 0x1000>;
interrupts = <0x0 0x88 0x4>; interrupts = <0x0 0x88 0x4>;
dma-coherent;
status = "ok"; status = "ok";
clocks = <&sata45clk 0>; clocks = <&sata45clk 0>;
phys = <&phy3 0>; phys = <&phy3 0>;

View File

@ -143,10 +143,8 @@ static int __init setup_early_printk(char *buf)
} }
/* no options parsing yet */ /* no options parsing yet */
if (paddr) { if (paddr)
set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr); early_base = (void __iomem *)set_fixmap_offset_io(FIX_EARLYCON_MEM_BASE, paddr);
early_base = (void __iomem *)fix_to_virt(FIX_EARLYCON_MEM_BASE);
}
printch = match->printch; printch = match->printch;
early_console = &early_console_dev; early_console = &early_console_dev;

View File

@ -396,7 +396,7 @@ static int __init arm64_device_init(void)
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
return 0; return 0;
} }
arch_initcall(arm64_device_init); arch_initcall_sync(arm64_device_init);
static DEFINE_PER_CPU(struct cpu, cpu_data); static DEFINE_PER_CPU(struct cpu, cpu_data);

View File

@ -22,8 +22,11 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/dma-contiguous.h> #include <linux/dma-contiguous.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/swiotlb.h> #include <linux/swiotlb.h>
#include <linux/amba/bus.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
@ -305,17 +308,45 @@ struct dma_map_ops coherent_swiotlb_dma_ops = {
}; };
EXPORT_SYMBOL(coherent_swiotlb_dma_ops); EXPORT_SYMBOL(coherent_swiotlb_dma_ops);
static int dma_bus_notifier(struct notifier_block *nb,
unsigned long event, void *_dev)
{
struct device *dev = _dev;
if (event != BUS_NOTIFY_ADD_DEVICE)
return NOTIFY_DONE;
if (of_property_read_bool(dev->of_node, "dma-coherent"))
set_dma_ops(dev, &coherent_swiotlb_dma_ops);
return NOTIFY_OK;
}
static struct notifier_block platform_bus_nb = {
.notifier_call = dma_bus_notifier,
};
static struct notifier_block amba_bus_nb = {
.notifier_call = dma_bus_notifier,
};
extern int swiotlb_late_init_with_default_size(size_t default_size); extern int swiotlb_late_init_with_default_size(size_t default_size);
static int __init swiotlb_late_init(void) static int __init swiotlb_late_init(void)
{ {
size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT); size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT);
dma_ops = &coherent_swiotlb_dma_ops; /*
* These must be registered before of_platform_populate().
*/
bus_register_notifier(&platform_bus_type, &platform_bus_nb);
bus_register_notifier(&amba_bustype, &amba_bus_nb);
dma_ops = &noncoherent_swiotlb_dma_ops;
return swiotlb_late_init_with_default_size(swiotlb_size); return swiotlb_late_init_with_default_size(swiotlb_size);
} }
subsys_initcall(swiotlb_late_init); arch_initcall(swiotlb_late_init);
#define PREALLOC_DMA_DEBUG_ENTRIES 4096 #define PREALLOC_DMA_DEBUG_ENTRIES 4096

View File

@ -374,6 +374,9 @@ int kern_addr_valid(unsigned long addr)
if (pmd_none(*pmd)) if (pmd_none(*pmd))
return 0; return 0;
if (pmd_sect(*pmd))
return pfn_valid(pmd_pfn(*pmd));
pte = pte_offset_kernel(pmd, addr); pte = pte_offset_kernel(pmd, addr);
if (pte_none(*pte)) if (pte_none(*pte))
return 0; return 0;

View File

@ -100,6 +100,8 @@ void __init vexpress_osc_of_setup(struct device_node *node)
struct clk *clk; struct clk *clk;
u32 range[2]; u32 range[2];
vexpress_sysreg_of_early_init();
osc = kzalloc(sizeof(*osc), GFP_KERNEL); osc = kzalloc(sizeof(*osc), GFP_KERNEL);
if (!osc) if (!osc)
return; return;

View File

@ -93,5 +93,8 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
#define set_fixmap_io(idx, phys) \ #define set_fixmap_io(idx, phys) \
__set_fixmap(idx, phys, FIXMAP_PAGE_IO) __set_fixmap(idx, phys, FIXMAP_PAGE_IO)
#define set_fixmap_offset_io(idx, phys) \
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_IO)
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __ASM_GENERIC_FIXMAP_H */ #endif /* __ASM_GENERIC_FIXMAP_H */