Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp972799ybl; Wed, 11 Dec 2019 10:22:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyheO6JjgFJ1/+VevQvW5TwxRvEmf4ASwJJ10j22hJZ9Aoz0V9wh5XsiCHsEbJA9Wc38wAO X-Received: by 2002:a05:6808:8cd:: with SMTP id k13mr3963551oij.4.1576088523276; Wed, 11 Dec 2019 10:22:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576088523; cv=none; d=google.com; s=arc-20160816; b=EvqJJVvw1QyGqKWnTS6uFL5cVaA40xKpOaQkAD9Zc8SoqphD+QO+u1Ii0O1S1fMt38 cMBcszWlvlbhtbIBwd4AYX6Ad3OG8eRomvietvZkIjdUYuwcMgY+ipgCbMpXIaiLd1pc MUOWL6mrbjareFb7XWPwwdmIT5ggViFQOykZhI7TrlzuoG6eSmauodCJVsFAHz83lIHW X6fb5A1XVDufWO/o0iHvGYPSWKgfV9wfPCuL+u2DGzNtOgTQ9qozKLoeN80LaXwXgFP7 cA8cDB3XTRmu08C8fsAogI/XBqjAr7sYJ6vTrjMS2DEx4TDcJru+Dq5wZnJwgjVVeB36 KE9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Dmi01Oy2RV8hGj6DnK6xB1HtcSV8b8zyTSUwu3cWvvo=; b=UUeB9/S9h+0fGCgHXhmZzUNWS8xSM8oBaJgfrz5WukG2z0M2dua3Guus53wdRJYeFC 1yVjduEMLkf60ades93z91QMME7d8P6NAeKxtzu2ww2P2SNqK5hlQ7htwR4197bja0xS bLzjGn1nZlsRCAaxC4W1Voo8+pfp1C6gz1qAG2AQ6/IApxY8gGwbhfAz0SgAZH72oJNx XOKyQc/fJL5jY/A3VAAYgNimD/pYJpGdEmcvICSkj1DOhx4nNCjGDWgS3ztLBKbCHIu1 YJzBNIp3Vr1YxfG6uuk+Lyo+pmboawP/p/ThwCxQAhjPC1iTfZUijGnWK8X5FAP5srqA addQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si1667371oij.136.2019.12.11.10.21.50; Wed, 11 Dec 2019 10:22:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731007AbfLKSVA (ORCPT + 99 others); Wed, 11 Dec 2019 13:21:00 -0500 Received: from verein.lst.de ([213.95.11.211]:56752 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729855AbfLKSVA (ORCPT ); Wed, 11 Dec 2019 13:21:00 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 4FD2668AFE; Wed, 11 Dec 2019 19:20:56 +0100 (CET) Date: Wed, 11 Dec 2019 19:20:56 +0100 From: Christoph Hellwig To: Michael Roth Cc: Alexey Kardashevskiy , Ram Pai , mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, benh@kernel.crashing.org, david@gibson.dropbear.id.au, paulus@ozlabs.org, hch@lst.de, andmike@us.ibm.com, sukadev@linux.vnet.ibm.com, mst@redhat.com, ram.n.pai@gmail.com, cai@lca.pw, tglx@linutronix.de, bauerman@linux.ibm.com, linux-kernel@vger.kernel.org, leonardo@linux.ibm.com Subject: Re: [PATCH v5 2/2] powerpc/pseries/iommu: Use dma_iommu_ops for Secure VM. Message-ID: <20191211182056.GA17052@lst.de> References: <1575681159-30356-1-git-send-email-linuxram@us.ibm.com> <1575681159-30356-2-git-send-email-linuxram@us.ibm.com> <1575681159-30356-3-git-send-email-linuxram@us.ibm.com> <157602860458.3810.8599908751067047456@sif> <157608763756.3810.12346253559039287143@sif> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <157608763756.3810.12346253559039287143@sif> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 11, 2019 at 12:07:17PM -0600, Michael Roth wrote: > > io_tlb_start/io_tlb_end are only guaranteed to stay within 4GB and our > > default DMA window is 1GB (KVM) or 2GB (PowerVM), ok, we can define > > ARCH_LOW_ADDRESS_LIMIT as 1GB. > > True, and limiting allocations to under 1GB might be brittle (also saw a > patching floating around that increased IO_TLB_DEFAULT_SIZE size to 1GB, > which obviously wouldn't work out with this approach, but not sure if > that's still needed or not: "powerpc/svm: Increase SWIOTLB buffer size") FYI, there is a patch out there that allocates the powerpc swiotlb from the boottom of the memblock area instead of the top to fix a 85xx regression. Also the AMD folks have been asking about non-GFP_DMA32 swiotlb pools as they have the same bounce buffer issue with SEV. I think it is entirely doable to have multiple swiotlb pool, I just need a volunteer to implement that. > > However that's only an issue if we insist on using an identity mapping > in the IOMMU, which would be nice because non-IOMMU virtio would > magically work, but since that's not a goal of this series I think we do > have the option of mapping io_tlb_start at DMA address 0 (or > thereabouts). > > We'd probably need to modify __phys_to_dma to treat archdata.dma_offset > as a negative offset in this case, but it seems like it would work about > the same as with DDW offset. Or switch to the generic version of __phys_to_dma that has a negative offset. We'd just need to look into a signed value for dma_pfn_offset to allow for the existing platforms that need the current positive offset.