aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/include/asm/device.h1
-rw-r--r--arch/arm64/include/asm/dma-mapping.h7
-rw-r--r--arch/arm64/include/asm/xen/page-coherent.h44
-rw-r--r--arch/arm64/kernel/psci.c4
4 files changed, 11 insertions, 45 deletions
diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h
index cf98b362094b..243ef256b8c9 100644
--- a/arch/arm64/include/asm/device.h
+++ b/arch/arm64/include/asm/device.h
@@ -21,6 +21,7 @@ struct dev_archdata {
21#ifdef CONFIG_IOMMU_API 21#ifdef CONFIG_IOMMU_API
22 void *iommu; /* private IOMMU data */ 22 void *iommu; /* private IOMMU data */
23#endif 23#endif
24 bool dma_coherent;
24}; 25};
25 26
26struct pdev_archdata { 27struct pdev_archdata {
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index adeae3f6f0fc..d34189bceff7 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -54,11 +54,18 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
54 54
55static inline int set_arch_dma_coherent_ops(struct device *dev) 55static inline int set_arch_dma_coherent_ops(struct device *dev)
56{ 56{
57 dev->archdata.dma_coherent = true;
57 set_dma_ops(dev, &coherent_swiotlb_dma_ops); 58 set_dma_ops(dev, &coherent_swiotlb_dma_ops);
58 return 0; 59 return 0;
59} 60}
60#define set_arch_dma_coherent_ops set_arch_dma_coherent_ops 61#define set_arch_dma_coherent_ops set_arch_dma_coherent_ops
61 62
63/* do not use this function in a driver */
64static inline bool is_device_dma_coherent(struct device *dev)
65{
66 return dev->archdata.dma_coherent;
67}
68
62#include <asm-generic/dma-mapping-common.h> 69#include <asm-generic/dma-mapping-common.h>
63 70
64static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 71static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
diff --git a/arch/arm64/include/asm/xen/page-coherent.h b/arch/arm64/include/asm/xen/page-coherent.h
index dde3fc9c49f0..2052102b4e02 100644
--- a/arch/arm64/include/asm/xen/page-coherent.h
+++ b/arch/arm64/include/asm/xen/page-coherent.h
@@ -1,43 +1 @@
1#ifndef _ASM_ARM64_XEN_PAGE_COHERENT_H #include <../../arm/include/asm/xen/page-coherent.h>
2#define _ASM_ARM64_XEN_PAGE_COHERENT_H
3
4#include <asm/page.h>
5#include <linux/dma-attrs.h>
6#include <linux/dma-mapping.h>
7
8static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
9 dma_addr_t *dma_handle, gfp_t flags,
10 struct dma_attrs *attrs)
11{
12 return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
13}
14
15static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
16 void *cpu_addr, dma_addr_t dma_handle,
17 struct dma_attrs *attrs)
18{
19 __generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
20}
21
22static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
23 unsigned long offset, size_t size, enum dma_data_direction dir,
24 struct dma_attrs *attrs)
25{
26}
27
28static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
29 size_t size, enum dma_data_direction dir,
30 struct dma_attrs *attrs)
31{
32}
33
34static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
35 dma_addr_t handle, size_t size, enum dma_data_direction dir)
36{
37}
38
39static inline void xen_dma_sync_single_for_device(struct device *hwdev,
40 dma_addr_t handle, size_t size, enum dma_data_direction dir)
41{
42}
43#endif /* _ASM_ARM64_XEN_PAGE_COHERENT_H */
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 663da771580a..3425f311c49e 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -511,7 +511,7 @@ static int cpu_psci_cpu_kill(unsigned int cpu)
511 511
512static int psci_suspend_finisher(unsigned long index) 512static int psci_suspend_finisher(unsigned long index)
513{ 513{
514 struct psci_power_state *state = __get_cpu_var(psci_power_state); 514 struct psci_power_state *state = __this_cpu_read(psci_power_state);
515 515
516 return psci_ops.cpu_suspend(state[index - 1], 516 return psci_ops.cpu_suspend(state[index - 1],
517 virt_to_phys(cpu_resume)); 517 virt_to_phys(cpu_resume));
@@ -520,7 +520,7 @@ static int psci_suspend_finisher(unsigned long index)
520static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index) 520static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index)
521{ 521{
522 int ret; 522 int ret;
523 struct psci_power_state *state = __get_cpu_var(psci_power_state); 523 struct psci_power_state *state = __this_cpu_read(psci_power_state);
524 /* 524 /*
525 * idle state index 0 corresponds to wfi, should never be called 525 * idle state index 0 corresponds to wfi, should never be called
526 * from the cpu_suspend operations 526 * from the cpu_suspend operations