[PATCH] drm/amdgpu: Basic emulation support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




>-----Original Message-----
>From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf Of
>Christian König
>Sent: Monday, February 05, 2018 11:49 AM
>To: Alex Deucher; Liu, Shaoyun
>Cc: amd-gfx list
>Subject: Re: [PATCH] drm/amdgpu: Basic emulation support
>
>Am 05.02.2018 um 17:45 schrieb Alex Deucher:
>> On Thu, Feb 1, 2018 at 6:16 PM, Shaoyun Liu <Shaoyun.Liu at amd.com>
>wrote:
>>> Add amdgpu_emu_mode module parameter to control the emulation
>mode
>>> Avoid vbios operation on emulation since there is no vbios post
>>> duirng emulation, use the common hw_init to simulate the post
>>>
>>> Change-Id: Iba32fa16e735490e7401e471219797b83c6c2a58
>>> Signed-off-by: Shaoyun Liu <Shaoyun.Liu at amd.com>
>> Acked-by: Alex Deucher <alexander.deucher at amd.com>
>
>Acked-by: Christian König <christian.koenig at amd.com> as well.

Maybe add a comment to the following change indicating that we might have done early HW init either due to emulation or early init of GMC during normal operation ? 

Otherwise change is Reviewed-by: John Bridgman <john.bridgman at amd.com>

>
>>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 +
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 26
>+++++++++++++++++++++++---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  4 ++++
>>>   3 files changed, 28 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> index ab10295..4c9c320 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> @@ -129,6 +129,7 @@
>>>   extern int amdgpu_lbpw;
>>>   extern int amdgpu_compute_multipipe;
>>>   extern int amdgpu_gpu_recovery;
>>> +extern int amdgpu_emu_mode;
>>>
>>>   #ifdef CONFIG_DRM_AMDGPU_SI
>>>   extern int amdgpu_si_support;
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> index 6adb6e8..fe7a941 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> @@ -1339,6 +1339,20 @@ static int amdgpu_device_ip_init(struct
>amdgpu_device *adev)
>>>                          return r;
>>>                  }
>>>                  adev->ip_blocks[i].status.sw = true;
>>> +
>>> +               if (amdgpu_emu_mode == 1) {
>>> +                       /* Need to do common hw init first on emulation  */
>>> +                       if (adev->ip_blocks[i].version->type ==
>AMD_IP_BLOCK_TYPE_COMMON) {
>>> +                               r = adev->ip_blocks[i].version->funcs->hw_init((void
>*)adev);
>>> +                               if (r) {
>>> +                                       DRM_ERROR("hw_init of IP block <%s> failed %d\n",
>>> +                                               adev->ip_blocks[i].version->funcs->name, r);
>>> +                                       return r;
>>> +                               }
>>> +                               adev->ip_blocks[i].status.hw = true;
>>> +                       }
>>> +               }
>>> +
>>>                  /* need to do gmc hw init early so we can allocate gpu mem */
>>>                  if (adev->ip_blocks[i].version->type ==
>AMD_IP_BLOCK_TYPE_GMC) {
>>>                          r = amdgpu_device_vram_scratch_init(adev);
>>> @@ -1372,8 +1386,7 @@ static int amdgpu_device_ip_init(struct
>amdgpu_device *adev)
>>>          for (i = 0; i < adev->num_ip_blocks; i++) {
>>>                  if (!adev->ip_blocks[i].status.sw)
>>>                          continue;
>>> -               /* gmc hw init is done early */
>>> -               if (adev->ip_blocks[i].version->type ==
>AMD_IP_BLOCK_TYPE_GMC)
>>> +               if (adev->ip_blocks[i].status.hw)
>>>                          continue;
>>>                  r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
>>>                  if (r) {
>>> @@ -1914,6 +1927,9 @@ int amdgpu_device_init(struct amdgpu_device
>*adev,
>>>          if (runtime)
>>>                  vga_switcheroo_init_domain_pm_ops(adev->dev,
>>> &adev->vga_pm_domain);
>>>
>>> +       if (amdgpu_emu_mode == 1)
>>> +               goto fence_driver_init;
>>> +
>>>          /* Read BIOS */
>>>          if (!amdgpu_get_bios(adev)) {
>>>                  r = -EINVAL;
>>> @@ -1966,6 +1982,7 @@ int amdgpu_device_init(struct amdgpu_device
>*adev,
>>>                          amdgpu_atombios_i2c_init(adev);
>>>          }
>>>
>>> +fence_driver_init:
>>>          /* Fence driver */
>>>          r = amdgpu_fence_driver_init(adev);
>>>          if (r) {
>>> @@ -2108,7 +2125,10 @@ void amdgpu_device_fini(struct amdgpu_device
>*adev)
>>>          /* free i2c buses */
>>>          if (!amdgpu_device_has_dc_support(adev))
>>>                  amdgpu_i2c_fini(adev);
>>> -       amdgpu_atombios_fini(adev);
>>> +
>>> +       if (amdgpu_emu_mode != 1)
>>> +               amdgpu_atombios_fini(adev);
>>> +
>>>          kfree(adev->bios);
>>>          adev->bios = NULL;
>>>          if (!pci_is_thunderbolt_attached(adev->pdev))
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> index 5a5ed47..fdd24d5 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> @@ -130,6 +130,7 @@
>>>   int amdgpu_lbpw = -1;
>>>   int amdgpu_compute_multipipe = -1;
>>>   int amdgpu_gpu_recovery = -1; /* auto */
>>> +int amdgpu_emu_mode = 0;
>>>
>>>   MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in
>megabytes");
>>>   module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); @@
>>> -285,6 +286,9 @@
>>>   MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism,
>(1 = enable, 0 = disable, -1 = auto");
>>>   module_param_named(gpu_recovery, amdgpu_gpu_recovery, int,
>0444);
>>>
>>> +MODULE_PARM_DESC(emu_mode, "Emulation mode, (1 = enable, 0 =
>>> +disable"); module_param_named(emu_mode, amdgpu_emu_mode, int,
>0444);
>>> +
>>>   #ifdef CONFIG_DRM_AMDGPU_SI
>>>
>>>   #if defined(CONFIG_DRM_RADEON) ||
>defined(CONFIG_DRM_RADEON_MODULE)
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
>_______________________________________________
>amd-gfx mailing list
>amd-gfx at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux