Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp160208pxb; Tue, 21 Sep 2021 22:10:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwETqFg/1q6RrrrvXkVNBnl7D4g7egPpkXZvx18qVLZ6EZXaQoC3ORDXb+ObB9+9gDNobOF X-Received: by 2002:a92:c84c:: with SMTP id b12mr24113429ilq.105.1632287405994; Tue, 21 Sep 2021 22:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632287405; cv=none; d=google.com; s=arc-20160816; b=vyCqVlAfaQbG9O/g4UvZaMK8ogPzeYYDOPFbFy0QYju1U42b/0Q4FKxShkteOLxqTw 3uP13L2H/6nopDc/64PFBIw4+arsxVImtgHxbnLig3htOWHVmxm3j/ejq/QglRdOnajC frfdBg8Y8S8dl2E2Hs+x3hSnlF1XYi6bzUaQFD78wM811uFJfWC4Uf70txtKJiEZiCt3 kTJ1GA/TgnSkUpTVtK1ApZifMhRm9cO3tr9yC+5fs/cEA2J9mosJMO2uvQt/Q794vQxZ 2J1hhYcX7dEdnDiftP4UDE2e/mmao5Uu41NgqYUAYsWe3kHfka7SQFLYoKVNcdVX17Uj UCzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=UAH5MXVG5vImjWw/x2SSHwBaHhm1f63zjg7Q3dJDvHE=; b=gsa35L3JRO9nlmiwBJl7MV7RaSJ56xuAd8AKVjElNI9x/ibgAibiAOx9qH6JAGXc5s DM57doimqam4q2KrtBidHIUKd22jtO/1khp9x0KF8CQREDOWgAGUr6fC3lbGC37jYPBz r+51T/9O5nlKp3neRFP0HwWZc0dDAC74ojT3nKaQJ6YgFqSVVEoLMzzijMU1t/FNLMVV m99kAjLVI57RL369Ew46FeUi4Yc7GcZjZmbDUlZI0XsZbGzHKve+OuKCNUI+r6d3UXFS VjT3ghxI9yit4BhVDEkrkO5JlRT/XTU3ZwlqfFzRU9YnnWfDGyn7DPRfwpTyDL7fgQhS wn6w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si1066326jaf.91.2021.09.21.22.09.53; Tue, 21 Sep 2021 22:10:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbhIVFJU (ORCPT + 99 others); Wed, 22 Sep 2021 01:09:20 -0400 Received: from verein.lst.de ([213.95.11.211]:58677 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231775AbhIVFJT (ORCPT ); Wed, 22 Sep 2021 01:09:19 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 2FB4667373; Wed, 22 Sep 2021 07:07:46 +0200 (CEST) Date: Wed, 22 Sep 2021 07:07:46 +0200 From: Christoph Hellwig To: Lu Baolu Cc: Jason Gunthorpe , Liu Yi L , alex.williamson@redhat.com, hch@lst.de, jasowang@redhat.com, joro@8bytes.org, jean-philippe@linaro.org, kevin.tian@intel.com, parav@mellanox.com, lkml@metux.net, pbonzini@redhat.com, lushenming@huawei.com, eric.auger@redhat.com, corbet@lwn.net, ashok.raj@intel.com, yi.l.liu@linux.intel.com, jun.j.tian@intel.com, hao.wu@intel.com, dave.jiang@intel.com, jacob.jun.pan@linux.intel.com, kwankhede@nvidia.com, robin.murphy@arm.com, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, dwmw2@infradead.org, linux-kernel@vger.kernel.org, david@gibson.dropbear.id.au, nicolinc@nvidia.com Subject: Re: [RFC 04/20] iommu: Add iommu_device_get_info interface Message-ID: <20210922050746.GA12921@lst.de> References: <20210919063848.1476776-1-yi.l.liu@intel.com> <20210919063848.1476776-5-yi.l.liu@intel.com> <20210921161930.GP327412@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 22, 2021 at 10:31:47AM +0800, Lu Baolu wrote: > Hi Jason, > > On 9/22/21 12:19 AM, Jason Gunthorpe wrote: >> On Sun, Sep 19, 2021 at 02:38:32PM +0800, Liu Yi L wrote: >>> From: Lu Baolu >>> >>> This provides an interface for upper layers to get the per-device iommu >>> attributes. >>> >>> int iommu_device_get_info(struct device *dev, >>> enum iommu_devattr attr, void *data); >> >> Can't we use properly typed ops and functions here instead of a void >> *data? >> >> get_snoop() >> get_page_size() >> get_addr_width() > > Yeah! Above are more friendly to the upper layer callers. The other option would be a struct with all the attributes. Still type safe, but not as many methods. It'll require a little boilerplate in the callers, though.