From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNJAn-0002rV-Ms for qemu-devel@nongnu.org; Fri, 29 Aug 2014 06:13:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNJAc-0001iX-Py for qemu-devel@nongnu.org; Fri, 29 Aug 2014 06:12:49 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:45769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNJAc-0001gk-4S for qemu-devel@nongnu.org; Fri, 29 Aug 2014 06:12:38 -0400 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Aug 2014 20:12:34 +1000 From: Alexey Kardashevskiy Date: Fri, 29 Aug 2014 20:12:07 +1000 Message-Id: <1409307142-2600-4-git-send-email-aik@ozlabs.ru> In-Reply-To: <1409307142-2600-1-git-send-email-aik@ozlabs.ru> References: <1409307142-2600-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [RFC PATCH v3 03/18] spapr_iommu: Disable in-kernel IOMMU tables for >4GB windows List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Alex Williamson , qemu-ppc@nongnu.org, Alexander Graf , David Gibson 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. Since those windows are normally mapped at the boot time, there will be no performance impact. Signed-off-by: Alexey Kardashevskiy --- Changes: v3: * fixed commit log * added cast to uint64_t --- hw/ppc/spapr_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index f6e32a4..7f9a862 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -113,11 +113,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); } -- 2.0.0