The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* RE: [PATCH rc v4 2/5] iommu/arm-smmu-v3: Implement is_attach_deferred() for kdump
       [not found] ` <1d339a2353e9793c46853192a93d28fd7caac4a1.1777446969.git.nicolinc@nvidia.com>
@ 2026-05-08  7:39   ` Tian, Kevin
  0 siblings, 0 replies; 6+ messages in thread
From: Tian, Kevin @ 2026-05-08  7:39 UTC (permalink / raw)
  To: Nicolin Chen, will@kernel.org, robin.murphy@arm.com,
	jgg@nvidia.com
  Cc: joro@8bytes.org, praan@google.com, kees@kernel.org,
	baolu.lu@linux.intel.com, miko.lenczewski@arm.com,
	smostafa@google.com, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, jamien@nvidia.com

> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Wednesday, April 29, 2026 3:21 PM
> 
> Though the kdump kernel adopts the crashed kernel's stream table, the
> iommu
> core will still try to attach each probed device to a default domain, which
> overwrites the adopted STE and breaks in-flight DMA from that device.
> 
> Implement an is_attach_deferred() callback to prevent this. For each device
> that has STE.V=1 and STE.Cfg!=Abort in the adopted table, defer the default
> domain attachment, until the device driver explicitly requests it.
> 
> Fixes: b63b3439b856 ("iommu/arm-smmu-v3: Abort all transactions if SMMU
> is enabled in kdump kernel")
> Cc: stable@vger.kernel.org # v6.12+
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH rc v4 3/5] iommu/arm-smmu-v3: Skip EVTQ/PRIQ setup in kdump kernel
       [not found] ` <25398d02373e7592d0555e7da9dbf33b3e83983a.1777446969.git.nicolinc@nvidia.com>
@ 2026-05-08  7:41   ` Tian, Kevin
  2026-05-09  7:44     ` Nicolin Chen
  0 siblings, 1 reply; 6+ messages in thread
From: Tian, Kevin @ 2026-05-08  7:41 UTC (permalink / raw)
  To: Nicolin Chen, will@kernel.org, robin.murphy@arm.com,
	jgg@nvidia.com
  Cc: joro@8bytes.org, praan@google.com, kees@kernel.org,
	baolu.lu@linux.intel.com, miko.lenczewski@arm.com,
	smostafa@google.com, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, jamien@nvidia.com

> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Wednesday, April 29, 2026 3:21 PM
> 
> In kdump cases, the crashed kernel's CDs and page tables can be corrupted,
> which could trigger event spamming. Also, we cannot serve page requests.
> 
> Skip the EVTQ/PRIQ setup entirely rather than enabling then disabling them.

this is a refactoring to achieve the same goal as before...

> 
> Skip the IRQ setup and guard their thread functions as well.

... while this sounds a new enforcement (then better in a separate patch?)

> 
> Also add some inline comments explaining that.
> 
> Fixes: b63b3439b856 ("iommu/arm-smmu-v3: Abort all transactions if SMMU
> is enabled in kdump kernel")
> Cc: stable@vger.kernel.org # v6.12+
> Suggested-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>

Overall it looks good:

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH rc v4 4/5] iommu/arm-smmu-v3: Retain CR0_SMMUEN during kdump device reset
       [not found] ` <38bbcaae651ccc3adcc78e232bdb5ce217c86693.1777446969.git.nicolinc@nvidia.com>
@ 2026-05-08  7:43   ` Tian, Kevin
  0 siblings, 0 replies; 6+ messages in thread
From: Tian, Kevin @ 2026-05-08  7:43 UTC (permalink / raw)
  To: Nicolin Chen, will@kernel.org, robin.murphy@arm.com,
	jgg@nvidia.com
  Cc: joro@8bytes.org, praan@google.com, kees@kernel.org,
	baolu.lu@linux.intel.com, miko.lenczewski@arm.com,
	smostafa@google.com, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, jamien@nvidia.com

> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Wednesday, April 29, 2026 3:21 PM
> 
> When ARM_SMMU_OPT_KDUMP_ADOPT is detected, do not disable
> SMMUEN and skip
> the CR1/CR2/STRTAB_BASE update sequence in arm_smmu_device_reset().
> Those
> register writes are all CONSTRAINED UNPREDICTABLE while
> CR0_SMMUEN==1, so
> leaving them intact lets in-flight DMAs continue to be translated by the
> adopted stream table.
> 
> Initialize 'enables' to 0 so it can carry CR0_SMMUEN in kdump case. Then,
> preserve that when enabling the command queue.
> 
> Clear latched gerror bits if necessary.
> 
> Fixes: b63b3439b856 ("iommu/arm-smmu-v3: Abort all transactions if SMMU
> is enabled in kdump kernel")
> Cc: stable@vger.kernel.org # v6.12+
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH rc v4 5/5] iommu/arm-smmu-v3: Detect ARM_SMMU_OPT_KDUMP_ADOPT in probe()
       [not found] ` <bb1aa2d0d1fabadb76dfef9ea9cf44f4a96c65be.1777446969.git.nicolinc@nvidia.com>
@ 2026-05-08  7:47   ` Tian, Kevin
  2026-05-09  7:53     ` Nicolin Chen
  0 siblings, 1 reply; 6+ messages in thread
From: Tian, Kevin @ 2026-05-08  7:47 UTC (permalink / raw)
  To: Nicolin Chen, will@kernel.org, robin.murphy@arm.com,
	jgg@nvidia.com
  Cc: joro@8bytes.org, praan@google.com, kees@kernel.org,
	baolu.lu@linux.intel.com, miko.lenczewski@arm.com,
	smostafa@google.com, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, jamien@nvidia.com

> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Wednesday, April 29, 2026 3:21 PM
> 
> arm_smmu_device_hw_probe() runs before arm_smmu_init_structures(), so
> it's
> natural to decide whether the kdump kernel must adopt the crashed kernel's
> stream table.
> 
> Given that memremap is used to adopt the old stream table, set this option
> only on a coherent SMMU.
> 
> And make sure SMMU isn't in Service Failure Mode.
> 
> Fixes: b63b3439b856 ("iommu/arm-smmu-v3: Abort all transactions if SMMU
> is enabled in kdump kernel")
> Cc: stable@vger.kernel.org # v6.12+
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>, with nits:

> 
> +static void arm_smmu_device_hw_probe_kdump(struct arm_smmu_device
> *smmu)
> +{
> +	u32 gerror, gerrorn, active;
> +
> +	/*
> +	 * If SMMU is already active in kdump case, there could be in-flight
> DMA
> +	 * from devices initiated by the crashed kernel.
> +	 */
> +	if (!(readl_relaxed(smmu->base + ARM_SMMU_CR0) &
> CR0_SMMUEN))
> +		return;

Above comment is for the entire function. for the check here the comment
should be that no in-fly DMA to require adoption due to SMMU disabled.

> +
> +	/* For now, only support a coherent SMMU that works with
> MEMREMAP_WB */
> +	if (!(smmu->features & ARM_SMMU_FEAT_COHERENCY)) {
> +		dev_warn(smmu->dev,
> +			 "kdump: non-coherent SMMU can't adopt stream
> table\n");

"can't adopt stream table so SMMU will be reset to block all DMAs"


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH rc v4 3/5] iommu/arm-smmu-v3: Skip EVTQ/PRIQ setup in kdump kernel
  2026-05-08  7:41   ` [PATCH rc v4 3/5] iommu/arm-smmu-v3: Skip EVTQ/PRIQ setup in kdump kernel Tian, Kevin
@ 2026-05-09  7:44     ` Nicolin Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolin Chen @ 2026-05-09  7:44 UTC (permalink / raw)
  To: Tian, Kevin
  Cc: will@kernel.org, robin.murphy@arm.com, jgg@nvidia.com,
	joro@8bytes.org, praan@google.com, kees@kernel.org,
	baolu.lu@linux.intel.com, miko.lenczewski@arm.com,
	smostafa@google.com, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, jamien@nvidia.com

On Fri, May 08, 2026 at 07:41:20AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@nvidia.com>
> > Sent: Wednesday, April 29, 2026 3:21 PM
> > 
> > In kdump cases, the crashed kernel's CDs and page tables can be corrupted,
> > which could trigger event spamming. Also, we cannot serve page requests.
> > 
> > Skip the EVTQ/PRIQ setup entirely rather than enabling then disabling them.
> 
> this is a refactoring to achieve the same goal as before...
> 
> > 
> > Skip the IRQ setup and guard their thread functions as well.
> 
> ... while this sounds a new enforcement (then better in a separate patch?)

In v5, I split it into two patches and kept your Reviewed-by:
 - iommu/arm-smmu-v3: Skip EVTQ/PRIQ setup in kdump kernel
 - iommu/arm-smmu-v3: Suppress EVTQ/PRIQ events in kdump kernel

Thanks
Nicolin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH rc v4 5/5] iommu/arm-smmu-v3: Detect ARM_SMMU_OPT_KDUMP_ADOPT in probe()
  2026-05-08  7:47   ` [PATCH rc v4 5/5] iommu/arm-smmu-v3: Detect ARM_SMMU_OPT_KDUMP_ADOPT in probe() Tian, Kevin
@ 2026-05-09  7:53     ` Nicolin Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolin Chen @ 2026-05-09  7:53 UTC (permalink / raw)
  To: Tian, Kevin
  Cc: will@kernel.org, robin.murphy@arm.com, jgg@nvidia.com,
	joro@8bytes.org, praan@google.com, kees@kernel.org,
	baolu.lu@linux.intel.com, miko.lenczewski@arm.com,
	smostafa@google.com, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, jamien@nvidia.com

On Fri, May 08, 2026 at 07:47:22AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@nvidia.com>
> > +	/*
> > +	 * If SMMU is already active in kdump case, there could be in-flight
> > DMA
> > +	 * from devices initiated by the crashed kernel.
> > +	 */
> > +	if (!(readl_relaxed(smmu->base + ARM_SMMU_CR0) &
> > CR0_SMMUEN))
> > +		return;
> 
> Above comment is for the entire function. for the check here the comment
> should be that no in-fly DMA to require adoption due to SMMU disabled.

Changed it to:
	/* No adoption if SMMU is disabled (i.e., there is no in-flight DMA) */

> > +
> > +	/* For now, only support a coherent SMMU that works with
> > MEMREMAP_WB */
> > +	if (!(smmu->features & ARM_SMMU_FEAT_COHERENCY)) {
> > +		dev_warn(smmu->dev,
> > +			 "kdump: non-coherent SMMU can't adopt stream
> > table\n");
> 
> "can't adopt stream table so SMMU will be reset to block all DMAs"

That'd be a bit too long. So, I changed it to:
	"kdump: non-coherent SMMU unsupported; reset to block all DMAs\n");

Thanks
Nicolin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-09  7:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1777446969.git.nicolinc@nvidia.com>
     [not found] ` <1d339a2353e9793c46853192a93d28fd7caac4a1.1777446969.git.nicolinc@nvidia.com>
2026-05-08  7:39   ` [PATCH rc v4 2/5] iommu/arm-smmu-v3: Implement is_attach_deferred() for kdump Tian, Kevin
     [not found] ` <25398d02373e7592d0555e7da9dbf33b3e83983a.1777446969.git.nicolinc@nvidia.com>
2026-05-08  7:41   ` [PATCH rc v4 3/5] iommu/arm-smmu-v3: Skip EVTQ/PRIQ setup in kdump kernel Tian, Kevin
2026-05-09  7:44     ` Nicolin Chen
     [not found] ` <38bbcaae651ccc3adcc78e232bdb5ce217c86693.1777446969.git.nicolinc@nvidia.com>
2026-05-08  7:43   ` [PATCH rc v4 4/5] iommu/arm-smmu-v3: Retain CR0_SMMUEN during kdump device reset Tian, Kevin
     [not found] ` <bb1aa2d0d1fabadb76dfef9ea9cf44f4a96c65be.1777446969.git.nicolinc@nvidia.com>
2026-05-08  7:47   ` [PATCH rc v4 5/5] iommu/arm-smmu-v3: Detect ARM_SMMU_OPT_KDUMP_ADOPT in probe() Tian, Kevin
2026-05-09  7:53     ` Nicolin Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox