Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: request init data in virt detection

Move request init data to virt detection func, so we
can insert request full access between request init data
and set ip blocks.

Signed-off-by: Wenhui Sheng <Wenhui.Sheng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Wenhui Sheng and committed by
Alex Deucher
c1299461 81659b20

+46 -12
+28
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
··· 27 27 28 28 #include "amdgpu.h" 29 29 #include "amdgpu_ras.h" 30 + #include "vi.h" 31 + #include "soc15.h" 32 + #include "nv.h" 30 33 31 34 bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev) 32 35 { ··· 515 512 if (!reg) { 516 513 if (is_virtual_machine()) /* passthrough mode exclus sriov mod */ 517 514 adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE; 515 + } 516 + 517 + /* we have the ability to check now */ 518 + if (amdgpu_sriov_vf(adev)) { 519 + switch (adev->asic_type) { 520 + case CHIP_TONGA: 521 + case CHIP_FIJI: 522 + vi_set_virt_ops(adev); 523 + break; 524 + case CHIP_VEGA10: 525 + case CHIP_VEGA20: 526 + case CHIP_ARCTURUS: 527 + soc15_set_virt_ops(adev); 528 + break; 529 + case CHIP_NAVI10: 530 + case CHIP_NAVI12: 531 + case CHIP_SIENNA_CICHLID: 532 + nv_set_virt_ops(adev); 533 + /* try send GPU_INIT_DATA request to host */ 534 + amdgpu_virt_request_init_data(adev); 535 + break; 536 + default: /* other chip doesn't support SRIOV */ 537 + DRM_ERROR("Unknown asic type: %d!\n", adev->asic_type); 538 + break; 539 + } 518 540 } 519 541 } 520 542
+5 -6
drivers/gpu/drm/amd/amdgpu/nv.c
··· 420 420 return 0; 421 421 } 422 422 423 + void nv_set_virt_ops(struct amdgpu_device *adev) 424 + { 425 + adev->virt.ops = &xgpu_nv_virt_ops; 426 + } 427 + 423 428 int nv_set_ip_blocks(struct amdgpu_device *adev) 424 429 { 425 430 int r; 426 431 427 432 adev->nbio.funcs = &nbio_v2_3_funcs; 428 433 adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg; 429 - 430 - if (amdgpu_sriov_vf(adev)) { 431 - adev->virt.ops = &xgpu_nv_virt_ops; 432 - /* try send GPU_INIT_DATA request to host */ 433 - amdgpu_virt_request_init_data(adev); 434 - } 435 434 436 435 /* Set IP register base before any HW register access */ 437 436 r = nv_reg_base_init(adev);
+1
drivers/gpu/drm/amd/amdgpu/nv.h
··· 28 28 29 29 void nv_grbm_select(struct amdgpu_device *adev, 30 30 u32 me, u32 pipe, u32 queue, u32 vmid); 31 + void nv_set_virt_ops(struct amdgpu_device *adev); 31 32 int nv_set_ip_blocks(struct amdgpu_device *adev); 32 33 int navi10_reg_base_init(struct amdgpu_device *adev); 33 34 int navi14_reg_base_init(struct amdgpu_device *adev);
+5 -3
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 669 669 return adev->nbio.funcs->get_rev_id(adev); 670 670 } 671 671 672 + void soc15_set_virt_ops(struct amdgpu_device *adev) 673 + { 674 + adev->virt.ops = &xgpu_ai_virt_ops; 675 + } 676 + 672 677 int soc15_set_ip_blocks(struct amdgpu_device *adev) 673 678 { 674 679 int r; ··· 726 721 adev->df.funcs = &df_v1_7_funcs; 727 722 728 723 adev->rev_id = soc15_get_rev_id(adev); 729 - 730 - if (amdgpu_sriov_vf(adev)) 731 - adev->virt.ops = &xgpu_ai_virt_ops; 732 724 733 725 switch (adev->asic_type) { 734 726 case CHIP_VEGA10:
+1
drivers/gpu/drm/amd/amdgpu/soc15.h
··· 90 90 91 91 void soc15_grbm_select(struct amdgpu_device *adev, 92 92 u32 me, u32 pipe, u32 queue, u32 vmid); 93 + void soc15_set_virt_ops(struct amdgpu_device *adev); 93 94 int soc15_set_ip_blocks(struct amdgpu_device *adev); 94 95 95 96 void soc15_program_register_sequence(struct amdgpu_device *adev,
+5 -3
drivers/gpu/drm/amd/amdgpu/vi.c
··· 1705 1705 .funcs = &vi_common_ip_funcs, 1706 1706 }; 1707 1707 1708 + void vi_set_virt_ops(struct amdgpu_device *adev) 1709 + { 1710 + adev->virt.ops = &xgpu_vi_virt_ops; 1711 + } 1712 + 1708 1713 int vi_set_ip_blocks(struct amdgpu_device *adev) 1709 1714 { 1710 - if (amdgpu_sriov_vf(adev)) 1711 - adev->virt.ops = &xgpu_vi_virt_ops; 1712 - 1713 1715 switch (adev->asic_type) { 1714 1716 case CHIP_TOPAZ: 1715 1717 /* topaz has no DCE, UVD, VCE */
+1
drivers/gpu/drm/amd/amdgpu/vi.h
··· 28 28 29 29 void vi_srbm_select(struct amdgpu_device *adev, 30 30 u32 me, u32 pipe, u32 queue, u32 vmid); 31 + void vi_set_virt_ops(struct amdgpu_device *adev); 31 32 int vi_set_ip_blocks(struct amdgpu_device *adev); 32 33 33 34 void legacy_doorbell_index_init(struct amdgpu_device *adev);