Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp498730rdb; Fri, 17 Nov 2023 05:09:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYQwXxphD/rL9Yc6Xn6ejxuBOKuDEF3XNozH/7Qb++9tvj0YQjzefjoVVE1sxLuKnoxBI4 X-Received: by 2002:a05:6871:5289:b0:1d6:cbcd:80f8 with SMTP id hu9-20020a056871528900b001d6cbcd80f8mr25682370oac.54.1700226553234; Fri, 17 Nov 2023 05:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700226553; cv=none; d=google.com; s=arc-20160816; b=xBRxiARWfeEurHgVGYf5V8a5PBTCgsnaFXaw1SXU1bhtAYA5CrIvJheZlBESsJMjBM YMBtcYeqxV7wrQuqUNADa1B7gG9gYjekF+z0q4VU7FaVo9k1q7FkihKjpY8VbWotzzYj Peh5OUQJfG4wZFoOC/6wkxapzcvPeRFPolOTvmS30Bt4bEEUeQTY9Fe9+8ijvYVfUukP 5K6g8IcfNb/xzgU/rkXMYxC49yA21ZhrOFBBMycok+fMN7CZmQIKPjPHM6zd7ysQOhFA IsE8yruSA/WCKoE+eD11v4uH4k0EG9l4u1+8Lvj7WudDa1qECXPKdlTfjtYr3MWt6MAA QOuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xYJC7txQg+XVy3povoIneigNeaYf7XjMoOZStClkpv8=; fh=jW7leW0WH26QTMDegkaQbVnQRZP2lI5YAYlO5DQiKjY=; b=xxQ0guPlzzhy80oJuGZUjOXIeBAqnVLSAYvCeuNjyAdT3b9lDr3G8UXGaUcClzzURz me+mUngmJ2/L24x8o0jCqsZXQ/gJk7TA3+FqUmz3n+pLv9bCn/kkon0Wx0tpzp7MFyJ9 S+pexMsZkOmg1N0T5MPKfcXIdlmh0i6Lp1UEe9XvKs3Hj37Ig0Z2xrEdqcrgRNMXKNCl +88k0O3uDORAcp9Nu01G+agduyotkceqxlDrFtzD/eiYo9erXptLQoDDpzq49nH1v6Tc eQhGuyuw0z84h9IM8Yr9CTNgp/8dB2XrFgdVzXLFUFH/og/uy04V5zKFD6clmyzfE8GQ F54Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="YCnIb/zd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id a15-20020a056870e0cf00b001e9eae6903esi560897oab.239.2023.11.17.05.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 05:09:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="YCnIb/zd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0F84D832EF75; Fri, 17 Nov 2023 05:09:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235725AbjKQNIa (ORCPT + 99 others); Fri, 17 Nov 2023 08:08:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235193AbjKQNIM (ORCPT ); Fri, 17 Nov 2023 08:08:12 -0500 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9E031BFF for ; Fri, 17 Nov 2023 05:07:59 -0800 (PST) Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-7789a4c01ddso118112485a.1 for ; Fri, 17 Nov 2023 05:07:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1700226479; x=1700831279; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xYJC7txQg+XVy3povoIneigNeaYf7XjMoOZStClkpv8=; b=YCnIb/zdoWijRR3fBUtGj+9sINBW+bSCUYMdffeTqROq5nOPKHdyvZrul7F325K7Ti aCr6i1V40IMksINrVanBS1eZv9si197uvyPklyGZRNGJNn9zqqxY/tCKdcZif+18gQ5K PuBYN/okm1B3xZlsYgj3cwtjLx9Iyn5U91pjp0cuFmrljACmix3CKyv2yqsYK6p/iSZs GtAD4hl3arsikyVUY7Hz+qXeZEd9YwQ3qco4ce1m5wA4d3nwCzIbEVFnce1BMKsbWnzP MBZ2qT9yPOSVa3hWv3detpLWo/DWuF54QQ5rQvtqUYb4Kzc0Q7GFztr8Pz9fuAR+FWpa S99w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700226479; x=1700831279; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xYJC7txQg+XVy3povoIneigNeaYf7XjMoOZStClkpv8=; b=plJePlocyq8Rk//sPAVvDwWrMm0tYB4pN+iuKChbwlUn6ZerexH06hHO3drGzEBXm0 3W6MrVhrMj+nUxek7ZCYXxbwzfEIx2nvqTL2F/+1tinJQAiyQ8+QU/3zWD/KAslLLea4 pRMUP+n+YnKnGSs2i5LxJXgCnYv1pFHKRJxtpLpBB2sg59XBe3RMfGtN1C2wyKzOtxuk oYIOXEnahUaD6c37TNH9Y/v2KjLb7w+Opp4G1A9TBxYpswM+TIVCSOwe9OIAmnNjkHYi GZGDelvswsiXdHBu6T/w+zlXJ5BxvRXrRHMonbRd8p/+v8PxB6PYyPlvWau5/pFiOekh nsaA== X-Gm-Message-State: AOJu0YwjoFnSOppg3oQZdca+5017+f6Rv8EOauGvfjmH02Bdftefslgt koE1R4GkESfDkAQDBiJuvrEoeg== X-Received: by 2002:a05:620a:4104:b0:77a:5493:8a3 with SMTP id j4-20020a05620a410400b0077a549308a3mr14826885qko.11.1700226478437; Fri, 17 Nov 2023 05:07:58 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-134-23-187.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.134.23.187]) by smtp.gmail.com with ESMTPSA id az44-20020a05620a172c00b00777611164c5sm577475qkb.106.2023.11.17.05.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 05:07:57 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1r3yZg-0001hp-Th; Fri, 17 Nov 2023 09:07:56 -0400 Date: Fri, 17 Nov 2023 09:07:56 -0400 From: Jason Gunthorpe To: Baolu Lu Cc: "Tian, Kevin" , Joerg Roedel , Will Deacon , Robin Murphy , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/4] iommu/vt-d: Introduce dev_to_iommu() Message-ID: <20231117130756.GA6501@ziepe.ca> References: <20231116015048.29675-1-baolu.lu@linux.intel.com> <20231116015048.29675-2-baolu.lu@linux.intel.com> <053e89dd-8de9-43f3-8530-1f65181efd46@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <053e89dd-8de9-43f3-8530-1f65181efd46@linux.intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 05:09:03 -0800 (PST) On Thu, Nov 16, 2023 at 11:23:56AM +0800, Baolu Lu wrote: > On 11/16/23 11:19 AM, Tian, Kevin wrote: > > > From: Lu Baolu > > > Sent: Thursday, November 16, 2023 9:51 AM > > > > > > +static inline struct intel_iommu *dev_to_iommu(struct device *dev) > > > +{ > > > + /* > > > + * Assume that valid per-device iommu structure must be installed > > > + * if iommu_probe_device() has succeeded. This helper could only > > > + * be used after device is probed. > > > + */ > > > + return ((struct device_domain_info *)dev_iommu_priv_get(dev))- > > > > iommu; > > > +} > > > > Not sure whether this helper is useful. This is only used by 2 out of 5 > > post-probe users. Probably just open-coding in all 5 places is clearer. > > I thought it should get more users in the future development. The pattern in the SMMUv2 driver is like struct device_domain_info *info = dev_iommu_priv_get(dev); struct intel_iommu *iommu = info->iommu; Which really isn't worth the helper, unless you have lots of caes where info isn't needed at all? Jason