<div dir="ltr">It may be ok to drop this driver entirely now too; I doubt anyone is relying on GPU turbo in Ironlake for anything critical anymore.  That would allow for some simplifications in i915 too if it's still supported.<div><br></div><div>Jesse</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 10, 2021 at 4:56 AM Joonas Lahtinen <<a href="mailto:joonas.lahtinen@linux.intel.com">joonas.lahtinen@linux.intel.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">(Address for Hans was corrupt in previous message, which confused my mail<br>
client. Sorry for duplicate message, the other is without From: field).<br>
<br>
+ Jesse<br>
<br>
Quoting Colin Ian King (2021-06-09 14:50:07)<br>
> Hi,<br>
> <br>
> I was reviewing some old unassigned variable warnings from static<br>
> analysis by Coverity and found an issue introduced with the following<br>
> commit:<br>
> <br>
> commit aa7ffc01d254c91a36bf854d57a14049c6134c72<br>
> Author: Jesse Barnes <<a href="mailto:jbarnes@virtuousgeek.org" target="_blank">jbarnes@virtuousgeek.org</a>><br>
> Date:   Fri May 14 15:41:14 2010 -0700<br>
> <br>
>     x86 platform driver: intelligent power sharing driver<br>
> <br>
> The analysis is as follows:<br>
> <br>
> drivers/platform/x86/intel_ips.c<br>
> <br>
>  871 static u32 get_cpu_power(struct ips_driver *ips, u32 *last, int period)<br>
>  872 {<br>
>  873        u32 val;<br>
>  874        u32 ret;<br>
>  875<br>
>  876        /*<br>
>  877         * CEC is in joules/65535.  Take difference over time to<br>
>  878         * get watts.<br>
>  879         */<br>
>  880        val = thm_readl(THM_CEC);<br>
>  881<br>
>  882        /* period is in ms and we want mW */<br>
>  883        ret = (((val - *last) * 1000) / period);<br>
> <br>
> Unused value (UNUSED_VALUE)<br>
> assigned_value:  Assigning value from ret * 1000U / 65535U to ret here,<br>
> but that stored value is not used.<br>
> <br>
>  884        ret = (ret * 1000) / 65535;<br>
>  885        *last = val;<br>
>  886<br>
>  887        return 0;<br>
>  888 }<br>
> <br>
> I'm really not sure why ret is being calculated on lines 883,884 and not<br>
> being used. Should that be *last = ret on line 885? Looks suspect anyhow.<br>
<br>
According to git blame code seems to have been disabled intentionally by the<br>
following commit:<br>
<br>
commit 96f3823f537088c13735cfdfbf284436c802352a<br>
Author: Jesse Barnes <<a href="mailto:jbarnes@virtuousgeek.org" target="_blank">jbarnes@virtuousgeek.org</a>><br>
Date:   Tue Oct 5 14:50:59 2010 -0400<br>
<br>
    [PATCH 2/2] IPS driver: disable CPU turbo<br>
<br>
    The undocumented interface we're using for reading CPU power seems to be<br>
    overreporting power.  Until we figure out how to correct it, disable CPU<br>
    turbo and power reporting to be safe.  This will keep the CPU within default<br>
    limits and still allow us to increase GPU frequency as needed.<br>
<br>
Maybe wrap the code after thm_readl() in #if 0 in case somebody ends up<br>
wanting to fix it? Or eliminate completely.<br>
<br>
In theory the thm_readl() may affect the system behavior so would not<br>
remove that for extra paranoia.<br>
<br>
Regards, Joonas<br>
<br>
> Colin<br>
> <br>
> <br>
</blockquote></div>