From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH6a4-0002ZV-91 for qemu-devel@nongnu.org; Tue, 12 Aug 2014 03:33:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XH6Zw-0002Gr-Dt for qemu-devel@nongnu.org; Tue, 12 Aug 2014 03:33:16 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:33208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH6Zw-0002Gd-8j for qemu-devel@nongnu.org; Tue, 12 Aug 2014 03:33:08 -0400 Received: by mail-pd0-f171.google.com with SMTP id z10so12213826pdj.30 for ; Tue, 12 Aug 2014 00:33:07 -0700 (PDT) Message-ID: <53E9C329.90800@ozlabs.ru> Date: Tue, 12 Aug 2014 17:32:57 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1406799254-25223-1-git-send-email-aik@ozlabs.ru> <1406799254-25223-3-git-send-email-aik@ozlabs.ru> <20140812011724.GA7628@voom.redhat.com> In-Reply-To: <20140812011724.GA7628@voom.redhat.com> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 02/10] spapr_iommu: Disable in-kernel IOMMU tables for >4GB windows List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: Alex Williamson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf On 08/12/2014 11:17 AM, David Gibson wrote: > On Thu, Jul 31, 2014 at 07:34:06PM +1000, Alexey Kardashevskiy wrote: >> The existing KVM_CREATE_SPAPR_TCE ioctl only support 4G windows max. >> We are going to add huge DMA windows support so this will create small >> window and unexpectedly fail later. > > I'm not entirely clear on what you're saying here. Are you saying > that the kernel interface silently truncates a window > 4G, rather > than failing? > > If so, that's a kernel bug which should be addressed - obviously we'd > still need this as a workaround for older kernels, but it should be > treated as a workaround, not as the real fix. This is an RFC patchset and I have a KVM_CREATE_SPAPR_TCE_64 patch for kernel but since we are still thinking whether to allocate these tables in the userspace or not, I have not posted it. >> 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 >> --- >> 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..36f5d27 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 = 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); >> } > -- Alexey