AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Liu ChengZhe <ChengZhe.Liu@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: "Jack Xiao" <Jack.Xiao@amd.com>, "Feifei Xu" <Feifei.Xu@amd.com>,
	"Kevin Wang" <Kevin1.Wang@amd.com>,
	"Liu ChengZhe" <ChengZhe.Liu@amd.com>,
	"Tuikov Luben" <Luben.Tuikov@amd.com>,
	"Deucher Alexander" <Alexander.Deucher@amd.com>,
	"Xiaojie Yuan" <xiaojie.yuan@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Hawking Zhang" <Hawking.Zhang@amd.com>
Subject: [PATCH] drm/amdgpu: Skip some registers config for SRIOV
Date: Thu, 6 Aug 2020 15:40:36 +0800	[thread overview]
Message-ID: <20200806074036.404227-1-ChengZhe.Liu@amd.com> (raw)

For VF, registers L2_CNTL, L2_CONTEXT1_IDENTITY_APERTURE
L2_PROTECTION_FAULT_CNTL are not accesible, skip the
configuration for them in SRIOV mode.

Signed-off-by: Liu ChengZhe <ChengZhe.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c | 12 ++++++++++--
 drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c  | 12 ++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
index 1f6112b7fa49..6b96f45fde2a 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
@@ -330,10 +330,13 @@ int gfxhub_v2_1_gart_enable(struct amdgpu_device *adev)
 	gfxhub_v2_1_init_gart_aperture_regs(adev);
 	gfxhub_v2_1_init_system_aperture_regs(adev);
 	gfxhub_v2_1_init_tlb_regs(adev);
-	gfxhub_v2_1_init_cache_regs(adev);
+	if (!amdgpu_sriov_vf(adev))
+		gfxhub_v2_1_init_cache_regs(adev);
 
 	gfxhub_v2_1_enable_system_domain(adev);
-	gfxhub_v2_1_disable_identity_aperture(adev);
+	if (!amdgpu_sriov_vf(adev))
+		gfxhub_v2_1_disable_identity_aperture(adev);
+
 	gfxhub_v2_1_setup_vmid_config(adev);
 	gfxhub_v2_1_program_invalidation(adev);
 
@@ -372,7 +375,12 @@ void gfxhub_v2_1_gart_disable(struct amdgpu_device *adev)
 void gfxhub_v2_1_set_fault_enable_default(struct amdgpu_device *adev,
 					  bool value)
 {
+	/*These regs are not accessible for VF, PF will program in SRIOV */
+	if (amdgpu_sriov_vf(adev))
+		return;
+
 	u32 tmp;
+
 	tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL);
 	tmp = REG_SET_FIELD(tmp, GCVM_L2_PROTECTION_FAULT_CNTL,
 			    RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
index d83912901f73..9cfde9b81600 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
@@ -321,10 +321,13 @@ int mmhub_v2_0_gart_enable(struct amdgpu_device *adev)
 	mmhub_v2_0_init_gart_aperture_regs(adev);
 	mmhub_v2_0_init_system_aperture_regs(adev);
 	mmhub_v2_0_init_tlb_regs(adev);
-	mmhub_v2_0_init_cache_regs(adev);
+	if (!amdgpu_sriov_vf(adev))
+		mmhub_v2_0_init_cache_regs(adev);
 
 	mmhub_v2_0_enable_system_domain(adev);
-	mmhub_v2_0_disable_identity_aperture(adev);
+	if (!amdgpu_sriov_vf(adev))
+		mmhub_v2_0_disable_identity_aperture(adev);
+
 	mmhub_v2_0_setup_vmid_config(adev);
 	mmhub_v2_0_program_invalidation(adev);
 
@@ -364,7 +367,12 @@ void mmhub_v2_0_gart_disable(struct amdgpu_device *adev)
  */
 void mmhub_v2_0_set_fault_enable_default(struct amdgpu_device *adev, bool value)
 {
+	/*These regs are not accessible for VF, PF will program in SRIOV */
+	if (amdgpu_sriov_vf(adev))
+		return;
+
 	u32 tmp;
+
 	tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_PROTECTION_FAULT_CNTL);
 	tmp = REG_SET_FIELD(tmp, MMVM_L2_PROTECTION_FAULT_CNTL,
 			    RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
-- 
2.25.1

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

             reply	other threads:[~2020-08-06 11:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  7:40 Liu ChengZhe [this message]
2020-08-06 19:46 ` [PATCH] drm/amdgpu: Skip some registers config for SRIOV Luben Tuikov
  -- strict thread matches above, loose matches on Subject: below --
2020-08-07  8:48 Liu ChengZhe
2020-08-08  1:29 ` Luben Tuikov

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=20200806074036.404227-1-ChengZhe.Liu@amd.com \
    --to=chengzhe.liu@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Feifei.Xu@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Jack.Xiao@amd.com \
    --cc=Kevin1.Wang@amd.com \
    --cc=Luben.Tuikov@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=xiaojie.yuan@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox