From patchwork Thu Feb 8 09:14:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Liu X-Patchwork-Id: 198234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp40220dyd; Thu, 8 Feb 2024 01:14:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWq31opoBqAy7C4fMmhJxuzIIvN/q22J6t8vqkFmCZD5zof6m+0IiMivrrmipkB/DTQ+ZMfPt07OwdgKD1zCoT5dY1aWg== X-Google-Smtp-Source: AGHT+IGj+FQO/IOSH7QWEq7xy1klMDvBAjuQuapx2dzN3mu+UrotBm7nf3oCRh2EC7AGv7JOgI6O X-Received: by 2002:ae9:f402:0:b0:785:98ab:255b with SMTP id y2-20020ae9f402000000b0078598ab255bmr4954087qkl.61.1707383680097; Thu, 08 Feb 2024 01:14:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707383680; cv=pass; d=google.com; s=arc-20160816; b=Tc76bs0rIsDg/YdJthCj1oxyo3n2JmrH5tJK3NT9BRpeDtP8WZsztCECN9oT2FoDZS ZR4GSpdk6U09iUVTifQaF2WWVLHp5hUfYzwf/0j8otViRj7UdLxKCfPFQUr0xuZq/tbo tEFCtdghB0bbn3o6NkiDlp6WgRefibu039IEPbyFHwnn5HKRcI5ZU8Rp0T+jQ0DnhR8K se6pJ8TzHV2a+jKU5OjbakWyC8SUXLZNtFCTL4S4BdKgTlcdEEa6FmtIJVrMFlzGVaAp 11TgE/KVLrwTZfrXp8RXYc+WcCVrL363rg/gx4oacua0LdWa2pwWVMyp0Jt/X8b7SPcQ BQ9A== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=GFW6L8Hd6hjWO5KOPqezQEnYTp/urui2kiIcb8/DzLc=; fh=uEr6xkk6NHLSK8iCXBNi1CBItobgRj3YtgsvSEQeaI8=; b=rEZCr4fRdXchgvnJhmjuuRR6nf8lqCIyE8U3ZTxHP6PbU/RZiQ49r1Tnz711XkDa/l QxIrD97JItoXYZUpcHURUrVX3HUzsSl0tCpj/VjVhTqVxpteR7OVXWklq0LlcPVIKkcK U6o+jpuW4nSdffm9dcAn9QA1UfSzBsz0YbAC2QLh8VBnpzPePGdwXEVLzBarjOBITr6X fKlXaf74jBMe+DQt4Etfgh2B7m9S3cJifPBt6QlFwliPcBiArsIC3PHor7vnbeX5wptw AXWPoRQrStFJduAvKI497ELlcjzR3LSLSyT+Bb3GhPUSgdsuOjg2rFBR1tA43ti22bBe hT0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ES0pCdTA; 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-57704-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57704-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCV1usqZUPGKmQyIimTT+JTvHuxA9huEwnVA/MSclfvaxwE5DkFVbgpJNhvd3TtpURhHqeTqWuue9DwNof5lJb/14K2Zdg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z4-20020ae9e604000000b00785a3478d15si1566333qkf.696.2024.02.08.01.14.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 01:14:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57704-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ES0pCdTA; 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-57704-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57704-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DD3A51C2623E for ; Thu, 8 Feb 2024 09:14:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F1F06BFB8; Thu, 8 Feb 2024 09:14:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ES0pCdTA" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 3B33167C45; Thu, 8 Feb 2024 09:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707383659; cv=none; b=sby0NwCc10VEnK+Wth1OQFYhddNoDn6aHmemME8bbNf/emmMoroEPQeWLxJVWqPnr51YQ4Etw/6DsnnXiDAvWmZk1Yl9jDE4ROAi6ux7I11dT7soOkgIUGO/PSACQs0bwGxNowji4lGmj5J0BehNdY67HS+AjneLyFHbmpuHdN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707383659; c=relaxed/simple; bh=GfZd+JEhD2jTwwbKWrI6hzvpQqkOQgWgJY3OFvAaJwg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=sddp1tF3HQRUeLfxLstquX8dzDDFhF50bV0RkTP94tn/ZxE+bGXSDFAKWBurwZ9ZI5bHYVkq/JvbnipohPMnLXBldUA+MhLLEXy9xIoti3a2HSNs9ThudAtV9WUfQh2ZjolksBlp2XZ4WiquB///pcoqV27KD1bCe94PPI9lT1Q= 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=ES0pCdTA; arc=none smtp.client-ip=192.198.163.16 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=1707383659; x=1738919659; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GfZd+JEhD2jTwwbKWrI6hzvpQqkOQgWgJY3OFvAaJwg=; b=ES0pCdTAwMA3TE7xcJ9m0lc6TGGqv6cKgIWxoKqEFroWjciGKuRihgq/ o/63n46ei9UkSt1K3GMdOb9g20SaOdesuh2dcKDVpWbpR7KJELv8RtTXh DAbNlsVPoAVb0CwpKUS9m0rp5mK+CXU+Sm44agdwSfzTmhHoDgD4Fcnj5 glnoOlqx4aZljeJK1MyBuxq8UaYxabANI1PYBvXB7rQTixpNpGpgVoPRm uNj2c/hPNnEizDeQCW5M6ignQDFbsUNbpvmyvWh7MbiKZhFTAamO8AVoi LtC2/GQXjz6AE/oM7RqRpzTXcyItdurXzSTZPijDSJuimxZSO14deFNpV g==; X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="1475035" X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="1475035" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 01:14:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="32672164" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by fmviesa001.fm.intel.com with ESMTP; 08 Feb 2024 01:14:16 -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] iommu/vt-d: Set SSADE when attaching to a parent with dirty tracking Date: Thu, 8 Feb 2024 01:14:14 -0800 Message-Id: <20240208091414.28133-1-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790321550102869263 X-GMAIL-MSGID: 1790321550102869263 Should set the SSADE (Second Stage Access/Dirty bit Enable) bit of the pasid entry when attaching a device to a nested domain if its parent has already enabled dirty tracking. Fixes: 111bf85c68f6 ("iommu/vt-d: Add helper to setup pasid nested translation") Signed-off-by: Yi Liu Reviewed-by: Joao Martins --- base commit: 547ab8fc4cb04a1a6b34377dd8fad34cd2c8a8e3 --- drivers/iommu/intel/pasid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index 3239cefa4c33..9be24bb762cf 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -658,6 +658,8 @@ int intel_pasid_setup_nested(struct intel_iommu *iommu, struct device *dev, pasid_set_domain_id(pte, did); pasid_set_address_width(pte, s2_domain->agaw); pasid_set_page_snoop(pte, !!ecap_smpwc(iommu->ecap)); + if (s2_domain->dirty_tracking) + pasid_set_ssade(pte); pasid_set_translation_type(pte, PASID_ENTRY_PGTT_NESTED); pasid_set_present(pte); spin_unlock(&iommu->lock);