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
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).
v2: Added parameter of engine type to interface function
--- drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/include/kgd_kfd_interface.h +15 -0
@@ -45,6 +45,17 @@ enum kgd_memory_pool { KGD_POOL_FRAMEBUFFER = 3, }; +enum kgd_engine_type { +KGD_ENGINE_PFP =1 , +KGD_ENGINE_ME , +KGD_ENGINE_CE , +KGD_ENGINE_MEC1 , +KGD_ENGINE_MEC2 , +KGD_ENGINE_RLC , +KGD_ENGINE_SDMA , +KGD_ENGINE_MAX +}; +struct kgd2kfd_shared_resources {/* Bit n == 1 means VMID n is available for KFD. */ unsigned int compute_vmid_bitmap;
@@ -137,6 +148,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 +189,8 @@ 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, +enum kgd_engine_type type); }; 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
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 a specific engine. The firmware was uploaded to the engine by the radeon driver.
v2: Returns the fw version of the specific engine, as passed into the function by a new parameter
--- drivers/gpu/drm/radeon/radeon_kfd.c | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
drivers/gpu/drm/radeon/radeon_kfd.c +53 -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,enum kgd_engine_type type);/* * 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,52 @@ 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,enum kgd_engine_type type) +{ +struct radeon_device *rdev = (struct radeon_device *) kgd; +const union radeon_firmware_header *hdr; + +BUG_ON (kgd ==NULL || rdev->mec_fw ==NULL ); + +switch (type) { +case KGD_ENGINE_PFP : + hdr = (const union radeon_firmware_header *) rdev->pfp_fw->data; +break ; + +case KGD_ENGINE_ME : + hdr = (const union radeon_firmware_header *) rdev->me_fw->data; +break ; + +case KGD_ENGINE_CE : + hdr = (const union radeon_firmware_header *) rdev->ce_fw->data; +break ; + +case KGD_ENGINE_MEC1 : + hdr = (const union radeon_firmware_header *) rdev->mec_fw->data; +break ; + +case KGD_ENGINE_MEC2 : + hdr = (const union radeon_firmware_header *) + rdev->mec2_fw->data; +break ; + +case KGD_ENGINE_RLC : + hdr = (const union radeon_firmware_header *) rdev->rlc_fw->data; +break ; + +case KGD_ENGINE_SDMA : + hdr = (const union radeon_firmware_header *) + rdev->sdma_fw->data; +break ; + +default : +return 0 ; + } + +if (hdr ==NULL ) +return 0 ; + +/* Only 12 bit in use*/ +return hdr->common.ucode_version; +}
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
Quoted 9 lines · Oded Gabbay
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 a specific engine. The firmware was uploaded to the engine by the radeon driver.
v2: Returns the fw version of the specific engine, as passed into the function by a new parameter
Signed-off-by Oded Gabbay <[email protected]>
Quoted 89 lines
--- drivers/gpu/drm/radeon/radeon_kfd.c | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)drivers/gpu/drm/radeon/radeon_kfd.c +53
-1@@ -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,enum kgd_engine_type type);/* * 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,52 @@ 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,enum kgd_engine_type type) +{ +struct radeon_device *rdev = (struct radeon_device *) kgd; +const union radeon_firmware_header *hdr; + +BUG_ON (kgd ==NULL || rdev->mec_fw ==NULL ); + +switch (type) { +case KGD_ENGINE_PFP : + hdr = (const union radeon_firmware_header *) rdev->pfp_fw->data; +break ; + +case KGD_ENGINE_ME : + hdr = (const union radeon_firmware_header *) rdev->me_fw->data; +break ; + +case KGD_ENGINE_CE : + hdr = (const union radeon_firmware_header *) rdev->ce_fw->data; +break ; + +case KGD_ENGINE_MEC1 : + hdr = (const union radeon_firmware_header *) rdev->mec_fw->data; +break ; + +case KGD_ENGINE_MEC2 : + hdr = (const union radeon_firmware_header *) + rdev->mec2_fw->data; +break ; + +case KGD_ENGINE_RLC : + hdr = (const union radeon_firmware_header *) rdev->rlc_fw->data; +break ; + +case KGD_ENGINE_SDMA : + hdr = (const union radeon_firmware_header *) + rdev->sdma_fw->data; +break ; + +default : +return 0 ; + } + +if (hdr ==NULL ) +return 0 ; + +/* Only 12 bit in use*/ +return hdr->common.ucode_version; +} --1.9.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
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 GabbayThis 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
v2: Send the KGD_ENGINE_MEC1 as a parameter to the get_fw_version()
--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +6 -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,12 @@ 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, +KGD_ENGINE_MEC1 )); + } 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
This should be [PATCH v2 x/3] for all three patches. Sorry.
Oded
Quoted 45 lines · Oded Gabbay
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).v2: Added parameter of engine type to interface function
Signed-off-by Oded Gabbay <[email protected]>--- drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/gpu/drm/amd/include/kgd_kfd_interface.h +13
-0@@ -45,6 +45,17 @@ enum kgd_memory_pool { KGD_POOL_FRAMEBUFFER = 3, }; +enum kgd_engine_type { +KGD_ENGINE_PFP =1 , +KGD_ENGINE_ME , +KGD_ENGINE_CE , +KGD_ENGINE_MEC1 , +KGD_ENGINE_MEC2 , +KGD_ENGINE_RLC , +KGD_ENGINE_SDMA , +KGD_ENGINE_MAX +}; +struct kgd2kfd_shared_resources {/* Bit n == 1 means VMID n is available for KFD. */ unsigned int compute_vmid_bitmap;@@ -137,6 +148,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. *
drivers/gpu/drm/amd/include/kgd_kfd_interface.h struct kfd2kgd_calls { · line 196
Quoted 8 lines
drivers/gpu/drm/amd/include/kgd_kfd_interface.h +2
-0@@ -176,6 +189,8 @@ 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, +enum kgd_engine_type type); }; bool kgd2kfd_init(unsigned interface_version,
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Oded Gabbay
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).v2: Added parameter of engine type to interface function
Signed-off-by Oded Gabbay <[email protected]>
For the series:
Quoted 47 lines
--- drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/gpu/drm/amd/include/kgd_kfd_interface.h +15
-1@@ -45,6 +45,17 @@ enum kgd_memory_pool { KGD_POOL_FRAMEBUFFER = 3, }; +enum kgd_engine_type { +KGD_ENGINE_PFP =1 , +KGD_ENGINE_ME , +KGD_ENGINE_CE , +KGD_ENGINE_MEC1 , +KGD_ENGINE_MEC2 , +KGD_ENGINE_RLC , +KGD_ENGINE_SDMA , +KGD_ENGINE_MAX +}; +struct kgd2kfd_shared_resources {/* Bit n == 1 means VMID n is available for KFD. */ unsigned int compute_vmid_bitmap;@@ -137,6 +148,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 +189,8 @@ 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, +enum kgd_engine_type type); }; bool kgd2kfd_init(unsigned interface_version, --1.9.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel