Skip to content

Commit 1636f57

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rmk/linux
Pull ARM updates from Russell King: - clean up TTBCR magic numbers and use u32 for this register - fix clang issue in VFP code leading to kernel oops, caused by compiler instruction scheduling. - switch 32-bit Arm to use GENERIC_CPU_DEVICES and use the arch_cpu_is_hotpluggable() hook. - pass struct device to arm_iommu_create_mapping() and move over to use iommu_paging_domain_alloc() rather than iommu_domain_alloc() - make amba_bustype constant * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rmk/linux: ARM: 9418/1: dma-mapping: Use iommu_paging_domain_alloc() ARM: 9417/1: dma-mapping: Pass device to arm_iommu_create_mapping() ARM: 9416/1: amba: make amba_bustype constant ARM: 9412/1: Convert to arch_cpu_is_hotpluggable() ARM: 9411/1: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu() ARM: 9410/1: vfp: Use asm volatile in fmrx/fmxr macros ARM: 9409/1: mmu: Do not use magic number for TTBCR settings
2 parents 85ffc6e + 61a3fc7 commit 1636f57

File tree

14 files changed

+52
-51
lines changed

14 files changed

+52
-51
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ config ARM
6464
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
6565
select GENERIC_IRQ_IPI if SMP
6666
select GENERIC_CPU_AUTOPROBE
67+
select GENERIC_CPU_DEVICES
6768
select GENERIC_EARLY_IOREMAP
6869
select GENERIC_IDLE_POLL_SETUP
6970
select GENERIC_IRQ_MULTI_HANDLER

arch/arm/include/asm/cpu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/cpu.h>
1212

1313
struct cpuinfo_arm {
14-
struct cpu cpu;
1514
u32 cpuid;
1615
#ifdef CONFIG_SMP
1716
unsigned int loops_per_jiffy;

arch/arm/include/asm/dma-iommu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct dma_iommu_mapping {
2424
};
2525

2626
struct dma_iommu_mapping *
27-
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size);
27+
arm_iommu_create_mapping(struct device *dev, dma_addr_t base, u64 size);
2828

2929
void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
3030

arch/arm/include/asm/pgtable-3level-hwdef.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@
106106

107107
/*
108108
* TTBCR register bits.
109+
*
110+
* The ORGN0 and IRGN0 bits enables different forms of caching when
111+
* walking the translation table. Clearing these bits (which is claimed
112+
* to be the reset default) means "normal memory, [outer|inner]
113+
* non-cacheable"
109114
*/
110115
#define TTBCR_EAE (1 << 31)
111116
#define TTBCR_IMP (1 << 30)

arch/arm/kernel/setup.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,20 +1201,10 @@ void __init setup_arch(char **cmdline_p)
12011201
mdesc->init_early();
12021202
}
12031203

1204-
1205-
static int __init topology_init(void)
1204+
bool arch_cpu_is_hotpluggable(int num)
12061205
{
1207-
int cpu;
1208-
1209-
for_each_possible_cpu(cpu) {
1210-
struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu);
1211-
cpuinfo->cpu.hotpluggable = platform_can_hotplug_cpu(cpu);
1212-
register_cpu(&cpuinfo->cpu, cpu);
1213-
}
1214-
1215-
return 0;
1206+
return platform_can_hotplug_cpu(num);
12161207
}
1217-
subsys_initcall(topology_init);
12181208

12191209
#ifdef CONFIG_HAVE_PROC_CPU
12201210
static int __init proc_cpu_init(void)

arch/arm/mm/dma-mapping.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ static const struct dma_map_ops iommu_ops = {
15321532

15331533
/**
15341534
* arm_iommu_create_mapping
1535-
* @bus: pointer to the bus holding the client device (for IOMMU calls)
1535+
* @dev: pointer to the client device (for IOMMU calls)
15361536
* @base: start address of the valid IO address space
15371537
* @size: maximum size of the valid IO address space
15381538
*
@@ -1544,7 +1544,7 @@ static const struct dma_map_ops iommu_ops = {
15441544
* arm_iommu_attach_device function.
15451545
*/
15461546
struct dma_iommu_mapping *
1547-
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size)
1547+
arm_iommu_create_mapping(struct device *dev, dma_addr_t base, u64 size)
15481548
{
15491549
unsigned int bits = size >> PAGE_SHIFT;
15501550
unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long);
@@ -1585,9 +1585,11 @@ arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size)
15851585

15861586
spin_lock_init(&mapping->lock);
15871587

1588-
mapping->domain = iommu_domain_alloc(bus);
1589-
if (!mapping->domain)
1588+
mapping->domain = iommu_paging_domain_alloc(dev);
1589+
if (IS_ERR(mapping->domain)) {
1590+
err = PTR_ERR(mapping->domain);
15901591
goto err4;
1592+
}
15911593

15921594
kref_init(&mapping->kref);
15931595
return mapping;
@@ -1718,7 +1720,7 @@ static void arm_setup_iommu_dma_ops(struct device *dev)
17181720
dma_base = dma_range_map_min(dev->dma_range_map);
17191721
size = dma_range_map_max(dev->dma_range_map) - dma_base;
17201722
}
1721-
mapping = arm_iommu_create_mapping(dev->bus, dma_base, size);
1723+
mapping = arm_iommu_create_mapping(dev, dma_base, size);
17221724
if (IS_ERR(mapping)) {
17231725
pr_warn("Failed to create %llu-byte IOMMU mapping for device %s\n",
17241726
size, dev_name(dev));

arch/arm/mm/mmu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ static void __init early_paging_init(const struct machine_desc *mdesc)
16381638
{
16391639
pgtables_remap *lpae_pgtables_remap;
16401640
unsigned long pa_pgd;
1641-
unsigned int cr, ttbcr;
1641+
u32 cr, ttbcr, tmp;
16421642
long long offset;
16431643

16441644
if (!mdesc->pv_fixup)
@@ -1688,7 +1688,9 @@ static void __init early_paging_init(const struct machine_desc *mdesc)
16881688
cr = get_cr();
16891689
set_cr(cr & ~(CR_I | CR_C));
16901690
ttbcr = cpu_get_ttbcr();
1691-
cpu_set_ttbcr(ttbcr & ~(3 << 8 | 3 << 10));
1691+
/* Disable all kind of caching of the translation table */
1692+
tmp = ttbcr & ~(TTBCR_ORGN0_MASK | TTBCR_IRGN0_MASK);
1693+
cpu_set_ttbcr(tmp);
16921694
flush_cache_all();
16931695

16941696
/*

arch/arm/vfp/vfpinstr.h

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,37 @@
6464

6565
#ifdef CONFIG_AS_VFP_VMRS_FPINST
6666

67-
#define fmrx(_vfp_) ({ \
68-
u32 __v; \
69-
asm(".fpu vfpv2\n" \
70-
"vmrs %0, " #_vfp_ \
71-
: "=r" (__v) : : "cc"); \
72-
__v; \
73-
})
74-
75-
#define fmxr(_vfp_,_var_) \
76-
asm(".fpu vfpv2\n" \
77-
"vmsr " #_vfp_ ", %0" \
78-
: : "r" (_var_) : "cc")
67+
#define fmrx(_vfp_) ({ \
68+
u32 __v; \
69+
asm volatile (".fpu vfpv2\n" \
70+
"vmrs %0, " #_vfp_ \
71+
: "=r" (__v) : : "cc"); \
72+
__v; \
73+
})
74+
75+
#define fmxr(_vfp_, _var_) ({ \
76+
asm volatile (".fpu vfpv2\n" \
77+
"vmsr " #_vfp_ ", %0" \
78+
: : "r" (_var_) : "cc"); \
79+
})
7980

8081
#else
8182

8283
#define vfpreg(_vfp_) #_vfp_
8384

84-
#define fmrx(_vfp_) ({ \
85-
u32 __v; \
86-
asm("mrc p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmrx %0, " #_vfp_ \
87-
: "=r" (__v) : : "cc"); \
88-
__v; \
89-
})
90-
91-
#define fmxr(_vfp_,_var_) \
92-
asm("mcr p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmxr " #_vfp_ ", %0" \
93-
: : "r" (_var_) : "cc")
85+
#define fmrx(_vfp_) ({ \
86+
u32 __v; \
87+
asm volatile ("mrc p10, 7, %0, " vfpreg(_vfp_) "," \
88+
"cr0, 0 @ fmrx %0, " #_vfp_ \
89+
: "=r" (__v) : : "cc"); \
90+
__v; \
91+
})
92+
93+
#define fmxr(_vfp_, _var_) ({ \
94+
asm volatile ("mcr p10, 7, %0, " vfpreg(_vfp_) "," \
95+
"cr0, 0 @ fmxr " #_vfp_ ", %0" \
96+
: : "r" (_var_) : "cc"); \
97+
})
9498

9599
#endif
96100

drivers/amba/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static const struct dev_pm_ops amba_pm = {
435435
* DMA configuration for platform and AMBA bus is same. So here we reuse
436436
* platform's DMA config routine.
437437
*/
438-
struct bus_type amba_bustype = {
438+
const struct bus_type amba_bustype = {
439439
.name = "amba",
440440
.dev_groups = amba_dev_groups,
441441
.match = amba_match,

drivers/gpu/drm/exynos/exynos_drm_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
110110
void *mapping = NULL;
111111

112112
if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
113-
mapping = arm_iommu_create_mapping(&platform_bus_type,
113+
mapping = arm_iommu_create_mapping(dev,
114114
EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
115115
else if (IS_ENABLED(CONFIG_IOMMU_DMA))
116116
mapping = iommu_get_domain_for_dev(priv->dma_dev);

0 commit comments

Comments
 (0)