From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Megha Dey <megha.dey@linux.intel.com>, Dan Carpenter <dan.carpenter@oracle.com>, Lu Baolu <baolu.lu@linux.intel.com>, Joerg Roedel <jroedel@suse.de>, Sasha Levin <sashal@kernel.org>, iommu@lists.linux-foundation.org Subject: [PATCH AUTOSEL 5.4 73/73] iommu/vt-d: Populate debugfs if IOMMUs are detected Date: Wed, 18 Mar 2020 16:53:37 -0400 [thread overview] Message-ID: <20200318205337.16279-73-sashal@kernel.org> (raw) In-Reply-To: <20200318205337.16279-1-sashal@kernel.org> From: Megha Dey <megha.dey@linux.intel.com> [ Upstream commit 1da8347d8505c137fb07ff06bbcd3f2bf37409bc ] Currently, the intel iommu debugfs directory(/sys/kernel/debug/iommu/intel) gets populated only when DMA remapping is enabled (dmar_disabled = 0) irrespective of whether interrupt remapping is enabled or not. Instead, populate the intel iommu debugfs directory if any IOMMUs are detected. Cc: Dan Carpenter <dan.carpenter@oracle.com> Fixes: ee2636b8670b1 ("iommu/vt-d: Enable base Intel IOMMU debugfs support") Signed-off-by: Megha Dey <megha.dey@linux.intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/iommu/intel-iommu-debugfs.c | 11 ++++++++++- drivers/iommu/intel-iommu.c | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c index 80378c10dd77a..bdf095e9dbe03 100644 --- a/drivers/iommu/intel-iommu-debugfs.c +++ b/drivers/iommu/intel-iommu-debugfs.c @@ -281,9 +281,16 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused) { struct dmar_drhd_unit *drhd; struct intel_iommu *iommu; + u32 sts; rcu_read_lock(); for_each_active_iommu(iommu, drhd) { + sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); + if (!(sts & DMA_GSTS_TES)) { + seq_printf(m, "DMA Remapping is not enabled on %s\n", + iommu->name); + continue; + } root_tbl_walk(m, iommu); seq_putc(m, '\n'); } @@ -353,6 +360,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) struct dmar_drhd_unit *drhd; struct intel_iommu *iommu; u64 irta; + u32 sts; rcu_read_lock(); for_each_active_iommu(iommu, drhd) { @@ -362,7 +370,8 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) seq_printf(m, "Remapped Interrupt supported on IOMMU: %s\n", iommu->name); - if (iommu->ir_table) { + sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); + if (iommu->ir_table && (sts & DMA_GSTS_IRES)) { irta = virt_to_phys(iommu->ir_table->base); seq_printf(m, " IR table address:%llx\n", irta); ir_tbl_remap_entry_show(m, iommu); diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index be39363244389..ef38e98b5bceb 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -4961,6 +4961,9 @@ int __init intel_iommu_init(void) down_write(&dmar_global_lock); + if (!no_iommu) + intel_iommu_debugfs_init(); + if (no_iommu || dmar_disabled) { /* * We exit the function here to ensure IOMMU's remapping and @@ -5056,7 +5059,6 @@ int __init intel_iommu_init(void) pr_info("Intel(R) Virtualization Technology for Directed I/O\n"); intel_iommu_enabled = 1; - intel_iommu_debugfs_init(); return 0; -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sasha Levin <sashal@kernel.org>, Joerg Roedel <jroedel@suse.de>, iommu@lists.linux-foundation.org, Megha Dey <megha.dey@linux.intel.com>, Dan Carpenter <dan.carpenter@oracle.com> Subject: [PATCH AUTOSEL 5.4 73/73] iommu/vt-d: Populate debugfs if IOMMUs are detected Date: Wed, 18 Mar 2020 16:53:37 -0400 [thread overview] Message-ID: <20200318205337.16279-73-sashal@kernel.org> (raw) In-Reply-To: <20200318205337.16279-1-sashal@kernel.org> From: Megha Dey <megha.dey@linux.intel.com> [ Upstream commit 1da8347d8505c137fb07ff06bbcd3f2bf37409bc ] Currently, the intel iommu debugfs directory(/sys/kernel/debug/iommu/intel) gets populated only when DMA remapping is enabled (dmar_disabled = 0) irrespective of whether interrupt remapping is enabled or not. Instead, populate the intel iommu debugfs directory if any IOMMUs are detected. Cc: Dan Carpenter <dan.carpenter@oracle.com> Fixes: ee2636b8670b1 ("iommu/vt-d: Enable base Intel IOMMU debugfs support") Signed-off-by: Megha Dey <megha.dey@linux.intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/iommu/intel-iommu-debugfs.c | 11 ++++++++++- drivers/iommu/intel-iommu.c | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c index 80378c10dd77a..bdf095e9dbe03 100644 --- a/drivers/iommu/intel-iommu-debugfs.c +++ b/drivers/iommu/intel-iommu-debugfs.c @@ -281,9 +281,16 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused) { struct dmar_drhd_unit *drhd; struct intel_iommu *iommu; + u32 sts; rcu_read_lock(); for_each_active_iommu(iommu, drhd) { + sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); + if (!(sts & DMA_GSTS_TES)) { + seq_printf(m, "DMA Remapping is not enabled on %s\n", + iommu->name); + continue; + } root_tbl_walk(m, iommu); seq_putc(m, '\n'); } @@ -353,6 +360,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) struct dmar_drhd_unit *drhd; struct intel_iommu *iommu; u64 irta; + u32 sts; rcu_read_lock(); for_each_active_iommu(iommu, drhd) { @@ -362,7 +370,8 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) seq_printf(m, "Remapped Interrupt supported on IOMMU: %s\n", iommu->name); - if (iommu->ir_table) { + sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); + if (iommu->ir_table && (sts & DMA_GSTS_IRES)) { irta = virt_to_phys(iommu->ir_table->base); seq_printf(m, " IR table address:%llx\n", irta); ir_tbl_remap_entry_show(m, iommu); diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index be39363244389..ef38e98b5bceb 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -4961,6 +4961,9 @@ int __init intel_iommu_init(void) down_write(&dmar_global_lock); + if (!no_iommu) + intel_iommu_debugfs_init(); + if (no_iommu || dmar_disabled) { /* * We exit the function here to ensure IOMMU's remapping and @@ -5056,7 +5059,6 @@ int __init intel_iommu_init(void) pr_info("Intel(R) Virtualization Technology for Directed I/O\n"); intel_iommu_enabled = 1; - intel_iommu_debugfs_init(); return 0; -- 2.20.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2020-03-18 20:55 UTC|newest] Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-18 20:52 [PATCH AUTOSEL 5.4 01/73] cgroup-v1: cgroup_pidlist_next should update position index Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 02/73] cgroup: Iterate tasks that did not finish do_exit() Sasha Levin 2020-03-18 20:52 ` Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 03/73] clk: imx8mn: Fix incorrect clock defines Sasha Levin 2020-03-18 20:52 ` Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 04/73] batman-adv: Don't schedule OGM for disabled interface Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 05/73] pinctrl: meson-gxl: fix GPIOX sdio pins Sasha Levin 2020-03-18 20:52 ` Sasha Levin 2020-03-18 20:52 ` Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 06/73] pinctrl: imx: scu: Align imx sc msg structs to 4 Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 07/73] nfs: add minor version to nfs_server_key for fscache Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 08/73] pinctrl: core: Remove extra kref_get which blocks hogs being freed Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 09/73] r8152: check disconnect status after long sleep Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 10/73] net: dsa: mv88e6xxx: fix lockup on warm boot Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 11/73] net: phy: avoid clearing PHY interrupts twice in irq handler Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 12/73] bnxt_en: reinitialize IRQs when MTU is modified Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 13/73] bnxt_en: fix error handling when flashing from file Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 14/73] cpupower: avoid multiple definition with gcc -fno-common Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 15/73] fib: add missing attribute validation for tun_id Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 16/73] can: add missing attribute validation for termination Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 17/73] macsec: add missing attribute validation for port Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 18/73] team: add missing attribute validation for port ifindex Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 19/73] team: add missing attribute validation for array index Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 20/73] netfilter: cthelper: add missing attribute validation for cthelper Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 21/73] netfilter: nft_payload: add missing attribute validation for payload csum flags Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 22/73] netfilter: nft_tunnel: add missing attribute validation for tunnels Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 23/73] net: phy: bcm63xx: fix OOPS due to missing driver name Sasha Levin 2020-03-18 20:52 ` Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 24/73] drivers/of/of_mdio.c:fix of_mdiobus_register() Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 25/73] cgroup1: don't call release_agent when it is "" Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 26/73] netfilter: nf_tables: dump NFTA_CHAIN_FLAGS attribute Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 27/73] netfilter: nf_tables: fix infinite loop when expr is not available Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 28/73] slip: make slhc_compress() more robust against malicious packets Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 29/73] net: hns3: fix a not link up issue when fibre port supports autoneg Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 30/73] futex: Fix inode life-time issue Sasha Levin 2020-03-23 19:18 ` Jann Horn 2020-03-24 8:06 ` Greg Kroah-Hartman 2020-04-08 9:48 ` backport request for 3.16 [was: Re: [PATCH AUTOSEL 5.4 30/73] futex: Fix inode life-time issue] Jann Horn 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 31/73] netfilter: nft_chain_nat: inet family is missing module ownership Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 32/73] dt-bindings: net: FMan erratum A050385 Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 33/73] arm64: dts: ls1043a: " Sasha Levin 2020-03-18 20:52 ` Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 34/73] fsl/fman: detect " Sasha Levin 2020-03-18 20:52 ` [PATCH AUTOSEL 5.4 35/73] bonding/alb: make sure arp header is pulled before accessing it Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 36/73] virtio_ring: Fix mem leak with vring_new_virtqueue() Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 37/73] virtio-blk: fix hw_queue stopped on arbitrary error Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 38/73] virtio_balloon: Adjust label in virtballoon_probe Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 39/73] ipvlan: do not add hardware address of master to its unicast filter list Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 40/73] net: stmmac: dwmac1000: Disable ACS if enhanced descs are not used Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 41/73] drm/amd/display: update soc bb for nv14 Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 42/73] drm/amdgpu: correct ROM_INDEX/DATA offset for VEGA20 Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 43/73] futex: Unbreak futex hashing Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 44/73] ipvlan: don't deref eth hdr before checking it's set Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 45/73] ipvlan: add cond_resched_rcu() while processing muticast backlog Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 46/73] macvlan: add cond_resched() during multicast processing Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 47/73] ipvlan: do not use cond_resched_rcu() in ipvlan_process_multicast() Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 48/73] drm/exynos: Fix cleanup of IOMMU related objects Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 49/73] i2c: i801: Do not add ICH_RES_IO_SMI for the iTCO_wdt device Sasha Levin 2020-03-19 7:30 ` Wolfram Sang 2020-03-29 20:07 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 50/73] iommu/vt-d: Fix RCU-list bugs in intel_iommu_init() Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 51/73] iommu/vt-d: Silence RCU-list debugging warnings Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 52/73] i2c: gpio: suppress error on probe defer Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 53/73] s390/qeth: don't reset default_out_queue Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 54/73] s390/qeth: handle error when backing RX buffer Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 55/73] scsi: ipr: Fix softlockup when rescanning devices in petitboot Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 56/73] nl80211: add missing attribute validation for critical protocol indication Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 57/73] nl80211: add missing attribute validation for beacon report scanning Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 58/73] nl80211: add missing attribute validation for channel switch Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 59/73] mac80211: Do not send mesh HWMP PREQ if HWMP is disabled Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 60/73] driver code: clarify and fix platform device DMA mask allocation Sasha Levin 2020-03-19 6:49 ` Greg Kroah-Hartman 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 61/73] dpaa_eth: Remove unnecessary boolean expression in dpaa_get_headroom Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 62/73] net: fec: validate the new settings in fec_enet_set_coalesce() Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 63/73] sxgbe: Fix off by one in samsung driver strncpy size arg Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 64/73] net: mvmdio: avoid error message for optional IRQ Sasha Levin 2020-03-18 20:57 ` Chris Packham 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 65/73] net: hns3: fix "tc qdisc del" failed issue Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 66/73] net: systemport: fix index check to avoid an array out of bounds access Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 67/73] iommu/vt-d: quirk_ioat_snb_local_iommu: replace WARN_TAINT with pr_warn + add_taint Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 68/73] iommu/vt-d: Fix debugfs register reads Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 69/73] i2c: acpi: put device when verifying client fails Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 70/73] iommu/vt-d: Fix the wrong printing in RHSA parsing Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 71/73] iommu/vt-d: Ignore devices with out-of-spec domain number Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 72/73] iommu/amd: Fix IOMMU AVIC not properly update the is_run bit in IRTE Sasha Levin 2020-03-18 20:53 ` Sasha Levin 2020-03-18 20:53 ` Sasha Levin [this message] 2020-03-18 20:53 ` [PATCH AUTOSEL 5.4 73/73] iommu/vt-d: Populate debugfs if IOMMUs are detected Sasha Levin
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=20200318205337.16279-73-sashal@kernel.org \ --to=sashal@kernel.org \ --cc=baolu.lu@linux.intel.com \ --cc=dan.carpenter@oracle.com \ --cc=iommu@lists.linux-foundation.org \ --cc=jroedel@suse.de \ --cc=linux-kernel@vger.kernel.org \ --cc=megha.dey@linux.intel.com \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.