Since bios reading does not work currently so just bypass all operations
related to bios

Signed-off-by: Shiwu Zhang <shiwu.zh...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 66 ++++++++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    |  7 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 58 +++++++++++--------
 3 files changed, 80 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index a9d9bbe8586b..a36670c7bc61 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1388,6 +1388,15 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device 
*adev)
        return 0;
 }
 
+static bool amdgpu_device_read_bios(struct amdgpu_device *adev)
+{
+       if (hweight32(adev->aid_mask)) {
+               return false;
+       }
+
+       return true;
+}
+
 /*
  * GPU helpers function.
  */
@@ -1404,6 +1413,9 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
 {
        uint32_t reg;
 
+       if (!amdgpu_device_read_bios(adev))
+               return false;
+
        if (amdgpu_sriov_vf(adev))
                return false;
 
@@ -2317,14 +2329,16 @@ static int amdgpu_device_ip_early_init(struct 
amdgpu_device *adev)
                                return r;
 
                        /* Read BIOS */
-                       if (!amdgpu_get_bios(adev))
-                               return -EINVAL;
+                       if (amdgpu_device_read_bios(adev)) {
+                               if (!amdgpu_get_bios(adev))
+                                       return -EINVAL;
 
-                       r = amdgpu_atombios_init(adev);
-                       if (r) {
-                               dev_err(adev->dev, "amdgpu_atombios_init 
failed\n");
-                               amdgpu_vf_error_put(adev, 
AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL, 0, 0);
-                               return r;
+                               r = amdgpu_atombios_init(adev);
+                               if (r) {
+                                       dev_err(adev->dev, 
"amdgpu_atombios_init failed\n");
+                                       amdgpu_vf_error_put(adev, 
AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL, 0, 0);
+                                       return r;
+                               }
                        }
 
                        /*get pf2vf msg info at it's earliest time*/
@@ -3944,25 +3958,27 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                }
        }
 
-       if (adev->is_atom_fw) {
-               /* Initialize clocks */
-               r = amdgpu_atomfirmware_get_clock_info(adev);
-               if (r) {
-                       dev_err(adev->dev, "amdgpu_atomfirmware_get_clock_info 
failed\n");
-                       amdgpu_vf_error_put(adev, 
AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0);
-                       goto failed;
-               }
-       } else {
-               /* Initialize clocks */
-               r = amdgpu_atombios_get_clock_info(adev);
-               if (r) {
-                       dev_err(adev->dev, "amdgpu_atombios_get_clock_info 
failed\n");
-                       amdgpu_vf_error_put(adev, 
AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0);
-                       goto failed;
+       if (adev->bios) {
+               if (adev->is_atom_fw) {
+                       /* Initialize clocks */
+                       r = amdgpu_atomfirmware_get_clock_info(adev);
+                       if (r) {
+                               dev_err(adev->dev, 
"amdgpu_atomfirmware_get_clock_info failed\n");
+                               amdgpu_vf_error_put(adev, 
AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0);
+                               goto failed;
+                       }
+               } else {
+                       /* Initialize clocks */
+                       r = amdgpu_atombios_get_clock_info(adev);
+                       if (r) {
+                               dev_err(adev->dev, 
"amdgpu_atombios_get_clock_info failed\n");
+                               amdgpu_vf_error_put(adev, 
AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0);
+                               goto failed;
+                       }
+                       /* init i2c buses */
+                       if (!amdgpu_device_has_dc_support(adev))
+                               amdgpu_atombios_i2c_init(adev);
                }
-               /* init i2c buses */
-               if (!amdgpu_device_has_dc_support(adev))
-                       amdgpu_atombios_i2c_init(adev);
        }
 
 fence_driver_init:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index d466c02857a9..a6a379d3acdb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1700,7 +1700,7 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device 
*adev)
        uint32_t reserve_size = 0;
        int ret;
 
-       if (!amdgpu_sriov_vf(adev)) {
+       if (adev->bios && !amdgpu_sriov_vf(adev)) {
                if (amdgpu_atomfirmware_mem_training_supported(adev))
                        mem_train_support = true;
                else
@@ -1717,7 +1717,10 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device 
*adev)
        if (adev->bios)
                reserve_size =
                        amdgpu_atomfirmware_get_fw_reserved_fb_size(adev);
-       if (!reserve_size)
+       /* reserve 256MB protected region for aqua_vanjaram boot time TMR */
+       if (!adev->bios && adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3))
+               reserve_size = max(reserve_size, (uint32_t)280 << 20);
+       else if (!reserve_size)
                reserve_size = DISCOVERY_TMR_OFFSET;
 
        if (mem_train_support) {
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index f70e666cecf2..3b6b80d784c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -2010,34 +2010,44 @@ static int gmc_v9_0_sw_init(void *handle)
 
        spin_lock_init(&adev->gmc.invalidate_lock);
 
-       r = amdgpu_atomfirmware_get_vram_info(adev,
-               &vram_width, &vram_type, &vram_vendor);
-       if (amdgpu_sriov_vf(adev))
-               /* For Vega10 SR-IOV, vram_width can't be read from ATOM as 
RAVEN,
-                * and DF related registers is not readable, seems hardcord is 
the
-                * only way to set the correct vram_width
-                */
-               adev->gmc.vram_width = 2048;
-       else if (amdgpu_emu_mode != 1)
-               adev->gmc.vram_width = vram_width;
+       if (!(adev->bios)) {
+               if (adev->flags & AMD_IS_APU) {
+                       adev->gmc.vram_type = AMDGPU_VRAM_TYPE_DDR4;
+                       adev->gmc.vram_width = 64;
+               } else {
+                       adev->gmc.vram_type = AMDGPU_VRAM_TYPE_HBM;
+                       adev->gmc.vram_width = 128;
+               }
+       } else {
+               r = amdgpu_atomfirmware_get_vram_info(adev,
+                       &vram_width, &vram_type, &vram_vendor);
+               if (amdgpu_sriov_vf(adev))
+                       /* For Vega10 SR-IOV, vram_width can't be read from 
ATOM as RAVEN,
+                        * and DF related registers is not readable, seems 
hardcord is the
+                        * only way to set the correct vram_width
+                        */
+                       adev->gmc.vram_width = 2048;
+               else if (amdgpu_emu_mode != 1)
+                       adev->gmc.vram_width = vram_width;
 
-       if (!adev->gmc.vram_width) {
-               int chansize, numchan;
+               if (!adev->gmc.vram_width) {
+                       int chansize, numchan;
 
-               /* hbm memory channel size */
-               if (adev->flags & AMD_IS_APU)
-                       chansize = 64;
-               else
-                       chansize = 128;
-               if (adev->df.funcs &&
-                   adev->df.funcs->get_hbm_channel_number) {
-                       numchan = adev->df.funcs->get_hbm_channel_number(adev);
-                       adev->gmc.vram_width = numchan * chansize;
+                       /* hbm memory channel size */
+                       if (adev->flags & AMD_IS_APU)
+                               chansize = 64;
+                       else
+                               chansize = 128;
+                       if (adev->df.funcs &&
+                           adev->df.funcs->get_hbm_channel_number) {
+                               numchan = 
adev->df.funcs->get_hbm_channel_number(adev);
+                               adev->gmc.vram_width = numchan * chansize;
+                       }
                }
-       }
 
-       adev->gmc.vram_type = vram_type;
-       adev->gmc.vram_vendor = vram_vendor;
+               adev->gmc.vram_type = vram_type;
+               adev->gmc.vram_vendor = vram_vendor;
+       }
        switch (adev->ip_versions[GC_HWIP][0]) {
        case IP_VERSION(9, 1, 0):
        case IP_VERSION(9, 2, 2):
-- 
2.17.1

Reply via email to