From: Hollis Blanchard Date: Mon, 15 Dec 2008 23:03:08 +0000 Subject: Re: [PATCH 05/11] E500 core-specific code Message-Id: <1229382188.4313.14.camel@localhost.localdomain> List-Id: References: <1228986705-9213-6-git-send-email-yu.liu@freescale.com> In-Reply-To: <1228986705-9213-6-git-send-email-yu.liu@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc@vger.kernel.org (By the way, I know you split these patches because they're different files, but since patch 5 can't possibly work (or even build) without patches 6 and 7, they should be joined together.) On Thu, 2008-12-11 at 17:11 +0800, Liu Yu wrote: > +int kvmppc_core_vcpu_translate(struct kvm_vcpu *vcpu, > + struct kvm_translation *tr) > +{ > + int index; > + gva_t eaddr; > + u8 pid; > + u8 as; > + > + eaddr = tr->linear_address; > + pid = (tr->linear_address >> 32) & 0xff; > + as = (tr->linear_address >> 40) & 0x1; > + > + index = kvmppc_e500_tlb_search(vcpu, eaddr, as); Why are you discarding pid here? Which brings up the next point, from a later patch: > +int kvmppc_e500_tlb_search(struct kvm_vcpu *vcpu, > + gva_t eaddr, int as) > +{ > + struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); > + int esel, tlbsel; > + > + for (tlbsel = 0; tlbsel < 2; tlbsel++) { > + esel = e500_tlb_index(vcpu_e500, eaddr, tlbsel, > + get_cur_pid(vcpu), as); > + if (esel >= 0) > + return index_of(tlbsel, esel); > + } > + > + return -1; > +} You can't possibly search a TLB without knowing the EA, AS, *and* PID. accordingly, PID should be a parameter to this function. Now, if you told me you wanted to support e500's multiple PID registers, I could understand that's something of an interface issue. But you're not, so... By the way, do you happen to know if any major operating systems use PID1 or PID2? -- Hollis Blanchard IBM Linux Technology Center