Most 8xx registers have specific names, so just include
reg_8xx.h all the time in reg.h in order to have them defined
even when CONFIG_PPC_8xx is not selected. This will avoid
the need for #ifdefs in C code.
Guard SPRN_ICTRL in an #ifdef CONFIG_PPC_8xx as this register
has same name but different meaning and different spr number as
another register in the mpc7450.
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/include/asm/reg.h | 2 --
arch/powerpc/include/asm/reg_8xx.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
@@ -38,7 +38,9 @@#define SPRN_CMPF 153#define SPRN_LCTRL1 156#define SPRN_LCTRL2 157+#ifdef CONFIG_PPC_8xx#define SPRN_ICTRL 158+#endif#define SPRN_BAR 159/* Commands. Only the first few are available to the instruction cache.
SET_MSR_EE() is just use in this file and doesn't provide
any added value compared to mtmsr(). Drop it.
Add macros to use wrtee/wrteei insn.
Replace #ifdefs by IS_ENABLED()
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/include/asm/hw_irq.h | 57 ++++++++++++++++++---------------------
arch/powerpc/include/asm/reg.h | 2 ++
2 files changed, 28 insertions(+), 31 deletions(-)
From: Nicholas Piggin <npiggin@gmail.com> Date: 2019-08-27 12:49:10
Christophe Leroy's on August 27, 2019 6:13 pm:
quoted hunk
SET_MSR_EE() is just use in this file and doesn't provide
any added value compared to mtmsr(). Drop it.
Add macros to use wrtee/wrteei insn.
Replace #ifdefs by IS_ENABLED()
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/include/asm/hw_irq.h | 57 ++++++++++++++++++---------------------
arch/powerpc/include/asm/reg.h | 2 ++
2 files changed, 28 insertions(+), 31 deletions(-)
Can you implement just one macro that uses __builtin_constant_p to
select between the imm and reg versions? I forgot if there's some
corner cases that prevent that working with inline asm i constraints.
Otherwise, looks like a nice cleanup.
Thanks,
Nick
Can you implement just one macro that uses __builtin_constant_p to
select between the imm and reg versions? I forgot if there's some
corner cases that prevent that working with inline asm i constraints.
static inline void wrtee(long val)
{
asm volatile("wrtee%I0 %0" : : "n"(val) : "memory");
}
(This output modifier goes back to the dark ages, some 2.4 or something).
Segher
Can you implement just one macro that uses __builtin_constant_p to
select between the imm and reg versions? I forgot if there's some
corner cases that prevent that working with inline asm i constraints.
Can you implement just one macro that uses __builtin_constant_p to
select between the imm and reg versions? I forgot if there's some
corner cases that prevent that working with inline asm i constraints.
Great, didn't know that possibility.
Can it be used with any insn, for instance with add/addi ?
Or with mr/li ?
Any instruction, yes. %I<n> simply outputs an "i" if operand n is a
constant integer, and nothing otherwise.
So
asm("add%I2 %0,%1,%2" : "=r"(dst) : "r"(src1), "ri"(src1));
works well. I don't see how you would use it for li/mr... You can do
asm("add%I1 %0,0,%1" : "=r"(dst) : "ri"(src));
I suppose, but that is not really an mr.
quoted
(This output modifier goes back to the dark ages, some 2.4 or something).
Hope Clang support it ...
I don't know, sorry. But it is used all over the place, see sfp-machine.h
for example, so maybe?
Segher
Can you implement just one macro that uses __builtin_constant_p to
select between the imm and reg versions? I forgot if there's some
corner cases that prevent that working with inline asm i constraints.
Great, didn't know that possibility.
Can it be used with any insn, for instance with add/addi ?
Or with mr/li ?
Any instruction, yes. %I<n> simply outputs an "i" if operand n is a
constant integer, and nothing otherwise.
Thinking about it once more, I'm not sure this form is possible, because
wrteei expect 0 or 1. If someone calls wrtee(MSR_EE); (or any constant
containing MSR_EE) wrteei 1 is expected. And any constant with MSR_EE
cleared should result in wrteei 0.
So
asm("add%I2 %0,%1,%2" : "=r"(dst) : "r"(src1), "ri"(src1));
"ri", not "n" as for wrtee ?
Christophe
works well. I don't see how you would use it for li/mr... You can do
asm("add%I1 %0,0,%1" : "=r"(dst) : "ri"(src));
I suppose, but that is not really an mr.
quoted
quoted
(This output modifier goes back to the dark ages, some 2.4 or something).
Hope Clang support it ...
I don't know, sorry. But it is used all over the place, see sfp-machine.h
for example, so maybe?
Segher
On Tue, Aug 27, 2019 at 08:33:45PM +0200, Christophe Leroy wrote:
quoted
So
asm("add%I2 %0,%1,%2" : "=r"(dst) : "r"(src1), "ri"(src1));
"ri", not "n" as for wrtee ?
"n" means a number. "i" means any constant integer. The difference is
mostly that "n" does not allow relocations. This probably does not matter
for this asm, not if you call it with correct values anyway.
(If you want to pass other than small numbers here, you need different
constraints; let's not go there).
Segher