All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhao, Yong" <Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Zhao, Yong" <Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 5/6] drm/amdgpu: Add the HDP flush support for Navi
Date: Sat, 28 Sep 2019 03:41:47 +0000	[thread overview]
Message-ID: <20190928034132.28340-5-Yong.Zhao@amd.com> (raw)
In-Reply-To: <20190928034132.28340-1-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>

The HDP flush support code was missing in the nbio and nv files.

Change-Id: I046ff52567676b56bf16dc1728b02481233acb61
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 16 +++++++++++++---
 drivers/gpu/drm/amd/amdgpu/nv.c        |  9 +++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
index e7e36fb6113d..c699cbfe015a 100644
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
@@ -27,11 +27,21 @@
 #include "nbio/nbio_2_3_default.h"
 #include "nbio/nbio_2_3_offset.h"
 #include "nbio/nbio_2_3_sh_mask.h"
+#include <uapi/linux/kfd_ioctl.h>
 
 #define smnPCIE_CONFIG_CNTL	0x11180044
 #define smnCPM_CONTROL		0x11180460
 #define smnPCIE_CNTL2		0x11180070
 
+
+static void nbio_v2_3_remap_hdp_registers(struct amdgpu_device *adev)
+{
+	WREG32_SOC15(NBIO, 0, mmREMAP_HDP_MEM_FLUSH_CNTL,
+		adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL);
+	WREG32_SOC15(NBIO, 0, mmREMAP_HDP_REG_FLUSH_CNTL,
+		adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL);
+}
+
 static u32 nbio_v2_3_get_rev_id(struct amdgpu_device *adev)
 {
 	u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
@@ -56,10 +66,9 @@ static void nbio_v2_3_hdp_flush(struct amdgpu_device *adev,
 				struct amdgpu_ring *ring)
 {
 	if (!ring || !ring->funcs->emit_wreg)
-		WREG32_SOC15_NO_KIQ(NBIO, 0, mmBIF_BX_PF_HDP_MEM_COHERENCY_FLUSH_CNTL, 0);
+		WREG32_NO_KIQ((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
 	else
-		amdgpu_ring_emit_wreg(ring, SOC15_REG_OFFSET(
-			NBIO, 0, mmBIF_BX_PF_HDP_MEM_COHERENCY_FLUSH_CNTL), 0);
+		amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);
 }
 
 static u32 nbio_v2_3_get_memsize(struct amdgpu_device *adev)
@@ -330,4 +339,5 @@ const struct amdgpu_nbio_funcs nbio_v2_3_funcs = {
 	.ih_control = nbio_v2_3_ih_control,
 	.init_registers = nbio_v2_3_init_registers,
 	.detect_hw_virt = nbio_v2_3_detect_hw_virt,
+	.remap_hdp_registers = nbio_v7_4_remap_hdp_registers,
 };
diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
index b3e7756fcc4b..6699a45b88ec 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -587,8 +587,11 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
 
 static int nv_common_early_init(void *handle)
 {
+#define MMIO_REG_HOLE_OFFSET (0x80000 - PAGE_SIZE)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	adev->rmmio_remap.reg_offset = MMIO_REG_HOLE_OFFSET;
+	adev->rmmio_remap.bus_addr = adev->rmmio_base + MMIO_REG_HOLE_OFFSET;
 	adev->smc_rreg = NULL;
 	adev->smc_wreg = NULL;
 	adev->pcie_rreg = &nv_pcie_rreg;
@@ -714,6 +717,12 @@ static int nv_common_hw_init(void *handle)
 	nv_program_aspm(adev);
 	/* setup nbio registers */
 	adev->nbio.funcs->init_registers(adev);
+	/* remap HDP registers to a hole in mmio space,
+	 * for the purpose of expose those registers
+	 * to process space
+	 */
+	if (adev->nbio.funcs->remap_hdp_registers)
+		adev->nbio.funcs->remap_hdp_registers(adev);
 	/* enable the doorbell aperture */
 	nv_enable_doorbell_aperture(adev, true);
 
-- 
2.17.1

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

  parent reply	other threads:[~2019-09-28  3:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-28  3:41 [PATCH 1/6] drm/amdkfd: Update parameter type of pasid to uint16_t Zhao, Yong
     [not found] ` <20190928034132.28340-1-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
2019-09-28  3:41   ` [PATCH 2/6] drm/amdgpu: Delete useless header file reference Zhao, Yong
2019-09-28  3:41   ` [PATCH 3/6] drm/amdkfd: Delete unnecessary function declarations Zhao, Yong
2019-09-28  3:41   ` [PATCH 4/6] drm/amdkfd: Use array to probe kfd2kgd_calls Zhao, Yong
     [not found]     ` <20190928034132.28340-4-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
2019-09-30 15:42       ` Kuehling, Felix
     [not found]         ` <39dcbd3e-1bb9-8729-6368-0e87fdfcdbd3-5C7GfCeVMHo@public.gmane.org>
2019-09-30 18:04           ` Zhao, Yong
2019-09-28  3:41   ` [PATCH 6/6] drm/amdkfd: Improve KFD IOCTL printing Zhao, Yong
     [not found]     ` <20190928034132.28340-6-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
2019-09-30 15:47       ` Kuehling, Felix
     [not found]         ` <30b9f4d8-0365-27fb-b6b4-ba2d20b9cb81-5C7GfCeVMHo@public.gmane.org>
2019-09-30 18:05           ` Zhao, Yong
2019-09-28  3:41   ` Zhao, Yong [this message]
     [not found]     ` <20190928034132.28340-5-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
2019-09-30 15:57       ` [PATCH 5/6] drm/amdgpu: Add the HDP flush support for Navi Kuehling, Felix
     [not found]         ` <9e4b4889-4937-bb42-d0f9-79766fd87138-5C7GfCeVMHo@public.gmane.org>
2019-09-30 18:08           ` Zhao, Yong
2019-09-30 15:54   ` [PATCH 1/6] drm/amdkfd: Update parameter type of pasid to uint16_t Kuehling, Felix
     [not found]     ` <4674ca17-3d2b-f44a-bf0b-8d17d3b4fe9c-5C7GfCeVMHo@public.gmane.org>
2019-09-30 21:57       ` Zhao, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190928034132.28340-5-Yong.Zhao@amd.com \
    --to=yong.zhao-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.