public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: mohd.syazwan.abdul.halim@intel.com,
	Kunwu Chan <chentao@kylinos.cn>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 4/7] iommu/vt-d: Make context clearing consistent with context mapping
Date: Wed, 22 Nov 2023 11:26:05 +0800	[thread overview]
Message-ID: <20231122032608.165144-5-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <20231122032608.165144-1-baolu.lu@linux.intel.com>

In the iommu probe_device path, domain_context_mapping() allows setting
up the context entry for a non-PCI device. However, in the iommu
release_device path, domain_context_clear() only clears context entries
for PCI devices.

Make domain_context_clear() behave consistently with
domain_context_mapping() by clearing context entries for both PCI and
non-PCI devices.

Fixes: 579305f75d34 ("iommu/vt-d: Update to use PCI DMA aliases")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20231114011036.70142-4-baolu.lu@linux.intel.com
---
 drivers/iommu/intel/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 9bddd4fbbdf8..4c257ccf9dc3 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -3928,8 +3928,8 @@ static int domain_context_clear_one_cb(struct pci_dev *pdev, u16 alias, void *op
  */
 static void domain_context_clear(struct device_domain_info *info)
 {
-	if (!info->iommu || !info->dev || !dev_is_pci(info->dev))
-		return;
+	if (!dev_is_pci(info->dev))
+		domain_context_clear_one(info, info->bus, info->devfn);
 
 	pci_for_each_dma_alias(to_pci_dev(info->dev),
 			       &domain_context_clear_one_cb, info);
-- 
2.34.1


  parent reply	other threads:[~2023-11-22  3:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22  3:26 [PATCH 0/7] [PULL REQUEST] iommu/vt-d: Fixes for v6.7-rc3 Lu Baolu
2023-11-22  3:26 ` [PATCH 1/7] iommu/vt-d: Support enforce_cache_coherency only for empty domains Lu Baolu
2023-11-22  3:26 ` [PATCH 2/7] iommu/vt-d: Omit devTLB invalidation requests when TES=0 Lu Baolu
2023-11-22  3:26 ` [PATCH 3/7] iommu/vt-d: Disable PCI ATS in legacy passthrough mode Lu Baolu
2023-11-22  3:26 ` Lu Baolu [this message]
2023-11-22  3:26 ` [PATCH 5/7] iommu/vt-d: Add MTL to quirk list to skip TE disabling Lu Baolu
2023-11-22  3:26 ` [PATCH 6/7] iommu/vt-d: Fix incorrect cache invalidation for mm notification Lu Baolu
2023-11-22  3:26 ` [PATCH 7/7] iommu/vt-d: Set variable intel_dirty_ops to static Lu Baolu
2023-11-27 10:08 ` [PATCH 0/7] [PULL REQUEST] iommu/vt-d: Fixes for v6.7-rc3 Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231122032608.165144-5-baolu.lu@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=chentao@kylinos.cn \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mohd.syazwan.abdul.halim@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox