devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Yoder <stuart.yoder@nxp.com>
To: robh@kernel.org, frowand.list@gmail.com, grant.likely@linaro.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: marc.zyngier@arm.com, david.daney@cavium.com,
	mark.rutland@arm.com, Stuart Yoder <stuart.yoder@nxp.com>
Subject: [PATCH] of/irq: fix bug in computing output requester-id for an msi-map
Date: Mon, 8 Feb 2016 16:30:23 -0600	[thread overview]
Message-ID: <1454970623-28781-1-git-send-email-stuart.yoder@nxp.com> (raw)

From: Stuart Yoder <stuart.yoder@nxp.com>

The binding for msi-map specifies that the output requester id
should be computed as: (r - rid-base + msi-base)

...update the code accordingly.

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
---
 drivers/of/irq.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 706e3ff..3f5e5fd 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -589,6 +589,7 @@ static u32 __of_msi_map_rid(struct device *dev, struct device_node **np,
 	struct device_node *msi_controller_node;
 	struct device_node *msi_np = *np;
 	u32 map_mask, masked_rid, rid_base, msi_base, rid_len, phandle;
+	u32 masked_rid_base;
 	int msi_map_len;
 	bool matched;
 	u32 rid_out = rid_in;
@@ -654,7 +655,8 @@ static u32 __of_msi_map_rid(struct device *dev, struct device_node **np,
 	if (!matched)
 		return rid_out;
 
-	rid_out = masked_rid + msi_base;
+	masked_rid_base = map_mask & rid_base;
+	rid_out = msi_base + (masked_rid - masked_rid_base);
 	dev_dbg(dev,
 		"msi-map at: %s, using mask %08x, rid-base: %08x, msi-base: %08x, length: %08x, rid: %08x -> %08x\n",
 		dev_name(parent_dev), map_mask, rid_base, msi_base,
-- 
1.7.9.5

             reply	other threads:[~2016-02-08 22:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 22:30 Stuart Yoder [this message]
2016-02-08 23:47 ` [PATCH] of/irq: fix bug in computing output requester-id for an msi-map David Daney

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=1454970623-28781-1-git-send-email-stuart.yoder@nxp.com \
    --to=stuart.yoder@nxp.com \
    --cc=david.daney@cavium.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).