mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonas Karlman <jonas@kwiboo.se>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Heiko Stuebner <heiko@sntech.de>
Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Jonas Karlman <jonas@kwiboo.se>
Subject: [PATCH v3 0/2] iommu: rockchip: Fix directory table address encoding
Date: Sat, 17 Jun 2023 18:25:44 +0000 (UTC)	[thread overview]
Message-ID: <20230617182540.3091374-1-jonas@kwiboo.se> (raw)

The address to the directory table is currently encoded using an
incorrect bit layout when configured into the DTE_ADDR reg on IOMMU v2.

This currently do not cause any issue because the directory and page
tables is allocated in memory below 4GB thanks to the use of the
GFP_DMA32 flag.

Testing has shown that the directory table address should be encoded
using the same bit layout as the page table and memory page addresses.

Only removing the GFP_DMA32 on a RK3568 device with 8GB of memory will
result in a page fault similar to:

[    0.907236] rk_iommu fe043e00.iommu: Page fault at 0x00000000ff801000 of type read
[    0.907264] rk_iommu fe043e00.iommu: iova = 0x00000000ff801000: dte_index: 0x3fe pte_index: 0x1 page_offset: 0x0
[    0.907281] rk_iommu fe043e00.iommu: mmu_dte_addr: 0x000000010189a000 dte@0x000000010189aff8: 0x1722101 valid: 1 pte@0x0000000101722004: 0x2c01107 valid: 1 page@0x0000000102c01000 flags: 0x106

This series fixes this by using the existing mk_dtentries instead of the
dma_addr_dte ops to encode the directory table address, removes unused
ops and finally removes the GFP_DMA32 flag to allow for directory and
page tables to be allocated in memory above 4GB on IOMMU v2.

Changes in v3:
- merge patch 1 and 2
- only remove GFP_DMA32 flag for IOMMU v2

Changes in v2:
- no changes, rebased on next-20230615

This series can also be found at [1].

[1] https://github.com/Kwiboo/linux-rockchip/commits/next-20230616-iommu

Jonas Karlman (2):
  iommu: rockchip: Fix directory table address encoding
  iommu: rockchip: Allocate tables from all available memory for IOMMU
    v2

 drivers/iommu/rockchip-iommu.c | 50 +++++++---------------------------
 1 file changed, 10 insertions(+), 40 deletions(-)

-- 
2.40.1


             reply	other threads:[~2023-06-17 18:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17 18:25 Jonas Karlman [this message]
2023-06-17 18:25 ` [PATCH v3 1/2] " Jonas Karlman
2023-06-19 14:32   ` Robin Murphy
2023-06-17 18:25 ` [PATCH v3 2/2] iommu: rockchip: Allocate tables from all available memory for IOMMU v2 Jonas Karlman
2023-06-19 14:51   ` Robin Murphy
2023-07-14 14:18 ` [PATCH v3 0/2] iommu: rockchip: Fix directory table address encoding Joerg Roedel

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=20230617182540.3091374-1-jonas@kwiboo.se \
    --to=jonas@kwiboo.se \
    --cc=benjamin.gaignard@collabora.com \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=robin.murphy@arm.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

all inboxes | Powered by JetHome®