diff mbox

[U-Boot,v2,12/20] x86: Add an mfence macro

Message ID 1430274322-14383-13-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass April 29, 2015, 2:25 a.m. UTC
Provide access to this x86 instruction from C code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Remove unnecessary \t\n after mfence assembler instruction

 arch/x86/include/asm/cpu.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Bin Meng April 29, 2015, 5:19 a.m. UTC | #1
On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass <sjg@chromium.org> wrote:
> Provide access to this x86 instruction from C code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Remove unnecessary \t\n after mfence assembler instruction
>
>  arch/x86/include/asm/cpu.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
> index c839291..08284ee 100644
> --- a/arch/x86/include/asm/cpu.h
> +++ b/arch/x86/include/asm/cpu.h
> @@ -151,6 +151,11 @@ static inline int flag_is_changeable_p(uint32_t flag)
>         return ((f1^f2) & flag) != 0;
>  }
>
> +static inline void mfence(void)
> +{
> +       __asm__ __volatile__("mfence" : : : "memory");
> +}
> +
>  /**
>   * cpu_enable_paging_pae() - Enable PAE-paging
>   *
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass April 30, 2015, 4:22 a.m. UTC | #2
On 28 April 2015 at 23:19, Bin Meng <bmeng.cn@gmail.com> wrote:
> On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass <sjg@chromium.org> wrote:
>> Provide access to this x86 instruction from C code.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v2:
>> - Remove unnecessary \t\n after mfence assembler instruction
>>
>>  arch/x86/include/asm/cpu.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
>> index c839291..08284ee 100644
>> --- a/arch/x86/include/asm/cpu.h
>> +++ b/arch/x86/include/asm/cpu.h
>> @@ -151,6 +151,11 @@ static inline int flag_is_changeable_p(uint32_t flag)
>>         return ((f1^f2) & flag) != 0;
>>  }
>>
>> +static inline void mfence(void)
>> +{
>> +       __asm__ __volatile__("mfence" : : : "memory");
>> +}
>> +
>>  /**
>>   * cpu_enable_paging_pae() - Enable PAE-paging
>>   *
>> --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot-x86.
diff mbox

Patch

diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index c839291..08284ee 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -151,6 +151,11 @@  static inline int flag_is_changeable_p(uint32_t flag)
 	return ((f1^f2) & flag) != 0;
 }
 
+static inline void mfence(void)
+{
+	__asm__ __volatile__("mfence" : : : "memory");
+}
+
 /**
  * cpu_enable_paging_pae() - Enable PAE-paging
  *