From: Bjorn Helgaas <helgaas@kernel.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Nishanth Menon" <nm@ti.com>,
"Santosh Shilimkar" <ssantosh@kernel.org>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Tero Kristo" <kristo@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
"Siddharth Vadapalli" <s-vadapalli@ti.com>,
"Bao Cheng Su" <baocheng.su@siemens.com>,
"Hua Qian Li" <huaqian.li@siemens.com>,
"Diogo Ivo" <diogo.ivo@siemens.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>
Subject: Re: [PATCH v4 4/7] PCI: keystone: Add supported for PVU-based DMA isolation on AM654
Date: Thu, 5 Sep 2024 14:16:35 -0500 [thread overview]
Message-ID: <20240905191635.GA395079@bhelgaas> (raw)
In-Reply-To: <35b5f0ff-50e7-42f9-8b66-b967476dd6c5@siemens.com>
On Thu, Sep 05, 2024 at 09:07:36PM +0200, Jan Kiszka wrote:
> On 05.09.24 18:33, Bjorn Helgaas wrote:
> > [+cc Kishon, just in case you have time/interest ;)]
> >
> > On Wed, Sep 04, 2024 at 12:00:13PM +0200, Jan Kiszka wrote:
> >> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>
> >> The AM654 lacks an IOMMU, thus does not support isolating DMA requests
> >> from untrusted PCI devices to selected memory regions this way. Use
> >> static PVU-based protection instead.
> >>
> >> For this, we use the availability of restricted-dma-pool memory regions
> >> as trigger and register those as valid DMA targets with the PVU.
> >
> > I guess the implication is that DMA *outside* the restricted-dma-pool
> > just gets dropped, and the Requester would see Completion Timeouts or
> > something for reads?
>
> I cannot tell what happens on the PCI bus in that case, maybe someone
> from TI can help out.
>
> On the host side, the PVU will record an error and raise an interrupt
> which will make the driver report that to the kernel log. That's quite
> similar to what IOMMU drivers do on translation faults.
The main thing is that the DMA doesn't complete, as you mentioned
below.
> > Since there's no explicit use of "restricted-dma-pool" elsewhere in
> > this patch, I assume the setup above causes the controller to drop any
> > DMA accesses outside that pool? I think a comment about how the
> > controller behavior is being changed would be useful. Basically the
> > same comment as for the commit log.
>
> Right, this is what will happen. Will add some comment.
>
> > Would there be any value in a dmesg note about a restriction being
> > enforced? Seems like it's dependent on both CONFIG_TI_PVU and some DT
> > properties, and since those are invisible in the log, maybe a note
> > would help understand/debug any issues?
>
> This is what you will see when there are reserved region and PVU in
> play:
>
> keystone-pcie 5600000.pcie: assigned reserved memory node restricted-dma@c0000000
> ti-pvu 30f80000.iommu: created TLB entry 0.2: 0xc0000000, psize 4 (0x02000000)
> ti-pvu 30f80000.iommu: created TLB entry 0.3: 0xc2000000, psize 4 (0x02000000)
> ...
> ath9k 0000:01:00.0: assigned reserved memory node restricted-dma@c0000000
Looks reasonable and solves my concern.
> >> + of_for_each_phandle(&it, err, pdev->dev.of_node, "memory-region",
> >> + NULL, 0) {
> >> + if (of_device_is_compatible(it.node, "restricted-dma-pool") &&
> >> + of_address_to_resource(it.node, 0, &phys) == 0)
> >> + ti_pvu_remove_region(KS_PCI_VIRTID, &phys);
> >
> > I guess it's not important to undo the PCIE_VMAP_xP_CTRL_EN and
> > related setup that was done by ks_init_restricted_dma()?
> >
>
> Right, I didn't find a reason to do that.
OK, as long as you considered it :)
Bjorn
next prev parent reply other threads:[~2024-09-05 19:16 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 10:00 [PATCH v4 0/7] soc: ti: Add and use PVU on K3-AM65 for DMA isolation Jan Kiszka
2024-09-04 10:00 ` [PATCH v4 1/7] dt-bindings: soc: ti: Add AM65 peripheral virtualization unit Jan Kiszka
2024-09-04 10:00 ` [PATCH v4 2/7] dt-bindings: PCI: ti,am65: Extend for use with PVU Jan Kiszka
2024-09-04 10:16 ` Siddharth Vadapalli
2024-09-04 11:47 ` Jan Kiszka
2024-09-05 6:32 ` Krzysztof Kozlowski
2024-09-05 6:40 ` Jan Kiszka
2024-09-05 6:53 ` Krzysztof Kozlowski
2024-09-05 7:15 ` Jan Kiszka
2024-09-05 7:50 ` Krzysztof Kozlowski
2024-09-05 7:56 ` Krzysztof Kozlowski
2024-09-06 7:00 ` Jan Kiszka
2024-09-05 6:57 ` Krzysztof Kozlowski
2024-09-05 7:16 ` Jan Kiszka
2024-09-05 7:52 ` Krzysztof Kozlowski
2024-09-06 7:13 ` Jan Kiszka
2024-09-05 16:37 ` Bjorn Helgaas
2024-09-04 10:00 ` [PATCH v4 3/7] soc: ti: Add IOMPU-like PVU driver Jan Kiszka
2024-09-04 10:00 ` [PATCH v4 4/7] PCI: keystone: Add supported for PVU-based DMA isolation on AM654 Jan Kiszka
2024-09-05 16:33 ` Bjorn Helgaas
2024-09-05 19:07 ` Jan Kiszka
2024-09-05 19:16 ` Bjorn Helgaas [this message]
2024-09-06 6:24 ` Jan Kiszka
2024-09-04 10:00 ` [PATCH v4 5/7] arm64: dts: ti: k3-am65-main: Add PVU nodes Jan Kiszka
2024-09-04 10:00 ` [PATCH v4 6/7] arm64: dts: ti: k3-am65-main: Add VMAP registers to PCI root complexes Jan Kiszka
2024-09-04 10:00 ` [PATCH v4 7/7] arm64: dts: ti: iot2050: Enforce DMA isolation for devices behind PCI RC on Advanced Jan Kiszka
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=20240905191635.GA395079@bhelgaas \
--to=helgaas@kernel.org \
--cc=baocheng.su@siemens.com \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=diogo.ivo@siemens.com \
--cc=huaqian.li@siemens.com \
--cc=jan.kiszka@siemens.com \
--cc=kishon@kernel.org \
--cc=kristo@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=nm@ti.com \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=ssantosh@kernel.org \
--cc=vigneshr@ti.com \
/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).