All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martijn de Gouw <martijn.de.gouw@prodrive-technologies.com>
To: "Bounine, Alexandre" <Alexandre.Bounine@idt.com>
Cc: "scottwood@freescale.com" <scottwood@freescale.com>,
	"stef.van.os@prodrive-technologies.com"
	<stef.van.os@prodrive-technologies.com>,
	Martijn de Gouw <martijn.de.gouw@prodrive.nl>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"Wood, Barry" <Barry.Wood@idt.com>
Subject: Re: [PATCH] fsl-rio: add support for mapping inbound windows
Date: Mon, 23 Jun 2014 15:57:23 +0200	[thread overview]
Message-ID: <53A83243.1080605@prodrive-technologies.com> (raw)
In-Reply-To: <8D983423E7EDF846BB3056827B8CC5D15CC9575C@corpmail1.na.ads.idt.com>

On 06/18/2014 05:17 PM, Bounine, Alexandre wrote:
> On Friday, June 13, 2014 7:09 AM Martijn de Gouw [mailto:martijn.de.gouw@prodrive-
> technologies.com] wrote:
>
>> Add support for mapping and unmapping of inbound rapidio windows.
>>
>> Signed-off-by: Martijn de Gouw <martijn.de.gouw@prodrive.nl>
>> ---
> ... skip ...
>
>> +
>> +int fsl_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
>> +	u64 rstart, u32 size, u32 flags)
>> +{
>> +	struct rio_priv *priv = mport->priv;
>> +	u32 base_size;
>> +	unsigned int base_size_log;
>> +	u64 win_start, win_end;
>> +	u32 riwar;
>> +	int i;
>> +
>> +	base_size_log = __ilog2(size) + ((size & (size - 1)) != 0);
>> +	base_size = 1 << base_size_log;
>> +
>> +	for (i = 0; i < RIO_INB_ATMU_COUNT; i++) {
>> +		riwar = in_be32(&priv->inb_atmu_regs[i].riwar);
>> +		if ((riwar & RIWAR_ENABLE) == 0)
>> +			break;
>> +		/* check conflicting ranges */
>> +		win_start = ((u64)(in_be32(&priv->inb_atmu_regs[i].riwbar) & RIWBAR_BADD_MASK))
>> +			<< RIWBAR_BADD_VAL_SHIFT;
>> +		win_end = win_start + ((1 << ((riwar & RIWAR_SIZE_MASK) + 1)) - 1);
>> +		if (rstart < win_end && (rstart + size) > win_start)
>> +			return -EINVAL;
>> +	}
>
> It looks like the check for conflicting ranges assumes sequential mapping requests only.
> This check will be missed if ATMU windows are dynamically mapped/unmapped out-of-order.
> Because the unmap callback is implemented please consider possibility of using ATMU windows
> in any order.
>

You are correct. I'll send a new patch which first check all enabled 
windows for conflicts, before is searches for a free ATMU.


-- 
Martijn de Gouw
Engineer
Prodrive Technologies B.V.
Mobile: +31 63 17 76 161
Phone:  +31 40 26 76 200

  reply	other threads:[~2014-06-23 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13 11:09 [PATCH] fsl-rio: add support for mapping inbound windows Martijn de Gouw
2014-06-18 15:17 ` Bounine, Alexandre
2014-06-23 13:57   ` Martijn de Gouw [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-05 13:52 Martijn de Gouw
2014-08-05 21:37 ` Scott Wood
2014-08-12  8:48   ` Martijn de Gouw
2014-09-17  3:37     ` Gang.Liu
2014-09-03 22:42   ` Scott Wood

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=53A83243.1080605@prodrive-technologies.com \
    --to=martijn.de.gouw@prodrive-technologies.com \
    --cc=Alexandre.Bounine@idt.com \
    --cc=Barry.Wood@idt.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=martijn.de.gouw@prodrive.nl \
    --cc=scottwood@freescale.com \
    --cc=stef.van.os@prodrive-technologies.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: link
Be 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.