Skip to contentSkip to conversation

drm/amdgpu: Add place holder for soc15 asic init on emulation

PATCH In review Shaoyun Liu 4 participants 9 messages Feb 6, 2018 7 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Add place holder for soc15 asic init on emulation

Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h  |  2 ++
 drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/emu_soc.c
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
 amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o
 
 amdgpu-y += \
-	vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
+	vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
 bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type);
 bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);
 
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +33 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev)
+{
+	return 0;
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -0
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/* Add asic specific init sequence for emulation */
+	if (amdgpu_emu_mode == 1)
+		emu_soc_asic_init(adev);
+
 	/* enable pcie gen2/3 link */
 	soc15_pcie_gen3_enable(adev);
 	/* enable aspm */
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1517953287-22026-1-git-send-email-Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 2 lines · Shaoyun Liu
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Alex

Quoted 91 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h  |  2 ++
 drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/emu_soc.c
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
 amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o
 
 amdgpu-y += \
-       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
+       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
 bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type);
 bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);
 
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +33 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev)
+{
+       return 0;
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_PFej=MAbD-ZOoqHwiNk82A+qg304_5c7rXHOLJS9He+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Ye, I try to put the asic specific register sequences for emulation in a separate emu_soc.c file, I think it's suggested by John or you ? The asic specific code will be keep in separate bring up branch , but a common place to add them seems not bad to me .

Shaoyun.liu

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 4:46 PM
To: Liu, Shaoyun
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 2 lines · Shaoyun Liu
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Alex

Quoted 108 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-  
drivers/gpu/drm/amd/amdgpu/amdgpu.h  |  2 ++  
drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)  create mode 100644 

drivers/gpu/drm/amd/amdgpu/emu_soc.c

drivers/gpu/drm/amd/amdgpu/Makefile +0 -0
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o 

kv_smc.o kv_dpm.o \ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o

amdgpu-y += \

drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
-       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
+       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o 
+ nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, 

uint32_t reg, uint32_t v, bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type); bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +44 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev) {
+       return 0;
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)  {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): DM5PR12MB117937BE7328E6634A4DA6B1F4FD0-2J9CzHegvk8p/[email protected]

#6 lore raw

Yes, I made that suggestion in order to make it easy for us to replace the massive function we use in emulation with a stub function for upstream. I figured if we had that function in a separate file it would be cleaner, but maybe that is not the case.

I was thinking that we could replace the upstream stub file with an NPI-specific file for most of our emulator work, then go back to the stub file once VBIOS was enabled and we no longer needed the SOC init sequence from HW.

I guess from a CM perspective it doesn't make a lot of difference whether we add 20,000 lines to a file and delete them later or replace a short file with a 20,000 line file and then replace it again later... so maybe we don't need to move the function out after all.

________________________________
From: Liu, Shaoyun
Sent: February 6, 2018 4:55 PM
To: Alex Deucher; Bridgman, John
Cc: amd-gfx list
Subject: RE: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Ye, I try to put the asic specific register sequences for emulation in a separate emu_soc.c file, I think it's suggested by John or you ? The asic specific code will be keep in separate bring up branch , but a common place to add them seems not bad to me .

Shaoyun.liu

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 4:46 PM
To: Liu, Shaoyun
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 2 lines · Shaoyun Liu
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Alex

Quoted 58 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu.h  |  2 ++
drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)  create mode 100644

drivers/gpu/drm/amd/amdgpu/emu_soc.c

drivers/gpu/drm/amd/amdgpu/Makefile +0 -0
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o

kv_smc.o kv_dpm.o \ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o

amdgpu-y += \

drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
-       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
+       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o
+ nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev,

uint32_t reg, uint32_t v, bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type); bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +12 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 22

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +10 -0
+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

Is there an expectation that MAM block features will become available under virtualization at some point in the future, eg Navi10 ?

Quoted 40 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +22 -0
+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.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev) {
+       return 0;
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)  {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 4 lines

_______________________________________________
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

#7 lore raw
In reply to a message not in the archive
Quoted 3 lines · Shaoyun

Ye, I try to put the asic specific register sequences for emulation in a separate emu_soc.c file, I think it's suggested by John or you ? The asic specific code will be keep in separate bring up branch , but a common place to add them seems not bad to me .

Shaoyun.liu

I guess the idea is that you could use emu_soc_asic_init() for any family, that makes sense. To keep the logic more similar to actual silicon, it might be better to make emu_soc_asic_init() a replacement for atom_asic_init() in amdgpu_device.c. E.g.,

if (emu == 1) {
    emu_soc_asic_init();
} else {
    // do vbios stuff
}

Then we can drop the other changes to the ip ordering for emulation.

Alex

Quoted 125 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 4:46 PM
To: Liu, Shaoyun
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 2 lines · Shaoyun Liu
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Alex

Quoted 108 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu.h  |  2 ++
drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)  create mode 100644

drivers/gpu/drm/amd/amdgpu/emu_soc.c

drivers/gpu/drm/amd/amdgpu/Makefile +0 -0
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o

kv_smc.o kv_dpm.o \ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o

amdgpu-y += \

drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
-       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
+       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o
+ nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev,

uint32_t reg, uint32_t v, bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type); bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +44 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev) {
+       return 0;
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)  {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 4 lines
Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_NE-DcpUjikVkGvqMs8MsHEGrqWkd9ar02_tvCi2eupmw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#9 lore raw

You are right , I try to use the emu_soc_asic_init()as a entry point for any family .
For driver to get into amdgpu_atom_asic_init() function call , it depends on other logic like read bios and check some register etc . On emulation mode , we can not get bios image so it will requires more code and logic change based on existing code than we use the common hw init entry point to simulate the post . In either way ,do you agree to keep a separate file as emu_soc.c for this init sequence on emulation mdoe?

Shaoyun.liu

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 5:03 PM
To: Liu, Shaoyun
Cc: Bridgman, John; amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 3 lines · Shaoyun

Ye, I try to put the asic specific register sequences for emulation in a separate emu_soc.c file, I think it's suggested by John or you ? The asic specific code will be keep in separate bring up branch , but a common place to add them seems not bad to me .

Shaoyun.liu

I guess the idea is that you could use emu_soc_asic_init() for any family, that makes sense. To keep the logic more similar to actual silicon, it might be better to make emu_soc_asic_init() a replacement for atom_asic_init() in amdgpu_device.c. E.g.,

if (emu == 1) {
    emu_soc_asic_init();
} else {
    // do vbios stuff
}

Then we can drop the other changes to the ip ordering for emulation.

Alex

Quoted 127 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 4:46 PM
To: Liu, Shaoyun
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 2 lines · Shaoyun Liu
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Alex

Quoted 109 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +- 
drivers/gpu/drm/amd/amdgpu/amdgpu.h  |  2 ++ 
drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)  create mode 100644 

drivers/gpu/drm/amd/amdgpu/emu_soc.c

drivers/gpu/drm/amd/amdgpu/Makefile +0 -0
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o 

kv_smc.o kv_dpm.o \ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o

amdgpu-y += \

drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
-       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
+       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o 
+ nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, 

uint32_t reg, uint32_t v, bool amdgpu_device_asic_has_dc_support(enum
amd_asic_type asic_type); bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +44 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev) {
+       return 0;
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)  {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 4 lines
Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): DM5PR12MB11795B8669187663F7070C6EF4FD0-2J9CzHegvk8p/[email protected]

#11 lore raw
Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Liu, Shaoyun
Sent: Tuesday, February 6, 2018 5:26 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>; Bridgman, John <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 8 lines

You are right , I try to use the emu_soc_asic_init()as a entry point for any family .
For driver to get into amdgpu_atom_asic_init() function call , it depends on other logic like read bios and check some register etc . On emulation mode , we can not get bios image so it will requires more code and logic change based on existing code than we use the common hw init entry point to simulate the post . In either way ,do you agree to keep a separate file as emu_soc.c for this init sequence on emulation mdoe?

You already sent out a patch to skip all of the vbios fetching and asic init stuff if emu ==1, It would be a trivial patch on top of that one to just call the emu_soc code when emu == 1 in amdgpu_device_init(). I'm fine with the separate file. You've convinced me.

Alex

Quoted 175 lines

Shaoyun.liu

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 5:03 PM
To: Liu, Shaoyun
Cc: Bridgman, John; amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 1 line · Shaoyun

Ye, I try to put the asic specific register sequences for emulation in a

separate emu_soc.c file, I think it's suggested by John or you ? The asic specific code will be keep in separate bring up branch , but a common place to add them seems not bad to me .

Quoted 2 lines

Shaoyun.liu

I guess the idea is that you could use emu_soc_asic_init() for any family, that makes sense. To keep the logic more similar to actual silicon, it might be better to make emu_soc_asic_init() a replacement for atom_asic_init() in amdgpu_device.c. E.g.,

if (emu == 1) {
    emu_soc_asic_init();
} else {
    // do vbios stuff
}

Then we can drop the other changes to the ip ordering for emulation.

Alex

Quoted 10 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 4:46 PM
To: Liu, Shaoyun
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

On Tue, Feb 6, 2018 at 4:41 PM, Shaoyun Liu <[email protected]>

Quoted 4 lines · wrote:
Quoted 2 lines
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to

where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Quoted 8 lines

Alex

Quoted 4 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-

drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33

+++++++++++++++++++++++++++++++++

Quoted 10 lines

drivers/gpu/drm/amd/amdgpu/Makefile amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o

Quoted 10 lines
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)  create mode 100644

drivers/gpu/drm/amd/amdgpu/emu_soc.c

drivers/gpu/drm/amd/amdgpu/Makefile +0 -0
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o

cik_ih.o

Quoted 1 line
Quoted 1 line

kv_smc.o kv_dpm.o \ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o

gmc_v6_0.o

Quoted 4 lines
Quoted 4 lines

gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o

amdgpu-y += \
- vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o

vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o

Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h void amdgpu_mm_wreg(struct amdgpu_device

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/Makefile +2 -0
+       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o
+ nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device

*adev,

Quoted 29 lines
Quoted 29 lines

uint32_t reg, uint32_t v, bool amdgpu_device_asic_has_dc_support(enum
amd_asic_type asic_type); bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +12 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 20

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +8 -0
+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,

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 24

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +4 -0
+EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN

NO

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 30

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +6 -0
+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

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +12 -0
+USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev) {
+       return 0;
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/soc15.c static int soc15_common_hw_init(void *handle)

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +2 -0
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)

{

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
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

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

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1653DA78A0412EC8B7A92EF8F7FD0-rpdhrqHFk06apTa93KjAaQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#13 lore raw

Thanks . Can I add Review-By you for this patch ?

Shaoyun.liu

-----Original Message-----
From: Deucher, Alexander
Sent: Tuesday, February 06, 2018 5:37 PM
To: Liu, Shaoyun; Alex Deucher
Cc: amd-gfx list; Bridgman, John
Subject: RE: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Liu, Shaoyun
Sent: Tuesday, February 6, 2018 5:26 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>; Bridgman, John <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 8 lines

You are right , I try to use the emu_soc_asic_init()as a entry point for any family .
For driver to get into amdgpu_atom_asic_init() function call , it depends on other logic like read bios and check some register etc . On emulation mode , we can not get bios image so it will requires more code and logic change based on existing code than we use the common hw init entry point to simulate the post . In either way ,do you agree to keep a separate file as emu_soc.c for this init sequence on emulation mdoe?

You already sent out a patch to skip all of the vbios fetching and asic init stuff if emu ==1, It would be a trivial patch on top of that one to just call the emu_soc code when emu == 1 in amdgpu_device_init(). I'm fine with the separate file. You've convinced me.

Alex

Quoted 178 lines

Shaoyun.liu

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 5:03 PM
To: Liu, Shaoyun
Cc: Bridgman, John; amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 2 lines · Shaoyun

Ye, I try to put the asic specific register sequences for emulation in a

separate emu_soc.c file, I think it's suggested by John or you ? The asic specific code will be keep in separate bring up branch , but a common place to add them seems not bad to me .

Quoted 2 lines

Shaoyun.liu

I guess the idea is that you could use emu_soc_asic_init() for any family, that makes sense. To keep the logic more similar to actual silicon, it might be better to make emu_soc_asic_init() a replacement for atom_asic_init() in amdgpu_device.c. E.g.,

if (emu == 1) {
    emu_soc_asic_init();
} else {
    // do vbios stuff
}

Then we can drop the other changes to the ip ordering for emulation.

Alex

Quoted 10 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 4:46 PM
To: Liu, Shaoyun
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

On Tue, Feb 6, 2018 at 4:41 PM, Shaoyun Liu <[email protected]>

Quoted 5 lines · wrote:
Quoted 2 lines
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to

where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Quoted 8 lines

Alex

Quoted 4 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +- 

drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33

+++++++++++++++++++++++++++++++++

Quoted 10 lines

drivers/gpu/drm/amd/amdgpu/Makefile amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o

Quoted 10 lines
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)  create mode 

100644 drivers/gpu/drm/amd/amdgpu/emu_soc.c

drivers/gpu/drm/amd/amdgpu/Makefile +0 -0
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o

cik_ih.o

Quoted 1 line
Quoted 1 line

kv_smc.o kv_dpm.o \ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o

gmc_v6_0.o

Quoted 4 lines
Quoted 4 lines

gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o

amdgpu-y += \
- vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o

vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o

Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h void amdgpu_mm_wreg(struct amdgpu_device

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/Makefile +2 -0
+       vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o 
+ nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o
 
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct amdgpu_device

*adev,

Quoted 29 lines
Quoted 29 lines

uint32_t reg, uint32_t v, bool amdgpu_device_asic_has_dc_support(enum
amd_asic_type asic_type); bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +12 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 20

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +8 -0
+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,

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 24

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +4 -0
+EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN

NO

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 30

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +6 -0
+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

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +12 -0
+USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev) {
+       return 0;
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/soc15.c static int soc15_common_hw_init(void *handle)

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +2 -0
+}
+
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void *handle)

{

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
        struct amdgpu_device *adev = (struct amdgpu_device 
 *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
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

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

A message that is not in the archive (sent off-list or not yet received): DM5PR12MB1179375843EB379B4B3315C8F4FD0-2J9CzHegvk8p/[email protected]

Reviewed-by Alex Deucher
#15 lore raw
Quoted 11 lines

-----Original Message-----
From: Liu, Shaoyun
Sent: Tuesday, February 6, 2018 5:42 PM
To: Deucher, Alexander <[email protected]>
Cc: amd-gfx list <[email protected]>; Bridgman, John <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Thanks . Can I add Review-By you for this patch ?

I'd prefer to adjust the logic as per my suggestion below to make things more consistent between silicon and emulation, but if you want to make those changes as a follow-on patch, I'm ok with that. Please add a better commit message. With that:

Quoted 199 lines

Shaoyun.liu

-----Original Message-----
From: Deucher, Alexander
Sent: Tuesday, February 06, 2018 5:37 PM
To: Liu, Shaoyun; Alex Deucher
Cc: amd-gfx list; Bridgman, John
Subject: RE: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Liu, Shaoyun
Sent: Tuesday, February 6, 2018 5:26 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>; Bridgman, John <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 8 lines

You are right , I try to use the emu_soc_asic_init()as a entry point for any family .
For driver to get into amdgpu_atom_asic_init() function call , it depends on other logic like read bios and check some register etc . On emulation mode , we can not get bios image so it will requires more code and logic change based on existing code than we use the common hw init entry point to simulate the post . In either way ,do you agree to keep a separate file as emu_soc.c for this init sequence on

emulation mdoe?

You already sent out a patch to skip all of the vbios fetching and asic init stuff if emu ==1, It would be a trivial patch on top of that one to just call the emu_soc code when emu == 1 in amdgpu_device_init(). I'm fine with the separate file. You've convinced me.

Alex

Quoted 85 lines

Shaoyun.liu

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 5:03 PM
To: Liu, Shaoyun
Cc: Bridgman, John; amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

Quoted 2 lines · Shaoyun

Ye, I try to put the asic specific register sequences for emulation in a

separate emu_soc.c file, I think it's suggested by John or you ? The asic specific code will be keep in separate bring up branch , but a common place to add them seems not bad to me .

Quoted 2 lines

Shaoyun.liu

I guess the idea is that you could use emu_soc_asic_init() for any family, that makes sense. To keep the logic more similar to actual silicon, it might be better to make emu_soc_asic_init() a replacement for atom_asic_init() in amdgpu_device.c. E.g.,

if (emu == 1) {
    emu_soc_asic_init();
} else {
    // do vbios stuff
}

Then we can drop the other changes to the ip ordering for emulation.

Alex

Quoted 10 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 4:46 PM
To: Liu, Shaoyun
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: Add place holder for soc15 asic init on emulation

On Tue, Feb 6, 2018 at 4:41 PM, Shaoyun Liu <[email protected]>

Quoted 5 lines · wrote:
Quoted 2 lines
Change-Id I6ff04e1199d1ebdbdb31d0e7e8ca3c240c61ab3a

What is the purpose of this? If it's just as a hint the the driver writer as to

where to add the emulation register sequences from the IP teams, I don't see much value in it. Just add a comment.

Quoted 8 lines

Alex

Quoted 4 lines
---
 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-

drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
drivers/gpu/drm/amd/amdgpu/emu_soc.c | 33

+++++++++++++++++++++++++++++++++

Quoted 10 lines

drivers/gpu/drm/amd/amdgpu/Makefile amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o

Quoted 10 lines
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)  create mode

100644 drivers/gpu/drm/amd/amdgpu/emu_soc.c

drivers/gpu/drm/amd/amdgpu/Makefile +0 -0
index 1f6d43e..6f5db5e 100644
@@ -41,7 +41,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o

cik_ih.o

Quoted 1 line
Quoted 1 line

kv_smc.o kv_dpm.o \ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o

gmc_v6_0.o

Quoted 4 lines
Quoted 4 lines

gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o

amdgpu-y += \
- vi.o mxgpu_vi.o nbio_v6_1.o soc15.o mxgpu_ai.o nbio_v7_0.o

vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o

Quoted 3 lines
Quoted 3 lines

+ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o
+ nbio_v7_0.o vega10_reg_init.o vega20_reg_init.o nbio_v7_4.o

Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h void amdgpu_mm_wreg(struct

Quoted 8 lines
 # add GMC block
 amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index d417cfb..13aa8a8 100644
@@ -1740,6 +1740,8 @@ void amdgpu_mm_wreg(struct

amdgpu_device

Quoted 4 lines

*adev,

Quoted 3 lines
Quoted 3 lines

uint32_t reg, uint32_t v, bool
amdgpu_device_asic_has_dc_support(enum
amd_asic_type asic_type); bool

amdgpu_device_has_dc_support(struct

Quoted 35 lines
Quoted 26 lines
Quoted 26 lines

amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int emu_soc_asic_init(struct amdgpu_device *adev);
+
 /*
  * Registers read & write functions.
  */
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +12 -0
new file mode 100644
index 0000000..d72c25c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 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
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 20

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +8 -0
+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,

Quoted 7 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 24

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +4 -0
+EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN

NO

Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +2 -0
+EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY

CLAIM,

Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/emu_soc.c line 30

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +4 -0
+DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE

OR

Quoted 14 lines

THE

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +13 -0
+USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "amdgpu.h"
+#include "soc15.h"
+
+#include "soc15_common.h"
+#include "soc15_hw_ip.h"
+
+int emu_soc_asic_init(struct amdgpu_device *adev) {
+       return 0;
+}
Quoted 30 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/soc15.c static int soc15_common_hw_init(void

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/emu_soc.c new file +1 -0
+
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 22cd84f..6a3d108 100644
@@ -747,6 +747,10 @@ static int soc15_common_hw_init(void

*handle)

Quoted 22 lines

{

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -1
        struct amdgpu_device *adev = (struct amdgpu_device
 *)handle;
 
+       /* Add asic specific init sequence for emulation */
+       if (amdgpu_emu_mode == 1)
+               emu_soc_asic_init(adev);
+
        /* enable pcie gen2/3 link */
        soc15_pcie_gen3_enable(adev);
        /* enable aspm */
--

1.9.1

Quoted 4 lines
Quoted 4 lines

_______________________________________________
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

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