[PATCH] drm/amdgpu: add another Renior DID

2021-07-12 Thread Jinzhou Su
Add new PCI device id.

Signed-off-by: Jinzhou Su 
Reviewed-by: Huang Rui 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 179f2d01a082..1db106b135f9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1166,6 +1166,7 @@ static const struct pci_device_id pciidlist[] = {
{0x1002, 0x734F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
 
/* Renoir */
+   {0x1002, 0x15E7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
{0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
{0x1002, 0x1638, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
{0x1002, 0x164C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Add compile flag for securedisplay

2021-05-11 Thread Jinzhou Su
Add compile flag CONFIG_DEBUG_FS to clear the warning:
unused variable 'amdgpu_securedisplay_debugfs_ops'

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
index 5369c8dd0764..123453999093 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
@@ -86,6 +86,8 @@ void psp_prep_securedisplay_cmd_buf(struct psp_context *psp, 
struct securedispla
(*cmd)->cmd_id = command_id;
 }
 
+#if defined(CONFIG_DEBUG_FS)
+
 static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char 
__user *buf,
size_t size, loff_t *pos)
 {
@@ -162,6 +164,8 @@ static const struct file_operations 
amdgpu_securedisplay_debugfs_ops = {
.llseek = default_llseek
 };
 
+#endif
+
 void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Enable SDMA LS for Vangogh

2021-04-23 Thread Jinzhou Su
Add flags AMD_CG_SUPPORT_SDMA_LS for Vangogh.
Start to open sdma ls from firmware version 70.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/nv.c| 1 +
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 4 
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
index 9c4f232e81c0..82a380be8368 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -1121,6 +1121,7 @@ static int nv_common_early_init(void *handle)
AMD_CG_SUPPORT_GFX_FGCG |
AMD_CG_SUPPORT_VCN_MGCG |
AMD_CG_SUPPORT_SDMA_MGCG |
+   AMD_CG_SUPPORT_SDMA_LS |
AMD_CG_SUPPORT_JPEG_MGCG;
adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |
AMD_PG_SUPPORT_VCN |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 4ba7fce4c0b4..7c4e0586e26d 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -1593,6 +1593,10 @@ static void 
sdma_v5_2_update_medium_grain_light_sleep(struct amdgpu_device *adev
int i;
 
for (i = 0; i < adev->sdma.num_instances; i++) {
+
+   if (adev->sdma.instance[i].fw_version < 70 && adev->asic_type 
== CHIP_VANGOGH)
+   adev->cg_flags &= ~AMD_CG_SUPPORT_SDMA_LS;
+
if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_LS)) {
/* Enable sdma mem light sleep */
def = data = RREG32(sdma_v5_2_get_reg_offset(adev, i, 
mmSDMA0_POWER_CNTL));
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Enable SDMA MGCG for Vangogh

2021-04-21 Thread Jinzhou Su
Add flags AMD_CG_SUPPORT_SDMA_MGCG for Vangogh.
Start to open sdma mgcg from firmware version 70.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/nv.c| 1 +
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 4 
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
index d54af7f8801b..0142f6760ad2 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -1118,6 +1118,7 @@ static int nv_common_early_init(void *handle)
AMD_CG_SUPPORT_MC_LS |
AMD_CG_SUPPORT_GFX_FGCG |
AMD_CG_SUPPORT_VCN_MGCG |
+   AMD_CG_SUPPORT_SDMA_MGCG |
AMD_CG_SUPPORT_JPEG_MGCG;
adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |
AMD_PG_SUPPORT_VCN |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index b1ad9e52b234..4ba7fce4c0b4 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -1556,6 +1556,10 @@ static void 
sdma_v5_2_update_medium_grain_clock_gating(struct amdgpu_device *ade
int i;
 
for (i = 0; i < adev->sdma.num_instances; i++) {
+
+   if (adev->sdma.instance[i].fw_version < 70 && adev->asic_type 
== CHIP_VANGOGH)
+   adev->cg_flags &= ~AMD_CG_SUPPORT_SDMA_MGCG;
+
if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_MGCG)) {
/* Enable sdma clock gating */
def = data = RREG32(sdma_v5_2_get_reg_offset(adev, i, 
mmSDMA0_CLK_CTRL));
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Add mem sync flag for IB allocated by SA

2021-04-20 Thread Jinzhou Su
The buffer of SA bo will be used by many cases. So better
to flush the cache of indirect buffer allocated by SA before
commit the IB.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 148a3b481b12..a2fe2dac32c1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -76,6 +76,8 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct 
amdgpu_vm *vm,
}
 
ib->ptr = amdgpu_sa_bo_cpu_addr(ib->sa_bo);
+   /* flush the cache before commit the IB */
+   ib->flags = AMDGPU_IB_FLAG_EMIT_MEM_SYNC;
 
if (!vm)
ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Add mem sync flag for SDMA IB test

2021-04-19 Thread Jinzhou Su
The buffer for SDMA IB test is allocated by sa bo
which may be used by other purpose. Better to flush
the cache before commit the IB.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index b1ad9e52b234..da67f440b102 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -1000,6 +1000,7 @@ static int sdma_v5_2_ring_test_ib(struct amdgpu_ring 
*ring, long timeout)
ib.ptr[7] = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP);
ib.length_dw = 8;
 
+   ib.flags = AMDGPU_IB_FLAG_EMIT_MEM_SYNC;
r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f);
if (r)
goto err1;
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Add graphics cache rinse packet for sdma

2021-04-12 Thread Jinzhou Su
  Add emit mem sync callback for sdma_v5_2

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 28 ++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 93f826a7d3f0..b1ad9e52b234 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -369,6 +369,33 @@ static void sdma_v5_2_ring_emit_ib(struct amdgpu_ring 
*ring,
amdgpu_ring_write(ring, upper_32_bits(csa_mc_addr));
 }
 
+/**
+ * sdma_v5_2_ring_emit_mem_sync - flush the IB by graphics cache rinse
+ *
+ * @ring: amdgpu ring pointer
+ * @job: job to retrieve vmid from
+ * @ib: IB object to schedule
+ *
+ * flush the IB by graphics cache rinse.
+ */
+static void sdma_v5_2_ring_emit_mem_sync(struct amdgpu_ring *ring)
+{
+uint32_t gcr_cntl =
+   SDMA_GCR_GL2_INV | SDMA_GCR_GL2_WB | SDMA_GCR_GLM_INV |
+   SDMA_GCR_GL1_INV | SDMA_GCR_GLV_INV | SDMA_GCR_GLK_INV |
+   SDMA_GCR_GLI_INV(1);
+
+   /* flush entire cache L0/L1/L2, this can be optimized by performance 
requirement */
+   amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_GCR_REQ));
+   amdgpu_ring_write(ring, SDMA_PKT_GCR_REQ_PAYLOAD1_BASE_VA_31_7(0));
+   amdgpu_ring_write(ring, 
SDMA_PKT_GCR_REQ_PAYLOAD2_GCR_CONTROL_15_0(gcr_cntl) |
+   SDMA_PKT_GCR_REQ_PAYLOAD2_BASE_VA_47_32(0));
+   amdgpu_ring_write(ring, SDMA_PKT_GCR_REQ_PAYLOAD3_LIMIT_VA_31_7(0) |
+   SDMA_PKT_GCR_REQ_PAYLOAD3_GCR_CONTROL_18_16(gcr_cntl >> 
16));
+   amdgpu_ring_write(ring, SDMA_PKT_GCR_REQ_PAYLOAD4_LIMIT_VA_47_32(0) |
+   SDMA_PKT_GCR_REQ_PAYLOAD4_VMID(0));
+}
+
 /**
  * sdma_v5_2_ring_emit_hdp_flush - emit an hdp flush on the DMA ring
  *
@@ -1663,6 +1690,7 @@ static const struct amdgpu_ring_funcs 
sdma_v5_2_ring_funcs = {
10 + 10 + 10, /* sdma_v5_2_ring_emit_fence x3 for user fence, 
vm fence */
.emit_ib_size = 7 + 6, /* sdma_v5_2_ring_emit_ib */
.emit_ib = sdma_v5_2_ring_emit_ib,
+   .emit_mem_sync = sdma_v5_2_ring_emit_mem_sync,
.emit_fence = sdma_v5_2_ring_emit_fence,
.emit_pipeline_sync = sdma_v5_2_ring_emit_pipeline_sync,
.emit_vm_flush = sdma_v5_2_ring_emit_vm_flush,
-- 
2.27.0

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: update secure display TA header

2021-03-08 Thread Jinzhou Su
update secure display TA header file.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 3 +++
 drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h  | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
index 834440ab9ff7..9cf856c94f94 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
@@ -69,6 +69,9 @@ void psp_securedisplay_parse_resp_status(struct psp_context 
*psp,
case TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR:
dev_err(psp->adev->dev, "Secure display: Failed to Read CRC");
break;
+   case TA_SECUREDISPLAY_STATUS__I2C_INIT_ERROR:
+   dev_err(psp->adev->dev, "Secure display: Failed to initialize 
I2C.");
+   break;
default:
dev_err(psp->adev->dev, "Secure display: Failed to parse 
status: %d\n", status);
}
diff --git a/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h 
b/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h
index 5039375bb1d4..cf8ff064dc72 100644
--- a/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h
+++ b/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h
@@ -50,6 +50,7 @@ enum ta_securedisplay_status {
TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR = 0x04, /* 
Fail to Write to I2C */
TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR  = 0x05, /*Fail Read 
DIO Scratch Register*/
TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR  = 0x06, /* 
Fail to Read CRC*/
+   TA_SECUREDISPLAY_STATUS__I2C_INIT_ERROR  = 0x07, /* Failed 
to initialize I2C */
 
TA_SECUREDISPLAY_STATUS__MAX = 0x7FFF,/* 
Maximum Value for status*/
 };
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Enable SDMA MGCG for Vangogh

2021-02-23 Thread Jinzhou Su
Add AMD_CG_SUPPORT_SDMA_MGCG for Vangogh

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/nv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
index 160fa5f59805..393a0d5905ab 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -1003,6 +1003,7 @@ static int nv_common_early_init(void *handle)
AMD_CG_SUPPORT_MC_LS |
AMD_CG_SUPPORT_GFX_FGCG |
AMD_CG_SUPPORT_VCN_MGCG |
+   AMD_CG_SUPPORT_SDMA_MGCG |
AMD_CG_SUPPORT_JPEG_MGCG;
adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |
AMD_PG_SUPPORT_VCN |
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amd/pm: Disable GFXOFF when GFX DPM or PG disabled

2021-02-02 Thread Jinzhou Su
Check GFX DPM and PG bit before enable GFXOFF on Vangogh
smu post init.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 4726cac8d824..f0f06ef47b9e 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -1712,10 +1712,16 @@ static int vangogh_post_smu_init(struct smu_context 
*smu)
adev->gfx.config.max_sh_per_se * 
adev->gfx.config.max_shader_engines;
 
/* allow message will be sent after enable message on Vangogh*/
-   ret = smu_cmn_send_smc_msg(smu, SMU_MSG_EnableGfxOff, NULL);
-   if (ret) {
-   dev_err(adev->dev, "Failed to Enable GfxOff!\n");
-   return ret;
+   if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&
+   (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
+   ret = smu_cmn_send_smc_msg(smu, SMU_MSG_EnableGfxOff, NULL);
+   if (ret) {
+   dev_err(adev->dev, "Failed to Enable GfxOff!\n");
+   return ret;
+   }
+   } else {
+   adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
+   dev_info(adev->dev, "If GFX DPM or power gate disabled, disable 
GFXOFF\n");
}
 
/* if all CUs are active, no need to power off any WGPs */
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Allow GfxOff on Vangogh as default

2021-01-20 Thread Jinzhou Su
Send allow GfxOff message to SMU to enter GfxOff
mode as default.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index dd102cc2516a..426a217ce83f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -7905,6 +7905,7 @@ static int gfx_v10_0_set_powergating_state(void *handle,
break;
case CHIP_VANGOGH:
gfx_v10_cntl_pg(adev, enable);
+   amdgpu_gfx_off_ctrl(adev, enable);
break;
default:
break;
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Add RLC_PG_DELAY_3 for Vangogh

2021-01-19 Thread Jinzhou Su
Driver should enable the CGPG feature for RLC in safe mode to
prevent any misalignment or conflict in middle of any power
feature entry/exit sequence.
Achieved by setting RLC_PG_CNTL.GFX_POWER_GATING_ENABLE = 0x1,
and RLC_PG_DELAY_3.CGCG_ACTIVE_BEFORE_CGPG to the desired CGPG
hysteresis value in refclk count.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index c4314e25f560..dd102cc2516a 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -120,6 +120,7 @@
 #define mmSPI_CONFIG_CNTL_Vangogh_BASE_IDX   1
 #define mmGCR_GENERAL_CNTL_Vangogh   0x1580
 #define mmGCR_GENERAL_CNTL_Vangogh_BASE_IDX  0
+#define RLC_PG_DELAY_3__CGCG_ACTIVE_BEFORE_CGPG_MASK_Vangogh   0xL
 
 #define mmCP_HYP_PFP_UCODE_ADDR0x5814
 #define mmCP_HYP_PFP_UCODE_ADDR_BASE_IDX   1
@@ -7829,6 +7830,20 @@ static void gfx_v10_cntl_power_gating(struct 
amdgpu_device *adev, bool enable)
data &= ~RLC_PG_CNTL__GFX_POWER_GATING_ENABLE_MASK;
 
WREG32_SOC15(GC, 0, mmRLC_PG_CNTL, data);
+
+   /*
+* CGPG enablement required and the register to program the hysteresis 
value
+* RLC_PG_DELAY_3.CGCG_ACTIVE_BEFORE_CGPG to the desired CGPG 
hysteresis value
+* in refclk count. Note that RLC FW is modified to take 16 bits from
+* RLC_PG_DELAY_3[15:0] as the hysteresis instead of just 8 bits.
+*
+* The recommendation from RLC team is setting RLC_PG_DELAY_3 to 
200us(0x4E20)
+* as part of CGPG enablement starting point.
+*/
+   if (enable && (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) && 
adev->asic_type == CHIP_VANGOGH) {
+   data = 0x4E20 & 
RLC_PG_DELAY_3__CGCG_ACTIVE_BEFORE_CGPG_MASK_Vangogh;
+   WREG32_SOC15(GC, 0, mmRLC_PG_DELAY_3, data);
+   }
 }
 
 static void gfx_v10_cntl_pg(struct amdgpu_device *adev, bool enable)
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Add RLC_PG_DELAY_3 for Vangogh

2021-01-19 Thread Jinzhou Su
Copy from RLC MAS:

Driver should enable the CGPG feature for RLC while it is in
safe mode to prevent any misalignment or conflict while it is
in middle of any power feature entry/exit sequence. This can
be achieved by setting RLC_PG_CNTL.GFX_POWER_GATING_ENABLE = 0x1,
and RLC_PG_DELAY_3.CGCG_ACTIVE_BEFORE_CGPG to the desired CGPG
hysteresis value in refclk count.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index c4314e25f560..23a11ec40c33 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -120,6 +120,7 @@
 #define mmSPI_CONFIG_CNTL_Vangogh_BASE_IDX   1
 #define mmGCR_GENERAL_CNTL_Vangogh   0x1580
 #define mmGCR_GENERAL_CNTL_Vangogh_BASE_IDX  0
+#define RLC_PG_DELAY_3__CGCG_ACTIVE_BEFORE_CGPG_MASK_Vangogh   0xL
 
 #define mmCP_HYP_PFP_UCODE_ADDR0x5814
 #define mmCP_HYP_PFP_UCODE_ADDR_BASE_IDX   1
@@ -7829,6 +7830,17 @@ static void gfx_v10_cntl_power_gating(struct 
amdgpu_device *adev, bool enable)
data &= ~RLC_PG_CNTL__GFX_POWER_GATING_ENABLE_MASK;
 
WREG32_SOC15(GC, 0, mmRLC_PG_CNTL, data);
+
+   /*
+* CGPG enablement required and the register to program the hysteresis 
value
+* RLC_PG_DELAY_3.CGCG_ACTIVE_BEFORE_CGPG to the desired CGPG 
hysteresis value
+* in refclk count. Note that RLC FW is modified to take 16 bits from
+* RLC_PG_DELAY_3[15:0] as the hysteresis instead of just 8 bits.
+*/
+   if (enable && (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) && 
adev->asic_type == CHIP_VANGOGH) {
+   data = 0x4E20 & 
RLC_PG_DELAY_3__CGCG_ACTIVE_BEFORE_CGPG_MASK_Vangogh;
+   WREG32_SOC15(GC, 0, mmRLC_PG_DELAY_3, data);
+   }
 }
 
 static void gfx_v10_cntl_pg(struct amdgpu_device *adev, bool enable)
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: modify GCR_GENERAL_CNTL for Vangogh

2021-01-18 Thread Jinzhou Su
GCR_GENERAL_CNTL is defined differently in gc_10_1_0_offset.h and
gc_10_3_0_offset.h. Update GCR_GENERAL_CNTL for Vangogh.

Signed-off-by: Jinzhou Su 
Reviewed-by: Huang Rui 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 4d3b30a2dd45..1d604fcb9b77 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -118,6 +118,8 @@
 #define mmVGT_ESGS_RING_SIZE_Vangogh_BASE_IDX1
 #define mmSPI_CONFIG_CNTL_Vangogh0x2440
 #define mmSPI_CONFIG_CNTL_Vangogh_BASE_IDX   1
+#define mmGCR_GENERAL_CNTL_Vangogh   0x1580
+#define mmGCR_GENERAL_CNTL_Vangogh_BASE_IDX  0
 
 #define mmCP_HYP_PFP_UCODE_ADDR0x5814
 #define mmCP_HYP_PFP_UCODE_ADDR_BASE_IDX   1
@@ -3243,7 +3245,7 @@ static const struct soc15_reg_golden 
golden_settings_gc_10_3_vangogh[] =
SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0x, 0x0080),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_EXCEPTION_CONTROL, 0x7fff0f1f, 
0x00b8),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0x0c1807ff, 0x0142),
-   SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x1ff1, 
0x0500),
+   SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL_Vangogh, 0x1ff1, 
0x0500),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_PIPE_STEER, 0x00ff, 0x00e4),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_0, 0x, 
0x32103210),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_1, 0x, 
0x32103210),
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: modify GCR_GENERAL_CNTL for Vangogh

2021-01-18 Thread Jinzhou Su
GCR_GENERAL_CNTL is defined differently in gc_10_1_0_offset.h and
gc_10_3_0_offset.h. Update GCR_GENERAL_CNTL for Vangogh.

http://ontrack-internal.amd.com/browse/AER-11

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 4d3b30a2dd45..1d604fcb9b77 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -118,6 +118,8 @@
 #define mmVGT_ESGS_RING_SIZE_Vangogh_BASE_IDX1
 #define mmSPI_CONFIG_CNTL_Vangogh0x2440
 #define mmSPI_CONFIG_CNTL_Vangogh_BASE_IDX   1
+#define mmGCR_GENERAL_CNTL_Vangogh   0x1580
+#define mmGCR_GENERAL_CNTL_Vangogh_BASE_IDX  0
 
 #define mmCP_HYP_PFP_UCODE_ADDR0x5814
 #define mmCP_HYP_PFP_UCODE_ADDR_BASE_IDX   1
@@ -3243,7 +3245,7 @@ static const struct soc15_reg_golden 
golden_settings_gc_10_3_vangogh[] =
SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0x, 0x0080),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_EXCEPTION_CONTROL, 0x7fff0f1f, 
0x00b8),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0x0c1807ff, 0x0142),
-   SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x1ff1, 
0x0500),
+   SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL_Vangogh, 0x1ff1, 
0x0500),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_PIPE_STEER, 0x00ff, 0x00e4),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_0, 0x, 
0x32103210),
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2_PIPE_STEER_1, 0x, 
0x32103210),
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Remove GFXOFF MASK for Vangogh

2021-01-18 Thread Jinzhou Su
 1. Remove PP_GFXOFF_MASK and then GFXOFF can be enabled
by user space.
 2. GFXOFF is still disabled on Vangogh by default.
 3. When GFXOFF feature on Vangogh landed, will enable
GFXOFF by default.
 4. GFXOFF can be enabled by debugfs interface amdgpu_gfxoff.

Signed-off-by: Jinzhou Su 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 4d3b30a2dd45..92b1cbdebae9 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -3775,9 +3775,6 @@ static void gfx_v10_0_check_gfxoff_flag(struct 
amdgpu_device *adev)
if (!gfx_v10_0_navi10_gfxoff_should_enable(adev))
adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
break;
-   case CHIP_VANGOGH:
-   adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
-   break;
default:
break;
}
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/amdgpu: Add secure display TA interface

2021-01-12 Thread Jinzhou Su
Add interface to load, unload, invoke command for
secure display TA.

v2: Add debugfs interface for secure display TA

Signed-off-by: Jinzhou.Su 
Reviewed-by: Huang Rui 
---
 drivers/gpu/drm/amd/amdgpu/Makefile   |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   | 195 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h   |  17 ++
 .../gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 174 
 .../gpu/drm/amd/amdgpu/amdgpu_securedisplay.h |  36 
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |   4 +
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c|  12 +-
 8 files changed, 440 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.h

diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
b/drivers/gpu/drm/amd/amdgpu/Makefile
index c6262689e14e..e4bebbfa88af 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -56,7 +56,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
amdgpu_gmc.o amdgpu_mmhub.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o 
amdgpu_vm_cpu.o \
amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \
amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \
-   amdgpu_fw_attestation.o
+   amdgpu_fw_attestation.o amdgpu_securedisplay.o
 
 amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 477bead4fab1..4c38c5771cbc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -35,6 +35,7 @@
 #include "amdgpu_dm_debugfs.h"
 #include "amdgpu_ras.h"
 #include "amdgpu_rap.h"
+#include "amdgpu_securedisplay.h"
 #include "amdgpu_fw_attestation.h"
 
 /**
@@ -1666,6 +1667,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 
amdgpu_rap_debugfs_init(adev);
 
+   amdgpu_securedisplay_debugfs_init(adev);
+
amdgpu_fw_attestation_debugfs_init(adev);
 
return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 523d22db094b..eb19ae734396 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -36,6 +36,7 @@
 #include "psp_v12_0.h"
 
 #include "amdgpu_ras.h"
+#include "amdgpu_securedisplay.h"
 
 static int psp_sysfs_init(struct amdgpu_device *adev);
 static void psp_sysfs_fini(struct amdgpu_device *adev);
@@ -1642,6 +1643,179 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t 
ta_cmd_id)
 }
 // RAP end
 
+/* securedisplay start */
+static int psp_securedisplay_init_shared_buf(struct psp_context *psp)
+{
+   int ret;
+
+   /*
+* Allocate 16k memory aligned to 4k from Frame Buffer (local
+* physical) for sa ta <-> Driver
+*/
+   ret = amdgpu_bo_create_kernel(psp->adev, 
PSP_SECUREDISPLAY_SHARED_MEM_SIZE,
+ PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
+ 
&psp->securedisplay_context.securedisplay_shared_bo,
+ 
&psp->securedisplay_context.securedisplay_shared_mc_addr,
+ 
&psp->securedisplay_context.securedisplay_shared_buf);
+
+   return ret;
+}
+
+static int psp_securedisplay_load(struct psp_context *psp)
+{
+   int ret;
+   struct psp_gfx_cmd_resp *cmd;
+
+   /*
+* TODO: bypass the loading in sriov for now
+*/
+
+   cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
+   if (!cmd)
+   return -ENOMEM;
+
+   memset(psp->fw_pri_buf, 0, PSP_1_MEG);
+   memcpy(psp->fw_pri_buf, psp->ta_securedisplay_start_addr, 
psp->ta_securedisplay_ucode_size);
+
+   psp_prep_ta_load_cmd_buf(cmd,
+psp->fw_pri_mc_addr,
+psp->ta_securedisplay_ucode_size,
+
psp->securedisplay_context.securedisplay_shared_mc_addr,
+PSP_SECUREDISPLAY_SHARED_MEM_SIZE);
+
+   ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
+
+   if (ret)
+   goto failed;
+
+   psp->securedisplay_context.securedisplay_initialized = true;
+   psp->securedisplay_context.session_id = cmd->resp.session_id;
+   mutex_init(&psp->securedisplay_context.mutex);
+
+failed:
+   kfree(cmd);
+   return ret;
+}
+
+static int psp_securedisplay_unload(struct psp_context *psp)
+{
+   int ret;
+   struct psp_gfx_cmd_resp *cmd;
+
+   cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
+   if (!cmd)
+   return -ENOMEM;
+
+   psp_prep_ta_unload_cmd_buf(cmd, psp->securedisplay_context.session_id);
+
+   ret = psp_cmd_su

[PATCH 1/2] drm/amdgpu: Add Secure Display TA header file

2021-01-12 Thread Jinzhou Su
Add file ta_secureDisplay_if.h for Secure Display TA

Signed-off-by: Jinzhou Su 
Reviewed-by: Huang Rui 
Reviewed-by: Alex Deucher 
---
 .../gpu/drm/amd/amdgpu/ta_secureDisplay_if.h  | 154 ++
 1 file changed, 154 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h

diff --git a/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h 
b/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h
new file mode 100644
index ..5039375bb1d4
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2019 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _TA_SECUREDISPLAY_IF_H
+#define _TA_SECUREDISPLAY_IF_H
+
+/** Secure Display related enumerations */
+/**/
+
+/** @enum ta_securedisplay_command
+ *Secure Display Command ID
+ */
+enum ta_securedisplay_command {
+   /* Query whether TA is responding used only for validation purpose */
+   TA_SECUREDISPLAY_COMMAND__QUERY_TA  = 1,
+   /* Send region of Interest and CRC value to I2C */
+   TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC  = 2,
+   /* Maximum Command ID */
+   TA_SECUREDISPLAY_COMMAND__MAX_ID= 0x7FFF,
+};
+
+/** @enum ta_securedisplay_status
+ *Secure Display status returns in shared buffer status
+ */
+enum ta_securedisplay_status {
+   TA_SECUREDISPLAY_STATUS__SUCCESS = 0x00, /* 
Success */
+   TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE = 0x01, /* 
Generic Failure */
+   TA_SECUREDISPLAY_STATUS__INVALID_PARAMETER   = 0x02, /* 
Invalid Parameter */
+   TA_SECUREDISPLAY_STATUS__NULL_POINTER= 0x03, /* 
Null Pointer*/
+   TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR = 0x04, /* 
Fail to Write to I2C */
+   TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR  = 0x05, /*Fail Read 
DIO Scratch Register*/
+   TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR  = 0x06, /* 
Fail to Read CRC*/
+
+   TA_SECUREDISPLAY_STATUS__MAX = 0x7FFF,/* 
Maximum Value for status*/
+};
+
+/** @enum ta_securedisplay_max_phy
+ *Physical ID number to use for reading corresponding DIO Scratch register 
for ROI
+ */
+enum  ta_securedisplay_max_phy {
+   TA_SECUREDISPLAY_PHY0   = 0,
+   TA_SECUREDISPLAY_PHY1   = 1,
+   TA_SECUREDISPLAY_PHY2   = 2,
+   TA_SECUREDISPLAY_PHY3   = 3,
+   TA_SECUREDISPLAY_MAX_PHY= 4,
+};
+
+/** @enum ta_securedisplay_ta_query_cmd_ret
+ *A predefined specific reteurn value which is 0xAB only used to validate
+ *communication to Secure Display TA is functional.
+ *This value is used to validate whether TA is responding successfully
+ */
+enum ta_securedisplay_ta_query_cmd_ret {
+   /* This is a value to validate if TA is loaded successfully */
+   TA_SECUREDISPLAY_QUERY_CMD_RET = 0xAB,
+};
+
+/** @enum ta_securedisplay_buffer_size
+ *I2C Buffer size which contains 8 bytes of ROI  (X start, X end, Y start, 
Y end)
+ *and 6 bytes of CRC( R,G,B) and 1  byte for physical ID
+ */
+enum ta_securedisplay_buffer_size {
+   /* 15 bytes = 8 byte (ROI) + 6 byte(CRC) + 1 byte(phy_id) */
+   TA_SECUREDISPLAY_I2C_BUFFER_SIZE= 15,
+};
+
+/** Input/output structures for Secure Display commands */
+/**/
+/**
+ * Input structures
+ */
+
+/** @struct ta_securedisplay_send_roi_crc_input
+ *Physical ID to determine which DIO scratch register should be used to 
get ROI
+ */
+struct ta_securedisplay_send_roi_crc_input {
+   uint32_t  phy_id;  /* Physical ID 

[PATCH] drm/amdgpu: Set doorbell range for gfx ring

2020-11-27 Thread Jinzhou Su
If there are 2 gfx rings, the doorbell lower range of second ring
will override the first ring.

Signed-off-by: Jinzhou.Su 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index ffbda6680a68..f33e54b01d3a 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -6357,8 +6357,11 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_ring 
*ring)
DOORBELL_EN, 0);
mqd->cp_rb_doorbell_control = tmp;
 
-   /* set doorbell range */
-   gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
+   /*if there are 2 gfx rings, set the lower doorbell range of the first 
ring,
+*otherwise the range of the second ring will override the first ring */
+   if (ring->doorbell_index == adev->doorbell_index.gfx_ring0 << 1)
+   gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
+
/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */
ring->wptr = 0;
mqd->cp_gfx_hqd_rptr = RREG32_SOC15(GC, 0, mmCP_GFX_HQD_RPTR);
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: Add gfx doorbell setting for Vangogh

2020-11-18 Thread Jinzhou Su
Using KIQ to map GFX queues instead of MMIO for gfx async ring,
add missing doorbell range setting.

Signed-off-by: Jinzhou.Su 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index a6d03931f7fa..9b4e5d53432f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -5995,17 +5995,19 @@ static void gfx_v10_0_cp_gfx_set_doorbell(struct 
amdgpu_device *adev,
 {
u32 tmp;
 
-   tmp = RREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL);
-   if (ring->use_doorbell) {
-   tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-   DOORBELL_OFFSET, ring->doorbell_index);
-   tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-   DOORBELL_EN, 1);
-   } else {
-   tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-   DOORBELL_EN, 0);
+   if (!amdgpu_async_gfx_ring) {
+   tmp = RREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL);
+   if (ring->use_doorbell) {
+   tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+   DOORBELL_OFFSET, ring->doorbell_index);
+   tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+   DOORBELL_EN, 1);
+   } else {
+   tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+   DOORBELL_EN, 0);
+   }
+   WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL, tmp);
}
-   WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL, tmp);
switch (adev->asic_type) {
case CHIP_SIENNA_CICHLID:
case CHIP_NAVY_FLOUNDER:
@@ -6349,6 +6351,8 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_ring 
*ring)
DOORBELL_EN, 0);
mqd->cp_rb_doorbell_control = tmp;
 
+   /* set doorbell range */
+   gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */
ring->wptr = 0;
mqd->cp_gfx_hqd_rptr = RREG32_SOC15(GC, 0, mmCP_GFX_HQD_RPTR);
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx