Skip to content

Commit 3762d45

Browse files
aikpaulusmack
authored andcommitted
KVM: PPC: Align the table size to system page size
At the moment the userspace can request a table smaller than a page size and this value will be stored as kvmppc_spapr_tce_table::size. However the actual allocated size will still be aligned to the system page size as alloc_page() is used there. This aligns the table size up to the system page size. It should not change the existing behaviour but when in-kernel TCE acceleration patchset reaches the upstream kernel, this will allow small TCE tables be accelerated as well: PCI IODA iommu_table allocator already aligns the size and, without this patch, an IOMMU group won't attach to LIOBN due to the mismatching table size. Reviewed-by: David Gibson <[email protected]> Signed-off-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 96df226 commit 3762d45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/powerpc/kvm/book3s_64_vio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
164164
return -EBUSY;
165165
}
166166

167-
size = args->size;
167+
size = _ALIGN_UP(args->size, PAGE_SIZE >> 3);
168168
npages = kvmppc_tce_pages(size);
169169
ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true);
170170
if (ret) {

0 commit comments

Comments
 (0)