add vbios info query
PATCH 1/1 add vbios info query
--- src/app/CMakeLists.txt | 1 + src/app/main.c | 8 +++++ src/app/vbios.c | 58 ++++++++++++++++++++++++++++++ src/lib/lowlevel/linux/query_drm.c | 11 ++++++ src/umr.h | 15 ++++++++ src/umrapp.h | 1 + 6 files changed, 94 insertions(+) create mode 100644 src/app/vbios.c
src/app/CMakeLists.txt +1 -0
@@ -35,6 +35,7 @@ add_library(umrapp STATIC pp_table.c navi10_ppt.c read_metrics.c + vbios.c ${GUI_SOURCE} )
src/app/main.c +8 -0
@@ -825,6 +825,11 @@ int main(int argc, char **argv) asic =get_asic ();ih_self_test (asic);#endif + }else if (!strcmp (argv[i],"--vbios_info" ) || !strcmp (argv[i],"-vi" )) { +if (!asic) + asic =get_asic (); +if (umr_print_vbios_info (asic) !=0 ) +fprintf (stderr,"[ERROR]: Cannot print vbios info.\n" ); }else if (!strcmp (argv[i],"--help" ) || !strcmp (argv[i],"-h" )) {printf ("User Mode Register debugger v%s for AMDGPU devices (build: %s [%s]), Copyright (c) 2021, AMD Inc.\n" "\n*** Device Selection ***\n"
@@ -951,6 +956,9 @@ printf("\n\t\tPrint the GPU metrics table for the device." "\n\t--power, -p \n\t\tRead the conetent of clocks, temperature, gpu loading at runtime" "\n\t\toptions 'use_colour' to colourize output \n"); +printf ( +"\n*** Video BIOS Information ***\n" +"\n\t--vbios_info, -vi \n\t\tPrint Video BIOS information\n" );#if UMR_GUI printf(
src/app/vbios.c new file +58 -0
59 lines not on this page · raw message
src/lib/lowlevel/linux/query_drm.c +11 -0
@@ -49,7 +49,18 @@ int umr_query_drm(struct umr_asic *asic, int field, void *ret, int size) inf.return_size = size; inf.query = field; return ioctl(asic->fd.drm, DRM_IOC(DRM_IOC_WRITE, DRM_IOCTL_BASE, DRM_COMMAND_BASE + DRM_AMDGPU_INFO, sizeof(inf)), &inf); +} +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type,void *ret,int size) +{ +struct drm_amdgpu_info inf; + +memset (&inf,0 ,sizeof inf); + inf.return_pointer = (uintptr_t )ret; + inf.return_size = size; + inf.query = field; + inf.vbios_info.type = type; +return ioctl (asic->fd.drm,DRM_IOC (DRM_IOC_WRITE ,DRM_IOCTL_BASE ,DRM_COMMAND_BASE +DRM_AMDGPU_INFO ,sizeof (inf)), &inf); }#else
src/umr.h +15 -0
@@ -973,6 +973,7 @@ void umr_free_asic(struct umr_asic *asic);void umr_free_maps (struct umr_asic *asic);void umr_close_asic (struct umr_asic *asic);// call this to close a fully open asic int umr_query_drm (struct umr_asic *asic,int field,void *ret,int size); +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type,void *ret,int size);void umr_enumerate_devices (void );int umr_update (struct umr_asic *asic,char *script);int umr_update_string (struct umr_asic *asic,char *sdata);
@@ -1349,6 +1350,20 @@ struct umr_soc15_database {struct umr_soc15_database *next; }; +// vbios +struct umr_vbios_info { +uint8_t name[64 ]; +uint32_t dbdf; +uint8_t vbios_pn[64 ]; +uint32_t version; +uint8_t date[32 ]; +uint64_t serial; +uint32_t dev_id; +uint32_t rev_id; +uint32_t sub_dev_id; +uint32_t sub_ved_id; +}; +FILE *umr_database_open (char *path,char *filename);struct umr_soc15_database *umr_database_read_soc15 (char *path,char *filename);void umr_database_free_soc15 (struct umr_soc15_database *soc15);
src/umrapp.h +1 -0
@@ -57,5 +57,6 @@ void umr_clock_scan(struct umr_asic *asic, const char* clock_name);void umr_clock_manual (struct umr_asic *asic,const char * clock_name,void * value);int umr_print_pp_table (struct umr_asic *asic,const char * param);int umr_print_gpu_metrics (struct umr_asic *asic); +int umr_print_vbios_info (struct umr_asic *asic);void run_server_loop (const char *url,struct umr_asic * asic);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Hi Tom,
Can you help review & merge this patch to bring vbios IOCTL usage in UMR back? The patch is also attached.
Thanks in advance,
Jiawei
-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Wednesday, May 12, 2021 11:35 AM
To: StDenis, Tom <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] add vbios info query
--- src/app/CMakeLists.txt | 1 + src/app/main.c | 8 +++++ src/app/vbios.c | 58 ++++++++++++++++++++++++++++++ src/lib/lowlevel/linux/query_drm.c | 11 ++++++ src/umr.h | 15 ++++++++ src/umrapp.h | 1 + 6 files changed, 94 insertions(+) create mode 100644 src/app/vbios.c
src/app/CMakeLists.txt +1 -0
@@ -35,6 +35,7 @@ add_library(umrapp STATIC pp_table.c navi10_ppt.c read_metrics.c + vbios.c ${GUI_SOURCE} )
src/app/main.c +8 -0
@@ -825,6 +825,11 @@ int main(int argc, char **argv) asic =get_asic ();ih_self_test (asic);#endif + }else if (!strcmp (argv[i],"--vbios_info" ) || !strcmp (argv[i],"-vi" )) { +if (!asic) + asic =get_asic (); +if (umr_print_vbios_info (asic) !=0 ) +fprintf (stderr,"[ERROR]: Cannot print vbios info.\n" ); }else if (!strcmp (argv[i],"--help" ) || !strcmp (argv[i],"-h" )) {printf ("User Mode Register debugger v%s for AMDGPU devices (build: %s [%s]), Copyright (c) 2021, AMD Inc.\n" "\n*** Device Selection ***\n"
@@ -951,6 +956,9 @@ printf("\n\t\tPrint the GPU metrics table for the device." "\n\t--power, -p \n\t\tRead the conetent of clocks, temperature, gpu loading at runtime" "\n\t\toptions 'use_colour' to colourize output \n"); +printf ( +"\n*** Video BIOS Information ***\n" +"\n\t--vbios_info, -vi \n\t\tPrint Video BIOS information\n" );#if UMR_GUI printf(
src/app/vbios.c new file +58 -0
58 lines not on this page · raw message
+ printf("vbios version : %d\n", vbios_info.version);
+ printf("vbios date : %s\n", vbios_info.date);
+ printf("vbios serial : %lld\n", vbios_info.serial);
+ printf("vbios dev_id : 0x%x\n", vbios_info.dev_id);
+ printf("vbios rev_id : 0x%x\n", vbios_info.rev_id);
+ printf("vbios sub_dev_id : 0x%x\n", vbios_info.sub_dev_id);
+ printf("vbios sub_ved_id : 0x%x\n", vbios_info.sub_ved_id);+
+ close(asic->fd.drm);
+ return 0;
+}
\ No newline at end of file
src/lib/lowlevel/linux/query_drm.c +12 -0
@@ -49,7 +49,18 @@ int umr_query_drm(struct umr_asic *asic, int field, void *ret, int size) inf.return_size = size; inf.query = field;return ioctl (asic->fd.drm,DRM_IOC (DRM_IOC_WRITE ,DRM_IOCTL_BASE ,DRM_COMMAND_BASE +DRM_AMDGPU_INFO ,sizeof (inf)), &inf); +} +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type, +void *ret,int size) { +struct drm_amdgpu_info inf; + +memset (&inf,0 ,sizeof inf); + inf.return_pointer = (uintptr_t )ret; + inf.return_size = size; + inf.query = field; + inf.vbios_info.type = type; +return ioctl (asic->fd.drm,DRM_IOC (DRM_IOC_WRITE ,DRM_IOCTL_BASE , +DRM_COMMAND_BASE +DRM_AMDGPU_INFO ,sizeof (inf)), &inf); }
#else
src/umr.h +2 -0
@@ -973,6 +973,7 @@ void umr_free_asic(struct umr_asic *asic); void umr_free_maps(struct umr_asic *asic); void umr_close_asic(struct umr_asic *asic); // call this to close a fully open asic int umr_query_drm(struct umr_asic *asic, int field, void *ret, int size); +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type, +void *ret,int size);void umr_enumerate_devices (void ); int umr_update(struct umr_asic *asic, char *script); int umr_update_string(struct umr_asic *asic, char *sdata); @@ -1349,6 +1350,20 @@ struct umr_soc15_database {struct umr_soc15_database *next; };
+// vbios
+struct umr_vbios_info {
+ uint8_t name[64];
+ uint32_t dbdf;
+ uint8_t vbios_pn[64];
+ uint32_t version;
+ uint8_t date[32];
+ uint64_t serial;
+ uint32_t dev_id;
+ uint32_t rev_id;
+ uint32_t sub_dev_id;
+ uint32_t sub_ved_id;
+};
+
FILE *umr_database_open(char *path, char *filename); struct umr_soc15_database *umr_database_read_soc15(char *path, char *filename); void umr_database_free_soc15(struct umr_soc15_database *soc15); diff --git a/src/umrapp.h b/src/umrapp.h index 14457fe..1336e07 100644
src/umrapp.h +1 -1
@@ -57,5 +57,6 @@ void umr_clock_scan(struct umr_asic *asic, const char* clock_name); void umr_clock_manual(struct umr_asic *asic, const char* clock_name, void* value); int umr_print_pp_table(struct umr_asic *asic, const char* param); int umr_print_gpu_metrics(struct umr_asic *asic); +int umr_print_vbios_info (struct umr_asic *asic);void run_server_loop (const char *url,struct umr_asic * asic); --
2.17.1
From 636698d457abf602019ee0ad60e8681e6723f7f5 Mon Sep 17 00:00:00 2001
From: Jiawei Gu <[email protected]>
Date: Wed, 12 May 2021 11:30:56 +0800
Subject: [PATCH] add vbios info query
--- src/app/CMakeLists.txt | 1 + src/app/main.c | 8 +++++ src/app/vbios.c | 58 ++++++++++++++++++++++++++++++ src/lib/lowlevel/linux/query_drm.c | 11 ++++++ src/umr.h | 15 ++++++++ src/umrapp.h | 1 + 6 files changed, 94 insertions(+) create mode 100644 src/app/vbios.c
src/app/CMakeLists.txt +1 -0
@@ -35,6 +35,7 @@ add_library(umrapp STATIC pp_table.c navi10_ppt.c read_metrics.c + vbios.c ${GUI_SOURCE} )
src/app/main.c +8 -0
@@ -825,6 +825,11 @@ int main(int argc, char **argv) asic =get_asic ();ih_self_test (asic);#endif + }else if (!strcmp (argv[i],"--vbios_info" ) || !strcmp (argv[i],"-vi" )) { +if (!asic) + asic =get_asic (); +if (umr_print_vbios_info (asic) !=0 ) +fprintf (stderr,"[ERROR]: Cannot print vbios info.\n" ); }else if (!strcmp (argv[i],"--help" ) || !strcmp (argv[i],"-h" )) {printf ("User Mode Register debugger v%s for AMDGPU devices (build: %s [%s]), Copyright (c) 2021, AMD Inc.\n" "\n*** Device Selection ***\n"
@@ -951,6 +956,9 @@ printf("\n\t\tPrint the GPU metrics table for the device." "\n\t--power, -p \n\t\tRead the conetent of clocks, temperature, gpu loading at runtime" "\n\t\toptions 'use_colour' to colourize output \n"); +printf ( +"\n*** Video BIOS Information ***\n" +"\n\t--vbios_info, -vi \n\t\tPrint Video BIOS information\n" );#if UMR_GUI printf(
src/app/vbios.c new file +58 -0
59 lines not on this page · raw message
src/lib/lowlevel/linux/query_drm.c +11 -0
@@ -49,7 +49,18 @@ int umr_query_drm(struct umr_asic *asic, int field, void *ret, int size) inf.return_size = size; inf.query = field; return ioctl(asic->fd.drm, DRM_IOC(DRM_IOC_WRITE, DRM_IOCTL_BASE, DRM_COMMAND_BASE + DRM_AMDGPU_INFO, sizeof(inf)), &inf); +} +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type,void *ret,int size) +{ +struct drm_amdgpu_info inf; + +memset (&inf,0 ,sizeof inf); + inf.return_pointer = (uintptr_t )ret; + inf.return_size = size; + inf.query = field; + inf.vbios_info.type = type; +return ioctl (asic->fd.drm,DRM_IOC (DRM_IOC_WRITE ,DRM_IOCTL_BASE ,DRM_COMMAND_BASE +DRM_AMDGPU_INFO ,sizeof (inf)), &inf); }#else
src/umr.h +15 -0
@@ -973,6 +973,7 @@ void umr_free_asic(struct umr_asic *asic);void umr_free_maps (struct umr_asic *asic);void umr_close_asic (struct umr_asic *asic);// call this to close a fully open asic int umr_query_drm (struct umr_asic *asic,int field,void *ret,int size); +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type,void *ret,int size);void umr_enumerate_devices (void );int umr_update (struct umr_asic *asic,char *script);int umr_update_string (struct umr_asic *asic,char *sdata);
@@ -1349,6 +1350,20 @@ struct umr_soc15_database {struct umr_soc15_database *next; }; +// vbios +struct umr_vbios_info { +uint8_t name[64 ]; +uint32_t dbdf; +uint8_t vbios_pn[64 ]; +uint32_t version; +uint8_t date[32 ]; +uint64_t serial; +uint32_t dev_id; +uint32_t rev_id; +uint32_t sub_dev_id; +uint32_t sub_ved_id; +}; +FILE *umr_database_open (char *path,char *filename);struct umr_soc15_database *umr_database_read_soc15 (char *path,char *filename);void umr_database_free_soc15 (struct umr_soc15_database *soc15);
src/umrapp.h +1 -0
@@ -57,5 +57,6 @@ void umr_clock_scan(struct umr_asic *asic, const char* clock_name);void umr_clock_manual (struct umr_asic *asic,const char * clock_name,void * value);int umr_print_pp_table (struct umr_asic *asic,const char * param);int umr_print_gpu_metrics (struct umr_asic *asic); +int umr_print_vbios_info (struct umr_asic *asic);void run_server_loop (const char *url,struct umr_asic * asic);
Signature · 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 7 lines · JiaWei (Will)
[AMD Official Use Only - Internal Distribution Only]
Hi Tom,
Can you help review & merge this patch to bring vbios IOCTL usage in UMR back? The patch is also attached.
We need to wait until the kernel driver patch lands in upstream drm-next (https://cgit.freedesktop.org/drm/drm/). I haven't sent it upstream yet because the ioctl is still in flux. We still need to sort out the pci id handling in the ioctl.
Alex
Quoted 190 lines
Thanks in advance,
Jiawei-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Wednesday, May 12, 2021 11:35 AM
To: StDenis, Tom <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] add vbios info querySigned-off-by Jiawei Gu <[email protected]>--- src/app/CMakeLists.txt | 1 + src/app/main.c | 8 +++++ src/app/vbios.c | 58 ++++++++++++++++++++++++++++++ src/lib/lowlevel/linux/query_drm.c | 11 ++++++ src/umr.h | 15 ++++++++ src/umrapp.h | 1 + 6 files changed, 94 insertions(+) create mode 100644 src/app/vbios.csrc/app/CMakeLists.txt +1
-0@@ -35,6 +35,7 @@ add_library(umrapp STATIC pp_table.c navi10_ppt.c read_metrics.c + vbios.c ${GUI_SOURCE} )src/app/main.c +8
-0@@ -825,6 +825,11 @@ int main(int argc, char **argv) asic =get_asic ();ih_self_test (asic);#endif + }else if (!strcmp (argv[i],"--vbios_info" ) || !strcmp (argv[i],"-vi" )) { +if (!asic) + asic =get_asic (); +if (umr_print_vbios_info (asic) !=0 ) +fprintf (stderr,"[ERROR]: Cannot print vbios info.\n" ); }else if (!strcmp (argv[i],"--help" ) || !strcmp (argv[i],"-h" )) {printf ("User Mode Register debugger v%s for AMDGPU devices (build: %s [%s]), Copyright (c) 2021, AMD Inc.\n" "\n*** Device Selection ***\n"@@ -951,6 +956,9 @@ printf("\n\t\tPrint the GPU metrics table for the device." "\n\t--power, -p \n\t\tRead the conetent of clocks, temperature, gpu loading at runtime" "\n\t\toptions 'use_colour' to colourize output \n"); +printf ( +"\n*** Video BIOS Information ***\n" +"\n\t--vbios_info, -vi \n\t\tPrint Video BIOS information\n" );#if UMR_GUI printf(src/app/vbios.c new file +69
-0@@ -0,0 +1,58 @@ +/* +* Copyright 2021 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. +* +* Authors: Tom St Denis <[email protected]> +* +*/ +#include "umrapp.h" + +#define AMDGPU_INFO_VBIOS 0x1B +#define AMDGPU_INFO_VBIOS_INFO 0x3 +int umr_print_vbios_info (struct umr_asic *asic) { +char fname[64 ]; +int r; +struct umr_vbios_info vbios_info; + +if (asic->fd.drm <0 ) { +snprintf (fname,sizeof (fname)-1 ,"/dev/dri/card%d" , asic->instance); + asic->fd.drm =open (fname,O_RDWR ); + } + + r =umr_query_drm_vbios (asic,AMDGPU_INFO_VBIOS ,AMDGPU_INFO_VBIOS_INFO , + &vbios_info,sizeof (vbios_info)); +if (r) +return r; + +printf ("vbios name : %s\n" , vbios_info.name); +printf ("vbios dbdf : 0x%x\n" , vbios_info.dbdf); +printf ("vbios pn : %s\n" , vbios_info.vbios_pn); +printf ("vbios version : %d\n" , vbios_info.version); +printf ("vbios date : %s\n" , vbios_info.date); +printf ("vbios serial : %lld\n" , vbios_info.serial); +printf ("vbios dev_id : 0x%x\n" , vbios_info.dev_id); +printf ("vbios rev_id : 0x%x\n" , vbios_info.rev_id); +printf ("vbios sub_dev_id : 0x%x\n" , vbios_info.sub_dev_id); +printf ("vbios sub_ved_id : 0x%x\n" , vbios_info.sub_ved_id); + +close (asic->fd.drm); +return 0 ; +}src/lib/lowlevel/linux/query_drm.c +12
-0@@ -49,7 +49,18 @@ int umr_query_drm(struct umr_asic *asic, int field, void *ret, int size) inf.return_size = size; inf.query = field; return ioctl(asic->fd.drm, DRM_IOC(DRM_IOC_WRITE, DRM_IOCTL_BASE, DRM_COMMAND_BASE + DRM_AMDGPU_INFO, sizeof(inf)), &inf); +} +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type, +void *ret,int size) { +struct drm_amdgpu_info inf; + +memset (&inf,0 ,sizeof inf); + inf.return_pointer = (uintptr_t )ret; + inf.return_size = size; + inf.query = field; + inf.vbios_info.type = type; +return ioctl (asic->fd.drm,DRM_IOC (DRM_IOC_WRITE ,DRM_IOCTL_BASE , +DRM_COMMAND_BASE +DRM_AMDGPU_INFO ,sizeof (inf)), &inf); }#else src/umr.h +16
-0@@ -973,6 +973,7 @@ void umr_free_asic(struct umr_asic *asic); void umr_free_maps(struct umr_asic *asic); void umr_close_asic(struct umr_asic *asic); // call this to close a fully open asic int umr_query_drm(struct umr_asic *asic, int field, void *ret, int size); +int umr_query_drm_vbios (struct umr_asic *asic,int field,int type, +void *ret,int size);void umr_enumerate_devices (void ); int umr_update(struct umr_asic *asic, char *script); int umr_update_string(struct umr_asic *asic, char *sdata); @@ -1349,6 +1350,20 @@ struct umr_soc15_database {struct umr_soc15_database *next; }; +// vbios +struct umr_vbios_info { +uint8_t name[64 ]; +uint32_t dbdf; +uint8_t vbios_pn[64 ]; +uint32_t version; +uint8_t date[32 ]; +uint64_t serial; +uint32_t dev_id; +uint32_t rev_id; +uint32_t sub_dev_id; +uint32_t sub_ved_id; +}; + FILE *umr_database_open(char *path, char *filename); struct umr_soc15_database *umr_database_read_soc15(char *path, char *filename); void umr_database_free_soc15(struct umr_soc15_database *soc15); diff --git a/src/umrapp.h b/src/umrapp.h index 14457fe..1336e07 100644src/umrapp.h +1
-1@@ -57,5 +57,6 @@ void umr_clock_scan(struct umr_asic *asic, const char* clock_name); void umr_clock_manual(struct umr_asic *asic, const char* clock_name, void* value); int umr_print_pp_table(struct umr_asic *asic, const char* param); int umr_print_gpu_metrics(struct umr_asic *asic); +int umr_print_vbios_info (struct umr_asic *asic);void run_server_loop (const char *url,struct umr_asic * asic); --
Quoted 5 lines
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx