public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] <sys/platform/x86.h>: Add Intel LAM support
@ 2020-12-22  4:22 H.J. Lu
  2020-12-22  7:39 ` Siddhesh Poyarekar
  2020-12-22  9:05 ` Florian Weimer
  0 siblings, 2 replies; 5+ messages in thread
From: H.J. Lu @ 2020-12-22  4:22 UTC (permalink / raw)
  To: libc-alpha

Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>.
---
 manual/platform.texi               | 3 +++
 sysdeps/x86/sys/platform/x86.h     | 3 +++
 sysdeps/x86/tst-get-cpu-features.c | 1 +
 3 files changed, 7 insertions(+)

diff --git a/manual/platform.texi b/manual/platform.texi
index 8fec2933d6..b67683aeb3 100644
--- a/manual/platform.texi
+++ b/manual/platform.texi
@@ -377,6 +377,9 @@ the indirect branch predictor barrier (IBPB).
 @item
 @code{KL} -- AES Key Locker instructions.
 
+@item
+@code{LAM} -- Linear Address Masking.
+
 @item
 @code{L1D_FLUSH} -- IA32_FLUSH_CMD MSR.
 
diff --git a/sysdeps/x86/sys/platform/x86.h b/sysdeps/x86/sys/platform/x86.h
index 3ef92b04e8..99d8c9b0ab 100644
--- a/sysdeps/x86/sys/platform/x86.h
+++ b/sysdeps/x86/sys/platform/x86.h
@@ -317,6 +317,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define bit_cpu_FSRS		(1u << 11)
 #define bit_cpu_FSRCS		(1u << 12)
 #define bit_cpu_HRESET		(1u << 22)
+#define bit_cpu_LAM		(1u << 26)
 
 /* COMMON_CPUID_INDEX_19.  */
 
@@ -541,6 +542,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define index_cpu_FSRS		COMMON_CPUID_INDEX_7_ECX_1
 #define index_cpu_FSRCS		COMMON_CPUID_INDEX_7_ECX_1
 #define index_cpu_HRESET	COMMON_CPUID_INDEX_7_ECX_1
+#define index_cpu_LAM		COMMON_CPUID_INDEX_7_ECX_1
 
 /* COMMON_CPUID_INDEX_19.  */
 
@@ -765,6 +767,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define reg_FSRS		eax
 #define reg_FSRCS		eax
 #define reg_HRESET		eax
+#define reg_LAM			eax
 
 /* COMMON_CPUID_INDEX_19.  */
 
diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c
index 667aa27117..6f1e925a6a 100644
--- a/sysdeps/x86/tst-get-cpu-features.c
+++ b/sysdeps/x86/tst-get-cpu-features.c
@@ -227,6 +227,7 @@ do_test (void)
   CHECK_CPU_FEATURE (FSRS);
   CHECK_CPU_FEATURE (FSRCS);
   CHECK_CPU_FEATURE (HRESET);
+  CHECK_CPU_FEATURE (LAM);
   CHECK_CPU_FEATURE (AESKLE);
   CHECK_CPU_FEATURE (WIDE_KL);
 
-- 
2.29.2


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

* Re: [PATCH] <sys/platform/x86.h>: Add Intel LAM support
  2020-12-22  4:22 [PATCH] <sys/platform/x86.h>: Add Intel LAM support H.J. Lu
@ 2020-12-22  7:39 ` Siddhesh Poyarekar
  2020-12-22  9:05 ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2020-12-22  7:39 UTC (permalink / raw)
  To: H.J. Lu, libc-alpha

On 12/22/20 9:52 AM, H.J. Lu via Libc-alpha wrote:
> Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>.
> ---
>   manual/platform.texi               | 3 +++
>   sysdeps/x86/sys/platform/x86.h     | 3 +++
>   sysdeps/x86/tst-get-cpu-features.c | 1 +
>   3 files changed, 7 insertions(+)

The change itself is fine, but please provide a summary in the commit 
message of what Intel LAM is and what these changes enable.

Thanks,
Siddhesh

> diff --git a/manual/platform.texi b/manual/platform.texi
> index 8fec2933d6..b67683aeb3 100644
> --- a/manual/platform.texi
> +++ b/manual/platform.texi
> @@ -377,6 +377,9 @@ the indirect branch predictor barrier (IBPB).
>   @item
>   @code{KL} -- AES Key Locker instructions.
>   
> +@item
> +@code{LAM} -- Linear Address Masking.
> +
>   @item
>   @code{L1D_FLUSH} -- IA32_FLUSH_CMD MSR.
>   
> diff --git a/sysdeps/x86/sys/platform/x86.h b/sysdeps/x86/sys/platform/x86.h
> index 3ef92b04e8..99d8c9b0ab 100644
> --- a/sysdeps/x86/sys/platform/x86.h
> +++ b/sysdeps/x86/sys/platform/x86.h
> @@ -317,6 +317,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
>   #define bit_cpu_FSRS		(1u << 11)
>   #define bit_cpu_FSRCS		(1u << 12)
>   #define bit_cpu_HRESET		(1u << 22)
> +#define bit_cpu_LAM		(1u << 26)
>   
>   /* COMMON_CPUID_INDEX_19.  */
>   
> @@ -541,6 +542,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
>   #define index_cpu_FSRS		COMMON_CPUID_INDEX_7_ECX_1
>   #define index_cpu_FSRCS		COMMON_CPUID_INDEX_7_ECX_1
>   #define index_cpu_HRESET	COMMON_CPUID_INDEX_7_ECX_1
> +#define index_cpu_LAM		COMMON_CPUID_INDEX_7_ECX_1
>   
>   /* COMMON_CPUID_INDEX_19.  */
>   
> @@ -765,6 +767,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
>   #define reg_FSRS		eax
>   #define reg_FSRCS		eax
>   #define reg_HRESET		eax
> +#define reg_LAM			eax
>   
>   /* COMMON_CPUID_INDEX_19.  */
>   
> diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c
> index 667aa27117..6f1e925a6a 100644
> --- a/sysdeps/x86/tst-get-cpu-features.c
> +++ b/sysdeps/x86/tst-get-cpu-features.c
> @@ -227,6 +227,7 @@ do_test (void)
>     CHECK_CPU_FEATURE (FSRS);
>     CHECK_CPU_FEATURE (FSRCS);
>     CHECK_CPU_FEATURE (HRESET);
> +  CHECK_CPU_FEATURE (LAM);
>     CHECK_CPU_FEATURE (AESKLE);
>     CHECK_CPU_FEATURE (WIDE_KL);
>   
> 


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

* Re: [PATCH] <sys/platform/x86.h>: Add Intel LAM support
  2020-12-22  4:22 [PATCH] <sys/platform/x86.h>: Add Intel LAM support H.J. Lu
  2020-12-22  7:39 ` Siddhesh Poyarekar
@ 2020-12-22  9:05 ` Florian Weimer
  2020-12-22 11:45   ` H.J. Lu
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2020-12-22  9:05 UTC (permalink / raw)
  To: H.J. Lu via Libc-alpha

* H. J. Lu via Libc-alpha:

> Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>.
> ---
>  manual/platform.texi               | 3 +++
>  sysdeps/x86/sys/platform/x86.h     | 3 +++
>  sysdeps/x86/tst-get-cpu-features.c | 1 +
>  3 files changed, 7 insertions(+)

Looks okay to me.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


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

* Re: [PATCH] <sys/platform/x86.h>: Add Intel LAM support
  2020-12-22  9:05 ` Florian Weimer
@ 2020-12-22 11:45   ` H.J. Lu
  2020-12-22 11:52     ` Siddhesh Poyarekar
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2020-12-22 11:45 UTC (permalink / raw)
  To: Florian Weimer, Siddhesh Poyarekar; +Cc: H.J. Lu via Libc-alpha

On Tue, Dec 22, 2020 at 1:05 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>.
> > ---
> >  manual/platform.texi               | 3 +++
> >  sysdeps/x86/sys/platform/x86.h     | 3 +++
> >  sysdeps/x86/tst-get-cpu-features.c | 1 +
> >  3 files changed, 7 insertions(+)
>
> Looks okay to me.
>

I checked it with the updated commit message:

Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>.
HAS_CPU_FEATURE (LAM) can be used to detect if LAM is enabled in CPU.

LAM modifies the checking that is applied to 64-bit linear addresses,
allowing software to use of the untranslated address bits for metadata.

-- 
H.J.

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

* Re: [PATCH] <sys/platform/x86.h>: Add Intel LAM support
  2020-12-22 11:45   ` H.J. Lu
@ 2020-12-22 11:52     ` Siddhesh Poyarekar
  0 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2020-12-22 11:52 UTC (permalink / raw)
  To: H.J. Lu, Florian Weimer; +Cc: H.J. Lu via Libc-alpha

On 12/22/20 5:15 PM, H.J. Lu wrote:
> I checked it with the updated commit message:
> 
> Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>.
> HAS_CPU_FEATURE (LAM) can be used to detect if LAM is enabled in CPU.
> 
> LAM modifies the checking that is applied to 64-bit linear addresses,
> allowing software to use of the untranslated address bits for metadata.
> 

Perfect, thanks!

Siddhesh

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

end of thread, other threads:[~2020-12-22 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22  4:22 [PATCH] <sys/platform/x86.h>: Add Intel LAM support H.J. Lu
2020-12-22  7:39 ` Siddhesh Poyarekar
2020-12-22  9:05 ` Florian Weimer
2020-12-22 11:45   ` H.J. Lu
2020-12-22 11:52     ` Siddhesh Poyarekar

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).