Date: Tue, 11 Oct 2022 07:30:10 -0600 From: Warner Losh <imp@bsdimp.com> To: Tom Jones <thj@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: eee0f7aea425 - main - acpi: Put CPPC workaround behind i386/amd64 if def Message-ID: <CANCZdfpXQgEZu6XDDJPvT8ctfScY79ZeZfiLBhektmKYp_JzGw@mail.gmail.com> In-Reply-To: <202210110832.29B8WnnR003119@gitrepo.freebsd.org> References: <202210110832.29B8WnnR003119@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000003b42a905eac2473b Content-Type: text/plain; charset="UTF-8" On Tue, Oct 11, 2022 at 2:32 AM Tom Jones <thj@freebsd.org> wrote: > The branch main has been updated by thj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=eee0f7aea42564fe005c74f004d63f8cc170ef59 > > commit eee0f7aea42564fe005c74f004d63f8cc170ef59 > Author: Tom Jones <thj@FreeBSD.org> > AuthorDate: 2022-10-11 08:30:34 +0000 > Commit: Tom Jones <thj@FreeBSD.org> > CommitDate: 2022-10-11 08:31:22 +0000 > > acpi: Put CPPC workaround behind i386/amd64 if def > > While CPPC is available on arm64 platforms with ACPI we don't know if > we > need to work around issues with firmware there. > --- > sys/dev/acpica/acpi_cpu.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c > index 49d2bd11fdaa..ea99cfdeb90f 100644 > --- a/sys/dev/acpica/acpi_cpu.c > +++ b/sys/dev/acpica/acpi_cpu.c > @@ -153,7 +153,9 @@ static struct sysctl_ctx_list cpu_sysctl_ctx; > static struct sysctl_oid *cpu_sysctl_tree; > static int cpu_cx_generic; > static int cpu_cx_lowest_lim; > +#if defined(__i386__) || defined(__amd64__) > static bool cppc_notify; > +#endif > > static struct acpi_cpu_softc **cpu_softc; > ACPI_SERIAL_DECL(cpu, "ACPI CPU"); > @@ -985,11 +987,13 @@ acpi_cpu_startup(void *arg) > NULL, 0, acpi_cpu_global_cx_lowest_sysctl, "A", > "Global lowest Cx sleep state to use"); > > +#if defined(__i386__) || defined(__amd64__) > /* Add sysctl handler to control registering for CPPC notifications */ > cppc_notify = 1; > SYSCTL_ADD_BOOL(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cpu_sysctl_tree), > OID_AUTO, "cppc_notify", CTLFLAG_RDTUN | CTLFLAG_MPSAFE, > &cppc_notify, 0, "Register for CPPC Notifications"); > +#endif > > /* Take over idling from cpu_idle_default(). */ > cpu_cx_lowest_lim = 0; > I'd suggest changing the #ifdef to something more like: #if defined(__i386__) || defined (__amd64__) cppc_notify=1; #else cppc_notify=0; #endif SYSCTL_ADD... instead. What do you think? I'd have done it as a one-liner, but you can't say cppc_notify=defined(__i386__) || defined(__amd64__) :) Warner --0000000000003b42a905eac2473b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Tue, Oct 11, 2022 at 2:32 AM Tom J= ones <<a href=3D"mailto:thj@freebsd.org">thj@freebsd.org</a>> wrote:<= br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e= x;border-left:1px solid rgb(204,204,204);padding-left:1ex">The branch main = has been updated by thj:<br> <br> URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Deee0f7aea42564fe0= 05c74f004d63f8cc170ef59" rel=3D"noreferrer" target=3D"_blank">https://cgit.= FreeBSD.org/src/commit/?id=3Deee0f7aea42564fe005c74f004d63f8cc170ef59</a><b= r> <br> commit eee0f7aea42564fe005c74f004d63f8cc170ef59<br> Author:=C2=A0 =C2=A0 =C2=A0Tom Jones <thj@FreeBSD.org><br> AuthorDate: 2022-10-11 08:30:34 +0000<br> Commit:=C2=A0 =C2=A0 =C2=A0Tom Jones <thj@FreeBSD.org><br> CommitDate: 2022-10-11 08:31:22 +0000<br> <br> =C2=A0 =C2=A0 acpi: Put CPPC workaround behind i386/amd64 if def<br> <br> =C2=A0 =C2=A0 While CPPC is available on arm64 platforms with ACPI we don&#= 39;t know if we<br> =C2=A0 =C2=A0 need to work around issues with firmware there.<br> ---<br> =C2=A0sys/dev/acpica/acpi_cpu.c | 4 ++++<br> =C2=A01 file changed, 4 insertions(+)<br> <br> diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c<br> index 49d2bd11fdaa..ea99cfdeb90f 100644<br> --- a/sys/dev/acpica/acpi_cpu.c<br> +++ b/sys/dev/acpica/acpi_cpu.c<br> @@ -153,7 +153,9 @@ static struct sysctl_ctx_list cpu_sysctl_ctx;<br> =C2=A0static struct sysctl_oid *cpu_sysctl_tree;<br> =C2=A0static int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cpu_cx_gen= eric;<br> =C2=A0static int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cpu_cx_low= est_lim;<br> +#if defined(__i386__) || defined(__amd64__)<br> =C2=A0static bool=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cppc_notif= y;<br> +#endif<br> <br> =C2=A0static struct acpi_cpu_softc **cpu_softc;<br> =C2=A0ACPI_SERIAL_DECL(cpu, "ACPI CPU");<br> @@ -985,11 +987,13 @@ acpi_cpu_startup(void *arg)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 NULL, 0, acpi_cpu_global_cx_lowest_sysctl, &quo= t;A",<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Global lowest Cx sleep state to use"= );<br> <br> +#if defined(__i386__) || defined(__amd64__)<br> =C2=A0 =C2=A0 =C2=A0/* Add sysctl handler to control registering for CPPC n= otifications */<br> =C2=A0 =C2=A0 =C2=A0cppc_notify =3D 1;<br> =C2=A0 =C2=A0 =C2=A0SYSCTL_ADD_BOOL(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cp= u_sysctl_tree),<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 OID_AUTO, "cppc_notify", CTLFLAG_RDTU= N | CTLFLAG_MPSAFE,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 &cppc_notify, 0, "Register for CPPC No= tifications");<br> +#endif<br> <br> =C2=A0 =C2=A0 =C2=A0/* Take over idling from cpu_idle_default(). */<br> =C2=A0 =C2=A0 =C2=A0cpu_cx_lowest_lim =3D 0;<br></blockquote><div><br></div= ><div>I'd suggest changing the #ifdef to something more like:</div><div= ><br></div><div>#if defined(__i386__) || defined (__amd64__)</div><div>cppc= _notify=3D1;</div><div>#else</div><div>cppc_notify=3D0;</div><div>#endif=C2= =A0</div><div>SYSCTL_ADD...</div><div><br></div><div>instead. What do you t= hink? I'd have done it as a one-liner, but you can't say cppc_notif= y=3Ddefined(__i386__) || defined(__amd64__) :)</div><div><br></div><div>War= ner</div></div></div> --0000000000003b42a905eac2473b--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpXQgEZu6XDDJPvT8ctfScY79ZeZfiLBhektmKYp_JzGw>