From: Robin Murphy <robin.murphy@arm.com>
To: Adam Joseph <adam@westernsemico.com>
Cc: Peter Geis <pgwipeout@gmail.com>,
Heiko Stuebner <heiko@sntech.de>,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>,
linux-pci@vger.kernel.org
Subject: Re: [Question] rk3399 vfio-pci/sr-iov support
Date: Tue, 16 Nov 2021 10:28:06 +0000 [thread overview]
Message-ID: <ba499fa1-c5f7-2e69-2bd5-14677f385d5b@arm.com> (raw)
In-Reply-To: <20211115115004.7d043c5b@snowden>
On 2021-11-15 19:50, Adam Joseph wrote:
> On Mon, 9 Dec 2019 14:07:02 +0000
> Robin Murphy <robin.murphy@arm.com> wrote:
>> On 09/12/2019 1:28 pm, Peter Geis wrote:
>>> I'm back with more pcie fun on the rk3399.
>>> I'm trying to get pcie passthrough working for a vm on the rk3399,
>>> and have encountered some roadblocks.
>>
>> That much I can help with somewhat: the major impediment is that
>> RK3399 doesn't have an IOMMU in front of PCIe.
>
> For the more limited case of defending against attacks from
> hostile/buggy firmware on PCIe devices: is it possible to use the
> RK3399 PCIe "inbound address translation" support instead of an IOMMU?
I guess it might be possible to reserve some memory with the new
"restricted-dma-pool" semantics then tweak the PCIe setup to match that.
It will mostly depend on what the RC does with transactions that don't
match any ATU entry. These kinds of registers typically only decode a
small number of naturally-aligned power-of-two-sized address ranges so
would not be able to support the kind of arbitrary translation/page
protection you'd need for something like VFIO.
> The RK3399 TRM, v1.3 "Part 2", section 17.5.5.2.1 explains how to
> configure address translation (including a base/bounds check) for
> inbound-to-SoC memory writes, but details are quite sparse.
>
> Linux appears to not use this functionality; from
> drivers/pci/controller/pcie-rockchip-host.c we can see that it
> disables the base/bounds (sets them to the entire 32-bit space, which
> is all RAM on RK3399 since it supports only 4GB) and passes all 32
> bits of incoming memory writes:
>
> static int rockchip_pcie_prog_ib_atu(struct rockchip_pcie *rockchip,
> int region_no, u8 num_pass_bits,
> u32 lower_addr, u32 upper_addr)
> ...
>
> static int rockchip_pcie_cfg_atu(struct rockchip_pcie *rockchip)
> {
> ...
> err = rockchip_pcie_prog_ib_atu(rockchip, 2, 32 - 1, 0x0, 0);
>
> Is this a dead end? If not I might pursue it, if I can get the
> necessary documentation. I couldn't find any mention of ATS in the
> RK3399 manual; if the PCIe RC allows that then all bets are off anyways.
Knowing this RC, if it ever did see an ATS translated transaction header
it would probably SError the system, like it does for such outlandish
things as trying to probe config space behind bridges :)
Robin.
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
prev parent reply other threads:[~2021-11-16 10:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 13:28 [Question] rk3399 vfio-pci/sr-iov support Peter Geis
[not found] ` <CAMdYzYoPXWbv4zXet6c9JQEMbqcJi6ZEOui_n82NVmrqNLy_pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-12-09 14:07 ` Robin Murphy
[not found] ` <b597b9a6-870a-8fbd-6490-59734c04367f-5wv7dgnIgG8@public.gmane.org>
2019-12-09 17:05 ` Alex Williamson
[not found] ` <20191209100509.5cb950ac-hfcDOgR9qeA@public.gmane.org>
2019-12-10 1:23 ` Peter Geis
2021-11-15 19:50 ` Adam Joseph
2021-11-16 10:28 ` Robin Murphy [this message]
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=ba499fa1-c5f7-2e69-2bd5-14677f385d5b@arm.com \
--to=robin.murphy@arm.com \
--cc=adam@westernsemico.com \
--cc=heiko@sntech.de \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=pgwipeout@gmail.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