Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1587277 > unrolled thread
| Started by | Stafford Horne <shorne@gmail.com> |
|---|---|
| First post | 2017-02-24 05:40 +0100 |
| Last post | 2017-02-24 05:50 +0100 |
| Articles | 20 on this page of 45 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH v4 00/24] OpenRISC patches for 4.11 Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 23/24] openrisc: Export ioremap symbols used by modules Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 13/24] openrisc: Initial support for the idle state Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 18/24] scripts/checkstack.pl: Add openrisc support Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 18/24] scripts/checkstack.pl: Add openrisc support Tobias Klauser <tklauser@distanz.ch> - 2017-02-24 16:00 +0100
Re: [PATCH v4 18/24] scripts/checkstack.pl: Add openrisc support Stafford Horne <shorne@gmail.com> - 2017-02-24 20:40 +0100
[PATCH v4 22/24] arch/openrisc/lib/memcpy.c: use correct OR1200 option Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 22/24] arch/openrisc/lib/memcpy.c: use correct OR1200 option Jonas Bonn <jonas@southpole.se> - 2017-02-24 10:50 +0100
Re: [PATCH v4 22/24] arch/openrisc/lib/memcpy.c: use correct OR1200 option Stafford Horne <shorne@gmail.com> - 2017-02-24 21:00 +0100
[PATCH v4 08/24] openrisc: add cmpxchg and xchg implementations Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 20/24] openrisc: entry: Fix delay slot detection Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 20/24] openrisc: entry: Fix delay slot detection Jonas Bonn <jonas@southpole.se> - 2017-02-24 11:00 +0100
Re: [PATCH v4 20/24] openrisc: entry: Fix delay slot detection Stafford Horne <shorne@gmail.com> - 2017-02-24 21:20 +0100
[PATCH v4 09/24] openrisc: add optimized atomic operations Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 04/24] openrisc: head: use THREAD_SIZE instead of magic constant Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 07/24] openrisc: add atomic bitops Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 07/24] openrisc: add atomic bitops Peter Zijlstra <peterz@infradead.org> - 2017-02-24 12:00 +0100
Re: [PATCH v4 07/24] openrisc: add atomic bitops Stafford Horne <shorne@gmail.com> - 2017-02-24 20:30 +0100
[PATCH v4 11/24] openrisc: remove unnecessary stddef.h include Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 01/24] openrisc: use SPARSE_IRQ Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 21/24] openrisc: head: Move init strings to rodata section Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 21/24] openrisc: head: Move init strings to rodata section Jonas Bonn <jonas@southpole.se> - 2017-02-24 11:00 +0100
Re: [PATCH v4 21/24] openrisc: head: Move init strings to rodata section Stafford Horne <shorne@gmail.com> - 2017-02-24 21:20 +0100
[PATCH v4 05/24] openrisc: head: refactor out tlb flush into it's own function Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 05/24] openrisc: head: refactor out tlb flush into it's own function Jonas Bonn <jonas@southpole.se> - 2017-02-24 11:00 +0100
Re: [PATCH v4 05/24] openrisc: head: refactor out tlb flush into it's own function Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> - 2017-02-24 12:10 +0100
Re: [PATCH v4 05/24] openrisc: head: refactor out tlb flush into it's own function Jonas Bonn <jonas@southpole.se> - 2017-02-24 13:50 +0100
Re: [PATCH v4 05/24] openrisc: head: refactor out tlb flush into it's own function Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> - 2017-02-24 15:00 +0100
Re: [PATCH v4 05/24] openrisc: head: refactor out tlb flush into it's own function Stafford Horne <shorne@gmail.com> - 2017-02-24 20:30 +0100
[PATCH v4 24/24] openrisc: head: Init r0 to 0 on start Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 24/24] openrisc: head: Init r0 to 0 on start Jonas Bonn <jonas@southpole.se> - 2017-02-24 11:10 +0100
Re: [PATCH v4 24/24] openrisc: head: Init r0 to 0 on start Stafford Horne <shorne@gmail.com> - 2017-02-24 20:40 +0100
[PATCH v4 17/24] MAINTAINERS: Add the openrisc official repository Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 12/24] openrisc: Fix the bitmask for the unit present register Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 06/24] openrisc: add l.lwa/l.swa emulation Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 06/24] openrisc: add l.lwa/l.swa emulation Jonas Bonn <jonas@southpole.se> - 2017-02-24 10:50 +0100
Re: [PATCH v4 06/24] openrisc: add l.lwa/l.swa emulation Stafford Horne <shorne@gmail.com> - 2017-02-24 21:00 +0100
[PATCH v4 10/24] openrisc: add futex_atomic_* implementations Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 03/24] openrisc: tlb miss handler optimizations Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
[PATCH v4 19/24] openrisc: entry: Whitespace and comment cleanups Stafford Horne <shorne@gmail.com> - 2017-02-24 05:40 +0100
Re: [PATCH v4 19/24] openrisc: entry: Whitespace and comment cleanups Jonas Bonn <jonas@southpole.se> - 2017-02-24 10:50 +0100
Re: [PATCH v4 19/24] openrisc: entry: Whitespace and comment cleanups Stafford Horne <shorne@gmail.com> - 2017-02-24 21:40 +0100
[PATCH v4 15/24] openrisc: Add optimized memcpy routine Stafford Horne <shorne@gmail.com> - 2017-02-24 05:50 +0100
[PATCH v4 16/24] openrisc: Add .gitignore Stafford Horne <shorne@gmail.com> - 2017-02-24 05:50 +0100
[PATCH v4 14/24] openrisc: Add optimized memset Stafford Horne <shorne@gmail.com> - 2017-02-24 05:50 +0100
Page 1 of 3 [1] 2 3 Next page →
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 00/24] OpenRISC patches for 4.11 |
| Message-ID | <tefPH-3gU-5@gated-at.bofh.it> |
Hi All,
Changes from v3
o Removed spinlock due to
- Peter had some comments on qrwlocks and unlocking that should be
pretty easy, but...
- Its only going to be used for SMP so not testable by me now
o incorporate Atomic & Cmpxchg comments from Peter Z and RTH
o incorporate Idle state formatting comments from Joe Perches
Changes from v2
o implemented all atomic ops pointed out by Peter Z
o export ioremap symbols pointed out by allyesconfig
o init r0 to 0 as per openrisc spec, suggested by Jakob Viketoft
Changes from v1
o added change set from Valentin catching CONFIG issues
o added missing test_and_change_bit atomic bitops patch
This is another attempt to get some final comments before I send the pull
request for this merge window to Linus. Again, this is coming as I got
some nice comments on costmetics and issues with my last series.
Any feedback is appreciated.
The interesting things here are:
- optimized memset and memcpy routines, ~20% boot time saving
- support for cpu idling
- adding support for l.swa and l.lwa atomic operations (in spec from 2014)
- use atomics to implement: bitops, cmpxchg, futex, spinlocks
- the atomics are in preparation for SMP support
Testing:
I have used the kselftests to validate the changes especially the futex
operations with the futex test. Other atomic operations are common so no
explicit testing. I have mainly done the tests on qemu.
Note for testers:
The l.swa and l.lwa emulation + native instruction support is NOW FIXED in
qemu upstream git.
I have send patches for get a recent openrisc toolchain added to the
lkp-tests make.cross script. It should be up to date now I believe
this is what most build sytems use. Let me know if different.
-Stafford
Jonas Bonn (1):
openrisc: use SPARSE_IRQ
Olof Kindgren (1):
openrisc: Add optimized memset
Sebastian Macke (2):
openrisc: Fix the bitmask for the unit present register
openrisc: Initial support for the idle state
Stafford Horne (9):
openrisc: Add optimized memcpy routine
openrisc: Add .gitignore
MAINTAINERS: Add the openrisc official repository
scripts/checkstack.pl: Add openrisc support
openrisc: entry: Whitespace and comment cleanups
openrisc: entry: Fix delay slot detection
openrisc: head: Move init strings to rodata section
openrisc: Export ioremap symbols used by modules
openrisc: head: Init r0 to 0 on start
Stefan Kristiansson (10):
openrisc: add cache way information to cpuinfo
openrisc: tlb miss handler optimizations
openrisc: head: use THREAD_SIZE instead of magic constant
openrisc: head: refactor out tlb flush into it's own function
openrisc: add l.lwa/l.swa emulation
openrisc: add atomic bitops
openrisc: add cmpxchg and xchg implementations
openrisc: add optimized atomic operations
openrisc: add futex_atomic_* implementations
openrisc: remove unnecessary stddef.h include
Valentin Rothberg (1):
arch/openrisc/lib/memcpy.c: use correct OR1200 option
MAINTAINERS | 1 +
arch/openrisc/Kconfig | 1 +
arch/openrisc/TODO.openrisc | 1 -
arch/openrisc/include/asm/Kbuild | 5 +-
arch/openrisc/include/asm/atomic.h | 126 +++++++++++++++++++
arch/openrisc/include/asm/bitops.h | 2 +-
arch/openrisc/include/asm/bitops/atomic.h | 123 ++++++++++++++++++
arch/openrisc/include/asm/cmpxchg.h | 83 +++++++++++++
arch/openrisc/include/asm/cpuinfo.h | 2 +
arch/openrisc/include/asm/futex.h | 135 ++++++++++++++++++++
arch/openrisc/include/asm/spr_defs.h | 4 +-
arch/openrisc/include/asm/string.h | 10 ++
arch/openrisc/kernel/.gitignore | 1 +
arch/openrisc/kernel/entry.S | 60 +++++----
arch/openrisc/kernel/head.S | 200 ++++++++++++------------------
arch/openrisc/kernel/or32_ksyms.c | 1 +
arch/openrisc/kernel/process.c | 14 +++
arch/openrisc/kernel/ptrace.c | 1 -
arch/openrisc/kernel/setup.c | 67 +++++-----
arch/openrisc/kernel/traps.c | 183 +++++++++++++++++++++++++++
arch/openrisc/lib/Makefile | 2 +-
arch/openrisc/lib/memcpy.c | 124 ++++++++++++++++++
arch/openrisc/lib/memset.S | 98 +++++++++++++++
arch/openrisc/mm/ioremap.c | 2 +
include/asm-generic/atomic.h | 2 +
scripts/checkstack.pl | 3 +
26 files changed, 1064 insertions(+), 187 deletions(-)
create mode 100644 arch/openrisc/include/asm/atomic.h
create mode 100644 arch/openrisc/include/asm/bitops/atomic.h
create mode 100644 arch/openrisc/include/asm/cmpxchg.h
create mode 100644 arch/openrisc/include/asm/futex.h
create mode 100644 arch/openrisc/include/asm/string.h
create mode 100644 arch/openrisc/kernel/.gitignore
create mode 100644 arch/openrisc/lib/memcpy.c
create mode 100644 arch/openrisc/lib/memset.S
--
2.9.3
[toc] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 23/24] openrisc: Export ioremap symbols used by modules |
| Message-ID | <tefPH-3gU-11@gated-at.bofh.it> |
| In reply to | #1587277 |
Noticed this when building with allyesconfig. Got build failures due
to iounmap and __ioremap symbols missing. This patch exports them so
modules can use them. This is inline with other architectures.
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
arch/openrisc/mm/ioremap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
index 8705a46..2175e4b 100644
--- a/arch/openrisc/mm/ioremap.c
+++ b/arch/openrisc/mm/ioremap.c
@@ -80,6 +80,7 @@ __ioremap(phys_addr_t addr, unsigned long size, pgprot_t prot)
return (void __iomem *)(offset + (char *)v);
}
+EXPORT_SYMBOL(__ioremap);
void iounmap(void *addr)
{
@@ -106,6 +107,7 @@ void iounmap(void *addr)
return vfree((void *)(PAGE_MASK & (unsigned long)addr));
}
+EXPORT_SYMBOL(iounmap);
/**
* OK, this one's a bit tricky... ioremap can get called before memory is
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 13/24] openrisc: Initial support for the idle state |
| Message-ID | <tefPH-3gU-13@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Sebastian Macke <sebastian@macke.de>
This patch adds basic support for the idle state of the cpu.
The patch overrides the regular idle function, enables the interupts,
checks for the power management unit and enables the cpu doze mode
if available.
Signed-off-by: Sebastian Macke <sebastian@macke.de>
[shorne@gmail.com: Fixed checkpatch, blankline after declarations]
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
arch/openrisc/kernel/process.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index c49350b..6e9d1cb 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -75,6 +75,17 @@ void machine_power_off(void)
__asm__("l.nop 1");
}
+/*
+ * Send the doze signal to the cpu if available.
+ * Make sure, that all interrupts are enabled
+ */
+void arch_cpu_idle(void)
+{
+ local_irq_enable();
+ if (mfspr(SPR_UPR) & SPR_UPR_PMP)
+ mtspr(SPR_PMR, mfspr(SPR_PMR) | SPR_PMR_DME);
+}
+
void (*pm_power_off) (void) = machine_power_off;
/*
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 18/24] scripts/checkstack.pl: Add openrisc support |
| Message-ID | <tefPH-3gU-7@gated-at.bofh.it> |
| In reply to | #1587277 |
Openrisc stack pointer is managed by decrementing r1. Add regexes to
recognize this.
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
scripts/checkstack.pl | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index dd83978..eea5b78 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -106,6 +106,9 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
# f0019d10: 9d e3 bf 90 save %sp, -112, %sp
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
+ } elsif ($arch eq 'openrisc') {
+ # c000043c: 9c 21 fe f0 l.addi r1,r1,-272
+ $re = qr/.*l\.addi.*r1,r1,-(([0-9]{2}|[3-9])[0-9]{2})/o;
} else {
print("wrong or unknown architecture \"$arch\"\n");
exit
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Tobias Klauser <tklauser@distanz.ch> |
|---|---|
| Date | 2017-02-24 16:00 +0100 |
| Subject | Re: [PATCH v4 18/24] scripts/checkstack.pl: Add openrisc support |
| Message-ID | <tepvH-1C7-11@gated-at.bofh.it> |
| In reply to | #1587280 |
On 2017-02-24 at 05:32:38 +0100, Stafford Horne <shorne@gmail.com> wrote:
> Openrisc stack pointer is managed by decrementing r1. Add regexes to
> recognize this.
>
> Signed-off-by: Stafford Horne <shorne@gmail.com>
> ---
> scripts/checkstack.pl | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
> index dd83978..eea5b78 100755
> --- a/scripts/checkstack.pl
> +++ b/scripts/checkstack.pl
> @@ -106,6 +106,9 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
> } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
> # f0019d10: 9d e3 bf 90 save %sp, -112, %sp
> $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
> + } elsif ($arch eq 'openrisc') {
> + # c000043c: 9c 21 fe f0 l.addi r1,r1,-272
> + $re = qr/.*l\.addi.*r1,r1,-(([0-9]{2}|[3-9])[0-9]{2})/o;
The if/elsif clauses are currently ordered alphabetically (except for
blackfin :-/), so this should rather be inserted above after nios2.
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 20:40 +0100 |
| Subject | Re: [PATCH v4 18/24] scripts/checkstack.pl: Add openrisc support |
| Message-ID | <tetSF-4P4-1@gated-at.bofh.it> |
| In reply to | #1587701 |
On Fri, Feb 24, 2017 at 03:42:06PM +0100, Tobias Klauser wrote:
> On 2017-02-24 at 05:32:38 +0100, Stafford Horne <shorne@gmail.com> wrote:
> > Openrisc stack pointer is managed by decrementing r1. Add regexes to
> > recognize this.
> >
> > Signed-off-by: Stafford Horne <shorne@gmail.com>
> > ---
> > scripts/checkstack.pl | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
> > index dd83978..eea5b78 100755
> > --- a/scripts/checkstack.pl
> > +++ b/scripts/checkstack.pl
> > @@ -106,6 +106,9 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
> > } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
> > # f0019d10: 9d e3 bf 90 save %sp, -112, %sp
> > $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
> > + } elsif ($arch eq 'openrisc') {
> > + # c000043c: 9c 21 fe f0 l.addi r1,r1,-272
> > + $re = qr/.*l\.addi.*r1,r1,-(([0-9]{2}|[3-9])[0-9]{2})/o;
>
> The if/elsif clauses are currently ordered alphabetically (except for
> blackfin :-/), so this should rather be inserted above after nios2.
Right, I didnt notice the order. Also, nios is new, this might cause a
bit of a conflict during merge. (just a note)
Thanks for the comment.
-Stafford
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 22/24] arch/openrisc/lib/memcpy.c: use correct OR1200 option |
| Message-ID | <tefPH-3gU-9@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Valentin Rothberg <valentinrothberg@gmail.com> The Kconfig option for OR12000 is OR1K_1200. Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Signed-off-by: Stafford Horne <shorne@gmail.com> --- arch/openrisc/lib/memcpy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/openrisc/lib/memcpy.c b/arch/openrisc/lib/memcpy.c index 4706f01..669887a 100644 --- a/arch/openrisc/lib/memcpy.c +++ b/arch/openrisc/lib/memcpy.c @@ -17,7 +17,7 @@ #include <linux/string.h> -#ifdef CONFIG_OR1200 +#ifdef CONFIG_OR1K_1200 /* * Do memcpy with word copies and loop unrolling. This gives the * best performance on the OR1200 and MOR1KX archirectures -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Jonas Bonn <jonas@southpole.se> |
|---|---|
| Date | 2017-02-24 10:50 +0100 |
| Subject | Re: [PATCH v4 22/24] arch/openrisc/lib/memcpy.c: use correct OR1200 option |
| Message-ID | <tekFH-6GV-1@gated-at.bofh.it> |
| In reply to | #1587281 |
Hi Stafford, Squash this patch into the memcpy patch in order to prevent surprises for anyone doing a git bisection through here. /Jonas On 02/24/2017 05:32 AM, Stafford Horne wrote: > From: Valentin Rothberg <valentinrothberg@gmail.com> > > The Kconfig option for OR12000 is OR1K_1200. > > Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> > Signed-off-by: Stafford Horne <shorne@gmail.com> > --- > arch/openrisc/lib/memcpy.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/openrisc/lib/memcpy.c b/arch/openrisc/lib/memcpy.c > index 4706f01..669887a 100644 > --- a/arch/openrisc/lib/memcpy.c > +++ b/arch/openrisc/lib/memcpy.c > @@ -17,7 +17,7 @@ > > #include <linux/string.h> > > -#ifdef CONFIG_OR1200 > +#ifdef CONFIG_OR1K_1200 > /* > * Do memcpy with word copies and loop unrolling. This gives the > * best performance on the OR1200 and MOR1KX archirectures
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 21:00 +0100 |
| Subject | Re: [PATCH v4 22/24] arch/openrisc/lib/memcpy.c: use correct OR1200 option |
| Message-ID | <teuc2-4Ze-17@gated-at.bofh.it> |
| In reply to | #1587466 |
On Fri, Feb 24, 2017 at 10:24:31AM +0100, Jonas Bonn wrote: > Hi Stafford, > > Squash this patch into the memcpy patch in order to prevent surprises for > anyone doing a git bisection through here. Hi Jonas, Thanks for reviewing. Good spot. I intentionally didn't squash this one just to give Valentin credit on the fix. Also, since it wouldnt really be broken (build or boot issues) in the initial patch I didnt think it would be a bisect issue. Also, I noticed a lot of Valintin's patches pushed by people are separated out not squashed. -Stafford > /Jonas > > On 02/24/2017 05:32 AM, Stafford Horne wrote: > > From: Valentin Rothberg <valentinrothberg@gmail.com> > > > > The Kconfig option for OR12000 is OR1K_1200. > > > > Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> > > Signed-off-by: Stafford Horne <shorne@gmail.com> > > --- > > arch/openrisc/lib/memcpy.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/openrisc/lib/memcpy.c b/arch/openrisc/lib/memcpy.c > > index 4706f01..669887a 100644 > > --- a/arch/openrisc/lib/memcpy.c > > +++ b/arch/openrisc/lib/memcpy.c > > @@ -17,7 +17,7 @@ > > #include <linux/string.h> > > -#ifdef CONFIG_OR1200 > > +#ifdef CONFIG_OR1K_1200 > > /* > > * Do memcpy with word copies and loop unrolling. This gives the > > * best performance on the OR1200 and MOR1KX archirectures > >
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 08/24] openrisc: add cmpxchg and xchg implementations |
| Message-ID | <tefPH-3gU-15@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Optimized version that make use of the l.lwa and l.swa atomic instruction
pair.
Most openrisc cores provide these instructions now, if not available
emulation is provided.
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
[shorne@gmail.com: remove OPENRISC_HAVE_INST_LWA_SWA config suggesed by
Alan Cox https://lkml.org/lkml/2014/7/23/666]
[shorne@gmail.com: fixed unused calculated value compiler warning in
define cmpxchg]
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
arch/openrisc/include/asm/Kbuild | 2 -
arch/openrisc/include/asm/cmpxchg.h | 83 +++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 2 deletions(-)
create mode 100644 arch/openrisc/include/asm/cmpxchg.h
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 6dd177d..15e6ed5 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -10,8 +10,6 @@ generic-y += bugs.h
generic-y += cacheflush.h
generic-y += checksum.h
generic-y += clkdev.h
-generic-y += cmpxchg-local.h
-generic-y += cmpxchg.h
generic-y += cputime.h
generic-y += current.h
generic-y += device.h
diff --git a/arch/openrisc/include/asm/cmpxchg.h b/arch/openrisc/include/asm/cmpxchg.h
new file mode 100644
index 0000000..5fcb9ac
--- /dev/null
+++ b/arch/openrisc/include/asm/cmpxchg.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2014 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ASM_OPENRISC_CMPXCHG_H
+#define __ASM_OPENRISC_CMPXCHG_H
+
+#include <linux/types.h>
+
+/*
+ * This function doesn't exist, so you'll get a linker error
+ * if something tries to do an invalid cmpxchg().
+ */
+extern void __cmpxchg_called_with_bad_pointer(void);
+
+#define __HAVE_ARCH_CMPXCHG 1
+
+static inline unsigned long
+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+ if (size != 4) {
+ __cmpxchg_called_with_bad_pointer();
+ return old;
+ }
+
+ __asm__ __volatile__(
+ "1: l.lwa %0, 0(%1) \n"
+ " l.sfeq %0, %2 \n"
+ " l.bnf 2f \n"
+ " l.nop \n"
+ " l.swa 0(%1), %3 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ "2: \n"
+ : "=&r"(old)
+ : "r"(ptr), "r"(old), "r"(new)
+ : "cc", "memory");
+
+ return old;
+}
+
+#define cmpxchg(ptr, o, n) \
+ ({ \
+ (__typeof__(*(ptr))) __cmpxchg((ptr), \
+ (unsigned long)(o), \
+ (unsigned long)(n), \
+ sizeof(*(ptr))); \
+ })
+
+/*
+ * This function doesn't exist, so you'll get a linker error if
+ * something tries to do an invalidly-sized xchg().
+ */
+extern void __xchg_called_with_bad_pointer(void);
+
+static inline unsigned long __xchg(unsigned long val, volatile void *ptr,
+ int size)
+{
+ if (size != 4) {
+ __xchg_called_with_bad_pointer();
+ return val;
+ }
+
+ __asm__ __volatile__(
+ "1: l.lwa %0, 0(%1) \n"
+ " l.swa 0(%1), %2 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ : "=&r"(val)
+ : "r"(ptr), "r"(val)
+ : "cc", "memory");
+
+ return val;
+}
+
+#define xchg(ptr, with) \
+ ((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), sizeof(*(ptr))))
+
+#endif /* __ASM_OPENRISC_CMPXCHG_H */
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 20/24] openrisc: entry: Fix delay slot detection |
| Message-ID | <tefPH-3gU-17@gated-at.bofh.it> |
| In reply to | #1587277 |
Use execption SR stored in pt_regs for detection, the current SR is not correct as the handler is running after return from exception. Also, The code that checks for a delay slot uses a flag bitmask and then wants to check if the result is not zero. The test it implemented was wrong. Correct it by changing the test to check result against non zero. Signed-off-by: Stafford Horne <shorne@gmail.com> --- arch/openrisc/kernel/entry.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index daae2a4..bc65008 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S @@ -258,9 +258,9 @@ EXCEPTION_ENTRY(_data_page_fault_handler) #else - l.mfspr r6,r0,SPR_SR // SR + l.lwz r6,PT_SR(r3) // SR l.andi r6,r6,SPR_SR_DSX // check for delay slot exception - l.sfeqi r6,0x1 // exception happened in delay slot + l.sfne r6,r0 // exception happened in delay slot l.bnf 7f l.lwz r6,PT_PC(r3) // address of an offending insn -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Jonas Bonn <jonas@southpole.se> |
|---|---|
| Date | 2017-02-24 11:00 +0100 |
| Subject | Re: [PATCH v4 20/24] openrisc: entry: Fix delay slot detection |
| Message-ID | <tekPn-6Kt-1@gated-at.bofh.it> |
| In reply to | #1587283 |
On 02/24/2017 05:32 AM, Stafford Horne wrote: > Use execption SR stored in pt_regs for detection, the current SR is not > correct as the handler is running after return from exception. > > Also, The code that checks for a delay slot uses a flag bitmask and then > wants to check if the result is not zero. The test it implemented was > wrong. > > Correct it by changing the test to check result against non zero. This wants to be two patches as you are changing two different things. /Joans > > Signed-off-by: Stafford Horne <shorne@gmail.com> > --- > arch/openrisc/kernel/entry.S | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S > index daae2a4..bc65008 100644 > --- a/arch/openrisc/kernel/entry.S > +++ b/arch/openrisc/kernel/entry.S > @@ -258,9 +258,9 @@ EXCEPTION_ENTRY(_data_page_fault_handler) > > #else > > - l.mfspr r6,r0,SPR_SR // SR > + l.lwz r6,PT_SR(r3) // SR > l.andi r6,r6,SPR_SR_DSX // check for delay slot exception > - l.sfeqi r6,0x1 // exception happened in delay slot > + l.sfne r6,r0 // exception happened in delay slot > l.bnf 7f > l.lwz r6,PT_PC(r3) // address of an offending insn >
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 21:20 +0100 |
| Subject | Re: [PATCH v4 20/24] openrisc: entry: Fix delay slot detection |
| Message-ID | <teuvo-5m8-7@gated-at.bofh.it> |
| In reply to | #1587478 |
On Fri, Feb 24, 2017 at 10:32:32AM +0100, Jonas Bonn wrote: > On 02/24/2017 05:32 AM, Stafford Horne wrote: > > Use execption SR stored in pt_regs for detection, the current SR is not > > correct as the handler is running after return from exception. > > > > Also, The code that checks for a delay slot uses a flag bitmask and then > > wants to check if the result is not zero. The test it implemented was > > wrong. > > > > Correct it by changing the test to check result against non zero. > > This wants to be two patches as you are changing two different things. Hi Jonas, Technically yes, two things, but... The logic is broken without both fixes. It would be a nightmare for someone to review these one-liners as two patches. I would like to keep as one. -Stafford > > > > Signed-off-by: Stafford Horne <shorne@gmail.com> > > --- > > arch/openrisc/kernel/entry.S | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S > > index daae2a4..bc65008 100644 > > --- a/arch/openrisc/kernel/entry.S > > +++ b/arch/openrisc/kernel/entry.S > > @@ -258,9 +258,9 @@ EXCEPTION_ENTRY(_data_page_fault_handler) > > #else > > - l.mfspr r6,r0,SPR_SR // SR > > + l.lwz r6,PT_SR(r3) // SR > > l.andi r6,r6,SPR_SR_DSX // check for delay slot exception > > - l.sfeqi r6,0x1 // exception happened in delay slot > > + l.sfne r6,r0 // exception happened in delay slot > > l.bnf 7f > > l.lwz r6,PT_PC(r3) // address of an offending insn > >
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 09/24] openrisc: add optimized atomic operations |
| Message-ID | <tefPI-3gU-43@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Using the l.lwa and l.swa atomic instruction pair.
Most openrisc processor cores provide these instructions now. If the
instructions are not available emulation is provided.
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
[shorne@gmail.com: remove OPENRISC_HAVE_INST_LWA_SWA config suggesed by
Alan Cox https://lkml.org/lkml/2014/7/23/666]
[shorne@gmail.com: expand to implement all ops suggested by Peter
Zijlstra https://lkml.org/lkml/2017/2/20/317]
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
arch/openrisc/include/asm/Kbuild | 1 -
arch/openrisc/include/asm/atomic.h | 126 +++++++++++++++++++++++++++++++++++++
include/asm-generic/atomic.h | 2 +
3 files changed, 128 insertions(+), 1 deletion(-)
create mode 100644 arch/openrisc/include/asm/atomic.h
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 15e6ed5..1cedd63 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -1,7 +1,6 @@
header-y += ucontext.h
-generic-y += atomic.h
generic-y += auxvec.h
generic-y += barrier.h
generic-y += bitsperlong.h
diff --git a/arch/openrisc/include/asm/atomic.h b/arch/openrisc/include/asm/atomic.h
new file mode 100644
index 0000000..146e166
--- /dev/null
+++ b/arch/openrisc/include/asm/atomic.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2014 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ASM_OPENRISC_ATOMIC_H
+#define __ASM_OPENRISC_ATOMIC_H
+
+#include <linux/types.h>
+
+/* Atomically perform op with v->counter and i */
+#define ATOMIC_OP(op) \
+static inline void atomic_##op(int i, atomic_t *v) \
+{ \
+ int tmp; \
+ \
+ __asm__ __volatile__( \
+ "1: l.lwa %0,0(%1) \n" \
+ " l." #op " %0,%0,%2 \n" \
+ " l.swa 0(%1),%0 \n" \
+ " l.bnf 1b \n" \
+ " l.nop \n" \
+ : "=&r"(tmp) \
+ : "r"(&v->counter), "r"(i) \
+ : "cc", "memory"); \
+}
+
+/* Atomically perform op with v->counter and i, return the result */
+#define ATOMIC_OP_RETURN(op) \
+static inline int atomic_##op##_return(int i, atomic_t *v) \
+{ \
+ int tmp; \
+ \
+ __asm__ __volatile__( \
+ "1: l.lwa %0,0(%1) \n" \
+ " l." #op " %0,%0,%2 \n" \
+ " l.swa 0(%1),%0 \n" \
+ " l.bnf 1b \n" \
+ " l.nop \n" \
+ : "=&r"(tmp) \
+ : "r"(&v->counter), "r"(i) \
+ : "cc", "memory"); \
+ \
+ return tmp; \
+}
+
+/* Atomically perform op with v->counter and i, return orig v->counter */
+#define ATOMIC_FETCH_OP(op) \
+static inline int atomic_fetch_##op(int i, atomic_t *v) \
+{ \
+ int tmp, old; \
+ \
+ __asm__ __volatile__( \
+ "1: l.lwa %0,0(%2) \n" \
+ " l." #op " %1,%0,%3 \n" \
+ " l.swa 0(%2),%1 \n" \
+ " l.bnf 1b \n" \
+ " l.nop \n" \
+ : "=&r"(old), "=&r"(tmp) \
+ : "r"(&v->counter), "r"(i) \
+ : "cc", "memory"); \
+ \
+ return old; \
+}
+
+ATOMIC_OP_RETURN(add)
+ATOMIC_OP_RETURN(sub)
+
+ATOMIC_FETCH_OP(add)
+ATOMIC_FETCH_OP(sub)
+ATOMIC_FETCH_OP(and)
+ATOMIC_FETCH_OP(or)
+ATOMIC_FETCH_OP(xor)
+
+ATOMIC_OP(and)
+ATOMIC_OP(or)
+ATOMIC_OP(xor)
+
+#undef ATOMIC_FETCH_OP
+#undef ATOMIC_OP_RETURN
+#undef ATOMIC_OP
+
+#define atomic_add_return atomic_add_return
+#define atomic_sub_return atomic_sub_return
+#define atomic_fetch_add atomic_fetch_add
+#define atomic_fetch_sub atomic_fetch_sub
+#define atomic_fetch_and atomic_fetch_and
+#define atomic_fetch_or atomic_fetch_or
+#define atomic_fetch_xor atomic_fetch_xor
+#define atomic_and atomic_and
+#define atomic_or atomic_or
+#define atomic_xor atomic_xor
+
+/*
+ * Atomically add a to v->counter as long as v is not already u.
+ * Returns the original value at v->counter.
+ *
+ * This is often used through atomic_inc_not_zero()
+ */
+static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+{
+ int old, tmp;
+
+ __asm__ __volatile__(
+ "1: l.lwa %0, 0(%2) \n"
+ " l.sfeq %0, %4 \n"
+ " l.bf 2f \n"
+ " l.add %1, %0, %3 \n"
+ " l.swa 0(%2), %1 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ "2: \n"
+ : "=&r"(old), "=&r" (tmp)
+ : "r"(&v->counter), "r"(a), "r"(u)
+ : "cc", "memory");
+
+ return old;
+}
+#define __atomic_add_unless __atomic_add_unless
+
+#include <asm-generic/atomic.h>
+
+#endif /* __ASM_OPENRISC_ATOMIC_H */
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 9ed8b98..3f38eb0 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -223,6 +223,7 @@ static inline void atomic_dec(atomic_t *v)
#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
+#ifndef __atomic_add_unless
static inline int __atomic_add_unless(atomic_t *v, int a, int u)
{
int c, old;
@@ -231,5 +232,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
c = old;
return c;
}
+#endif
#endif /* __ASM_GENERIC_ATOMIC_H */
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 04/24] openrisc: head: use THREAD_SIZE instead of magic constant |
| Message-ID | <tefPI-3gU-45@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> The stack size was hard coded to 0x2000, use the standard THREAD_SIZE definition loaded from thread_info.h. Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> [shorne@gmail.com: Added body to the commit message] Signed-off-by: Stafford Horne <shorne@gmail.com> --- arch/openrisc/kernel/head.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S index 2346c5b..63ba2d9 100644 --- a/arch/openrisc/kernel/head.S +++ b/arch/openrisc/kernel/head.S @@ -24,6 +24,7 @@ #include <asm/page.h> #include <asm/mmu.h> #include <asm/pgtable.h> +#include <asm/thread_info.h> #include <asm/cache.h> #include <asm/spr_defs.h> #include <asm/asm-offsets.h> @@ -486,7 +487,8 @@ _start: /* * set up initial ksp and current */ - LOAD_SYMBOL_2_GPR(r1,init_thread_union+0x2000) // setup kernel stack + /* setup kernel stack */ + LOAD_SYMBOL_2_GPR(r1,init_thread_union + THREAD_SIZE) LOAD_SYMBOL_2_GPR(r10,init_thread_union) // setup current tophys (r31,r10) l.sw TI_KSP(r31), r1 -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 07/24] openrisc: add atomic bitops |
| Message-ID | <tefPI-3gU-47@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
This utilize the load-link/store-conditional l.lwa and l.swa
instructions to implement the atomic bitops.
When those instructions are not available emulation is provided.
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
[shorne@gmail.com: remove OPENRISC_HAVE_INST_LWA_SWA config suggesed by
Alan Cox https://lkml.org/lkml/2014/7/23/666, implement
test_and_change_bit]
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
arch/openrisc/include/asm/bitops.h | 2 +-
arch/openrisc/include/asm/bitops/atomic.h | 123 ++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+), 1 deletion(-)
create mode 100644 arch/openrisc/include/asm/bitops/atomic.h
diff --git a/arch/openrisc/include/asm/bitops.h b/arch/openrisc/include/asm/bitops.h
index 3003cda..689f568 100644
--- a/arch/openrisc/include/asm/bitops.h
+++ b/arch/openrisc/include/asm/bitops.h
@@ -45,7 +45,7 @@
#include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h>
-#include <asm-generic/bitops/atomic.h>
+#include <asm/bitops/atomic.h>
#include <asm-generic/bitops/non-atomic.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-atomic.h>
diff --git a/arch/openrisc/include/asm/bitops/atomic.h b/arch/openrisc/include/asm/bitops/atomic.h
new file mode 100644
index 0000000..35fb85f
--- /dev/null
+++ b/arch/openrisc/include/asm/bitops/atomic.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2014 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __ASM_OPENRISC_BITOPS_ATOMIC_H
+#define __ASM_OPENRISC_BITOPS_ATOMIC_H
+
+static inline void set_bit(int nr, volatile unsigned long *addr)
+{
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
+ unsigned long tmp;
+
+ __asm__ __volatile__(
+ "1: l.lwa %0,0(%1) \n"
+ " l.or %0,%0,%2 \n"
+ " l.swa 0(%1),%0 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ : "=&r"(tmp)
+ : "r"(p), "r"(mask)
+ : "cc", "memory");
+}
+
+static inline void clear_bit(int nr, volatile unsigned long *addr)
+{
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
+ unsigned long tmp;
+
+ __asm__ __volatile__(
+ "1: l.lwa %0,0(%1) \n"
+ " l.and %0,%0,%2 \n"
+ " l.swa 0(%1),%0 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ : "=&r"(tmp)
+ : "r"(p), "r"(~mask)
+ : "cc", "memory");
+}
+
+static inline void change_bit(int nr, volatile unsigned long *addr)
+{
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
+ unsigned long tmp;
+
+ __asm__ __volatile__(
+ "1: l.lwa %0,0(%1) \n"
+ " l.xor %0,%0,%2 \n"
+ " l.swa 0(%1),%0 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ : "=&r"(tmp)
+ : "r"(p), "r"(mask)
+ : "cc", "memory");
+}
+
+static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
+{
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
+ unsigned long old;
+ unsigned long tmp;
+
+ __asm__ __volatile__(
+ "1: l.lwa %0,0(%2) \n"
+ " l.or %1,%0,%3 \n"
+ " l.swa 0(%2),%1 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ : "=&r"(old), "=&r"(tmp)
+ : "r"(p), "r"(mask)
+ : "cc", "memory");
+
+ return (old & mask) != 0;
+}
+
+static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
+{
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
+ unsigned long old;
+ unsigned long tmp;
+
+ __asm__ __volatile__(
+ "1: l.lwa %0,0(%2) \n"
+ " l.and %1,%0,%3 \n"
+ " l.swa 0(%2),%1 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ : "=&r"(old), "=&r"(tmp)
+ : "r"(p), "r"(~mask)
+ : "cc", "memory");
+
+ return (old & mask) != 0;
+}
+
+static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
+{
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
+ unsigned long old;
+ unsigned long tmp;
+
+ __asm__ __volatile__(
+ "1: l.lwa %0,0(%2) \n"
+ " l.xor %1,%0,%3 \n"
+ " l.swa 0(%2),%1 \n"
+ " l.bnf 1b \n"
+ " l.nop \n"
+ : "=&r"(old), "=&r"(tmp)
+ : "r"(p), "r"(mask)
+ : "cc", "memory");
+
+ return (old & mask) != 0;
+}
+
+#endif /* __ASM_OPENRISC_BITOPS_ATOMIC_H */
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-02-24 12:00 +0100 |
| Subject | Re: [PATCH v4 07/24] openrisc: add atomic bitops |
| Message-ID | <telLr-7oY-13@gated-at.bofh.it> |
| In reply to | #1587286 |
These 4 patches (7,8,9,10) look good to me. Thanks! Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 20:30 +0100 |
| Subject | Re: [PATCH v4 07/24] openrisc: add atomic bitops |
| Message-ID | <tetJ0-4Gt-21@gated-at.bofh.it> |
| In reply to | #1587516 |
On Fri, Feb 24, 2017 at 11:56:48AM +0100, Peter Zijlstra wrote: > > > These 4 patches (7,8,9,10) look good to me. > > Thanks! > > Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Thanks Peter
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 11/24] openrisc: remove unnecessary stddef.h include |
| Message-ID | <tefPI-3gU-49@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> This causes the build to fail when building with the or1k-musl-linux- toolchain and it is not needed. Signed-off-by: Stafford Horne <shorne@gmail.com> --- arch/openrisc/kernel/ptrace.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c index 4f59fa4..2282888 100644 --- a/arch/openrisc/kernel/ptrace.c +++ b/arch/openrisc/kernel/ptrace.c @@ -16,7 +16,6 @@ * 2 of the License, or (at your option) any later version. */ -#include <stddef.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Date | 2017-02-24 05:40 +0100 |
| Subject | [PATCH v4 01/24] openrisc: use SPARSE_IRQ |
| Message-ID | <tefPI-3gU-39@gated-at.bofh.it> |
| In reply to | #1587277 |
From: Jonas Bonn <jonas@southpole.se>
The sparse IRQ framework is preferred nowadays so switch over to it.
Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
arch/openrisc/Kconfig | 1 +
arch/openrisc/include/asm/Kbuild | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 8d22015..1e95920 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -12,6 +12,7 @@ config OPENRISC
select HAVE_MEMBLOCK
select GPIOLIB
select HAVE_ARCH_TRACEHOOK
+ select SPARSE_IRQ
select GENERIC_IRQ_CHIP
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 2832f03..6dd177d 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -29,6 +29,7 @@ generic-y += hw_irq.h
generic-y += ioctl.h
generic-y += ioctls.h
generic-y += ipcbuf.h
+generic-y += irq.h
generic-y += irq_regs.h
generic-y += irq_work.h
generic-y += kdebug.h
--
2.9.3
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web