AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Graham Sider <Graham.Sider@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Felix.Kuehling@amd.com, Graham Sider <Graham.Sider@amd.com>
Subject: [PATCH 2/4] drm/amdkfd: add kfd_device_info_init function
Date: Fri, 19 Nov 2021 11:27:58 -0500	[thread overview]
Message-ID: <20211119162800.2111819-2-Graham.Sider@amd.com> (raw)
In-Reply-To: <20211119162800.2111819-1-Graham.Sider@amd.com>

Initializes device_info structs given either asic_type (enum) if GFX
version is less than GFX9, or GC IP version if greater. Also takes in vf
and the target compiler gfx version.

Inclusion/exclusion to certain conditions for certain GC IP versions may
be necessary on npi bringup on a case-by-case basis, but for the most
part should be minimal (e.g. adding one || asic_version == IP_VERSION(X ,X, X) case).

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 58 +++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index e11fc4e20c32..23e35a466cf0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -511,6 +511,64 @@ static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
 
 static int kfd_resume(struct kfd_dev *kfd);
 
+static void kfd_device_info_init(struct kfd_device_info *device_info,
+				 uint32_t asic_version, bool is_soc15, bool vf,
+				 uint32_t gfx_target_version)
+{
+	device_info->max_pasid_bits = 16;
+	device_info->max_no_of_hqd = 24;
+	device_info->num_of_watch_points = 4;
+	device_info->mqd_size_aligned = MQD_SIZE_ALIGNED;
+	device_info->gfx_target_version = gfx_target_version;
+
+	if (is_soc15) {
+		device_info->doorbell_size = 8;
+		device_info->ih_ring_entry_size = 8 * sizeof(uint32_t);
+		device_info->event_interrupt_class = &event_interrupt_class_v9;
+		device_info->supports_cwsr = true;
+
+		if ((asic_version >= IP_VERSION(9, 0, 1)  &&
+		     asic_version <= IP_VERSION(9, 3, 0)) ||
+		     asic_version == IP_VERSION(10, 3, 1) ||
+		     asic_version == IP_VERSION(10, 3, 3))
+			device_info->num_sdma_queues_per_engine = 2;
+		else
+			device_info->num_sdma_queues_per_engine = 8;
+
+		// Navi2x+, Navi1x+
+		if (asic_version >= IP_VERSION(10, 3, 0))
+			device_info->no_atomic_fw_version = 145;
+		else if (asic_version >= IP_VERSION(10, 1, 1))
+			device_info->no_atomic_fw_version = 92;
+
+		// Raven
+		if (asic_version == IP_VERSION(9, 1, 0) ||
+		    asic_version == IP_VERSION(9, 2, 2))
+			device_info->needs_iommu_device = true;
+
+		// Navi1x+
+		if (asic_version >= IP_VERSION(10, 1, 1))
+			device_info->needs_pci_atomics = true;
+	} else {
+		device_info->doorbell_size = 4;
+		device_info->ih_ring_entry_size = 4 * sizeof(uint32_t);
+		device_info->event_interrupt_class = &event_interrupt_class_cik;
+		device_info->num_sdma_queues_per_engine = 2;
+
+		if (asic_version != CHIP_KAVERI &&
+		    asic_version != CHIP_HAWAII &&
+		    asic_version != CHIP_TONGA)
+			device_info->supports_cwsr = true;
+
+		if (asic_version == CHIP_KAVERI ||
+		    asic_version == CHIP_CARRIZO)
+			device_info->needs_iommu_device = true;
+
+		if (asic_version != CHIP_HAWAII && !vf)
+			device_info->needs_pci_atomics = true;
+	}
+}
+
 struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 {
 	struct kfd_dev *kfd;
-- 
2.25.1


  reply	other threads:[~2021-11-19 16:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 16:27 [PATCH 1/4] drm/amdkfd: replace asic_name with amdgpu_asic_name Graham Sider
2021-11-19 16:27 ` Graham Sider [this message]
2021-11-19 18:54   ` [PATCH 2/4] drm/amdkfd: add kfd_device_info_init function Alex Deucher
2021-11-19 19:10     ` Sider, Graham
2021-11-19 16:27 ` [PATCH 3/4] drm/amdkfd: move to dynamic device_info creation Graham Sider
2021-11-19 16:28 ` [PATCH 4/4] drm/amdkfd: remove hardcoded device_info structs Graham Sider
2021-11-19 18:50   ` Alex Deucher

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=20211119162800.2111819-2-Graham.Sider@amd.com \
    --to=graham.sider@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=amd-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox