<div dir="ltr"><div>Mesa doesn't use sysfs.</div><div><br></div><div>Note that this is a uapi, meaning that once it's in the kernel, it can't be changed like that.<br></div><div><br></div><div>What's the use case for this new interface? Isn't it partially redundant with the current device info structure, which seems to have the equivalent of dev_id and rev_id?<br></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 11, 2021 at 3:51 AM Christian König <<a href="mailto:ckoenig.leichtzumerken@gmail.com" target="_blank">ckoenig.leichtzumerken@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    Marek and other userspace folks need to decide that.<br>
    <br>
    Basic question here is if Mesa is already accessing sysfs nodes for
    OpenGL or RADV. If that is the case then we should probably expose
    the information there as well.<br>
    <br>
    If that isn't the case (which I think it is) then we should
    implement it as IOCTL.<br>
    <br>
    Regards,<br>
    Christian.<br>
    <br>
    <div>Am 10.05.21 um 22:19 schrieb Nieto,
      David M:<br>
    </div>
    <blockquote type="cite">
      
      
      
      
      <div>
        <p class="MsoNormal">One of the primary usecases is to add this
          information to the renderer string, I am not sure if there are
          other cases of UMD drivers accessing sysfs nodes, but I think
          if we think permissions, if a client is authenticated and
          opens the render device then it can use the IOCTL, it is
          unclear to me we can make a such an assumption for sysfs
          nodes…<u></u><u></u></p>
        <p class="MsoNormal"><u></u> <u></u></p>
        <p class="MsoNormal">I think there is value in having both tbh.<u></u><u></u></p>
        <p class="MsoNormal"><u></u> <u></u></p>
        <p class="MsoNormal">Regards,<u></u><u></u></p>
        <p class="MsoNormal">David<u></u><u></u></p>
        <p class="MsoNormal"><u></u> <u></u></p>
        <div style="border-color:rgb(181,196,223) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0in 0in">
          <p class="MsoNormal"><b><span style="font-size:12pt;color:black">From: </span></b><span style="font-size:12pt;color:black">Christian König
              <a href="mailto:ckoenig.leichtzumerken@gmail.com" target="_blank"><ckoenig.leichtzumerken@gmail.com></a><br>
              <b>Date: </b>Monday, May 10, 2021 at 6:48 AM<br>
              <b>To: </b>"Nieto, David M" <a href="mailto:David.Nieto@amd.com" target="_blank"><David.Nieto@amd.com></a>,
              "Gu, JiaWei (Will)" <a href="mailto:JiaWei.Gu@amd.com" target="_blank"><JiaWei.Gu@amd.com></a><br>
              <b>Cc: </b>Alex Deucher <a href="mailto:alexdeucher@gmail.com" target="_blank"><alexdeucher@gmail.com></a>,
              "Deng, Emily" <a href="mailto:Emily.Deng@amd.com" target="_blank"><Emily.Deng@amd.com></a>, Kees Cook
              <a href="mailto:keescook@chromium.org" target="_blank"><keescook@chromium.org></a>, amd-gfx list
              <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank"><amd-gfx@lists.freedesktop.org></a><br>
              <b>Subject: </b>Re: [PATCH] drm/amdgpu: Align serial size
              in drm_amdgpu_info_vbios<u></u><u></u></span></p>
        </div>
        <div>
          <p class="MsoNormal"><u></u> <u></u></p>
        </div>
        <p class="MsoNormal" style="margin-bottom:12pt">Well we could
          add both as sysfs file(s).<br>
          <br>
          Question here is rather what is the primary use case of this
          and if the application has the necessary access permissions to
          the sysfs files?<br>
          <br>
          Regards,<br>
          Christian.<u></u><u></u></p>
        <div>
          <p class="MsoNormal">Am 10.05.21 um 15:42 schrieb Nieto, David
            M:<u></u><u></u></p>
        </div>
        <blockquote style="margin-top:5pt;margin-bottom:5pt">
          <div>
            <div>
              <div>
                <p class="MsoNormal" style="background:white none repeat scroll 0% 0%"><span style="color:black">Then the application would need
                    to issue the ioctl and then open a sysfs file to get
                    all the information it needs. It makes little sense
                    from a programming perspective to add an incomplete
                    interface in my opinion <u></u><u></u></span></p>
              </div>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
          </div>
          <div class="MsoNormal" style="text-align:center" align="center">
            <hr width="100%" size="0" align="center">
          </div>
          <div id="gmail-m_782079725653541167gmail-m_3184748164637597930gmail-m_-3452308432024396062divRplyFwdMsg">
            <p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Gu, JiaWei (Will)
                <a href="mailto:JiaWei.Gu@amd.com" target="_blank"><JiaWei.Gu@amd.com></a><br>
                <b>Sent:</b> Monday, May 10, 2021 12:13:07 AM<br>
                <b>To:</b> Nieto, David M <a href="mailto:David.Nieto@amd.com" target="_blank"><David.Nieto@amd.com></a><br>
                <b>Cc:</b> Alex Deucher <a href="mailto:alexdeucher@gmail.com" target="_blank"><alexdeucher@gmail.com></a>;
                amd-gfx list
                <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank"><amd-gfx@lists.freedesktop.org></a>;
                Kees Cook
                <a href="mailto:keescook@chromium.org" target="_blank"><keescook@chromium.org></a>;
                Deng, Emily <a href="mailto:Emily.Deng@amd.com" target="_blank">
                  <Emily.Deng@amd.com></a><br>
                <b>Subject:</b> RE: [PATCH] drm/amdgpu: Align serial
                size in drm_amdgpu_info_vbios</span>
              <u></u><u></u></p>
            <div>
              <p class="MsoNormal"> <u></u><u></u></p>
            </div>
          </div>
          <div>
            <div>
              <p class="MsoNormal">[AMD Official Use Only - Internal
                Distribution Only]<br>
                <br>
                Hi David,<br>
                <br>
                What I meant is to ONLY delete the serial[16] from
                drm_amdgpu_info_vbios, not the whole struct.<br>
                <br>
                struct drm_amdgpu_info_vbios {<br>
                        __u8 name[64];<br>
                        __u32 dbdf;<br>
                        __u8 vbios_pn[64];<br>
                        __u32 version;<br>
                        __u8 date[32];<br>
                        __u8 serial[16]; // jiawei: shall we delete this<br>
                        __u32 dev_id;<br>
                        __u32 rev_id;<br>
                        __u32 sub_dev_id;<br>
                        __u32 sub_ved_id;<br>
                };<br>
                <br>
                serial[16] in drm_amdgpu_info_vbios  copied from
                adev->serial, but there's already a sysfs named
                serial_number, which exposes it already.<br>
                <br>
                static ssize_t amdgpu_device_get_serial_number(struct
                device *dev,<br>
                                struct device_attribute *attr, char
                *buf)<br>
                {<br>
                        struct drm_device *ddev = dev_get_drvdata(dev);<br>
                        struct amdgpu_device *adev =
                ddev->dev_private;<br>
                <br>
                        return snprintf(buf, PAGE_SIZE, "%s\n",
                adev->serial);<br>
                }<br>
                <br>
                Thanks,<br>
                Jiawei<br>
                <br>
                <br>
                -----Original Message-----<br>
                From: Nieto, David M <a href="mailto:David.Nieto@amd.com" target="_blank"><David.Nieto@amd.com></a>
                <br>
                Sent: Monday, May 10, 2021 2:53 PM<br>
                To: Gu, JiaWei (Will) <a href="mailto:JiaWei.Gu@amd.com" target="_blank"><JiaWei.Gu@amd.com></a><br>
                Cc: Alex Deucher <a href="mailto:alexdeucher@gmail.com" target="_blank"><alexdeucher@gmail.com></a>;
                amd-gfx list
                <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank"><amd-gfx@lists.freedesktop.org></a>;
                Kees Cook
                <a href="mailto:keescook@chromium.org" target="_blank"><keescook@chromium.org></a>;
                Deng, Emily <a href="mailto:Emily.Deng@amd.com" target="_blank">
                  <Emily.Deng@amd.com></a><br>
                Subject: Re: [PATCH] drm/amdgpu: Align serial size in
                drm_amdgpu_info_vbios<br>
                <br>
                No, this structure contains all the details of the
                vbios: date, serial number, name, etc.<br>
                <br>
                The sysfs node only contains the vbios name string<br>
                <br>
                > On May 9, 2021, at 23:33, Gu, JiaWei (Will) <a href="mailto:JiaWei.Gu@amd.com" target="_blank">
                  <JiaWei.Gu@amd.com></a> wrote:<br>
                > <br>
                > [AMD Official Use Only - Internal Distribution
                Only]<br>
                > <br>
                > With a second thought,<br>
                > __u8 serial[16] in drm_amdgpu_info_vbios is a bit
                redundant, sysfs serial_number already exposes it.<br>
                > <br>
                > Is it fine to abandon it from drm_amdgpu_info_vbios
                struct? @Alex <br>
                > Deucher @Nieto, David M<br>
                > <br>
                > Best regards,<br>
                > Jiawei<br>
                > <br>
                > -----Original Message-----<br>
                > From: Alex Deucher <a href="mailto:alexdeucher@gmail.com" target="_blank"><alexdeucher@gmail.com></a><br>
                > Sent: Sunday, May 9, 2021 11:59 PM<br>
                > To: Gu, JiaWei (Will) <a href="mailto:JiaWei.Gu@amd.com" target="_blank"><JiaWei.Gu@amd.com></a><br>
                > Cc: amd-gfx list <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank"><amd-gfx@lists.freedesktop.org></a>;
                Kees Cook
                <br>
                > <a href="mailto:keescook@chromium.org" target="_blank"><keescook@chromium.org></a><br>
                > Subject: Re: [PATCH] drm/amdgpu: Align serial size
                in <br>
                > drm_amdgpu_info_vbios<br>
                > <br>
                >> On Sat, May 8, 2021 at 2:48 AM Jiawei Gu <a href="mailto:Jiawei.Gu@amd.com" target="_blank"><Jiawei.Gu@amd.com></a>
                wrote:<br>
                >> <br>
                >> 20 should be serial char size now instead of
                16.<br>
                >> <br>
                >> Signed-off-by: Jiawei Gu <a href="mailto:Jiawei.Gu@amd.com" target="_blank"><Jiawei.Gu@amd.com></a><br>
                > <br>
                > Please make sure this keeps proper 64 bit alignment
                in the structure.<br>
                > <br>
                > Alex<br>
                > <br>
                > <br>
                >> ---<br>
                >> include/uapi/drm/amdgpu_drm.h | 2 +-<br>
                >> 1 file changed, 1 insertion(+), 1 deletion(-)<br>
                >> <br>
                >> diff --git a/include/uapi/drm/amdgpu_drm.h <br>
                >> b/include/uapi/drm/amdgpu_drm.h index
                2b487a8d2727..1c20721f90da<br>
                >> 100644<br>
                >> --- a/include/uapi/drm/amdgpu_drm.h<br>
                >> +++ b/include/uapi/drm/amdgpu_drm.h<br>
                >> @@ -957,7 +957,7 @@ struct
                drm_amdgpu_info_vbios {<br>
                >>        __u8 vbios_pn[64];<br>
                >>        __u32 version;<br>
                >>        __u8 date[32];<br>
                >> -       __u8 serial[16];<br>
                >> +       __u8 serial[20];<br>
                >>        __u32 dev_id;<br>
                >>        __u32 rev_id;<br>
                >>        __u32 sub_dev_id;<br>
                >> --<br>
                >> 2.17.1<br>
                >> <br>
                >> _______________________________________________<br>
                >> amd-gfx mailing list<br>
                >> <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
                >> <a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis" target="_blank">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis</a><br>
                >> t <br>
                >>
<a href="http://s.freedesktop.org" target="_blank">s.freedesktop.org</a>%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ<br>
                >> i<br>
                >>
                awei.Gu%<a href="http://40amd.com" target="_blank">40amd.com</a>%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e<br>
                >> 6 <br>
                >>
                08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3<br>
                >> d <br>
                >>
                8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7<br>
                >> C <br>
                >>
1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res<br>
                >> e<br>
                >> rved=0<u></u><u></u></p>
            </div>
          </div>
          <p class="MsoNormal"><br>
            <br>
            <u></u><u></u></p>
          <pre>_______________________________________________<u></u><u></u></pre>
          <pre>amd-gfx mailing list<u></u><u></u></pre>
          <pre><a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><u></u><u></u></pre>
          <pre><a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7C3c0071a8a2a74127027408d913ba53e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637562513264718308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g11aunC78b48N19Q%2FFXJBK%2B2Z0PZBWdqp%2FzhsPiqQ8Q%3D&reserved=0" target="_blank">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><u></u><u></u></pre>
        </blockquote>
        <p class="MsoNormal"><br>
          <br>
          <u></u><u></u></p>
      </div>
    </blockquote>
    <br>
  </div>

_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</blockquote></div>