Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp121902rdb; Thu, 8 Feb 2024 00:28:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWtoYH+UVBy3WPX+CAHtAE5fg1xTp/qeHcJUdYCUJVLtFW9r3twVQnhxdM2VgDl4UoutqwitMXzGdtTk09zvHMGiQl5Isc6SIEGUtx66Q== X-Google-Smtp-Source: AGHT+IHm3Ruh58nuSF7WqX8FwyJZEJd/x5boG4YyMcpc1Qc9DwjS4RmKO4fthkQnIWtTCnuDvPiN X-Received: by 2002:a05:6a21:33a6:b0:19b:a07a:3495 with SMTP id yy38-20020a056a2133a600b0019ba07a3495mr3480615pzb.25.1707380903052; Thu, 08 Feb 2024 00:28:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707380903; cv=pass; d=google.com; s=arc-20160816; b=ZB3xU/o59yjYi9WNTKAwpoyS/9PfB+Ir+3DRBT3K9SzMPFkJSXf60X0mDsY1rFrmDH cNDYwQT2ljjK6YR3kz3y6ye2HA62NT8hdr6pGVP16Ah8coSCX0t95k5XQGn1rtQ+14z9 x52Evt2ud92bo2FMKHXKseod5Y7pCVqvQWuJHXeTwEdpCq4fe3N0MXajibd3JVqe+6M7 XCTi9hXE4pTiNsLG9xI9HVPz3gk6GxjyajdGG3vJaMhMPekHVFSQ7asLHmE3V/+eesaK K/aOBC0u6Z7qa8NY8/i30Z6oqVYpMzgMKVtxvwMjbkRmQRMLI9QV6v93OJ1IVrL4PsrP jC2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3S4KR+ncWw8pz+sW66DSd9oOsEbe+BtQjhcYyBhFwSk=; fh=RYgaHGP718JTcDHnjXX6Xpeyf8NwkPqdXd/YnHAEqTs=; b=CR0EaNWm2tHLCzAhEJjtYyDvYiZOKrpnIl3K+lV2/OAM7FslAuKAWJS42dL5G2zKrV 84zxcFer76F9FOLiDaRCplvEDHuB9PHFSTZ+WD6eYyEr9GUGsceLifJ973/s1a5PB+SP y0wTonoR/l/1E76+Vlk0UDHnd4brnjNe97z/S8Ju0RRmoblDJWh8uTjTY2Rrxcypw2kP 2rWc75zwJU67VLbVOrEiPwoDvpEj6xqVhJECnWBNzew3XAhEzWLt0dcStwduYHZzSGbo d9yYsz/KeotP7VZr11NNiKMhj0ci6gOaCtUKWDGJlSfLZsvOQdHGueIscn4joA84VW/C utmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EtlFc3wV; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-57610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCX+7bS0B5tDp1+YEEOJVmT2obc+0XmZ/+h1fCW+01qPbtSlEfYchYXqZsPsc1GUdVneN49l2e3EDOEVAz6nzwTXd7X47VqzbPiqZ2rR/A== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bn13-20020a056a02030d00b005d8b30f48b6si3808306pgb.652.2024.02.08.00.28.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 00:28:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EtlFc3wV; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-57610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 16968B24946 for ; Thu, 8 Feb 2024 08:25:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C8036DCE7; Thu, 8 Feb 2024 08:23:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EtlFc3wV" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CA786BB25; Thu, 8 Feb 2024 08:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707380597; cv=none; b=Kd/DrJgHKCgVcE5+uD3IQwJMMp7WomM5kgz/D67SDrGuvnWWQpR+SIq12VI4uNQOm0f/tYGAvA0ezQRUecwu7cZ/BJzYJoYQVxN5Dn5OL0lphTZKb75IEyMUi2rNjngRF5FbdooDFjcSkkZN0e/WAw0CCFMfLj9PWdDU8XZoteU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707380597; c=relaxed/simple; bh=m/RDlw1Azbc+HTUjCY0lMPLwvnpodCQbjh7vQHAUPf4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eZTEreUggIc/NzxgapRZHlTAoFtXL45DvRpMZtdG5H8dfvMm5Oejy0JWwZ46HjX4scDfb9SgaBUh/uKXyrTkoIB5bC9l1/mf/vpMbdXRsGkBglzvrUOSGlOoo80Cn0RWDdNy6qjn+PmbCWUZk2QDyIsiJZMFgUBGE3espTu2lbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EtlFc3wV; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707380596; x=1738916596; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m/RDlw1Azbc+HTUjCY0lMPLwvnpodCQbjh7vQHAUPf4=; b=EtlFc3wVPVZva8pB2sUAjsNSoFSIT1As8GwTj/sw2K+rBQc/+i4TOYuv rqtZxe6cFvZhvSju0kD+mffzhzqNcGNsrsFkx46bGZiIr71MtsyY6rUfe blmkissZjB7IDtbnH1POAs8yM0chrzaRRh23kH3K5M8fhNUlwNk7JEyp0 BC2t+UX7gKjPy+f+1ZWhm6cOYqB3A7J5IvjP126qsth1QeKekTUVE4bhf l0m7qlk7VTGlP3snl0yNxynn0B69vFVqHJGg9wBo0uWU34qO4+nrvUKuf rRhq1hDtKnQNc571+87JH2QGhR33gyygamFx+aY9Tr7iBeVMu5tzz8UT0 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="5036345" X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="5036345" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 00:23:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="6252131" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orviesa003.jf.intel.com with ESMTP; 08 Feb 2024 00:23:14 -0800 From: Yi Liu To: joro@8bytes.org, jgg@nvidia.com, kevin.tian@intel.com, baolu.lu@linux.intel.com Cc: alex.williamson@redhat.com, robin.murphy@arm.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, chao.p.peng@linux.intel.com, yi.l.liu@intel.com, yi.y.sun@linux.intel.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com, joao.m.martins@oracle.com Subject: [PATCH rc 6/8] iommu/vt-d: Remove @domain parameter from intel_pasid_setup_dirty_tracking() Date: Thu, 8 Feb 2024 00:23:05 -0800 Message-Id: <20240208082307.15759-7-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208082307.15759-1-yi.l.liu@intel.com> References: <20240208082307.15759-1-yi.l.liu@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The only usage of input @domain is to get the domain id (DID) to flush cache after setting dirty tracking. However, DID can be obtained from the pasid entry. So no need to pass in domain. This can make this helper cleaner when adding the missing dirty tracking for the parent domain, which needs to use the DID of nested domain. Signed-off-by: Yi Liu --- drivers/iommu/intel/iommu.c | 7 +++---- drivers/iommu/intel/pasid.c | 3 +-- drivers/iommu/intel/pasid.h | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index c5a0275697cb..dae20991e036 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -4742,8 +4742,7 @@ static int intel_iommu_set_dirty_tracking(struct iommu_domain *domain, goto out_unlock; list_for_each_entry(info, &dmar_domain->devices, link) { - ret = intel_pasid_setup_dirty_tracking(info->iommu, - info->domain, info->dev, + ret = intel_pasid_setup_dirty_tracking(info->iommu, info->dev, IOMMU_NO_PASID, enable); if (ret) goto err_unwind; @@ -4757,8 +4756,8 @@ static int intel_iommu_set_dirty_tracking(struct iommu_domain *domain, err_unwind: list_for_each_entry(info, &dmar_domain->devices, link) - intel_pasid_setup_dirty_tracking(info->iommu, dmar_domain, - info->dev, IOMMU_NO_PASID, + intel_pasid_setup_dirty_tracking(info->iommu, info->dev, + IOMMU_NO_PASID, dmar_domain->dirty_tracking); spin_unlock(&dmar_domain->lock); return ret; diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index 3239cefa4c33..a32d7e509842 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -428,7 +428,6 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu, * Set up dirty tracking on a second only or nested translation type. */ int intel_pasid_setup_dirty_tracking(struct intel_iommu *iommu, - struct dmar_domain *domain, struct device *dev, u32 pasid, bool enabled) { @@ -445,7 +444,7 @@ int intel_pasid_setup_dirty_tracking(struct intel_iommu *iommu, return -ENODEV; } - did = domain_id_iommu(domain, iommu); + did = pasid_get_domain_id(pte); pgtt = pasid_pte_get_pgtt(pte); if (pgtt != PASID_ENTRY_PGTT_SL_ONLY && pgtt != PASID_ENTRY_PGTT_NESTED) { diff --git a/drivers/iommu/intel/pasid.h b/drivers/iommu/intel/pasid.h index 8d40d4c66e31..487ede039bdd 100644 --- a/drivers/iommu/intel/pasid.h +++ b/drivers/iommu/intel/pasid.h @@ -307,7 +307,6 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu, struct dmar_domain *domain, struct device *dev, u32 pasid); int intel_pasid_setup_dirty_tracking(struct intel_iommu *iommu, - struct dmar_domain *domain, struct device *dev, u32 pasid, bool enabled); int intel_pasid_setup_pass_through(struct intel_iommu *iommu, -- 2.34.1