On Fri, 2008-09-12 at 11:10 +0800, Liu Yu-B13201 wrote:
> 
> > @@ -76,9 +76,9 @@ struct kvm_arch {
> >  
> >  struct kvm_vcpu_arch {
> >       /* Unmodified copy of the guest's TLB. */
> > -     struct tlbe guest_tlb[PPC44x_TLB_SIZE];
> > +     struct kvmppc_44x_tlbe guest_tlb[PPC44x_TLB_SIZE];
> >       /* TLB that's actually used when the guest is running. */
> > -     struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
> > +     struct kvmppc_44x_tlbe shadow_tlb[PPC44x_TLB_SIZE];
> >       /* Pages which are referenced in the shadow TLB. */
> >       struct page *shadow_pages[PPC44x_TLB_SIZE];
> >  
> 
> I have been thinking about merge kvm_vcpu_arch of 44x and e500.
> But I'm not sure whether it's worth doing this.

We could do implement a scheme like to_vmx() in arch/x86/kvm/vmx.c . See
the thread around
http://article.gmane.org/gmane.comp.emulators.kvm.devel/8516/ for more
discussion.

This approach will get a little weird in emulate.c, since right now we
kvmppc_emulate_instruction() emulates all instructions for all cores. We
may need to split that up, for example:

emulate.c:
        switch (opcode) {
        case MFSPR:
                switch (sprn) {
                case SRR0: vcpu->arch.gpr[rt] = vcpu->arch.srr0;
                ...
                default:
                        r = kvmppc_emulate_mfspr(vcpu, sprn, rt); // core hook
                        if (r)
                                return EMULATE_FAIL;
                }
        }

e500_emulate.c:
        int kvmppc_emulate_mfspr(struct kvm_vcpu *vcpu, u32 sprn, unsigned gpr)
        {
                struct vcpu_e500 *vcpu_e500 = to_vcpu_e500(vcpu);
                int r = 0;
                
                switch (sprn) {
                case MAS0: vcpu->arch.gpr[rt] = vcpu_e500->mas0;
                ...
                default:
                        r = -1;
                }
                
                return r;
        }


I will be traveling and won't have time to look at this next week, so if
this approach makes sense to you, do you want to send a patch?

-- 
Hollis Blanchard
IBM Linux Technology Center

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to