Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3835972pxb; Mon, 4 Oct 2021 10:37:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZSaVj7JPy46idRK8jBthQ8o1/3xvK3ypkinwbYO+VObq/T4fNJYF/OazGP1VetaHEu9NU X-Received: by 2002:a17:902:ee11:b0:13e:bdb6:66fb with SMTP id z17-20020a170902ee1100b0013ebdb666fbmr818312plb.81.1633369075177; Mon, 04 Oct 2021 10:37:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633369075; cv=none; d=google.com; s=arc-20160816; b=eacxrWPdrcC0n+kpxvdPXwwkJxYVHE96DuYOLArNUtHR6vQ/hOBvPvAQJCdllZGYDG xv/NA1HfTcxFHFNZztcFMONriBGlGyAiWQGf+ZvoieYsMo0ultNii+99AUHBT1xmHGo0 G9IGCg3Kt6SpB9TWTZRRQRLEDU3+7/Zk2hJQRPrxvu6nQVbhjUmFjw5QG0euCLzEwzkR s1b9Yz0YALf0QkA8G4QZlCtw874NnbrwFaB7hY/CYt6RjlwIIfxYLBY/Q/QeZh8jROgN vNVMohi1fIOCrcPwmkHGCZzHXAtpLsWP4jga7hDYry6rDxv01vA+mS9z6y/dgPAG2e3b Cr/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=SWsowwvbHZ7rZzUUa50TZqVXB58UXYNuZV3Q1icC50k=; b=XHamXd1jK0FqAU2nz2nJ0r65e3ZFOXMMTt92LiUk64TVK+ws9L/nRwGyOn6dWxslWf F2mQGV7vL4LmSTRO1GH+r56TnvGzDcdiD396j4E2jKqS6JIsCNI7O9Xpdqxs5Aw/E7mF 8r+bpryUqVlsXlKZiwLKuK2NSYwQAmkNjJ0bLrn8fZODzS/I20BqzQxmPepOrenMjNkY ltbMjBYwX33gsZtx9PbsI3/+Izfj1IwN5kNDZy9Xi+1tVk0glzHvvPzn/d67OTkjxPzH nNW3jM3Vn65SUOmEWdoWgQIY9tfBZLAPEdQFAnwjusNTsX5P/XWrIfSwAMUqWU/BDDu/ 3oVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si17250642pjd.15.2021.10.04.10.37.42; Mon, 04 Oct 2021 10:37:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235141AbhJDOuz (ORCPT + 99 others); Mon, 4 Oct 2021 10:50:55 -0400 Received: from foss.arm.com ([217.140.110.172]:45680 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235150AbhJDOun (ORCPT ); Mon, 4 Oct 2021 10:50:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BA8DDD6E; Mon, 4 Oct 2021 07:48:54 -0700 (PDT) Received: from [10.57.22.120] (unknown [10.57.22.120]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F33813F70D; Mon, 4 Oct 2021 07:48:52 -0700 (PDT) Subject: Re: [PATCH 0/5] iommu: Some IOVA code reorganisation To: Will Deacon , John Garry Cc: joro@8bytes.org, mst@redhat.com, jasowang@redhat.com, xieyongji@bytedance.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, virtualization@lists.linux-foundation.org, linuxarm@huawei.com, thunder.leizhen@huawei.com, baolu.lu@linux.intel.com References: <1632477717-5254-1-git-send-email-john.garry@huawei.com> <20211004114418.GC27373@willie-the-truck> From: Robin Murphy Message-ID: <87b782d7-339a-fcd0-8fae-659e2d9da078@arm.com> Date: Mon, 4 Oct 2021 15:48:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211004114418.GC27373@willie-the-truck> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-10-04 12:44, Will Deacon wrote: > On Fri, Sep 24, 2021 at 06:01:52PM +0800, John Garry wrote: >> The IOVA domain structure is a bit overloaded, holding: >> - IOVA tree management >> - FQ control >> - IOVA rcache memories >> >> Indeed only a couple of IOVA users use the rcache, and only dma-iommu.c >> uses the FQ feature. >> >> This series separates out that structure. In addition, it moves the FQ >> code into dma-iommu.c . This is not strictly necessary, but it does make >> it easier for the FQ domain lookup the rcache domain. >> >> The rcache code stays where it is, as it may be reworked in future, so >> there is not much point in relocating and then discarding. >> >> This topic was initially discussed and suggested (I think) by Robin here: >> https://lore.kernel.org/linux-iommu/1d06eda1-9961-d023-f5e7-fe87e768f067@arm.com/ > > It would be useful to have Robin's Ack on patches 2-4. The implementation > looks straightforward to me, but the thread above isn't very clear about > what is being suggested. FWIW I actually got about half-way through writing my own equivalent of patches 2-3, except tackling it from the other direction - simplifying the FQ code *before* moving whatever was left to iommu-dma, then I got side-tracked trying to make io-pgtable use that freelist properly, and then I've been on holiday the last 2 weeks. I've got other things to catch up on first but I'll try to get to this later this week. > To play devil's advocate: there aren't many direct users of the iovad code: > either they'll die out entirely (and everybody will use the dma-iommu code) > and it's fine having the flush queue code where it is, or we'll get more > users and the likelihood of somebody else wanting flush queues increases. I think the FQ code is mostly just here as a historical artefact, since the IOVA allocator was the only thing common to the Intel and AMD DMA ops when the common FQ implementation was factored out of those, so although it's essentially orthogonal it was still related enough that it was an easy place to stick it. Cheers, Robin.