Thanks a lot Dan for testing Ritesh's patch.

@Ritesh, I need to test the 2 scenarios for which I sent the first patch,

Thanks,

Gaurav

On 3/26/26 5:38 AM, Ritesh Harjani (IBM) wrote:
Dan Horák <[email protected]> writes:

Hi Ritesh,

On Wed, 25 Mar 2026 23:12:16 +0530
Ritesh Harjani (IBM) <[email protected]> wrote:

Gaurav Batra <[email protected]> writes:

Hello Ritesh

I think, what you are proposing to add dev->bus_dma_limit in the check
might work. In the case of PowerNV, this is not set, but
dev->dma_ops_bypass is set. So, for PowerNV, it will fall back to how it
was before.

Also, since these both are set in LPAR mode, the current patch as-is
will work.

Dan, can you please try Ritesh proposed fix on your PowerNV box? I am
not able to lay my hands on a PowerNV box yet.

It would be this diff then. Note, I have only compile tested it.

diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 73e10bd4d56d..8b4de508d2eb 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -67,7 +67,7 @@ bool arch_dma_unmap_sg_direct(struct device *dev, struct 
scatterlist *sg,
  }
  bool arch_dma_alloc_direct(struct device *dev)
  {
-       if (dev->dma_ops_bypass)
+       if (dev->dma_ops_bypass && dev->bus_dma_limit)
                 return true;

         return false;
@@ -75,7 +75,7 @@ bool arch_dma_alloc_direct(struct device *dev)

  bool arch_dma_free_direct(struct device *dev, dma_addr_t dma_handle)
  {
-       if (!dev->dma_ops_bypass)
+       if (!dev->dma_ops_bypass || !dev->bus_dma_limit)
                 return false;

         return is_direct_handle(dev, dma_handle);
this seems to fix the amdgpu initialization, full kernel log available
as https://fedora.danny.cz/tmp/kernel-7.0-rc5.log

Tested-by: Dan Horák <[email protected]>

Thanks a lot Dan!

@Gaurav,
In that case, please feel free to take the diff and submit an official
patch (if you think this looks good for all cases). You might want to
test your previous usecase once, so that we don't see any new surprises
there :)

-ritesh

Reply via email to