Skip to contentSkip to conversation

KVM: PPC: Use correct page shift in H_STUFF_TCE

PATCH Superseded Alexey Kardashevskiy 2 participants 2 messages May 14, 2018 – May 15, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 KVM: PPC: Use correct page shift in H_STUFF_TCE

The other TCE handlers use page shift from the guest visible TCE table (described by kvmppc_spapr_tce_iommu_table) so let's make H_STUFF_TCE handlers do the same thing.

This should cause no behavioral change now but soon we will allow the iommu_table::it_page_shift being different from from the emulated table page size so this will play a role.

---
 arch/powerpc/kvm/book3s_64_vio.c    | 2 +-
 arch/powerpc/kvm/book3s_64_vio_hv.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_64_vio.c +1 -1
index 4dffa61..041e54d 100644
@@ -615,7 +615,7 @@ long kvmppc_h_stuff_tce(struct kvm_vcpu *vcpu,
 		return H_PARAMETER;
 
 	list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
-		unsigned long entry = ioba >> stit->tbl->it_page_shift;
+		unsigned long entry = ioba >> stt->page_shift;
 
 		for (i = 0; i < npages; ++i) {
 			ret = kvmppc_tce_iommu_unmap(vcpu->kvm,
arch/powerpc/kvm/book3s_64_vio_hv.c +1 -1
index 6651f73..e220fab 100644
@@ -526,7 +526,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu,
 		return H_PARAMETER;
 
 	list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
-		unsigned long entry = ioba >> stit->tbl->it_page_shift;
+		unsigned long entry = ioba >> stt->page_shift;
 
 		for (i = 0; i < npages; ++i) {
 			ret = kvmppc_rm_tce_iommu_unmap(vcpu->kvm,
Signature · 1 line
2.11.0
Acked-by on v2 1/3
#1 lore raw
Quoted 33 lines · Alexey Kardashevskiy

The other TCE handlers use page shift from the guest visible TCE table (described by kvmppc_spapr_tce_iommu_table) so let's make H_STUFF_TCE handlers do the same thing.

This should cause no behavioral change now but soon we will allow the iommu_table::it_page_shift being different from from the emulated table page size so this will play a role.

---
 arch/powerpc/kvm/book3s_64_vio.c    | 2 +-
 arch/powerpc/kvm/book3s_64_vio_hv.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_64_vio.c +1 -1
index 4dffa61..041e54d 100644
@@ -615,7 +615,7 @@ long kvmppc_h_stuff_tce(struct kvm_vcpu *vcpu,
                return H_PARAMETER;
 
        list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
-               unsigned long entry = ioba >> stit->tbl->it_page_shift;
+               unsigned long entry = ioba >> stt->page_shift;
 
                for (i = 0; i < npages; ++i) {
                        ret = kvmppc_tce_iommu_unmap(vcpu->kvm,
arch/powerpc/kvm/book3s_64_vio_hv.c +0 -0
index 6651f73..e220fab 100644

arch/powerpc/kvm/book3s_64_vio_hv.c long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, · line 532

Quoted 8 lines
arch/powerpc/kvm/book3s_64_vio_hv.c +1 -1
@@ -526,7 +526,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu,
                return H_PARAMETER;
 
        list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
-               unsigned long entry = ioba >> stit->tbl->it_page_shift;
+               unsigned long entry = ioba >> stt->page_shift;
 
                for (i = 0; i < npages; ++i) {
                        ret = kvmppc_rm_tce_iommu_unmap(vcpu->kvm,

Balbir