[PATCH -V8 04/11] arch/powerpc: Convert virtual address to vpn
Aneesh Kumar K.V
aneesh.kumar at linux.vnet.ibm.com
Tue Oct 16 03:28:30 EST 2012
"Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com> writes:
> Andreas Schwab <schwab at linux-m68k.org> writes:
>
>> "Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com> writes:
>>
>>> diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
>>> index 837f13e..00aa612 100644
>>> --- a/arch/powerpc/kvm/book3s_32_mmu_host.c
>>> +++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
>>> @@ -141,7 +141,7 @@ extern char etext[];
>>> int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
>>> {
>>> pfn_t hpaddr;
>>> - u64 va;
>>> + u64 vpn;
>>> u64 vsid;
>>> struct kvmppc_sid_map *map;
>>> volatile u32 *pteg;
>>> @@ -173,7 +173,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
>>> BUG_ON(!map);
>>>
>>> vsid = map->host_vsid;
>>> - va = (vsid << SID_SHIFT) | (eaddr & ~ESID_MASK);
>>> + vpn = (vsid << (SID_SHIFT - VPN_SHIFT)) | ((eaddr & ~ESID_MASK) >> VPN_SHIFT)
>>
>> Where is VPN_SHIFT? Where is the semicolon?
>
> I had done a kvm build test with the changes, but missed the fact that
> this is !SMP and PPC_BOOK3S_32. Will send a follow up patch.
How about the below ? Any help on how to get this tested ?
diff --git a/arch/powerpc/include/asm/kvm_book3s_32.h b/arch/powerpc/include/asm/kvm_book3s_32.h
index 38040ff..ce0ef6c 100644
--- a/arch/powerpc/include/asm/kvm_book3s_32.h
+++ b/arch/powerpc/include/asm/kvm_book3s_32.h
@@ -42,5 +42,6 @@ static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
#define SID_SHIFT 28
#define ESID_MASK 0xf0000000
#define VSID_MASK 0x00fffffff0000000ULL
+#define VPN_SHIFT 12
#endif /* __ASM_KVM_BOOK3S_32_H__ */
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 00aa612..b0f625a 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -173,8 +173,8 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
BUG_ON(!map);
vsid = map->host_vsid;
- vpn = (vsid << (SID_SHIFT - VPN_SHIFT)) | ((eaddr & ~ESID_MASK) >> VPN_SHIFT)
-
+ vpn = (vsid << (SID_SHIFT - VPN_SHIFT)) |
+ ((eaddr & ~ESID_MASK) >> VPN_SHIFT);
next_pteg:
if (rr == 16) {
primary = !primary;
More information about the Linuxppc-dev
mailing list