arm64: Add ARCH_HAS_SG_CHAIN
Subsystems (8)
PATCH 1/1 arm64: Add ARCH_HAS_SG_CHAIN
It's useful to be able to chain scatterlists together for very large scatter allocations. Define ARCH_HAS_SG_CHAIN to let this happen.
--- arch/arm64/include/asm/scatterlist.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 arch/arm64/include/asm/scatterlist.h
arch/arm64/include/asm/scatterlist.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright (c) 2014, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ASM_SCATTERLIST_H +#define __ASM_SCATTERLIST_H + +#include <asm-generic/scatterlist.h> + +#define ARCH_HAS_SG_CHAIN + +#endif
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH 1/1 arm64: Add ARCH_HAS_SG_CHAIN
Quoted 24 lines · Laura Abbott
It's useful to be able to chain scatterlists together for very large scatter allocations. Define
ARCH_HAS_SG_CHAINto let this happen.Signed-off-by Laura Abbott <[email protected]>--- arch/arm64/include/asm/scatterlist.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 arch/arm64/include/asm/scatterlist.harch/arm64/include/asm/scatterlist.h new file +9
-0@@ -0,0 +1,21 @@ +/* +* Copyright (c) 2014, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of
arch/arm64/include/asm/scatterlist.h line 19
Quoted 10 lines
arch/arm64/include/asm/scatterlist.h new file +10
-0+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ASM_SCATTERLIST_H +#define __ASM_SCATTERLIST_H + +#include <asm-generic/scatterlist.h> + +#define ARCH_HAS_SG_CHAIN
Hmm, I wonder if this should be a Kconfig option instead, to avoid the need for the dummy header?
Will
PATCH 1/1 arm64: Add ARCH_HAS_SG_CHAIN
Quoted 39 lines · Will Deacon
Quoted 24 lines · Laura Abbott
It's useful to be able to chain scatterlists together for very large scatter allocations. Define
ARCH_HAS_SG_CHAINto let this happen.Signed-off-by Laura Abbott <[email protected]>--- arch/arm64/include/asm/scatterlist.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)create mode 100644
arch/arm64/include/asm/scatterlist.harch/arm64/include/asm/scatterlist.h new file +9
-0@@ -0,0 +1,21 @@ +/* +* Copyright (c) 2014, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of arch/arm64/include/asm/scatterlist.h line 19
Quoted 10 lines
arch/arm64/include/asm/scatterlist.h new file +10
-0+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ASM_SCATTERLIST_H +#define __ASM_SCATTERLIST_H + +#include <asm-generic/scatterlist.h> + +#define ARCH_HAS_SG_CHAIN Hmm, I wonder if this should be a
Kconfigoption instead, to avoid the need for the dummy header?
Quoted 2 lines
Will
Yeah, it does seem non-standard at this point. Something like the following perhaps?
arch/arm/Kconfig +1 -0
@@ -82,6 +82,7 @@ config ARM <http://www.arm.linux.org.uk/>. config ARM_HAS_SG_CHAIN + select ARCH_HAS_SG_CHAIN bool config NEED_SG_DMA_LENGTH
(quoted diff) +0 -0
b/arch/arm/include/asm/scatterlist.h
index cefdb8f..2f87870 100644
arch/arm/include/asm/scatterlist.h +0 -4
@@ -1,10 +1,6 @@#ifndef _ASMARM_SCATTERLIST_H#define _ASMARM_SCATTERLIST_H -#ifdef CONFIG_ARM_HAS_SG_CHAIN -#define ARCH_HAS_SG_CHAIN -#endif -#include <asm/memory.h> #include <asm/types.h> #include <asm-generic/scatterlist.h>
arch/arm64/Kconfig +1 -0
@@ -2,6 +2,7 @@ config ARM64 def_bool y select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_HAS_SG_CHAIN select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
arch/ia64/Kconfig +1 -0
@@ -44,6 +44,7 @@ config IA64 select HAVE_MOD_ARCH_SPECIFIC select MODULES_USE_ELF_RELA select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_HAS_SG_CHAIN default y help The Itanium Processor Family is Intel's 64-bit successor to
(quoted diff) +0 -0
b/arch/ia64/include/asm/scatterlist.h
index 08fd93b..c19b59d 100644
arch/ia64/include/asm/scatterlist.h +0 -1
@@ -2,6 +2,5 @@#define _ASM_IA64_SCATTERLIST_H#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN #endif /* _ASM_IA64_SCATTERLIST_H */
arch/powerpc/Kconfig +1 -0
@@ -141,6 +141,7 @@ config PPC select HAVE_DEBUG_STACKOVERFLOW select HAVE_IRQ_EXIT_ON_IRQ_STACK select ARCH_USE_CMPXCHG_LOCKREF if PPC64 + select ARCH_HAS_SG_CHAIN config GENERIC_CSUM def_bool CPU_LITTLE_ENDIAN
(quoted diff) +0 -0
b/arch/powerpc/include/asm/scatterlist.h
index de1f620..1f51af5 100644
arch/powerpc/include/asm/scatterlist.h +0 -2
@@ -12,6 +12,4 @@#include <asm/dma.h> #include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN -#endif /* _ASM_POWERPC_SCATTERLIST_H */
arch/s390/Kconfig +1 -0
@@ -142,6 +142,7 @@ config S390 select SYSCTL_EXCEPTION_TRACE select VIRT_CPU_ACCOUNTING select VIRT_TO_BUS + select ARCH_HAS_SG_CHAIN config SCHED_OMIT_FRAME_POINTER def_bool y
(quoted diff) +0 -0
b/arch/s390/include/asm/scatterlist.h
index 6d45ef6..4aaea56 100644
arch/s390/include/asm/scatterlist.h +0 -1
@@ -1,3 +1,2 @@#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN
arch/sparc/Kconfig +1 -0
@@ -42,6 +42,7 @@ config SPARC select MODULES_USE_ELF_RELA select ODD_RT_SIGACTION select OLD_SIGSUSPEND + select ARCH_HAS_SG_CHAIN config SPARC32 def_bool !64BIT
(quoted diff) +0 -0
b/arch/sparc/include/asm/scatterlist.h
index 92bb638..6eab378 100644
arch/sparc/include/asm/scatterlist.h +0 -2
@@ -3,6 +3,4 @@#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN -#endif /* !(_SPARC_SCATTERLIST_H) */
arch/x86/Kconfig +1 -0
@@ -127,6 +127,7 @@ config X86 select HAVE_DEBUG_STACKOVERFLOW select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 select HAVE_CC_STACKPROTECTOR + select ARCH_HAS_SG_CHAIN config INSTRUCTION_DECODER def_bool y
(quoted diff) +0 -0
b/arch/x86/include/asm/scatterlist.h
index 4240878..b08f91d 100644
arch/x86/include/asm/scatterlist.h +0 -2
@@ -3,6 +3,4 @@#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN -#endif /* _ASM_X86_SCATTERLIST_H */
include/linux/scatterlist.h +0 -0
@@ -136,7 +136,7 @@ static inline void sg_set_buf(struct scatterlist
*sg, const void *buf,
static inline void sg_chain(struct scatterlist *prv, unsigned intprv_nents,
struct scatterlist *sgl)
{
-#ifndef ARCH_HAS_SG_CHAIN
+#ifndef CONFIG_ARCH_HAS_SG_CHAIN
BUG();
#endif
include/scsi/scsi.h +0 -0
@@ -31,7 +31,7 @@ enum scsi_timeouts {* Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining.
This limit
* is totally arbitrary, a setting of 2048 will get you at least 8mb ios. */
-#ifdef ARCH_HAS_SG_CHAIN
+#ifdef CONFIG_ARCH_HAS_SG_CHAIN
#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048
#else
#define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTS
lib/Kconfig +7 -0
@@ -451,4 +451,11 @@ config UCS2_STRING source "lib/fonts/Kconfig" +# +# sg chaining option +# + +config ARCH_HAS_SG_CHAIN + def_bool n + endmenu
lib/scatterlist.c +1 -1
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(sg_nents);**/ struct scatterlist *sg_last (struct scatterlist *sgl,unsigned int nents) { -#ifndef ARCH_HAS_SG_CHAIN +#ifndef CONFIG_ARCH_HAS_SG_CHAIN struct scatterlist *ret = &sgl[nents -1 ];#else struct scatterlist *sg, *ret =NULL ;
@@ -251,7 +251,7 @@ int __sg_alloc_table(struct sg_table *table,
unsigned int nents,
if (nents == 0)
return -EINVAL;
-#ifndef ARCH_HAS_SG_CHAIN
+#ifndef CONFIG_ARCH_HAS_SG_CHAIN
if (WARN_ON_ONCE(nents > max_ents))
return -EINVAL;
#endif
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH 1/1 arm64: Add ARCH_HAS_SG_CHAIN
Hi Laura,
Quoted 10 lines · Laura Abbott
Quoted 9 lines · Will Deacon
Quoted 8 lines · Laura Abbott
It's useful to be able to chain scatterlists together for very large scatter allocations. Define
ARCH_HAS_SG_CHAINto let this happen.Signed-off-by Laura Abbott <[email protected]>--- arch/arm64/include/asm/scatterlist.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)create mode 100644
arch/arm64/include/asm/scatterlist.h
[...]
Quoted 10 lines
Quoted 10 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+#ifndef __ASM_SCATTERLIST_H +#define __ASM_SCATTERLIST_H + +#include <asm-generic/scatterlist.h> + +#define ARCH_HAS_SG_CHAINHmm, I wonder if this should be a
Kconfigoption instead, to avoid the need for the dummy header?
Quoted 5 lines
Quoted 2 lines
Will
Yeah, it does seem non-standard at this point. Something like the following perhaps?
Yes, that looks like the right sort of thing, thanks.
Probably easiest to merge via akpm if you can get some more acks.
Will
Quoted 230 lines
arch/arm/Kconfig +1
-0@@ -82,6 +82,7 @@ config ARM <http://www.arm.linux.org.uk/>. config ARM_HAS_SG_CHAIN + select ARCH_HAS_SG_CHAIN bool config NEED_SG_DMA_LENGTHarch/arm/include/asm/scatterlist.h +0
-4@@ -1,10 +1,6 @@#ifndef _ASMARM_SCATTERLIST_H#define _ASMARM_SCATTERLIST_H -#ifdef CONFIG_ARM_HAS_SG_CHAIN -#define ARCH_HAS_SG_CHAIN -#endif -#include <asm/memory.h> #include <asm/types.h> #include <asm-generic/scatterlist.h> arch/arm64/Kconfig +1
-0@@ -2,6 +2,7 @@ config ARM64 def_bool y select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_HAS_SG_CHAIN select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSIONarch/ia64/Kconfig +1
-0@@ -44,6 +44,7 @@ config IA64 select HAVE_MOD_ARCH_SPECIFIC select MODULES_USE_ELF_RELA select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_HAS_SG_CHAIN default y help The Itanium Processor Family is Intel's 64-bit successor toarch/ia64/include/asm/scatterlist.h +0
-1@@ -2,6 +2,5 @@#define _ASM_IA64_SCATTERLIST_H#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN #endif /* _ASM_IA64_SCATTERLIST_H */ arch/powerpc/Kconfig +1
-0@@ -141,6 +141,7 @@ config PPC select HAVE_DEBUG_STACKOVERFLOW select HAVE_IRQ_EXIT_ON_IRQ_STACK select ARCH_USE_CMPXCHG_LOCKREF if PPC64 + select ARCH_HAS_SG_CHAIN config GENERIC_CSUM def_bool CPU_LITTLE_ENDIANarch/powerpc/include/asm/scatterlist.h +0
-2@@ -12,6 +12,4 @@#include <asm/dma.h> #include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN -#endif /* _ASM_POWERPC_SCATTERLIST_H */ arch/s390/Kconfig +1
-0@@ -142,6 +142,7 @@ config S390 select SYSCTL_EXCEPTION_TRACE select VIRT_CPU_ACCOUNTING select VIRT_TO_BUS + select ARCH_HAS_SG_CHAIN config SCHED_OMIT_FRAME_POINTER def_bool yarch/s390/include/asm/scatterlist.h +0
-1@@ -1,3 +1,2 @@#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN arch/sparc/Kconfig +1
-0@@ -42,6 +42,7 @@ config SPARC select MODULES_USE_ELF_RELA select ODD_RT_SIGACTION select OLD_SIGSUSPEND + select ARCH_HAS_SG_CHAIN config SPARC32 def_bool !64BITarch/sparc/include/asm/scatterlist.h +0
-2@@ -3,6 +3,4 @@#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN -#endif /* !(_SPARC_SCATTERLIST_H) */ arch/x86/Kconfig +1
-0@@ -127,6 +127,7 @@ config X86 select HAVE_DEBUG_STACKOVERFLOW select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 select HAVE_CC_STACKPROTECTOR + select ARCH_HAS_SG_CHAIN config INSTRUCTION_DECODER def_bool yarch/x86/include/asm/scatterlist.h +0
-2@@ -3,6 +3,4 @@#include <asm-generic/scatterlist.h> -#define ARCH_HAS_SG_CHAIN -#endif /* _ASM_X86_SCATTERLIST_H */ include/linux/scatterlist.h +1
-1@@ -136,7 +136,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf, static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,struct scatterlist *sgl) { -#ifndef ARCH_HAS_SG_CHAIN +#ifndef CONFIG_ARCH_HAS_SG_CHAIN BUG ();#endifinclude/scsi/scsi.h +0
-0@@ -31,7 +31,7 @@ enum scsi_timeouts {* Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
* is totally arbitrary, a setting of 2048 will get you at least 8mb ios. */include/scsi/scsi.h +1
-1-#ifdef ARCH_HAS_SG_CHAIN +#ifdef CONFIG_ARCH_HAS_SG_CHAIN #define SCSI_MAX_SG_CHAIN_SEGMENTS 2048#else #define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTSlib/Kconfig +7
-0@@ -451,4 +451,11 @@ config UCS2_STRING source "lib/fonts/Kconfig" +# +# sg chaining option +# + +config ARCH_HAS_SG_CHAIN + def_bool n + endmenulib/scatterlist.c +2
-2@@ -73,7 +73,7 @@ EXPORT_SYMBOL(sg_nents);**/ struct scatterlist *sg_last (struct scatterlist *sgl,unsigned int nents) { -#ifndef ARCH_HAS_SG_CHAIN +#ifndef CONFIG_ARCH_HAS_SG_CHAIN struct scatterlist *ret = &sgl[nents -1 ];#else struct scatterlist *sg, *ret =NULL ;@@ -251,7 +251,7 @@ int __sg_alloc_table(struct sg_table *table, unsigned int nents, if (nents == 0) return -EINVAL; -#ifndef ARCH_HAS_SG_CHAIN +#ifndef CONFIG_ARCH_HAS_SG_CHAIN if (WARN_ON_ONCE (nents > max_ents))return -EINVAL ;#endifSignature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Catalin Marinas
maintainerPATCH 1/1 arm64: Add ARCH_HAS_SG_CHAIN
In reply to Laura AbbottQuoted 61 lines · Laura Abbott
Quoted 30 lines · Will Deacon
Quoted 29 lines · Laura Abbott
It's useful to be able to chain scatterlists together for very large scatter allocations. Define
ARCH_HAS_SG_CHAINto let this happen.Signed-off-by Laura Abbott <[email protected]>--- arch/arm64/include/asm/scatterlist.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)create mode 100644
arch/arm64/include/asm/scatterlist.harch/arm64/include/asm/scatterlist.h new file +14
-0@@ -0,0 +1,21 @@ +/* +* Copyright (c) 2014, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ASM_SCATTERLIST_HQuoted 8 lines
arch/arm64/include/asm/scatterlist.h line 19
Quoted 5 lines
arch/arm64/include/asm/scatterlist.h new file +5
-0+#define __ASM_SCATTERLIST_H + +#include <asm-generic/scatterlist.h> + +#define ARCH_HAS_SG_CHAIN Hmm, I wonder if this should be a
Kconfigoption instead, to avoid the need for the dummy header?Yeah, it does seem non-standard at this point. Something like the following perhaps?
arch/arm/Kconfig +1
-0@@ -82,6 +82,7 @@ config ARM <http://www.arm.linux.org.uk/>. config ARM_HAS_SG_CHAIN + select ARCH_HAS_SG_CHAIN bool config NEED_SG_DMA_LENGTHarch/arm/include/asm/scatterlist.h +0
-0
arch/arm/include/asm/scatterlist.h line 6
Quoted 10 lines
arch/arm/include/asm/scatterlist.h +0
-4@@ -1,10 +1,6 @@#ifndef _ASMARM_SCATTERLIST_H#define _ASMARM_SCATTERLIST_H -#ifdef CONFIG_ARM_HAS_SG_CHAIN -#define ARCH_HAS_SG_CHAIN -#endif -#include <asm/memory.h> #include <asm/types.h> #include <asm-generic/scatterlist.h>
For most architectures, you can remove this file entirely and place
generic-y += scatterlist.h
in arch/*/include/asm/Kbuild.
It would result in some nice negative diffstat.
arch/arm64/Kconfig config ARM64 · line 8
Quoted 12 lines
arch/arm64/Kconfig +1
-0@@ -2,6 +2,7 @@ config ARM64 def_bool y select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_HAS_SG_CHAIN select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
This would be a new feature in a clean-up patch. I don't mind if they go together, you can add my ack for the arm64 part.
Signature · 1 line
Catalin