aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/mca.c
diff options
context:
space:
mode:
authorXiantao Zhang <xiantao.zhang@intel.com>2008-04-03 14:02:58 -0400
committerTony Luck <tony.luck@intel.com>2008-04-03 14:02:58 -0400
commit96651896b8d9ad4244a1c3ed9691faa3e382f503 (patch)
treed1982cf832e019deb8619fd0eae9133e5b98bc99 /arch/ia64/kernel/mca.c
parent9597362d354f8655ece324b01d0c640a0e99c077 (diff)
[IA64] Add API for allocating Dynamic TR resource.
Dynamic TR resource should be managed in the uniform way. Add two interfaces for kernel: ia64_itr_entry: Allocate a (pair of) TR for caller. ia64_ptr_entry: Purge a (pair of ) TR by caller. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Anthony Xu <anthony.xu@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel/mca.c')
-rw-r--r--arch/ia64/kernel/mca.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 6c18221dba36..607006a6a976 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -97,6 +97,7 @@
97 97
98#include <asm/irq.h> 98#include <asm/irq.h>
99#include <asm/hw_irq.h> 99#include <asm/hw_irq.h>
100#include <asm/tlb.h>
100 101
101#include "mca_drv.h" 102#include "mca_drv.h"
102#include "entry.h" 103#include "entry.h"
@@ -112,6 +113,7 @@ DEFINE_PER_CPU(u64, ia64_mca_data); /* == __per_cpu_mca[smp_processor_id()] */
112DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */ 113DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */
113DEFINE_PER_CPU(u64, ia64_mca_pal_pte); /* PTE to map PAL code */ 114DEFINE_PER_CPU(u64, ia64_mca_pal_pte); /* PTE to map PAL code */
114DEFINE_PER_CPU(u64, ia64_mca_pal_base); /* vaddr PAL code granule */ 115DEFINE_PER_CPU(u64, ia64_mca_pal_base); /* vaddr PAL code granule */
116DEFINE_PER_CPU(u64, ia64_mca_tr_reload); /* Flag for TR reload */
115 117
116unsigned long __per_cpu_mca[NR_CPUS]; 118unsigned long __per_cpu_mca[NR_CPUS];
117 119
@@ -1182,6 +1184,49 @@ all_in:
1182 return; 1184 return;
1183} 1185}
1184 1186
1187/* mca_insert_tr
1188 *
1189 * Switch rid when TR reload and needed!
1190 * iord: 1: itr, 2: itr;
1191 *
1192*/
1193static void mca_insert_tr(u64 iord)
1194{
1195
1196 int i;
1197 u64 old_rr;
1198 struct ia64_tr_entry *p;
1199 unsigned long psr;
1200 int cpu = smp_processor_id();
1201
1202 psr = ia64_clear_ic();
1203 for (i = IA64_TR_ALLOC_BASE; i < IA64_TR_ALLOC_MAX; i++) {
1204 p = &__per_cpu_idtrs[cpu][iord-1][i];
1205 if (p->pte & 0x1) {
1206 old_rr = ia64_get_rr(p->ifa);
1207 if (old_rr != p->rr) {
1208 ia64_set_rr(p->ifa, p->rr);
1209 ia64_srlz_d();
1210 }
1211 ia64_ptr(iord, p->ifa, p->itir >> 2);
1212 ia64_srlz_i();
1213 if (iord & 0x1) {
1214 ia64_itr(0x1, i, p->ifa, p->pte, p->itir >> 2);
1215 ia64_srlz_i();
1216 }
1217 if (iord & 0x2) {
1218 ia64_itr(0x2, i, p->ifa, p->pte, p->itir >> 2);
1219 ia64_srlz_i();
1220 }
1221 if (old_rr != p->rr) {
1222 ia64_set_rr(p->ifa, old_rr);
1223 ia64_srlz_d();
1224 }
1225 }
1226 }
1227 ia64_set_psr(psr);
1228}
1229
1185/* 1230/*
1186 * ia64_mca_handler 1231 * ia64_mca_handler
1187 * 1232 *
@@ -1271,6 +1316,10 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1271 monarch_cpu = -1; 1316 monarch_cpu = -1;
1272#endif 1317#endif
1273 } 1318 }
1319 if (__get_cpu_var(ia64_mca_tr_reload)) {
1320 mca_insert_tr(0x1); /*Reload dynamic itrs*/
1321 mca_insert_tr(0x2); /*Reload dynamic itrs*/
1322 }
1274 if (notify_die(DIE_MCA_MONARCH_LEAVE, "MCA", regs, (long)&nd, 0, recover) 1323 if (notify_die(DIE_MCA_MONARCH_LEAVE, "MCA", regs, (long)&nd, 0, recover)
1275 == NOTIFY_STOP) 1324 == NOTIFY_STOP)
1276 ia64_mca_spin(__func__); 1325 ia64_mca_spin(__func__);