Re: [PATCH 1/7] x86: lib: Add busy-loop delay util

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/03/2018 00:23, Liran Alon wrote:
> From: Arbel Moshe <arbel.moshe@xxxxxxxxxx>
> 
> Add a delay utility to x86 arch.
> The delay is in number of busy-loop iterations running 'pause'.
> 
> Signed-off-by: Arbel Moshe <arbel.moshe@xxxxxxxxxx>
> Signed-off-by: Liran Alon <liran.alon@xxxxxxxxxx>
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>

This last should be a Reviewed-by.  I queued the patches, thanks.

Paolo

> ---
>  lib/x86/delay.c     | 8 ++++++++
>  lib/x86/delay.h     | 8 ++++++++
>  x86/Makefile.common | 1 +
>  3 files changed, 17 insertions(+)
>  create mode 100644 lib/x86/delay.c
>  create mode 100644 lib/x86/delay.h
> 
> diff --git a/lib/x86/delay.c b/lib/x86/delay.c
> new file mode 100644
> index 000000000000..595ad24fec69
> --- /dev/null
> +++ b/lib/x86/delay.c
> @@ -0,0 +1,8 @@
> +#include "delay.h"
> +
> +void delay(u64 count)
> +{
> +	while (count--)
> +		asm volatile("pause");
> +}
> +
> diff --git a/lib/x86/delay.h b/lib/x86/delay.h
> new file mode 100644
> index 000000000000..a9bf89485509
> --- /dev/null
> +++ b/lib/x86/delay.h
> @@ -0,0 +1,8 @@
> +#ifndef __X86_DELAY__
> +#define __X86_DELAY__
> +
> +#include "libcflat.h"
> +
> +void delay(u64 count);
> +
> +#endif
> diff --git a/x86/Makefile.common b/x86/Makefile.common
> index 5f7eac4a26be..57f0bc7d16c3 100644
> --- a/x86/Makefile.common
> +++ b/x86/Makefile.common
> @@ -19,6 +19,7 @@ cflatobjs += lib/x86/desc.o
>  cflatobjs += lib/x86/isr.o
>  cflatobjs += lib/x86/acpi.o
>  cflatobjs += lib/x86/stack.o
> +cflatobjs += lib/x86/delay.o
>  
>  OBJDIRS += lib/x86
>  
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux