Commit 740f834e authored by Alexander Graf's avatar Alexander Graf

KVM: PPC: Book3S: PR: Fix C/R bit setting

Commit 9308ab8e made C/R HTAB updates go byte-wise into the target HTAB.
However, it didn't update the guest's copy of the HTAB, but instead the
host local copy of it.

Write to the guest's HTAB instead.
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
CC: Paul Mackerras <paulus@samba.org>
Acked-by: default avatarPaul Mackerras <paulus@samba.org>
parent 7562c4fd
...@@ -270,7 +270,7 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr, ...@@ -270,7 +270,7 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
page */ page */
if (found) { if (found) {
u32 pte_r = pteg[i+1]; u32 pte_r = pteg[i+1];
char __user *addr = (char __user *) &pteg[i+1]; char __user *addr = (char __user *) (ptegp + (i+1) * sizeof(u32));
/* /*
* Use single-byte writes to update the HPTE, to * Use single-byte writes to update the HPTE, to
......
...@@ -342,14 +342,14 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, ...@@ -342,14 +342,14 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
* non-PAPR platforms such as mac99, and this is * non-PAPR platforms such as mac99, and this is
* what real hardware does. * what real hardware does.
*/ */
char __user *addr = (char __user *) &pteg[i+1]; char __user *addr = (char __user *) (ptegp + (i + 1) * sizeof(u64));
r |= HPTE_R_R; r |= HPTE_R_R;
put_user(r >> 8, addr + 6); put_user(r >> 8, addr + 6);
} }
if (iswrite && gpte->may_write && !(r & HPTE_R_C)) { if (iswrite && gpte->may_write && !(r & HPTE_R_C)) {
/* Set the dirty flag */ /* Set the dirty flag */
/* Use a single byte write */ /* Use a single byte write */
char __user *addr = (char __user *) &pteg[i+1]; char __user *addr = (char __user *) (ptegp + (i + 1) * sizeof(u64));
r |= HPTE_R_C; r |= HPTE_R_C;
put_user(r, addr + 7); put_user(r, addr + 7);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment