From nobody Sat Feb 7 23:34:02 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 1A7C52BE7AB for ; Thu, 5 Feb 2026 02:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770258858; cv=none; b=OXTFsACdI7176vA2DICVlFC5CPXGWY+JIGQDdw2ql0dHnEBwgnQn/khP7RBEowytTYMFhgBUCAD1rbrYV9ysG6/sWNS7pCdDqpdaHN+vHJVU3qIoHGwoy4LS77Wzp6GK2aMq/yFntNzd+qqhMuPFUg7lPsEKaJh5shvnCZW7cxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770258858; c=relaxed/simple; bh=AbywpTOOKbxEqDW9iByzwp7ySVcBEv42pVsan2OURTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jrInLAUEqeNKH4j85EV78rM8C2FuIhw1EsQnEzw/JSqbAe/J7CP/kdFS8Ecndx2OUgFlWjp/UEoRG6Ef4c4z9nEqjpuN1w492lISOT1aVhw/n9W2qLN3GNtOHZ0BtYoZcJjIUvM816oU92Dw4p0wJShLoXwQOeARCrGxl/ZtCmc= 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=ispSGaJS; arc=none smtp.client-ip=192.198.163.13 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ispSGaJS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770258858; x=1801794858; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AbywpTOOKbxEqDW9iByzwp7ySVcBEv42pVsan2OURTQ=; b=ispSGaJSwebq2vjDmUIyTdFv3OjZBTuCsnTiP6syqVLdGRyP6WqitmMH vGEgyupCRMGID6oDGFbRQsvvG+lLQNe6MVZHkrBCN6BuVsxExteT30Znl H/MrUjKfWS2aIIN99K2QJFsQBDSyKvLInDxN8Zh8JjxDDtJhTMasKY69+ Nb66dSdypXAQSKI6t71vVmZl1gtWLwbxmwpGO8GUkFk+ZYJFdtAeoZe3R kHh7b3skKtKB9VXJJA64/dnAFsegM8LNO5KcnBxKm5HL3hR4eldljXm1T wr5HZVNX3Z4KIHeGZCunrY45YhTMLkceC6a7j0CjjEEGLHWP8Ra0Bg843 A==; X-CSE-ConnectionGUID: 3VrGq3gVRkeLTMlKMPEptA== X-CSE-MsgGUID: Hxezyf2TTvm9MZ9/xPKSzQ== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="74057936" X-IronPort-AV: E=Sophos;i="6.21,273,1763452800"; d="scan'208";a="74057936" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 18:34:18 -0800 X-CSE-ConnectionGUID: qoqrCeOfTMCUzx4vy7Sn9g== X-CSE-MsgGUID: fkOkHTpOTiaan/dJGHM9cQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,273,1763452800"; d="scan'208";a="214872061" Received: from spr-duan.bj.intel.com ([172.16.114.123]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 18:34:16 -0800 From: Zhenzhong Duan To: linux-kernel@vger.kernel.org, iommu@lists.linux.dev Cc: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, jgg@ziepe.ca, kevin.tian@intel.com, Zhenzhong Duan Subject: [PATCH 1/3] iommupt/vtd: Pass dmar_domain pointer to device_set_dirty_tracking() Date: Wed, 4 Feb 2026 21:34:02 -0500 Message-ID: <20260205023405.41583-2-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260205023405.41583-1-zhenzhong.duan@intel.com> References: <20260205023405.41583-1-zhenzhong.duan@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: quoted-printable Content-Type: text/plain; charset="utf-8" Pass dmar_domain pointer to device_set_dirty_tracking() instead of device list in the domain. This is a prerequisite patch to support dirty tracking on PASIDs. No functional changes intended. Suggested-by: Lu Baolu Signed-off-by: Zhenzhong Duan --- drivers/iommu/intel/iommu.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 134302fbcd92..acaa6eaf7e2f 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3687,16 +3687,15 @@ static void *intel_iommu_hw_info(struct device *dev= , u32 *length, return vtd; } =20 -/* - * Set dirty tracking for the device list of a domain. The caller must - * hold the domain->lock when calling it. - */ -static int device_set_dirty_tracking(struct list_head *devices, bool enabl= e) +/* Set dirty tracking for the devices that the domain has been attached. */ +static int device_set_dirty_tracking(struct dmar_domain *domain, bool enab= le) { struct device_domain_info *info; int ret =3D 0; =20 - list_for_each_entry(info, devices, link) { + lockdep_assert_held(&domain->lock); + + list_for_each_entry(info, &domain->devices, link) { ret =3D intel_pasid_setup_dirty_tracking(info->iommu, info->dev, IOMMU_NO_PASID, enable); if (ret) @@ -3716,7 +3715,7 @@ static int parent_domain_set_dirty_tracking(struct dm= ar_domain *domain, spin_lock(&domain->s1_lock); list_for_each_entry(s1_domain, &domain->s1_domains, s2_link) { spin_lock_irqsave(&s1_domain->lock, flags); - ret =3D device_set_dirty_tracking(&s1_domain->devices, enable); + ret =3D device_set_dirty_tracking(s1_domain, enable); spin_unlock_irqrestore(&s1_domain->lock, flags); if (ret) goto err_unwind; @@ -3727,8 +3726,7 @@ static int parent_domain_set_dirty_tracking(struct dm= ar_domain *domain, err_unwind: list_for_each_entry(s1_domain, &domain->s1_domains, s2_link) { spin_lock_irqsave(&s1_domain->lock, flags); - device_set_dirty_tracking(&s1_domain->devices, - domain->dirty_tracking); + device_set_dirty_tracking(s1_domain, domain->dirty_tracking); spin_unlock_irqrestore(&s1_domain->lock, flags); } spin_unlock(&domain->s1_lock); @@ -3745,7 +3743,7 @@ static int intel_iommu_set_dirty_tracking(struct iomm= u_domain *domain, if (dmar_domain->dirty_tracking =3D=3D enable) goto out_unlock; =20 - ret =3D device_set_dirty_tracking(&dmar_domain->devices, enable); + ret =3D device_set_dirty_tracking(dmar_domain, enable); if (ret) goto err_unwind; =20 @@ -3762,8 +3760,7 @@ static int intel_iommu_set_dirty_tracking(struct iomm= u_domain *domain, return 0; =20 err_unwind: - device_set_dirty_tracking(&dmar_domain->devices, - dmar_domain->dirty_tracking); + device_set_dirty_tracking(dmar_domain, dmar_domain->dirty_tracking); spin_unlock(&dmar_domain->lock); return ret; } --=20 2.47.3 From nobody Sat Feb 7 23:34:02 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 102CD29DB9A for ; Thu, 5 Feb 2026 02:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770258861; cv=none; b=ay0KRPr447bo2hPOCtkPoL+gdGQGzBqjVKYpjHC67cVDkQ2rlp67x+xgfx2R9SlYqxhj/5xYe061ZiK7uQCuBOlcdtca3xci0UmFETOss+yBwpkXs+3yBW1HIz+IFvA9XODh4YeqY7bur+nKfaqph1INtF9kAoyh0YlwWHQp3mI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770258861; c=relaxed/simple; bh=n5sm8CS+WQv1rbRYTvvCBmaf7sN0eqry4c5chWZubdo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i7472JMVI9R5ZveMy86ocCclDvFEkRILIz09jik71bJBgZtze0htqoaVd7GZ329+wTHg493/jM3l+yy3N73YrQo6l7jsjbCV177rOjhH/5ToNPmD26YWg9AewCQnA2NhDPB/MxOfhQisbQAULuYmyy/ds2iJiBAR2/iYpUp92P8= 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=h8tYc/z+; arc=none smtp.client-ip=192.198.163.13 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="h8tYc/z+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770258861; x=1801794861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n5sm8CS+WQv1rbRYTvvCBmaf7sN0eqry4c5chWZubdo=; b=h8tYc/z+gR1wgn2euH3t0Gwh+IAufCnQLBSCjK8SKtcNSUd8GIoqX37y 8GXBA8SAvUk7LlgyEU9EPoaVHL/dt4ZxDQnJbxOxmM6hWyjZhmIx9N7uK guLdQe+j97VtOjwmiYVl7jOgUMcyFJcfkttRk7bHfNqF3QVA2y85yyNgI TIRgScNSBkGtPNc7VXAm+kFDmkwstx3cKnr/0u9pieoKF34LqiiBYm8gK Kz5On24GKwEdO5zLdrAh6aJ/IKHGIa70mDaSAF0ACL7ZXsj2j8vsqAjKX Xp6Xb3pf/UeY3JenHEDMcsNFyjPHJoKDUTmSoGRni6ecjIPU45x2kA9oR Q==; X-CSE-ConnectionGUID: WD1/C54GRuCfGcQgJvzPcQ== X-CSE-MsgGUID: q3hc9YQARPqu2gbPCwrYyg== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="74057945" X-IronPort-AV: E=Sophos;i="6.21,273,1763452800"; d="scan'208";a="74057945" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 18:34:21 -0800 X-CSE-ConnectionGUID: xObtWwZoRquoCqQvCbO65w== X-CSE-MsgGUID: pRf/Uyx0RxOTHtZfDTCZkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,273,1763452800"; d="scan'208";a="214872069" Received: from spr-duan.bj.intel.com ([172.16.114.123]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 18:34:19 -0800 From: Zhenzhong Duan To: linux-kernel@vger.kernel.org, iommu@lists.linux.dev Cc: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, jgg@ziepe.ca, kevin.tian@intel.com, Zhenzhong Duan Subject: [PATCH 2/3] iommupt/vtd: Support dirty tracking on PASID Date: Wed, 4 Feb 2026 21:34:03 -0500 Message-ID: <20260205023405.41583-3-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260205023405.41583-1-zhenzhong.duan@intel.com> References: <20260205023405.41583-1-zhenzhong.duan@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: quoted-printable Content-Type: text/plain; charset="utf-8" In order to support passthrough device with PASID capability in QEMU, e.g., DSA device, kernel needs to support attaching PASID to a domain. But attaching is not allowed if the domain is a second stage domain with dirty tracking, this is the use case when guest configures 'iommu=3Dpt'. The reason is kernel lacking support for dirty tracking on such domain attached to PASID. Same for nested domain even though there is no such checking. By adding dirty tracking on PASID, the check can be removed. Signed-off-by: Zhenzhong Duan --- drivers/iommu/intel/iommu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index acaa6eaf7e2f..5a9ed91109a2 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3621,9 +3621,6 @@ static int intel_iommu_set_dev_pasid(struct iommu_dom= ain *domain, if (!pasid_supported(iommu) || dev_is_real_dma_subdevice(dev)) return -EOPNOTSUPP; =20 - if (domain->dirty_ops) - return -EINVAL; - if (context_copied(iommu, info->bus, info->devfn)) return -EBUSY; =20 @@ -3691,6 +3688,7 @@ static void *intel_iommu_hw_info(struct device *dev, = u32 *length, static int device_set_dirty_tracking(struct dmar_domain *domain, bool enab= le) { struct device_domain_info *info; + struct dev_pasid_info *dev_pasid; int ret =3D 0; =20 lockdep_assert_held(&domain->lock); @@ -3698,6 +3696,14 @@ static int device_set_dirty_tracking(struct dmar_dom= ain *domain, bool enable) list_for_each_entry(info, &domain->devices, link) { ret =3D intel_pasid_setup_dirty_tracking(info->iommu, info->dev, IOMMU_NO_PASID, enable); + if (ret) + return ret; + } + + list_for_each_entry(dev_pasid, &domain->dev_pasids, link_domain) { + info =3D dev_iommu_priv_get(dev_pasid->dev); + ret =3D intel_pasid_setup_dirty_tracking(info->iommu, info->dev, + dev_pasid->pasid, enable); if (ret) break; } --=20 2.47.3 From nobody Sat Feb 7 23:34:02 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 36D69288C30; Thu, 5 Feb 2026 02:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770258865; cv=none; b=C5b1aaoDo8Hm14piawen4O6j8IqY08+dk/rzt4tuJ9KpMGWQ14X2oEbo95U5FXCzcjGmDvMbTrl/Gvb9xLqPHj65gyLuESAvBtM0MROSvfoyh08KO7Eh/LpWiVgr9pJAih5Qe8Axh+6v9HwJMuD2/8fOt/uAd/xPz0lzf7qvY64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770258865; c=relaxed/simple; bh=B9S9jXBEC8CG/byBROfOYsXHweZLxU0jwg1eJQh5kGs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S3DdcnSQ262AojN+2ehd60mj1Flll8CTr1Untw+GkCEDBXvr3ICZ7525BGzC0+Ijbf1HHg/hPN3bfVnnr9Jc11sfLJmNiTyZ9CbLeFm9KhXUoukH8MIzwxkZwrvV2Pjtp1fh2IlPLnP5HfnI65t6DhEAyxZHMAn4kW4p3bAOJM8= 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=FWwNQdli; arc=none smtp.client-ip=192.198.163.13 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FWwNQdli" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770258864; x=1801794864; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B9S9jXBEC8CG/byBROfOYsXHweZLxU0jwg1eJQh5kGs=; b=FWwNQdligCCgVbZhLfh+pYopkjW8kpfSaTTRkq1mJfK+VtnhOvjm9Q0u 1zdGKc2GJINPrYsTIjkAW4e/u97cOsFTztwdMdGDLVkecx/N+WDSjmreJ ndFTEjtoycHUJWou9lrmwjPCFbzQ/atsUF3IVvnrwgRx5Ul5EzU6Y3AeA A+prMzQUDg/A7gyzV8yCfiTxH7fCVPIjzWe9EgeH7Fx528MQgV6YUw2ch SAZEwquUPpSuef1KBw1kifTOndJHURscGErS/c+IuFp0yH5hnPyIqSyW9 /9I+TdDNmVgCfoYJlO4NvA+85T3xkfsHh4exWLU0uX92x2qeDeTAvEy1W A==; X-CSE-ConnectionGUID: Ru2fL8y5SqCtaa7TJW28dg== X-CSE-MsgGUID: vB3MoMuCR5e7FlXpxaSB2Q== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="74057969" X-IronPort-AV: E=Sophos;i="6.21,273,1763452800"; d="scan'208";a="74057969" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 18:34:24 -0800 X-CSE-ConnectionGUID: RFMeHWWGRneJcBn4KhO4fQ== X-CSE-MsgGUID: UTS9hJKCRqChOhgGEFRUvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,273,1763452800"; d="scan'208";a="214872085" Received: from spr-duan.bj.intel.com ([172.16.114.123]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 18:34:22 -0800 From: Zhenzhong Duan To: linux-kernel@vger.kernel.org, iommu@lists.linux.dev Cc: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, jgg@ziepe.ca, kevin.tian@intel.com, Zhenzhong Duan , linux-kselftest@vger.kernel.org Subject: [PATCH 3/3] iommufd/selftest: Test dirty tracking on PASID Date: Wed, 4 Feb 2026 21:34:04 -0500 Message-ID: <20260205023405.41583-4-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260205023405.41583-1-zhenzhong.duan@intel.com> References: <20260205023405.41583-1-zhenzhong.duan@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: quoted-printable Content-Type: text/plain; charset="utf-8" Add test case for dirty tracking on a domain attached to PASID, also confirm attachment to PASID fail if device doesn't support dirty tracking. Suggested-by: Lu Baolu Signed-off-by: Zhenzhong Duan --- tools/testing/selftests/iommu/iommufd.c | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testing/selfte= sts/iommu/iommufd.c index dadad277f4eb..d1fe5dbc2813 100644 --- a/tools/testing/selftests/iommu/iommufd.c +++ b/tools/testing/selftests/iommu/iommufd.c @@ -2275,6 +2275,33 @@ TEST_F(iommufd_dirty_tracking, set_dirty_tracking) test_ioctl_destroy(hwpt_id); } =20 +TEST_F(iommufd_dirty_tracking, pasid_set_dirty_tracking) +{ + uint32_t stddev_id, ioas_id, hwpt_id, pasid =3D 100; + uint32_t dev_flags =3D MOCK_FLAGS_DEVICE_PASID; + + /* Regular case */ + test_cmd_hwpt_alloc(self->idev_id, self->ioas_id, + IOMMU_HWPT_ALLOC_PASID | IOMMU_HWPT_ALLOC_DIRTY_TRACKING, + &hwpt_id); + test_cmd_mock_domain_flags(hwpt_id, dev_flags, &stddev_id, NULL, NULL); + ASSERT_EQ(0, _test_cmd_pasid_attach(self->fd, stddev_id, pasid, hwpt_id)); + test_cmd_set_dirty_tracking(hwpt_id, true); + test_cmd_set_dirty_tracking(hwpt_id, false); + ASSERT_EQ(0, _test_cmd_pasid_detach(self->fd, stddev_id, pasid)); + + test_ioctl_destroy(stddev_id); + + /* IOMMU device does not support dirty tracking */ + dev_flags |=3D MOCK_FLAGS_DEVICE_NO_DIRTY; + test_ioctl_ioas_alloc(&ioas_id); + test_cmd_mock_domain_flags(ioas_id, dev_flags, &stddev_id, NULL, NULL); + EXPECT_ERRNO(EINVAL, _test_cmd_pasid_attach(self->fd, stddev_id, pasid, h= wpt_id)); + + test_ioctl_destroy(stddev_id); + test_ioctl_destroy(hwpt_id); +} + TEST_F(iommufd_dirty_tracking, device_dirty_capability) { uint32_t caps =3D 0; --=20 2.47.3