Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Documentation/devicetree/bindings/display/apple,dcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ properties:
power-domains:
maxItems: 1

dma-noncoherent: true

resets:
maxItems: 1

Expand Down Expand Up @@ -299,6 +301,7 @@ properties:
properties:
iommus:
maxItems: 1
dma-noncoherent: true
memory-region:
minItems: 1
maxItems: 64
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/gpu/apple,agx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ properties:
power-domains:
maxItems: 1

dma-noncoherent: true

mboxes:
minItems: 1
maxItems: 2
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/boot/dts/apple/t6040.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@
display: display-subsystem {
compatible = "apple,display-subsystem";
iommus = <&disp0_dart 0>;
dma-noncoherent;
status = "disabled";
};

Expand Down
5 changes: 5 additions & 0 deletions arch/arm64/boot/dts/apple/t8132-j713-display.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* frontend mappings it adds memory-region and apple,j713-inherited-mappings
* to piodma and display-subsystem and enables them and disp0_dart.
* apple,j713-native-piodma and apple,j713-native-scanout opt in to that.
* The DCP, PIODMA and scanout paths use non-coherent DMA only, so those
* nodes are marked dma-noncoherent.
* The DART driver also reads the ADT through the loader's phram "adt"
* region. Without that handoff the DCP and frontend are refused.
*
Expand Down Expand Up @@ -81,6 +83,7 @@
mbox-names = "mbox";
iommus = <&dcp_dart 23>;
power-domains = <&ps_disp_cpu>;
dma-noncoherent;
apple,j713-native-piodma;
apple,j713-native-scanout;
/* Full 2560x1664 panel including the notch rows, 224 ppi. */
Expand All @@ -91,13 +94,15 @@

disp0_piodma: piodma {
iommus = <&disp0_dart 16>;
dma-noncoherent;
status = "disabled"; /* Enabled by the loader. */
};
};

display: display-subsystem {
compatible = "apple,t8132-display-subsystem", "apple,t8132-display-diagnostics";
iommus = <&disp0_dart 0>;
dma-noncoherent;
status = "disabled"; /* Enabled by the loader. */
};
};
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/boot/dts/apple/t8132-j713-gpu.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
reg-names = "asc", "sgx";
mboxes = <&agx_mbox>;
power-domains = <&ps_gfx>;
/* G16 is admitted on non-coherent DMA only. */
dma-noncoherent;
apple,pmp = <&pmp>;
memory-region = <&gpu_ttbs>, <&gpu_pagetables>, <&gpu_handoff>,
<&gpu_shared_l2>, <&gpu_fw_text>, <&gpu_fw_data>;
Expand Down
12 changes: 9 additions & 3 deletions arch/arm64/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/gfp.h>
#include <linux/cache.h>
#include <linux/dma-map-ops.h>
#include <linux/property.h>
#include <xen/xen.h>

#include <asm/cacheflush.h>
Expand Down Expand Up @@ -42,12 +43,17 @@ void arch_setup_dma_ops(struct device *dev, bool coherent)
{
int cls = cache_line_size_of_cpu();

if (!coherent && !CLIDR_LOC(read_sysreg(clidr_el1))) {
/*
* A device explicitly marked "dma-noncoherent" keeps non-coherent DMA:
* its driver may depend on the non-cacheable attributes of that path.
*/
if (!coherent && !CLIDR_LOC(read_sysreg(clidr_el1)) &&
!device_property_present(dev, "dma-noncoherent")) {
/*
* This holds for every device on the system, so say it once
* This holds for every other device on the system, so say it once
* and keep the per-device line for debugging.
*/
pr_info_once("CLIDR_EL1.LoC == 0, treating all devices as DMA coherent\n");
pr_info_once("CLIDR_EL1.LoC == 0, treating devices not marked dma-noncoherent as DMA coherent\n");
dev_dbg(dev, "CLIDR_EL1.LoC == 0, treating as coherent\n");
coherent = true;
}
Expand Down
Loading