Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37772707rwd; Tue, 11 Jul 2023 20:32:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+ZMtUsY1ucdBecyTWUp6owxM1shTvs9ERdh551g+ZNBREIwd/YQWpiaL20mUmd6/amcdw X-Received: by 2002:a05:6a21:6d8b:b0:119:4141:6989 with SMTP id wl11-20020a056a216d8b00b0011941416989mr976935pzb.13.1689132738817; Tue, 11 Jul 2023 20:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689132738; cv=none; d=google.com; s=arc-20160816; b=Muy5+gvw+MyF30f2Zy49bFbAn341tlzn5lHiWkwXNsZIaY7rtbmUEFw70A3xW1S6HB wTPkDzHjcXBhX50qeVsrujhrfUFmebHQYAVjX8d5SWpYbtHHo9KRsvsP2AiAaRuO31Pf eHCc8r8gtTC+NgC8Odm8DHfLF8R2/QqZG0l9ceXlpExx+fYumoTRyXLzUPNy+8mKhGQF xTL4SOvkFOBo5DnvSOws3veksReuMlUlBDhpu3dbSiypNMbFYpgT6tOEfZtFQhDDs2Xn c+kE6mStllHQ6vT3pbXNZ+BQEuSycORzNTsWc6BJnbUnF0Q3DPCAJfO/jnpZTS/0YKgs CwwA== 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=Ws6Qg8ew1nQwfTHJFxNtraoX3OzcBwMiBn85L9Op3P4=; fh=COUz1nX6QMPDcALC5XR8ka7FYhpobmxMIcJXi1IQMk0=; b=oNr05P74ofDGsgz7L2L1Yzyi0OZzJoehTAAkjt/pxKlzHU2owr8COzpKW0coh+p5uO 1cwcNCfuOSUhcI5bZdW8oiZZc5SRLhBV4UdS5T3wAw7YB9ujL/HnIAAPfSll7vWgDtfO VfeNZW7Iwxfs5EEaDZpHVUQ1l1ae956RVmJ7wNfK6jITozERDBkX1TluxR5cYMoU3Wzh dcUSrKuniQZLG5QUG8Bmh0NjBXiBYjUOMYCiWV1Nvj5kMrjZoJPgTklNy0i+eYPy1wQh BYLyFjqmKk1+SNcpt12XMa/2bcPxzsNEOfrZ2RUhx7YGuCd2tr0GeNAfMSRXt4c+neyM cX+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NMssl0hD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a65618a000000b0055be613bbbbsi2375332pgv.77.2023.07.11.20.32.06; Tue, 11 Jul 2023 20:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NMssl0hD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232013AbjGLDN0 (ORCPT + 99 others); Tue, 11 Jul 2023 23:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbjGLDNT (ORCPT ); Tue, 11 Jul 2023 23:13:19 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B68F193; Tue, 11 Jul 2023 20:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689131597; x=1720667597; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=rS7yhv7p+ymForwhUax28XnYNPqA/QaWercDDj/Ioks=; b=NMssl0hD2jYm1Gh5gbcRvo3G7+z5ZNnUqMffBG56XrJBBFlCfC+CUjnw TQ5FM7cKyJiOuMBnaGUSQ3CT8K1EctBJOiTHeGI5bAp81BGpEi52GeMzF CXH+TAG+xIpq2PqvgY6tTF+bh2bZ8Rz07Hrw2IrUcIOlCXk3jB4FiN5e2 NT16nEkxfUM1bRJqs256pGQlyD89eXUxXYm32vnQ1Ya4Ph5jgdidY1P35 GbeJK2tsKPqU9Axx4ek0e69SQKYHlUaA5+7mkLRHl1PcOqMP3FBY+dknZ L7ARmtpMbQey6xmv1MPC0PPQUtwAxPyAmYEXvseD7zq4hQ4+rWLjGvIdO w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="395584217" X-IronPort-AV: E=Sophos;i="6.01,198,1684825200"; d="scan'208";a="395584217" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 20:13:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="724708910" X-IronPort-AV: E=Sophos;i="6.01,198,1684825200"; d="scan'208";a="724708910" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.252.187.60]) ([10.252.187.60]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 20:13:12 -0700 Message-ID: Date: Wed, 12 Jul 2023 11:13:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: baolu.lu@linux.intel.com, Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 9/9] iommu: Use fault cookie to store iopf_param Content-Language: en-US To: Jacob Pan References: <20230711010642.19707-1-baolu.lu@linux.intel.com> <20230711010642.19707-10-baolu.lu@linux.intel.com> <20230711150249.62917dad@jacob-builder> From: Baolu Lu In-Reply-To: <20230711150249.62917dad@jacob-builder> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/12 6:02, Jacob Pan wrote: > On Tue, 11 Jul 2023 09:06:42 +0800, Lu Baolu > wrote: > >> Remove the static iopf_param pointer from struct iommu_fault_param to >> save memory. >> >> Signed-off-by: Lu Baolu >> --- >> include/linux/iommu.h | 2 -- >> drivers/iommu/io-pgfault.c | 47 +++++++++++++++++++++++--------------- >> 2 files changed, 29 insertions(+), 20 deletions(-) >> >> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >> index ffd6fe1317f4..5fe37a7c5a55 100644 >> --- a/include/linux/iommu.h >> +++ b/include/linux/iommu.h >> @@ -551,7 +551,6 @@ struct iommu_fault_param { >> * struct dev_iommu - Collection of per-device IOMMU data >> * >> * @fault_param: IOMMU detected device fault reporting data >> - * @iopf_param: I/O Page Fault queue and data >> * @fwspec: IOMMU fwspec data >> * @iommu_dev: IOMMU device this device is linked to >> * @priv: IOMMU Driver private data >> @@ -564,7 +563,6 @@ struct iommu_fault_param { >> struct dev_iommu { >> struct mutex lock; >> struct iommu_fault_param *fault_param; >> - struct iopf_device_param *iopf_param; >> struct iommu_fwspec *fwspec; >> struct iommu_device *iommu_dev; >> void *priv; >> diff --git a/drivers/iommu/io-pgfault.c b/drivers/iommu/io-pgfault.c >> index 1749e0869f2e..6a3a4e08e67e 100644 >> --- a/drivers/iommu/io-pgfault.c >> +++ b/drivers/iommu/io-pgfault.c >> @@ -158,7 +158,7 @@ int iommu_queue_iopf(struct iommu_fault *fault, >> struct device *dev) >> * As long as we're holding param->lock, the queue can't be >> unlinked >> * from the device and therefore cannot disappear. >> */ >> - iopf_param = param->iopf_param; >> + iopf_param = iommu_get_device_fault_cookie(dev, 0); > I am not sure I understand how does it know the cookie type is iopf_param > for PASID 0? > > Between IOPF and IOMMUFD use of the cookie, cookie types are different, > right? > The fault cookie is managed by the code that delivers or handles the faults. The sva and IOMMUFD paths are exclusive. Best regards, baolu