drm/amdgpu: add RAP TA header file
Subsystems (2)
PATCH 1/3 drm/amdgpu: add RAP TA header file
The RAP TA contains tests used to verify if
RAP(Register Access Policy), or otherwise known
as Security Policy is applied correctly
by PSP BL&TOS.
The RAP test is a measure to ensure that we reduce the avenue of complexity and mistakes when dealing with RAP in post-si execution, where debugging failures related to RAP is quite difficult and expensive.
v2: add introduction for RAP TA
--- drivers/gpu/drm/amd/amdgpu/ta_rap_if.h | 84 ++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/ta_rap_if.h
drivers/gpu/drm/amd/amdgpu/ta_rap_if.h new file +84 -0
@@ -0,0 +1,84 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef _TA_RAP_IF_H +#define _TA_RAP_IF_H + +/* Responses have bit 31 set */ +#define RSP_ID_MASK (1U << 31) +#define RSP_ID (cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) + +enum ta_rap_status { +TA_RAP_STATUS__SUCCESS =1 , +TA_RAP_STATUS__ERROR_GENERIC_FAILURE =2 , +TA_RAP_STATUS__ERROR_CMD_NOT_SUPPORTED =3 , +TA_RAP_STATUS__ERROR_INVALID_VALIDATION_METHOD =4 , +TA_RAP_STATUS__ERROR_NULL_POINTER =5 , +TA_RAP_STATUS__ERROR_NOT_INITIALIZED =6 , +TA_RAP_STATUS__ERROR_VALIDATION_FAILED =7 , +TA_RAP_STATUS__ERROR_ASIC_NOT_SUPPORTED =8 , +TA_RAP_STATUS__ERROR_OPERATION_NOT_PERMISSABLE =9 , +TA_RAP_STATUS__ERROR_ALREADY_INIT =10 , +}; + +enum ta_rap_cmd { +TA_CMD_RAP__INITIALIZE =1 , +TA_CMD_RAP__VALIDATE_L0 =2 , +}; + +enum ta_rap_validation_method { +METHOD_A =1 , +}; + +struct ta_rap_cmd_input_data { +uint8_t reserved[8 ]; +}; + +struct ta_rap_cmd_output_data { +uint32_t last_subsection; +uint32_t num_total_validate; +uint32_t num_valid; +uint32_t last_validate_addr; +uint32_t last_validate_val; +uint32_t last_validate_val_exptd; +}; + +union ta_rap_cmd_input { +struct ta_rap_cmd_input_data input; +}; + +union ta_rap_cmd_output { +struct ta_rap_cmd_output_data output; +}; + +struct ta_rap_shared_memory { +uint32_t cmd_id; +uint32_t validation_method_id; +uint32_t resp_id; +enum ta_rap_status rap_status; +union ta_rap_cmd_input rap_in_message; +union ta_rap_cmd_output rap_out_message; +uint8_t reserved[64 ]; +}; + +#endif // #define _TA_RAP_IF_H
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amdgpu: enable RAP TA load
Enable the RAP TA loading path and add RAP test
trigger interface.
v2: fix potential mem leak issue
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 183 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 17 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + 3 files changed, 201 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +183 -0
@@ -1430,6 +1430,168 @@ static int psp_dtm_terminate(struct psp_context *psp) }// DTM end +// RAP start +static int psp_rap_init_shared_buf (struct psp_context *psp) +{ +int ret; + +/* +* Allocate 16k memory aligned to 4k from Frame Buffer (local +* physical) for rap ta <-> Driver +*/ + ret =amdgpu_bo_create_kernel (psp->adev,PSP_RAP_SHARED_MEM_SIZE , +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , + &psp->rap_context.rap_shared_bo, + &psp->rap_context.rap_shared_mc_addr, + &psp->rap_context.rap_shared_buf); + +return ret; +} + +static int psp_rap_load (struct psp_context *psp) +{ +int ret; +struct psp_gfx_cmd_resp *cmd; + + cmd =kzalloc (sizeof (struct psp_gfx_cmd_resp ),GFP_KERNEL ); +if (!cmd) +return -ENOMEM ; + +memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); +memcpy (psp->fw_pri_buf, psp->ta_rap_start_addr, psp->ta_rap_ucode_size); + +psp_prep_ta_load_cmd_buf (cmd, + psp->fw_pri_mc_addr, + psp->ta_rap_ucode_size, + psp->rap_context.rap_shared_mc_addr, +PSP_RAP_SHARED_MEM_SIZE ); + + ret =psp_cmd_submit_buf (psp,NULL , cmd, psp->fence_buf_mc_addr); + +if (!ret) { + psp->rap_context.rap_initialized = true; + psp->rap_context.session_id = cmd->resp.session_id; +mutex_init (&psp->rap_context.mutex); + } + +kfree (cmd); + +return ret; +} + +static int psp_rap_unload (struct psp_context *psp) +{ +int ret; +struct psp_gfx_cmd_resp *cmd; + + cmd =kzalloc (sizeof (struct psp_gfx_cmd_resp ),GFP_KERNEL ); +if (!cmd) +return -ENOMEM ; + +psp_prep_ta_unload_cmd_buf (cmd, psp->rap_context.session_id); + + ret =psp_cmd_submit_buf (psp,NULL , cmd, psp->fence_buf_mc_addr); + +kfree (cmd); + +return ret; +} + +static int psp_rap_initialize (struct psp_context *psp) +{ +int ret; + +/* +* TODO: bypass the initialize in sriov for now +*/ +if (amdgpu_sriov_vf (psp->adev)) +return 0 ; + +if (!psp->adev->psp.ta_rap_ucode_size || + !psp->adev->psp.ta_rap_start_addr) { +dev_info (psp->adev->dev,"RAP: optional rap ta ucode is not available\n" ); +return 0 ; + } + +if (!psp->rap_context.rap_initialized) { + ret =psp_rap_init_shared_buf (psp); +if (ret) +return ret; + } + + ret =psp_rap_load (psp); +if (ret) +return ret; + + ret =psp_rap_invoke (psp,TA_CMD_RAP__INITIALIZE ); +if (ret !=TA_RAP_STATUS__SUCCESS ) { +psp_rap_unload (psp); + +amdgpu_bo_free_kernel (&psp->rap_context.rap_shared_bo, + &psp->rap_context.rap_shared_mc_addr, + &psp->rap_context.rap_shared_buf); + + psp->rap_context.rap_initialized = false; + +dev_warn (psp->adev->dev,"RAP TA initialize fail.\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static int psp_rap_terminate (struct psp_context *psp) +{ +int ret; + +if (!psp->rap_context.rap_initialized) +return 0 ; + + ret =psp_rap_unload (psp); + + psp->rap_context.rap_initialized = false; + +/* free rap shared memory */ +amdgpu_bo_free_kernel (&psp->rap_context.rap_shared_bo, + &psp->rap_context.rap_shared_mc_addr, + &psp->rap_context.rap_shared_buf); + +return ret; +} + +int psp_rap_invoke (struct psp_context *psp,uint32_t ta_cmd_id) +{ +struct ta_rap_shared_memory *rap_cmd; +int ret; + +if (!psp->rap_context.rap_initialized) +return -EINVAL ; + +if (ta_cmd_id !=TA_CMD_RAP__INITIALIZE && + ta_cmd_id !=TA_CMD_RAP__VALIDATE_L0 ) +return -EINVAL ; + +mutex_lock (&psp->rap_context.mutex); + + rap_cmd = (struct ta_rap_shared_memory *) + psp->rap_context.rap_shared_buf; +memset (rap_cmd,0 ,sizeof (struct ta_rap_shared_memory )); + + rap_cmd->cmd_id = ta_cmd_id; + rap_cmd->validation_method_id =METHOD_A ; + + ret =psp_ta_invoke (psp, rap_cmd->cmd_id, psp->rap_context.session_id); +if (ret) { +mutex_unlock (&psp->rap_context.mutex); +return ret; + } + +mutex_unlock (&psp->rap_context.mutex); + +return rap_cmd->rap_status; +} +// RAP end +static int psp_hw_start (struct psp_context *psp) {struct amdgpu_device *adev = psp->adev;
@@ -1892,6 +2054,11 @@ static int psp_load_fw(struct amdgpu_device *adev)if (ret)dev_err (psp->adev->dev,"DTM: Failed to initialize DTM\n" ); + + ret =psp_rap_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"RAP: Failed to initialize RAP\n" ); }return 0 ;
@@ -1942,6 +2109,7 @@ static int psp_hw_fini(void *handle)if (psp->adev->psp.ta_fw) {psp_ras_terminate (psp); +psp_rap_terminate (psp);psp_dtm_terminate (psp);psp_hdcp_terminate (psp); }
@@ -2000,6 +2168,11 @@ static int psp_suspend(void *handle)DRM_ERROR ("Failed to terminate dtm ta\n" );return ret; } + ret =psp_rap_terminate (psp); +if (ret) { +DRM_ERROR ("Failed to terminate rap ta\n" ); +return ret; + } } ret =psp_asd_unload (psp);
@@ -2078,6 +2251,11 @@ static int psp_resume(void *handle)if (ret)dev_err (psp->adev->dev,"DTM: Failed to initialize DTM\n" ); + + ret =psp_rap_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"RAP: Failed to initialize RAP\n" ); }mutex_unlock (&adev->firmware.mutex);
@@ -2343,6 +2521,11 @@ int parse_ta_bin_descriptor(struct psp_context *psp, psp->ta_dtm_ucode_size =le32_to_cpu (desc->size_bytes); psp->ta_dtm_start_addr = ucode_start_addr;break ; +case TA_FW_TYPE_PSP_RAP : + psp->ta_rap_ucode_version =le32_to_cpu (desc->fw_version); + psp->ta_rap_ucode_size =le32_to_cpu (desc->size_bytes); + psp->ta_rap_start_addr = ucode_start_addr; +break ;default :dev_warn (psp->adev->dev,"Unsupported TA type: %d\n" , desc->fw_type);break ;
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +17 -0
@@ -29,6 +29,7 @@#include "psp_gfx_if.h" #include "ta_xgmi_if.h" #include "ta_ras_if.h" +#include "ta_rap_if.h" #define PSP_FENCE_BUFFER_SIZE 0x1000#define PSP_CMD_BUFFER_SIZE 0x1000
@@ -38,6 +39,7 @@#define PSP_TMR_SIZE 0x400000#define PSP_HDCP_SHARED_MEM_SIZE 0x4000#define PSP_DTM_SHARED_MEM_SIZE 0x4000 +#define PSP_RAP_SHARED_MEM_SIZE 0x4000#define PSP_SHARED_MEM_SIZE 0x4000struct psp_context ;
@@ -159,6 +161,15 @@ struct psp_dtm_context {struct mutex mutex; }; +struct psp_rap_context { +bool rap_initialized; +uint32_t session_id; +struct amdgpu_bo *rap_shared_bo; +uint64_t rap_shared_mc_addr; +void *rap_shared_buf; +struct mutex mutex; +}; +#define MEM_TRAIN_SYSTEM_SIGNATURE 0x54534942#define GDDR6_MEM_TRAINING_DATA_SIZE_IN_BYTES 0x1000#define GDDR6_MEM_TRAINING_OFFSET 0x8000
@@ -277,11 +288,16 @@ struct psp_contextuint32_t ta_dtm_ucode_size;uint8_t *ta_dtm_start_addr; +uint32_t ta_rap_ucode_version; +uint32_t ta_rap_ucode_size; +uint8_t *ta_rap_start_addr; +struct psp_asd_context asd_context;struct psp_xgmi_context xgmi_context;struct psp_ras_context ras;struct psp_hdcp_context hdcp_context;struct psp_dtm_context dtm_context; +struct psp_rap_context rap_context;struct mutex mutex;struct psp_memory_training_context mem_train_ctx; };
@@ -357,6 +373,7 @@ int psp_ras_trigger_error(struct psp_context *psp,int psp_hdcp_invoke (struct psp_context *psp,uint32_t ta_cmd_id);int psp_dtm_invoke (struct psp_context *psp,uint32_t ta_cmd_id); +int psp_rap_invoke (struct psp_context *psp,uint32_t ta_cmd_id);int psp_rlc_autoload_start (struct psp_context *psp);
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 -0
@@ -131,6 +131,7 @@ enum ta_fw_type {TA_FW_TYPE_PSP_RAS ,TA_FW_TYPE_PSP_HDCP ,TA_FW_TYPE_PSP_DTM , + TA_FW_TYPE_PSP_RAP, }; struct ta_fw_bin_desc {
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu: add debugfs interface for RAP test
In reply to Wenhui ShengAfter amdgpu driver loading successfully, we can use RAP debugfs interface <debugfs_dir>/dri/xxx/rap_test to trigger RAP test.
Currently only L0 validate test is supported.
v2: refine amdgpu_rap.h
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c | 127 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h | 28 +++++ 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -55,7 +55,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \ amdgpu_gmc.o amdgpu_mmhub.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \ - amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o + amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -0
@@ -34,6 +34,7 @@#include "amdgpu_pm.h" #include "amdgpu_dm_debugfs.h" #include "amdgpu_ras.h" +#include "amdgpu_rap.h" /** * amdgpu_debugfs_add_files - Add simple debugfs entries
@@ -1623,6 +1624,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)amdgpu_debugfs_autodump_init (adev); +amdgpu_rap_debugfs_init (adev); +return amdgpu_debugfs_add_files (adev, amdgpu_debugfs_list,ARRAY_SIZE (amdgpu_debugfs_list)); }
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c new file +127 -0
127 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* +*/ +#ifndef _AMDGPU_RAP_H +#define _AMDGPU_RAP_H + +void amdgpu_rap_debugfs_init (struct amdgpu_device *adev); +#endif
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/3] drm/amdgpu: add debugfs interface for RAP test
[AMD Public Use]
One comment inline, please check.
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenhui Sheng
Sent: Tuesday, August 11, 2020 11:04 AM
To: [email protected]
Cc: Clements, John <[email protected]>; Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: add debugfs interface for RAP test
After amdgpu driver loading successfully, we can use RAP debugfs interface <debugfs_dir>/dri/xxx/rap_test to trigger RAP test.
Currently only L0 validate test is supported.
v2: refine amdgpu_rap.h
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c | 127 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h | 28 +++++ 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -55,7 +55,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \ amdgpu_gmc.o amdgpu_mmhub.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \ - amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o + amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -0
@@ -34,6 +34,7 @@#include "amdgpu_pm.h" #include "amdgpu_dm_debugfs.h" #include "amdgpu_ras.h" +#include "amdgpu_rap.h" /** * amdgpu_debugfs_add_files - Add simple debugfs entries @@ -1623,6 +1624,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
amdgpu_debugfs_autodump_init(adev);
+ amdgpu_rap_debugfs_init(adev);
+
return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
ARRAY_SIZE(amdgpu_debugfs_list));
}
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c new file +127 -0
127 lines not on this page · raw message
+void amdgpu_rap_debugfs_init(struct amdgpu_device *adev) { #if
+defined(CONFIG_DEBUG_FS)
+ struct drm_minor *minor = adev->ddev->primary;
+
+ if (!adev->psp.rap_context.rap_initialized)
+ return;
+
+ debugfs_create_file("rap_test", S_IWUGO | S_IRUGO, minor->debugfs_root,
+ adev, &amdgpu_rap_debugfs_ops);
[Guchun]I believe S_IWUGO would be complained by checkpatch.pl if running it on top of your modifications, as it's one world writable permission. Perhaps, we should use S_IWUSR | S_IRUGO.
+#endif
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person +obtaining a +* copy of this software and associated documentation files (the +"Software"), +* to deal in the Software without restriction, including without +limitation +* the rights to use, copy, modify, merge, publish, distribute, +sublicense, +* and/or sell copies of the Software, and to permit persons to whom +the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, +DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ */
+#ifndef _AMDGPU_RAP_H
+#define _AMDGPU_RAP_H
+
+void amdgpu_rap_debugfs_init(struct amdgpu_device *adev); #endif --
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cguchun.chen%40amd.com%7C900c01aafb0c4fd363fa08d83da33e49%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637327118636879081&sdata=OwEZNbL9khBXRmIPu714WAtEJ5bvR4nf2XU7IrsIatc%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/3] drm/amdgpu: add debugfs interface for RAP test
[AMD Public Use]
Hi Gunchun,
Thanks for pointing this out, for rap_test file node, I thought I need to use the same file mode as ras previously, it seems that I'm wrong, for this rap_test file node, I think only S_IWUSR is enough, what's your opinion?
Brs
Wenhui
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Tuesday, August 11, 2020 11:33 AM
To: Sheng, Wenhui <[email protected]>; [email protected]
Cc: Clements, John <[email protected]>; Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 3/3] drm/amdgpu: add debugfs interface for RAP test
[AMD Public Use]
One comment inline, please check.
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenhui Sheng
Sent: Tuesday, August 11, 2020 11:04 AM
To: [email protected]
Cc: Clements, John <[email protected]>; Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: add debugfs interface for RAP test
After amdgpu driver loading successfully, we can use RAP debugfs interface <debugfs_dir>/dri/xxx/rap_test to trigger RAP test.
Currently only L0 validate test is supported.
v2: refine amdgpu_rap.h
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c | 127 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h | 28 +++++ 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -55,7 +55,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \ amdgpu_gmc.o amdgpu_mmhub.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \ - amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o + amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -0
@@ -34,6 +34,7 @@#include "amdgpu_pm.h" #include "amdgpu_dm_debugfs.h" #include "amdgpu_ras.h" +#include "amdgpu_rap.h" /** * amdgpu_debugfs_add_files - Add simple debugfs entries @@ -1623,6 +1624,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
amdgpu_debugfs_autodump_init(adev);
+ amdgpu_rap_debugfs_init(adev);
+
return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
ARRAY_SIZE(amdgpu_debugfs_list));
}
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c new file +127 -0
127 lines not on this page · raw message
+void amdgpu_rap_debugfs_init(struct amdgpu_device *adev) { #if
+defined(CONFIG_DEBUG_FS)
+ struct drm_minor *minor = adev->ddev->primary;
+
+ if (!adev->psp.rap_context.rap_initialized)
+ return;
+
+ debugfs_create_file("rap_test", S_IWUGO | S_IRUGO, minor->debugfs_root,
+ adev, &amdgpu_rap_debugfs_ops);
[Guchun]I believe S_IWUGO would be complained by checkpatch.pl if running it on top of your modifications, as it's one world writable permission. Perhaps, we should use S_IWUSR | S_IRUGO.
+#endif
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person +obtaining a +* copy of this software and associated documentation files (the +"Software"), +* to deal in the Software without restriction, including without +limitation +* the rights to use, copy, modify, merge, publish, distribute, +sublicense, +* and/or sell copies of the Software, and to permit persons to whom +the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, +DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ */
+#ifndef _AMDGPU_RAP_H
+#define _AMDGPU_RAP_H
+
+void amdgpu_rap_debugfs_init(struct amdgpu_device *adev); #endif --
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cguchun.chen%40amd.com%7C900c01aafb0c4fd363fa08d83da33e49%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637327118636879081&sdata=OwEZNbL9khBXRmIPu714WAtEJ5bvR4nf2XU7IrsIatc%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx