|
|
@@ -911,9 +911,11 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
|
|
|
struct pt_regs *regs)
|
|
|
{
|
|
|
struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
|
|
|
- unsigned int pd0[mmu->ways];
|
|
|
unsigned long flags;
|
|
|
- int set;
|
|
|
+ int set, n_ways = mmu->ways;
|
|
|
+
|
|
|
+ n_ways = min(n_ways, 4);
|
|
|
+ BUG_ON(mmu->ways > 4);
|
|
|
|
|
|
local_irq_save(flags);
|
|
|
|
|
|
@@ -921,9 +923,10 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
|
|
|
for (set = 0; set < mmu->sets; set++) {
|
|
|
|
|
|
int is_valid, way;
|
|
|
+ unsigned int pd0[4];
|
|
|
|
|
|
/* read out all the ways of current set */
|
|
|
- for (way = 0, is_valid = 0; way < mmu->ways; way++) {
|
|
|
+ for (way = 0, is_valid = 0; way < n_ways; way++) {
|
|
|
write_aux_reg(ARC_REG_TLBINDEX,
|
|
|
SET_WAY_TO_IDX(mmu, set, way));
|
|
|
write_aux_reg(ARC_REG_TLBCOMMAND, TLBRead);
|
|
|
@@ -937,14 +940,14 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
|
|
|
continue;
|
|
|
|
|
|
/* Scan the set for duplicate ways: needs a nested loop */
|
|
|
- for (way = 0; way < mmu->ways - 1; way++) {
|
|
|
+ for (way = 0; way < n_ways - 1; way++) {
|
|
|
|
|
|
int n;
|
|
|
|
|
|
if (!pd0[way])
|
|
|
continue;
|
|
|
|
|
|
- for (n = way + 1; n < mmu->ways; n++) {
|
|
|
+ for (n = way + 1; n < n_ways; n++) {
|
|
|
if (pd0[way] != pd0[n])
|
|
|
continue;
|
|
|
|