提交 98c532ec 编写于 作者: I Ivan Kokshaysky 提交者: Linus Torvalds

alpha: use single HAE window on T2 core logic (gamma, sable)

T2 are the only alpha SMP systems that do HAE switching at runtime, which
is fundamentally racy on SMP.  This patch limits MMIO space on T2 to HAE0
only, like we did on MCPCIA (rawhide) long ago.  This leaves us with only
112 Mb of PCI MMIO (128 Mb HAE aperture minus 16 Mb reserved for EISA),
but since linux PCI allocations are reasonably tight, it should be enough
for sane hardware configurations.

Also, fix a typo in MCPCIA_FROB_MMIO macro which shouldn't call set_hae()
if MCPCIA_ONE_HAE_WINDOW is defined.  It's more for correctness, as
set_hae() is a no-op anyway in that case.
Signed-off-by: NIvan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 947272dd
...@@ -247,7 +247,7 @@ struct el_MCPCIA_uncorrected_frame_mcheck { ...@@ -247,7 +247,7 @@ struct el_MCPCIA_uncorrected_frame_mcheck {
#define vip volatile int __force * #define vip volatile int __force *
#define vuip volatile unsigned int __force * #define vuip volatile unsigned int __force *
#ifdef MCPCIA_ONE_HAE_WINDOW #ifndef MCPCIA_ONE_HAE_WINDOW
#define MCPCIA_FROB_MMIO \ #define MCPCIA_FROB_MMIO \
if (__mcpcia_is_mmio(hose)) { \ if (__mcpcia_is_mmio(hose)) { \
set_hae(hose & 0xffffffff); \ set_hae(hose & 0xffffffff); \
......
#ifndef __ALPHA_T2__H__ #ifndef __ALPHA_T2__H__
#define __ALPHA_T2__H__ #define __ALPHA_T2__H__
/* Fit everything into one 128MB HAE window. */
#define T2_ONE_HAE_WINDOW 1
#include <linux/types.h> #include <linux/types.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <asm/compiler.h> #include <asm/compiler.h>
...@@ -19,7 +22,7 @@ ...@@ -19,7 +22,7 @@
* *
*/ */
#define T2_MEM_R1_MASK 0x07ffffff /* Mem sparse region 1 mask is 26 bits */ #define T2_MEM_R1_MASK 0x07ffffff /* Mem sparse region 1 mask is 27 bits */
/* GAMMA-SABLE is a SABLE with EV5-based CPUs */ /* GAMMA-SABLE is a SABLE with EV5-based CPUs */
/* All LYNX machines, EV4 or EV5, use the GAMMA bias also */ /* All LYNX machines, EV4 or EV5, use the GAMMA bias also */
...@@ -85,7 +88,9 @@ ...@@ -85,7 +88,9 @@
#define T2_DIR (IDENT_ADDR + GAMMA_BIAS + 0x38e0004a0UL) #define T2_DIR (IDENT_ADDR + GAMMA_BIAS + 0x38e0004a0UL)
#define T2_ICE (IDENT_ADDR + GAMMA_BIAS + 0x38e0004c0UL) #define T2_ICE (IDENT_ADDR + GAMMA_BIAS + 0x38e0004c0UL)
#ifndef T2_ONE_HAE_WINDOW
#define T2_HAE_ADDRESS T2_HAE_1 #define T2_HAE_ADDRESS T2_HAE_1
#endif
/* T2 CSRs are in the non-cachable primary IO space from 3.8000.0000 to /* T2 CSRs are in the non-cachable primary IO space from 3.8000.0000 to
3.8fff.ffff 3.8fff.ffff
...@@ -429,13 +434,15 @@ extern inline void t2_outl(u32 b, unsigned long addr) ...@@ -429,13 +434,15 @@ extern inline void t2_outl(u32 b, unsigned long addr)
* *
*/ */
#ifdef T2_ONE_HAE_WINDOW
#define t2_set_hae
#else
#define t2_set_hae { \ #define t2_set_hae { \
msb = addr >> 27; \ unsigned long msb = addr >> 27; \
addr &= T2_MEM_R1_MASK; \ addr &= T2_MEM_R1_MASK; \
set_hae(msb); \ set_hae(msb); \
} }
#endif
extern raw_spinlock_t t2_hae_lock;
/* /*
* NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since
...@@ -446,28 +453,22 @@ extern raw_spinlock_t t2_hae_lock; ...@@ -446,28 +453,22 @@ extern raw_spinlock_t t2_hae_lock;
__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long result, msb; unsigned long result;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00); result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00);
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
return __kernel_extbl(result, addr & 3); return __kernel_extbl(result, addr & 3);
} }
__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long result, msb; unsigned long result;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08); result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08);
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
return __kernel_extwl(result, addr & 3); return __kernel_extwl(result, addr & 3);
} }
...@@ -478,59 +479,47 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) ...@@ -478,59 +479,47 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long result, msb; unsigned long result;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18); result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18);
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
return result & 0xffffffffUL; return result & 0xffffffffUL;
} }
__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long r0, r1, work, msb; unsigned long r0, r1, work;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
work = (addr << 5) + T2_SPARSE_MEM + 0x18; work = (addr << 5) + T2_SPARSE_MEM + 0x18;
r0 = *(vuip)(work); r0 = *(vuip)(work);
r1 = *(vuip)(work + (4 << 5)); r1 = *(vuip)(work + (4 << 5));
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
return r1 << 32 | r0; return r1 << 32 | r0;
} }
__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb, w; unsigned long w;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
w = __kernel_insbl(b, addr & 3); w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w; *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w;
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
} }
__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb, w; unsigned long w;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
w = __kernel_inswl(b, addr & 3); w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w; *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w;
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
} }
/* /*
...@@ -540,29 +529,22 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) ...@@ -540,29 +529,22 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b; *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b;
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
} }
__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb, work; unsigned long work;
unsigned long flags;
raw_spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae; t2_set_hae;
work = (addr << 5) + T2_SPARSE_MEM + 0x18; work = (addr << 5) + T2_SPARSE_MEM + 0x18;
*(vuip)work = b; *(vuip)work = b;
*(vuip)(work + (4 << 5)) = b >> 32; *(vuip)(work + (4 << 5)) = b >> 32;
raw_spin_unlock_irqrestore(&t2_hae_lock, flags);
} }
__EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr) __EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr)
......
...@@ -74,8 +74,6 @@ ...@@ -74,8 +74,6 @@
# define DBG(args) # define DBG(args)
#endif #endif
DEFINE_RAW_SPINLOCK(t2_hae_lock);
static volatile unsigned int t2_mcheck_any_expected; static volatile unsigned int t2_mcheck_any_expected;
static volatile unsigned int t2_mcheck_last_taken; static volatile unsigned int t2_mcheck_last_taken;
...@@ -406,6 +404,7 @@ void __init ...@@ -406,6 +404,7 @@ void __init
t2_init_arch(void) t2_init_arch(void)
{ {
struct pci_controller *hose; struct pci_controller *hose;
struct resource *hae_mem;
unsigned long temp; unsigned long temp;
unsigned int i; unsigned int i;
...@@ -433,7 +432,13 @@ t2_init_arch(void) ...@@ -433,7 +432,13 @@ t2_init_arch(void)
*/ */
pci_isa_hose = hose = alloc_pci_controller(); pci_isa_hose = hose = alloc_pci_controller();
hose->io_space = &ioport_resource; hose->io_space = &ioport_resource;
hose->mem_space = &iomem_resource; hae_mem = alloc_resource();
hae_mem->start = 0;
hae_mem->end = T2_MEM_R1_MASK;
hae_mem->name = pci_hae0_name;
if (request_resource(&iomem_resource, hae_mem) < 0)
printk(KERN_ERR "Failed to request HAE_MEM\n");
hose->mem_space = hae_mem;
hose->index = 0; hose->index = 0;
hose->sparse_mem_base = T2_SPARSE_MEM - IDENT_ADDR; hose->sparse_mem_base = T2_SPARSE_MEM - IDENT_ADDR;
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#ifdef MCPCIA_ONE_HAE_WINDOW #ifdef MCPCIA_ONE_HAE_WINDOW
#define MCPCIA_HAE_ADDRESS (&alpha_mv.hae_cache) #define MCPCIA_HAE_ADDRESS (&alpha_mv.hae_cache)
#endif #endif
#ifdef T2_ONE_HAE_WINDOW
#define T2_HAE_ADDRESS (&alpha_mv.hae_cache)
#endif
/* Only a few systems don't define IACK_SC, handling all interrupts through /* Only a few systems don't define IACK_SC, handling all interrupts through
the SRM console. But splitting out that one case from IO() below the SRM console. But splitting out that one case from IO() below
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册