Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 1/3] clk: samsung: introduce nMUX for MUX clks that can reparented
From: André Draszik @ 2024-03-28 12:44 UTC (permalink / raw)
  To: Tudor Ambarus, peter.griffin, krzysztof.kozlowski
  Cc: alim.akhtar, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	willmcvicker, kernel-team, s.nawrocki, cw00.choi, mturquette,
	sboyd, semen.protsenko, linux-clk, jaewon02.kim
In-Reply-To: <20240328123440.1387823-2-tudor.ambarus@linaro.org>

On Thu, 2024-03-28 at 12:34 +0000, Tudor Ambarus wrote:
> All samsung MUX clocks that are defined with MUX() set the
> CLK_SET_RATE_NO_REPARENT flag in __MUX(), which prevents MUXes to be
> reparented during clk_set_rate().
> 
> Introduce nMUX() for MUX clocks that can be reparented on clock rate
> change. "nMUX" comes from "n-to-1 selector", hopefully emphasising that
> the selector can change on clock rate changes. Ideally MUX/MUX_F()
> should change to not have the CLK_SET_RATE_NO_REPARENT flag set by
> default, and all their users to be updated to add the flag back
> (like in the case of DIV and GATE). But this is a very intrusive change
> and because for now only GS101 allows MUX reparenting on clock rate
> change, stick with nMUX().
> 
> One user of nMUX() will be GS101. GS101 defines MUX clocks that
> are dedicated for each instance of an IP (see MUX USI). The reparenting
> of these MUX clocks will not affect other instances of the same IP or
> different IPs altogether.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>

Reviewed-by: André Draszik <andre.draszik@linaro.org>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 3/3] arch: Rename fbdev header and source files
From: Helge Deller @ 2024-03-28 12:46 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, javierm, sui.jingfeng
  Cc: linux-arch, dri-devel, linux-fbdev, sparclinux, linux-sh,
	linuxppc-dev, linux-parisc, linux-mips, linux-m68k, loongarch,
	linux-arm-kernel, linux-snps-arc, linux-kernel, Vineet Gupta,
	Catalin Marinas, Will Deacon, Huacai Chen, WANG Xuerui,
	Geert Uytterhoeven, Thomas Bogendoerfer, James E.J. Bottomley,
	Michael Ellerman, Nicholas Piggin, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S. Miller, Andreas Larsson,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
In-Reply-To: <20240327204450.14914-4-tzimmermann@suse.de>

On 3/27/24 21:41, Thomas Zimmermann wrote:
> The per-architecture fbdev code has no dependencies on fbdev and can
> be used for any video-related subsystem. Rename the files to 'video'.
> Use video-sti.c on parisc as the source file depends on CONFIG_STI_CORE.
>
> Further update all includes statements, includ guards, and Makefiles.
> Also update a few strings and comments to refer to video instead of
> fbdev.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Andreas Larsson <andreas@gaisler.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> ---
>   arch/arc/include/asm/fb.h                    |  8 --------
>   arch/arc/include/asm/video.h                 |  8 ++++++++
>   arch/arm/include/asm/fb.h                    |  6 ------
>   arch/arm/include/asm/video.h                 |  6 ++++++
>   arch/arm64/include/asm/fb.h                  | 10 ----------
>   arch/arm64/include/asm/video.h               | 10 ++++++++++
>   arch/loongarch/include/asm/{fb.h => video.h} |  8 ++++----
>   arch/m68k/include/asm/{fb.h => video.h}      |  8 ++++----
>   arch/mips/include/asm/{fb.h => video.h}      | 12 ++++++------
>   arch/parisc/include/asm/{fb.h => video.h}    |  8 ++++----
>   arch/parisc/video/Makefile                   |  2 +-
>   arch/parisc/video/{fbdev.c => video-sti.c}   |  2 +-
>   arch/powerpc/include/asm/{fb.h => video.h}   |  8 ++++----
>   arch/powerpc/kernel/pci-common.c             |  2 +-
>   arch/sh/include/asm/fb.h                     |  7 -------
>   arch/sh/include/asm/video.h                  |  7 +++++++
>   arch/sparc/include/asm/{fb.h => video.h}     |  8 ++++----
>   arch/sparc/video/Makefile                    |  2 +-
>   arch/sparc/video/{fbdev.c => video.c}        |  4 ++--
>   arch/x86/include/asm/{fb.h => video.h}       |  8 ++++----
>   arch/x86/video/Makefile                      |  2 +-
>   arch/x86/video/{fbdev.c => video.c}          |  3 ++-
>   include/asm-generic/Kbuild                   |  2 +-
>   include/asm-generic/{fb.h => video.h}        |  6 +++---
>   include/linux/fb.h                           |  2 +-
>   25 files changed, 75 insertions(+), 74 deletions(-)
>   delete mode 100644 arch/arc/include/asm/fb.h
>   create mode 100644 arch/arc/include/asm/video.h
>   delete mode 100644 arch/arm/include/asm/fb.h
>   create mode 100644 arch/arm/include/asm/video.h
>   delete mode 100644 arch/arm64/include/asm/fb.h
>   create mode 100644 arch/arm64/include/asm/video.h
>   rename arch/loongarch/include/asm/{fb.h => video.h} (86%)
>   rename arch/m68k/include/asm/{fb.h => video.h} (86%)
>   rename arch/mips/include/asm/{fb.h => video.h} (76%)
>   rename arch/parisc/include/asm/{fb.h => video.h} (68%)
>   rename arch/parisc/video/{fbdev.c => video-sti.c} (96%)
>   rename arch/powerpc/include/asm/{fb.h => video.h} (76%)
>   delete mode 100644 arch/sh/include/asm/fb.h
>   create mode 100644 arch/sh/include/asm/video.h
>   rename arch/sparc/include/asm/{fb.h => video.h} (89%)
>   rename arch/sparc/video/{fbdev.c => video.c} (86%)
>   rename arch/x86/include/asm/{fb.h => video.h} (77%)
>   rename arch/x86/video/{fbdev.c => video.c} (97%)
>   rename include/asm-generic/{fb.h => video.h} (96%)
>
> diff --git a/arch/arc/include/asm/fb.h b/arch/arc/include/asm/fb.h
> deleted file mode 100644
> index 9c2383d29cbb9..0000000000000
> --- a/arch/arc/include/asm/fb.h
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> -
> -#include <asm-generic/fb.h>
> -
> -#endif /* _ASM_FB_H_ */
> diff --git a/arch/arc/include/asm/video.h b/arch/arc/include/asm/video.h
> new file mode 100644
> index 0000000000000..8ff7263727fe7
> --- /dev/null
> +++ b/arch/arc/include/asm/video.h
> @@ -0,0 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
> +
> +#include <asm-generic/video.h>
> +
> +#endif /* _ASM_VIDEO_H_ */

I wonder, since that file simply #includes the generic version,
wasn't there a possibility that kbuild could symlink
the generic version for us?
Does it need to be mandatory in include/asm-generic/Kbuild ?
Same applies to a few other files below.

Helge



> diff --git a/arch/arm/include/asm/fb.h b/arch/arm/include/asm/fb.h
> deleted file mode 100644
> index ce20a43c30339..0000000000000
> --- a/arch/arm/include/asm/fb.h
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> -
> -#include <asm-generic/fb.h>
> -
> -#endif /* _ASM_FB_H_ */
> diff --git a/arch/arm/include/asm/video.h b/arch/arm/include/asm/video.h
> new file mode 100644
> index 0000000000000..f570565366e67
> --- /dev/null
> +++ b/arch/arm/include/asm/video.h
> @@ -0,0 +1,6 @@
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
> +
> +#include <asm-generic/video.h>
> +
> +#endif /* _ASM_VIDEO_H_ */
> diff --git a/arch/arm64/include/asm/fb.h b/arch/arm64/include/asm/fb.h
> deleted file mode 100644
> index 1a495d8fb2ce0..0000000000000
> --- a/arch/arm64/include/asm/fb.h
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-only */
> -/*
> - * Copyright (C) 2012 ARM Ltd.
> - */
> -#ifndef __ASM_FB_H_
> -#define __ASM_FB_H_
> -
> -#include <asm-generic/fb.h>
> -
> -#endif /* __ASM_FB_H_ */
> diff --git a/arch/arm64/include/asm/video.h b/arch/arm64/include/asm/video.h
> new file mode 100644
> index 0000000000000..fe0e74983f4d9
> --- /dev/null
> +++ b/arch/arm64/include/asm/video.h
> @@ -0,0 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (C) 2012 ARM Ltd.
> + */
> +#ifndef __ASM_VIDEO_H_
> +#define __ASM_VIDEO_H_
> +
> +#include <asm-generic/video.h>
> +
> +#endif /* __ASM_VIDEO_H_ */
> diff --git a/arch/loongarch/include/asm/fb.h b/arch/loongarch/include/asm/video.h
> similarity index 86%
> rename from arch/loongarch/include/asm/fb.h
> rename to arch/loongarch/include/asm/video.h
> index 0b218b10a9ec3..9f76845f2d4fd 100644
> --- a/arch/loongarch/include/asm/fb.h
> +++ b/arch/loongarch/include/asm/video.h
> @@ -2,8 +2,8 @@
>   /*
>    * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
>    */
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
>
>   #include <linux/compiler.h>
>   #include <linux/string.h>
> @@ -26,6 +26,6 @@ static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
>   }
>   #define fb_memset fb_memset_io
>
> -#include <asm-generic/fb.h>
> +#include <asm-generic/video.h>
>
> -#endif /* _ASM_FB_H_ */
> +#endif /* _ASM_VIDEO_H_ */
> diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/video.h
> similarity index 86%
> rename from arch/m68k/include/asm/fb.h
> rename to arch/m68k/include/asm/video.h
> index 9941b7434b696..6cf2194c413d8 100644
> --- a/arch/m68k/include/asm/fb.h
> +++ b/arch/m68k/include/asm/video.h
> @@ -1,6 +1,6 @@
>   /* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
>
>   #include <asm/page.h>
>   #include <asm/setup.h>
> @@ -27,6 +27,6 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
>   }
>   #define pgprot_framebuffer pgprot_framebuffer
>
> -#include <asm-generic/fb.h>
> +#include <asm-generic/video.h>
>
> -#endif /* _ASM_FB_H_ */
> +#endif /* _ASM_VIDEO_H_ */
> diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/video.h
> similarity index 76%
> rename from arch/mips/include/asm/fb.h
> rename to arch/mips/include/asm/video.h
> index d98d6681d64ec..007c106d980fd 100644
> --- a/arch/mips/include/asm/fb.h
> +++ b/arch/mips/include/asm/video.h
> @@ -1,5 +1,5 @@
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
>
>   #include <asm/page.h>
>
> @@ -13,8 +13,8 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
>
>   /*
>    * MIPS doesn't define __raw_ I/O macros, so the helpers
> - * in <asm-generic/fb.h> don't generate fb_readq() and
> - * fb_write(). We have to provide them here.
> + * in <asm-generic/video.h> don't generate fb_readq() and
> + * fb_writeq(). We have to provide them here.
>    *
>    * TODO: Convert MIPS to generic I/O. The helpers below can
>    *       then be removed.
> @@ -33,6 +33,6 @@ static inline void fb_writeq(u64 b, volatile void __iomem *addr)
>   #define fb_writeq fb_writeq
>   #endif
>
> -#include <asm-generic/fb.h>
> +#include <asm-generic/video.h>
>
> -#endif /* _ASM_FB_H_ */
> +#endif /* _ASM_VIDEO_H_ */
> diff --git a/arch/parisc/include/asm/fb.h b/arch/parisc/include/asm/video.h
> similarity index 68%
> rename from arch/parisc/include/asm/fb.h
> rename to arch/parisc/include/asm/video.h
> index ed2a195a3e762..c5dff3223194a 100644
> --- a/arch/parisc/include/asm/fb.h
> +++ b/arch/parisc/include/asm/video.h
> @@ -1,6 +1,6 @@
>   /* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
>
>   #include <linux/types.h>
>
> @@ -11,6 +11,6 @@ bool video_is_primary_device(struct device *dev);
>   #define video_is_primary_device video_is_primary_device
>   #endif
>
> -#include <asm-generic/fb.h>
> +#include <asm-generic/video.h>
>
> -#endif /* _ASM_FB_H_ */
> +#endif /* _ASM_VIDEO_H_ */
> diff --git a/arch/parisc/video/Makefile b/arch/parisc/video/Makefile
> index 16a73cce46612..b5db5b42880f8 100644
> --- a/arch/parisc/video/Makefile
> +++ b/arch/parisc/video/Makefile
> @@ -1,3 +1,3 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>
> -obj-$(CONFIG_STI_CORE) += fbdev.o
> +obj-$(CONFIG_STI_CORE) += video-sti.o
> diff --git a/arch/parisc/video/fbdev.c b/arch/parisc/video/video-sti.c
> similarity index 96%
> rename from arch/parisc/video/fbdev.c
> rename to arch/parisc/video/video-sti.c
> index 540fa0c919d59..564661e87093c 100644
> --- a/arch/parisc/video/fbdev.c
> +++ b/arch/parisc/video/video-sti.c
> @@ -9,7 +9,7 @@
>
>   #include <video/sticore.h>
>
> -#include <asm/fb.h>
> +#include <asm/video.h>
>
>   bool video_is_primary_device(struct device *dev)
>   {
> diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/video.h
> similarity index 76%
> rename from arch/powerpc/include/asm/fb.h
> rename to arch/powerpc/include/asm/video.h
> index c0c5d1df7ad1e..e1770114ffc36 100644
> --- a/arch/powerpc/include/asm/fb.h
> +++ b/arch/powerpc/include/asm/video.h
> @@ -1,6 +1,6 @@
>   /* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
>
>   #include <asm/page.h>
>
> @@ -12,6 +12,6 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
>   }
>   #define pgprot_framebuffer pgprot_framebuffer
>
> -#include <asm-generic/fb.h>
> +#include <asm-generic/video.h>
>
> -#endif /* _ASM_FB_H_ */
> +#endif /* _ASM_VIDEO_H_ */
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index d95a48eff412e..eac84d687b53f 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -517,7 +517,7 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
>   }
>
>   /*
> - * This one is used by /dev/mem and fbdev who have no clue about the
> + * This one is used by /dev/mem and video who have no clue about the
>    * PCI device, it tries to find the PCI device first and calls the
>    * above routine
>    */
> diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
> deleted file mode 100644
> index 19df13ee9ca73..0000000000000
> --- a/arch/sh/include/asm/fb.h
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _ASM_FB_H_
> -#define _ASM_FB_H_
> -
> -#include <asm-generic/fb.h>
> -
> -#endif /* _ASM_FB_H_ */
> diff --git a/arch/sh/include/asm/video.h b/arch/sh/include/asm/video.h
> new file mode 100644
> index 0000000000000..14f49934a247a
> --- /dev/null
> +++ b/arch/sh/include/asm/video.h
> @@ -0,0 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _ASM_VIDEO_H_
> +#define _ASM_VIDEO_H_
> +
> +#include <asm-generic/video.h>
> +
> +#endif /* _ASM_VIDEO_H_ */
> diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/video.h
> similarity index 89%
> rename from arch/sparc/include/asm/fb.h
> rename to arch/sparc/include/asm/video.h
> index 07f0325d6921c..a6f48f52db584 100644
> --- a/arch/sparc/include/asm/fb.h
> +++ b/arch/sparc/include/asm/video.h
> @@ -1,6 +1,6 @@
>   /* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _SPARC_FB_H_
> -#define _SPARC_FB_H_
> +#ifndef _SPARC_VIDEO_H_
> +#define _SPARC_VIDEO_H_
>
>   #include <linux/io.h>
>   #include <linux/types.h>
> @@ -40,6 +40,6 @@ static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
>   }
>   #define fb_memset fb_memset_io
>
> -#include <asm-generic/fb.h>
> +#include <asm-generic/video.h>
>
> -#endif /* _SPARC_FB_H_ */
> +#endif /* _SPARC_VIDEO_H_ */
> diff --git a/arch/sparc/video/Makefile b/arch/sparc/video/Makefile
> index 9dd82880a027a..fdf83a408d750 100644
> --- a/arch/sparc/video/Makefile
> +++ b/arch/sparc/video/Makefile
> @@ -1,3 +1,3 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>
> -obj-y	+= fbdev.o
> +obj-y	+= video.o
> diff --git a/arch/sparc/video/fbdev.c b/arch/sparc/video/video.c
> similarity index 86%
> rename from arch/sparc/video/fbdev.c
> rename to arch/sparc/video/video.c
> index e46f0499c2774..2414380caadc9 100644
> --- a/arch/sparc/video/fbdev.c
> +++ b/arch/sparc/video/video.c
> @@ -4,8 +4,8 @@
>   #include <linux/device.h>
>   #include <linux/module.h>
>
> -#include <asm/fb.h>
>   #include <asm/prom.h>
> +#include <asm/video.h>
>
>   bool video_is_primary_device(struct device *dev)
>   {
> @@ -21,5 +21,5 @@ bool video_is_primary_device(struct device *dev)
>   }
>   EXPORT_SYMBOL(video_is_primary_device);
>
> -MODULE_DESCRIPTION("Sparc fbdev helpers");
> +MODULE_DESCRIPTION("Sparc video helpers");
>   MODULE_LICENSE("GPL");
> diff --git a/arch/x86/include/asm/fb.h b/arch/x86/include/asm/video.h
> similarity index 77%
> rename from arch/x86/include/asm/fb.h
> rename to arch/x86/include/asm/video.h
> index 999db33792869..0950c9535fae9 100644
> --- a/arch/x86/include/asm/fb.h
> +++ b/arch/x86/include/asm/video.h
> @@ -1,6 +1,6 @@
>   /* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _ASM_X86_FB_H
> -#define _ASM_X86_FB_H
> +#ifndef _ASM_X86_VIDEO_H
> +#define _ASM_X86_VIDEO_H
>
>   #include <linux/types.h>
>
> @@ -16,6 +16,6 @@ pgprot_t pgprot_framebuffer(pgprot_t prot,
>   bool video_is_primary_device(struct device *dev);
>   #define video_is_primary_device video_is_primary_device
>
> -#include <asm-generic/fb.h>
> +#include <asm-generic/video.h>
>
> -#endif /* _ASM_X86_FB_H */
> +#endif /* _ASM_X86_VIDEO_H */
> diff --git a/arch/x86/video/Makefile b/arch/x86/video/Makefile
> index 9dd82880a027a..fdf83a408d750 100644
> --- a/arch/x86/video/Makefile
> +++ b/arch/x86/video/Makefile
> @@ -1,3 +1,3 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>
> -obj-y	+= fbdev.o
> +obj-y	+= video.o
> diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/video.c
> similarity index 97%
> rename from arch/x86/video/fbdev.c
> rename to arch/x86/video/video.c
> index 4d87ce8e257fe..81fc97a2a837a 100644
> --- a/arch/x86/video/fbdev.c
> +++ b/arch/x86/video/video.c
> @@ -10,7 +10,8 @@
>   #include <linux/module.h>
>   #include <linux/pci.h>
>   #include <linux/vgaarb.h>
> -#include <asm/fb.h>
> +
> +#include <asm/video.h>
>
>   pgprot_t pgprot_framebuffer(pgprot_t prot,
>   			    unsigned long vm_start, unsigned long vm_end,
> diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
> index d436bee4d129d..b20fa25a7e8d8 100644
> --- a/include/asm-generic/Kbuild
> +++ b/include/asm-generic/Kbuild
> @@ -22,7 +22,6 @@ mandatory-y += dma-mapping.h
>   mandatory-y += dma.h
>   mandatory-y += emergency-restart.h
>   mandatory-y += exec.h
> -mandatory-y += fb.h
>   mandatory-y += ftrace.h
>   mandatory-y += futex.h
>   mandatory-y += hardirq.h
> @@ -62,5 +61,6 @@ mandatory-y += uaccess.h
>   mandatory-y += unaligned.h
>   mandatory-y += vermagic.h
>   mandatory-y += vga.h
> +mandatory-y += video.h
>   mandatory-y += word-at-a-time.h
>   mandatory-y += xor.h
> diff --git a/include/asm-generic/fb.h b/include/asm-generic/video.h
> similarity index 96%
> rename from include/asm-generic/fb.h
> rename to include/asm-generic/video.h
> index 4788c1e1c6bc0..b1da2309d9434 100644
> --- a/include/asm-generic/fb.h
> +++ b/include/asm-generic/video.h
> @@ -1,7 +1,7 @@
>   /* SPDX-License-Identifier: GPL-2.0 */
>
> -#ifndef __ASM_GENERIC_FB_H_
> -#define __ASM_GENERIC_FB_H_
> +#ifndef __ASM_GENERIC_VIDEO_H_
> +#define __ASM_GENERIC_VIDEO_H_
>
>   /*
>    * Only include this header file from your architecture's <asm/fb.h>.
> @@ -133,4 +133,4 @@ static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
>   #define fb_memset fb_memset_io
>   #endif
>
> -#endif /* __ASM_GENERIC_FB_H_ */
> +#endif /* __ASM_GENERIC_VIDEO_H_ */
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 708e6a177b1be..1f23e0c505424 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -12,7 +12,7 @@
>   #include <linux/types.h>
>   #include <linux/workqueue.h>
>
> -#include <asm/fb.h>
> +#include <asm/video.h>
>
>   struct backlight_device;
>   struct device;


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 3/3] arch: Rename fbdev header and source files
From: Arnd Bergmann @ 2024-03-28 12:51 UTC (permalink / raw)
  To: Helge Deller, Thomas Zimmermann, Javier Martinez Canillas,
	sui.jingfeng
  Cc: Linux-Arch, dri-devel, linux-fbdev, sparclinux, linux-sh,
	linuxppc-dev, linux-parisc, linux-mips, linux-m68k, loongarch,
	linux-arm-kernel, linux-snps-arc, linux-kernel, Vineet Gupta,
	Catalin Marinas, Will Deacon, Huacai Chen, WANG Xuerui,
	Geert Uytterhoeven, Thomas Bogendoerfer, James E . J . Bottomley,
	Michael Ellerman, Nicholas Piggin, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andreas Larsson,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
In-Reply-To: <140d6bb3-5f44-49cb-846b-7141e551eedd@gmx.de>

On Thu, Mar 28, 2024, at 13:46, Helge Deller wrote:
> On 3/27/24 21:41, Thomas Zimmermann wrote:

>> +++ b/arch/arc/include/asm/video.h
>> @@ -0,0 +1,8 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +
>> +#ifndef _ASM_VIDEO_H_
>> +#define _ASM_VIDEO_H_
>> +
>> +#include <asm-generic/video.h>
>> +
>> +#endif /* _ASM_VIDEO_H_ */
>
> I wonder, since that file simply #includes the generic version,
> wasn't there a possibility that kbuild could symlink
> the generic version for us?
> Does it need to be mandatory in include/asm-generic/Kbuild ?
> Same applies to a few other files below.

It should be enough to just remove the files entirely,
as kbuild will generate the same wrappers for mandatory files.

     Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 3/3] arch: Rename fbdev header and source files
From: kernel test robot @ 2024-03-28 13:15 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, javierm, deller, sui.jingfeng
  Cc: oe-kbuild-all, linux-arch, dri-devel, linux-fbdev, sparclinux,
	linux-sh, linuxppc-dev, linux-parisc, linux-mips, linux-m68k,
	loongarch, linux-arm-kernel, linux-snps-arc, linux-kernel,
	Thomas Zimmermann, Vineet Gupta, Catalin Marinas, Will Deacon,
	Huacai Chen, WANG Xuerui, Geert Uytterhoeven, Thomas Bogendoerfer,
	James E.J. Bottomley, Michael Ellerman, Nicholas Piggin,
	Yoshinori Sato, Rich Felker
In-Reply-To: <20240327204450.14914-4-tzimmermann@suse.de>

Hi Thomas,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.9-rc1 next-20240328]
[cannot apply to tip/x86/core deller-parisc/for-next arnd-asm-generic/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/arch-Select-fbdev-helpers-with-CONFIG_VIDEO/20240328-044735
base:   linus/master
patch link:    https://lore.kernel.org/r/20240327204450.14914-4-tzimmermann%40suse.de
patch subject: [PATCH v2 3/3] arch: Rename fbdev header and source files
config: um-randconfig-001-20240328 (https://download.01.org/0day-ci/archive/20240328/202403282102.OEKoBT3H-lkp@intel.com/config)
compiler: gcc-12 (Ubuntu 12.3.0-9ubuntu2) 12.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240328/202403282102.OEKoBT3H-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403282102.OEKoBT3H-lkp@intel.com/

All errors (new ones prefixed by >>):

   /usr/bin/ld: drivers/video/fbdev/core/fb_io_fops.o: in function `fb_io_mmap':
>> fb_io_fops.c:(.text+0x251): undefined reference to `pgprot_framebuffer'
   collect2: error: ld returned 1 exit status

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v6 03/29] iommu/arm-smmu-v3: Do not allow a SVA domain to be set on the wrong PASID
From: Mostafa Saleh @ 2024-03-28 13:18 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: iommu, Joerg Roedel, linux-arm-kernel, Robin Murphy, Will Deacon,
	Lu Baolu, Eric Auger, Jean-Philippe Brucker, Joerg Roedel,
	Kevin Tian, kernel test robot, Moritz Fischer, Moritz Fischer,
	Michael Shavit, Nicolin Chen, patches, Shameer Kolothum, Tony Zhu,
	Yi Liu, Zhangfei Gao
In-Reply-To: <3-v6-228e7adf25eb+4155-smmuv3_newapi_p2_jgg@nvidia.com>

Hi Jason,

On Wed, Mar 27, 2024 at 03:07:49PM -0300, Jason Gunthorpe wrote:
> The SVA code is wired to assume that the SVA is programmed onto the
> mm->pasid. The current core code always does this, so it is fine.
> 
> Add a check for clarity.
> 
> Fixes: 386fa64fd52b ("arm-smmu-v3/sva: Add SVA domain support")
> Tested-by: Nicolin Chen <nicolinc@nvidia.com>
> Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
> Reviewed-by: Mostafa Saleh <smostafa@google.com>

I think there might have been a mix up, this was patch 01 in v5,
I didn’t add a tag on it. I don’t have a problem with the patch.
I just think (based on my limited understanding and rules in[1])
that it is not a fix as (mentioned in the last thread) the only
caller in the tree calls it properly.
But that’s up to the driver/stable maintainers.

[1] https://www.kernel.org/doc/html/next/process/stable-kernel-rules.html
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> index 2cd433a9c8a0fa..41b44baef15e80 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> @@ -569,6 +569,9 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain,
>  	int ret = 0;
>  	struct mm_struct *mm = domain->mm;
>  
> +	if (mm_get_enqcmd_pasid(mm) != id)
> +		return -EINVAL;
> +
>  	mutex_lock(&sva_lock);
>  	ret = __arm_smmu_sva_bind(dev, id, mm);
>  	mutex_unlock(&sva_lock);
> -- 
> 2.43.2
>

Thanks,
Mostafa

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 3/3] arch: Rename fbdev header and source files
From: Thomas Zimmermann @ 2024-03-28 13:23 UTC (permalink / raw)
  To: Arnd Bergmann, Helge Deller, Javier Martinez Canillas,
	sui.jingfeng
  Cc: Linux-Arch, dri-devel, linux-fbdev, sparclinux, linux-sh,
	linuxppc-dev, linux-parisc, linux-mips, linux-m68k, loongarch,
	linux-arm-kernel, linux-snps-arc, linux-kernel, Vineet Gupta,
	Catalin Marinas, Will Deacon, Huacai Chen, WANG Xuerui,
	Geert Uytterhoeven, Thomas Bogendoerfer, James E . J . Bottomley,
	Michael Ellerman, Nicholas Piggin, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andreas Larsson,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
In-Reply-To: <72e8aa58-c732-4a96-bcb1-32310ee041b3@app.fastmail.com>

Hi

Am 28.03.24 um 13:51 schrieb Arnd Bergmann:
> On Thu, Mar 28, 2024, at 13:46, Helge Deller wrote:
>> On 3/27/24 21:41, Thomas Zimmermann wrote:
>>> +++ b/arch/arc/include/asm/video.h
>>> @@ -0,0 +1,8 @@
>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>> +
>>> +#ifndef _ASM_VIDEO_H_
>>> +#define _ASM_VIDEO_H_
>>> +
>>> +#include <asm-generic/video.h>
>>> +
>>> +#endif /* _ASM_VIDEO_H_ */
>> I wonder, since that file simply #includes the generic version,
>> wasn't there a possibility that kbuild could symlink
>> the generic version for us?
>> Does it need to be mandatory in include/asm-generic/Kbuild ?
>> Same applies to a few other files below.
> It should be enough to just remove the files entirely,
> as kbuild will generate the same wrappers for mandatory files.

If that works, I'm happy to remove these wrapper files.

Best regards
Thomas

>
>       Arnd

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 2/3] arch: Remove struct fb_info from video helpers
From: Thomas Zimmermann @ 2024-03-28 13:33 UTC (permalink / raw)
  To: Helge Deller, arnd, javierm, sui.jingfeng
  Cc: linux-arch, dri-devel, linux-fbdev, sparclinux, linux-sh,
	linuxppc-dev, linux-parisc, linux-mips, linux-m68k, loongarch,
	linux-arm-kernel, linux-snps-arc, linux-kernel,
	James E.J. Bottomley, David S. Miller, Andreas Larsson,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
In-Reply-To: <b5a8bc60-ad16-407d-9e57-c224467c3f06@gmx.de>

Hi

Am 28.03.24 um 12:04 schrieb Helge Deller:
> On 3/27/24 21:41, Thomas Zimmermann wrote:
>> The per-architecture video helpers do not depend on struct fb_info
>> or anything else from fbdev. Remove it from the interface and replace
>> fb_is_primary_device() with video_is_primary_device(). The new helper
>
> Since you rename this function, wouldn't something similar to
>
> device_is_primary_display()
>     or
> device_is_primary_console()
>     or
> is_primary_graphics_device()
>     or
> is_primary_display_device()
>
> be a better name?

The video_ prefix is there to signal that the code is part of the video 
subsystem.

But there's too much code that tried to figure out a default video 
device. So I actually have different plans for this function. I'd like 
to replace it with a helper that returns the default device instead of 
just testing for it. Sample code for x86 is already in vgaarb.c. [1] The 
function's name would then be video_default_device() and return the 
appropriate struct device*. video_is_primary device() will be removed. 
This rename here is the easiest step towards the new helper. Ok?

Best regards
Thomas

[1] https://elixir.bootlin.com/linux/v6.8/source/drivers/pci/vgaarb.c#L559

>
> Helge
>
>> is similar in functionality, but can operate on non-fbdev devices.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
>> Cc: Helge Deller <deller@gmx.de>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Andreas Larsson <andreas@gaisler.com>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Borislav Petkov <bp@alien8.de>
>> Cc: Dave Hansen <dave.hansen@linux.intel.com>
>> Cc: x86@kernel.org
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> ---
>>   arch/parisc/include/asm/fb.h     |  8 +++++---
>>   arch/parisc/video/fbdev.c        |  9 +++++----
>>   arch/sparc/include/asm/fb.h      |  7 ++++---
>>   arch/sparc/video/fbdev.c         | 17 ++++++++---------
>>   arch/x86/include/asm/fb.h        |  8 +++++---
>>   arch/x86/video/fbdev.c           | 18 +++++++-----------
>>   drivers/video/fbdev/core/fbcon.c |  2 +-
>>   include/asm-generic/fb.h         | 11 ++++++-----
>>   8 files changed, 41 insertions(+), 39 deletions(-)
>>
>> diff --git a/arch/parisc/include/asm/fb.h b/arch/parisc/include/asm/fb.h
>> index 658a8a7dc5312..ed2a195a3e762 100644
>> --- a/arch/parisc/include/asm/fb.h
>> +++ b/arch/parisc/include/asm/fb.h
>> @@ -2,11 +2,13 @@
>>   #ifndef _ASM_FB_H_
>>   #define _ASM_FB_H_
>>
>> -struct fb_info;
>> +#include <linux/types.h>
>> +
>> +struct device;
>>
>>   #if defined(CONFIG_STI_CORE)
>> -int fb_is_primary_device(struct fb_info *info);
>> -#define fb_is_primary_device fb_is_primary_device
>> +bool video_is_primary_device(struct device *dev);
>> +#define video_is_primary_device video_is_primary_device
>>   #endif
>>
>>   #include <asm-generic/fb.h>
>> diff --git a/arch/parisc/video/fbdev.c b/arch/parisc/video/fbdev.c
>> index e4f8ac99fc9e0..540fa0c919d59 100644
>> --- a/arch/parisc/video/fbdev.c
>> +++ b/arch/parisc/video/fbdev.c
>> @@ -5,12 +5,13 @@
>>    * Copyright (C) 2001-2002 Thomas Bogendoerfer 
>> <tsbogend@alpha.franken.de>
>>    */
>>
>> -#include <linux/fb.h>
>>   #include <linux/module.h>
>>
>>   #include <video/sticore.h>
>>
>> -int fb_is_primary_device(struct fb_info *info)
>> +#include <asm/fb.h>
>> +
>> +bool video_is_primary_device(struct device *dev)
>>   {
>>       struct sti_struct *sti;
>>
>> @@ -21,6 +22,6 @@ int fb_is_primary_device(struct fb_info *info)
>>           return true;
>>
>>       /* return true if it's the default built-in framebuffer driver */
>> -    return (sti->dev == info->device);
>> +    return (sti->dev == dev);
>>   }
>> -EXPORT_SYMBOL(fb_is_primary_device);
>> +EXPORT_SYMBOL(video_is_primary_device);
>> diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
>> index 24440c0fda490..07f0325d6921c 100644
>> --- a/arch/sparc/include/asm/fb.h
>> +++ b/arch/sparc/include/asm/fb.h
>> @@ -3,10 +3,11 @@
>>   #define _SPARC_FB_H_
>>
>>   #include <linux/io.h>
>> +#include <linux/types.h>
>>
>>   #include <asm/page.h>
>>
>> -struct fb_info;
>> +struct device;
>>
>>   #ifdef CONFIG_SPARC32
>>   static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
>> @@ -18,8 +19,8 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t 
>> prot,
>>   #define pgprot_framebuffer pgprot_framebuffer
>>   #endif
>>
>> -int fb_is_primary_device(struct fb_info *info);
>> -#define fb_is_primary_device fb_is_primary_device
>> +bool video_is_primary_device(struct device *dev);
>> +#define video_is_primary_device video_is_primary_device
>>
>>   static inline void fb_memcpy_fromio(void *to, const volatile void 
>> __iomem *from, size_t n)
>>   {
>> diff --git a/arch/sparc/video/fbdev.c b/arch/sparc/video/fbdev.c
>> index bff66dd1909a4..e46f0499c2774 100644
>> --- a/arch/sparc/video/fbdev.c
>> +++ b/arch/sparc/video/fbdev.c
>> @@ -1,26 +1,25 @@
>>   // SPDX-License-Identifier: GPL-2.0
>>
>>   #include <linux/console.h>
>> -#include <linux/fb.h>
>> +#include <linux/device.h>
>>   #include <linux/module.h>
>>
>> +#include <asm/fb.h>
>>   #include <asm/prom.h>
>>
>> -int fb_is_primary_device(struct fb_info *info)
>> +bool video_is_primary_device(struct device *dev)
>>   {
>> -    struct device *dev = info->device;
>> -    struct device_node *node;
>> +    struct device_node *node = dev->of_node;
>>
>>       if (console_set_on_cmdline)
>> -        return 0;
>> +        return false;
>>
>> -    node = dev->of_node;
>>       if (node && node == of_console_device)
>> -        return 1;
>> +        return true;
>>
>> -    return 0;
>> +    return false;
>>   }
>> -EXPORT_SYMBOL(fb_is_primary_device);
>> +EXPORT_SYMBOL(video_is_primary_device);
>>
>>   MODULE_DESCRIPTION("Sparc fbdev helpers");
>>   MODULE_LICENSE("GPL");
>> diff --git a/arch/x86/include/asm/fb.h b/arch/x86/include/asm/fb.h
>> index c3b9582de7efd..999db33792869 100644
>> --- a/arch/x86/include/asm/fb.h
>> +++ b/arch/x86/include/asm/fb.h
>> @@ -2,17 +2,19 @@
>>   #ifndef _ASM_X86_FB_H
>>   #define _ASM_X86_FB_H
>>
>> +#include <linux/types.h>
>> +
>>   #include <asm/page.h>
>>
>> -struct fb_info;
>> +struct device;
>>
>>   pgprot_t pgprot_framebuffer(pgprot_t prot,
>>                   unsigned long vm_start, unsigned long vm_end,
>>                   unsigned long offset);
>>   #define pgprot_framebuffer pgprot_framebuffer
>>
>> -int fb_is_primary_device(struct fb_info *info);
>> -#define fb_is_primary_device fb_is_primary_device
>> +bool video_is_primary_device(struct device *dev);
>> +#define video_is_primary_device video_is_primary_device
>>
>>   #include <asm-generic/fb.h>
>>
>> diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c
>> index 1dd6528cc947c..4d87ce8e257fe 100644
>> --- a/arch/x86/video/fbdev.c
>> +++ b/arch/x86/video/fbdev.c
>> @@ -7,7 +7,6 @@
>>    *
>>    */
>>
>> -#include <linux/fb.h>
>>   #include <linux/module.h>
>>   #include <linux/pci.h>
>>   #include <linux/vgaarb.h>
>> @@ -25,20 +24,17 @@ pgprot_t pgprot_framebuffer(pgprot_t prot,
>>   }
>>   EXPORT_SYMBOL(pgprot_framebuffer);
>>
>> -int fb_is_primary_device(struct fb_info *info)
>> +bool video_is_primary_device(struct device *dev)
>>   {
>> -    struct device *device = info->device;
>> -    struct pci_dev *pci_dev;
>> +    struct pci_dev *pdev;
>>
>> -    if (!device || !dev_is_pci(device))
>> -        return 0;
>> +    if (!dev_is_pci(dev))
>> +        return false;
>>
>> -    pci_dev = to_pci_dev(device);
>> +    pdev = to_pci_dev(dev);
>>
>> -    if (pci_dev == vga_default_device())
>> -        return 1;
>> -    return 0;
>> +    return (pdev == vga_default_device());
>>   }
>> -EXPORT_SYMBOL(fb_is_primary_device);
>> +EXPORT_SYMBOL(video_is_primary_device);
>>
>>   MODULE_LICENSE("GPL");
>> diff --git a/drivers/video/fbdev/core/fbcon.c 
>> b/drivers/video/fbdev/core/fbcon.c
>> index 46823c2e2ba12..85c5c8cbc680a 100644
>> --- a/drivers/video/fbdev/core/fbcon.c
>> +++ b/drivers/video/fbdev/core/fbcon.c
>> @@ -2939,7 +2939,7 @@ void fbcon_remap_all(struct fb_info *info)
>>   static void fbcon_select_primary(struct fb_info *info)
>>   {
>>       if (!map_override && primary_device == -1 &&
>> -        fb_is_primary_device(info)) {
>> +        video_is_primary_device(info->device)) {
>>           int i;
>>
>>           printk(KERN_INFO "fbcon: %s (fb%i) is primary device\n",
>> diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h
>> index 6ccabb400aa66..4788c1e1c6bc0 100644
>> --- a/include/asm-generic/fb.h
>> +++ b/include/asm-generic/fb.h
>> @@ -10,8 +10,9 @@
>>   #include <linux/io.h>
>>   #include <linux/mm_types.h>
>>   #include <linux/pgtable.h>
>> +#include <linux/types.h>
>>
>> -struct fb_info;
>> +struct device;
>>
>>   #ifndef pgprot_framebuffer
>>   #define pgprot_framebuffer pgprot_framebuffer
>> @@ -23,11 +24,11 @@ static inline pgprot_t 
>> pgprot_framebuffer(pgprot_t prot,
>>   }
>>   #endif
>>
>> -#ifndef fb_is_primary_device
>> -#define fb_is_primary_device fb_is_primary_device
>> -static inline int fb_is_primary_device(struct fb_info *info)
>> +#ifndef video_is_primary_device
>> +#define video_is_primary_device video_is_primary_device
>> +static inline bool video_is_primary_device(struct device *dev)
>>   {
>> -    return 0;
>> +    return false;
>>   }
>>   #endif
>>
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH REVIEW] hwrng: add exynos Secure World RNG device driver
From: Krzysztof Kozlowski @ 2024-03-28 13:36 UTC (permalink / raw)
  To: Alexey Klimov, olivia, herbert, sehi.kim, linux-samsung-soc,
	peter.griffin, Łukasz Stelmach
  Cc: alim.akhtar, linux-crypto, linux-arm-kernel, linux-kernel,
	kernel-team, andre.draszik, willmcvicker, saravanak, elder,
	tudor.ambarus, klimov.linux
In-Reply-To: <20240328125056.1054878-1-alexey.klimov@linaro.org>

On 28/03/2024 13:50, Alexey Klimov wrote:
> The Exynos TRNG device is controlled by firmware and shared between

No, it is not. I have TRNG perfectly usable on my board. Maybe you are
refer to some specific SoC...

Please always Cc existing TRNG driver maintainer.

> non-secure world and secure world. Access to it is exposed via SMC
> interface which is implemented here. The firmware code does
> additional security checks, start-up test and some checks on resume.
> 
> This device is found, for instance, in Google Tensor GS101-family
> of devices.

Nothing here explains why this cannot be integrated into existing
driver. Maybe it, maybe it cannot...

You try to upstream again vendor driver ignoring that community already
did it and instead it might be enough to customize it.

Guys, the same as all the MCT, PHYs and PCI in previous works of various
people: stop duplicating drivers by upstreaming new vendor stuff with
all the issues we already fixed and please work on re-using existing
drivers.

Sometimes work cannot be combined, so come with arguments. Otherwise we
keep repeating and repeating the same feedback.

> 
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> ---
>  drivers/char/hw_random/Kconfig           |  12 +
>  drivers/char/hw_random/Makefile          |   1 +
>  drivers/char/hw_random/exynos-swd-trng.c | 423 +++++++++++++++++++++++
>  3 files changed, 436 insertions(+)
>  create mode 100644 drivers/char/hw_random/exynos-swd-trng.c
> 
> diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
> index 442c40efb200..bff7c3ec129a 100644
> --- a/drivers/char/hw_random/Kconfig
> +++ b/drivers/char/hw_random/Kconfig
> @@ -479,6 +479,18 @@ config HW_RANDOM_EXYNOS
>  
>  	  If unsure, say Y.
>  
> +config HW_RANDOM_EXYNOS_SWD
> +	tristate "Exynos SWD HW random number generator support"

What is SWD?

> +	default n
> +	help
> +	  This driver provides kernel-side support for accessing Samsung
> +	  TRNG hardware located in secure world using smc calls.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called exynos-swd-trng.
> +
> +	  If unsure, say N.
> +


...

> +
> +static UNIVERSAL_DEV_PM_OPS(exyswd_rng_pm_ops, exyswd_rng_suspend,
> +			    exyswd_rng_resume, NULL);
> +
> +static struct platform_driver exyswd_rng_driver = {
> +	.probe		= exyswd_rng_probe,
> +	.remove		= exyswd_rng_remove,
> +	.driver		= {
> +		.name	= DRVNAME,
> +		.owner	= THIS_MODULE,

So this was fixed ~8-10 years ago. Yet it re-appears. Please do not use
downstream code as template.

Take upstream driver and either change it or customize it.


> +		.pm     = &exyswd_rng_pm_ops,
> +	},
> +};
> +
> +static struct platform_device *exyswd_rng_pdev;

And if I have multiple devices?

> +
> +static int __init exyswd_rng_init(void)
> +{
> +	int ret;
> +
> +	exyswd_rng_pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
> +	if (IS_ERR(exyswd_rng_pdev))
> +		pr_err(DRVNAME ": could not register device: %ld\n",
> +		       PTR_ERR(exyswd_rng_pdev));

This is some oddity... Why do you create devices based on module load?
So I load this on Qualcomm anbd you create exynos device? This does not
make sense.


> +
> +	ret = platform_driver_register(&exyswd_rng_driver);
> +	if (ret) {
> +		platform_device_unregister(exyswd_rng_pdev);
> +		return ret;
> +	}
> +
> +	pr_info("ExyRNG driver, (c) 2014 Samsung Electronics\n");

Drop, dirvers should not print code just because I load a driver. Again:
imagine I load it on Qualcomm.


Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v1 1/2] dt-bindings: thermal: amlogic: add support for A1 thermal sensor
From: Dmitry Rokosov @ 2024-03-28 13:37 UTC (permalink / raw)
  To: neil.armstrong, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel, Dmitry Rokosov
In-Reply-To: <20240328133802.15651-1-ddrokosov@salutedevices.com>

Provide right compatible properties for Amlogic A1 Thermal Sensor
controller. A1 family supports only one thermal node - CPU thermal
sensor.

Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 .../bindings/thermal/amlogic,thermal.yaml          | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml b/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
index 20f8f9b3b971..0e7f6568d385 100644
--- a/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
@@ -13,11 +13,15 @@ description: Binding for Amlogic Thermal
 
 properties:
   compatible:
-    items:
-      - enum:
-          - amlogic,g12a-cpu-thermal
-          - amlogic,g12a-ddr-thermal
-      - const: amlogic,g12a-thermal
+    oneOf:
+      - items:
+          - enum:
+              - amlogic,g12a-cpu-thermal
+              - amlogic,g12a-ddr-thermal
+          - const: amlogic,g12a-thermal
+      - items:
+          - const: amlogic,a1-cpu-thermal
+          - const: amlogic,a1-thermal
 
   reg:
     maxItems: 1
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH v1 0/2] thermal: amlogic: introduce A1 SoC family Thermal Sensor controller
From: Dmitry Rokosov @ 2024-03-28 13:37 UTC (permalink / raw)
  To: neil.armstrong, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel, Dmitry Rokosov

It is primarily based on the G12A thermal controller, with only a slight
variation in the offset value of the efuse parameters. Therefore, this
patch series provides appropriate platform data and dt-bindings to
ensure proper support.

Dmitry Rokosov (2):
  dt-bindings: thermal: amlogic: add support for A1 thermal sensor
  thermal: amlogic: support A1 SoC family Thermal Sensor controller

 .../bindings/thermal/amlogic,thermal.yaml          | 14 +++++++++-----
 drivers/thermal/amlogic_thermal.c                  | 10 ++++++++++
 2 files changed, 19 insertions(+), 5 deletions(-)

-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v1 2/2] thermal: amlogic: support A1 SoC family Thermal Sensor controller
From: Dmitry Rokosov @ 2024-03-28 13:37 UTC (permalink / raw)
  To: neil.armstrong, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel, Dmitry Rokosov
In-Reply-To: <20240328133802.15651-1-ddrokosov@salutedevices.com>

In comparison to other Amlogic chips, there is one key difference.
The offset for the sec_ao base, also known as u_efuse_off, is special,
while other aspects remain the same.

Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 drivers/thermal/amlogic_thermal.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
index 5877cde25b79..1d23afd32013 100644
--- a/drivers/thermal/amlogic_thermal.c
+++ b/drivers/thermal/amlogic_thermal.c
@@ -222,6 +222,12 @@ static const struct amlogic_thermal_data amlogic_thermal_g12a_ddr_param = {
 	.regmap_config = &amlogic_thermal_regmap_config_g12a,
 };
 
+static const struct amlogic_thermal_data amlogic_thermal_a1_cpu_param = {
+	.u_efuse_off = 0x114,
+	.calibration_parameters = &amlogic_thermal_g12a,
+	.regmap_config = &amlogic_thermal_regmap_config_g12a,
+};
+
 static const struct of_device_id of_amlogic_thermal_match[] = {
 	{
 		.compatible = "amlogic,g12a-ddr-thermal",
@@ -231,6 +237,10 @@ static const struct of_device_id of_amlogic_thermal_match[] = {
 		.compatible = "amlogic,g12a-cpu-thermal",
 		.data = &amlogic_thermal_g12a_cpu_param,
 	},
+	{
+		.compatible = "amlogic,a1-cpu-thermal",
+		.data = &amlogic_thermal_a1_cpu_param,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, of_amlogic_thermal_match);
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH RFC 00/10] First try to replace page_frag with page_frag_cache
From: Yunsheng Lin @ 2024-03-28 13:38 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: netdev, linux-kernel, Yunsheng Lin, Alexander Duyck,
	Matthias Brugger, AngeloGioacchino Del Regno, Alexei Starovoitov,
	Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
	linux-arm-kernel, linux-mediatek, bpf

After [1], Only there are two implementations for page frag:

1. mm/page_alloc.c: net stack seems to be using it in the
   rx part with 'struct page_frag_cache' and the main API
   being page_frag_alloc_align().
2. net/core/sock.c: net stack seems to be using it in the
   tx part with 'struct page_frag' and the main API being
   skb_page_frag_refill().

This patchset tries to unfiy the page frag implementation
by replacing page_frag with page_frag_cache for sk_page_frag()
first. And will try to replace the rest of page_frag in the
follow patchset.

After this patchset, we are not only able to unify the page
frag implementation a little, but seems able to have about
0.5% performance boost testing by using the vhost_net_test
introduced in [1] too.

Before this patch:
Performance counter stats for './vhost_net_test' (10 runs):

         603027.29 msec task-clock                       #    1.756 CPUs utilized               ( +-  0.04% )
           2097713      context-switches                 #    3.479 K/sec                       ( +-  0.00% )
               212      cpu-migrations                   #    0.352 /sec                        ( +-  4.72% )
                40      page-faults                      #    0.066 /sec                        ( +-  1.18% )
      467215266413      cycles                           #    0.775 GHz                         ( +-  0.12% )  (66.02%)
      131736729037      stalled-cycles-frontend          #   28.20% frontend cycles idle        ( +-  2.38% )  (64.34%)
       77728393294      stalled-cycles-backend           #   16.64% backend cycles idle         ( +-  3.98% )  (65.42%)
      345874254764      instructions                     #    0.74  insn per cycle
                                                  #    0.38  stalled cycles per insn     ( +-  0.75% )  (70.28%)
      105166217892      branches                         #  174.397 M/sec                       ( +-  0.65% )  (68.56%)
        9649321070      branch-misses                    #    9.18% of all branches             ( +-  0.69% )  (65.38%)

           343.376 +- 0.147 seconds time elapsed  ( +-  0.04% )


After this patch:
Performance counter stats for './vhost_net_test' (10 runs):

         598081.02 msec task-clock                       #    1.752 CPUs utilized               ( +-  0.11% )
           2097738      context-switches                 #    3.507 K/sec                       ( +-  0.00% )
               220      cpu-migrations                   #    0.368 /sec                        ( +-  6.58% )
                40      page-faults                      #    0.067 /sec                        ( +-  0.92% )
      469788205101      cycles                           #    0.785 GHz                         ( +-  0.27% )  (64.86%)
      137108509582      stalled-cycles-frontend          #   29.19% frontend cycles idle        ( +-  0.96% )  (63.62%)
       75499065401      stalled-cycles-backend           #   16.07% backend cycles idle         ( +-  1.04% )  (65.86%)
      345469451681      instructions                     #    0.74  insn per cycle
                                                  #    0.40  stalled cycles per insn     ( +-  0.37% )  (70.16%)
      102782224964      branches                         #  171.853 M/sec                       ( +-  0.62% )  (69.28%)
        9295357532      branch-misses                    #    9.04% of all branches             ( +-  1.08% )  (66.21%)

           341.466 +- 0.305 seconds time elapsed  ( +-  0.09% )

CC: Alexander Duyck <alexander.duyck@gmail.com>

1. https://lore.kernel.org/all/20240228093013.8263-1-linyunsheng@huawei.com/

Yunsheng Lin (10):
  mm: Move the page fragment allocator from page_alloc into its own file
  mm: page_frag: use initial zero offset for page_frag_alloc_align()
  mm: page_frag: change page_frag_alloc_* API to accept align param
  mm: page_frag: add '_va' suffix to page_frag API
  mm: page_frag: add two inline helper for page_frag API
  mm: page_frag: reuse MSB of 'size' field for pfmemalloc
  mm: page_frag: reuse existing bit field of 'va' for pagecnt_bias
  net: introduce the skb_copy_to_va_nocache() helper
  mm: page_frag: introduce prepare/commit API for page_frag
  net: replace page_frag with page_frag_cache

 drivers/net/ethernet/google/gve/gve_rx.c      |   4 +-
 drivers/net/ethernet/intel/ice/ice_txrx.c     |   2 +-
 drivers/net/ethernet/intel/ice/ice_txrx.h     |   2 +-
 drivers/net/ethernet/intel/ice/ice_txrx_lib.c |   2 +-
 .../net/ethernet/intel/ixgbevf/ixgbevf_main.c |   4 +-
 .../marvell/octeontx2/nic/otx2_common.c       |   2 +-
 drivers/net/ethernet/mediatek/mtk_wed_wo.c    |   4 +-
 drivers/net/tun.c                             |  36 ++---
 drivers/nvme/host/tcp.c                       |   8 +-
 drivers/nvme/target/tcp.c                     |  22 +--
 drivers/vhost/net.c                           |   6 +-
 include/linux/gfp.h                           |  22 ---
 include/linux/mm_types.h                      |  18 ---
 include/linux/page_frag_cache.h               | 142 ++++++++++++++++
 include/linux/sched.h                         |   5 +-
 include/linux/skbuff.h                        |  15 +-
 include/net/sock.h                            |  22 ++-
 kernel/bpf/cpumap.c                           |   2 +-
 kernel/exit.c                                 |   3 +-
 kernel/fork.c                                 |   2 +-
 mm/Makefile                                   |   1 +
 mm/page_alloc.c                               | 136 ----------------
 mm/page_frag_alloc.c                          | 152 ++++++++++++++++++
 net/core/skbuff.c                             |  54 ++++---
 net/core/skmsg.c                              |  24 +--
 net/core/sock.c                               |  24 +--
 net/core/xdp.c                                |   2 +-
 net/ipv4/ip_output.c                          |  37 +++--
 net/ipv4/tcp.c                                |  33 ++--
 net/ipv4/tcp_output.c                         |  30 ++--
 net/ipv6/ip6_output.c                         |  37 +++--
 net/kcm/kcmsock.c                             |  28 ++--
 net/mptcp/protocol.c                          |  72 ++++++---
 net/rxrpc/txbuf.c                             |  16 +-
 net/sunrpc/svcsock.c                          |   4 +-
 net/tls/tls_device.c                          | 139 +++++++++-------
 36 files changed, 661 insertions(+), 451 deletions(-)
 create mode 100644 include/linux/page_frag_cache.h
 create mode 100644 mm/page_frag_alloc.c

-- 
2.33.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v1 0/3] arm64: dts: amlogic: a1: introduce thermal setup
From: Dmitry Rokosov @ 2024-03-28 13:44 UTC (permalink / raw)
  To: neil.armstrong, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel, Dmitry Rokosov

This patch series introduces thermal sensor declaration to the Meson A1
common dtsi file. It also sets up thermal zones for the AD402 reference
board. It depends on the series with A1 thermal support at [1].

Links:
[1] - https://lore.kernel.org/all/20240328133802.15651-1-ddrokosov@salutedevices.com/

Dmitry Rokosov (3):
  arm64: dts: amlogic: a1: add cooling-cells for DVFS feature
  arm64: dts: amlogic: a1: introduce cpu temperature sensor
  arm64: dts: amlogic: ad402: setup thermal-zones

 .../arm64/boot/dts/amlogic/meson-a1-ad402.dts | 45 +++++++++++++++++++
 arch/arm64/boot/dts/amlogic/meson-a1.dtsi     | 14 ++++++
 2 files changed, 59 insertions(+)

-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v1 2/3] arm64: dts: amlogic: a1: introduce cpu temperature sensor
From: Dmitry Rokosov @ 2024-03-28 13:44 UTC (permalink / raw)
  To: neil.armstrong, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel, Dmitry Rokosov
In-Reply-To: <20240328134459.18446-1-ddrokosov@salutedevices.com>

The A1 SoC family has only one thermal sensor for CPU temperature
measurement. It is required to set the TS clock rate to 500kHz to make
it workable.

Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
index f65d4a77ee52..6f0d0e07e037 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
@@ -854,6 +854,18 @@ usb2_phy1: phy@4000 {
 				power-domains = <&pwrc PWRC_USB_ID>;
 			};
 
+			cpu_temp: temperature-sensor@4c00 {
+				compatible = "amlogic,a1-cpu-thermal",
+					     "amlogic,a1-thermal";
+				reg = <0x0 0x4c00 0x0 0x50>;
+				interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clkc_periphs CLKID_TS>;
+				assigned-clocks = <&clkc_periphs CLKID_TS>;
+				assigned-clock-rates = <500000>;
+				#thermal-sensor-cells = <0>;
+				amlogic,ao-secure = <&sec_AO>;
+			};
+
 			hwrng: rng@5118 {
 				compatible = "amlogic,meson-rng";
 				reg = <0x0 0x5118 0x0 0x4>;
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH 7/7] regulator: mcp16502: Update the names from buck regulators
From: Mark Brown @ 2024-03-28 13:45 UTC (permalink / raw)
  To: Conor Dooley
  Cc: robh, conor+dt, lgirdwood, linux-kernel, alexandre.belloni,
	Mihai Sain, devicetree, krzysztof.kozlowski+dt, claudiu.beznea,
	andrei.simion, linux-arm-kernel
In-Reply-To: <20240327-agreed-routine-0cc60186876b@spud>


[-- Attachment #1.1: Type: text/plain, Size: 911 bytes --]

On Wed, Mar 27, 2024 at 04:28:49PM +0000, Conor Dooley wrote:
> On Wed, Mar 27, 2024 at 12:17:24PM +0200, Mihai Sain wrote:

> > Use generic names for buck regulators to avoid any confusion.
> > Update the names from buck regulators in order to match
> > the datasheet block diagram for the buck regulators.

> I know the regulator core will create dummy regulators when they are not
> provided in the devicetree, so I am not 100% on how backwards
> compatibility works here.
> You'll end up with a bunch of dummies and therefore the regulator-names
> and constraints on the regulator will be lost, no?
> Can you explain how is this backwards compatible with the old
> devicetrees?

It quite simply isn't backwards compatible.  The original driver looks
to be pretty broken but this breaks compatibility, we'd need a
transition plan of some kind which probably needs some core work to cope
with fallback names.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v1 1/3] arm64: dts: amlogic: a1: add cooling-cells for DVFS feature
From: Dmitry Rokosov @ 2024-03-28 13:44 UTC (permalink / raw)
  To: neil.armstrong, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel, Dmitry Rokosov
In-Reply-To: <20240328134459.18446-1-ddrokosov@salutedevices.com>

It's used for CPU with DVFS feature to specify minimum and maximum
cooling state used in the reference.
Without these values DVFS will not work and dtbs_check will raise the
error.

Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
index fbee986421f1..f65d4a77ee52 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
@@ -32,6 +32,7 @@ cpu0: cpu@0 {
 			reg = <0x0 0x0>;
 			enable-method = "psci";
 			next-level-cache = <&l2>;
+			#cooling-cells = <2>;
 		};
 
 		cpu1: cpu@1 {
@@ -40,6 +41,7 @@ cpu1: cpu@1 {
 			reg = <0x0 0x1>;
 			enable-method = "psci";
 			next-level-cache = <&l2>;
+			#cooling-cells = <2>;
 		};
 
 		l2: l2-cache0 {
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH v1 3/3] arm64: dts: amlogic: ad402: setup thermal-zones
From: Dmitry Rokosov @ 2024-03-28 13:44 UTC (permalink / raw)
  To: neil.armstrong, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel, Dmitry Rokosov
In-Reply-To: <20240328134459.18446-1-ddrokosov@salutedevices.com>

There is one thermal zone with 3 trip points: soc_passive, soc_hot, and
soc_critical, as well as two cooling maps.

Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 .../arm64/boot/dts/amlogic/meson-a1-ad402.dts | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts b/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts
index 6c02301840ff..2d22e8b45c6d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts
@@ -7,6 +7,7 @@
 /dts-v1/;
 
 #include "meson-a1.dtsi"
+#include <dt-bindings/thermal/thermal.h>
 
 #include <dt-bindings/gpio/gpio.h>
 
@@ -177,6 +178,50 @@ codec {
 			};
 		};
 	};
+
+	thermal-zones {
+		soc_thermal: soc_thermal {
+			polling-delay = <1000>;
+			polling-delay-passive = <100>;
+			sustainable-power = <130>;
+
+			thermal-sensors = <&cpu_temp>;
+
+			trips {
+				soc_passive: soc-passive {
+					temperature = <70000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				soc_hot: soc-hot {
+					temperature = <85000>;
+					hysteresis = <5000>;
+					type = "hot";
+				};
+
+				soc_critical: soc-critical {
+					temperature = <110000>;
+					hysteresis = <1000>;
+					type = "critical";
+				};
+			};
+
+			soc_cooling_maps: cooling-maps {
+				map0 {
+					trip = <&soc_passive>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+
+				map1 {
+					trip = <&soc_hot>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
 };
 
 /* Bluetooth HCI H4 */
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH v5 6/6] ARM: dts: imx: Add UNI-T UTi260B thermal camera board
From: Shawn Guo @ 2024-03-28 13:54 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, imx, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Pengutronix Kernel Team,
	Dong Aisheng, Linus Walleij, Dmitry Torokhov, linux-arm-kernel,
	devicetree, linux-kernel, Stefan Wahren
In-Reply-To: <20240226212740.2019837-7-sre@kernel.org>

On Mon, Feb 26, 2024 at 10:26:28PM +0100, Sebastian Reichel wrote:
> Add DT for the UNI-T UTi260B handheld thermal camera.
> 
> Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Applied, thanks!


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH] ASoC: sunxi: sun4i-i2s: Enable 32-bit audio formats
From: Mark Brown @ 2024-03-28 13:56 UTC (permalink / raw)
  To: John Watts
  Cc: Jernej Škrabec, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Chen-Yu Tsai, Samuel Holland, linux-sound, linux-arm-kernel,
	linux-sunxi, linux-kernel
In-Reply-To: <ZgTUIWh8qXH_7oxQ@titan>


[-- Attachment #1.1: Type: text/plain, Size: 745 bytes --]

On Thu, Mar 28, 2024 at 01:21:21PM +1100, John Watts wrote:
> On Wed, Mar 27, 2024 at 08:53:32PM +0100, Jernej Škrabec wrote:

> > I wish it would be that simple. SUN4I_FORMATS is cross section of all I2S
> > variants that are supported by this driver. If you check A10, you'll see that
> > it doesn't support S32.

> > If you want to add support for S32, you'll have to add new quirk for each
> > variant.

> Yes, A10 doesn't support it. But it should error out in hw_params due to
> get_sr not supporting 32-bit, no?

The constraints shouldn't be advertising things that hw_params() will
error out on, sometimes there are contingent constraints that prevent
this but something that just doesn't work isn't one of those times.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH 2/2] KVM: arm64: Allow only the specified FF-A calls to be forwarded to TZ
From: Sebastian Ene @ 2024-03-28 13:59 UTC (permalink / raw)
  To: Oliver Upton
  Cc: catalin.marinas, james.morse, jean-philippe, maz, qperret,
	qwandor, suzuki.poulose, tabba, will, yuzenghui, kvmarm,
	linux-arm-kernel, linux-kernel, kernel-team
In-Reply-To: <ZgKKcurtndJaIwAV@linux.dev>

On Tue, Mar 26, 2024 at 01:42:26AM -0700, Oliver Upton wrote:
> On Mon, Mar 25, 2024 at 11:29:39AM +0000, Sebastian Ene wrote:
> > On Fri, Mar 22, 2024 at 07:07:52PM -0700, Oliver Upton wrote:
> > > On Fri, Mar 22, 2024 at 12:43:03PM +0000, Sebastian Ene wrote:
> > > > The previous logic used a deny list to filter the FF-A calls. Because of
> > > > this, some of the calls escaped the check and they were forwarded by
> > > > default to Trustzone. (eg. FFA_MSG_SEND_DIRECT_REQ was denied but the 64
> > > > bit version of the call was not).
> > > > Modify the logic to use an allowlist and allow only the calls specified in
> > > > the filter function to be proxied to TZ from the hypervisor.
> > 
> > Hi Oliver,
> > 
> > > 
> > > I had discussed this with Will back when the feature was upstreamed and
> > > he said there's a lot of off-label calls that necessitate a denylist
> > > implementation. Has anything changed to give us confidence that we can
> > > be restrictive, at least on the FF-A range?
> > > 
> > 
> > I remember your proposal for having an allowlist instead. The current change makes
> > sense if we have https://lore.kernel.org/kvmarm/20240322124303.309423-1-sebastianene@google.com/
> > which opens the window for more FF-A calls to be forwarded to TZ.
> 
> Got it. Last time I didn't catch the level of abuse we expect to endure
> from vendors, but now it seems we will not support non-conforming calls
> that appear in standardized SMC ranges.
> 
> Adding mention of this to the changelog might be a good idea then.
> 

That's a good point. I didn't create a changelog for this but I should
add one and specify this.

> -- 
> Thanks,
> Oliver

Thanks,
Sebastian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH 2/2] arm64: dts: imx93: drop the 4th interrupt for ADC
From: Shawn Guo @ 2024-03-28 12:47 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: haibo.chen, jic23, lars, robh, krzysztof.kozlowski+dt, conor+dt,
	shawnguo, s.hauer, kernel, festevam, linux-imx, linux-iio,
	devicetree, linux-arm-kernel, linux-kernel, Peng Fan
In-Reply-To: <20240226130826.3824251-2-peng.fan@oss.nxp.com>

On Mon, Feb 26, 2024 at 09:08:26PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Per i.MX93 Reference Mannual Rev.4, 12/2023, there is no interrupt 268,
> drop it.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Applied, thanks!


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH REVIEW] hwrng: add exynos Secure World RNG device driver
From: Alexey Klimov @ 2024-03-28 12:50 UTC (permalink / raw)
  To: olivia, herbert, sehi.kim, linux-samsung-soc, peter.griffin
  Cc: krzysztof.kozlowski, alim.akhtar, alexey.klimov, linux-crypto,
	linux-arm-kernel, linux-kernel, kernel-team, andre.draszik,
	willmcvicker, saravanak, elder, tudor.ambarus, klimov.linux

The Exynos TRNG device is controlled by firmware and shared between
non-secure world and secure world. Access to it is exposed via SMC
interface which is implemented here. The firmware code does
additional security checks, start-up test and some checks on resume.

This device is found, for instance, in Google Tensor GS101-family
of devices.

Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
 drivers/char/hw_random/Kconfig           |  12 +
 drivers/char/hw_random/Makefile          |   1 +
 drivers/char/hw_random/exynos-swd-trng.c | 423 +++++++++++++++++++++++
 3 files changed, 436 insertions(+)
 create mode 100644 drivers/char/hw_random/exynos-swd-trng.c

diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 442c40efb200..bff7c3ec129a 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -479,6 +479,18 @@ config HW_RANDOM_EXYNOS
 
 	  If unsure, say Y.
 
+config HW_RANDOM_EXYNOS_SWD
+	tristate "Exynos SWD HW random number generator support"
+	default n
+	help
+	  This driver provides kernel-side support for accessing Samsung
+	  TRNG hardware located in secure world using smc calls.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called exynos-swd-trng.
+
+	  If unsure, say N.
+
 config HW_RANDOM_OPTEE
 	tristate "OP-TEE based Random Number Generator support"
 	depends on OPTEE
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
index 32549a1186dc..ce64929d461a 100644
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o
 n2-rng-y := n2-drv.o n2-asm.o
 obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o
 obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-trng.o
+obj-$(CONFIG_HW_RANDOM_EXYNOS_SWD) += exynos-swd-trng.o
 obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o
 obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o
 obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += omap3-rom-rng.o
diff --git a/drivers/char/hw_random/exynos-swd-trng.c b/drivers/char/hw_random/exynos-swd-trng.c
new file mode 100644
index 000000000000..29def8e6d0b7
--- /dev/null
+++ b/drivers/char/hw_random/exynos-swd-trng.c
@@ -0,0 +1,423 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * exynos-swd-trng.c - Random Number Generator driver for the exynos TRNG
+ * located in secure world
+ * Copyright (C) Linaro Ltd 2024 Alexey Klimov <alexey.klimov@linaro.org>
+ *
+ * Based on downstream driver:
+ * Copyright (C) 2018 Samsung Electronics
+ * Sehee Kim <sehi.kim@samsung.com>
+ */
+
+#include <linux/arm-smccc.h>
+#include <linux/delay.h>
+#include <linux/hw_random.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+/* DTRNG smc */
+#define SMC_CMD_RANDOM			(0x82001012)
+
+/* DTRNG smc commands */
+#define HWRNG_INIT			(0x0)
+#define HWRNG_EXIT			(0x1)
+#define HWRNG_GET_DATA			(0x2)
+#define HWRNG_RESUME			(0x3)
+
+#define HWRNG_RET_OK			0
+#define HWRNG_RET_INVALID_ERROR		1
+#define HWRNG_RET_RETRY_ERROR		2
+#define HWRNG_RET_INVALID_FLAG_ERROR	3
+#define HWRNG_RET_TEST_ERROR		4
+#define HWRNG_RET_START_UP_TEST_DONE	5
+#define HWRNG_RET_TEST_KAT_ERROR	0xC
+
+#define EXYRNG_START_UP_SIZE		(4096 + 1)
+#define EXYRNG_RETRY_MAX_COUNT		1000000
+#define EXYRNG_START_UP_TEST_MAX_RETRY	2
+
+#define DRVNAME	"exynos_swd_trng"
+
+enum state {
+	INACTIVE = 0,
+	ACTIVE,
+};
+
+struct exyswd_rng {
+	struct hwrng rng;
+	enum state state;
+	struct device *dev;
+	/* to track and protect state of the device */
+	struct mutex lock;
+};
+
+static int __exynos_cm_smc(u64 *arg0, u64 *arg1,
+			   u64 *arg2, u64 *arg3)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(*arg0, *arg1, *arg2, *arg3, 0, 0, 0, 0, &res);
+
+	*arg0 = res.a0;
+	*arg1 = res.a1;
+	*arg2 = res.a2;
+	*arg3 = res.a3;
+
+	return *arg0;
+}
+
+static int exynos_cm_cmd(int cmd)
+{
+	u64 reg0, reg1, reg2, reg3;
+
+	reg0 = SMC_CMD_RANDOM;
+	reg1 = cmd;
+	reg3 = reg2 = 0;
+
+	return __exynos_cm_smc(&reg0, &reg1, &reg2, &reg3);
+}
+
+static int exynos_cm_get_data(u64 *arg0, u64 *arg1,
+			      u64 *arg2, u64 *arg3)
+{
+	*arg0 = SMC_CMD_RANDOM;
+	*arg1 = HWRNG_GET_DATA;
+	*arg3 = 0;
+
+	return __exynos_cm_smc(arg0, arg1, arg2, arg3);
+}
+
+static int exynos_swd_get_data(u64 *arg0, u64 *arg1, u64 *arg2, u64 *arg3,
+			       struct exyswd_rng *exyswd_rng)
+{
+	u32 retry_cnt = 0;
+	int ret;
+
+	while (retry_cnt++ < EXYRNG_RETRY_MAX_COUNT) {
+		ret = exynos_cm_get_data(arg0, arg1, arg2, arg3);
+
+		if (ret == HWRNG_RET_OK)
+			return 0;
+
+		if (ret == HWRNG_RET_RETRY_ERROR) {
+			usleep_range(50, 100);
+			continue;
+		}
+
+		if (ret == HWRNG_RET_TEST_ERROR) {
+			dev_dbg(exyswd_rng->dev, "error while testing\n");
+			return -EAGAIN;
+		}
+
+		return -EFAULT;
+	}
+
+	ret = -EFAULT;
+	dev_warn(exyswd_rng->dev, "retry counter is reached\n");
+	return ret;
+}
+
+static int exynos_swd_init(void)
+{
+	u32 retry_cnt = 0;
+	int ret;
+
+	do {
+		ret = exynos_cm_cmd(HWRNG_INIT);
+		if (ret == HWRNG_RET_RETRY_ERROR) {
+			if (retry_cnt++ > EXYRNG_RETRY_MAX_COUNT)
+				break;
+
+			usleep_range(50, 100);
+		}
+	} while (ret == HWRNG_RET_RETRY_ERROR);
+
+	return ret;
+}
+
+static void exynos_swd_exit(void)
+{
+	u32 retry_cnt = 0;
+
+	while (retry_cnt++ < EXYRNG_RETRY_MAX_COUNT) {
+		if (!exynos_cm_cmd(HWRNG_EXIT))
+			break;
+		usleep_range(50, 100);
+	}
+}
+
+static int exynos_swd_startup_test(struct exyswd_rng *exyswd_rng)
+{
+	u64 reg0, reg1, reg2, reg3;
+	int start_up_size = EXYRNG_START_UP_SIZE;
+	u32 retry_cnt = 0;
+	int ret;
+
+	ret = exynos_swd_init();
+	if (ret != HWRNG_RET_OK) {
+		if (ret == HWRNG_RET_TEST_ERROR) {
+			ret = -EAGAIN;
+			goto out;
+		} else
+			return -EFAULT;
+	}
+
+	while (start_up_size > 0) {
+		/* For start-up test the 3-rd argument has to be set to 1 */
+		reg2 = 1;
+		ret = exynos_cm_get_data(&reg0, &reg1, &reg2, &reg3);
+		if (ret == HWRNG_RET_RETRY_ERROR) {
+			if (retry_cnt++ > EXYRNG_RETRY_MAX_COUNT) {
+				dev_warn(exyswd_rng->dev,
+					 "exceeded retry in start-up test\n");
+				break;
+			}
+			usleep_range(50, 100);
+			continue;
+		}
+
+		if (ret == HWRNG_RET_TEST_ERROR ||
+		    ret == HWRNG_RET_TEST_KAT_ERROR) {
+			dev_err(exyswd_rng->dev,
+				"malfunction of TRNG(HW) is detected\n");
+			return -EFAULT;
+		}
+
+		if (ret == HWRNG_RET_START_UP_TEST_DONE) {
+			dev_dbg(exyswd_rng->dev,
+				"start-up test is already done\n");
+			ret = 0;
+			break;
+		}
+
+		if (ret != HWRNG_RET_OK) {
+			dev_dbg(exyswd_rng->dev, "failed to get random data\n");
+			return -EFAULT;
+		}
+
+		start_up_size -= 32;
+		retry_cnt = 0;
+	}
+
+out:
+	exynos_swd_exit();
+	return ret;
+}
+
+static int exynos_swd_read(struct hwrng *rng, void *data, size_t max, bool wait)
+{
+	struct exyswd_rng *exyswd_rng =
+				container_of(rng, struct exyswd_rng, rng);
+	u64 reg0, reg1, reg2, reg3;
+	u32 *read_buf = data;
+	u32 read_size = max;
+	u32 retry_cnt;
+	int ret = HWRNG_RET_OK;
+
+	mutex_lock(&exyswd_rng->lock);
+	ret = exynos_swd_init();
+	if (ret != HWRNG_RET_OK) {
+		if (ret == HWRNG_RET_TEST_ERROR) {
+			ret = -EAGAIN;
+			goto out_locked;
+		} else {
+			mutex_unlock(&exyswd_rng->lock);
+			return -EFAULT;
+		}
+	}
+
+	exyswd_rng->state = ACTIVE;
+	mutex_unlock(&exyswd_rng->lock);
+
+	retry_cnt = 0;
+	while (read_size >= 8) {
+		reg2 = 0;
+		ret = exynos_swd_get_data(&reg0, &reg1, &reg2, &reg3, exyswd_rng);
+		if (ret)
+			goto out;
+
+		*(u32 *)(read_buf++) = (u32)reg2;
+		*(u32 *)(read_buf++) = (u32)reg3;
+
+		read_size -= 8;
+		retry_cnt = 0;
+	}
+
+	/*
+	 * rng_buf_size is 32 bytes or cache line usually, it is unlikely
+	 * we will have remaining bytes to read here.
+	 */
+	if (unlikely(read_size > 0)) {
+		reg2 = 0;
+		ret = exynos_swd_get_data(&reg0, &reg1, &reg2, &reg3, exyswd_rng);
+		if (ret)
+			goto out;
+		if (read_size >= 4) {
+			*(u32 *)(read_buf++) = (u32)reg2;
+			read_size -= 4;
+		}
+
+		if (read_size) {
+			memcpy(read_buf, &reg3, read_size);
+			read_size = 0;
+		}
+	}
+
+	ret = max;
+out:
+	mutex_lock(&exyswd_rng->lock);
+out_locked:
+	exynos_swd_exit();
+	exyswd_rng->state = INACTIVE;
+	mutex_unlock(&exyswd_rng->lock);
+
+	return ret;
+}
+
+static int exyswd_rng_probe(struct platform_device *pdev)
+{
+	struct exyswd_rng *exyswd_rng;
+	int ret;
+
+	exyswd_rng = devm_kzalloc(&pdev->dev, sizeof(*exyswd_rng), GFP_KERNEL);
+	if (!exyswd_rng)
+		return -ENOMEM;
+
+	exyswd_rng->rng.name = DRVNAME;
+	exyswd_rng->rng.read = exynos_swd_read;
+	exyswd_rng->rng.quality = 500;
+	exyswd_rng->dev = &pdev->dev;
+	exyswd_rng->state = INACTIVE;
+	mutex_init(&exyswd_rng->lock);
+
+	/*
+	 * Do the startup test first. If it works we've got the device
+	 * and can finish probe().
+	 */
+	ret = exynos_swd_startup_test(exyswd_rng);
+	if (ret) {
+		dev_dbg(&pdev->dev, "start-up test failed\n");
+		return -ENODEV;
+	}
+
+	ret = devm_hwrng_register(&pdev->dev, &exyswd_rng->rng);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "failed to register hwrng\n");
+
+	platform_set_drvdata(pdev, exyswd_rng);
+	dev_set_drvdata(&pdev->dev, exyswd_rng);
+
+	dev_info(&pdev->dev, "hwrng registered\n");
+
+	return 0;
+}
+
+static int exyswd_rng_remove(struct platform_device *pdev)
+{
+	struct exyswd_rng *exyswd_rng = platform_get_drvdata(pdev);
+
+	devm_hwrng_unregister(&pdev->dev, &exyswd_rng->rng);
+
+	mutex_lock(&exyswd_rng->lock);
+	if (exyswd_rng->state == ACTIVE) {
+		exynos_swd_exit();
+		exyswd_rng->state = INACTIVE;
+	}
+	mutex_unlock(&exyswd_rng->lock);
+
+	return 0;
+}
+
+#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
+static int exyswd_rng_suspend(struct device *dev)
+{
+	struct exyswd_rng *exyswd_rng = dev_get_drvdata(dev);
+	int ret = 0;
+
+	mutex_lock(&exyswd_rng->lock);
+	if (exyswd_rng->state) {
+		ret = exynos_cm_cmd(HWRNG_EXIT);
+		if (ret != HWRNG_RET_OK)
+			dev_warn(dev,
+				 "failed to enter suspend, error %d\n", ret);
+	}
+	mutex_unlock(&exyswd_rng->lock);
+
+	return ret;
+}
+
+static int exyswd_rng_resume(struct device *dev)
+{
+	struct exyswd_rng *exyswd_rng = dev_get_drvdata(dev);
+	int ret;
+
+	mutex_lock(&exyswd_rng->lock);
+	ret = exynos_cm_cmd(HWRNG_RESUME);
+	if (ret != HWRNG_RET_OK)
+		dev_warn(dev, "failed to resume, error %d\n", ret);
+	if (exyswd_rng->state) {
+		ret = exynos_cm_cmd(HWRNG_INIT);
+		if (ret != HWRNG_RET_OK)
+			dev_warn(dev,
+				 "failed to init hwrng on resume, error %d\n",
+				 ret);
+	}
+	mutex_unlock(&exyswd_rng->lock);
+
+	return ret;
+}
+#endif
+
+static UNIVERSAL_DEV_PM_OPS(exyswd_rng_pm_ops, exyswd_rng_suspend,
+			    exyswd_rng_resume, NULL);
+
+static struct platform_driver exyswd_rng_driver = {
+	.probe		= exyswd_rng_probe,
+	.remove		= exyswd_rng_remove,
+	.driver		= {
+		.name	= DRVNAME,
+		.owner	= THIS_MODULE,
+		.pm     = &exyswd_rng_pm_ops,
+	},
+};
+
+static struct platform_device *exyswd_rng_pdev;
+
+static int __init exyswd_rng_init(void)
+{
+	int ret;
+
+	exyswd_rng_pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
+	if (IS_ERR(exyswd_rng_pdev))
+		pr_err(DRVNAME ": could not register device: %ld\n",
+		       PTR_ERR(exyswd_rng_pdev));
+
+	ret = platform_driver_register(&exyswd_rng_driver);
+	if (ret) {
+		platform_device_unregister(exyswd_rng_pdev);
+		return ret;
+	}
+
+	pr_info("ExyRNG driver, (c) 2014 Samsung Electronics\n");
+
+	return 0;
+}
+
+static void __exit exyswd_rng_exit(void)
+{
+	platform_driver_unregister(&exyswd_rng_driver);
+	platform_device_unregister(exyswd_rng_pdev);
+}
+
+module_init(exyswd_rng_init);
+module_exit(exyswd_rng_exit);
+
+MODULE_DESCRIPTION("Exynos SWD H/W Random Number Generator driver");
+MODULE_AUTHOR("Alexey Klimov <alexey.klimov@linaro.org>");
+MODULE_AUTHOR("Sehee Kim <sehi.kim@samsung.com>");
+MODULE_LICENSE("GPL");
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 00/11] address remaining stringop-truncation warnings
From: Arnd Bergmann @ 2024-03-28 14:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Jens Axboe, Robert Moore, Rafael J. Wysocki,
	Len Brown, James E.J. Bottomley, Martin K. Petersen, Viresh Kumar,
	Johan Hovold, Alex Elder, Greg Kroah-Hartman, Florian Fainelli,
	Broadcom internal kernel review list, Mike Marshall,
	Martin Brandenburg, Steven Rostedt, Masami Hiramatsu,
	Mathieu Desnoyers, Andrew Morton, Masahiro Yamada,
	Nathan Chancellor, Nicolas Schier, Kees Cook, Alexey Starikovskiy,
	linux-ntfs-dev, linux-block, linux-acpi, acpica-devel, linux-scsi,
	greybus-dev, linux-staging, linux-rpi-kernel, linux-arm-kernel,
	devel, linux-trace-kernel, linux-kbuild

From: Arnd Bergmann <arnd@arndb.de>

We are close to being able to turn on -Wstringop-truncation
unconditionally instead of only at the 'make W=1' level, these ten
warnings are all that I saw in randconfig testing across compiler versions
on arm, arm64 and x86.

The final patch is only there for reference at the moment, I hope
we can merge the other ones through the subsystem trees first,
as there are no dependencies between them.

     Arnd

Arnd Bergmann (11):
  staging: vc04_services: changen strncpy() to strscpy_pad()
  scsi: devinfo: rework scsi_strcpy_devinfo()
  staging: replace weird strncpy() with memcpy()
  orangefs: convert strncpy() to strscpy()
  test_hexdump: avoid string truncation warning
  acpi: avoid warning for truncated string copy
  block/partitions/ldm: convert strncpy() to strscpy()
  blktrace: convert strncpy() to strscpy_pad()
  staging: rtl8723bs: convert strncpy to strscpy
  staging: greybus: change strncpy() to strscpy()
  kbuild: enable -Wstringop-truncation globally

 block/partitions/ldm.c                        |  6 ++--
 drivers/acpi/acpica/tbfind.c                  | 19 +++++------
 drivers/scsi/scsi_devinfo.c                   | 30 +++++++++++------
 drivers/staging/greybus/fw-management.c       |  4 +--
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c |  5 ++-
 drivers/staging/rts5208/rtsx_scsi.c           |  2 +-
 .../vc04_services/vchiq-mmal/mmal-vchiq.c     |  4 +--
 fs/orangefs/dcache.c                          |  4 +--
 fs/orangefs/namei.c                           | 33 +++++++++----------
 fs/orangefs/super.c                           | 16 ++++-----
 kernel/trace/blktrace.c                       |  3 +-
 lib/test_hexdump.c                            |  2 +-
 scripts/Makefile.extrawarn                    |  1 -
 13 files changed, 64 insertions(+), 65 deletions(-)

-- 
2.39.2

Cc: "Richard Russon
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Robert Moore <robert.moore@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Viresh Kumar <vireshk@kernel.org>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alex Elder <elder@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Martin Brandenburg <martin@omnibond.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>
Cc: linux-ntfs-dev@lists.sourceforge.net
Cc: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-acpi@vger.kernel.org
Cc: acpica-devel@lists.linux.dev
Cc: linux-scsi@vger.kernel.org
Cc: greybus-dev@lists.linaro.org
Cc: linux-staging@lists.linux.dev
Cc: linux-rpi-kernel@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: devel@lists.orangefs.org
Cc: linux-trace-kernel@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH 01/11] staging: vc04_services: changen strncpy() to strscpy_pad()
From: Arnd Bergmann @ 2024-03-28 14:04 UTC (permalink / raw)
  To: linux-kernel, Florian Fainelli, Greg Kroah-Hartman
  Cc: Arnd Bergmann, Broadcom internal kernel review list,
	linux-rpi-kernel, linux-arm-kernel, linux-staging
In-Reply-To: <20240328140512.4148825-1-arnd@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

gcc-14 warns about this strncpy() that results in a non-terminated
string for an overflow:

In file included from include/linux/string.h:369,
                 from drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:20:
In function 'strncpy',
    inlined from 'create_component' at drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:940:2:
include/linux/fortify-string.h:108:33: error: '__builtin_strncpy' specified bound 128 equals destination size [-Werror=stringop-truncation]

Change it to strscpy_pad(), which produces a properly terminated and
zero-padded string.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index 258aa0e37f55..6ca5797aeae5 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -937,8 +937,8 @@ static int create_component(struct vchiq_mmal_instance *instance,
 	/* build component create message */
 	m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
 	m.u.component_create.client_component = component->client_component;
-	strncpy(m.u.component_create.name, name,
-		sizeof(m.u.component_create.name));
+	strscpy_pad(m.u.component_create.name, name,
+		    sizeof(m.u.component_create.name));
 
 	ret = send_synchronous_mmal_msg(instance, &m,
 					sizeof(m.u.component_create),
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH v1 2/2] thermal: amlogic: support A1 SoC family Thermal Sensor controller
From: neil.armstrong @ 2024-03-28 14:08 UTC (permalink / raw)
  To: Dmitry Rokosov, jbrunet, mturquette, khilman, martin.blumenstingl,
	glaroque, rafael, daniel.lezcano, rui.zhang, lukasz.luba, robh+dt,
	krzysztof.kozlowski+dt, conor+dt
  Cc: kernel, rockosov, linux-amlogic, linux-pm, linux-kernel,
	devicetree, linux-arm-kernel
In-Reply-To: <20240328133802.15651-3-ddrokosov@salutedevices.com>

On 28/03/2024 14:37, Dmitry Rokosov wrote:
> In comparison to other Amlogic chips, there is one key difference.
> The offset for the sec_ao base, also known as u_efuse_off, is special,
> while other aspects remain the same.
> 
> Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> ---
>   drivers/thermal/amlogic_thermal.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
> index 5877cde25b79..1d23afd32013 100644
> --- a/drivers/thermal/amlogic_thermal.c
> +++ b/drivers/thermal/amlogic_thermal.c
> @@ -222,6 +222,12 @@ static const struct amlogic_thermal_data amlogic_thermal_g12a_ddr_param = {
>   	.regmap_config = &amlogic_thermal_regmap_config_g12a,
>   };
>   
> +static const struct amlogic_thermal_data amlogic_thermal_a1_cpu_param = {
> +	.u_efuse_off = 0x114,
> +	.calibration_parameters = &amlogic_thermal_g12a,
> +	.regmap_config = &amlogic_thermal_regmap_config_g12a,
> +};
> +
>   static const struct of_device_id of_amlogic_thermal_match[] = {
>   	{
>   		.compatible = "amlogic,g12a-ddr-thermal",
> @@ -231,6 +237,10 @@ static const struct of_device_id of_amlogic_thermal_match[] = {
>   		.compatible = "amlogic,g12a-cpu-thermal",
>   		.data = &amlogic_thermal_g12a_cpu_param,
>   	},
> +	{
> +		.compatible = "amlogic,a1-cpu-thermal",
> +		.data = &amlogic_thermal_a1_cpu_param,
> +	},
>   	{ /* sentinel */ }
>   };
>   MODULE_DEVICE_TABLE(of, of_amlogic_thermal_match);

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Keep it even it you change the compatible,

Thanks,
Neil

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox