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
7 changes: 7 additions & 0 deletions arch/arm64/boot/dts/apple/t8011-pmgr.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,19 @@
apple,always-on; /* Core device */
};

/*
* DWI carries the voltage manager's requests to the PMIC: with it
* off the GPU rail never comes up and the first RGX access hangs the
* bus. iBoot and iPadOS keep it on; the boot chain can hand it over
* off, so this turns it on at probe.
*/
ps_dwi: power-controller@80110 {
compatible = "apple,t8010-pmgr-pwrstate", "apple,pmgr-pwrstate";
reg = <0x80110 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
label = "dwi";
apple,always-on;
};

ps_gpio: power-controller@80118 {
Expand Down
46 changes: 46 additions & 0 deletions arch/arm64/boot/dts/apple/t8011.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#address-cells = <2>;
#size-cells = <2>;

aliases {
gpu = &gpu; /* the bootloader fills its OPP table */
};

nco_clkref: clock-ref-nco {
compatible = "fixed-clock";
#clock-cells = <0>;
Expand Down Expand Up @@ -149,6 +153,16 @@
#endif
};

/*
* The GPU's performance states. The bootloader (m1n1) fills one entry
* per powered state from the Apple device tree's sgx node: opp-hz,
* opp-microvolt and opp-level, the state number the GPU's power
* controller takes. The table stays empty without it.
*/
gpu_opp: opp-table-gpu {
compatible = "operating-points-v2";
};

soc {
compatible = "simple-bus";
#address-cells = <2>;
Expand Down Expand Up @@ -337,6 +351,38 @@
status = "disabled";
};

/*
* The A10X GPU (G9G): the A10's register windows (ADT sgx and
* gfx-kf: rgx, Fender, IOP at the same addresses); its own
* firmware (AGXFirmwareKextG9GRTBuddy, not the A10's G9P).
*/
gpu: gpu@201000000 {
compatible = "apple,t8011-gpu";
reg = <0x2 0x01000000 0x0 0x100000>,
<0x2 0x01d00000 0x0 0x5000>,
<0x2 0x01d20000 0x0 0x4000>;
reg-names = "rgx", "fender", "iop";
mboxes = <&gpu_mbox>;
power-domains = <&ps_gfx>;
operating-points-v2 = <&gpu_opp>;
firmware-name = "apple/gfx-t8011.bin";
};

/* ADT gfx-kf interrupts 186, 185, 188, 187: the A10's minus 4 */
gpu_mbox: mbox@201d24000 {
compatible = "apple,t8010-a7iop-mailbox";
reg = <0x2 0x01d24000 0x0 0x1000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 185 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 186 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 187 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 188 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "send-empty", "send-not-empty",
"recv-empty", "recv-not-empty";
#mbox-cells = <0>;
power-domains = <&ps_gfx>;
};

/*
* The H9G display pipe. Only its registers are described: the
* boot framebuffer names it so that the boot scanout cadence
Expand Down
16 changes: 14 additions & 2 deletions drivers/gpu/drm/imagination/pvr_apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -2599,9 +2599,21 @@ void pvr_apple_device_info_init(struct pvr_device *pvr_dev)
/*
* The A7 (S5L8960X, BVNC 1.70.4.3) has 4 clusters (CORE_ID); with 6,
* the GPU info reported 2 phantoms and Mesa's Rogue render path, which
* expects one on a 4-cluster core, refused to record a draw.
* expects one on a 4-cluster core, refused to record a draw. The A10X
* (T8011, 13.7.12.2) has 12: Mesa takes three phantoms from that, one
* per pipe of its G9G firmware.
*/
pvr_dev->features.num_clusters = pvr_dev->gpu_id.b == 1 ? 4 : 6;
switch (pvr_gpu_id_to_packed_bvnc(&pvr_dev->gpu_id)) {
case PVR_PACKED_BVNC(1, 70, 4, 3): /* A7 */
pvr_dev->features.num_clusters = 4;
break;
case PVR_PACKED_BVNC(13, 7, 12, 2): /* A10X */
pvr_dev->features.num_clusters = 12;
break;
default:
pvr_dev->features.num_clusters = 6;
break;
}
pvr_dev->features.has_phys_bus_width = true;
pvr_dev->features.phys_bus_width = 40;
pvr_dev->features.has_virtual_address_space_bits = true;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/imagination/pvr_apple.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern const struct pvr_apple_chip pvr_apple_chip_s5l8960x;
extern const struct pvr_apple_chip pvr_apple_chip_s8003;
extern const struct pvr_apple_chip pvr_apple_chip_t7000;
extern const struct pvr_apple_chip pvr_apple_chip_t8010;
extern const struct pvr_apple_chip pvr_apple_chip_t8011;
extern const struct pvr_apple_chip pvr_apple_chip_t8015;

/*
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/imagination/pvr_apple_chip.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ struct pvr_apple {
*/
struct pvr_apple_chip {
const char *fw_name;
/* End of the image and its runtime data in the window; 0: PVR_APPLE_FW_RUNTIME */
u32 fw_runtime;
u32 perf_state_max;
bool fixed_perf_state;
u32 compute_slots;
Expand Down
14 changes: 10 additions & 4 deletions drivers/gpu/drm/imagination/pvr_apple_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <linux/array_size.h>
#include <linux/bug.h>
#include <linux/minmax.h>
#include <linux/printk.h>

#define FW_VA_HEAP 0x00100000u /* heap descriptor 0 */
Expand Down Expand Up @@ -513,18 +514,22 @@ void pvr_apple_layout_write_ta_job(u8 *heap, u32 seq, const struct pvr_apple_ta_
{
u32 base = HEAP_TA_JOBS + ((seq - 1) % JOBS_TA) * JOB_TA_STRIDE;
u32 cmd = base, useq = base + 0x600, sc = base + 0x900, ctx = base + 0xa00;
u32 regs32 = base + 0x700, regs64 = base + 0x800;
u32 regs32 = base + 0x700, regs64 = base + job->regs64_offset;
u32 fl = HEAP_TA_FREE_LIST, slot = HEAP_TA_PM_SLOT;
u32 work = HEAP_TA_RING + ((seq - 1) % RING_ENTRIES) * WORK_ENTRY_SIZE;
u32 i;
u32 i, n;

for (i = base; i < base + JOB_TA_STRIDE; i++)
heap[i] = 0;
for (i = HEAP_TA_FREE_LIST; i < HEAP_TA_PM_HEADER + 0x100; i++)
heap[i] = 0;
for (i = 0; i < 8; i++)
wr32(heap, regs32 + 4 * i, job->regs32[i]);
for (i = 0; i < 28; i++)
/* The 64-bit block sits after the 32-bit one and ends before +0x900 */
n = job->regs64_count;
if (WARN_ON_ONCE(job->regs64_offset < 0x720 || job->regs64_offset + 8 * n > 0x900))
n = 0;
for (i = 0; i < n; i++)
wr64(heap, regs64 + 8 * i, job->regs64[i]);
wr32(heap, sc + TA_CANCEL, 0xffffffff);
wr32(heap, sc + TA_CANCEL + 4, 0xffffffff);
Expand Down Expand Up @@ -651,7 +656,8 @@ void pvr_apple_layout_write_3d_job(u8 *heap, u32 seq, const struct pvr_apple_3d_
heap[i] = 0;
for (i = 0; i < 18; i++)
wr32(heap, cmd + 0x3b0 + 4 * i, job->regs32[i]);
for (i = 0; i < 29; i++)
/* Up to 0x3b0, where the 32-bit block starts */
for (i = 0; i < min_t(u32, job->regs64_count, (0x3b0 - 0x68) / 8); i++)
wr64(heap, cmd + 0x68 + 8 * i, job->regs64[i]);
wr32(heap, sc + F_CANCEL, 0xffffffff);
wr32(heap, sc + F_CANCEL + 4, 0xffffffff);
Expand Down
16 changes: 14 additions & 2 deletions drivers/gpu/drm/imagination/pvr_apple_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ void pvr_apple_layout_build(u8 *win, u64 win_pa, u8 *heap, u64 heap_pa, u64 gpu_
#define PVR_APPLE_GPU_DATA 0x200000ull /* stream at +0, PDS HALT at +0x1000 */
void pvr_apple_layout_write_compute_job(u8 *heap, u32 seq, u64 stream, u64 ctx_state);
/* A geometry (TA) job; see pvr_apple_layout_write_ta_job() */
/*
* The register blocks' largest sizes: the A10X's G9G firmware loads its
* per-cluster registers for 12 clusters and 0xfc0 for three pipes.
*/
#define PVR_APPLE_TA_REGS64_MAX 34
#define PVR_APPLE_3D_REGS64_MAX 42

struct pvr_apple_ta_job {
u32 regs32[8]; /* RGX 0xc78, 0xc88, 0xc98, 0xc18, 0xc08, 0xc10, 0xc20, 0xc28 */
u64 regs64[28]; /* RGX 0xc90 ... 0x408, 0xf058 ... 0xf040, 0x11030 x 6 */
/* RGX 0xc90 ... 0x408, 0xf058 ... 0xf040, 0x11030 per cluster (6 or 12) */
u64 regs64[PVR_APPLE_TA_REGS64_MAX];
u32 regs64_count; /* words StartTA loads: 28 on the A10, 34 on the A10X */
u32 regs64_offset; /* the 64-bit block's place in the job record */
u64 free_list; /* GPU address of the free stack (u32 page numbers) */
u32 free_list_pages;
u64 mlist, mtile_array, vheap_table;
Expand All @@ -41,7 +51,9 @@ u32 pvr_apple_layout_ta_pm_state_offset(void);
/* A fragment (3D) job; see pvr_apple_layout_write_3d_job() */
struct pvr_apple_3d_job {
u32 regs32[18]; /* RGX 0xf18, 0xf80, 0xf88, -, 0x6d0, 0x618 ... 0x11f8 */
u64 regs64[29]; /* RGX 0xfa8 ... 0xf30, 0x11020 x 6, 0x11080 x 6, 0xfd0 */
/* RGX 0xfa8 ... 0xf30, 0x11020 and 0x11080 per cluster, 0xfd0 */
u64 regs64[PVR_APPLE_3D_REGS64_MAX];
u32 regs64_count; /* words Start3D loads: 29 on the A10, 42 on the A10X */
};

void pvr_apple_layout_build_3d(u8 *heap);
Expand Down
Loading
Loading