This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] PowerPC: Extend Program Priority Register support
- From: Carlos Eduardo Seo <cseo at linux dot vnet dot ibm dot com>
- To: Gabriel Ferreira Teles Gomes <gftg at linux dot vnet dot ibm dot com>
- Cc: libc-alpha at sourceware dot org, Tulio Machado <tuliom at linux dot vnet dot ibm dot com>, "Steven J. Munroe" <sjmunroe at us dot ibm dot com>
- Date: Thu, 13 Aug 2015 15:38:54 -0300
- Subject: Re: [PATCH] PowerPC: Extend Program Priority Register support
- Authentication-results: sourceware.org; auth=none
- References: <1439215092-31407-1-git-send-email-gftg at linux dot vnet dot ibm dot com>
Missing a changelog entry for manual/platform.texi.
Other than that, LGTM.
Thanks,
--
Carlos Eduardo Seo
Software Engineer - Linux on Power Toolchain
cseo@linux.vnet.ibm.com
> On Aug 10, 2015, at 10:58 AM, Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> wrote:
>
> This patch adds extra inline functions to change the Program Priority Register
> from ISA 2.07.
>
> 2015-08-10 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
>
> * sysdeps/powerpc/sys/platform/ppc.h (__ppc_set_ppr_med_high,
> __ppc_set_ppr_very_low): New functions.
> ---
> manual/platform.texi | 19 +++++++++++++++++++
> sysdeps/powerpc/sys/platform/ppc.h | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 50 insertions(+)
>
> diff --git a/manual/platform.texi b/manual/platform.texi
> index 872e32e..f772460 100644
> --- a/manual/platform.texi
> +++ b/manual/platform.texi
> @@ -97,3 +97,22 @@ Set the Program Priority Register to low value.
> @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> Set the Program Priority Register to medium low value.
> @end deftypefun
> +
> +Power ISA 2.07 extends the priorities that can be set to the Program Priority
> +Register (PPR). The following functions implement the new priority levels:
> +very low and medium high.
> +
> +@deftypefun {void} __ppc_set_ppr_very_low (void)
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +Set the Program Priority Register to very low value.
> +@end deftypefun
> +
> +@deftypefun {void} __ppc_set_ppr_med_high (void)
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +Set the Program Priority Register to medium high value. The medium high
> +priority is privileged and may only be set during certain time intervals by
> +problem-state programs. If the program priority is medium high when the time
> +interval expires or if an attempt is made to set the priority to medium high
> +when it is not allowed, the priority is set to medium.
> +@end deftypefun
> +
> diff --git a/sysdeps/powerpc/sys/platform/ppc.h b/sysdeps/powerpc/sys/platform/ppc.h
> index 3febb61..2594606 100644
> --- a/sysdeps/powerpc/sys/platform/ppc.h
> +++ b/sysdeps/powerpc/sys/platform/ppc.h
> @@ -112,4 +112,35 @@ __ppc_set_ppr_low (void)
> __asm__ volatile ("or 1,1,1");
> }
>
> +/* Power ISA 2.07 (Book II, Chapter 3) extends the priorities that can be set
> + to the Program Priority Register (PPR). The form 'or Rx,Rx,Rx' is used to
> + modify the PRI field of the PPR, the same way as described above.
> + The new priority levels are:
> + Rx = 31 (very low)
> + Rx = 5 (medium high)
> + Any program can set the priority to very low, low, medium low, and medium,
> + as these are unprivileged.
> + The medium high priority, on the other hand, is privileged, and may only be
> + set during certain time intervals by problem-state programs. If the program
> + priority is medium high when the time interval expires or if an attempt is
> + made to set the priority to medium high when it is not allowed, the PRI
> + field is set to medium.
> + */
> +
> +#ifdef _ARCH_PWR8
> +
> +static inline void
> +__ppc_set_ppr_very_low (void)
> +{
> + __asm__ volatile ("or 31,31,31");
> +}
> +
> +static inline void
> +__ppc_set_ppr_med_high (void)
> +{
> + __asm__ volatile ("or 5,5,5");
> +}
> +
> +#endif
> +
> #endif /* sys/platform/ppc.h */
> --
> 2.1.0
>