mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 23:00:53 +07:00
KVM: PPC: e500: Don't search over the entire TLB0.
Only look in the 4 entries that could possibly contain the entry we're looking for. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
dd9ebf1f94
commit
1aee47a027
@ -418,11 +418,21 @@ static void kvmppc_e500_stlbe_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500,
|
||||
static int kvmppc_e500_tlb_index(struct kvmppc_vcpu_e500 *vcpu_e500,
|
||||
gva_t eaddr, int tlbsel, unsigned int pid, int as)
|
||||
{
|
||||
int size = vcpu_e500->gtlb_size[tlbsel];
|
||||
int set_base;
|
||||
int i;
|
||||
|
||||
/* XXX Replace loop with fancy data structures. */
|
||||
for (i = 0; i < vcpu_e500->gtlb_size[tlbsel]; i++) {
|
||||
struct tlbe *tlbe = &vcpu_e500->gtlb_arch[tlbsel][i];
|
||||
if (tlbsel == 0) {
|
||||
int mask = size / KVM_E500_TLB0_WAY_NUM - 1;
|
||||
set_base = (eaddr >> PAGE_SHIFT) & mask;
|
||||
set_base *= KVM_E500_TLB0_WAY_NUM;
|
||||
size = KVM_E500_TLB0_WAY_NUM;
|
||||
} else {
|
||||
set_base = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
struct tlbe *tlbe = &vcpu_e500->gtlb_arch[tlbsel][set_base + i];
|
||||
unsigned int tid;
|
||||
|
||||
if (eaddr < get_tlb_eaddr(tlbe))
|
||||
@ -441,7 +451,7 @@ static int kvmppc_e500_tlb_index(struct kvmppc_vcpu_e500 *vcpu_e500,
|
||||
if (get_tlb_ts(tlbe) != as && as != -1)
|
||||
continue;
|
||||
|
||||
return i;
|
||||
return set_base + i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user