提交 4e509af9 编写于 作者: A Alexander Graf

KVM: PPC: Book3S_64 PR: Access HTAB in big endian

The HTAB is always big endian. We access the guest's HTAB using
copy_from/to_user, but don't yet take care of the fact that we might
be running on an LE host.

Wrap all accesses to the guest HTAB with big endian accessors.
Signed-off-by: NAlexander Graf <agraf@suse.de>
上级 860540bc
无相关合并请求
...@@ -275,12 +275,15 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, ...@@ -275,12 +275,15 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
key = 4; key = 4;
for (i=0; i<16; i+=2) { for (i=0; i<16; i+=2) {
u64 pte0 = be64_to_cpu(pteg[i]);
u64 pte1 = be64_to_cpu(pteg[i + 1]);
/* Check all relevant fields of 1st dword */ /* Check all relevant fields of 1st dword */
if ((pteg[i] & v_mask) == v_val) { if ((pte0 & v_mask) == v_val) {
/* If large page bit is set, check pgsize encoding */ /* If large page bit is set, check pgsize encoding */
if (slbe->large && if (slbe->large &&
(vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE)) { (vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE)) {
pgsize = decode_pagesize(slbe, pteg[i+1]); pgsize = decode_pagesize(slbe, pte1);
if (pgsize < 0) if (pgsize < 0)
continue; continue;
} }
...@@ -297,8 +300,8 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, ...@@ -297,8 +300,8 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
goto do_second; goto do_second;
} }
v = pteg[i]; v = be64_to_cpu(pteg[i]);
r = pteg[i+1]; r = be64_to_cpu(pteg[i+1]);
pp = (r & HPTE_R_PP) | key; pp = (r & HPTE_R_PP) | key;
if (r & HPTE_R_PP0) if (r & HPTE_R_PP0)
pp |= 8; pp |= 8;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部