drm/amd: Add get_fw_version to kfd-->kgd interface
Subsystems (3)
PATCH 1/3 drm/amd: Add get_fw_version to kfd-->kgd interface
From: Alexey Skidanov <[email protected]>
This patch adds a new interface to the kfd-->kgd interface.
The new interface function retrieves the firmware version that is currently in use by the MEC engine. The firmware was uploaded to the MEC engine by the kgd (radeon).
--- drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/include/kgd_kfd_interface.h +3 -0
@@ -137,6 +137,8 @@ struct kgd2kfd_calls {* * @hqd_destroy: Destructs and preempts the queue assigned to that hqd slot. * +* @get_fw_version: Returns FW versions from the header +* * This structure contains function pointers to services that the kgd driver * provides to amdkfd driver. *
@@ -176,6 +178,7 @@ struct kfd2kgd_calls {int (*hqd_destroy)(struct kgd_dev *kgd,uint32_t reset_type,unsigned int timeout,uint32_t pipe_id,uint32_t queue_id); +uint16_t (*get_fw_version)(struct kgd_dev *kgd); }; bool kgd2kfd_init(unsigned interface_version,
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/radeon: Add implementation of get_fw_version
From: Alexey Skidanov <[email protected]>
This patch implements a new interface that was added to the kfd-->kgd interface. The new interface function retrieves the firmware version that is currently in use by the MEC engine. The firmware was uploaded to the MEC engine by the radeon driver.
--- drivers/gpu/drm/radeon/radeon_kfd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/radeon/radeon_kfd.c +23 -0
@@ -28,6 +28,8 @@#include "cikd.h" #include "cik_reg.h" #include "radeon_kfd.h" +#include "radeon_ucode.h" +#include <linux/firmware.h> #define CIK_PIPE_PER_MEC (4)
@@ -49,6 +51,7 @@ static uint64_t get_vmem_size(struct kgd_dev *kgd);static uint64_t get_gpu_clock_counter (struct kgd_dev *kgd);static uint32_t get_max_engine_clock_in_mhz (struct kgd_dev *kgd); +static uint16_t get_fw_version (struct kgd_dev *kgd);/* * Register access functions
@@ -91,6 +94,7 @@ static const struct kfd2kgd_calls kfd2kgd = { .hqd_load = kgd_hqd_load, .hqd_is_occupies = kgd_hqd_is_occupies, .hqd_destroy = kgd_hqd_destroy, + .get_fw_version = get_fw_version };static const struct kgd2kfd_calls *kgd2kfd;
@@ -561,3 +565,22 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,release_queue (kgd);return 0 ; } + +static uint16_t get_fw_version (struct kgd_dev *kgd) +{ +struct radeon_device *rdev; +const struct gfx_firmware_header_v1_0 *hdr; + +BUG_ON (kgd ==NULL ); + + rdev = (struct radeon_device *) kgd; + +BUG_ON (rdev->mec_fw ==NULL ); + + hdr = (const struct gfx_firmware_header_v1_0 *)rdev->mec_fw->data; + +BUG_ON (hdr ==NULL ); + +/* Only 12 bit in use*/ +return hdr->header.ucode_version; +}
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 amdkfd: Display MEC fw version in topology node
In reply to Oded GabbayFrom: Alexey Skidanov <[email protected]>
This patch displays the firmware version of the microcode that is currently running in the MEC.
This is needed for the HSA RT, so it could differentiate its behavior based on fw version. e.g. workarounds for bugs in fw
--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -2
@@ -700,8 +700,6 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, dev->node_props.simd_per_cu);sysfs_show_32bit_prop (buffer,"max_slots_scratch_cu" , dev->node_props.max_slots_scratch_cu); -sysfs_show_32bit_prop (buffer,"engine_id" , - dev->node_props.engine_id);sysfs_show_32bit_prop (buffer,"vendor_id" , dev->node_props.vendor_id); sysfs_show_32bit_prop(buffer, "device_id",
@@ -715,6 +713,10 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, dev->gpu->kgd));sysfs_show_64bit_prop (buffer,"local_mem_size" , kfd2kgd->get_vmem_size (dev->gpu->kgd)); + +sysfs_show_32bit_prop (buffer,"fw_version" , + kfd2kgd->get_fw_version (dev->gpu->kgd)); + } ret = sysfs_show_32bit_prop(buffer, "max_engine_clk_ccompute",
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] drm/radeon: Add implementation of get_fw_version
In reply to Oded GabbayQuoted 43 lines · Oded Gabbay
From: Alexey Skidanov <[email protected]>
This patch implements a new interface that was added to the kfd-->kgd interface. The new interface function retrieves the firmware version that is currently in use by the MEC engine. The firmware was uploaded to the MEC engine by the radeon driver.
Signed-off-by Alexey Skidanov <[email protected]>Reviewed-by Oded Gabbay <[email protected]>--- drivers/gpu/drm/radeon/radeon_kfd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/gpu/drm/radeon/radeon_kfd.c +4
-0@@ -28,6 +28,8 @@#include "cikd.h" #include "cik_reg.h" #include "radeon_kfd.h" +#include "radeon_ucode.h" +#include <linux/firmware.h> #define CIK_PIPE_PER_MEC (4)@@ -49,6 +51,7 @@ static uint64_t get_vmem_size(struct kgd_dev *kgd);static uint64_t get_gpu_clock_counter (struct kgd_dev *kgd);static uint32_t get_max_engine_clock_in_mhz (struct kgd_dev *kgd); +static uint16_t get_fw_version (struct kgd_dev *kgd);/* * Register access functions @@ -91,6 +94,7 @@ static const struct kfd2kgd_calls kfd2kgd = { .hqd_load = kgd_hqd_load, .hqd_is_occupies = kgd_hqd_is_occupies, .hqd_destroy = kgd_hqd_destroy, + .get_fw_version = get_fw_version };static const struct kgd2kfd_calls *kgd2kfd;
drivers/gpu/drm/radeon/radeon_kfd.c static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, · line 569
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_kfd.c +2
-0@@ -561,3 +565,22 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,release_queue (kgd);return 0 ; } + +static uint16_t get_fw_version (struct kgd_dev *kgd)
I think it would be better to call the is get_mec_fw_version or add an engine and/or instance parameter if it need to query other engines (e.g., MEC2 or GFX).
drivers/gpu/drm/radeon/radeon_kfd.c static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, · line 581
Quoted 12 lines
drivers/gpu/drm/radeon/radeon_kfd.c +12
-0+{ +struct radeon_device *rdev; +const struct gfx_firmware_header_v1_0 *hdr; + +BUG_ON (kgd ==NULL ); + + rdev = (struct radeon_device *) kgd; + +BUG_ON (rdev->mec_fw ==NULL ); + + hdr = (const struct gfx_firmware_header_v1_0 *)rdev->mec_fw->data; +
Do you care about the fw version of MEC2?
Alex
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] drm/radeon: Add implementation of get_fw_version
Quoted 42 lines · Alex Deucher
Quoted 41 lines · Oded Gabbay
From: Alexey Skidanov <[email protected]>
This patch implements a new interface that was added to the kfd-->kgd interface. The new interface function retrieves the firmware version that is currently in use by the MEC engine. The firmware was uploaded to the MEC engine by the radeon driver.
Signed-off-by Alexey Skidanov <[email protected]>Reviewed-by Oded Gabbay <[email protected]>--- drivers/gpu/drm/radeon/radeon_kfd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/gpu/drm/radeon/radeon_kfd.c +4
-0@@ -28,6 +28,8 @@#include "cikd.h" #include "cik_reg.h" #include "radeon_kfd.h" +#include "radeon_ucode.h" +#include <linux/firmware.h> #define CIK_PIPE_PER_MEC (4)@@ -49,6 +51,7 @@ static uint64_t get_vmem_size(struct kgd_dev *kgd);static uint64_t get_gpu_clock_counter (struct kgd_dev *kgd);static uint32_t get_max_engine_clock_in_mhz (struct kgd_dev *kgd); +static uint16_t get_fw_version (struct kgd_dev *kgd);/* * Register access functions @@ -91,6 +94,7 @@ static const struct kfd2kgd_calls kfd2kgd = { .hqd_load = kgd_hqd_load, .hqd_is_occupies = kgd_hqd_is_occupies, .hqd_destroy = kgd_hqd_destroy, + .get_fw_version = get_fw_version };
Quoted 12 lines
drivers/gpu/drm/radeon/radeon_kfd.c static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, · line 569
Quoted 7 lines
drivers/gpu/drm/radeon/radeon_kfd.c +2
-0static const struct kgd2kfd_calls *kgd2kfd;@@ -561,3 +565,22 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,release_queue (kgd);return 0 ; } + +static uint16_t get_fw_version (struct kgd_dev *kgd)I think it would be better to call the is
get_mec_fw_versionor add an engine and/or instance parameter if it need to query other engines (e.g., MEC2 or GFX).
Right, I will add the engine parameter.
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_kfd.c +6
-0+{ +struct radeon_device *rdev; +const struct gfx_firmware_header_v1_0 *hdr; + +BUG_ON (kgd ==NULL ); +
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_kfd.c static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, · line 581
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_kfd.c +6
-0+ rdev = (struct radeon_device *) kgd; + +BUG_ON (rdev->mec_fw ==NULL ); + + hdr = (const struct gfx_firmware_header_v1_0 *)rdev->mec_fw->data; +Do you care about the fw version of MEC2?
Not currently, as MEC1 & MEC2 have the same fw version, although we load different fw files to them.
Oded
Quoted 3 lines
Alex
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel