From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Lu Baolu <baolu.lu@linux.intel.com>,
Kevin Tian <kevin.tian@intel.com>, Joerg Roedel <jroedel@suse.de>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 091/107] iommu/vt-d: Allocate pasid table in device probe path
Date: Tue, 5 Dec 2023 12:17:06 +0900 [thread overview]
Message-ID: <20231205031537.381772322@linuxfoundation.org> (raw)
In-Reply-To: <20231205031531.426872356@linuxfoundation.org>
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <baolu.lu@linux.intel.com>
[ Upstream commit ec62b4424174f41bdcedd08d12d7bed80088453d ]
Whether or not a domain is attached to the device, the pasid table should
always be valid as long as it has been probed. This moves the pasid table
allocation from the domain attaching device path to device probe path and
frees it in the device release path.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20221118132451.114406-2-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Stable-dep-of: da37dddcf4ca ("iommu/vt-d: Disable PCI ATS in legacy passthrough mode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/intel/iommu.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index bd34fcc5a5274..3dbf86c61f073 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2494,13 +2494,6 @@ static int domain_add_dev_info(struct dmar_domain *domain, struct device *dev)
/* PASID table is mandatory for a PCI device in scalable mode. */
if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {
- ret = intel_pasid_alloc_table(dev);
- if (ret) {
- dev_err(dev, "PASID table allocation failed\n");
- dmar_remove_one_dev_info(dev);
- return ret;
- }
-
/* Setup the PASID entry for requests without PASID: */
if (hw_pass_through && domain_type_is_si(domain))
ret = intel_pasid_setup_pass_through(iommu, domain,
@@ -4112,7 +4105,6 @@ static void dmar_remove_one_dev_info(struct device *dev)
iommu_disable_dev_iotlb(info);
domain_context_clear(info);
- intel_pasid_free_table(info->dev);
}
spin_lock_irqsave(&domain->lock, flags);
@@ -4477,6 +4469,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
struct device_domain_info *info;
struct intel_iommu *iommu;
u8 bus, devfn;
+ int ret;
iommu = device_to_iommu(dev, &bus, &devfn);
if (!iommu || !iommu->iommu.ops)
@@ -4521,6 +4514,16 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
dev_iommu_priv_set(dev, info);
+ if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {
+ ret = intel_pasid_alloc_table(dev);
+ if (ret) {
+ dev_err(dev, "PASID table allocation failed\n");
+ dev_iommu_priv_set(dev, NULL);
+ kfree(info);
+ return ERR_PTR(ret);
+ }
+ }
+
return &iommu->iommu;
}
@@ -4529,6 +4532,7 @@ static void intel_iommu_release_device(struct device *dev)
struct device_domain_info *info = dev_iommu_priv_get(dev);
dmar_remove_one_dev_info(dev);
+ intel_pasid_free_table(dev);
dev_iommu_priv_set(dev, NULL);
kfree(info);
set_dma_ops(dev, NULL);
--
2.42.0
next prev parent reply other threads:[~2023-12-05 3:33 UTC|newest]
Thread overview: 120+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 3:15 [PATCH 6.1 000/107] 6.1.66-rc1 review Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 001/107] cifs: Fix FALLOC_FL_ZERO_RANGE by setting i_size if EOF moved Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 002/107] cifs: Fix FALLOC_FL_INSERT_RANGE by setting i_size after " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 003/107] smb: client: report correct st_size for SMB and NFS symlinks Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 004/107] pinctrl: avoid reload of p state in list iteration Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 005/107] firewire: core: fix possible memory leak in create_units() Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 006/107] mmc: sdhci-pci-gli: Disable LPM during initialization Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 007/107] mmc: cqhci: Increase recovery halt timeout Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 008/107] mmc: cqhci: Warn of halt or task clear failure Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 009/107] mmc: cqhci: Fix task clearing in CQE error recovery Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 010/107] mmc: block: Retry commands " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 011/107] mmc: block: Do not lose cache flush during " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 012/107] mmc: block: Be sure to wait while busy in " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 013/107] ALSA: hda: Disable power-save on KONTRON SinglePC Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 014/107] ALSA: hda/realtek: Headset Mic VREF to 100% Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 015/107] ALSA: hda/realtek: Add supported ALC257 for ChromeOS Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 016/107] dm-verity: align struct dm_verity_fec_io properly Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 017/107] scsi: Change SCSI device boolean fields to single bit flags Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 018/107] scsi: sd: Fix system start for ATA devices Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 019/107] drm/amd: Enable PCIe PME from D3 Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 020/107] drm/amdgpu: Force order between a read and write to the same address Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 021/107] drm/amd/display: Include udelay when waiting for INBOX0 ACK Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 022/107] drm/amd/display: Remove min_dst_y_next_start check for Z8 Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 023/107] drm/amd/display: Use DRAM speed from validation for dummy p-state Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 024/107] drm/amd/display: Update min Z8 residency time to 2100 for DCN314 Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 025/107] drm/amd/display: fix ABM disablement Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 026/107] dm verity: initialize fec io before freeing it Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 027/107] dm verity: dont perform FEC for failed readahead IO Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 028/107] nvme: check for valid nvme_identify_ns() before using it Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 029/107] powercap: DTPM: Fix unneeded conversions to micro-Watts Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 030/107] cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 031/107] dma-buf: fix check in dma_resv_add_fence Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 032/107] bcache: revert replacing IS_ERR_OR_NULL with IS_ERR Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 033/107] iommu/vt-d: Add MTL to quirk list to skip TE disabling Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 034/107] KVM: PPC: Book3S HV: Fix KVM_RUN clobbering FP/VEC user registers Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 035/107] powerpc: Dont clobber f0/vs0 during fp|altivec register save Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 036/107] parisc: Mark ex_table entries 32-bit aligned in assembly.h Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 037/107] parisc: Mark ex_table entries 32-bit aligned in uaccess.h Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 038/107] parisc: Use natural CPU alignment for bug_table Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 039/107] parisc: Mark lock_aligned variables 16-byte aligned on SMP Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 040/107] parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 041/107] parisc: Mark jump_table naturally aligned Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 042/107] parisc: Ensure 32-bit alignment on parisc unwind section Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 043/107] parisc: Mark altinstructions read-only and 32-bit aligned Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 044/107] btrfs: add dmesg output for first mount and last unmount of a filesystem Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 045/107] btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 046/107] btrfs: fix off-by-one when checking chunk map includes logical address Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 047/107] btrfs: send: ensure send_fd is writable Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 048/107] btrfs: make error messages more clear when getting a chunk map Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 049/107] btrfs: fix 64bit compat send ioctl arguments not initializing version member Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 050/107] Input: xpad - add HyperX Clutch Gladiate Support Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 051/107] auxdisplay: hd44780: move cursor home after clear display command Greg Kroah-Hartman
2023-12-06 0:33 ` Miguel Ojeda
2023-12-05 3:16 ` [PATCH 6.1 052/107] serial: sc16is7xx: Put IOControl register into regmap_volatile Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 053/107] serial: sc16is7xx: add missing support for rs485 devicetree properties Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 054/107] wifi: cfg80211: fix CQM for non-range use Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 055/107] USB: xhci-plat: fix legacy PHY double init Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 056/107] USB: core: Change configuration warnings to notices Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 057/107] usb: config: fix iteration issue in usb_get_bos_descriptor() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 058/107] ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 059/107] dpaa2-eth: increase the needed headroom to account for alignment Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 060/107] uapi: propagate __struct_group() attributes to the container union Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 061/107] selftests/net: ipsec: fix constant out of range Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 062/107] selftests/net: fix a char signedness issue Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 063/107] selftests/net: unix: fix unused variable compiler warning Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 064/107] selftests/net: mptcp: fix uninitialized variable warnings Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 065/107] octeontx2-af: Fix possible buffer overflow Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 066/107] net: stmmac: xgmac: Disable FPE MMC interrupts Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 067/107] octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64 Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 068/107] octeontx2-af: Install TC filter rules in hardware based on priority Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 069/107] octeontx2-pf: Restore TC ingress police rules when interface is up Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 070/107] r8169: prevent potential deadlock in rtl8169_close Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 071/107] ravb: Fix races between ravb_tx_timeout_work() and net related ops Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 072/107] net: ravb: Check return value of reset_control_deassert() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 073/107] net: ravb: Use pm_runtime_resume_and_get() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 074/107] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 075/107] net: ravb: Start TX queues after HW initialization succeeded Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 076/107] net: ravb: Stop DMA in case of failures on ravb_open() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 077/107] net: ravb: Keep reverse order of operations in ravb_remove() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 078/107] KVM: x86: Fix lapic timer interrupt lost after loading a snapshot Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 079/107] PCI: Lengthen reset delay for VideoPropulsion Torrent QN16e card Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 080/107] powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping for SR-IOV device Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 081/107] s390/cmma: fix handling of swapper_pg_dir and invalid_pg_dir Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 082/107] PCI: qcom-ep: Add dedicated callback for writing to DBI2 registers Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 083/107] fbdev: stifb: Make the STI next font pointer a 32-bit signed offset Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 084/107] drivers: perf: Check find_first_bit() return value Greg Kroah-Hartman
2023-12-05 10:46 ` Conor Dooley
2023-12-05 18:25 ` Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 085/107] spi: Fix null dereference on suspend Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 086/107] drm/amd/display: Restore rptr/wptr for DMCUB as workaround Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 087/107] drm/amd/display: Guard against invalid RPTR/WPTR being set Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 088/107] cpufreq: imx6q: dont warn for disabling a non-existing frequency Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 089/107] cpufreq: imx6q: Dont disable 792 Mhz OPP unnecessarily Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 090/107] iommu/vt-d: Omit devTLB invalidation requests when TES=0 Greg Kroah-Hartman
2023-12-05 3:17 ` Greg Kroah-Hartman [this message]
2023-12-05 3:17 ` [PATCH 6.1 092/107] iommu/vt-d: Add device_block_translation() helper Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 093/107] iommu/vt-d: Disable PCI ATS in legacy passthrough mode Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 094/107] iommu/vt-d: Make context clearing consistent with context mapping Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 095/107] drm/amd/pm: fix a memleak in aldebaran_tables_init Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 096/107] mmc: core: add helpers mmc_regulator_enable/disable_vqmmc Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 097/107] mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 098/107] drm/amd/display: Expand kernel doc for DC Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 099/107] drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 100/107] drm/amd/display: Fix the delta clamping for shaper LUT Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 101/107] drm/amd/display: Fix MPCC 1DLUT programming Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 102/107] r8169: disable ASPM in case of tx timeout Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 103/107] r8169: fix deadlock on RTL8125 in jumbo mtu mode Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 104/107] xen: Allow platform PCI interrupt to be shared Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 105/107] xen: simplify evtchn_do_upcall() call maze Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 106/107] x86/xen: fix percpu vcpu_info allocation Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 107/107] x86/apic/msi: Fix misconfigured non-maskable MSI quirk Greg Kroah-Hartman
2023-12-05 10:35 ` [PATCH 6.1 000/107] 6.1.66-rc1 review Pavel Machek
2023-12-05 10:47 ` Conor Dooley
2023-12-05 11:10 ` Jon Hunter
2023-12-05 16:21 ` Naresh Kamboju
2023-12-05 18:26 ` Greg Kroah-Hartman
2023-12-05 16:55 ` Guenter Roeck
2023-12-05 17:09 ` SeongJae Park
2023-12-05 18:35 ` Florian Fainelli
2023-12-06 1:42 ` Shuah Khan
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=20231205031537.381772322@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=baolu.lu@linux.intel.com \
--cc=jroedel@suse.de \
--cc=kevin.tian@intel.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/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