aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2018-11-28 04:23:36 -0500
committerJoerg Roedel <jroedel@suse.de>2018-12-03 08:23:53 -0500
commitb7ee92c6ff0e023a473b2500d771f6bf504fcc1a (patch)
tree82c810d8070e5b4fea8d850ca702041a97cc3d92 /drivers
parent31fc9763f9d752b75711156ef6a066f6ea264be5 (diff)
iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions
Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So, to check whether this R-Car Gen3 SoC can use the IPMMU correctly, this patch modifies the ipmmu_slave_whitelist(). Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/ipmmu-vmsa.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index aa0de59f3679..46906a763d69 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -751,12 +751,6 @@ static int ipmmu_init_platform_device(struct device *dev,
751 return 0; 751 return 0;
752} 752}
753 753
754static bool ipmmu_slave_whitelist(struct device *dev)
755{
756 /* By default, do not allow use of IPMMU */
757 return false;
758}
759
760static const struct soc_device_attribute soc_rcar_gen3[] = { 754static const struct soc_device_attribute soc_rcar_gen3[] = {
761 { .soc_id = "r8a774a1", }, 755 { .soc_id = "r8a774a1", },
762 { .soc_id = "r8a7795", }, 756 { .soc_id = "r8a7795", },
@@ -768,11 +762,35 @@ static const struct soc_device_attribute soc_rcar_gen3[] = {
768 { /* sentinel */ } 762 { /* sentinel */ }
769}; 763};
770 764
765static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
766 { .soc_id = "r8a7795", .revision = "ES3.*" },
767 { .soc_id = "r8a77965", },
768 { .soc_id = "r8a77990", },
769 { .soc_id = "r8a77995", },
770 { /* sentinel */ }
771};
772
773static bool ipmmu_slave_whitelist(struct device *dev)
774{
775 /*
776 * For R-Car Gen3 use a white list to opt-in slave devices.
777 * For Other SoCs, this returns true anyway.
778 */
779 if (!soc_device_match(soc_rcar_gen3))
780 return true;
781
782 /* Check whether this R-Car Gen3 can use the IPMMU correctly or not */
783 if (!soc_device_match(soc_rcar_gen3_whitelist))
784 return false;
785
786 /* By default, do not allow use of IPMMU */
787 return false;
788}
789
771static int ipmmu_of_xlate(struct device *dev, 790static int ipmmu_of_xlate(struct device *dev,
772 struct of_phandle_args *spec) 791 struct of_phandle_args *spec)
773{ 792{
774 /* For R-Car Gen3 use a white list to opt-in slave devices */ 793 if (!ipmmu_slave_whitelist(dev))
775 if (soc_device_match(soc_rcar_gen3) && !ipmmu_slave_whitelist(dev))
776 return -ENODEV; 794 return -ENODEV;
777 795
778 iommu_fwspec_add_ids(dev, spec->args, 1); 796 iommu_fwspec_add_ids(dev, spec->args, 1);