lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 20 Apr 2015 19:16:51 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	York Sun <yorksun@...escale.com>
Cc:	Julia.Lawall@...6.fr, linux-i2c@...r.kernel.org,
	wolfram@...-dreams.de, linux-kernel@...r.kernel.org
Subject: Re: Need some guidance on i2c-ocores driver

On Mon, 20 Apr 2015, York Sun wrote:

> 
> 
> On 04/19/2015 11:42 PM, Lee Jones wrote:
> > On Fri, 17 Apr 2015, York Sun wrote:
> > 
> >> Resend to LKML
> >>
> >> Lee,
> >>
> >> This question is actually more about MFD. Can you point me to the possible
> >> causes for my failure below?
> > 
> > It's hard to tell exactly without code, but it looks like you're
> > trying to allocate overlapping memory regions.  Double check all of
> > your addresses.  For DT you need to take a look at your 'reg'
> > properties, for traditional platform data it's best to grep for
> > IORESOURCE_MEM.
> > 
> Lee,
> 
> It _is_ overlapping. How could it not be? The resource for the I2C is mapped to
> BAR2. So the resource is overlapping with BAR2. It is alway the case, isn't it?
> What I don't understand is how MFD works with the resources if it is guaranteed
> overlapping. Did I get something wrong?
> 
> Look at the reference code I took, drivers/mfd/timberdale.c, when
> mfd_add_devices() is called, it uses &dev->resource as the base. So the BAR will
> be the parent. Check the code in mfd-core.c, mfd_add_device(),
> 
> if ((cell->resources[r].flags & IORESOURCE_MEM) && mem_base) {
> 	res[r].parent = mem_base;
> 	res[r].start = mem_base->start + cell->resources[r].start;
> 	res[r].end = mem_base->start + cell->resources[r].end;
> }
> 
> So the MFD resource is within its parent. When later the device driver request a
> region, will it get conflict with the parent?

I doubt you'll want to map the same memory area in both the parent and
the child device drivers.  Only map the registers you plan to use in
the driver you plan to use them.  If you need multiple devices to
access the same registers then you need to create an API, complete
with locking, in the MFD parent device.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ