> On 25 Oct 2016, at 18:27, David Miller <davem@xxxxxxxxxxxxx> wrote: > > From: David Miller <davem@xxxxxxxxxxxxx> > Date: Tue, 25 Oct 2016 13:18:08 -0400 (EDT) > >> So the full virtual address comparison is something like: >> >> unsigned long compare = (tag >> 22) << 22; /* Clear CONTEXT bits */ >> >> compare |= (tsb_index & (nentries - 1)) << 13; >> >> if (vaddr == compare) >> goto match; >> >> The swapper TSB only stores PAGE_SIZE translations. > > Ok, this should work: > > static void flush_tsb_kernel_range_scan(unsigned long start, unsigned long end) > { > unsigned long idx; > > for (idx = 0; idx < KERNEL_TSB_NENTRIES; idx++) { > struct tsb *ent = &swapper_tsb[idx]; > unsigned long match = idx << 13; > > match |= (ent->tag << 22); > if (match >= start && match < end) > ent->tag = (1UL << TSB_TAG_INVALID_BIT); > } > } > > Bits 13-"21+N" come from the TSB index, and the tag always stores > bits 22 and above. So simply 'or'ing them together always gives > us a usable match value. Ah, right, got it. That makes it much nicer than mine. James -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html