Skip to content

Commit

Permalink
remoteproc: add IOMMU hardware capability flag
Browse files Browse the repository at this point in the history
The remoteproc framework currently relies on iommu_present() on
the bus the device is on, to perform MMU management. However, this
logic doesn't scale for multi-arch, especially for processors that
do not have an IOMMU. Replace this logic instead by using a h/w
capability flag for the presence of IOMMU in the rproc structure.

This issue is seen on OMAP platforms when trying to add a remoteproc
driver for a small Cortex M3 called the WkupM3 used for suspend /
resume management on TI AM335/AM437x SoCs. This processor does not
have an MMU. Same is the case with another processor subsystem
PRU-ICSS on AM335/AM437x. All these are platform devices, and the
current iommu_present check will not scale for the same kernel image
to support OMAP4/OMAP5 and AM335/AM437x.

The existing platform implementation drivers - OMAP remoteproc, STE
Modem remoteproc and DA8xx remoteproc, are updated as well to properly
configure the newly added rproc field.

Cc: Robert Tivy <[email protected]>
Cc: Linus Walleij <[email protected]>
Signed-off-by: Suman Anna <[email protected]>
[small change in the commit title and in a single comment]
Signed-off-by: Ohad Ben-Cohen <[email protected]>
  • Loading branch information
sumananna authored and ohadbc committed Mar 12, 2015
1 parent c517d83 commit 315491e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions drivers/remoteproc/da8xx_remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev)

drproc = rproc->priv;
drproc->rproc = rproc;
rproc->has_iommu = false;

platform_set_drvdata(pdev, rproc);

Expand Down
2 changes: 2 additions & 0 deletions drivers/remoteproc/omap_remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ static int omap_rproc_probe(struct platform_device *pdev)

oproc = rproc->priv;
oproc->rproc = rproc;
/* All existing OMAP IPU and DSP processors have an MMU */
rproc->has_iommu = true;

platform_set_drvdata(pdev, rproc);

Expand Down
15 changes: 2 additions & 13 deletions drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,8 @@ static int rproc_enable_iommu(struct rproc *rproc)
struct device *dev = rproc->dev.parent;
int ret;

/*
* We currently use iommu_present() to decide if an IOMMU
* setup is needed.
*
* This works for simple cases, but will easily fail with
* platforms that do have an IOMMU, but not for this specific
* rproc.
*
* This will be easily solved by introducing hw capabilities
* that will be set by the remoteproc driver.
*/
if (!iommu_present(dev->bus)) {
dev_dbg(dev, "iommu not found\n");
if (!rproc->has_iommu) {
dev_dbg(dev, "iommu not present\n");
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/remoteproc/ste_modem_rproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ static int sproc_probe(struct platform_device *pdev)
sproc = rproc->priv;
sproc->mdev = mdev;
sproc->rproc = rproc;
rproc->has_iommu = false;
mdev->drv_data = sproc;

/* Provide callback functions to modem device */
Expand Down
2 changes: 2 additions & 0 deletions include/linux/remoteproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ enum rproc_crash_type {
* @table_ptr: pointer to the resource table in effect
* @cached_table: copy of the resource table
* @table_csum: checksum of the resource table
* @has_iommu: flag to indicate if remote processor is behind an MMU
*/
struct rproc {
struct klist_node node;
Expand Down Expand Up @@ -435,6 +436,7 @@ struct rproc {
struct resource_table *table_ptr;
struct resource_table *cached_table;
u32 table_csum;
bool has_iommu;
};

/* we currently support only two vrings per rvdev */
Expand Down

0 comments on commit 315491e

Please sign in to comment.