Re: [PATCH 11/27] Add book3s_64 Host MMU handling

Alexander Graf
2009-11-02T09:26:34Z

Am 02.11.2009 um 00:39 schrieb Michael Neuling <mikey@neuling.org>:

> <snip>
>> +static void invalidate_pte(struct hpte_cache *pte)
>> +{
>> + dprintk_mmu("KVM: Flushing SPT %d: 0x%llx (0x%llx) -> 0x%llx\n",
>> + i, pte->pte.eaddr, pte->pte.vpage, pte->host_va);
>> +
>> + ppc_md.hpte_invalidate(pte->slot, pte->host_va,
>> + MMU_PAGE_4K, MMU_SEGSIZE_256M,
>> + false);
>
> Are we assuming 256M segments here (and elsewhere)?

Yes, on the host we only create 256MB segments. What the guest uses is
a different question.

>
> <snip>
>> +static int kvmppc_mmu_next_segment(struct kvm_vcpu *vcpu, ulong
>> esid)
>> +{
>> + int i;
>> + int max_slb_size = 64;
>> + int found_inval = -1;
>> + int r;
>> +
>> + if (!get_paca()->kvm_slb_max)
>> + get_paca()->kvm_slb_max = 1;
>> +
>> + /* Are we overwriting? */
>> + for (i = 1; i < get_paca()->kvm_slb_max; i++) {
>> + if (!(get_paca()->kvm_slb[i].esid & SLB_ESID_V))
>> + found_inval = i;
>> + else if ((get_paca()->kvm_slb[i].esid & ESID_MASK) == esid)
>> + return i;
>> + }
>> +
>> + /* Found a spare entry that was invalidated before */
>> + if (found_inval > 0)
>> + return found_inval;
>> +
>> + /* No spare invalid entry, so create one */
>> +
>> + if (mmu_slb_size < 64)
>> + max_slb_size = mmu_slb_size;
>
> Can we just use the global mmu_slb_size eliminate max_slb_size?

Hm, for a strange reason I wanted to have at most 64 slb entries.
Maybe the struct can't hold more? I'll check again as soon as I'm on a
notebook again.

Alex

>
> <snip>
>
> Mikey
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html