2007-10-16 07:41:44 +08:00
|
|
|
/* bitops.S: Sparc64 atomic bit operations.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2007-10-16 07:41:44 +08:00
|
|
|
* Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net)
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
2012-05-12 11:33:22 +08:00
|
|
|
#include <linux/linkage.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/asi.h>
|
2007-10-16 07:41:44 +08:00
|
|
|
#include <asm/backoff.h>
|
2016-01-17 10:39:30 +08:00
|
|
|
#include <asm/export.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
.text
|
|
|
|
|
2012-05-12 11:33:22 +08:00
|
|
|
ENTRY(test_and_set_bit) /* %o0=nr, %o1=addr */
|
2007-10-16 07:41:44 +08:00
|
|
|
BACKOFF_SETUP(%o3)
|
2005-04-17 06:20:36 +08:00
|
|
|
srlx %o0, 6, %g1
|
|
|
|
mov 1, %o2
|
|
|
|
sllx %g1, 3, %g3
|
|
|
|
and %o0, 63, %g2
|
|
|
|
sllx %o2, %g2, %o2
|
|
|
|
add %o1, %g3, %o1
|
|
|
|
1: ldx [%o1], %g7
|
|
|
|
or %g7, %o2, %g1
|
|
|
|
casx [%o1], %g7, %g1
|
|
|
|
cmp %g7, %g1
|
2010-08-19 13:53:26 +08:00
|
|
|
bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
|
2005-04-17 06:20:36 +08:00
|
|
|
and %g7, %o2, %g2
|
|
|
|
clr %o0
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
movrne %g2, 1, %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
retl
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
nop
|
2007-10-16 07:41:44 +08:00
|
|
|
2: BACKOFF_SPIN(%o3, %o4, 1b)
|
2012-05-12 11:33:22 +08:00
|
|
|
ENDPROC(test_and_set_bit)
|
2016-01-17 10:39:30 +08:00
|
|
|
EXPORT_SYMBOL(test_and_set_bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-05-12 11:33:22 +08:00
|
|
|
ENTRY(test_and_clear_bit) /* %o0=nr, %o1=addr */
|
2007-10-16 07:41:44 +08:00
|
|
|
BACKOFF_SETUP(%o3)
|
2005-04-17 06:20:36 +08:00
|
|
|
srlx %o0, 6, %g1
|
|
|
|
mov 1, %o2
|
|
|
|
sllx %g1, 3, %g3
|
|
|
|
and %o0, 63, %g2
|
|
|
|
sllx %o2, %g2, %o2
|
|
|
|
add %o1, %g3, %o1
|
|
|
|
1: ldx [%o1], %g7
|
|
|
|
andn %g7, %o2, %g1
|
|
|
|
casx [%o1], %g7, %g1
|
|
|
|
cmp %g7, %g1
|
2010-08-19 13:53:26 +08:00
|
|
|
bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
|
2005-04-17 06:20:36 +08:00
|
|
|
and %g7, %o2, %g2
|
|
|
|
clr %o0
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
movrne %g2, 1, %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
retl
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
nop
|
2007-10-16 07:41:44 +08:00
|
|
|
2: BACKOFF_SPIN(%o3, %o4, 1b)
|
2012-05-12 11:33:22 +08:00
|
|
|
ENDPROC(test_and_clear_bit)
|
2016-01-17 10:39:30 +08:00
|
|
|
EXPORT_SYMBOL(test_and_clear_bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-05-12 11:33:22 +08:00
|
|
|
ENTRY(test_and_change_bit) /* %o0=nr, %o1=addr */
|
2007-10-16 07:41:44 +08:00
|
|
|
BACKOFF_SETUP(%o3)
|
2005-04-17 06:20:36 +08:00
|
|
|
srlx %o0, 6, %g1
|
|
|
|
mov 1, %o2
|
|
|
|
sllx %g1, 3, %g3
|
|
|
|
and %o0, 63, %g2
|
|
|
|
sllx %o2, %g2, %o2
|
|
|
|
add %o1, %g3, %o1
|
|
|
|
1: ldx [%o1], %g7
|
|
|
|
xor %g7, %o2, %g1
|
|
|
|
casx [%o1], %g7, %g1
|
|
|
|
cmp %g7, %g1
|
2010-08-19 13:53:26 +08:00
|
|
|
bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
|
2005-04-17 06:20:36 +08:00
|
|
|
and %g7, %o2, %g2
|
|
|
|
clr %o0
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
movrne %g2, 1, %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
retl
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
nop
|
2007-10-16 07:41:44 +08:00
|
|
|
2: BACKOFF_SPIN(%o3, %o4, 1b)
|
2012-05-12 11:33:22 +08:00
|
|
|
ENDPROC(test_and_change_bit)
|
2016-01-17 10:39:30 +08:00
|
|
|
EXPORT_SYMBOL(test_and_change_bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-05-12 11:33:22 +08:00
|
|
|
ENTRY(set_bit) /* %o0=nr, %o1=addr */
|
2007-10-16 07:41:44 +08:00
|
|
|
BACKOFF_SETUP(%o3)
|
2005-04-17 06:20:36 +08:00
|
|
|
srlx %o0, 6, %g1
|
|
|
|
mov 1, %o2
|
|
|
|
sllx %g1, 3, %g3
|
|
|
|
and %o0, 63, %g2
|
|
|
|
sllx %o2, %g2, %o2
|
|
|
|
add %o1, %g3, %o1
|
|
|
|
1: ldx [%o1], %g7
|
|
|
|
or %g7, %o2, %g1
|
|
|
|
casx [%o1], %g7, %g1
|
|
|
|
cmp %g7, %g1
|
2010-08-19 13:53:26 +08:00
|
|
|
bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
|
2005-04-17 06:20:36 +08:00
|
|
|
nop
|
|
|
|
retl
|
|
|
|
nop
|
2007-10-16 07:41:44 +08:00
|
|
|
2: BACKOFF_SPIN(%o3, %o4, 1b)
|
2012-05-12 11:33:22 +08:00
|
|
|
ENDPROC(set_bit)
|
2016-01-17 10:39:30 +08:00
|
|
|
EXPORT_SYMBOL(set_bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-05-12 11:33:22 +08:00
|
|
|
ENTRY(clear_bit) /* %o0=nr, %o1=addr */
|
2007-10-16 07:41:44 +08:00
|
|
|
BACKOFF_SETUP(%o3)
|
2005-04-17 06:20:36 +08:00
|
|
|
srlx %o0, 6, %g1
|
|
|
|
mov 1, %o2
|
|
|
|
sllx %g1, 3, %g3
|
|
|
|
and %o0, 63, %g2
|
|
|
|
sllx %o2, %g2, %o2
|
|
|
|
add %o1, %g3, %o1
|
|
|
|
1: ldx [%o1], %g7
|
|
|
|
andn %g7, %o2, %g1
|
|
|
|
casx [%o1], %g7, %g1
|
|
|
|
cmp %g7, %g1
|
2010-08-19 13:53:26 +08:00
|
|
|
bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
|
2005-04-17 06:20:36 +08:00
|
|
|
nop
|
|
|
|
retl
|
|
|
|
nop
|
2007-10-16 07:41:44 +08:00
|
|
|
2: BACKOFF_SPIN(%o3, %o4, 1b)
|
2012-05-12 11:33:22 +08:00
|
|
|
ENDPROC(clear_bit)
|
2016-01-17 10:39:30 +08:00
|
|
|
EXPORT_SYMBOL(clear_bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-05-12 11:33:22 +08:00
|
|
|
ENTRY(change_bit) /* %o0=nr, %o1=addr */
|
2007-10-16 07:41:44 +08:00
|
|
|
BACKOFF_SETUP(%o3)
|
2005-04-17 06:20:36 +08:00
|
|
|
srlx %o0, 6, %g1
|
|
|
|
mov 1, %o2
|
|
|
|
sllx %g1, 3, %g3
|
|
|
|
and %o0, 63, %g2
|
|
|
|
sllx %o2, %g2, %o2
|
|
|
|
add %o1, %g3, %o1
|
|
|
|
1: ldx [%o1], %g7
|
|
|
|
xor %g7, %o2, %g1
|
|
|
|
casx [%o1], %g7, %g1
|
|
|
|
cmp %g7, %g1
|
2010-08-19 13:53:26 +08:00
|
|
|
bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
|
2005-04-17 06:20:36 +08:00
|
|
|
nop
|
|
|
|
retl
|
|
|
|
nop
|
2007-10-16 07:41:44 +08:00
|
|
|
2: BACKOFF_SPIN(%o3, %o4, 1b)
|
2012-05-12 11:33:22 +08:00
|
|
|
ENDPROC(change_bit)
|
2016-01-17 10:39:30 +08:00
|
|
|
EXPORT_SYMBOL(change_bit)
|