Re: Problems using AMD eMMC with AMD IOMMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So with the following CLs + the fix for the ACPI name matching:
f9d9f441a7a Revert "iommu/amd: Convert AMD iommu driver to the dma-iommu api"
f3ed2aa65e67 Revert "iommu: amd: Use generic_iommu_put_resv_regions()"
47cf1b422e60 (origin/master) Merge branch 'for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Everything works correctly.

Here is the trace for the working scenario: https://0paste.com/66921

The big difference is the 32 bit address vs the 64 bit address.

Without be62dbf554c5 we get the following: adma_addr:
0x00000000fffff200. While with it we get 0xfffffffffffff200

I tried adding SDHCI_QUIRK2_BROKEN_64_BIT_DMA to
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/third_party/kernel/v5.4/drivers/mmc/host/sdhci-acpi.c;l=607
and it worked!

So it looks like be62dbf554c5 made it so it starts honoring
`dma_set_mask_and_coherent`. This exposed a hardware quirk that was
missing.

I'll get some patches pushed up.

On Fri, May 8, 2020 at 3:09 PM Raul Rangel <rrangel@xxxxxxxxxxxx> wrote:
>
> > > > Two possibilities:
> > > >
> > > >         1) Please try the 5 patches from this branch:
> > > >            https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git/log/?h=iommu/fixes
> > > >
> > > >            The fix some race-condition issues, I think it is unlikely
> > > >            you hit them, but it is worth a test.
> > > >
> > > >         2) Dma-iommu code does sg-merging, which the previous DMA-API
> > > >            implementation did not. Can you try attached diff from Robin
> > > >            Murphy to disable sg-merging? It that helps it is an issue in
> > > >            the eMMC driver.
> > > >
> > > > Regards,
> > > >
> > > >         Joerg
> > > >
> > > > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> > > > index a2e96a5fd9a7..a6b71bad518e 100644
> > > > --- a/drivers/iommu/dma-iommu.c
> > > > +++ b/drivers/iommu/dma-iommu.c
> > > > @@ -779,7 +779,7 @@ static int __finalise_sg(struct device *dev, struct
> > > > scatterlist *sg, int nents,
> > > >                  * - but doesn't fall at a segment boundary
> > > >                  * - and wouldn't make the resulting output segment too long
> > > >                  */
> > > > -               if (cur_len && !s_iova_off && (dma_addr & seg_mask) &&
> > > > +               if (0 && cur_len && !s_iova_off && (dma_addr & seg_mask) &&
> > > >                     (max_len - cur_len >= s_length)) {
> > > >                         /* ...then concatenate it with the previous one */
> > > >                         cur_len += s_length;
> > > > @@ -799,6 +799,7 @@ static int __finalise_sg(struct device *dev, struct
> > > > scatterlist *sg, int nents,
> > > >                 if (s_length + s_iova_off < s_iova_len)
> > > >                         cur_len = 0;
> > > >         }
> > > > +       WARN_ON(count < nents);
> > > >         return count;
> > > >   }
>
> So I tried the 5 patches you listed in 1, and the patch in 2. It still
> results in the same failure.
>
> Here is a cleaner link to the trace: https://0paste.com/66912
>
> It's pretty straight forward:
>
>  0)               |        /* iommu_dma_alloc: sdhci-acpi AMDI0040:00:
> size: 3596 */
>  0)               |                              /* iommu_dma_map_sg:
> sdhci-acpi AMDI0040:00: nents: 1 */
>  0)               |                            /* sdhci_set_adma_addr:
> dma_addr: 0xfffffffffffff200 */
>  0)               |      sdhci_adma_show_error() {
>
>
> I'm going to try reverting be62dbf554c5 now that we know why the ACPI
> matching wasn't working.



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux