public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] x86: Properly check FEATURE_AESKLE
@ 2022-03-21 13:56 H.J. Lu
  2022-03-21 21:29 ` Uros Bizjak
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2022-03-21 13:56 UTC (permalink / raw)
  To: gcc-patches; +Cc: Uros Bizjak, liuhongt

1. Pass 0x19 to __cpuid for bit_AESKLE.
2. Enable FEATURE_AESKLE only if bit_AESKLE is set.

	PR target/104998
	* common/config/i386/cpuinfo.h (get_available_features): Pass
	0x19 to __cpuid for bit_AESKLE.  Enable FEATURE_AESKLE only if
	bit_AESKLE is set.
---
 gcc/common/config/i386/cpuinfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index 61b1a0f291c..239759dc766 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model,
   /* Get Advanced Features at level 0x19 (eax = 0x19).  */
   if (max_cpuid_level >= 0x19)
     {
-      set_feature (FEATURE_AESKLE);
-      __cpuid (19, eax, ebx, ecx, edx);
+      __cpuid (0x19, eax, ebx, ecx, edx);
       /* Check if OS support keylocker.  */
       if (ebx & bit_AESKLE)
 	{
+	  set_feature (FEATURE_AESKLE);
 	  if (ebx & bit_WIDEKL)
 	    set_feature (FEATURE_WIDEKL);
 	  if (has_kl)
-- 
2.35.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Properly check FEATURE_AESKLE
  2022-03-21 13:56 [PATCH] x86: Properly check FEATURE_AESKLE H.J. Lu
@ 2022-03-21 21:29 ` Uros Bizjak
  2022-03-21 21:51   ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Uros Bizjak @ 2022-03-21 21:29 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches, liuhongt

On Mon, Mar 21, 2022 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 1. Pass 0x19 to __cpuid for bit_AESKLE.
> 2. Enable FEATURE_AESKLE only if bit_AESKLE is set.
>
>         PR target/104998
>         * common/config/i386/cpuinfo.h (get_available_features): Pass
>         0x19 to __cpuid for bit_AESKLE.  Enable FEATURE_AESKLE only if
>         bit_AESKLE is set.

LGTM.

Thanks,
Uros.

> ---
>  gcc/common/config/i386/cpuinfo.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
> index 61b1a0f291c..239759dc766 100644
> --- a/gcc/common/config/i386/cpuinfo.h
> +++ b/gcc/common/config/i386/cpuinfo.h
> @@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model,
>    /* Get Advanced Features at level 0x19 (eax = 0x19).  */
>    if (max_cpuid_level >= 0x19)
>      {
> -      set_feature (FEATURE_AESKLE);
> -      __cpuid (19, eax, ebx, ecx, edx);
> +      __cpuid (0x19, eax, ebx, ecx, edx);
>        /* Check if OS support keylocker.  */
>        if (ebx & bit_AESKLE)
>         {
> +         set_feature (FEATURE_AESKLE);
>           if (ebx & bit_WIDEKL)
>             set_feature (FEATURE_WIDEKL);
>           if (has_kl)
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Properly check FEATURE_AESKLE
  2022-03-21 21:29 ` Uros Bizjak
@ 2022-03-21 21:51   ` H.J. Lu
  2022-03-21 22:05     ` Uros Bizjak
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2022-03-21 21:51 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches, liuhongt

On Mon, Mar 21, 2022 at 2:29 PM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Mon, Mar 21, 2022 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > 1. Pass 0x19 to __cpuid for bit_AESKLE.
> > 2. Enable FEATURE_AESKLE only if bit_AESKLE is set.
> >
> >         PR target/104998
> >         * common/config/i386/cpuinfo.h (get_available_features): Pass
> >         0x19 to __cpuid for bit_AESKLE.  Enable FEATURE_AESKLE only if
> >         bit_AESKLE is set.
>
> LGTM.

OK for backport?

Thanks.

> Thanks,
> Uros.
>
> > ---
> >  gcc/common/config/i386/cpuinfo.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
> > index 61b1a0f291c..239759dc766 100644
> > --- a/gcc/common/config/i386/cpuinfo.h
> > +++ b/gcc/common/config/i386/cpuinfo.h
> > @@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model,
> >    /* Get Advanced Features at level 0x19 (eax = 0x19).  */
> >    if (max_cpuid_level >= 0x19)
> >      {
> > -      set_feature (FEATURE_AESKLE);
> > -      __cpuid (19, eax, ebx, ecx, edx);
> > +      __cpuid (0x19, eax, ebx, ecx, edx);
> >        /* Check if OS support keylocker.  */
> >        if (ebx & bit_AESKLE)
> >         {
> > +         set_feature (FEATURE_AESKLE);
> >           if (ebx & bit_WIDEKL)
> >             set_feature (FEATURE_WIDEKL);
> >           if (has_kl)
> > --
> > 2.35.1
> >



-- 
H.J.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Properly check FEATURE_AESKLE
  2022-03-21 21:51   ` H.J. Lu
@ 2022-03-21 22:05     ` Uros Bizjak
  0 siblings, 0 replies; 4+ messages in thread
From: Uros Bizjak @ 2022-03-21 22:05 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches, liuhongt

On Mon, Mar 21, 2022 at 10:51 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Mar 21, 2022 at 2:29 PM Uros Bizjak <ubizjak@gmail.com> wrote:
> >
> > On Mon, Mar 21, 2022 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > 1. Pass 0x19 to __cpuid for bit_AESKLE.
> > > 2. Enable FEATURE_AESKLE only if bit_AESKLE is set.
> > >
> > >         PR target/104998
> > >         * common/config/i386/cpuinfo.h (get_available_features): Pass
> > >         0x19 to __cpuid for bit_AESKLE.  Enable FEATURE_AESKLE only if
> > >         bit_AESKLE is set.
> >
> > LGTM.
>
> OK for backport?

Looks safe, so OK.

Thanks,
Uros.

>
> Thanks.
>
> > Thanks,
> > Uros.
> >
> > > ---
> > >  gcc/common/config/i386/cpuinfo.h | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
> > > index 61b1a0f291c..239759dc766 100644
> > > --- a/gcc/common/config/i386/cpuinfo.h
> > > +++ b/gcc/common/config/i386/cpuinfo.h
> > > @@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model,
> > >    /* Get Advanced Features at level 0x19 (eax = 0x19).  */
> > >    if (max_cpuid_level >= 0x19)
> > >      {
> > > -      set_feature (FEATURE_AESKLE);
> > > -      __cpuid (19, eax, ebx, ecx, edx);
> > > +      __cpuid (0x19, eax, ebx, ecx, edx);
> > >        /* Check if OS support keylocker.  */
> > >        if (ebx & bit_AESKLE)
> > >         {
> > > +         set_feature (FEATURE_AESKLE);
> > >           if (ebx & bit_WIDEKL)
> > >             set_feature (FEATURE_WIDEKL);
> > >           if (has_kl)
> > > --
> > > 2.35.1
> > >
>
>
>
> --
> H.J.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-21 22:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 13:56 [PATCH] x86: Properly check FEATURE_AESKLE H.J. Lu
2022-03-21 21:29 ` Uros Bizjak
2022-03-21 21:51   ` H.J. Lu
2022-03-21 22:05     ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).