From: Magnus Damm <magnus.damm@gmail.com> To: iommu@lists.linux-foundation.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, joro@8bytes.org, linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm <magnus.damm@gmail.com>, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH/RFC v2 3/4] iommu/ipmmu-vmsa: Opt-in slave devices based on ES version Date: Fri, 27 Jan 2017 15:14:45 +0900 [thread overview] Message-ID: <148549768562.22203.6722636560743534786.sendpatchset@little-apple> (raw) In-Reply-To: <148549764733.22203.16459470412085471955.sendpatchset@little-apple> From: Magnus Damm <damm+renesas@opensource.se> Match on r8a7795 ES2 and enable a certain DMA controller. In other cases the IPMMU driver remains disabled. Signed-off-by: Magnus Damm <damm+renesas@opensource.se> --- Changes since V1: - Perform white list check in ->xlate() instead of ->add_device() drivers/iommu/ipmmu-vmsa.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) --- 0009/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-01-27 13:14:47.470607110 +0900 @@ -23,6 +23,7 @@ #include <linux/platform_device.h> #include <linux/sizes.h> #include <linux/slab.h> +#include <linux/sys_soc.h> #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA) #include <asm/dma-iommu.h> @@ -1032,9 +1033,33 @@ static void ipmmu_remove_device_dma(stru iommu_group_remove_device(dev); } +static const struct soc_device_attribute r8a7795es2[] = { + { .soc_id = "r8a7795", .revision = "ES2.*" }, + { /* sentinel */ } +}; + +static int ipmmu_slave_whitelist(struct device *dev) +{ + /* Opt-in slave devices based on SoC and ES version */ + if (soc_device_match(r8a7795es2)) { + if (!strcmp(dev_name(dev), "e7310000.dma-controller")) + return 0; + } + + /* By default, do not allow use of IPMMU */ + return -ENODEV; +} + static int ipmmu_of_xlate_dma(struct device *dev, struct of_phandle_args *spec) { + int ret; + + /* Opt-in devices based on SoC and ES version */ + ret = ipmmu_slave_whitelist(dev); + if (ret) + return ret; + /* For now only tested on R-Car Gen3 with ARM64 arch init order * TODO: Test R-Car Gen2 with ARM32 arch init order */
WARNING: multiple messages have this Message-ID (diff)
From: magnus.damm@gmail.com (Magnus Damm) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH/RFC v2 3/4] iommu/ipmmu-vmsa: Opt-in slave devices based on ES version Date: Fri, 27 Jan 2017 15:14:45 +0900 [thread overview] Message-ID: <148549768562.22203.6722636560743534786.sendpatchset@little-apple> (raw) In-Reply-To: <148549764733.22203.16459470412085471955.sendpatchset@little-apple> From: Magnus Damm <damm+renesas@opensource.se> Match on r8a7795 ES2 and enable a certain DMA controller. In other cases the IPMMU driver remains disabled. Signed-off-by: Magnus Damm <damm+renesas@opensource.se> --- Changes since V1: - Perform white list check in ->xlate() instead of ->add_device() drivers/iommu/ipmmu-vmsa.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) --- 0009/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-01-27 13:14:47.470607110 +0900 @@ -23,6 +23,7 @@ #include <linux/platform_device.h> #include <linux/sizes.h> #include <linux/slab.h> +#include <linux/sys_soc.h> #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA) #include <asm/dma-iommu.h> @@ -1032,9 +1033,33 @@ static void ipmmu_remove_device_dma(stru iommu_group_remove_device(dev); } +static const struct soc_device_attribute r8a7795es2[] = { + { .soc_id = "r8a7795", .revision = "ES2.*" }, + { /* sentinel */ } +}; + +static int ipmmu_slave_whitelist(struct device *dev) +{ + /* Opt-in slave devices based on SoC and ES version */ + if (soc_device_match(r8a7795es2)) { + if (!strcmp(dev_name(dev), "e7310000.dma-controller")) + return 0; + } + + /* By default, do not allow use of IPMMU */ + return -ENODEV; +} + static int ipmmu_of_xlate_dma(struct device *dev, struct of_phandle_args *spec) { + int ret; + + /* Opt-in devices based on SoC and ES version */ + ret = ipmmu_slave_whitelist(dev); + if (ret) + return ret; + /* For now only tested on R-Car Gen3 with ARM64 arch init order * TODO: Test R-Car Gen2 with ARM32 arch init order */
next prev parent reply other threads:[~2017-01-27 6:21 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-01-27 6:14 [PATCH/RFC v2 0/4] iommu/ipmmu-vmsa: IPMMU slave device whitelist V2 Magnus Damm 2017-01-27 6:14 ` Magnus Damm 2017-01-27 6:14 ` Magnus Damm 2017-01-27 6:14 ` [PATCH/RFC v2 1/4] iommu/of: Skip IOMMU devices disabled in DT Magnus Damm 2017-01-27 6:14 ` Magnus Damm 2017-01-27 6:14 ` Magnus Damm 2017-01-27 6:14 ` [PATCH/RFC v2 2/4] iommu/ipmmu-vmsa: Get rid of disabled device check Magnus Damm 2017-01-27 6:14 ` Magnus Damm 2017-01-27 6:14 ` [PATCH/RFC v2 3/4] iommu/ipmmu-vmsa: Check devices in xlate() Magnus Damm 2017-01-27 6:14 ` Magnus Damm 2017-01-27 6:14 ` Magnus Damm [this message] 2017-01-27 6:14 ` [PATCH/RFC v2 3/4] iommu/ipmmu-vmsa: Opt-in slave devices based on ES version Magnus Damm 2017-03-06 9:00 ` [PATCH/RFC v2 0/4] iommu/ipmmu-vmsa: IPMMU slave device whitelist V2 Magnus Damm 2017-03-06 9:00 ` Magnus Damm 2017-03-06 9:00 ` Magnus Damm 2017-03-22 14:25 ` Joerg Roedel 2017-03-22 14:25 ` Joerg Roedel 2017-03-22 14:25 ` Joerg Roedel
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=148549768562.22203.6722636560743534786.sendpatchset@little-apple \ --to=magnus.damm@gmail.com \ --cc=geert+renesas@glider.be \ --cc=horms+renesas@verge.net.au \ --cc=iommu@lists.linux-foundation.org \ --cc=joro@8bytes.org \ --cc=laurent.pinchart+renesas@ideasonboard.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-renesas-soc@vger.kernel.org \ --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: linkBe 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.