<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Leo<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please check my new patch serials , totally 6 sub patches<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks !<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">_____________________________________<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black;background:white">Monk Liu|GPU Virtualization Team |</span><span style="font-size:12.0pt;color:#C82613;border:none windowtext 1.0pt;padding:0in;background:white">AMD<o:p></o:p></span></p>
<p class="MsoNormal"><img width="80" height="80" style="width:.8333in;height:.8333in" id="Picture_x0020_1" src="cid:image001.png@01D5F335.CACDF850" alt="sig-cloud-gpu"><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Liu, Leo <Leo.Liu@amd.com> <br>
<b>Sent:</b> Thursday, March 5, 2020 7:28 PM<br>
<b>To:</b> Liu, Monk <Monk.Liu@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhao, Jiange <Jiange.Zhao@amd.com>; Opara, Darlington <Darlington.Opara@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: enable vcn 2.0 for SRIOV on NV12<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please separate the patch to a set of patches and add meaningful commit message about the changes to each of patches.
<br>
<br>
Leo<o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Monk Liu <<a href="mailto:Monk.Liu@amd.com">Monk.Liu@amd.com</a>><br>
<b>Sent:</b> March 5, 2020 4:48:37 AM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Cc:</b> Zhao, Jiange <<a href="mailto:Jiange.Zhao@amd.com">Jiange.Zhao@amd.com</a>>; Opara, Darlington <<a href="mailto:Darlington.Opara@amd.com">Darlington.Opara@amd.com</a>>; Liu, Monk <<a href="mailto:Monk.Liu@amd.com">Monk.Liu@amd.com</a>><br>
<b>Subject:</b> [PATCH] drm/amdgpu: enable vcn 2.0 for SRIOV on NV12</span> <o:p>
</o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">this a patch that port from SRIOV project branch<br>
to fix those IB/RING test fail on VCN 2.0 rings<br>
<br>
Signed-off-by: Darlington Opara <<a href="mailto:darlington.opara@amd.com">darlington.opara@amd.com</a>><br>
Signed-off-by: Jiange Zhao <<a href="mailto:jiange.zhao@amd.com">jiange.zhao@amd.com</a>><br>
Signed-off-by: Monk Liu <<a href="mailto:Monk.Liu@amd.com">Monk.Liu@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c           |   3 +<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c            |  14 +-<br>
 drivers/gpu/drm/amd/amdgpu/mmsch_v2_0.h            | 141 ++++++++++<br>
 drivers/gpu/drm/amd/amdgpu/nv.c                    |   3 +-<br>
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c              | 303 ++++++++++++++++++++-<br>
 .../amd/include/asic_reg/vcn/vcn_2_0_0_offset.h    | 197 ++++++++++++++<br>
 6 files changed, 637 insertions(+), 24 deletions(-)<br>
 create mode 100644 drivers/gpu/drm/amd/amdgpu/mmsch_v2_0.h<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c<br>
index 5727f00a..0120130 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c<br>
@@ -181,6 +181,9 @@ int amdgpu_jpeg_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)<br>
         struct dma_fence *fence = NULL;<br>
         long r = 0;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return 0;<br>
+<br>
         r = amdgpu_jpeg_dec_set_reg(ring, 1, &fence);<br>
         if (r)<br>
                 goto error;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
index f96464e..ca7c9a6 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
@@ -359,6 +359,9 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring)<br>
         unsigned i;<br>
         int r;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return 0;<br>
+<br>
         WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);<br>
         r = amdgpu_ring_alloc(ring, 3);<br>
         if (r)<br>
@@ -497,10 +500,6 @@ int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)<br>
         struct dma_fence *fence;<br>
         long r;<br>
 <br>
-       /* temporarily disable ib test for sriov */<br>
-       if (amdgpu_sriov_vf(adev))<br>
-               return 0;<br>
-<br>
         r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL);<br>
         if (r)<br>
                 goto error;<br>
@@ -527,6 +526,9 @@ int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring)<br>
         unsigned i;<br>
         int r;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return 0;<br>
+<br>
         r = amdgpu_ring_alloc(ring, 16);<br>
         if (r)<br>
                 return r;<br>
@@ -661,10 +663,6 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)<br>
         struct amdgpu_bo *bo = NULL;<br>
         long r;<br>
 <br>
-       /* temporarily disable ib test for sriov */<br>
-       if (amdgpu_sriov_vf(adev))<br>
-               return 0;<br>
-<br>
         r = amdgpu_bo_create_reserved(ring->adev, 128 * 1024, PAGE_SIZE,<br>
                                       AMDGPU_GEM_DOMAIN_VRAM,<br>
                                       &bo, NULL, NULL);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mmsch_v2_0.h b/drivers/gpu/drm/amd/amdgpu/mmsch_v2_0.h<br>
new file mode 100644<br>
index 0000000..ad99e92<br>
--- /dev/null<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mmsch_v2_0.h<br>
@@ -0,0 +1,141 @@<br>
+/*<br>
+ * Copyright 2019 Advanced Micro Devices, Inc.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice shall be included in<br>
+ * all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
+ * OTHER DEALINGS IN THE SOFTWARE.<br>
+ *<br>
+ */<br>
+<br>
+#ifndef __MMSCH_V2_0_H__<br>
+#define __MMSCH_V2_0_H__<br>
+<br>
+#define MMSCH_VERSION_MAJOR    2<br>
+#define MMSCH_VERSION_MINOR    0<br>
+#define MMSCH_VERSION  (MMSCH_VERSION_MAJOR << 16 | MMSCH_VERSION_MINOR)<br>
+<br>
+enum mmsch_v2_0_command_type {<br>
+       MMSCH_COMMAND__DIRECT_REG_WRITE = 0,<br>
+       MMSCH_COMMAND__DIRECT_REG_POLLING = 2,<br>
+       MMSCH_COMMAND__DIRECT_REG_READ_MODIFY_WRITE = 3,<br>
+       MMSCH_COMMAND__INDIRECT_REG_WRITE = 8,<br>
+       MMSCH_COMMAND__END = 0xf<br>
+};<br>
+<br>
+struct mmsch_v2_0_init_header {<br>
+       uint32_t version;<br>
+       uint32_t header_size;<br>
+       uint32_t vcn_init_status;<br>
+       uint32_t vcn_table_offset;<br>
+       uint32_t vcn_table_size;<br>
+};<br>
+<br>
+struct mmsch_v2_0_cmd_direct_reg_header {<br>
+       uint32_t reg_offset   : 28;<br>
+       uint32_t command_type : 4;<br>
+};<br>
+<br>
+struct mmsch_v2_0_cmd_indirect_reg_header {<br>
+       uint32_t reg_offset    : 20;<br>
+       uint32_t reg_idx_space : 8;<br>
+       uint32_t command_type  : 4;<br>
+};<br>
+<br>
+struct mmsch_v2_0_cmd_direct_write {<br>
+       struct mmsch_v2_0_cmd_direct_reg_header cmd_header;<br>
+       uint32_t reg_value;<br>
+};<br>
+<br>
+struct mmsch_v2_0_cmd_direct_read_modify_write {<br>
+       struct mmsch_v2_0_cmd_direct_reg_header cmd_header;<br>
+       uint32_t write_data;<br>
+       uint32_t mask_value;<br>
+};<br>
+<br>
+struct mmsch_v2_0_cmd_direct_polling {<br>
+       struct mmsch_v2_0_cmd_direct_reg_header cmd_header;<br>
+       uint32_t mask_value;<br>
+       uint32_t wait_value;<br>
+};<br>
+<br>
+struct mmsch_v2_0_cmd_end {<br>
+       struct mmsch_v2_0_cmd_direct_reg_header cmd_header;<br>
+};<br>
+<br>
+struct mmsch_v2_0_cmd_indirect_write {<br>
+       struct mmsch_v2_0_cmd_indirect_reg_header cmd_header;<br>
+       uint32_t reg_value;<br>
+};<br>
+<br>
+static inline void mmsch_v2_0_insert_direct_wt(struct mmsch_v2_0_cmd_direct_write *direct_wt,<br>
+                                              uint32_t *init_table,<br>
+                                              uint32_t reg_offset,<br>
+                                              uint32_t value)<br>
+{<br>
+       direct_wt->cmd_header.reg_offset = reg_offset;<br>
+       direct_wt->reg_value = value;<br>
+       memcpy((void *)init_table, direct_wt, sizeof(struct mmsch_v2_0_cmd_direct_write));<br>
+}<br>
+<br>
+static inline void mmsch_v2_0_insert_direct_rd_mod_wt(struct mmsch_v2_0_cmd_direct_read_modify_write *direct_rd_mod_wt,<br>
+                                                     uint32_t *init_table,<br>
+                                                     uint32_t reg_offset,<br>
+                                                     uint32_t mask, uint32_t data)<br>
+{<br>
+       direct_rd_mod_wt->cmd_header.reg_offset = reg_offset;<br>
+       direct_rd_mod_wt->mask_value = mask;<br>
+       direct_rd_mod_wt->write_data = data;<br>
+       memcpy((void *)init_table, direct_rd_mod_wt,<br>
+              sizeof(struct mmsch_v2_0_cmd_direct_read_modify_write));<br>
+}<br>
+<br>
+static inline void mmsch_v2_0_insert_direct_poll(struct mmsch_v2_0_cmd_direct_polling *direct_poll,<br>
+                                                uint32_t *init_table,<br>
+                                                uint32_t reg_offset,<br>
+                                                uint32_t mask, uint32_t wait)<br>
+{<br>
+       direct_poll->cmd_header.reg_offset = reg_offset;<br>
+       direct_poll->mask_value = mask;<br>
+       direct_poll->wait_value = wait;<br>
+       memcpy((void *)init_table, direct_poll, sizeof(struct mmsch_v2_0_cmd_direct_polling));<br>
+}<br>
+<br>
+#define MMSCH_V2_0_INSERT_DIRECT_RD_MOD_WT(reg, mask, data) { \<br>
+       mmsch_v2_0_insert_direct_rd_mod_wt(&direct_rd_mod_wt, \<br>
+                                          init_table, (reg), \<br>
+                                          (mask), (data)); \<br>
+       init_table += sizeof(struct mmsch_v2_0_cmd_direct_read_modify_write)/4; \<br>
+       table_size += sizeof(struct mmsch_v2_0_cmd_direct_read_modify_write)/4; \<br>
+}<br>
+<br>
+#define MMSCH_V2_0_INSERT_DIRECT_WT(reg, value) { \<br>
+       mmsch_v2_0_insert_direct_wt(&direct_wt, \<br>
+                                   init_table, (reg), \<br>
+                                   (value)); \<br>
+       init_table += sizeof(struct mmsch_v2_0_cmd_direct_write)/4; \<br>
+       table_size += sizeof(struct mmsch_v2_0_cmd_direct_write)/4; \<br>
+}<br>
+<br>
+#define MMSCH_V2_0_INSERT_DIRECT_POLL(reg, mask, wait) { \<br>
+       mmsch_v2_0_insert_direct_poll(&direct_poll, \<br>
+                                     init_table, (reg), \<br>
+                                     (mask), (wait)); \<br>
+       init_table += sizeof(struct mmsch_v2_0_cmd_direct_polling)/4; \<br>
+       table_size += sizeof(struct mmsch_v2_0_cmd_direct_polling)/4; \<br>
+}<br>
+<br>
+#endif<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c<br>
index 2d1bebd..033cbbc 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/nv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c<br>
@@ -516,7 +516,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)<br>
                     !amdgpu_sriov_vf(adev))<br>
                         amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);<br>
                 amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block);<br>
-               amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block);<br>
+               if (!amdgpu_sriov_vf(adev))<br>
+                       amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block);<br>
                 break;<br>
         default:<br>
                 return -EINVAL;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
index c387c81..65f46db 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
@@ -29,23 +29,45 @@<br>
 #include "soc15d.h"<br>
 #include "amdgpu_pm.h"<br>
 #include "amdgpu_psp.h"<br>
+#include "mmsch_v2_0.h"<br>
 <br>
 #include "vcn/vcn_2_0_0_offset.h"<br>
 #include "vcn/vcn_2_0_0_sh_mask.h"<br>
 #include "ivsrcid/vcn/irqsrcs_vcn_2_0.h"<br>
 <br>
-#define mmUVD_CONTEXT_ID_INTERNAL_OFFSET                       0x1fd<br>
-#define mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET                   0x503<br>
-#define mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET                 0x504<br>
-#define mmUVD_GPCOM_VCPU_DATA1_INTERNAL_OFFSET                 0x505<br>
-#define mmUVD_NO_OP_INTERNAL_OFFSET                            0x53f<br>
-#define mmUVD_GP_SCRATCH8_INTERNAL_OFFSET                      0x54a<br>
-#define mmUVD_SCRATCH9_INTERNAL_OFFSET                         0xc01d<br>
-<br>
-#define mmUVD_LMI_RBC_IB_VMID_INTERNAL_OFFSET                  0x1e1<br>
-#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET         0x5a6<br>
-#define mmUVD_LMI_RBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET         0x5a7<br>
-#define mmUVD_RBC_IB_SIZE_INTERNAL_OFFSET                      0x1e2<br>
+#define mmUVD_CONTEXT_ID_INTERNAL_OFFSET            0x1fd<br>
+#define mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET            0x503<br>
+#define mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET          0x504<br>
+#define mmUVD_GPCOM_VCPU_DATA1_INTERNAL_OFFSET          0x505<br>
+#define mmUVD_NO_OP_INTERNAL_OFFSET             0x53f<br>
+#define mmUVD_GP_SCRATCH8_INTERNAL_OFFSET           0x54a<br>
+#define mmUVD_SCRATCH9_INTERNAL_OFFSET              0xc01d<br>
+#define mmUVD_LMI_RBC_IB_VMID_INTERNAL_OFFSET           0x1e1<br>
+#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET     0x5a6<br>
+#define mmUVD_LMI_RBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET      0x5a7<br>
+#define mmUVD_RBC_IB_SIZE_INTERNAL_OFFSET           0x1e2<br>
+#define mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET             0x1bfff<br>
+#define mmUVD_JPEG_GPCOM_CMD_INTERNAL_OFFSET                0x4029<br>
+#define mmUVD_JPEG_GPCOM_DATA0_INTERNAL_OFFSET              0x402a<br>
+#define mmUVD_JPEG_GPCOM_DATA1_INTERNAL_OFFSET              0x402b<br>
+#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_LOW_INTERNAL_OFFSET      0x40ea<br>
+#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_HIGH_INTERNAL_OFFSET     0x40eb<br>
+#define mmUVD_LMI_JRBC_IB_VMID_INTERNAL_OFFSET              0x40cf<br>
+#define mmUVD_LMI_JPEG_VMID_INTERNAL_OFFSET             0x40d1<br>
+#define mmUVD_LMI_JRBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET         0x40e8<br>
+#define mmUVD_LMI_JRBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET        0x40e9<br>
+#define mmUVD_JRBC_IB_SIZE_INTERNAL_OFFSET              0x4082<br>
+#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW_INTERNAL_OFFSET      0x40ec<br>
+#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH_INTERNAL_OFFSET     0x40ed<br>
+#define mmUVD_JRBC_RB_COND_RD_TIMER_INTERNAL_OFFSET         0x4085<br>
+#define mmUVD_JRBC_RB_REF_DATA_INTERNAL_OFFSET              0x4084<br>
+#define mmUVD_JRBC_STATUS_INTERNAL_OFFSET               0x4089<br>
+#define mmUVD_JPEG_PITCH_INTERNAL_OFFSET                0x401f<br>
+#define JRBC_DEC_EXTERNAL_REG_WRITE_ADDR                0x18000<br>
+#define mmUVD_RBC_XX_IB_REG_CHECK                   0x026b<br>
+#define mmUVD_RBC_XX_IB_REG_CHECK_BASE_IDX              1<br>
+#define mmUVD_REG_XX_MASK                       0x026c<br>
+#define mmUVD_REG_XX_MASK_BASE_IDX                  1<br>
 <br>
 static void vcn_v2_0_set_dec_ring_funcs(struct amdgpu_device *adev);<br>
 static void vcn_v2_0_set_enc_ring_funcs(struct amdgpu_device *adev);<br>
@@ -54,7 +76,7 @@ static int vcn_v2_0_set_powergating_state(void *handle,<br>
                                 enum amd_powergating_state state);<br>
 static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,<br>
                                 int inst_idx, struct dpg_pause_state *new_state);<br>
-<br>
+static int vcn_v2_0_start_sriov(struct amdgpu_device *adev);<br>
 /**<br>
  * vcn_v2_0_early_init - set function pointers<br>
  *<br>
@@ -67,7 +89,10 @@ static int vcn_v2_0_early_init(void *handle)<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
 <br>
         adev->vcn.num_vcn_inst = 1;<br>
-       adev->vcn.num_enc_rings = 2;<br>
+       if (amdgpu_sriov_vf(adev))<br>
+               adev->vcn.num_enc_rings = 1;<br>
+       else<br>
+               adev->vcn.num_enc_rings = 2;<br>
 <br>
         vcn_v2_0_set_dec_ring_funcs(adev);<br>
         vcn_v2_0_set_enc_ring_funcs(adev);<br>
@@ -154,7 +179,10 @@ static int vcn_v2_0_sw_init(void *handle)<br>
         for (i = 0; i < adev->vcn.num_enc_rings; ++i) {<br>
                 ring = &adev->vcn.inst->ring_enc[i];<br>
                 ring->use_doorbell = true;<br>
-               ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 2 + i;<br>
+               if (!amdgpu_sriov_vf(adev))<br>
+                       ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 2 + i;<br>
+               else<br>
+                       ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 1 + i;<br>
                 sprintf(ring->name, "vcn_enc%d", i);<br>
                 r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0);<br>
                 if (r)<br>
@@ -163,6 +191,10 @@ static int vcn_v2_0_sw_init(void *handle)<br>
 <br>
         adev->vcn.pause_dpg_mode = vcn_v2_0_pause_dpg_mode;<br>
 <br>
+       r = amdgpu_virt_alloc_mm_table(adev);<br>
+       if (r)<br>
+               return r;<br>
+<br>
         return 0;<br>
 }<br>
 <br>
@@ -178,6 +210,8 @@ static int vcn_v2_0_sw_fini(void *handle)<br>
         int r;<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
 <br>
+       amdgpu_virt_free_mm_table(adev);<br>
+<br>
         r = amdgpu_vcn_suspend(adev);<br>
         if (r)<br>
                 return r;<br>
@@ -203,6 +237,9 @@ static int vcn_v2_0_hw_init(void *handle)<br>
         adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,<br>
                                              ring->doorbell_index, 0);<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               vcn_v2_0_start_sriov(adev);<br>
+<br>
         r = amdgpu_ring_test_helper(ring);<br>
         if (r)<br>
                 goto done;<br>
@@ -304,6 +341,9 @@ static void vcn_v2_0_mc_resume(struct amdgpu_device *adev)<br>
         uint32_t size = AMDGPU_GPU_PAGE_ALIGN(adev->vcn.fw->size + 4);<br>
         uint32_t offset;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return;<br>
+<br>
         /* cache window 0: fw */<br>
         if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {<br>
                 WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,<br>
@@ -448,6 +488,9 @@ static void vcn_v2_0_disable_clock_gating(struct amdgpu_device *adev)<br>
 {<br>
         uint32_t data;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return;<br>
+<br>
         /* UVD disable CGC */<br>
         data = RREG32_SOC15(VCN, 0, mmUVD_CGC_CTRL);<br>
         if (adev->cg_flags & AMD_CG_SUPPORT_VCN_MGCG)<br>
@@ -606,6 +649,9 @@ static void vcn_v2_0_enable_clock_gating(struct amdgpu_device *adev)<br>
 {<br>
         uint32_t data = 0;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return;<br>
+<br>
         /* enable UVD CGC */<br>
         data = RREG32_SOC15(VCN, 0, mmUVD_CGC_CTRL);<br>
         if (adev->cg_flags & AMD_CG_SUPPORT_VCN_MGCG)<br>
@@ -658,6 +704,9 @@ static void vcn_v2_0_disable_static_power_gating(struct amdgpu_device *adev)<br>
         uint32_t data = 0;<br>
         int ret;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return;<br>
+<br>
         if (adev->pg_flags & AMD_PG_SUPPORT_VCN) {<br>
                 data = (1 << UVD_PGFSM_CONFIG__UVDM_PWR_CONFIG__SHIFT<br>
                         | 1 << UVD_PGFSM_CONFIG__UVDU_PWR_CONFIG__SHIFT<br>
@@ -705,6 +754,9 @@ static void vcn_v2_0_enable_static_power_gating(struct amdgpu_device *adev)<br>
         uint32_t data = 0;<br>
         int ret;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return;<br>
+<br>
         if (adev->pg_flags & AMD_PG_SUPPORT_VCN) {<br>
                 /* Before power off, this indicator has to be turned on */<br>
                 data = RREG32_SOC15(VCN, 0, mmUVD_POWER_STATUS);<br>
@@ -1191,6 +1243,7 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,<br>
         return 0;<br>
 }<br>
 <br>
+<br>
 static bool vcn_v2_0_is_idle(void *handle)<br>
 {<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
@@ -1215,6 +1268,9 @@ static int vcn_v2_0_set_clockgating_state(void *handle,<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
         bool enable = (state == AMD_CG_STATE_GATE);<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return 0;<br>
+<br>
         if (enable) {<br>
                 /* wait for STATUS to clear */<br>
                 if (vcn_v2_0_is_idle(handle))<br>
@@ -1631,6 +1687,9 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)<br>
         unsigned i;<br>
         int r;<br>
 <br>
+       if (amdgpu_sriov_vf(adev))<br>
+               return 0;<br>
+<br>
         WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);<br>
         r = amdgpu_ring_alloc(ring, 4);<br>
         if (r)<br>
@@ -1667,6 +1726,11 @@ static int vcn_v2_0_set_powergating_state(void *handle,<br>
         int ret;<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
 <br>
+       if (amdgpu_sriov_vf(adev)) {<br>
+               adev->vcn.cur_state = AMD_PG_STATE_UNGATE;<br>
+               return 0;<br>
+       }<br>
+<br>
         if (state == adev->vcn.cur_state)<br>
                 return 0;<br>
 <br>
@@ -1680,6 +1744,215 @@ static int vcn_v2_0_set_powergating_state(void *handle,<br>
         return ret;<br>
 }<br>
 <br>
+static int vcn_v2_0_start_mmsch(struct amdgpu_device *adev,<br>
+                               struct amdgpu_mm_table *table)<br>
+{<br>
+       uint32_t data = 0, loop;<br>
+       uint64_t addr = table->gpu_addr;<br>
+       struct mmsch_v2_0_init_header *header;<br>
+       uint32_t size;<br>
+       int i;<br>
+<br>
+       header = (struct mmsch_v2_0_init_header *)table->cpu_addr;<br>
+       size = header->header_size + header->vcn_table_size;<br>
+<br>
+       /* 1, write to vce_mmsch_vf_ctx_addr_lo/hi register with GPU mc addr<br>
+        * of memory descriptor location<br>
+        */<br>
+       WREG32_SOC15(UVD, 0, mmMMSCH_VF_CTX_ADDR_LO, lower_32_bits(addr));<br>
+       WREG32_SOC15(UVD, 0, mmMMSCH_VF_CTX_ADDR_HI, upper_32_bits(addr));<br>
+<br>
+       /* 2, update vmid of descriptor */<br>
+       data = RREG32_SOC15(UVD, 0, mmMMSCH_VF_VMID);<br>
+       data &= ~MMSCH_VF_VMID__VF_CTX_VMID_MASK;<br>
+       /* use domain0 for MM scheduler */<br>
+       data |= (0 << MMSCH_VF_VMID__VF_CTX_VMID__SHIFT);<br>
+       WREG32_SOC15(UVD, 0, mmMMSCH_VF_VMID, data);<br>
+<br>
+       /* 3, notify mmsch about the size of this descriptor */<br>
+       WREG32_SOC15(UVD, 0, mmMMSCH_VF_CTX_SIZE, size);<br>
+<br>
+       /* 4, set resp to zero */<br>
+       WREG32_SOC15(UVD, 0, mmMMSCH_VF_MAILBOX_RESP, 0);<br>
+<br>
+       adev->vcn.inst->ring_dec.wptr = 0;<br>
+       adev->vcn.inst->ring_dec.wptr_old = 0;<br>
+       vcn_v2_0_dec_ring_set_wptr(&adev->vcn.inst->ring_dec);<br>
+<br>
+       for (i = 0; i < adev->vcn.num_enc_rings; ++i) {<br>
+               adev->vcn.inst->ring_enc[i].wptr = 0;<br>
+               adev->vcn.inst->ring_enc[i].wptr_old = 0;<br>
+               vcn_v2_0_enc_ring_set_wptr(&adev->vcn.inst->ring_enc[i]);<br>
+       }<br>
+<br>
+       /* 5, kick off the initialization and wait until<br>
+        * VCE_MMSCH_VF_MAILBOX_RESP becomes non-zero<br>
+        */<br>
+       WREG32_SOC15(UVD, 0, mmMMSCH_VF_MAILBOX_HOST, 0x10000001);<br>
+<br>
+       data = RREG32_SOC15(UVD, 0, mmMMSCH_VF_MAILBOX_RESP);<br>
+       loop = 1000;<br>
+       while ((data & 0x10000002) != 0x10000002) {<br>
+               udelay(10);<br>
+               data = RREG32_SOC15(UVD, 0, mmMMSCH_VF_MAILBOX_RESP);<br>
+               loop--;<br>
+               if (!loop)<br>
+                       break;<br>
+       }<br>
+<br>
+       if (!loop) {<br>
+               DRM_ERROR("failed to init MMSCH, " \<br>
+                       "mmMMSCH_VF_MAILBOX_RESP = 0x%08x\n", data);<br>
+               return -EBUSY;<br>
+       }<br>
+<br>
+       return 0;<br>
+}<br>
+<br>
+static int vcn_v2_0_start_sriov(struct amdgpu_device *adev)<br>
+{<br>
+       int r;<br>
+       uint32_t tmp;<br>
+       struct amdgpu_ring *ring;<br>
+       uint32_t offset, size;<br>
+       uint32_t table_size = 0;<br>
+       struct mmsch_v2_0_cmd_direct_write direct_wt = { {0} };<br>
+       struct mmsch_v2_0_cmd_direct_read_modify_write direct_rd_mod_wt = { {0} };<br>
+       struct mmsch_v2_0_cmd_direct_polling direct_poll = { {0} };<br>
+       struct mmsch_v2_0_cmd_end end = { {0} };<br>
+       struct mmsch_v2_0_init_header *header;<br>
+       uint32_t *init_table = adev->virt.mm_table.cpu_addr;<br>
+       uint8_t i = 0;<br>
+<br>
+       header = (struct mmsch_v2_0_init_header *)init_table;<br>
+       direct_wt.cmd_header.command_type = MMSCH_COMMAND__DIRECT_REG_WRITE;<br>
+       direct_rd_mod_wt.cmd_header.command_type =<br>
+               MMSCH_COMMAND__DIRECT_REG_READ_MODIFY_WRITE;<br>
+       direct_poll.cmd_header.command_type =<br>
+               MMSCH_COMMAND__DIRECT_REG_POLLING;<br>
+       end.cmd_header.command_type = MMSCH_COMMAND__END;<br>
+<br>
+       if (header->vcn_table_offset == 0 && header->vcn_table_size == 0) {<br>
+               header->version = MMSCH_VERSION;<br>
+               header->header_size = sizeof(struct mmsch_v2_0_init_header) >> 2;<br>
+<br>
+               header->vcn_table_offset = header->header_size;<br>
+<br>
+               init_table += header->vcn_table_offset;<br>
+<br>
+               size = AMDGPU_GPU_PAGE_ALIGN(adev->vcn.fw->size + 4);<br>
+<br>
+               MMSCH_V2_0_INSERT_DIRECT_RD_MOD_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_STATUS),<br>
+                       0xFFFFFFFF, 0x00000004);<br>
+<br>
+               /* mc resume*/<br>
+               if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {<br>
+                       tmp = AMDGPU_UCODE_ID_VCN;<br>
+                       MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                               SOC15_REG_OFFSET(UVD, i,<br>
+                                       mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW),<br>
+                               adev->firmware.ucode[tmp].tmr_mc_addr_lo);<br>
+                       MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                               SOC15_REG_OFFSET(UVD, i,<br>
+                                       mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH),<br>
+                               adev->firmware.ucode[tmp].tmr_mc_addr_hi);<br>
+                       offset = 0;<br>
+               } else {<br>
+                       MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                               SOC15_REG_OFFSET(UVD, i,<br>
+                                       mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW),<br>
+                               lower_32_bits(adev->vcn.inst->gpu_addr));<br>
+                       MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                               SOC15_REG_OFFSET(UVD, i,<br>
+                                       mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH),<br>
+                               upper_32_bits(adev->vcn.inst->gpu_addr));<br>
+                       offset = size;<br>
+               }<br>
+<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_OFFSET0),<br>
+                       0);<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_SIZE0),<br>
+                       size);<br>
+<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i,<br>
+                               mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW),<br>
+                       lower_32_bits(adev->vcn.inst->gpu_addr + offset));<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i,<br>
+                               mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_HIGH),<br>
+                       upper_32_bits(adev->vcn.inst->gpu_addr + offset));<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_OFFSET1),<br>
+                       0);<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_SIZE1),<br>
+                       AMDGPU_VCN_STACK_SIZE);<br>
+<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i,<br>
+                               mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_LOW),<br>
+                       lower_32_bits(adev->vcn.inst->gpu_addr + offset +<br>
+                               AMDGPU_VCN_STACK_SIZE));<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i,<br>
+                               mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_HIGH),<br>
+                       upper_32_bits(adev->vcn.inst->gpu_addr + offset +<br>
+                               AMDGPU_VCN_STACK_SIZE));<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_OFFSET2),<br>
+                       0);<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_SIZE2),<br>
+                       AMDGPU_VCN_CONTEXT_SIZE);<br>
+<br>
+               for (r = 0; r < adev->vcn.num_enc_rings; ++r) {<br>
+                       ring = &adev->vcn.inst->ring_enc[r];<br>
+                       ring->wptr = 0;<br>
+                       MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                               SOC15_REG_OFFSET(UVD, i, mmUVD_RB_BASE_LO),<br>
+                               lower_32_bits(ring->gpu_addr));<br>
+                       MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                               SOC15_REG_OFFSET(UVD, i, mmUVD_RB_BASE_HI),<br>
+                               upper_32_bits(ring->gpu_addr));<br>
+                       MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                               SOC15_REG_OFFSET(UVD, i, mmUVD_RB_SIZE),<br>
+                               ring->ring_size / 4);<br>
+               }<br>
+<br>
+               ring = &adev->vcn.inst->ring_dec;<br>
+               ring->wptr = 0;<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i,<br>
+                               mmUVD_LMI_RBC_RB_64BIT_BAR_LOW),<br>
+                       lower_32_bits(ring->gpu_addr));<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i,<br>
+                               mmUVD_LMI_RBC_RB_64BIT_BAR_HIGH),<br>
+                       upper_32_bits(ring->gpu_addr));<br>
+               /* force RBC into idle state */<br>
+               tmp = order_base_2(ring->ring_size);<br>
+               tmp = REG_SET_FIELD(0, UVD_RBC_RB_CNTL, RB_BUFSZ, tmp);<br>
+               tmp = REG_SET_FIELD(tmp, UVD_RBC_RB_CNTL, RB_BLKSZ, 1);<br>
+               tmp = REG_SET_FIELD(tmp, UVD_RBC_RB_CNTL, RB_NO_FETCH, 1);<br>
+               tmp = REG_SET_FIELD(tmp, UVD_RBC_RB_CNTL, RB_NO_UPDATE, 1);<br>
+               tmp = REG_SET_FIELD(tmp, UVD_RBC_RB_CNTL, RB_RPTR_WR_EN, 1);<br>
+               MMSCH_V2_0_INSERT_DIRECT_WT(<br>
+                       SOC15_REG_OFFSET(UVD, i, mmUVD_RBC_RB_CNTL), tmp);<br>
+<br>
+               /* add end packet */<br>
+               tmp = sizeof(struct mmsch_v2_0_cmd_end);<br>
+               memcpy((void *)init_table, &end, tmp);<br>
+               table_size += (tmp / 4);<br>
+               header->vcn_table_size = table_size;<br>
+<br>
+       }<br>
+       return vcn_v2_0_start_mmsch(adev, &adev->virt.mm_table);<br>
+}<br>
+<br>
 static const struct amd_ip_funcs vcn_v2_0_ip_funcs = {<br>
         .name = "vcn_v2_0",<br>
         .early_init = vcn_v2_0_early_init,<br>
diff --git a/drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_2_0_0_offset.h b/drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_2_0_0_offset.h<br>
index b089af6..e67cfcf 100644<br>
--- a/drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_2_0_0_offset.h<br>
+++ b/drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_2_0_0_offset.h<br>
@@ -22,6 +22,203 @@<br>
 #define _vcn_2_0_0_OFFSET_HEADER<br>
 <br>
 <br>
+// addressBlock: uvd0_mmsch_dec<br>
+// base address: 0x1e000<br>
+#define mmMMSCH_UCODE_ADDR                                                                             0x0000<br>
+#define mmMMSCH_UCODE_ADDR_BASE_IDX                                                                    0<br>
+#define mmMMSCH_UCODE_DATA                                                                             0x0001<br>
+#define mmMMSCH_UCODE_DATA_BASE_IDX                                                                    0<br>
+#define mmMMSCH_SRAM_ADDR                                                                              0x0002<br>
+#define mmMMSCH_SRAM_ADDR_BASE_IDX                                                                     0<br>
+#define mmMMSCH_SRAM_DATA                                                                              0x0003<br>
+#define mmMMSCH_SRAM_DATA_BASE_IDX                                                                     0<br>
+#define mmMMSCH_VF_SRAM_OFFSET                                                                         0x0004<br>
+#define mmMMSCH_VF_SRAM_OFFSET_BASE_IDX                                                                0<br>
+#define mmMMSCH_DB_SRAM_OFFSET                                                                         0x0005<br>
+#define mmMMSCH_DB_SRAM_OFFSET_BASE_IDX                                                                0<br>
+#define mmMMSCH_CTX_SRAM_OFFSET                                                                        0x0006<br>
+#define mmMMSCH_CTX_SRAM_OFFSET_BASE_IDX                                                               0<br>
+#define mmMMSCH_CTL                                                                                    0x0007<br>
+#define mmMMSCH_CTL_BASE_IDX                                                                           0<br>
+#define mmMMSCH_INTR                                                                                   0x0008<br>
+#define mmMMSCH_INTR_BASE_IDX                                                                          0<br>
+#define mmMMSCH_INTR_ACK                                                                               0x0009<br>
+#define mmMMSCH_INTR_ACK_BASE_IDX                                                                      0<br>
+#define mmMMSCH_INTR_STATUS                                                                            0x000a<br>
+#define mmMMSCH_INTR_STATUS_BASE_IDX                                                                   0<br>
+#define mmMMSCH_VF_VMID                                                                                0x000b<br>
+#define mmMMSCH_VF_VMID_BASE_IDX                                                                       0<br>
+#define mmMMSCH_VF_CTX_ADDR_LO                                                                         0x000c<br>
+#define mmMMSCH_VF_CTX_ADDR_LO_BASE_IDX                                                                0<br>
+#define mmMMSCH_VF_CTX_ADDR_HI                                                                         0x000d<br>
+#define mmMMSCH_VF_CTX_ADDR_HI_BASE_IDX                                                                0<br>
+#define mmMMSCH_VF_CTX_SIZE                                                                            0x000e<br>
+#define mmMMSCH_VF_CTX_SIZE_BASE_IDX                                                                   0<br>
+#define mmMMSCH_VF_GPCOM_ADDR_LO                                                                       0x000f<br>
+#define mmMMSCH_VF_GPCOM_ADDR_LO_BASE_IDX                                                              0<br>
+#define mmMMSCH_VF_GPCOM_ADDR_HI                                                                       0x0010<br>
+#define mmMMSCH_VF_GPCOM_ADDR_HI_BASE_IDX                                                              0<br>
+#define mmMMSCH_VF_GPCOM_SIZE                                                                          0x0011<br>
+#define mmMMSCH_VF_GPCOM_SIZE_BASE_IDX                                                                 0<br>
+#define mmMMSCH_VF_MAILBOX_HOST                                                                        0x0012<br>
+#define mmMMSCH_VF_MAILBOX_HOST_BASE_IDX                                                               0<br>
+#define mmMMSCH_VF_MAILBOX_RESP                                                                        0x0013<br>
+#define mmMMSCH_VF_MAILBOX_RESP_BASE_IDX                                                               0<br>
+#define mmMMSCH_VF_MAILBOX_0                                                                           0x0014<br>
+#define mmMMSCH_VF_MAILBOX_0_BASE_IDX                                                                  0<br>
+#define mmMMSCH_VF_MAILBOX_0_RESP                                                                      0x0015<br>
+#define mmMMSCH_VF_MAILBOX_0_RESP_BASE_IDX                                                             0<br>
+#define mmMMSCH_VF_MAILBOX_1                                                                           0x0016<br>
+#define mmMMSCH_VF_MAILBOX_1_BASE_IDX                                                                  0<br>
+#define mmMMSCH_VF_MAILBOX_1_RESP                                                                      0x0017<br>
+#define mmMMSCH_VF_MAILBOX_1_RESP_BASE_IDX                                                             0<br>
+#define mmMMSCH_CNTL                                                                                   0x001c<br>
+#define mmMMSCH_CNTL_BASE_IDX                                                                          0<br>
+#define mmMMSCH_NONCACHE_OFFSET0                                                                       0x001d<br>
+#define mmMMSCH_NONCACHE_OFFSET0_BASE_IDX                                                              0<br>
+#define mmMMSCH_NONCACHE_SIZE0                                                                         0x001e<br>
+#define mmMMSCH_NONCACHE_SIZE0_BASE_IDX                                                                0<br>
+#define mmMMSCH_NONCACHE_OFFSET1                                                                       0x001f<br>
+#define mmMMSCH_NONCACHE_OFFSET1_BASE_IDX                                                              0<br>
+#define mmMMSCH_NONCACHE_SIZE1                                                                         0x0020<br>
+#define mmMMSCH_NONCACHE_SIZE1_BASE_IDX                                                                0<br>
+#define mmMMSCH_PDEBUG_STATUS                                                                          0x0021<br>
+#define mmMMSCH_PDEBUG_STATUS_BASE_IDX                                                                 0<br>
+#define mmMMSCH_PDEBUG_DATA_32UPPERBITS                                                                0x0022<br>
+#define mmMMSCH_PDEBUG_DATA_32UPPERBITS_BASE_IDX                                                       0<br>
+#define mmMMSCH_PDEBUG_DATA_32LOWERBITS                                                                0x0023<br>
+#define mmMMSCH_PDEBUG_DATA_32LOWERBITS_BASE_IDX                                                       0<br>
+#define mmMMSCH_PDEBUG_EPC                                                                             0x0024<br>
+#define mmMMSCH_PDEBUG_EPC_BASE_IDX                                                                    0<br>
+#define mmMMSCH_PDEBUG_EXCCAUSE                                                                        0x0025<br>
+#define mmMMSCH_PDEBUG_EXCCAUSE_BASE_IDX                                                               0<br>
+#define mmMMSCH_PROC_STATE1                                                                            0x0026<br>
+#define mmMMSCH_PROC_STATE1_BASE_IDX                                                                   0<br>
+#define mmMMSCH_LAST_MC_ADDR                                                                           0x0027<br>
+#define mmMMSCH_LAST_MC_ADDR_BASE_IDX                                                                  0<br>
+#define mmMMSCH_LAST_MEM_ACCESS_HI                                                                     0x0028<br>
+#define mmMMSCH_LAST_MEM_ACCESS_HI_BASE_IDX                                                            0<br>
+#define mmMMSCH_LAST_MEM_ACCESS_LO                                                                     0x0029<br>
+#define mmMMSCH_LAST_MEM_ACCESS_LO_BASE_IDX                                                            0<br>
+#define mmMMSCH_IOV_ACTIVE_FCN_ID                                                                      0x002a<br>
+#define mmMMSCH_IOV_ACTIVE_FCN_ID_BASE_IDX                                                             0<br>
+#define mmMMSCH_SCRATCH_0                                                                              0x002b<br>
+#define mmMMSCH_SCRATCH_0_BASE_IDX                                                                     0<br>
+#define mmMMSCH_SCRATCH_1                                                                              0x002c<br>
+#define mmMMSCH_SCRATCH_1_BASE_IDX                                                                     0<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_0                                                                     0x002d<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_0_BASE_IDX                                                            0<br>
+#define mmMMSCH_GPUIOV_CMD_CONTROL_0                                                                   0x002e<br>
+#define mmMMSCH_GPUIOV_CMD_CONTROL_0_BASE_IDX                                                          0<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_0                                                                    0x002f<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_0_BASE_IDX                                                           0<br>
+#define mmMMSCH_GPUIOV_VM_BUSY_STATUS_0                                                                0x0030<br>
+#define mmMMSCH_GPUIOV_VM_BUSY_STATUS_0_BASE_IDX                                                       0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCNS_0                                                                   0x0031<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCNS_0_BASE_IDX                                                          0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_0                                                                 0x0032<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_0_BASE_IDX                                                        0<br>
+#define mmMMSCH_GPUIOV_DW6_0                                                                           0x0033<br>
+#define mmMMSCH_GPUIOV_DW6_0_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_DW7_0                                                                           0x0034<br>
+#define mmMMSCH_GPUIOV_DW7_0_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_DW8_0                                                                           0x0035<br>
+#define mmMMSCH_GPUIOV_DW8_0_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_1                                                                     0x0036<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_1_BASE_IDX                                                            0<br>
+#define mmMMSCH_GPUIOV_CMD_CONTROL_1                                                                   0x0037<br>
+#define mmMMSCH_GPUIOV_CMD_CONTROL_1_BASE_IDX                                                          0<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_1                                                                    0x0038<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_1_BASE_IDX                                                           0<br>
+#define mmMMSCH_GPUIOV_VM_BUSY_STATUS_1                                                                0x0039<br>
+#define mmMMSCH_GPUIOV_VM_BUSY_STATUS_1_BASE_IDX                                                       0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCNS_1                                                                   0x003a<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCNS_1_BASE_IDX                                                          0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_1                                                                 0x003b<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_1_BASE_IDX                                                        0<br>
+#define mmMMSCH_GPUIOV_DW6_1                                                                           0x003c<br>
+#define mmMMSCH_GPUIOV_DW6_1_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_DW7_1                                                                           0x003d<br>
+#define mmMMSCH_GPUIOV_DW7_1_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_DW8_1                                                                           0x003e<br>
+#define mmMMSCH_GPUIOV_DW8_1_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_CNTXT                                                                           0x003f<br>
+#define mmMMSCH_GPUIOV_CNTXT_BASE_IDX                                                                  0<br>
+#define mmMMSCH_SCRATCH_2                                                                              0x0040<br>
+#define mmMMSCH_SCRATCH_2_BASE_IDX                                                                     0<br>
+#define mmMMSCH_SCRATCH_3                                                                              0x0041<br>
+#define mmMMSCH_SCRATCH_3_BASE_IDX                                                                     0<br>
+#define mmMMSCH_SCRATCH_4                                                                              0x0042<br>
+#define mmMMSCH_SCRATCH_4_BASE_IDX                                                                     0<br>
+#define mmMMSCH_SCRATCH_5                                                                              0x0043<br>
+#define mmMMSCH_SCRATCH_5_BASE_IDX                                                                     0<br>
+#define mmMMSCH_SCRATCH_6                                                                              0x0044<br>
+#define mmMMSCH_SCRATCH_6_BASE_IDX                                                                     0<br>
+#define mmMMSCH_SCRATCH_7                                                                              0x0045<br>
+#define mmMMSCH_SCRATCH_7_BASE_IDX                                                                     0<br>
+#define mmMMSCH_VFID_FIFO_HEAD_0                                                                       0x0046<br>
+#define mmMMSCH_VFID_FIFO_HEAD_0_BASE_IDX                                                              0<br>
+#define mmMMSCH_VFID_FIFO_TAIL_0                                                                       0x0047<br>
+#define mmMMSCH_VFID_FIFO_TAIL_0_BASE_IDX                                                              0<br>
+#define mmMMSCH_VFID_FIFO_HEAD_1                                                                       0x0048<br>
+#define mmMMSCH_VFID_FIFO_HEAD_1_BASE_IDX                                                              0<br>
+#define mmMMSCH_VFID_FIFO_TAIL_1                                                                       0x0049<br>
+#define mmMMSCH_VFID_FIFO_TAIL_1_BASE_IDX                                                              0<br>
+#define mmMMSCH_NACK_STATUS                                                                            0x004a<br>
+#define mmMMSCH_NACK_STATUS_BASE_IDX                                                                   0<br>
+#define mmMMSCH_VF_MAILBOX0_DATA                                                                       0x004b<br>
+#define mmMMSCH_VF_MAILBOX0_DATA_BASE_IDX                                                              0<br>
+#define mmMMSCH_VF_MAILBOX1_DATA                                                                       0x004c<br>
+#define mmMMSCH_VF_MAILBOX1_DATA_BASE_IDX                                                              0<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_IP_0                                                                  0x004d<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_IP_0_BASE_IDX                                                         0<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_IP_0                                                                 0x004e<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_IP_0_BASE_IDX                                                        0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_IP_0                                                              0x004f<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_IP_0_BASE_IDX                                                     0<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_IP_1                                                                  0x0050<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_IP_1_BASE_IDX                                                         0<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_IP_1                                                                 0x0051<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_IP_1_BASE_IDX                                                        0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_IP_1                                                              0x0052<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_IP_1_BASE_IDX                                                     0<br>
+#define mmMMSCH_GPUIOV_CNTXT_IP                                                                        0x0053<br>
+#define mmMMSCH_GPUIOV_CNTXT_IP_BASE_IDX                                                               0<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_2                                                                     0x0054<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_2_BASE_IDX                                                            0<br>
+#define mmMMSCH_GPUIOV_CMD_CONTROL_2                                                                   0x0055<br>
+#define mmMMSCH_GPUIOV_CMD_CONTROL_2_BASE_IDX                                                          0<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_2                                                                    0x0056<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_2_BASE_IDX                                                           0<br>
+#define mmMMSCH_GPUIOV_VM_BUSY_STATUS_2                                                                0x0057<br>
+#define mmMMSCH_GPUIOV_VM_BUSY_STATUS_2_BASE_IDX                                                       0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCNS_2                                                                   0x0058<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCNS_2_BASE_IDX                                                          0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_2                                                                 0x0059<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_2_BASE_IDX                                                        0<br>
+#define mmMMSCH_GPUIOV_DW6_2                                                                           0x005a<br>
+#define mmMMSCH_GPUIOV_DW6_2_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_DW7_2                                                                           0x005b<br>
+#define mmMMSCH_GPUIOV_DW7_2_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_DW8_2                                                                           0x005c<br>
+#define mmMMSCH_GPUIOV_DW8_2_BASE_IDX                                                                  0<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_IP_2                                                                  0x005d<br>
+#define mmMMSCH_GPUIOV_SCH_BLOCK_IP_2_BASE_IDX                                                         0<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_IP_2                                                                 0x005e<br>
+#define mmMMSCH_GPUIOV_CMD_STATUS_IP_2_BASE_IDX                                                        0<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_IP_2                                                              0x005f<br>
+#define mmMMSCH_GPUIOV_ACTIVE_FCN_ID_IP_2_BASE_IDX                                                     0<br>
+#define mmMMSCH_VFID_FIFO_HEAD_2                                                                       0x0060<br>
+#define mmMMSCH_VFID_FIFO_HEAD_2_BASE_IDX                                                              0<br>
+#define mmMMSCH_VFID_FIFO_TAIL_2                                                                       0x0061<br>
+#define mmMMSCH_VFID_FIFO_TAIL_2_BASE_IDX                                                              0<br>
+#define mmMMSCH_VM_BUSY_STATUS_0                                                                       0x0062<br>
+#define mmMMSCH_VM_BUSY_STATUS_0_BASE_IDX                                                              0<br>
+#define mmMMSCH_VM_BUSY_STATUS_1                                                                       0x0063<br>
+#define mmMMSCH_VM_BUSY_STATUS_1_BASE_IDX                                                              0<br>
+#define mmMMSCH_VM_BUSY_STATUS_2                                                                       0x0064<br>
+#define mmMMSCH_VM_BUSY_STATUS_2_BASE_IDX                                                              0<br>
+<br>
 <br>
 // addressBlock: uvd0_jpegnpdec<br>
 // base address: 0x1e200<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cleo.liu%40amd.com%7C4c2fae0b5b374a86759d08d7c0ea6a4f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637189985360189246&amp;sdata=bzpOv%2FXbxWXKq00Wob%2FcjdCJJV4VfxdNtatel1uWybM%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cleo.liu%40amd.com%7C4c2fae0b5b374a86759d08d7c0ea6a4f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637189985360189246&amp;sdata=bzpOv%2FXbxWXKq00Wob%2FcjdCJJV4VfxdNtatel1uWybM%3D&amp;reserved=0</a><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>