Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp938063rdb; Fri, 17 Nov 2023 18:32:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFa+1XBTkRBJ26KQNu0CDBfgxZgY4fYfL2tYDTyKlN/ZcgbJT2VgreLRIERd0fyHOoCp2Vv X-Received: by 2002:a05:6a20:8628:b0:187:440b:6e40 with SMTP id l40-20020a056a20862800b00187440b6e40mr838289pze.17.1700274736485; Fri, 17 Nov 2023 18:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700274736; cv=none; d=google.com; s=arc-20160816; b=Qt5KeBq24dYbuvCqiwCK+B8wMmyspuKQ+lNIY51Br5A+oa/FaC4jYi5sVQ+nZF5M01 qJX740Io3FzZZrNps0yiAY7CYD/gq0QwVACRTf5a7f4g5Z6f8Ab47ZTQjy/mlIjEofs4 bhi3fEXQpxrecBMFxhQWbHgi5gqSHRWwTCwprkx1DGDVsKIjQZlXJPE2YUiP0CU2fx5y oiT9m1K1GFpwwPVSRJCf7oYHRyfttrSralW7ADC5RCBUmsIbbWYz0ORkV8nDIARJZeN8 zfBbk6OCVwF7XtkJTKwfy8/NxOtQBuINp1sECTBdIWlpB7hpretqYOhffrO9caNCZOyM mrEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=gs3YzGhjGZLERAcck+NtpgBXeTUwYK7bKA8p+w8WrVc=; fh=STSU0GbCJrMHvWE7eBQ1MLfB4vg0etAdASz/d59PMfI=; b=mYyulbBUzwYVuHlsCR7uKZQpXLHVWbmGHjuHmypaqeAltHv1i32Rps28wtF1iE++X5 gQn1q0yzT4HH2g7cejsnClujUVTrG1puDus/bLZcQwUOQFElm/ZDpggydRCjw2R0Oj51 CMa95QG2NTtAXGySFVB611m7G5ck9MH27STw9pmEWX3sTlOdmb1830mvvR5c/anJDYSG dIlaEbvk/B+zBuFqzesPxLQz7jukbpw4v0nMUsDJO6Y9rsC71FI7S4R/tHsKpS2Er2Xp MU2ZsqUJbjDqzX4AKnrbvzd1DJKYGHY5LU0ZfaWZ20l+4j556paD0TlTeRfa/j2aBA+n XCkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CTYFMz1i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id mf13-20020a17090b184d00b002801ac582d0si3406976pjb.185.2023.11.17.18.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 18:32:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CTYFMz1i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0473A820AAB6; Fri, 17 Nov 2023 18:32:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232868AbjKRCbU (ORCPT + 99 others); Fri, 17 Nov 2023 21:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232840AbjKRCbT (ORCPT ); Fri, 17 Nov 2023 21:31:19 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 229B41A1 for ; Fri, 17 Nov 2023 18:31:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700274676; x=1731810676; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=OehhV+d7VO0CSQ4vXI/Vdbgi96ek9dXfotfoBbJcYbo=; b=CTYFMz1i+VRMHfJcV/WccyglVv8A8YOCnaU284sGx7EiR6OI8b68EpWG mNcDwF8pXjvq8aOuJLWrAowACDcSjeYhObMUbA+FQa92HADvB/lu5t9ZT paa36P/++fAqkcbDaucg0/11SSPcsXPuUjYSkummIK8fKHbMbC1jskWGo pPPlR2omAYLP1WjWH5rW3wReTvxGO6WBOaSojytI78UCJtFu0sXg0PDRs SkUiY5XyWT0Df6Yn4nWYSPXbQlUFLTx0NAyxmXeRb7Ug02/HDvbBT5KZ2 BZPx7YBnmTVmTNoOlRJIBGnCBUAlGlHkZo0IvHmVai3cHzqUXG4abE7yl w==; X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="422494485" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="422494485" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2023 18:31:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="7023525" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by orviesa002.jf.intel.com with ESMTP; 17 Nov 2023 18:31:14 -0800 Message-ID: <79a1f935-12c1-4e12-92c8-2214bf6b7a73@linux.intel.com> Date: Sat, 18 Nov 2023 10:26:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, "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() Content-Language: en-US To: Jason Gunthorpe 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> <20231117130756.GA6501@ziepe.ca> From: Baolu Lu In-Reply-To: <20231117130756.GA6501@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 18:32:14 -0800 (PST) On 11/17/23 9:07 PM, Jason Gunthorpe wrote: > 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? No. As Kevin pointed out, there are only 2 places. I will drop this helper. Best regards, baolu