mbox series

[0/3] Qualcomm quirky SMMU support

Message ID 20231211-b4-dwc3-qcom-v1-0-46275113b4f2@linaro.org
Headers show
Series Qualcomm quirky SMMU support | expand

Message

Caleb Connolly Dec. 11, 2023, 6:41 p.m. UTC
Qualcomm platforms are heavily locked down, in many cases offering no
way for users to gain EL2 or EL3 code execution and including many
additional security features. Among these are modifications made to
the SMMU behaviour (done by having the hypervisor intercept register
accesses). On many platforms it is not possible to disable the SMMU,
and not possible to configure streams in BYPASS.

To enable support for peripherals like USB which depend on DMA, we must
allocate a context bank on the SMMU and configure an IDENTITY mapping.

This patch series fixes support for building IOMMU without CONFIG_PCI.

Then, it introduces first introduces support for a .connect() op in
IOMMU drivers, this is called before the peripheral drivers .probe()
function and allows for IOMMU devices to perform one-time setup.

Lastly, introduce a new driver which supports the SMMU as found on
Qualcomm platforms, when a DMA capable peripherals is probed, this
driver will first see if the previous stage bootloader configured a
context bank for the given stream ID already, and if not then it
allocates and configures one so that DMA accesses will work.

There are no in-tree users for this driver yet, however it is required
for upcoming USB support on SDM845 and future Qualcomm platforms.

---
Caleb Connolly (3):
      iommu: fix compilation when CONFIG_PCI disabled
      iommu: add a connect op
      iommu: add qcom-hyp-smmu

 drivers/iommu/Kconfig         |  16 ++
 drivers/iommu/Makefile        |   1 +
 drivers/iommu/iommu-uclass.c  |  16 +-
 drivers/iommu/qcom-hyp-smmu.c | 396 ++++++++++++++++++++++++++++++++++++++++++
 include/iommu.h               |   9 +
 5 files changed, 436 insertions(+), 2 deletions(-)
---
base-commit: 8806443ed784dad5b5daf351b0175acb3343e729

// Caleb (they/them)

Comments

Sumit Garg Dec. 14, 2023, 9:20 a.m. UTC | #1
Hi Caleb,

On Tue, 12 Dec 2023 at 00:11, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> Qualcomm platforms are heavily locked down, in many cases offering no
> way for users to gain EL2 or EL3 code execution and including many
> additional security features. Among these are modifications made to
> the SMMU behaviour (done by having the hypervisor intercept register
> accesses). On many platforms it is not possible to disable the SMMU,
> and not possible to configure streams in BYPASS.

I suppose SDM845 is one of those.

>
> To enable support for peripherals like USB which depend on DMA, we must
> allocate a context bank on the SMMU and configure an IDENTITY mapping.
>
> This patch series fixes support for building IOMMU without CONFIG_PCI.
>
> Then, it introduces first introduces support for a .connect() op in
> IOMMU drivers, this is called before the peripheral drivers .probe()
> function and allows for IOMMU devices to perform one-time setup.
>
> Lastly, introduce a new driver which supports the SMMU as found on
> Qualcomm platforms, when a DMA capable peripherals is probed, this
> driver will first see if the previous stage bootloader configured a
> context bank for the given stream ID already, and if not then it
> allocates and configures one so that DMA accesses will work.
>
> There are no in-tree users for this driver yet, however it is required
> for upcoming USB support on SDM845 and future Qualcomm platforms.
>

Is there any other pending stuff for USB to be supported on SDM845? If
not then you should enable USB alongside this patch-set as without a
user its hard to justify this driver merge as it is.

-Sumit

> ---
> Caleb Connolly (3):
>       iommu: fix compilation when CONFIG_PCI disabled
>       iommu: add a connect op
>       iommu: add qcom-hyp-smmu
>
>  drivers/iommu/Kconfig         |  16 ++
>  drivers/iommu/Makefile        |   1 +
>  drivers/iommu/iommu-uclass.c  |  16 +-
>  drivers/iommu/qcom-hyp-smmu.c | 396 ++++++++++++++++++++++++++++++++++++++++++
>  include/iommu.h               |   9 +
>  5 files changed, 436 insertions(+), 2 deletions(-)
> ---
> base-commit: 8806443ed784dad5b5daf351b0175acb3343e729
>
> // Caleb (they/them)
>