Skip to content

Commit 8a9f5ec

Browse files
committed
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
2 parents e3fb7d4 + e715eb2 commit 8a9f5ec

File tree

8 files changed

+50
-7
lines changed

8 files changed

+50
-7
lines changed

Documentation/devicetree/bindings/ata/apm-xgene.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Required properties:
2424
* "sata-phy" for the SATA 6.0Gbps PHY
2525

2626
Optional properties:
27+
- dma-coherent : Present if dma operations are coherent
2728
- status : Shall be "ok" if enabled or "disabled" if disabled.
2829
Default is "ok".
2930

@@ -55,6 +56,7 @@ Example:
5556
<0x0 0x1f22e000 0x0 0x1000>,
5657
<0x0 0x1f227000 0x0 0x1000>;
5758
interrupts = <0x0 0x87 0x4>;
59+
dma-coherent;
5860
status = "ok";
5961
clocks = <&sataclk 0>;
6062
phys = <&phy2 0>;
@@ -69,6 +71,7 @@ Example:
6971
<0x0 0x1f23e000 0x0 0x1000>,
7072
<0x0 0x1f237000 0x0 0x1000>;
7173
interrupts = <0x0 0x88 0x4>;
74+
dma-coherent;
7275
status = "ok";
7376
clocks = <&sataclk 0>;
7477
phys = <&phy3 0>;

arch/arm64/boot/dts/apm-storm.dtsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@
307307
<0x0 0x1f21e000 0x0 0x1000>,
308308
<0x0 0x1f217000 0x0 0x1000>;
309309
interrupts = <0x0 0x86 0x4>;
310+
dma-coherent;
310311
status = "disabled";
311312
clocks = <&sata01clk 0>;
312313
phys = <&phy1 0>;
@@ -321,6 +322,7 @@
321322
<0x0 0x1f22e000 0x0 0x1000>,
322323
<0x0 0x1f227000 0x0 0x1000>;
323324
interrupts = <0x0 0x87 0x4>;
325+
dma-coherent;
324326
status = "ok";
325327
clocks = <&sata23clk 0>;
326328
phys = <&phy2 0>;
@@ -334,6 +336,7 @@
334336
<0x0 0x1f23d000 0x0 0x1000>,
335337
<0x0 0x1f23e000 0x0 0x1000>;
336338
interrupts = <0x0 0x88 0x4>;
339+
dma-coherent;
337340
status = "ok";
338341
clocks = <&sata45clk 0>;
339342
phys = <&phy3 0>;

arch/arm64/kernel/early_printk.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ static int __init setup_early_printk(char *buf)
143143
}
144144
/* no options parsing yet */
145145

146-
if (paddr) {
147-
set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr);
148-
early_base = (void __iomem *)fix_to_virt(FIX_EARLYCON_MEM_BASE);
149-
}
146+
if (paddr)
147+
early_base = (void __iomem *)set_fixmap_offset_io(FIX_EARLYCON_MEM_BASE, paddr);
150148

151149
printch = match->printch;
152150
early_console = &early_console_dev;

arch/arm64/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ static int __init arm64_device_init(void)
396396
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
397397
return 0;
398398
}
399-
arch_initcall(arm64_device_init);
399+
arch_initcall_sync(arm64_device_init);
400400

401401
static DEFINE_PER_CPU(struct cpu, cpu_data);
402402

arch/arm64/mm/dma-mapping.c

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
#include <linux/slab.h>
2323
#include <linux/dma-mapping.h>
2424
#include <linux/dma-contiguous.h>
25+
#include <linux/of.h>
26+
#include <linux/platform_device.h>
2527
#include <linux/vmalloc.h>
2628
#include <linux/swiotlb.h>
29+
#include <linux/amba/bus.h>
2730

2831
#include <asm/cacheflush.h>
2932

@@ -305,17 +308,45 @@ struct dma_map_ops coherent_swiotlb_dma_ops = {
305308
};
306309
EXPORT_SYMBOL(coherent_swiotlb_dma_ops);
307310

311+
static int dma_bus_notifier(struct notifier_block *nb,
312+
unsigned long event, void *_dev)
313+
{
314+
struct device *dev = _dev;
315+
316+
if (event != BUS_NOTIFY_ADD_DEVICE)
317+
return NOTIFY_DONE;
318+
319+
if (of_property_read_bool(dev->of_node, "dma-coherent"))
320+
set_dma_ops(dev, &coherent_swiotlb_dma_ops);
321+
322+
return NOTIFY_OK;
323+
}
324+
325+
static struct notifier_block platform_bus_nb = {
326+
.notifier_call = dma_bus_notifier,
327+
};
328+
329+
static struct notifier_block amba_bus_nb = {
330+
.notifier_call = dma_bus_notifier,
331+
};
332+
308333
extern int swiotlb_late_init_with_default_size(size_t default_size);
309334

310335
static int __init swiotlb_late_init(void)
311336
{
312337
size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT);
313338

314-
dma_ops = &coherent_swiotlb_dma_ops;
339+
/*
340+
* These must be registered before of_platform_populate().
341+
*/
342+
bus_register_notifier(&platform_bus_type, &platform_bus_nb);
343+
bus_register_notifier(&amba_bustype, &amba_bus_nb);
344+
345+
dma_ops = &noncoherent_swiotlb_dma_ops;
315346

316347
return swiotlb_late_init_with_default_size(swiotlb_size);
317348
}
318-
subsys_initcall(swiotlb_late_init);
349+
arch_initcall(swiotlb_late_init);
319350

320351
#define PREALLOC_DMA_DEBUG_ENTRIES 4096
321352

arch/arm64/mm/mmu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ int kern_addr_valid(unsigned long addr)
374374
if (pmd_none(*pmd))
375375
return 0;
376376

377+
if (pmd_sect(*pmd))
378+
return pfn_valid(pmd_pfn(*pmd));
379+
377380
pte = pte_offset_kernel(pmd, addr);
378381
if (pte_none(*pte))
379382
return 0;

drivers/clk/versatile/clk-vexpress-osc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ void __init vexpress_osc_of_setup(struct device_node *node)
100100
struct clk *clk;
101101
u32 range[2];
102102

103+
vexpress_sysreg_of_early_init();
104+
103105
osc = kzalloc(sizeof(*osc), GFP_KERNEL);
104106
if (!osc)
105107
return;

include/asm-generic/fixmap.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,8 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
9393
#define set_fixmap_io(idx, phys) \
9494
__set_fixmap(idx, phys, FIXMAP_PAGE_IO)
9595

96+
#define set_fixmap_offset_io(idx, phys) \
97+
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_IO)
98+
9699
#endif /* __ASSEMBLY__ */
97100
#endif /* __ASM_GENERIC_FIXMAP_H */

0 commit comments

Comments
 (0)