]> git.proxmox.com Git - mirror_qemu.git/commitdiff
spapr_iommu: Disable in-kernel IOMMU tables for >4GB windows
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Thu, 7 May 2015 05:33:28 +0000 (15:33 +1000)
committerAlexander Graf <agraf@suse.de>
Wed, 3 Jun 2015 21:56:50 +0000 (23:56 +0200)
The existing KVM_CREATE_SPAPR_TCE ioctl only support 4G windows max as
the window size parameter to the kernel ioctl() is 32-bit so
there's no way of expressing a TCE window > 4GB.

We are going to add huge DMA windows support so this will create small
window and unexpectedly fail later.

This disables KVM_CREATE_SPAPR_TCE for windows bigger that 4GB.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/ppc/spapr_iommu.c

index f3990fdc325385553f7660b516afced001c3554c..e19bf89929389892b9611a2d219cb3d5e5ac651e 100644 (file)
@@ -126,11 +126,11 @@ static MemoryRegionIOMMUOps spapr_iommu_ops = {
 static int spapr_tce_table_realize(DeviceState *dev)
 {
     sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);
+    uint64_t window_size = (uint64_t)tcet->nb_table << tcet->page_shift;
 
-    if (kvm_enabled()) {
+    if (kvm_enabled() && !(window_size >> 32)) {
         tcet->table = kvmppc_create_spapr_tce(tcet->liobn,
-                                              tcet->nb_table <<
-                                              tcet->page_shift,
+                                              window_size,
                                               &tcet->fd,
                                               tcet->vfio_accel);
     }