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 DDEB0C83F19 for ; Tue, 29 Aug 2023 15:40:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237302AbjH2PkN (ORCPT ); Tue, 29 Aug 2023 11:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237303AbjH2Pj5 (ORCPT ); Tue, 29 Aug 2023 11:39:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 69D76B7; Tue, 29 Aug 2023 08:39:54 -0700 (PDT) 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 623062F4; Tue, 29 Aug 2023 08:40:33 -0700 (PDT) Received: from [10.1.34.35] (010265703453.arm.com [10.1.34.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4671B3F738; Tue, 29 Aug 2023 08:39:47 -0700 (PDT) Message-ID: Date: Tue, 29 Aug 2023 16:39:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH v11 5/6] iommu/dma: Allow a single FQ in addition to per-CPU FQs Content-Language: en-GB To: Niklas Schnelle , Joerg Roedel , Matthew Rosato , Will Deacon , Wenjia Zhang , Jason Gunthorpe Cc: Gerd Bayer , Julian Ruess , Pierre Morel , Alexandra Winter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Suravee Suthikulpanit , Hector Martin , Sven Peter , Alyssa Rosenzweig , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Konrad Dybcio , Yong Wu , Matthias Brugger , AngeloGioacchino Del Regno , Gerald Schaefer , Orson Zhai , Baolin Wang , Chunyan Zhang , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Krishna Reddy , Jonathan Hunter , Jonathan Corbet , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-doc@vger.kernel.org References: <20230717-dma_iommu-v11-0-a7a0b83c355c@linux.ibm.com> <20230717-dma_iommu-v11-5-a7a0b83c355c@linux.ibm.com> <9a466109-01c5-96b0-bf03-304123f435ee@arm.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On 2023-08-23 15:21, Niklas Schnelle wrote: [...] >>> +struct dma_iommu_options { >>> +#define IOMMU_DMA_OPTS_PER_CPU_QUEUE 0L >> >> Nit: if the intent is to add more flags then that will no longer make >> sense, and if not then we may as well just have a bool ;) >> >>> +#define IOMMU_DMA_OPTS_SINGLE_QUEUE BIT(0) > > My thinking was that the above two options are mutually exclusive with > per-CPU encoded as BIT(0) unset and single queue as set. Then other > options could still use the other bits. It's true though that the below > use of IOMMU_DMA_OPTS_PER_CPU_QUEUE is a nop so maybe just drop that? > Or we could use an enum even if I don't forsee more than these 2 queue > types. My point was that the value 0 can only mean "all flags not set", so while we can very much have the semantic of "single queue flag not set means percpu queue", we cannot infer "0 means percpu queue" unless "all flags" and "single queue flag" are the same thing. As soon as any additional flag is defined, 0 then has a different meaning which may well not even be a combination that's useful to put a specific name to. I'd like to hope it's sufficiently obvious from the implementation that the opposite of a single queue is multiple queues, since contextually this is already all happening in distinct paths from the case of no queue. Thanks, Robin.