[PATCH] xen: remove <asm/delay.h>

Oleksii Kurochko posted 1 patch 1 year ago
Failed in applying to current master (apply log)
xen/arch/arm/include/asm/delay.h   | 14 --------------
xen/arch/riscv/include/asm/delay.h | 13 -------------
xen/arch/x86/cpu/microcode/core.c  |  2 +-
xen/arch/x86/delay.c               |  2 +-
xen/arch/x86/include/asm/delay.h   | 13 -------------
xen/include/xen/delay.h            |  3 ++-
6 files changed, 4 insertions(+), 43 deletions(-)
delete mode 100644 xen/arch/arm/include/asm/delay.h
delete mode 100644 xen/arch/riscv/include/asm/delay.h
delete mode 100644 xen/arch/x86/include/asm/delay.h
[PATCH] xen: remove <asm/delay.h>
Posted by Oleksii Kurochko 1 year ago
<asm/delay.h> only declares udelay() function so udelay()  
declaration was moved to xen/delay.h.

For x86, __udelay() was renamed to udelay() and removed
inclusion of <asm/delay.h> in x86 code.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/arm/include/asm/delay.h   | 14 --------------
 xen/arch/riscv/include/asm/delay.h | 13 -------------
 xen/arch/x86/cpu/microcode/core.c  |  2 +-
 xen/arch/x86/delay.c               |  2 +-
 xen/arch/x86/include/asm/delay.h   | 13 -------------
 xen/include/xen/delay.h            |  3 ++-
 6 files changed, 4 insertions(+), 43 deletions(-)
 delete mode 100644 xen/arch/arm/include/asm/delay.h
 delete mode 100644 xen/arch/riscv/include/asm/delay.h
 delete mode 100644 xen/arch/x86/include/asm/delay.h

diff --git a/xen/arch/arm/include/asm/delay.h b/xen/arch/arm/include/asm/delay.h
deleted file mode 100644
index 042907d9d5..0000000000
--- a/xen/arch/arm/include/asm/delay.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _ARM_DELAY_H
-#define _ARM_DELAY_H
-
-extern void udelay(unsigned long usecs);
-
-#endif /* defined(_ARM_DELAY_H) */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/riscv/include/asm/delay.h b/xen/arch/riscv/include/asm/delay.h
deleted file mode 100644
index 2d59622c75..0000000000
--- a/xen/arch/riscv/include/asm/delay.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) 2009 Chen Liqin <liqin.chen@sunplusct.com>
- * Copyright (C) 2016 Regents of the University of California
- */
-
-#ifndef _ASM_RISCV_DELAY_H
-#define _ASM_RISCV_DELAY_H
-
-#define udelay udelay
-extern void udelay(unsigned long usecs);
-
-#endif /* _ASM_RISCV_DELAY_H */
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index c3fee62906..48822360c0 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -23,6 +23,7 @@
 
 #include <xen/alternative-call.h>
 #include <xen/cpu.h>
+#include <xen/delay.h>
 #include <xen/earlycpio.h>
 #include <xen/err.h>
 #include <xen/guest_access.h>
@@ -35,7 +36,6 @@
 
 #include <asm/apic.h>
 #include <asm/cpu-policy.h>
-#include <asm/delay.h>
 #include <asm/nmi.h>
 #include <asm/processor.h>
 #include <asm/setup.h>
diff --git a/xen/arch/x86/delay.c b/xen/arch/x86/delay.c
index 2662c26272..b3a41881a1 100644
--- a/xen/arch/x86/delay.c
+++ b/xen/arch/x86/delay.c
@@ -15,7 +15,7 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 
-void __udelay(unsigned long usecs)
+void udelay(unsigned long usecs)
 {
     unsigned long ticks = usecs * (cpu_khz / 1000);
     unsigned long s, e;
diff --git a/xen/arch/x86/include/asm/delay.h b/xen/arch/x86/include/asm/delay.h
deleted file mode 100644
index 9be2f46590..0000000000
--- a/xen/arch/x86/include/asm/delay.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _X86_DELAY_H
-#define _X86_DELAY_H
-
-/*
- * Copyright (C) 1993 Linus Torvalds
- *
- * Delay routines calling functions in arch/i386/lib/delay.c
- */
-
-extern void __udelay(unsigned long usecs);
-#define udelay(n) __udelay(n)
-
-#endif /* defined(_X86_DELAY_H) */
diff --git a/xen/include/xen/delay.h b/xen/include/xen/delay.h
index 9d70ef035f..a5189329c7 100644
--- a/xen/include/xen/delay.h
+++ b/xen/include/xen/delay.h
@@ -3,8 +3,9 @@
 
 /* Copyright (C) 1993 Linus Torvalds */
 
-#include <asm/delay.h>
 #define mdelay(n) (\
 	{unsigned long msec=(n); while (msec--) udelay(1000);})
 
+void udelay(unsigned long usecs);
+
 #endif /* defined(_LINUX_DELAY_H) */
-- 
2.41.0


Re: [PATCH] xen: remove <asm/delay.h>
Posted by Oleksii 1 year ago
Hi all,

On Tue, 2023-10-31 at 12:12 +0200, Oleksii Kurochko wrote:
> <asm/delay.h> only declares udelay() function so udelay()  
> declaration was moved to xen/delay.h.
> 
> For x86, __udelay() was renamed to udelay() and removed
> inclusion of <asm/delay.h> in x86 code.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
>  xen/arch/arm/include/asm/delay.h   | 14 --------------
>  xen/arch/riscv/include/asm/delay.h | 13 -------------
>  xen/arch/x86/cpu/microcode/core.c  |  2 +-
>  xen/arch/x86/delay.c               |  2 +-
>  xen/arch/x86/include/asm/delay.h   | 13 -------------
>  xen/include/xen/delay.h            |  3 ++-
>  6 files changed, 4 insertions(+), 43 deletions(-)
>  delete mode 100644 xen/arch/arm/include/asm/delay.h
>  delete mode 100644 xen/arch/riscv/include/asm/delay.h
>  delete mode 100644 xen/arch/x86/include/asm/delay.h
> 
> diff --git a/xen/arch/arm/include/asm/delay.h
> b/xen/arch/arm/include/asm/delay.h
> deleted file mode 100644
> index 042907d9d5..0000000000
> --- a/xen/arch/arm/include/asm/delay.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -#ifndef _ARM_DELAY_H
> -#define _ARM_DELAY_H
> -
> -extern void udelay(unsigned long usecs);
> -
> -#endif /* defined(_ARM_DELAY_H) */
> -/*
> - * Local variables:
> - * mode: C
> - * c-file-style: "BSD"
> - * c-basic-offset: 4
> - * indent-tabs-mode: nil
> - * End:
> - */
> diff --git a/xen/arch/riscv/include/asm/delay.h
> b/xen/arch/riscv/include/asm/delay.h
> deleted file mode 100644
> index 2d59622c75..0000000000
> --- a/xen/arch/riscv/include/asm/delay.h
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * Copyright (C) 2009 Chen Liqin <liqin.chen@sunplusct.com>
> - * Copyright (C) 2016 Regents of the University of California
> - */
> -
> -#ifndef _ASM_RISCV_DELAY_H
> -#define _ASM_RISCV_DELAY_H
> -
> -#define udelay udelay
> -extern void udelay(unsigned long usecs);
> -
> -#endif /* _ASM_RISCV_DELAY_H */
> diff --git a/xen/arch/x86/cpu/microcode/core.c
> b/xen/arch/x86/cpu/microcode/core.c
> index c3fee62906..48822360c0 100644
> --- a/xen/arch/x86/cpu/microcode/core.c
> +++ b/xen/arch/x86/cpu/microcode/core.c
> @@ -23,6 +23,7 @@
>  
>  #include <xen/alternative-call.h>
>  #include <xen/cpu.h>
> +#include <xen/delay.h>
>  #include <xen/earlycpio.h>
>  #include <xen/err.h>
>  #include <xen/guest_access.h>
> @@ -35,7 +36,6 @@
>  
>  #include <asm/apic.h>
>  #include <asm/cpu-policy.h>
> -#include <asm/delay.h>
>  #include <asm/nmi.h>
>  #include <asm/processor.h>
>  #include <asm/setup.h>
> diff --git a/xen/arch/x86/delay.c b/xen/arch/x86/delay.c
> index 2662c26272..b3a41881a1 100644
> --- a/xen/arch/x86/delay.c
> +++ b/xen/arch/x86/delay.c
> @@ -15,7 +15,7 @@
>  #include <asm/msr.h>
>  #include <asm/processor.h>
>  
> -void __udelay(unsigned long usecs)
> +void udelay(unsigned long usecs)
>  {
>      unsigned long ticks = usecs * (cpu_khz / 1000);
>      unsigned long s, e;
> diff --git a/xen/arch/x86/include/asm/delay.h
> b/xen/arch/x86/include/asm/delay.h
> deleted file mode 100644
> index 9be2f46590..0000000000
> --- a/xen/arch/x86/include/asm/delay.h
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -#ifndef _X86_DELAY_H
> -#define _X86_DELAY_H
> -
> -/*
> - * Copyright (C) 1993 Linus Torvalds
> - *
> - * Delay routines calling functions in arch/i386/lib/delay.c
> - */
> -
> -extern void __udelay(unsigned long usecs);
> -#define udelay(n) __udelay(n)
> -
> -#endif /* defined(_X86_DELAY_H) */
> diff --git a/xen/include/xen/delay.h b/xen/include/xen/delay.h
> index 9d70ef035f..a5189329c7 100644
> --- a/xen/include/xen/delay.h
> +++ b/xen/include/xen/delay.h
> @@ -3,8 +3,9 @@
>  
>  /* Copyright (C) 1993 Linus Torvalds */
>  
> -#include <asm/delay.h>
>  #define mdelay(n) (\
>         {unsigned long msec=(n); while (msec--) udelay(1000);})
>  
> +void udelay(unsigned long usecs);
> +
>  #endif /* defined(_LINUX_DELAY_H) */
I forgot to update xen/arch/{x86,arm,ppc}/include/asm/Makefile:
    generic-y += delay.h

Should I send a new patch version or it can be updated durig merge?

~ Oleksii
Re: [PATCH] xen: remove <asm/delay.h>
Posted by Julien Grall 1 year ago

On 31/10/2023 10:12, Oleksii Kurochko wrote:
> <asm/delay.h> only declares udelay() function so udelay()
> declaration was moved to xen/delay.h.
> 
> For x86, __udelay() was renamed to udelay() and removed
> inclusion of <asm/delay.h> in x86 code.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

For Arm:

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

-- 
Julien Grall
Re: [PATCH] xen: remove <asm/delay.h>
Posted by Jan Beulich 1 year ago
On 31.10.2023 11:12, Oleksii Kurochko wrote:
> <asm/delay.h> only declares udelay() function so udelay()  
> declaration was moved to xen/delay.h.
> 
> For x86, __udelay() was renamed to udelay() and removed
> inclusion of <asm/delay.h> in x86 code.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
>  xen/arch/arm/include/asm/delay.h   | 14 --------------
>  xen/arch/riscv/include/asm/delay.h | 13 -------------
>  xen/arch/x86/cpu/microcode/core.c  |  2 +-
>  xen/arch/x86/delay.c               |  2 +-
>  xen/arch/x86/include/asm/delay.h   | 13 -------------
>  xen/include/xen/delay.h            |  3 ++-
>  6 files changed, 4 insertions(+), 43 deletions(-)
>  delete mode 100644 xen/arch/arm/include/asm/delay.h
>  delete mode 100644 xen/arch/riscv/include/asm/delay.h
>  delete mode 100644 xen/arch/x86/include/asm/delay.h

What about xen/arch/ppc/include/asm/delay.h? With that also removed
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(and maybe also Suggested-by:?)

Jan