Skip to content

Commit

Permalink
iommu/ipmmu-vmsa: Add an array of slave devices whitelist
Browse files Browse the repository at this point in the history
To avoid adding copy and pasted strcmp codes in the future,
this patch adds an array "rcar_gen3_slave_whitelist" to check
whether the device can work with the IPMMU or not.

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>
  • Loading branch information
Yoshihiro Shimoda authored and Joerg Roedel committed Dec 3, 2018
1 parent b7ee92c commit 8075964
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/iommu/ipmmu-vmsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,13 @@ static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
{ /* sentinel */ }
};

static const char * const rcar_gen3_slave_whitelist[] = {
};

static bool ipmmu_slave_whitelist(struct device *dev)
{
unsigned int i;

/*
* For R-Car Gen3 use a white list to opt-in slave devices.
* For Other SoCs, this returns true anyway.
Expand All @@ -783,7 +788,13 @@ static bool ipmmu_slave_whitelist(struct device *dev)
if (!soc_device_match(soc_rcar_gen3_whitelist))
return false;

/* By default, do not allow use of IPMMU */
/* Check whether this slave device can work with the IPMMU */
for (i = 0; i < ARRAY_SIZE(rcar_gen3_slave_whitelist); i++) {
if (!strcmp(dev_name(dev), rcar_gen3_slave_whitelist[i]))
return true;
}

/* Otherwise, do not allow use of IPMMU */
return false;
}

Expand Down

0 comments on commit 8075964

Please sign in to comment.