<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Good point, this patch is Reviewed-by:
      Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>.<br>
      <br>
      But please ping the firmware guys if that really could be an
      issue,<br>
      Christian.<br>
      <br>
      Am 26.07.19 um 12:45 schrieb Thai, Thong:<br>
    </div>
    <blockquote type="cite"
cite="mid:BN6PR1201MB0178F74D883BC13DD35CDC369DC00@BN6PR1201MB0178.namprd12.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Exchange Server">
      <!-- converted from text -->
      <style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
      <div>
        <div>
          <div>
            <div style="direction:ltr">Well, not through this particular
              piece of code, since this explicitly sets it. But I would
              imagine someone could set the bit in userspace and insert
              KMD commands in the BO as part of some IB instructions -
              I’ll have a look.</div>
          </div>
          <div><br>
          </div>
        </div>
        <hr tabindex="-1" style="display:inline-block; width:98%">
        <div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
            face="Calibri, sans-serif" color="#000000"><b>From:</b>
            Christian König <a class="moz-txt-link-rfc2396E" href="mailto:ckoenig.leichtzumerken@gmail.com"><ckoenig.leichtzumerken@gmail.com></a><br>
            <b>Sent:</b> Friday, July 26, 2019 3:17:19 AM<br>
            <b>To:</b> Thai, Thong <a class="moz-txt-link-rfc2396E" href="mailto:Thong.Thai@amd.com"><Thong.Thai@amd.com></a>;
            <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
            <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org"><amd-gfx@lists.freedesktop.org></a><br>
            <b>Subject:</b> Re: [PATCH 1/2] drm/amd/amdgpu/vcn_v2_0:
            Mark RB commands as KMD commands</font>
          <div> </div>
        </div>
      </div>
      <font size="2"><span style="font-size:11pt;">
          <div class="PlainText">Am 25.07.19 um 17:52 schrieb Thai,
            Thong:<br>
            > Sets the CMD_SOURCE bit for VCN 2.0 Decoder Ring Buffer
            commands. This<br>
            > bit was previously set by the RBC HW on older firmware.
            Newer firmware<br>
            > uses a SW RBC and this bit has to be set by the driver.<br>
            <br>
            Mhm, another question came to my mind: Would it now be
            possible for user <br>
            space to set this flag and and gain access to the kernel
            driver commands?<br>
            <br>
            Cause that could be a security problem.<br>
            <br>
            Christian.<br>
            <br>
            ><br>
            > Signed-off-by: Thong Thai <a class="moz-txt-link-rfc2396E" href="mailto:thong.thai@amd.com"><thong.thai@amd.com></a><br>
            > ---<br>
            >   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  1 +<br>
            >   drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 12
            ++++++------<br>
            >   2 files changed, 7 insertions(+), 6 deletions(-)<br>
            ><br>
            > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
            b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h<br>
            > index 5e2453ee6b29..4d3bf4adf1eb 100644<br>
            > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h<br>
            > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h<br>
            > @@ -30,6 +30,7 @@<br>
            >   #define AMDGPU_VCN_FIRMWARE_OFFSET  256<br>
            >   #define AMDGPU_VCN_MAX_ENC_RINGS    3<br>
            >   <br>
            > +#define VCN_DEC_KMD_CMD                     
            0x80000000<br>
            >   #define VCN_DEC_CMD_FENCE           0x00000000<br>
            >   #define VCN_DEC_CMD_TRAP            0x00000001<br>
            >   #define VCN_DEC_CMD_WRITE_REG              
            0x00000004<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 bc9726787c97..7091aef95ff0 100644<br>
            > --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
            > +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
            > @@ -1488,7 +1488,7 @@ static void
            vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)<br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));<br>
            >        amdgpu_ring_write(ring, 0);<br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
            > -     amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_START
            << 1);<br>
            > +     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD |
            (VCN_DEC_CMD_PACKET_START << 1));<br>
            >   }<br>
            >   <br>
            >   /**<br>
            > @@ -1501,7 +1501,7 @@ static void
            vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)<br>
            >   static void vcn_v2_0_dec_ring_insert_end(struct
            amdgpu_ring *ring)<br>
            >   {<br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
            > -     amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_END
            << 1);<br>
            > +     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD |
            (VCN_DEC_CMD_PACKET_END << 1));<br>
            >   }<br>
            >   <br>
            >   /**<br>
            > @@ -1546,7 +1546,7 @@ static void
            vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64
            addr, u64<br>
            >        amdgpu_ring_write(ring, upper_32_bits(addr)
            & 0xff);<br>
            >   <br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
            > -     amdgpu_ring_write(ring, VCN_DEC_CMD_FENCE
            << 1);<br>
            > +     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD |
            (VCN_DEC_CMD_FENCE << 1));<br>
            >   <br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));<br>
            >        amdgpu_ring_write(ring, 0);<br>
            > @@ -1556,7 +1556,7 @@ static void
            vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64
            addr, u64<br>
            >   <br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
            >   <br>
            > -     amdgpu_ring_write(ring, VCN_DEC_CMD_TRAP <<
            1);<br>
            > +     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD |
            (VCN_DEC_CMD_TRAP << 1));<br>
            >   }<br>
            >   <br>
            >   /**<br>
            > @@ -1600,7 +1600,7 @@ static void
            vcn_v2_0_dec_ring_emit_reg_wait(struct amdgpu_ring *ring,<br>
            >   <br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
            >   <br>
            > -     amdgpu_ring_write(ring,
            VCN_DEC_CMD_REG_READ_COND_WAIT << 1);<br>
            > +     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD |
            (VCN_DEC_CMD_REG_READ_COND_WAIT << 1));<br>
            >   }<br>
            >   <br>
            >   static void vcn_v2_0_dec_ring_emit_vm_flush(struct
            amdgpu_ring *ring,<br>
            > @@ -1629,7 +1629,7 @@ static void
            vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring,<br>
            >   <br>
            >        amdgpu_ring_write(ring,
            PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
            >   <br>
            > -     amdgpu_ring_write(ring, VCN_DEC_CMD_WRITE_REG
            << 1);<br>
            > +     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD |
            (VCN_DEC_CMD_WRITE_REG << 1));<br>
            >   }<br>
            >   <br>
            >   /**<br>
            <br>
          </div>
        </span></font>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></pre>
    </blockquote>
    <br>
  </body>
</html>