<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Kent, </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you for the review. Yes, I can confirm I am trying to set this for every single file for SRIOV mode.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a id="OWAAM749892" class="J9Y1oNF3ZpoR5LC3M2PHm mention ms-bgc-nlr ms-fcl-b" href="mailto:Greg.Kitchen@amd.com">@Kitchen, Greg</a> required this for ROCM-SMI 5.0 release. In case you need it, he can provide more details.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm going to clarify commit message more and send a new patch.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
BR,<br>
Marina</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Russell, Kent <Kent.Russell@amd.com><br>
<b>Sent:</b> Monday, December 20, 2021 8:01 PM<br>
<b>To:</b> Nikolic, Marina <Marina.Nikolic@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Mitrovic, Milan <Milan.Mitrovic@amd.com>; Nikolic, Marina <Marina.Nikolic@amd.com>; Kitchen, Greg <Greg.Kitchen@amd.com><br>
<b>Subject:</b> RE: [PATCH] amdgpu/pm: Modify sysfs pp_dpm_sclk to have only read premission in ONEVF mode</font>
<div> </div>
</div>
<div class="BodyFragment"><font face="Times New Roman" size="3"><span style="font-size:12pt;"><a name="BM_BEGIN"></a>
<div><font size="2"><span style="font-size:11pt;">[AMD Official Use Only]<br>
<br>
> -----Original Message-----<br>
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Marina Nikolic<br>
> Sent: Monday, December 20, 2021 11:09 AM<br>
> To: amd-gfx@lists.freedesktop.org<br>
> Cc: Mitrovic, Milan <Milan.Mitrovic@amd.com>; Nikolic, Marina<br>
> <Marina.Nikolic@amd.com>; Kitchen, Greg <Greg.Kitchen@amd.com><br>
> Subject: [PATCH] amdgpu/pm: Modify sysfs pp_dpm_sclk to have only read premission in<br>
> ONEVF mode<br>
><br>
> == Description ==<br>
> Due to security reasons setting through sysfs<br>
> should only be allowed in passthrough mode.<br>
> Options that are not mapped as SMU messages<br>
> do not have any mechanizm to distinguish between<br>
> passthorugh, onevf and mutivf usecase.<br>
> A unified approach is needed.<br>
><br>
> == Changes ==<br>
> This patch introduces a new mechanizm to distinguish<br>
> ONEVF and PASSTHROUGH use case on sysfs level<br>
> and prohibit setting (writting to sysfs).<br>
> It also applies the new mechanizm on pp_dpm_sclk sysfs file.<br>
><br>
> == Test ==<br>
> Writing to pp_dpm_sclk sysfs file in passthrough mode will succeed.<br>
> Writing to pp_dpm_sclk sysfs file in ONEVF mode will yield error:<br>
> "calling process does not have sufficient permission to execute a command".<br>
> Sysfs pp_dpm_sclk will not be created in MULTIVF mode.<br>
><br>
> Signed-off-by: Marina Nikolic <Marina.Nikolic@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ++++++<br>
>  1 file changed, 6 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
> b/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
> index 082539c70fd4..d2b168babc7d 100644<br>
> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
> @@ -2133,6 +2133,12 @@ static int default_attr_update(struct amdgpu_device *adev,<br>
> struct amdgpu_device_<br>
>               }<br>
>       }<br>
><br>
> +     /* security: setting should not be allowed from VF */<br>
> +     if (amdgpu_sriov_vf(adev)) {<br>
<br>
You should be checking for pp_dpm_sclk here, for example:<br>
                if (DEVICE_ATTR_IS(pp_dpm_sclk) {<br>
<br>
Otherwise I am pretty sure you're setting this for every single file. And is it only sclk? Or does it also need to affect mclk/fclk/etc? If it's only sclk, the line above should help. If it's for more, then the commit should try to clarify that as it's not
 100% clear.<br>
<br>
 Kent<br>
<br>
> +             dev_attr->attr.mode &= ~S_IWUGO;<br>
> +             dev_attr->store = NULL;<br>
> +     }<br>
> +<br>
>  #undef DEVICE_ATTR_IS<br>
><br>
>       return 0;<br>
> --<br>
> 2.20.1<br>
<br>
</span></font></div>
</span></font></div>
</div>
</body>
</html>