iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Mon, 20 Dec 2021 21:15:50 +0000 (23:15 +0200)
committerJulien Grall <jgrall@amazon.com>
Thu, 27 Jan 2022 12:33:37 +0000 (12:33 +0000)
commita23e7a88bcf2471704db1b4948a39916886cc899
tree6a9c5f6419623c4cb5ca4bf00cb71a5688a7dcec
parentcbba37c8a3d07ae3b17eee7e4aaadfb23cf4feec
iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers

This is a non-verbatim port of corresponding Linux upsteam commit:
3667c9978b2911dc1ded77f5971df477885409c4

Original commit message:
 commit 3667c9978b2911dc1ded77f5971df477885409c4
 Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
 Date:   Wed Nov 6 11:35:49 2019 +0900

  iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers

  Since we will have changed memory mapping of the IPMMU in the future,
  This patch adds helper functions ipmmu_utlb_reg() and
  ipmmu_imu{asid,ctr}_write() for "uTLB" registers. No behavior change.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
**********

This is a prereq work needed to add support for S4 series easily
in the future.

Besides changes done in the original commit, we also need to introduce
ipmmu_imuctr_read() since Xen driver contains an additional logic in
ipmmu_utlb_enable() to prevent the use cases where devices which use
the same micro-TLB are assigned to different Xen domains.

No change in behavior.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/drivers/passthrough/arm/ipmmu-vmsa.c