tree:   git://people.freedesktop.org/~agd5f/linux.git drm-next
head:   57673be0a9f5ef814f8a9699abdb480886fa4c0c
commit: aeee2a48ec9239790b7c9a5c14dfb2a12554322f [655/663] drm/amd/amdgpu: 
Enable arcturus devices to access the method kgd_gfx_v9_get_cu_occupancy that 
is already defined
config: x86_64-randconfig-a005-20201104 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
09ec07827b1128504457a93dee80b2ceee1af600)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
        git fetch --no-tags radeon-alex drm-next
        git checkout aeee2a48ec9239790b7c9a5c14dfb2a12554322f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:94:6: warning: no previous 
prototype for function 'kgd_gfx_v9_program_sh_mem_settings' 
[-Wmissing-prototypes]
   void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
        ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:94:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:111:5: warning: no 
previous prototype for function 'kgd_gfx_v9_set_pasid_vmid_mapping' 
[-Wmissing-prototypes]
   int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int 
pasid,
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:111:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int 
pasid,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:172:5: warning: no 
previous prototype for function 'kgd_gfx_v9_init_interrupts' 
[-Wmissing-prototypes]
   int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:172:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:234:5: warning: no 
previous prototype for function 'kgd_gfx_v9_hqd_load' [-Wmissing-prototypes]
   int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:234:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:314:5: warning: no 
previous prototype for function 'kgd_gfx_v9_hiq_mqd_load' [-Wmissing-prototypes]
   int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd,
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:314:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:367:5: warning: no 
previous prototype for function 'kgd_gfx_v9_hqd_dump' [-Wmissing-prototypes]
   int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd,
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:367:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:501:6: warning: no 
previous prototype for function 'kgd_gfx_v9_hqd_is_occupied' 
[-Wmissing-prototypes]
   bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,
        ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:501:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:542:5: warning: no 
previous prototype for function 'kgd_gfx_v9_hqd_destroy' [-Wmissing-prototypes]
   int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:542:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:632:6: warning: no 
previous prototype for function 'kgd_gfx_v9_get_atc_vmid_pasid_mapping_info' 
[-Wmissing-prototypes]
   bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
        ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:632:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:645:5: warning: no 
previous prototype for function 'kgd_gfx_v9_address_watch_disable' 
[-Wmissing-prototypes]
   int kgd_gfx_v9_address_watch_disable(struct kgd_dev *kgd)
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:645:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_address_watch_disable(struct kgd_dev *kgd)
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:650:5: warning: no 
previous prototype for function 'kgd_gfx_v9_address_watch_execute' 
[-Wmissing-prototypes]
   int kgd_gfx_v9_address_watch_execute(struct kgd_dev *kgd,
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:650:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_address_watch_execute(struct kgd_dev *kgd,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:659:5: warning: no 
previous prototype for function 'kgd_gfx_v9_wave_control_execute' 
[-Wmissing-prototypes]
   int kgd_gfx_v9_wave_control_execute(struct kgd_dev *kgd,
       ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:659:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   int kgd_gfx_v9_wave_control_execute(struct kgd_dev *kgd,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:684:10: warning: no 
previous prototype for function 'kgd_gfx_v9_address_watch_get_offset' 
[-Wmissing-prototypes]
   uint32_t kgd_gfx_v9_address_watch_get_offset(struct kgd_dev *kgd,
            ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:684:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   uint32_t kgd_gfx_v9_address_watch_get_offset(struct kgd_dev *kgd,
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:691:6: warning: no 
previous prototype for function 'kgd_gfx_v9_set_vm_context_page_table_base' 
[-Wmissing-prototypes]
   void kgd_gfx_v9_set_vm_context_page_table_base(struct kgd_dev *kgd,
        ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:691:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   void kgd_gfx_v9_set_vm_context_page_table_base(struct kgd_dev *kgd,
   ^
   static 
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:802:6: warning: no 
>> previous prototype for function 'kgd_gfx_v9_get_cu_occupancy' 
>> [-Wmissing-prototypes]
   void kgd_gfx_v9_get_cu_occupancy(struct kgd_dev *kgd, int pasid,
        ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:802:1: note: declare 
'static' if the function is not intended to be used outside of this translation 
unit
   void kgd_gfx_v9_get_cu_occupancy(struct kgd_dev *kgd, int pasid,
   ^
   static 
   15 warnings generated.

vim +/kgd_gfx_v9_get_cu_occupancy +802 
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c

   755  
   756  /**
   757   * @kgd_gfx_v9_get_cu_occupancy: Reads relevant registers associated 
with each
   758   * shader engine and aggregates the number of waves that are in flight 
for the
   759   * process whose pasid is provided as a parameter. The process could 
have ZERO
   760   * or more queues running and submitting waves to compute units.
   761   *
   762   * @kgd: Handle of device from which to get number of waves in flight
   763   * @pasid: Identifies the process for which this query call is invoked
   764   * @wave_cnt: Output parameter updated with number of waves in flight 
that
   765   * belong to process with given pasid
   766   * @max_waves_per_cu: Output parameter updated with maximum number of 
waves
   767   * possible per Compute Unit
   768   *
   769   * @note: It's possible that the device has too many queues 
(oversubscription)
   770   * in which case a VMID could be remapped to a different PASID. This 
could lead
   771   * to an iaccurate wave count. Following is a high-level sequence:
   772   *    Time T1: vmid = getVmid(); vmid is associated with Pasid P1
   773   *    Time T2: passId = getPasId(vmid); vmid is associated with Pasid P2
   774   * In the sequence above wave count obtained from time T1 will be 
incorrectly
   775   * lost or added to total wave count.
   776   *
   777   * The registers that provide the waves in flight are:
   778   *
   779   *  SPI_CSQ_WF_ACTIVE_STATUS - bit-map of queues per pipe. The bit is 
ON if a
   780   *  queue is slotted, OFF if there is no queue. A process could have 
ZERO or
   781   *  more queues slotted and submitting waves to be run on compute 
units. Even
   782   *  when there is a queue it is possible there could be zero wave 
fronts, this
   783   *  can happen when queue is waiting on top-of-pipe events - e.g. 
waitRegMem
   784   *  command
   785   *
   786   *  For each bit that is ON from above:
   787   *
   788   *    Read (SPI_CSQ_WF_ACTIVE_COUNT_0 + queue_idx) register. It 
provides the
   789   *    number of waves that are in flight for the queue at specified 
index. The
   790   *    index ranges from 0 to 7.
   791   *
   792   *    If non-zero waves are in flight, read CP_HQD_VMID register to 
obtain VMID
   793   *    of the wave(s).
   794   *
   795   *    Determine if VMID from above step maps to pasid provided as 
parameter. If
   796   *    it matches agrregate the wave count. That the VMID will not match 
pasid is
   797   *    a normal condition i.e. a device is expected to support multiple 
queues
   798   *    from multiple proceses.
   799   *
   800   *  Reading registers referenced above involves programming GRBM 
appropriately
   801   */
 > 802  void kgd_gfx_v9_get_cu_occupancy(struct kgd_dev *kgd, int pasid,
   803                  int *pasid_wave_cnt, int *max_waves_per_cu)
   804  {
   805          int qidx;
   806          int vmid;
   807          int se_idx;
   808          int sh_idx;
   809          int se_cnt;
   810          int sh_cnt;
   811          int wave_cnt;
   812          int queue_map;
   813          int pasid_tmp;
   814          int max_queue_cnt;
   815          int vmid_wave_cnt = 0;
   816          struct amdgpu_device *adev;
   817          DECLARE_BITMAP(cp_queue_bitmap, KGD_MAX_QUEUES);
   818  
   819          adev = get_amdgpu_device(kgd);
   820          lock_spi_csq_mutexes(adev);
   821          soc15_grbm_select(adev, 1, 0, 0, 0);
   822  
   823          /*
   824           * Iterate through the shader engines and arrays of the device
   825           * to get number of waves in flight
   826           */
   827          bitmap_complement(cp_queue_bitmap, adev->gfx.mec.queue_bitmap,
   828                            KGD_MAX_QUEUES);
   829          max_queue_cnt = adev->gfx.mec.num_pipe_per_mec *
   830                          adev->gfx.mec.num_queue_per_pipe;
   831          sh_cnt = adev->gfx.config.max_sh_per_se;
   832          se_cnt = adev->gfx.config.max_shader_engines;
   833          for (se_idx = 0; se_idx < se_cnt; se_idx++) {
   834                  for (sh_idx = 0; sh_idx < sh_cnt; sh_idx++) {
   835  
   836                          gfx_v9_0_select_se_sh(adev, se_idx, sh_idx, 
0xffffffff);
   837                          queue_map = RREG32(SOC15_REG_OFFSET(GC, 0,
   838                                             mmSPI_CSQ_WF_ACTIVE_STATUS));
   839  
   840                          /*
   841                           * Assumption: queue map encodes following 
schema: four
   842                           * pipes per each micro-engine, with each pipe 
mapping
   843                           * eight queues. This schema is true for GFX9 
devices
   844                           * and must be verified for newer device 
families
   845                           */
   846                          for (qidx = 0; qidx < max_queue_cnt; qidx++) {
   847  
   848                                  /* Skip qeueus that are not associated 
with
   849                                   * compute functions
   850                                   */
   851                                  if (!test_bit(qidx, cp_queue_bitmap))
   852                                          continue;
   853  
   854                                  if (!(queue_map & (1 << qidx)))
   855                                          continue;
   856  
   857                                  /* Get number of waves in flight and 
aggregate them */
   858                                  get_wave_count(adev, qidx, &wave_cnt, 
&vmid);
   859                                  if (wave_cnt != 0) {
   860                                          pasid_tmp =
   861                                            
RREG32(SOC15_REG_OFFSET(OSSSYS, 0,
   862                                                   mmIH_VMID_0_LUT) + 
vmid);
   863                                          if (pasid_tmp == pasid)
   864                                                  vmid_wave_cnt += 
wave_cnt;
   865                                  }
   866                          }
   867                  }
   868          }
   869  
   870          gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
   871          soc15_grbm_select(adev, 0, 0, 0, 0);
   872          unlock_spi_csq_mutexes(adev);
   873  
   874          /* Update the output parameters and return */
   875          *pasid_wave_cnt = vmid_wave_cnt;
   876          *max_waves_per_cu = adev->gfx.cu_info.simd_per_cu *
   877                                  adev->gfx.cu_info.max_waves_per_simd;
   878  }
   879  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to