LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Linux IOMMU <iommu@lists.linux-foundation.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	suravee.suthikulpanit@amd.com, baolu.lu@linux.intel.com,
	John Garry <john.garry@huawei.com>,
	Doug Anderson <dianders@chromium.org>,
	rajatja@google.com, chenxiang <chenxiang66@hisilicon.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v4 15/24] iommu/io-pgtable: Remove non-strict quirk
Date: Tue, 24 Aug 2021 15:25:38 +0200	[thread overview]
Message-ID: <CAMuHMdX+VSr0TJabMBNqob0MkD2o0RBNp8E5QYNx0jFucW1Aew@mail.gmail.com> (raw)
In-Reply-To: <155b5c621cd8936472e273a8b07a182f62c6c20d.1628682049.git.robin.murphy@arm.com>

Hi Robin,

On Wed, Aug 11, 2021 at 2:24 PM Robin Murphy <robin.murphy@arm.com> wrote:
> IO_PGTABLE_QUIRK_NON_STRICT was never a very comfortable fit, since it's
> not a quirk of the pagetable format itself. Now that we have a more
> appropriate way to convey non-strict unmaps, though, this last of the
> non-quirk quirks can also go, and with the flush queue code also now
> enforcing its own ordering we can have a lovely cleanup all round.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Thanks for your patch, which is now commit a8e5f04458c4e496
("iommu/io-pgtable: Remove non-strict quirk") in iommu/next.

> --- a/drivers/iommu/io-pgtable-arm-v7s.c
> +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> @@ -700,14 +700,7 @@ static size_t __arm_v7s_unmap(struct arm_v7s_io_pgtable *data,
>                                                 ARM_V7S_BLOCK_SIZE(lvl + 1));
>                                 ptep = iopte_deref(pte[i], lvl, data);
>                                 __arm_v7s_free_table(ptep, lvl + 1, data);
> -                       } else if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT) {
> -                               /*
> -                                * Order the PTE update against queueing the IOVA, to
> -                                * guarantee that a flush callback from a different CPU
> -                                * has observed it before the TLBIALL can be issued.
> -                                */
> -                               smp_wmb();
> -                       } else {
> +                       } else if (!gather->queued) {

If CONFIG_IOMMU_API=n:

error: ‘struct iommu_iotlb_gather’ has no member named ‘queued’

This can be reproduced using e.g. shmobile_defconfig with
    CONFIG_IOMMU_SUPPORT=y
    CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y


>                                 io_pgtable_tlb_add_page(iop, gather, iova, blk_size);
>                         }
>                         iova += blk_size;

> --- a/drivers/iommu/io-pgtable-arm.c
> +++ b/drivers/iommu/io-pgtable-arm.c
> @@ -638,14 +638,7 @@ static size_t __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
>                                 io_pgtable_tlb_flush_walk(iop, iova + i * size, size,
>                                                           ARM_LPAE_GRANULE(data));
>                                 __arm_lpae_free_pgtable(data, lvl + 1, iopte_deref(pte, data));
> -                       } else if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT) {
> -                               /*
> -                                * Order the PTE update against queueing the IOVA, to
> -                                * guarantee that a flush callback from a different CPU
> -                                * has observed it before the TLBIALL can be issued.
> -                                */
> -                               smp_wmb();
> -                       } else {
> +                       } else if (!gather->queued) {

If CONFIG_IOMMU_API=n:

error: ‘struct iommu_iotlb_gather’ has no member named ‘queued’

This can be reproduced using e.g. shmobile_defconfig with
    CONFIG_IOMMU_SUPPORT=y
    CONFIG_IOMMU_IO_PGTABLE_LPAE=y

>                                 io_pgtable_tlb_add_page(iop, gather, iova + i * size, size);
>                         }
>

Perhaps "select IOMMU_API" should be added (moved from individual
drivers) to both IOMMU_IO_PGTABLE_ARMV7S and IOMMU_IO_PGTABLE_LPAE?
Or iommu_iotlb_gather.queued should not be accessed here, or the
access wrapped into a static inline helper function with a dummy for
the CONFIG_IOMMU_API=n case?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2021-08-24 13:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 12:21 [PATCH v4 00/24] iommu: Refactor DMA domain strictness Robin Murphy
2021-08-11 12:21 ` [PATCH v4 01/24] iommu: Pull IOVA cookie management into the core Robin Murphy
2021-08-11 12:21 ` [PATCH v4 02/24] iommu/amd: Drop IOVA cookie management Robin Murphy
2021-08-11 12:21 ` [PATCH v4 03/24] iommu/arm-smmu: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 04/24] iommu/vt-d: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 05/24] iommu/exynos: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 06/24] iommu/ipmmu-vmsa: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 07/24] iommu/mtk: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 08/24] iommu/rockchip: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 09/24] iommu/sprd: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 10/24] iommu/sun50i: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 11/24] iommu/virtio: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 12/24] iommu/dma: Unexport " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 13/24] iommu/dma: Remove redundant "!dev" checks Robin Murphy
2021-08-11 12:21 ` [PATCH v4 14/24] iommu: Indicate queued flushes via gather data Robin Murphy
2021-08-11 12:21 ` [PATCH v4 15/24] iommu/io-pgtable: Remove non-strict quirk Robin Murphy
2021-08-24 13:25   ` Geert Uytterhoeven [this message]
2021-08-24 13:46     ` Robin Murphy
2021-08-11 12:21 ` [PATCH v4 16/24] iommu: Introduce explicit type for non-strict DMA domains Robin Murphy
2021-08-11 12:21 ` [PATCH v4 17/24] iommu/amd: Prepare for multiple DMA domain types Robin Murphy
2021-08-11 12:21 ` [PATCH v4 18/24] iommu/arm-smmu: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 19/24] iommu/vt-d: " Robin Murphy
2021-08-11 12:21 ` [PATCH v4 20/24] iommu: Express DMA strictness via the domain type Robin Murphy
2021-08-11 12:21 ` [PATCH v4 21/24] iommu: Expose DMA domain strictness via sysfs Robin Murphy
2021-08-11 12:21 ` [PATCH v4 22/24] iommu: Only log strictness for DMA domains Robin Murphy
2021-08-11 12:21 ` [PATCH v4 23/24] iommu: Merge strictness and domain type configs Robin Murphy
2021-08-11 12:21 ` [PATCH v4 24/24] iommu: Allow enabling non-strict mode dynamically Robin Murphy
2021-08-18 11:29 ` [PATCH v4 00/24] iommu: Refactor DMA domain strictness Joerg Roedel
2021-08-18 15:13   ` Robin Murphy
2021-08-21  8:55     ` Sven Peter

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=CAMuHMdX+VSr0TJabMBNqob0MkD2o0RBNp8E5QYNx0jFucW1Aew@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=dianders@chromium.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=john.garry@huawei.com \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=rajatja@google.com \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).