diff --git a/Documentation/devicetree/bindings/gpu/apple,agx.yaml b/Documentation/devicetree/bindings/gpu/apple,agx.yaml index 7794c0e13b939..1829e74c57287 100644 --- a/Documentation/devicetree/bindings/gpu/apple,agx.yaml +++ b/Documentation/devicetree/bindings/gpu/apple,agx.yaml @@ -25,7 +25,9 @@ properties: - apple,agx-t8140 - apple,agx-t8142 - items: - - const: apple,agx-g17c + - enum: + - apple,agx-g17c + - apple,agx-g17d - const: apple,agx-g17s - items: - const: apple,agx-t8103 @@ -267,12 +269,15 @@ allOf: - if: properties: compatible: - const: apple,agx-g17s + anyOf: + - const: apple,agx-g17s + - contains: + const: apple,agx-g17d then: description: - The M5 Pro GPU uses one MMIO range and two firmware mailbox roles. - Its firmware graph supplies the performance tables, so it has no - operating-point table in the board DT. + The M5 Pro and M5 Ultra GPUs use one MMIO range and two firmware + mailbox roles. Their firmware graph supplies the performance tables, + so they have no operating-point table in the board DT. properties: reg: maxItems: 1 diff --git a/arch/arm64/boot/dts/apple/t6050-j775d-gpu.dtsi b/arch/arm64/boot/dts/apple/t6050-j775d-gpu.dtsi new file mode 100644 index 0000000000000..8b64a03432d96 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-j775d-gpu.dtsi @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * J775D GPU (G17D), for the boot loader's GPU handoff, as + * t6050-j714s-gpu-panel.dtsi describes the J714s's. Everything here stays + * disabled: the loader checks the ADT and the live GPU firmware state, fills + * the GPU reservations, and only then enables the nodes, the GPU last. A + * loader without the handoff, or one whose checks fail, leaves the GPU off. + * + * Values are from the J775DAP 27.0 ADT (sgx, gfx-asc, gfx1-asc, pmgr). Both + * firmware roles, their mailboxes and the GPU node are die 0's, with the + * addresses and interrupts of a one-die T6050; die 1 adds only its power + * states (t6050-ultra.dtsi). + */ + +/ { + aliases { + /* The loader finds the GPU through this alias */ + gpu = &sgx; + }; + + reserved-memory { + /* Filled and enabled by the loader from the ADT */ + gpu_fw_text: gpu-fw-text { + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + + gpu_fw_data: gpu-fw-data { + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + + uat_ttbs: uat-ttbs { + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + + uat_pagetables: uat-pagetables { + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + + uat_l2_pagetables: uat-l2-pagetables { + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + + uat_handoff: uat-handoff { + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + }; +}; + +/* The inventory ASC nodes; the mailboxes below describe the same windows. */ +/delete-node/ &gfx_asc; +/delete-node/ &gfx1_asc; + +&{/soc} { + /* + * ADT gfx-asc and gfx1-asc at their physical windows: the wrapper, the + * 8-byte iop-vbar, and their second and third interrupts (send-empty, + * recv-not-empty), as T8140/T8142. + */ + gfx_mbox: mailbox@2302600000 { + compatible = "apple,t6050-j775d-ascwrap-v6"; + reg = <0x23 0x2600000 0x0 0x88000>, + <0x23 0x2050000 0x0 0x8>; + reg-names = "wrapper", "iop-vbar"; + interrupts = , + ; + interrupt-names = "send-empty", "recv-not-empty"; + apple,firmware-role = "GFX"; + power-domains = <&ps_gfx>; + #mbox-cells = <0>; + status = "disabled"; + }; + + gfx1_mbox: mailbox@2302e00000 { + compatible = "apple,t6050-j775d-ascwrap-v6"; + reg = <0x23 0x2e00000 0x0 0x88000>, + <0x23 0x2850000 0x0 0x8>; + reg-names = "wrapper", "iop-vbar"; + interrupts = , + ; + interrupt-names = "send-empty", "recv-not-empty"; + apple,firmware-role = "GFX1"; + power-domains = <&ps_gfx>; + #mbox-cells = <0>; + status = "disabled"; + }; +}; + +/* The ADT marks GPX and AFR, GFX's parents, critical. */ +&ps_gpx { + apple,always-on; +}; + +&ps_afr { + apple,always-on; +}; + +&sgx { + compatible = "apple,agx-g17d", "apple,agx-g17s"; + /* ADT sgx reg[0]; the driver maps the first 16 MiB as "sgx" */ + reg = <0x23 0x0 0x0 0x3fdc000>; + reg-names = "sgx"; + /delete-property/ interrupts; + mboxes = <&gfx_mbox>, <&gfx1_mbox>; + memory-region = <&uat_ttbs>, <&uat_pagetables>, <&uat_handoff>, + <&gpu_fw_data>, <&uat_l2_pagetables>, <&gpu_fw_text>; + memory-region-names = "ttbs", "pagetables", "handoff", "fw-data", + "l2-pagetables", "fw-text"; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-j775d.dts b/arch/arm64/boot/dts/apple/t6050-j775d.dts index 68b4c324aca02..f3c9aa834e90a 100644 --- a/arch/arm64/boot/dts/apple/t6050-j775d.dts +++ b/arch/arm64/boot/dts/apple/t6050-j775d.dts @@ -696,3 +696,5 @@ #define T6050_J775D #include "t6050-peripherals.dtsi" + +#include "t6050-j775d-gpu.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-ultra.dtsi b/arch/arm64/boot/dts/apple/t6050-ultra.dtsi index 90bf4bb29be0e..eefdfdbdc5dee 100644 --- a/arch/arm64/boot/dts/apple/t6050-ultra.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-ultra.dtsi @@ -57,6 +57,168 @@ T6050_P_CPU(cpu32, 11202, cpufreq_pc_die1); T6050_P_CPU(cpu33, 11203, cpufreq_pc_die1); T6050_P_CPU(cpu34, 11204, cpufreq_pc_die1); + + /* + * The clusters are MPIDR Aff1 (die 0's M0, M1 and P, then die 1's), each with its + * own L2. They are listed flat, as on the other two-die parts. The boot loader + * prunes the entries of cores it did not start. + */ + cpu-map { + cluster0 { + core0 { + cpu = <&cpu0>; + }; + core1 { + cpu = <&cpu1>; + }; + core2 { + cpu = <&cpu2>; + }; + core3 { + cpu = <&cpu3>; + }; + core4 { + cpu = <&cpu4>; + }; + }; + + cluster1 { + core0 { + cpu = <&cpu6>; + }; + core1 { + cpu = <&cpu7>; + }; + core2 { + cpu = <&cpu8>; + }; + core3 { + cpu = <&cpu9>; + }; + core4 { + cpu = <&cpu10>; + }; + }; + + cluster2 { + core0 { + cpu = <&cpu12>; + }; + core1 { + cpu = <&cpu13>; + }; + core2 { + cpu = <&cpu14>; + }; + core3 { + cpu = <&cpu15>; + }; + core4 { + cpu = <&cpu16>; + }; + }; + + cluster3 { + core0 { + cpu = <&cpu18>; + }; + core1 { + cpu = <&cpu19>; + }; + core2 { + cpu = <&cpu20>; + }; + core3 { + cpu = <&cpu21>; + }; + core4 { + cpu = <&cpu22>; + }; + }; + + cluster4 { + core0 { + cpu = <&cpu24>; + }; + core1 { + cpu = <&cpu25>; + }; + core2 { + cpu = <&cpu26>; + }; + core3 { + cpu = <&cpu27>; + }; + core4 { + cpu = <&cpu28>; + }; + }; + + cluster5 { + core0 { + cpu = <&cpu30>; + }; + core1 { + cpu = <&cpu31>; + }; + core2 { + cpu = <&cpu32>; + }; + core3 { + cpu = <&cpu33>; + }; + core4 { + cpu = <&cpu34>; + }; + }; + }; + + /* + * One L2 per cluster: the ADT gives each CPU an l2-cache-size of 8 MiB in the M + * clusters and 16 MiB in the P clusters. It gives no L1 sizes and no L2 geometry, + * so the nodes carry the level and the size only. + */ + l2_cache_0: l2-cache-0 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x800000>; + }; + + l2_cache_1: l2-cache-1 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x800000>; + }; + + l2_cache_2: l2-cache-2 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x1000000>; + }; + + l2_cache_3: l2-cache-3 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x800000>; + }; + + l2_cache_4: l2-cache-4 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x800000>; + }; + + l2_cache_5: l2-cache-5 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x1000000>; + }; }; /* Die 1 MMIO. The boot loader needs each die's bus. */ @@ -69,6 +231,127 @@ }; }; +/* Each CPU's next-level cache is its cluster's L2 (cluster N, l2_cache_N). */ +&cpu0 { + next-level-cache = <&l2_cache_0>; +}; + +&cpu1 { + next-level-cache = <&l2_cache_0>; +}; + +&cpu2 { + next-level-cache = <&l2_cache_0>; +}; + +&cpu3 { + next-level-cache = <&l2_cache_0>; +}; + +&cpu4 { + next-level-cache = <&l2_cache_0>; +}; + +&cpu6 { + next-level-cache = <&l2_cache_1>; +}; + +&cpu7 { + next-level-cache = <&l2_cache_1>; +}; + +&cpu8 { + next-level-cache = <&l2_cache_1>; +}; + +&cpu9 { + next-level-cache = <&l2_cache_1>; +}; + +&cpu10 { + next-level-cache = <&l2_cache_1>; +}; + +&cpu12 { + next-level-cache = <&l2_cache_2>; +}; + +&cpu13 { + next-level-cache = <&l2_cache_2>; +}; + +&cpu14 { + next-level-cache = <&l2_cache_2>; +}; + +&cpu15 { + next-level-cache = <&l2_cache_2>; +}; + +&cpu16 { + next-level-cache = <&l2_cache_2>; +}; + +&cpu18 { + next-level-cache = <&l2_cache_3>; +}; + +&cpu19 { + next-level-cache = <&l2_cache_3>; +}; + +&cpu20 { + next-level-cache = <&l2_cache_3>; +}; + +&cpu21 { + next-level-cache = <&l2_cache_3>; +}; + +&cpu22 { + next-level-cache = <&l2_cache_3>; +}; + +&cpu24 { + next-level-cache = <&l2_cache_4>; +}; + +&cpu25 { + next-level-cache = <&l2_cache_4>; +}; + +&cpu26 { + next-level-cache = <&l2_cache_4>; +}; + +&cpu27 { + next-level-cache = <&l2_cache_4>; +}; + +&cpu28 { + next-level-cache = <&l2_cache_4>; +}; + +&cpu30 { + next-level-cache = <&l2_cache_5>; +}; + +&cpu31 { + next-level-cache = <&l2_cache_5>; +}; + +&cpu32 { + next-level-cache = <&l2_cache_5>; +}; + +&cpu33 { + next-level-cache = <&l2_cache_5>; +}; + +&cpu34 { + next-level-cache = <&l2_cache_5>; +}; + #define DIE #define DIE_NO 0 #define DIE_UNIT_PREFIX