Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4560654ybc; Tue, 26 Nov 2019 10:49:48 -0800 (PST) X-Google-Smtp-Source: APXvYqz2VoXQxq3tWt30gDexqJvajicPb8IbkhjMSKBh2NgXUNYfbltrbpeGCYEIVqfIwuR27Uf6 X-Received: by 2002:a17:906:6403:: with SMTP id d3mr45632154ejm.258.1574794188818; Tue, 26 Nov 2019 10:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574794188; cv=none; d=google.com; s=arc-20160816; b=EfjU1ePpDk/hfXKlHfPd417qqUQ18WnbK0vGQ+OnsDMLZc4UJyr6SckzGng0QxsUwa 6hRMf/w30IP2mLBWuTQ3frPu0ptOpFLJtq8/HtkTMTcUCTVpbCrwgV/RmS2H7GKftMhk TKdmGpGwqvrGDlMvhKVb9/we7+fxUN1cnPnKbFyjjcJpj+9fDh1WNp5O0aQYaJCfJLqg vWV03Cpc9qWpfrrQIoMRnKMKyjoV4yy2NezBc/GCaPtgWHBAWPgtV+vIaji31fcOxc9S tQn/0eIqzlpOTVYFwHR56tLHQIa5OXuUav6zkYo9X7I8o5w/yogNjvU4HLoC97GkWDdu Grwg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/QAp4XhgkcetEQ+yezBdLidATA7v/ZBbDyVJ6U1VFdk=; b=XUmca4ZLsN/jMUa1rmHr5Vb+EZO0x6BgYcRpfAveItWU+dS5sAf5KKteD6ctVh3lMu ReJgLTFf7zY3C5g1ywHYSZVtM/UmRlZoHu+2R2EgpkBMn+N9toO4QK3CV4A61cnFcEB8 HOlsJgUTv9LRNK9QSU3n9hrIgBmBzsTw+zmMVaOo5Ii3NujXgf8dTWvgf9R0Nd5YTCP3 c6KJNYxNieBooZWYhqFaRufEG/kgd3ZhsbAkBGAw4i/Qr73KQm5mm+tvaNIKKHc+h6HY cWUFCaNIP64hsNHTUH846KHXcLr+26OkAHufqX6Yl8vzYQdBIyiqS5KpGLYwDECCfOSl q4fw== 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 va7si7525902ejb.18.2019.11.26.10.49.24; Tue, 26 Nov 2019 10:49:48 -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 S1727080AbfKZSpa (ORCPT + 99 others); Tue, 26 Nov 2019 13:45:30 -0500 Received: from verein.lst.de ([213.95.11.211]:42203 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726019AbfKZSpa (ORCPT ); Tue, 26 Nov 2019 13:45:30 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 3ADCA68C4E; Tue, 26 Nov 2019 19:45:27 +0100 (CET) Date: Tue, 26 Nov 2019 19:45:27 +0100 From: Christoph Hellwig To: Tom Lendacky Cc: Halil Pasic , "Michael S. Tsirkin" , Jason Wang , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Cornelia Huck , linux-s390@vger.kernel.org, Michael Mueller , Christian Borntraeger , Janosch Frank , Christoph Hellwig , Ram Pai , Thiago Jung Bauermann , Andy Lutomirski , Brijesh Singh , "Kalra, Ashish" Subject: Re: [PATCH 1/1] virtio_ring: fix return code on DMA mapping fails Message-ID: <20191126184527.GA10481@lst.de> References: <20191114124646.74790-1-pasic@linux.ibm.com> <20191119121022.03aed69a.pasic@linux.ibm.com> <20191119080420-mutt-send-email-mst@kernel.org> <20191122140827.0ead345c.pasic@linux.ibm.com> <1ec7c229-6c4f-9351-efda-ed2df20f95f6@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1ec7c229-6c4f-9351-efda-ed2df20f95f6@amd.com> 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 Sat, Nov 23, 2019 at 09:39:08AM -0600, Tom Lendacky wrote: > Ideally, having a pool of shared pages for DMA, outside of standard > SWIOTLB, might be a good thing. On x86, SWIOTLB really seems geared > towards devices that don't support 64-bit DMA. If a device supports 64-bit > DMA then it can use shared pages that reside anywhere to perform the DMA > and bounce buffering. I wonder if the SWIOTLB support can be enhanced to > support something like this, using today's low SWIOTLB buffers if the DMA > mask necessitates it, otherwise using a dynamically sized pool of shared > pages that can live anywhere. I think that can be done relatively easily. I've actually been thinking of multiple pool support for a whіle to replace the bounce buffering in the block layer for ISA devices (24-bit addressing). I've also been looking into a dma_alloc_pages interface to help people just allocate pages that are always dma addressable, but don't need a coherent allocation. My last version I shared is here: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma_alloc_pages But it turns out this still doesn't work with SEV as we'll always bounce. And I've been kinda lost on figuring out a way how to allocate unencrypted pages that we we can feed into the normal dma_map_page & co interfaces due to the magic encryption bit in the address. I guess we could have a fallback path in the mapping path and just unconditionally clear that bit in the dma_to_phys path.