AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Horace Chen <horace.chen@amd.com>,
	Hawking Zhang <Hawking.Zhang@amd.com>
Subject: [PATCH 02/19] drm/amdgpu: add sriov nbio callback structure
Date: Tue, 30 Aug 2022 14:39:55 -0400	[thread overview]
Message-ID: <20220830184012.1825313-2-alexander.deucher@amd.com> (raw)
In-Reply-To: <20220830184012.1825313-1-alexander.deucher@amd.com>

From: Horace Chen <horace.chen@amd.com>

[Why]
under SR-IOV, the nbio doorbell range will be defined by PF. So VF
nbio doorbell range registers will be blocked. It will cause violation
if VF access those registers directly.

[How]
create an nbio_v4_3_sriov_funcs for sriov nbio_v4_3 initialization to
skip the setting for the doorbell range registers.

Signed-off-by: Horace Chen <horace.chen@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c |  5 ++-
 drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c        | 44 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/nbio_v4_3.h        |  1 +
 3 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 5fd56ebc3f6c..854ca8d4505b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -2242,7 +2242,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
 		break;
 	case IP_VERSION(4, 3, 0):
 	case IP_VERSION(4, 3, 1):
-		adev->nbio.funcs = &nbio_v4_3_funcs;
+		if (amdgpu_sriov_vf(adev))
+			adev->nbio.funcs = &nbio_v4_3_sriov_funcs;
+		else
+			adev->nbio.funcs = &nbio_v4_3_funcs;
 		adev->nbio.hdp_flush_reg = &nbio_v4_3_hdp_flush_reg;
 		break;
 	case IP_VERSION(7, 7, 0):
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c
index 982a89f841d5..15eb3658d70e 100644
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c
@@ -488,3 +488,47 @@ const struct amdgpu_nbio_funcs nbio_v4_3_funcs = {
 	.get_rom_offset = nbio_v4_3_get_rom_offset,
 	.program_aspm = nbio_v4_3_program_aspm,
 };
+
+
+static void nbio_v4_3_sriov_ih_doorbell_range(struct amdgpu_device *adev,
+					bool use_doorbell, int doorbell_index)
+{
+}
+
+static void nbio_v4_3_sriov_sdma_doorbell_range(struct amdgpu_device *adev, int instance,
+					  bool use_doorbell, int doorbell_index,
+					  int doorbell_size)
+{
+}
+
+static void nbio_v4_3_sriov_vcn_doorbell_range(struct amdgpu_device *adev, bool use_doorbell,
+					 int doorbell_index, int instance)
+{
+}
+
+static void nbio_v4_3_sriov_gc_doorbell_init(struct amdgpu_device *adev)
+{
+}
+
+const struct amdgpu_nbio_funcs nbio_v4_3_sriov_funcs = {
+	.get_hdp_flush_req_offset = nbio_v4_3_get_hdp_flush_req_offset,
+	.get_hdp_flush_done_offset = nbio_v4_3_get_hdp_flush_done_offset,
+	.get_pcie_index_offset = nbio_v4_3_get_pcie_index_offset,
+	.get_pcie_data_offset = nbio_v4_3_get_pcie_data_offset,
+	.get_rev_id = nbio_v4_3_get_rev_id,
+	.mc_access_enable = nbio_v4_3_mc_access_enable,
+	.get_memsize = nbio_v4_3_get_memsize,
+	.sdma_doorbell_range = nbio_v4_3_sriov_sdma_doorbell_range,
+	.vcn_doorbell_range = nbio_v4_3_sriov_vcn_doorbell_range,
+	.gc_doorbell_init = nbio_v4_3_sriov_gc_doorbell_init,
+	.enable_doorbell_aperture = nbio_v4_3_enable_doorbell_aperture,
+	.enable_doorbell_selfring_aperture = nbio_v4_3_enable_doorbell_selfring_aperture,
+	.ih_doorbell_range = nbio_v4_3_sriov_ih_doorbell_range,
+	.update_medium_grain_clock_gating = nbio_v4_3_update_medium_grain_clock_gating,
+	.update_medium_grain_light_sleep = nbio_v4_3_update_medium_grain_light_sleep,
+	.get_clockgating_state = nbio_v4_3_get_clockgating_state,
+	.ih_control = nbio_v4_3_ih_control,
+	.init_registers = nbio_v4_3_init_registers,
+	.remap_hdp_registers = nbio_v4_3_remap_hdp_registers,
+	.get_rom_offset = nbio_v4_3_get_rom_offset,
+};
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.h b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.h
index ade43661d7a9..711999ceedf4 100644
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.h
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.h
@@ -28,5 +28,6 @@
 
 extern const struct nbio_hdp_flush_reg nbio_v4_3_hdp_flush_reg;
 extern const struct amdgpu_nbio_funcs nbio_v4_3_funcs;
+extern const struct amdgpu_nbio_funcs nbio_v4_3_sriov_funcs;
 
 #endif
-- 
2.37.1


  reply	other threads:[~2022-08-30 18:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 18:39 [PATCH 01/19] drm/amdgpu: add CHIP_IP_DISCOVERY support for virtualization Alex Deucher
2022-08-30 18:39 ` Alex Deucher [this message]
2022-08-30 18:39 ` [PATCH 03/19] drm/amdgpu: add a compute pipe reset for RS64 Alex Deucher
2022-08-30 18:39 ` [PATCH 04/19] drm/amdgpu: enable WPTR_POLL_ENABLE for sriov on sdma_v6_0 Alex Deucher
2022-08-30 18:39 ` [PATCH 05/19] drm/amdgpu: refine virtualization psp fw skip check Alex Deucher
2022-08-30 18:39 ` [PATCH 06/19] drm/amdgpu: sriov remove vcn_4_0 and jpeg_4_0 Alex Deucher
2022-08-30 18:40 ` [PATCH 07/19] drm/amdgpu: Support PSP 13.0.10 on SR-IOV Alex Deucher
2022-08-30 18:40 ` [PATCH 08/19] drm/amdgpu: Use PSP program IH_RB_CNTL registers under SRIOV Alex Deucher
2022-08-30 18:40 ` [PATCH 09/19] drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0 Alex Deucher
2022-08-30 18:40 ` [PATCH 10/19] drm/amdgpu: skip "Issue additional private vm invalidation to MMHUB" on SRIOV Alex Deucher
2022-08-30 18:40 ` [PATCH 11/19] drm/amdgpu: Skip the VRAM base offset " Alex Deucher
2022-08-30 18:40 ` [PATCH 12/19] drm/amdgpu: Skip program SDMA0_SEM_WAIT_FAIL_TIMER_CNTL under SRIOV VF Alex Deucher
2022-08-30 18:40 ` [PATCH 13/19] drm/amdgpu: Use RLCG to program GRBM_GFX_CNTL during full access time Alex Deucher
2022-08-30 18:40 ` [PATCH 14/19] drm/admgpu: Skip CG/PG on SOC21 under SRIOV VF Alex Deucher
2022-08-30 18:40 ` [PATCH 15/19] drm/amd: Skip smu_v13 register irq on " Alex Deucher
2022-08-30 18:40 ` [PATCH 16/19] drm/amdgpu/vcn: Disable CG/PG for SRIOV Alex Deucher
2022-08-30 18:40 ` [PATCH 17/19] drm/amdgpu/vcn: Add vcn/vcn1 in white list to load its firmware under sriov Alex Deucher
2022-08-30 18:40 ` [PATCH 18/19] drm/amdgpu/vcn: Add sriov VCN v4_0 unified queue support Alex Deucher
2022-08-30 18:40 ` [PATCH 19/19] drm/amdgpu/vcn: Add MMSCH v4_0 support for sriov Alex Deucher
2022-08-31  8:05 ` [PATCH 01/19] drm/amdgpu: add CHIP_IP_DISCOVERY support for virtualization Christian König

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=20220830184012.1825313-2-alexander.deucher@amd.com \
    --to=alexander.deucher@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=horace.chen@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