From: Adam Joseph <adam@westernsemico.com>
To: Robin Murphy <robin.murphy@arm.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: Mon, 15 Nov 2021 11:50:04 -0800 [thread overview]
Message-ID: <20211115115004.7d043c5b@snowden> (raw)
In-Reply-To: <b597b9a6-870a-8fbd-6490-59734c04367f@arm.com>
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?
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.
- a
WARNING: multiple messages have this Message-ID (diff)
From: Adam Joseph <adam@westernsemico.com>
To: Robin Murphy <robin.murphy@arm.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: Mon, 15 Nov 2021 11:50:04 -0800 [thread overview]
Message-ID: <20211115115004.7d043c5b@snowden> (raw)
In-Reply-To: <b597b9a6-870a-8fbd-6490-59734c04367f@arm.com>
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?
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.
- a
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2021-11-15 21:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 13:28 [Question] rk3399 vfio-pci/sr-iov support Peter Geis
2019-12-09 13:28 ` Peter Geis
2019-12-09 14:07 ` Robin Murphy
2019-12-09 14:07 ` Robin Murphy
2019-12-09 17:05 ` Alex Williamson
2019-12-09 17:05 ` Alex Williamson
2019-12-10 1:23 ` Peter Geis
2019-12-10 1:23 ` Peter Geis
2021-11-15 19:50 ` Adam Joseph [this message]
2021-11-15 19:50 ` Adam Joseph
2021-11-16 10:28 ` Robin Murphy
2021-11-16 10:28 ` Robin Murphy
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=20211115115004.7d043c5b@snowden \
--to=adam@westernsemico.com \
--cc=heiko@sntech.de \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=pgwipeout@gmail.com \
--cc=robin.murphy@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.