From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7081C433EF for ; Mon, 14 Feb 2022 13:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354719AbiBNN6u (ORCPT ); Mon, 14 Feb 2022 08:58:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353936AbiBNN6t (ORCPT ); Mon, 14 Feb 2022 08:58:49 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87095CFD; Mon, 14 Feb 2022 05:58:41 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id C2B0468BEB; Mon, 14 Feb 2022 14:58:34 +0100 (CET) Date: Mon, 14 Feb 2022 14:58:34 +0100 From: Christoph Hellwig To: Tianyu Lan Cc: Christoph Hellwig , kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, hch@infradead.org, m.szyprowski@samsung.com, robin.murphy@arm.com, michael.h.kelley@microsoft.com, Tianyu Lan , iommu@lists.linux-foundation.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, vkuznets@redhat.com, brijesh.singh@amd.com, konrad.wilk@oracle.com, parri.andrea@gmail.com, thomas.lendacky@amd.com Subject: Re: [PATCH V2 1/2] Swiotlb: Add swiotlb_alloc_from_low_pages switch Message-ID: <20220214135834.GA30150@lst.de> References: <20220209122302.213882-1-ltykernel@gmail.com> <20220209122302.213882-2-ltykernel@gmail.com> <20220214081919.GA18337@lst.de> <4f433f07-05be-f81f-43e8-55c3f1af23b3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4f433f07-05be-f81f-43e8-55c3f1af23b3@gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org On Mon, Feb 14, 2022 at 07:28:40PM +0800, Tianyu Lan wrote: > On 2/14/2022 4:19 PM, Christoph Hellwig wrote: >> Adding a function to set the flag doesn't really change much. As Robin >> pointed out last time you should fine a way to just call >> swiotlb_init_with_tbl directly with the memory allocated the way you >> like it. Or given that we have quite a few of these trusted hypervisor >> schemes maybe add an argument to swiotlb_init that specifies how to >> allocate the memory. > > Thanks for your suggestion. I will try the first approach first approach. Take a look at the SWIOTLB_ANY flag in this WIP branch: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/swiotlb-init-cleanup That being said I'm not sure that either this flag or the existing powerpc code iѕ actually the right thing to do. We still need the 4G limited buffer to support devices with addressing limitations. So I think we need an additional io_tlb_mem instance for the devices without addressing limitations instead. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01FFFC43217 for ; Mon, 14 Feb 2022 13:58:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8C59A4015E; Mon, 14 Feb 2022 13:58:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lVETn8D4IpGN; Mon, 14 Feb 2022 13:58:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1B316400A4; Mon, 14 Feb 2022 13:58:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EA4BBC001A; Mon, 14 Feb 2022 13:58:44 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7026EC000B for ; Mon, 14 Feb 2022 13:58:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 41D5360655 for ; Mon, 14 Feb 2022 13:58:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9lC1V8EbzVhh for ; Mon, 14 Feb 2022 13:58:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9790F60030 for ; Mon, 14 Feb 2022 13:58:41 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id C2B0468BEB; Mon, 14 Feb 2022 14:58:34 +0100 (CET) Date: Mon, 14 Feb 2022 14:58:34 +0100 From: Christoph Hellwig To: Tianyu Lan Subject: Re: [PATCH V2 1/2] Swiotlb: Add swiotlb_alloc_from_low_pages switch Message-ID: <20220214135834.GA30150@lst.de> References: <20220209122302.213882-1-ltykernel@gmail.com> <20220209122302.213882-2-ltykernel@gmail.com> <20220214081919.GA18337@lst.de> <4f433f07-05be-f81f-43e8-55c3f1af23b3@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4f433f07-05be-f81f-43e8-55c3f1af23b3@gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: linux-hyperv@vger.kernel.org, brijesh.singh@amd.com, dave.hansen@linux.intel.com, hpa@zytor.com, kys@microsoft.com, Christoph Hellwig , hch@infradead.org, wei.liu@kernel.org, sthemmin@microsoft.com, x86@kernel.org, decui@microsoft.com, michael.h.kelley@microsoft.com, mingo@redhat.com, parri.andrea@gmail.com, thomas.lendacky@amd.com, Tianyu Lan , konrad.wilk@oracle.com, haiyangz@microsoft.com, bp@alien8.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, vkuznets@redhat.com, robin.murphy@arm.com X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" T24gTW9uLCBGZWIgMTQsIDIwMjIgYXQgMDc6Mjg6NDBQTSArMDgwMCwgVGlhbnl1IExhbiB3cm90 ZToKPiBPbiAyLzE0LzIwMjIgNDoxOSBQTSwgQ2hyaXN0b3BoIEhlbGx3aWcgd3JvdGU6Cj4+IEFk ZGluZyBhIGZ1bmN0aW9uIHRvIHNldCB0aGUgZmxhZyBkb2Vzbid0IHJlYWxseSBjaGFuZ2UgbXVj aC4gIEFzIFJvYmluCj4+IHBvaW50ZWQgb3V0IGxhc3QgdGltZSB5b3Ugc2hvdWxkIGZpbmUgYSB3 YXkgdG8ganVzdCBjYWxsCj4+IHN3aW90bGJfaW5pdF93aXRoX3RibCBkaXJlY3RseSB3aXRoIHRo ZSBtZW1vcnkgYWxsb2NhdGVkIHRoZSB3YXkgeW91Cj4+IGxpa2UgaXQuICBPciBnaXZlbiB0aGF0 IHdlIGhhdmUgcXVpdGUgYSBmZXc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