Skip to content

Commit d7ca2d1

Browse files
committed
Merge tag 'drm-msm-next-2020-01-14' of https://gitlab.freedesktop.org/drm/msm into drm-next
+ sc7180 display + DSI support + a618 (sc7180) support + more UBWC (bandwidth compression) support + various cleanups to handle devices that use vs don't use zap fw, etc + usual random cleanups and fixes Signed-off-by: Dave Airlie <[email protected]> From: Rob Clark <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/ <CAF6AEGvv03ifuP0tp7-dmqZtr1iS=s8Vc=az8BNGtEoSMD-dkw@mail.gmail.com
2 parents 3d47431 + 5f9935f commit d7ca2d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1049
-428
lines changed

Documentation/devicetree/bindings/display/msm/dpu.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The DPU display controller is found in SDM845 SoC.
88

99
MDSS:
1010
Required properties:
11-
- compatible: "qcom,sdm845-mdss"
11+
- compatible: "qcom,sdm845-mdss", "qcom,sc7180-mdss"
1212
- reg: physical base address and length of contoller's registers.
1313
- reg-names: register region names. The following region is required:
1414
* "mdss"
@@ -41,7 +41,7 @@ Optional properties:
4141

4242
MDP:
4343
Required properties:
44-
- compatible: "qcom,sdm845-dpu"
44+
- compatible: "qcom,sdm845-dpu", "qcom,sc7180-dpu"
4545
- reg: physical base address and length of controller's registers.
4646
- reg-names : register region names. The following region is required:
4747
* "mdp"

Documentation/devicetree/bindings/display/msm/gpu.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@ Required properties:
2323
- iommus: optional phandle to an adreno iommu instance
2424
- operating-points-v2: optional phandle to the OPP operating points
2525
- interconnects: optional phandle to an interconnect provider. See
26-
../interconnect/interconnect.txt for details.
26+
../interconnect/interconnect.txt for details. Some A3xx and all A4xx platforms
27+
will have two paths; all others will have one path.
28+
- interconnect-names: The names of the interconnect paths that correspond to the
29+
interconnects property. Values must be gfx-mem and ocmem.
2730
- qcom,gmu: For GMU attached devices a phandle to the GMU device that will
2831
control the power for the GPU. Applicable targets:
2932
- qcom,adreno-630.2
3033
- zap-shader: For a5xx and a6xx devices this node contains a memory-region that
3134
points to reserved memory to store the zap shader that can be used to help
3235
bring the GPU out of secure mode.
36+
- firmware-name: optional property of the 'zap-shader' node, listing the
37+
relative path of the device specific zap firmware.
3338

3439
Example 3xx/4xx/a5xx:
3540

@@ -76,11 +81,13 @@ Example a6xx (with GMU):
7681
operating-points-v2 = <&gpu_opp_table>;
7782

7883
interconnects = <&rsc_hlos MASTER_GFX3D &rsc_hlos SLAVE_EBI1>;
84+
interconnect-names = "gfx-mem";
7985

8086
qcom,gmu = <&gmu>;
8187

8288
zap-shader {
8389
memory-region = <&zap_shader_region>;
90+
firmware-name = "qcom/LENOVO/81JL/qcdxkmsuc850.mbn"
8491
};
8592
};
8693
};

drivers/gpu/drm/msm/adreno/a3xx_gpu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,14 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
506506
goto fail;
507507
}
508508

509+
/*
510+
* Set the ICC path to maximum speed for now by multiplying the fastest
511+
* frequency by the bus width (8). We'll want to scale this later on to
512+
* improve battery life.
513+
*/
514+
icc_set_bw(gpu->icc_path, 0, Bps_to_icc(gpu->fast_rate) * 8);
515+
icc_set_bw(gpu->ocmem_icc_path, 0, Bps_to_icc(gpu->fast_rate) * 8);
516+
509517
return gpu;
510518

511519
fail:

drivers/gpu/drm/msm/adreno/a4xx_gpu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,14 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
591591
goto fail;
592592
}
593593

594+
/*
595+
* Set the ICC path to maximum speed for now by multiplying the fastest
596+
* frequency by the bus width (8). We'll want to scale this later on to
597+
* improve battery life.
598+
*/
599+
icc_set_bw(gpu->icc_path, 0, Bps_to_icc(gpu->fast_rate) * 8);
600+
icc_set_bw(gpu->ocmem_icc_path, 0, Bps_to_icc(gpu->fast_rate) * 8);
601+
594602
return gpu;
595603

596604
fail:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,18 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
753753
gpu->funcs->flush(gpu, gpu->rb[0]);
754754
if (!a5xx_idle(gpu, gpu->rb[0]))
755755
return -EINVAL;
756-
} else {
757-
/* Print a warning so if we die, we know why */
756+
} else if (ret == -ENODEV) {
757+
/*
758+
* This device does not use zap shader (but print a warning
759+
* just in case someone got their dt wrong.. hopefully they
760+
* have a debug UART to realize the error of their ways...
761+
* if you mess this up you are about to crash horribly)
762+
*/
758763
dev_warn_once(gpu->dev->dev,
759764
"Zap shader not enabled - using SECVID_TRUST_CNTL instead\n");
760765
gpu_write(gpu, REG_A5XX_RBBM_SECVID_TRUST_CNTL, 0x0);
766+
} else {
767+
return ret;
761768
}
762769

763770
/* Last step - yield the ringbuffer */

drivers/gpu/drm/msm/adreno/a6xx.xml.h

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ The rules-ng-ng source files this header was generated from are:
1616
- /home/robclark/src/envytools/rnndb/adreno/a3xx.xml ( 83840 bytes, from 2018-07-03 19:37:13)
1717
- /home/robclark/src/envytools/rnndb/adreno/a4xx.xml ( 112086 bytes, from 2018-07-03 19:37:13)
1818
- /home/robclark/src/envytools/rnndb/adreno/a5xx.xml ( 147240 bytes, from 2018-12-02 17:29:54)
19-
- /home/robclark/src/envytools/rnndb/adreno/a6xx.xml ( 140790 bytes, from 2018-12-02 17:29:54)
19+
- /home/smasetty/playarea/envytools/rnndb/adreno/a6xx.xml ( 161969 bytes, from 2019-11-29 07:18:16)
2020
- /home/robclark/src/envytools/rnndb/adreno/a6xx_gmu.xml ( 10431 bytes, from 2018-09-14 13:03:07)
2121
- /home/robclark/src/envytools/rnndb/adreno/ocmem.xml ( 1773 bytes, from 2018-07-03 19:37:13)
2222
23-
Copyright (C) 2013-2018 by the following authors:
23+
Copyright (C) 2013-2019 by the following authors:
2424
- Rob Clark <[email protected]> (robclark)
2525
- Ilia Mirkin <[email protected]> (imirkin)
2626
@@ -2519,6 +2519,54 @@ static inline uint32_t A6XX_VBIF_TEST_BUS2_CTRL1_DATA_SEL(uint32_t val)
25192519

25202520
#define REG_A6XX_VBIF_PERF_PWR_CNT_HIGH2 0x0000311a
25212521

2522+
#define REG_A6XX_GBIF_SCACHE_CNTL1 0x00003c02
2523+
2524+
#define REG_A6XX_GBIF_QSB_SIDE0 0x00003c03
2525+
2526+
#define REG_A6XX_GBIF_QSB_SIDE1 0x00003c04
2527+
2528+
#define REG_A6XX_GBIF_QSB_SIDE2 0x00003c05
2529+
2530+
#define REG_A6XX_GBIF_QSB_SIDE3 0x00003c06
2531+
2532+
#define REG_A6XX_GBIF_HALT 0x00003c45
2533+
2534+
#define REG_A6XX_GBIF_HALT_ACK 0x00003c46
2535+
2536+
#define REG_A6XX_GBIF_PERF_PWR_CNT_EN 0x00003cc0
2537+
2538+
#define REG_A6XX_GBIF_PERF_CNT_SEL 0x00003cc2
2539+
2540+
#define REG_A6XX_GBIF_PERF_PWR_CNT_SEL 0x00003cc3
2541+
2542+
#define REG_A6XX_GBIF_PERF_CNT_LOW0 0x00003cc4
2543+
2544+
#define REG_A6XX_GBIF_PERF_CNT_LOW1 0x00003cc5
2545+
2546+
#define REG_A6XX_GBIF_PERF_CNT_LOW2 0x00003cc6
2547+
2548+
#define REG_A6XX_GBIF_PERF_CNT_LOW3 0x00003cc7
2549+
2550+
#define REG_A6XX_GBIF_PERF_CNT_HIGH0 0x00003cc8
2551+
2552+
#define REG_A6XX_GBIF_PERF_CNT_HIGH1 0x00003cc9
2553+
2554+
#define REG_A6XX_GBIF_PERF_CNT_HIGH2 0x00003cca
2555+
2556+
#define REG_A6XX_GBIF_PERF_CNT_HIGH3 0x00003ccb
2557+
2558+
#define REG_A6XX_GBIF_PWR_CNT_LOW0 0x00003ccc
2559+
2560+
#define REG_A6XX_GBIF_PWR_CNT_LOW1 0x00003ccd
2561+
2562+
#define REG_A6XX_GBIF_PWR_CNT_LOW2 0x00003cce
2563+
2564+
#define REG_A6XX_GBIF_PWR_CNT_HIGH0 0x00003ccf
2565+
2566+
#define REG_A6XX_GBIF_PWR_CNT_HIGH1 0x00003cd0
2567+
2568+
#define REG_A6XX_GBIF_PWR_CNT_HIGH2 0x00003cd1
2569+
25222570
#define REG_A6XX_RB_WINDOW_OFFSET2 0x000088d4
25232571
#define A6XX_RB_WINDOW_OFFSET2_WINDOW_OFFSET_DISABLE 0x80000000
25242572
#define A6XX_RB_WINDOW_OFFSET2_X__MASK 0x00007fff

drivers/gpu/drm/msm/adreno/a6xx_gmu.c

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
/* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. */
2+
/* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. */
33

44
#include <linux/clk.h>
55
#include <linux/interconnect.h>
@@ -149,6 +149,8 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq)
149149
if (freq == gmu->gpu_freqs[perf_index])
150150
break;
151151

152+
gmu->current_perf_index = perf_index;
153+
152154
__a6xx_gmu_set_freq(gmu, perf_index);
153155
}
154156

@@ -433,6 +435,8 @@ static void __iomem *a6xx_gmu_get_mmio(struct platform_device *pdev,
433435

434436
static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
435437
{
438+
struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
439+
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
436440
struct platform_device *pdev = to_platform_device(gmu->dev);
437441
void __iomem *pdcptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc");
438442
void __iomem *seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq");
@@ -480,20 +484,34 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
480484
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_MSGID + 4, 0x10108);
481485
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_ADDR + 4, 0x30000);
482486
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_DATA + 4, 0x0);
487+
483488
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_MSGID + 8, 0x10108);
484-
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_ADDR + 8, 0x30080);
489+
if (adreno_is_a618(adreno_gpu))
490+
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_ADDR + 8, 0x30090);
491+
else
492+
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_ADDR + 8, 0x30080);
485493
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS1_CMD0_DATA + 8, 0x0);
494+
486495
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD_ENABLE_BANK, 7);
487496
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD_WAIT_FOR_CMPL_BANK, 0);
488497
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CONTROL, 0);
489498
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_MSGID, 0x10108);
490499
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR, 0x30010);
491500
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_DATA, 2);
501+
492502
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_MSGID + 4, 0x10108);
493503
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 4, 0x30000);
494-
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_DATA + 4, 0x3);
504+
if (adreno_is_a618(adreno_gpu))
505+
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_DATA + 4, 0x2);
506+
else
507+
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_DATA + 4, 0x3);
508+
509+
495510
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_MSGID + 8, 0x10108);
496-
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 8, 0x30080);
511+
if (adreno_is_a618(adreno_gpu))
512+
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 8, 0x30090);
513+
else
514+
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 8, 0x30080);
497515
pdc_write(pdcptr, REG_A6XX_PDC_GPU_TCS3_CMD0_DATA + 8, 0x3);
498516

499517
/* Setup GPU PDC */
@@ -741,8 +759,8 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
741759
gmu_write(gmu, REG_A6XX_GMU_GMU2HOST_INTR_MASK, ~A6XX_HFI_IRQ_MASK);
742760
enable_irq(gmu->hfi_irq);
743761

744-
/* Set the GPU to the highest power frequency */
745-
__a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
762+
/* Set the GPU to the current freq */
763+
__a6xx_gmu_set_freq(gmu, gmu->current_perf_index);
746764

747765
/*
748766
* "enable" the GX power domain which won't actually do anything but it
@@ -1166,6 +1184,8 @@ static int a6xx_gmu_pwrlevels_probe(struct a6xx_gmu *gmu)
11661184
gmu->nr_gpu_freqs = a6xx_gmu_build_freq_table(&gpu->pdev->dev,
11671185
gmu->gpu_freqs, ARRAY_SIZE(gmu->gpu_freqs));
11681186

1187+
gmu->current_perf_index = gmu->nr_gpu_freqs - 1;
1188+
11691189
/* Build the list of RPMh votes that we'll send to the GMU */
11701190
return a6xx_gmu_rpmh_votes_init(gmu);
11711191
}

drivers/gpu/drm/msm/adreno/a6xx_gmu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ struct a6xx_gmu {
6363
struct clk_bulk_data *clocks;
6464
struct clk *core_clk;
6565

66+
/* current performance index set externally */
67+
int current_perf_index;
68+
6669
int nr_gpu_freqs;
6770
unsigned long gpu_freqs[16];
6871
u32 gx_arc_votes[16];

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
/* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. */
2+
/* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. */
33

44

55
#include "msm_gem.h"
@@ -378,6 +378,18 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
378378
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
379379
int ret;
380380

381+
/*
382+
* During a previous slumber, GBIF halt is asserted to ensure
383+
* no further transaction can go through GPU before GPU
384+
* headswitch is turned off.
385+
*
386+
* This halt is deasserted once headswitch goes off but
387+
* incase headswitch doesn't goes off clear GBIF halt
388+
* here to ensure GPU wake-up doesn't fail because of
389+
* halted GPU transactions.
390+
*/
391+
gpu_write(gpu, REG_A6XX_GBIF_HALT, 0x0);
392+
381393
/* Make sure the GMU keeps the GPU on while we set it up */
382394
a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_GPU_SET);
383395

@@ -406,12 +418,17 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
406418
gpu_write(gpu, REG_A6XX_TPL1_ADDR_MODE_CNTL, 0x1);
407419
gpu_write(gpu, REG_A6XX_RBBM_SECVID_TSB_ADDR_MODE_CNTL, 0x1);
408420

409-
/* enable hardware clockgating */
410-
a6xx_set_hwcg(gpu, true);
421+
/*
422+
* enable hardware clockgating
423+
* For now enable clock gating only for a630
424+
*/
425+
if (adreno_is_a630(adreno_gpu))
426+
a6xx_set_hwcg(gpu, true);
411427

412-
/* VBIF start */
413-
gpu_write(gpu, REG_A6XX_VBIF_GATE_OFF_WRREQ_EN, 0x00000009);
428+
/* VBIF/GBIF start*/
414429
gpu_write(gpu, REG_A6XX_RBBM_VBIF_CLIENT_QOS_CNTL, 0x3);
430+
if (adreno_is_a630(adreno_gpu))
431+
gpu_write(gpu, REG_A6XX_VBIF_GATE_OFF_WRREQ_EN, 0x00000009);
415432

416433
/* Make all blocks contribute to the GPU BUSY perf counter */
417434
gpu_write(gpu, REG_A6XX_RBBM_PERFCTR_GPU_BUSY_MASKED, 0xffffffff);
@@ -537,12 +554,19 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
537554
a6xx_flush(gpu, gpu->rb[0]);
538555
if (!a6xx_idle(gpu, gpu->rb[0]))
539556
return -EINVAL;
540-
} else {
541-
/* Print a warning so if we die, we know why */
557+
} else if (ret == -ENODEV) {
558+
/*
559+
* This device does not use zap shader (but print a warning
560+
* just in case someone got their dt wrong.. hopefully they
561+
* have a debug UART to realize the error of their ways...
562+
* if you mess this up you are about to crash horribly)
563+
*/
542564
dev_warn_once(gpu->dev->dev,
543565
"Zap shader not enabled - using SECVID_TRUST_CNTL instead\n");
544566
gpu_write(gpu, REG_A6XX_RBBM_SECVID_TRUST_CNTL, 0x0);
545567
ret = 0;
568+
} else {
569+
return ret;
546570
}
547571

548572
out:
@@ -724,6 +748,39 @@ static const u32 a6xx_register_offsets[REG_ADRENO_REGISTER_MAX] = {
724748
REG_ADRENO_DEFINE(REG_ADRENO_CP_RB_CNTL, REG_A6XX_CP_RB_CNTL),
725749
};
726750

751+
#define GBIF_CLIENT_HALT_MASK BIT(0)
752+
#define GBIF_ARB_HALT_MASK BIT(1)
753+
754+
static void a6xx_bus_clear_pending_transactions(struct adreno_gpu *adreno_gpu)
755+
{
756+
struct msm_gpu *gpu = &adreno_gpu->base;
757+
758+
if(!a6xx_has_gbif(adreno_gpu)){
759+
gpu_write(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL0, 0xf);
760+
spin_until((gpu_read(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL1) &
761+
0xf) == 0xf);
762+
gpu_write(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL0, 0);
763+
764+
return;
765+
}
766+
767+
/* Halt new client requests on GBIF */
768+
gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_CLIENT_HALT_MASK);
769+
spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) &
770+
(GBIF_CLIENT_HALT_MASK)) == GBIF_CLIENT_HALT_MASK);
771+
772+
/* Halt all AXI requests on GBIF */
773+
gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_ARB_HALT_MASK);
774+
spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) &
775+
(GBIF_ARB_HALT_MASK)) == GBIF_ARB_HALT_MASK);
776+
777+
/*
778+
* GMU needs DDR access in slumber path. Deassert GBIF halt now
779+
* to allow for GMU to access system memory.
780+
*/
781+
gpu_write(gpu, REG_A6XX_GBIF_HALT, 0x0);
782+
}
783+
727784
static int a6xx_pm_resume(struct msm_gpu *gpu)
728785
{
729786
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
@@ -748,6 +805,16 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu)
748805

749806
devfreq_suspend_device(gpu->devfreq.devfreq);
750807

808+
/*
809+
* Make sure the GMU is idle before continuing (because some transitions
810+
* may use VBIF
811+
*/
812+
a6xx_gmu_wait_for_idle(&a6xx_gpu->gmu);
813+
814+
/* Clear the VBIF pipe before shutting down */
815+
/* FIXME: This accesses the GPU - do we need to make sure it is on? */
816+
a6xx_bus_clear_pending_transactions(adreno_gpu);
817+
751818
return a6xx_gmu_stop(a6xx_gpu);
752819
}
753820

0 commit comments

Comments
 (0)