Re: [RFC] ktap: Another dynamic tracing tool for Linux

2013-01-04 Thread Jovi Zhang
On Tue, Jan 1, 2013 at 2:58 AM, Frank Ch. Eigler  wrote:
>
> bookjovi wrote:
>
>
>> [...]  This mail is RFC for discuss on a new dynamic tracing tool, I
>> name it ktap. (only experimental project now)
>
> Welcome to the problem domain!
Thanks very much, frank, I'm so luck to discussing this topic with you. :)
>
>
>> [...]
>> what ktap differentiates with Systemtap is:
>> [...]
>> 2). ktap have good portability, because it compile source file to
>> bytecode, like python and Java.
>
> (From this PoV, systemtap is just as portable as the kernel, as it
> generates the same sort of C code the kernel is built from.)
>
the portability for ktap what I mean here is binary portability, you
will not need to
compile arm and x86 binary in ktap, it's all bytecode.
but as you pointed, systemtap also have good portability in source
level, for more clear,
I will change the readme text a little bit about this portability.  thanks.

>> [...]
>> 5). ktap will be open source completely, with GPL license, it might be
>> merge into mainline in someday, that's very convince for tracing user.
>
> (systemtap has always been GPLv2, ever since its beginning in 2005.)

Yes, you are right, both is GPL licensed.
>
>
>> [...]
>> ktap use lua language syntax and bytecode as initial implementation,
>
> Interesting approach.  I recall we considered it way back when, but
> rejected it for a couple of reasons, including the at-the-time
> perceived unwelcomeness of a serious bytecode interpreter within the
> kernel.
>
ktap is more like Dtrace, without gcc compiling.
Obviously, the bytecode design is the biggest differences with systemtap.
systemtap really is a valueable tracing tool, but in many case we cannot use it.
many Linux box doesn't deverily with gcc, this is very common in
embedded device,
even there installed gcc, but it's hard(impossible) to get matched
kernel source.
embeded world have many hardware architectures, arm/x86/mips/ppc, when
those different
hardware board is combined into a cluster, you need to prepare several
systemtap kernel module
in development machine, then upload all kernel module to cluster. but
if you have a bytecode
mechanism, that's totaly not neccessary, just a source script file or
bytecode chunk file.
This is just one advantage of bytecode mechanism.

Of course we must need to afford some penalty on performance compare
with raw C design(systemtap),
but gaining better convenient, one directing of ktap is reducing
bytecode executing overhead to minimal.

On clear that, ktap is not a replacement to systemtap, it's supplementation.
>
>> it could support kprobe, uprobe, userspace probe, etc.
>
> Great.
>
>> I wish you can give me some technical architecture pre-review for
>> ktap, before ktap release 1.0.
>> Any comments is welcome, thanks very much.
>
> Have you made any source code available yet?
>
I will try to make ktap develop progress more faster, and make ktap
source code public available soon.

.jovi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 net-next] softirq: reduce latencies

2013-01-04 Thread Joe Perches
On Thu, 2013-01-03 at 23:49 -0800, Eric Dumazet wrote:
> In various network workloads, __do_softirq() latencies can be up
> to 20 ms if HZ=1000, and 200 ms if HZ=100.
> This patch changes the fallback to ksoftirqd condition to :
> - A time limit of 2 ms.

[]
> diff --git a/kernel/softirq.c b/kernel/softirq.c
[]
> +#define MAX_SOFTIRQ_TIME  max(1, (2*HZ/1000))

And if HZ is 1?
 
>  asmlinkage void __do_softirq(void)
>  {
[]
> + unsigned long end = jiffies + MAX_SOFTIRQ_TIME;

Perhaps MAX_SOFTIRQ_TIME should be

#define MAX_SOFTIRQ_TIME msecs_to_jiffies(2)

though it would be nicer if it were a compile time constant.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] iommu: moving initialization earlier

2013-01-04 Thread Alexey Kardashevskiy

On 16/12/12 22:20, Joerg Roedel wrote:

Alexey,

On Thu, Dec 13, 2012 at 08:48:55AM -0700, Alex Williamson wrote:

Probably a good idea to CC the iommu list and maintainer...

On Thu, 2012-12-13 at 17:28 +1100, Alexey Kardashevskiy wrote:

Signed-off-by: Alexey Kardashevskiy 


Please resend the patch when the merge-window is closed.


is it closed now? not sure I entirely understand what window you kept in 
mind :)



--
Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] nfs: fix null checking in nfs_get_option_str()

2013-01-04 Thread Xi Wang
The following null pointer check is broken.

*option = match_strdup(args);
return !option;

The pointer `option' must be non-null, and thus `!option' is always false.
Use `!*option' instead.

The bug was introduced in commit c5cb09b6f8 ("Cleanup: Factor out some
cut-and-paste code.").

Signed-off-by: Xi Wang 
Cc: sta...@vger.kernel.org
---
 fs/nfs/super.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c25cadf8..2e7e8c8 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1152,7 +1152,7 @@ static int nfs_get_option_str(substring_t args[], char 
**option)
 {
kfree(*option);
*option = match_strdup(args);
-   return !option;
+   return !*option;
 }
 
 static int nfs_get_option_ul(substring_t args[], unsigned long *option)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 net-next] softirq: reduce latencies

2013-01-04 Thread Eric Dumazet
On Fri, 2013-01-04 at 00:15 -0800, Joe Perches wrote:
> On Thu, 2013-01-03 at 23:49 -0800, Eric Dumazet wrote:
> > In various network workloads, __do_softirq() latencies can be up
> > to 20 ms if HZ=1000, and 200 ms if HZ=100.
> > This patch changes the fallback to ksoftirqd condition to :
> > - A time limit of 2 ms.
> 
> []
> > diff --git a/kernel/softirq.c b/kernel/softirq.c
> []
> > +#define MAX_SOFTIRQ_TIME  max(1, (2*HZ/1000))
> 
> And if HZ is 1?
>  

Then its OK.  2*1/1000 -> 20 ticks -> 2 ms


> >  asmlinkage void __do_softirq(void)
> >  {
> []
> > +   unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
> 
> Perhaps MAX_SOFTIRQ_TIME should be
> 
> #define MAX_SOFTIRQ_TIME msecs_to_jiffies(2)
> 
> though it would be nicer if it were a compile time constant.

If you send a patch to convert msecs_to_jiffies() to an inline function
when HZ = 1000, I will gladly use it instead of (2*HZ/1000)

Right now, max(1, msecs_to_jiffies(2)) uses way too many instructions,
while it should be the constant 2, known at compile time.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] backlight: check null deference of name when device is registered

2013-01-04 Thread Jingoo Han
NULL deference of name is checked when device is registered.
If the name is null, it will cause a kernel oops in dev_set_name().

Acked-by: Devendra Naga 
Signed-off-by: Jingoo Han 
---
 drivers/video/backlight/backlight.c |5 +
 drivers/video/backlight/lcd.c   |5 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/video/backlight/backlight.c 
b/drivers/video/backlight/backlight.c
index 345f666..f2db904 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -292,6 +292,11 @@ struct backlight_device *backlight_device_register(const 
char *name,
struct backlight_device *new_bd;
int rc;
 
+   if (name == NULL) {
+   pr_err("backlight name is null\n");
+   return ERR_PTR(-EINVAL);
+   }
+
pr_debug("backlight_device_register: name=%s\n", name);
 
new_bd = kzalloc(sizeof(struct backlight_device), GFP_KERNEL);
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 34fb6bd..3d0ac0c 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -207,6 +207,11 @@ struct lcd_device *lcd_device_register(const char *name, 
struct device *parent,
struct lcd_device *new_ld;
int rc;
 
+   if (name == NULL) {
+   pr_err("lcd name is null\n");
+   return ERR_PTR(-EINVAL);
+   }
+
pr_debug("lcd_device_register: name=%s\n", name);
 
new_ld = kzalloc(sizeof(struct lcd_device), GFP_KERNEL);
-- 
1.7.2.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][trivial] xtensa: Fix home page URL in Kconfig

2013-01-04 Thread Masanari Iida
This home page address has moved to new one.

Signed-off-by: Masanari Iida 
---
 arch/xtensa/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0d1f36a..75fb260 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -22,7 +22,7 @@ config XTENSA
  configurable and extensible.  The Linux port to the Xtensa
  architecture supports all processor configurations and extensions,
  with reasonable minimum requirements.  The Xtensa Linux project has
- a home page at .
+ a home page at .
 
 config RWSEM_XCHGADD_ALGORITHM
def_bool y
-- 
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] vfs: fix build break in include/linux/namei.h

2013-01-04 Thread Marek Szyprowski
This patch fixes the following build break which I've observed in v3.8-rc1:

In file included from fs/nfs/nfs4namespace.c:12:0:
include/linux/namei.h: In function ‘retry_estale’:
include/linux/namei.h:114:19: error: ‘ESTALE’ undeclared (first use in this 
function)
include/linux/namei.h:114:19: note: each undeclared identifier is reported only 
once for each function it appears in
make[2]: *** [fs/nfs/nfs4namespace.o] Error 1
make[1]: *** [fs/nfs] Error 2
make: *** [fs] Error 2

Signed-off-by: Marek Szyprowski 
---
 include/linux/namei.h |1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/namei.h b/include/linux/namei.h
index e998c03..5a5ff57 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -2,6 +2,7 @@
 #define _LINUX_NAMEI_H
 
 #include 
+#include 
 #include 
 #include 
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: DTS: exynos4210-origen: Add MAX8997 node entry

2013-01-04 Thread Tushar Behera
The node entry is added as per documentation and legacy board file.

Signed-off-by: Tushar Behera 
---
The patch is rebased on v3.8-rc1.

 arch/arm/boot/dts/exynos4210-origen.dts |  150 +++
 1 files changed, 150 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4210-origen.dts 
b/arch/arm/boot/dts/exynos4210-origen.dts
index f271001..362ef58 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -121,4 +121,154 @@
linux,default-trigger = "heartbeat";
};
};
+
+   i2c@1386 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   samsung,i2c-sda-delay = <100>;
+   samsung,i2c-max-bus-freq = <2>;
+   pinctrl-0 = <&i2c0_bus>;
+   pinctrl-names = "default";
+   status = "okay";
+
+   max8997_pmic@66 {
+   compatible = "maxim,max8997-pmic";
+   reg = <0x66>;
+   interrupt-parent = <&gpx0>;
+   interrupts = <4 0>, <3 0>;
+
+   max8997,pmic-ignore-gpiodvs-side-effect;
+   max8997,pmic-buck125-default-dvs-idx = <0>;
+   max8997,pmic-buck125-dvs-gpios = <&gpx0 0 0>,
+<&gpx0 1 0>,
+<&gpx0 2 0>;
+   max8997,pmic-buck1-dvs-voltage = <135>, <130>,
+<125>, <120>,
+<115>, <110>,
+<100>, <95>;
+   max8997,pmic-buck2-dvs-voltage = <110>, <110>,
+<110>, <110>,
+<100>, <100>,
+<100>, <100>;
+   max8997,pmic-buck5-dvs-voltage = <120>, <120>,
+<120>, <120>,
+<120>, <120>,
+<120>, <120>;
+
+   regulators {
+   ldo1_reg: LDO1 {
+   regulator-name = "VDD_ABB_3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   ldo2_reg: LDO2 {
+   regulator-name = "VDD_ALIVE_1.1V";
+   regulator-min-microvolt = <110>;
+   regulator-max-microvolt = <110>;
+   regulator-always-on;
+   };
+
+   ldo3_reg: LDO3 {
+   regulator-name = "VMIPI_1.1V";
+   regulator-min-microvolt = <110>;
+   regulator-max-microvolt = <110>;
+   regulator-always-on;
+   };
+
+   ldo4_reg: LDO4 {
+   regulator-name = "VDD_RTC_1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-always-on;
+   };
+
+   ldo6_reg: LDO6 {
+   regulator-name = "VMIPI_1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-always-on;
+   };
+
+   ldo7_reg: LDO7 {
+   regulator-name = "VDD_AUD_1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-always-on;
+   };
+
+   ldo8_reg: LDO8 {
+   regulator-name = "VADC_3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-always-on;
+

[PATCH 1/2] Add mempressure cgroup

2013-01-04 Thread Anton Vorontsov
This commit implements David Rientjes' idea of mempressure cgroup.

The main characteristics are the same to what I've tried to add to vmevent
API; internally, it uses Mel Gorman's idea of scanned/reclaimed ratio for
pressure index calculation. But we don't expose the index to the userland.
Instead, there are three levels of the pressure:

 o low (just reclaiming, e.g. caches are draining);
 o medium (allocation cost becomes high, e.g. swapping);
 o oom (about to oom very soon).

The rationale behind exposing levels and not the raw pressure index
described here: http://lkml.org/lkml/2012/11/16/675

For a task it is possible to be in both cpusets, memcg and mempressure
cgroups, so by rearranging the tasks it is possible to watch a specific
pressure (i.e. caused by cpuset and/or memcg).

Note that while this adds the cgroups support, the code is well separated
and eventually we might add a lightweight, non-cgroups API, i.e. vmevent.
But this is another story.

Signed-off-by: Anton Vorontsov 
---
 Documentation/cgroups/mempressure.txt |  50 ++
 include/linux/cgroup_subsys.h |   6 +
 include/linux/vmstat.h|  11 ++
 init/Kconfig  |  12 ++
 mm/Makefile   |   1 +
 mm/mempressure.c  | 330 ++
 mm/vmscan.c   |   4 +
 7 files changed, 414 insertions(+)
 create mode 100644 Documentation/cgroups/mempressure.txt
 create mode 100644 mm/mempressure.c

diff --git a/Documentation/cgroups/mempressure.txt 
b/Documentation/cgroups/mempressure.txt
new file mode 100644
index 000..dbc0aca
--- /dev/null
+++ b/Documentation/cgroups/mempressure.txt
@@ -0,0 +1,50 @@
+  Memory pressure cgroup
+~~
+  Before using the mempressure cgroup, make sure you have it mounted:
+
+   # cd /sys/fs/cgroup/
+   # mkdir mempressure
+   # mount -t cgroup cgroup ./mempressure -o mempressure
+
+  It is possible to combine cgroups, for example you can mount memory
+  (memcg) and mempressure cgroups together:
+
+   # mount -t cgroup cgroup ./mempressure -o memory,mempressure
+
+  That way the reported pressure will honour memory cgroup limits. The
+  same goes for cpusets.
+
+  After the hierarchy is mounted, you can use the following API:
+
+  /sys/fs/cgroup/.../mempressure.level
+
+  To maintain the interactivity/memory allocation cost, one can use the
+  pressure level notifications, and the levels are defined like this:
+
+  The "low" level means that the system is reclaiming memory for new
+  allocations. Monitoring reclaiming activity might be useful for
+  maintaining overall system's cache level. Upon notification, the program
+  (typically "Activity Manager") might analyze vmstat and act in advance
+  (i.e. prematurely shutdown unimportant services).
+
+  The "medium" level means that the system is experiencing medium memory
+  pressure, there is some mild swapping activity. Upon this event
+  applications may decide to free any resources that can be easily
+  reconstructed or re-read from a disk.
+
+  The "oom" level means that the system is actively thrashing, it is about
+  to out of memory (OOM) or even the in-kernel OOM killer is on its way to
+  trigger. Applications should do whatever they can to help the system.
+
+  Event control:
+Is used to setup an eventfd with a level threshold. The argument to
+the event control specifies the level threshold.
+  Read:
+Reads mempory presure levels: low, medium or oom.
+  Write:
+Not implemented.
+  Test:
+To set up a notification:
+
+# cgroup_event_listener ./mempressure.level low
+("low", "medium", "oom" are permitted.)
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index f204a7a..b9802e2 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -37,6 +37,12 @@ SUBSYS(mem_cgroup)
 
 /* */
 
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_MEMPRESSURE)
+SUBSYS(mpc_cgroup)
+#endif
+
+/* */
+
 #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
 SUBSYS(devices)
 #endif
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index a13291f..c1a66c7 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -10,6 +10,17 @@
 
 extern int sysctl_stat_interval;
 
+struct mem_cgroup;
+#ifdef CONFIG_CGROUP_MEMPRESSURE
+extern void vmpressure(struct mem_cgroup *memcg,
+  ulong scanned, ulong reclaimed);
+extern void vmpressure_prio(struct mem_cgroup *memcg, int prio);
+#else
+static inline void vmpressure(struct mem_cgroup *memcg,
+ ulong scanned, ulong reclaimed) {}
+static inline void vmpressure_prio(struct mem_cgroup *memcg, int prio) {}
+#endif
+
 #ifdef CONFIG_VM_EVENT_COUNTERS
 /*
  * Light weight per cpu counter implementation.
diff --git a/init/Kconfig b/init/Kconfig
index 7d30240..d526249 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -891,6 +891,18 @@ config MEMCG

[PATCH 0/2] Mempressure cgroup

2013-01-04 Thread Anton Vorontsov
Hi all,

Here is another round of the mempressure cgroup. This time I dared to
remove the RFC tag. :)

In this revision:

- Addressed most of Kirill Shutemov's comments. I didn't bother
  implementing per-level lists, though. It would needlessly complicate the
  logic, and the gain would be only visible with lots of watchers (which
  we don't have for our use-cases). But it is always an option to add the
  feature;

- I've split the pach into two: 'shrinker' and 'levels' parts. While the
  full-fledged userland shrinker is an interesting idea, we don't have any
  users ready for it, so I won't advocate for it too much.

  And since at least Kirill has some concerns about it, I don't want the
  shrinker to block the pressure levels.

  So, these are now separate. At some point, I'd like to both of them
  merged, but if anything, let's discuss them separately;

- Rebased onto v3.8-rc2.

RFC v2 (http://lkml.org/lkml/2012/12/10/128):

 - Added documentation, describes APIs and the purpose;
 - Implemented shrinker interface, this is based on Andrew's idea and
   supersedes my "balance" level idea;
 - The shrinker interface comes with a stress-test utility, that is what
   Andrew was also asking for. A simple app that we can run and see if the
   thing works as expected;
 - Added reclaimer's target_mem_cgroup handling;
 - As promised, added support for multiple listeners, and fixed some other
   comments on the previous RFC.

RFC v1 (http://lkml.org/lkml/2012/11/28/109)

--
 Documentation/cgroups/mempressure.txt|  97 +
 Documentation/cgroups/mempressure_test.c | 213 ++
 include/linux/cgroup_subsys.h|   6 +
 include/linux/vmstat.h   |  11 +
 init/Kconfig |  13 +
 mm/Makefile  |   1 +
 mm/mempressure.c | 487 +++
 mm/vmscan.c  |   4 +
 8 files changed, 832 insertions(+)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] Add shrinker interface for mempressure cgroup

2013-01-04 Thread Anton Vorontsov
This commit implements Andrew Morton's idea of kernel-controlled userland
reclaimer. This is very similar to the in-kernel shrinker, with one major
difference: it is asynchronous, i.e. like kswapd.

Note that the shrinker interface is not a substitution for the levels, the
two interfaces report different kinds information (i.e. with the shrinker
you don't know the actual system state -- how bad/good the memory
situation is).

The interface is well documented and comes with a stress-test utility.

Signed-off-by: Anton Vorontsov 
---
 Documentation/cgroups/mempressure.txt|  53 +++-
 Documentation/cgroups/mempressure_test.c | 213 +++
 init/Kconfig |   5 +-
 mm/mempressure.c | 157 +++
 4 files changed, 423 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/cgroups/mempressure_test.c

diff --git a/Documentation/cgroups/mempressure.txt 
b/Documentation/cgroups/mempressure.txt
index dbc0aca..5094749 100644
--- a/Documentation/cgroups/mempressure.txt
+++ b/Documentation/cgroups/mempressure.txt
@@ -16,10 +16,55 @@
 
   After the hierarchy is mounted, you can use the following API:
 
+  /sys/fs/cgroup/.../mempressure.shrinker
+~~~
+  The file implements userland shrinker (memory reclaimer) interface, so
+  that the kernel can ask userland to help with the memory reclaiming
+  process.
+
+  There are two basic concepts: chunks and chunks' size. The program must
+  tell the kernel the granularity of its allocations (chunk size) and the
+  number of reclaimable chunks. The granularity may be not 100% accurate,
+  but the more it is accurate, the better. I.e. suppose the application
+  has 200 page renders cached (but not displayed), 1MB each. So the chunk
+  size is 1MB, and the number of chunks is 200.
+
+  The granularity is specified during shrinker registration (i.e. via
+  argument to the event_control cgroup file; and it is OK to register
+  multiple shrinkers for different granularities). The number of
+  reclaimable chunks is specified by writing to the mempressure.shrinker
+  file.
+
+  The notification comes through the eventfd() interface. Upon the
+  notification, a read() from the eventfd returns the number of chunks to
+  reclaim (free).
+
+  It is assumed that the application will free the specified amount of
+  chunks before reading from the eventfd again. If that is not the case,
+  suppose the program was not able to reclaim the chunks, then application
+  should re-add the amount of chunks by writing to the
+  mempressure.shrinker file (otherwise the chunks won't be accounted by
+  the kernel, since it assumes that they were reclaimed).
+
+  Event control:
+Used to setup shrinker events. There is only one argument for the
+event control: chunk size in bytes.
+  Read:
+Not implemented.
+  Write:
+Writes must be in " " format. Positive
+numbers increment the internal counter, negative numbers decrement it
+(but the kernel prevents the counter from falling down below zero).
+  Test:
+See mempressure_test.c
+
   /sys/fs/cgroup/.../mempressure.level
 
-  To maintain the interactivity/memory allocation cost, one can use the
-  pressure level notifications, and the levels are defined like this:
+  Instead of working on the bytes level (like shrinkers), one may decide
+  to maintain the interactivity/memory allocation cost.
+
+  For this, the cgroup has memory pressure level notifications, and the
+  levels are defined like this:
 
   The "low" level means that the system is reclaiming memory for new
   allocations. Monitoring reclaiming activity might be useful for
@@ -30,7 +75,9 @@
   The "medium" level means that the system is experiencing medium memory
   pressure, there is some mild swapping activity. Upon this event
   applications may decide to free any resources that can be easily
-  reconstructed or re-read from a disk.
+  reconstructed or re-read from a disk. Note that for a fine-grained
+  control, you should probably use the shrinker interface, as described
+  above.
 
   The "oom" level means that the system is actively thrashing, it is about
   to out of memory (OOM) or even the in-kernel OOM killer is on its way to
diff --git a/Documentation/cgroups/mempressure_test.c 
b/Documentation/cgroups/mempressure_test.c
new file mode 100644
index 000..a6c770c
--- /dev/null
+++ b/Documentation/cgroups/mempressure_test.c
@@ -0,0 +1,213 @@
+/*
+ * mempressure shrinker test
+ *
+ * Copyright 2012 Linaro Ltd.
+ *   Anton Vorontsov 
+ *
+ * It is pretty simple: we create two threads, the first one constantly
+ * tries to allocate memory (more than we physically have), the second
+ * thread listens to the kernel shrinker notifications and frees asked
+ * amount of chunks. When we allocate more than available RAM, the two
+ * threads start to fight. Idially, we should n

Re: [PATCH 2/2] arm: make return_address available for ARM_UNWIND

2013-01-04 Thread Keun-O Park
On Fri, Jan 4, 2013 at 1:58 AM, Steven Rostedt  wrote:
> On Thu, 2013-01-03 at 16:23 +, Russell King - ARM Linux wrote:
>> On Thu, Jan 03, 2013 at 11:03:58AM -0500, Steven Rostedt wrote:
>> > On Thu, 2013-01-03 at 14:13 +, Russell King - ARM Linux wrote:
>> > > In summary, from what I can see in the patch, the reason why the ifdefs
>> > > are the way they are, and the reason the warning is there has not been
>> > > addressed; these patches just seem to be aimed just at removing a 
>> > > #warning
>> > > statement to make the warning go away.
>> >
>> > You're correct that this patch does not solve any of theses issues. Now,
>> > I'm thinking that ftrace has matured where these issues don't exist, and
>> > where they do, it will only cause noise in the trace than anything
>> > serious. But, this needs to be looked deeper to make sure.
>>
>> Looking back in the archives, it seems that we had a problem with ftrace
>> and the unwinder polluting the trace information:
>>
>> http://lists.arm.linux.org.uk/lurker/message/20090604.201745.1c41ee6c.en.html
>>
>> There's quite a bit of discussion in that thread about this which details
>> why we came up with what we have today.
>
> Thanks for the link. In fact, I see I was even involved :-)
>
> http://lists.arm.linux.org.uk/lurker/message/20090609.213448.b4e4d096.en.html
>
> Just as I explained, the problem isn't a recursion bug, but just noise
> in the trace.
>
> Some of what is called by unwind_frame() will always be traced, and I
> wouldn't want 'notrace' annotation on those.
>
> If anything, I would just suggest another config option that lets the
> user decide if they don't mind the messiness of the trace for the added
> benefit of where the latency output came from.
>
> Also, it's rather trivial to make the entire unwind.c not traced, by
> adding in the Makefile:
>
> CFLAGS_REMOVE_unwind.o = -pg
>
> But that only stops the tracing of the unwind_*. Looks to be a lot of
> those. But it wont stop the tracing of:
>
>  kernel_text_address <-unwind_frame
>  core_kernel_text <-unwind_frame
>  search_index <-unwind_frame
>  etc.
>
> Heck, the user could just keep those from being traced by doing:
>
>  echo kernel_text_address core_kernel_text search_index > \
>/sys/kernel/debug/tracing/set_ftrace_notrace
>
> If DYNAMIC_FTRACE is defined.
>
> -- Steve
>
>

With "CFLAGS_REMOVE_unwind.o = -pg" and with CONFIG_PROVE_LOCKING
turned on, I confirmed that
there's no trace output like Steve mentioned.
However, if I turn off CONFIG_PROVE_LOCKING, "irqsoff" and
"preemptirqsoff" ftracer prints these lines :

kernel_text_address <-unwind_frame
core_kernel_text <-unwind_frame
search_index <-unwind_frame

While I investigated the reason, I just found out there's two function
with same name, trace_hardirqs_off.
One in kernel/trace/trace_irqsoff.c and another in kernel/lockdep.c.
And both symbols are exported.
I am wondering whether it is intentionally maintained code to
manipulate ftrace and lockdep or not.
I guess it's probably not.

-- Kpark
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 00/15] net: introduce upper device lists and remove dev->master

2013-01-04 Thread Jiri Pirko
This is a V6 of a repost of my previous patchset:
"[patch net-next v2 00/15] net: introduce upper device lists and remove 
dev->master" from Aug 14

The discussion around
"[net-next] bonding: don't allow the master to become its slave"
forced me to think about upper<->lower device connections.

This patchset adds a possibility to record upper device linkage.
All upper<->lower devices are converted to use this mechanism right after.
That leads to dev->master removal because this info becomes redundant since
"master links" have the same value.

After all changes, there is no longer possible to do things as:
"bond->someotherdevice->samebond"

Also I think that drivers like cxgb3, qlcnic, qeth would benefit by this
in future by being able to get more appropriate info about l3 addresses.

v5->v6:
- netdev_has_upper_dev() - added statement to comment that this is looking at
  the immediate upper devices only.
- renamed "RTNL semaphore" -> "RTNL lock" in all comments
- renamed __netdev_has_upper_dev() to __netdev_search_upper_dev() to emhasize
  the difference to netdev_has_upper_dev()

v4->v5:
- fixed missed typo in drivers/infiniband/hw/nes/nes_cm.c

v3->v4:
- comments in __netdev_upper_dev_link() squashed into one line
- kfree_rcu used instead of call_rcu in netdev_upper_dev_unlink()

v2->v3:
- removed recursion in __netdev_has_upper_dev()
- refreshed bits to be applicable on current net-next

v1->v2:
- s/unique/master/ better naming + stays closer to the past
- fixed vlan err goto
- original patch 15 (WARN_ON change) is squashed into the first patch


Jiri Pirko (15):
  net: introduce upper device lists
  macvlan: add link to upper device
  vlan: add link to upper device
  rtnetlink: remove usage of dev->master
  team: remove usage of netdev_set_master()
  bridge: remove usage of netdev_set_master()
  netpoll: remove usage of dev->master
  cxgb3: remove usage of dev->master
  qlcnic: guard __vlan_find_dev_deep() by rcu_read_lock
  qeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock
  vlan: remove usage of dev->master in __vlan_find_dev_deep()
  nes: remove usage of dev->master
  bonding: remove usage of dev->master
  net: remove no longer used netdev_set_bond_master() and
netdev_set_master()
  net: kill dev->master

 drivers/infiniband/hw/nes/nes.c|   8 +-
 drivers/infiniband/hw/nes/nes_cm.c |   2 +-
 drivers/net/bonding/bond_3ad.c |  30 +--
 drivers/net/bonding/bond_alb.c |   6 +-
 drivers/net/bonding/bond_main.c|  94 
 drivers/net/bonding/bonding.h  |  14 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c |  11 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   |   2 +
 drivers/net/macvlan.c  |   9 +-
 drivers/net/team/team.c|  13 +-
 drivers/s390/net/qeth_l3_main.c|  21 +-
 include/linux/netdevice.h  |  22 +-
 net/8021q/vlan.c   |  10 +-
 net/8021q/vlan_core.c  |  18 +-
 net/bridge/br_if.c |   6 +-
 net/core/dev.c | 246 +
 net/core/netpoll.c |   9 +-
 net/core/rtnetlink.c   |  70 +++---
 18 files changed, 409 insertions(+), 182 deletions(-)

-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 05/15] team: remove usage of netdev_set_master()

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 drivers/net/team/team.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 78c7d87..5f35d6b 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1055,10 +1055,11 @@ static int team_port_add(struct team *team, struct 
net_device *port_dev)
}
}
 
-   err = netdev_set_master(port_dev, dev);
+   err = netdev_master_upper_dev_link(port_dev, dev);
if (err) {
-   netdev_err(dev, "Device %s failed to set master\n", portname);
-   goto err_set_master;
+   netdev_err(dev, "Device %s failed to set upper link\n",
+  portname);
+   goto err_set_upper_link;
}
 
err = netdev_rx_handler_register(port_dev, team_handle_frame,
@@ -1091,9 +1092,9 @@ err_option_port_add:
netdev_rx_handler_unregister(port_dev);
 
 err_handler_register:
-   netdev_set_master(port_dev, NULL);
+   netdev_upper_dev_unlink(port_dev, dev);
 
-err_set_master:
+err_set_upper_link:
team_port_disable_netpoll(port);
 
 err_enable_netpoll:
@@ -1137,7 +1138,7 @@ static int team_port_del(struct team *team, struct 
net_device *port_dev)
team_port_disable(team, port);
list_del_rcu(&port->list);
netdev_rx_handler_unregister(port_dev);
-   netdev_set_master(port_dev, NULL);
+   netdev_upper_dev_unlink(port_dev, dev);
team_port_disable_netpoll(port);
vlan_vids_del_by_dev(port_dev, dev);
dev_close(port_dev);
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 04/15] rtnetlink: remove usage of dev->master

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 net/core/rtnetlink.c | 69 
 1 file changed, 37 insertions(+), 32 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 2ef7a56..ae612f4 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -880,6 +880,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct 
net_device *dev,
const struct rtnl_link_stats64 *stats;
struct nlattr *attr, *af_spec;
struct rtnl_af_ops *af_ops;
+   struct net_device *upper_dev = netdev_master_upper_dev_get(dev);
 
ASSERT_RTNL();
nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags);
@@ -908,8 +909,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct 
net_device *dev,
 #endif
(dev->ifindex != dev->iflink &&
 nla_put_u32(skb, IFLA_LINK, dev->iflink)) ||
-   (dev->master &&
-nla_put_u32(skb, IFLA_MASTER, dev->master->ifindex)) ||
+   (upper_dev &&
+nla_put_u32(skb, IFLA_MASTER, upper_dev->ifindex)) ||
nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) ||
(dev->qdisc &&
 nla_put_string(skb, IFLA_QDISC, dev->qdisc->ops->id)) ||
@@ -1273,16 +1274,16 @@ static int do_setvfinfo(struct net_device *dev, struct 
nlattr *attr)
 
 static int do_set_master(struct net_device *dev, int ifindex)
 {
-   struct net_device *master_dev;
+   struct net_device *upper_dev = netdev_master_upper_dev_get(dev);
const struct net_device_ops *ops;
int err;
 
-   if (dev->master) {
-   if (dev->master->ifindex == ifindex)
+   if (upper_dev) {
+   if (upper_dev->ifindex == ifindex)
return 0;
-   ops = dev->master->netdev_ops;
+   ops = upper_dev->netdev_ops;
if (ops->ndo_del_slave) {
-   err = ops->ndo_del_slave(dev->master, dev);
+   err = ops->ndo_del_slave(upper_dev, dev);
if (err)
return err;
} else {
@@ -1291,12 +1292,12 @@ static int do_set_master(struct net_device *dev, int 
ifindex)
}
 
if (ifindex) {
-   master_dev = __dev_get_by_index(dev_net(dev), ifindex);
-   if (!master_dev)
+   upper_dev = __dev_get_by_index(dev_net(dev), ifindex);
+   if (!upper_dev)
return -EINVAL;
-   ops = master_dev->netdev_ops;
+   ops = upper_dev->netdev_ops;
if (ops->ndo_add_slave) {
-   err = ops->ndo_add_slave(master_dev, dev);
+   err = ops->ndo_add_slave(upper_dev, dev);
if (err)
return err;
} else {
@@ -2064,7 +2065,6 @@ errout:
 static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 {
struct net *net = sock_net(skb->sk);
-   struct net_device *master = NULL;
struct ndmsg *ndm;
struct nlattr *tb[NDA_MAX+1];
struct net_device *dev;
@@ -2106,10 +2106,10 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct 
nlmsghdr *nlh, void *arg)
/* Support fdb on master device the net/bridge default case */
if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
(dev->priv_flags & IFF_BRIDGE_PORT)) {
-   master = dev->master;
-   err = master->netdev_ops->ndo_fdb_add(ndm, tb,
- dev, addr,
- nlh->nlmsg_flags);
+   struct net_device *br_dev = netdev_master_upper_dev_get(dev);
+   const struct net_device_ops *ops = br_dev->netdev_ops;
+
+   err = ops->ndo_fdb_add(ndm, tb, dev, addr, nlh->nlmsg_flags);
if (err)
goto out;
else
@@ -2170,10 +2170,11 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct 
nlmsghdr *nlh, void *arg)
/* Support fdb on master device the net/bridge default case */
if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
(dev->priv_flags & IFF_BRIDGE_PORT)) {
-   struct net_device *master = dev->master;
+   struct net_device *br_dev = netdev_master_upper_dev_get(dev);
+   const struct net_device_ops *ops = br_dev->netdev_ops;
 
-   if (master->netdev_ops->ndo_fdb_del)
-   err = master->netdev_ops->ndo_fdb_del(ndm, dev, addr);
+   if (ops->ndo_fdb_del)
+   err = ops->ndo_fdb_del(ndm, dev, addr);
 
if (err)
goto out;
@@ -2257,9 +2258,11 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct 
netlink_callback *cb)
rcu_read_lock();
for_each_netdev_rcu(net, dev) {
if (dev->priv_fla

[patch net-next V6 09/15] qlcnic: guard __vlan_find_dev_deep() by rcu_read_lock

2013-01-04 Thread Jiri Pirko
rcu_read_lock was missing here

Signed-off-by: Jiri Pirko 
Acked-by: Sony Chacko 
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 137ca13..3655ca2 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -3186,12 +3186,14 @@ void qlcnic_restore_indev_addr(struct net_device 
*netdev, unsigned long event)
 
qlcnic_config_indev_addr(adapter, netdev, event);
 
+   rcu_read_lock();
for_each_set_bit(vid, adapter->vlans, VLAN_N_VID) {
dev = __vlan_find_dev_deep(netdev, vid);
if (!dev)
continue;
qlcnic_config_indev_addr(adapter, dev, event);
}
+   rcu_read_unlock();
 }
 
 static int qlcnic_netdev_event(struct notifier_block *this,
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 13/15] bonding: remove usage of dev->master

2013-01-04 Thread Jiri Pirko
Benefit from new upper dev list and free bonding from dev->master usage.

Signed-off-by: Jiri Pirko 
---
 drivers/net/bonding/bond_3ad.c  | 30 ++---
 drivers/net/bonding/bond_alb.c  |  6 +--
 drivers/net/bonding/bond_main.c | 94 -
 drivers/net/bonding/bonding.h   | 14 +++---
 net/core/rtnetlink.c|  1 +
 5 files changed, 81 insertions(+), 64 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index a030e63..84fabd6 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1127,7 +1127,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct 
port *port)
// INFO_RECEIVED_LOOPBACK_FRAMES
pr_err("%s: An illegal loopback occurred on 
adapter (%s).\n"
   "Check the configuration to verify that 
all adapters are connected to 802.3ad compliant switch ports\n",
-  port->slave->dev->master->name, 
port->slave->dev->name);
+  port->slave->bond->dev->name, 
port->slave->dev->name);
return;
}
__update_selected(lacpdu, port);
@@ -1306,7 +1306,7 @@ static void ad_port_selection_logic(struct port *port)
}
if (!curr_port) { // meaning: the port was related to an 
aggregator but was not on the aggregator port list
pr_warning("%s: Warning: Port %d (on %s) was related to 
aggregator %d but was not on its port list\n",
-  port->slave->dev->master->name,
+  port->slave->bond->dev->name,
   port->actor_port_number,
   port->slave->dev->name,
   port->aggregator->aggregator_identifier);
@@ -1386,7 +1386,7 @@ static void ad_port_selection_logic(struct port *port)
 port->aggregator->aggregator_identifier);
} else {
pr_err("%s: Port %d (on %s) did not find a suitable 
aggregator\n",
-  port->slave->dev->master->name,
+  port->slave->bond->dev->name,
   port->actor_port_number, port->slave->dev->name);
}
}
@@ -1463,7 +1463,7 @@ static struct aggregator *ad_agg_selection_test(struct 
aggregator *best,
 
default:
pr_warning("%s: Impossible agg select mode %d\n",
-  curr->slave->dev->master->name,
+  curr->slave->bond->dev->name,
   __get_agg_selection_mode(curr->lag_ports));
break;
}
@@ -1571,7 +1571,7 @@ static void ad_agg_selection_logic(struct aggregator *agg)
// check if any partner replys
if (best->is_individual) {
pr_warning("%s: Warning: No 802.3ad response from the 
link partner for any adapters in the bond\n",
-  best->slave ? best->slave->dev->master->name 
: "NULL");
+  best->slave ? best->slave->bond->dev->name : 
"NULL");
}
 
best->is_active = 1;
@@ -1898,7 +1898,7 @@ int bond_3ad_bind_slave(struct slave *slave)
 
if (bond == NULL) {
pr_err("%s: The slave %s is not attached to its bond\n",
-  slave->dev->master->name, slave->dev->name);
+  slave->bond->dev->name, slave->dev->name);
return -1;
}
 
@@ -1973,7 +1973,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
// if slave is null, the whole port is not initialized
if (!port->slave) {
pr_warning("Warning: %s: Trying to unbind an uninitialized port 
on %s\n",
-  slave->dev->master->name, slave->dev->name);
+  slave->bond->dev->name, slave->dev->name);
return;
}
 
@@ -2009,7 +2009,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
 
if ((new_aggregator->lag_ports == port) && 
new_aggregator->is_active) {
pr_info("%s: Removing an active 
aggregator\n",
-   
aggregator->slave->dev->master->name);
+   
aggregator->slave->bond->dev->name);
// select new active aggregator
 select_new_active_agg = 1;
}
@@ -2040,7 +2040,7 @@ void bond_3ad_unbind_slave(struct slave *slave)

ad_agg_selection_logic(__get_first_agg(port));
} else {

[patch net-next V6 15/15] net: kill dev->master

2013-01-04 Thread Jiri Pirko
Nobody uses this now. Remove it.

Signed-off-by: Jiri Pirko 
---
 include/linux/netdevice.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c3723ef..009bad3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1167,10 +1167,6 @@ struct net_device {
 * avoid dirtying this cache 
line.
 */
 
-   struct net_device   *master; /* Pointer to master device of a group,
- * which this device is member of.
- */
-
struct list_headupper_dev_list; /* List of upper devices */
 
/* Interface address info used in eth_type_trans() */
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 10/15] qeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock

2013-01-04 Thread Jiri Pirko
Also benefit from rcu_read_lock held and use __in_dev_get_rcu() in ipv4 case.

Signed-off-by: Jiri Pirko 
---
 drivers/s390/net/qeth_l3_main.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 6e5eef0..0749efe 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1640,6 +1640,7 @@ static void qeth_l3_add_mc(struct qeth_card *card, struct 
in_device *in4_dev)
}
 }
 
+/* called with rcu_read_lock */
 static void qeth_l3_add_vlan_mc(struct qeth_card *card)
 {
struct in_device *in_dev;
@@ -1652,19 +1653,14 @@ static void qeth_l3_add_vlan_mc(struct qeth_card *card)
for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) {
struct net_device *netdev;
 
-   rcu_read_lock();
netdev = __vlan_find_dev_deep(card->dev, vid);
-   rcu_read_unlock();
if (netdev == NULL ||
!(netdev->flags & IFF_UP))
continue;
-   in_dev = in_dev_get(netdev);
+   in_dev = __in_dev_get_rcu(netdev);
if (!in_dev)
continue;
-   rcu_read_lock();
qeth_l3_add_mc(card, in_dev);
-   rcu_read_unlock();
-   in_dev_put(in_dev);
}
 }
 
@@ -1673,14 +1669,14 @@ static void qeth_l3_add_multicast_ipv4(struct qeth_card 
*card)
struct in_device *in4_dev;
 
QETH_CARD_TEXT(card, 4, "chkmcv4");
-   in4_dev = in_dev_get(card->dev);
-   if (in4_dev == NULL)
-   return;
rcu_read_lock();
+   in4_dev = __in_dev_get_rcu(card->dev);
+   if (in4_dev == NULL)
+   goto unlock;
qeth_l3_add_mc(card, in4_dev);
qeth_l3_add_vlan_mc(card);
+unlock:
rcu_read_unlock();
-   in_dev_put(in4_dev);
 }
 
 #ifdef CONFIG_QETH_IPV6
@@ -1705,6 +1701,7 @@ static void qeth_l3_add_mc6(struct qeth_card *card, 
struct inet6_dev *in6_dev)
}
 }
 
+/* called with rcu_read_lock */
 static void qeth_l3_add_vlan_mc6(struct qeth_card *card)
 {
struct inet6_dev *in_dev;
@@ -1741,10 +1738,12 @@ static void qeth_l3_add_multicast_ipv6(struct qeth_card 
*card)
in6_dev = in6_dev_get(card->dev);
if (in6_dev == NULL)
return;
+   rcu_read_lock();
read_lock_bh(&in6_dev->lock);
qeth_l3_add_mc6(card, in6_dev);
qeth_l3_add_vlan_mc6(card);
read_unlock_bh(&in6_dev->lock);
+   rcu_read_unlock();
in6_dev_put(in6_dev);
 }
 #endif /* CONFIG_QETH_IPV6 */
@@ -1813,8 +1812,10 @@ static void qeth_l3_free_vlan_addresses6(struct 
qeth_card *card,
 static void qeth_l3_free_vlan_addresses(struct qeth_card *card,
unsigned short vid)
 {
+   rcu_read_lock();
qeth_l3_free_vlan_addresses4(card, vid);
qeth_l3_free_vlan_addresses6(card, vid);
+   rcu_read_unlock();
 }
 
 static int qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 14/15] net: remove no longer used netdev_set_bond_master() and netdev_set_master()

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 include/linux/netdevice.h |  6 +
 net/core/dev.c| 63 ---
 2 files changed, 1 insertion(+), 68 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 52d1146..c3723ef 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -856,8 +856,7 @@ struct netdev_fcoe_hbainfo {
  * flow_id is a flow ID to be passed to rps_may_expire_flow() later.
  * Return the filter ID on success, or a negative error code.
  *
- * Slave management functions (for bridge, bonding, etc). User should
- * call netdev_set_master() to set dev->master properly.
+ * Slave management functions (for bridge, bonding, etc).
  * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
  * Called to make another netdev an underling.
  *
@@ -2648,9 +2647,6 @@ extern int netdev_master_upper_dev_link(struct net_device 
*dev,
struct net_device *upper_dev);
 extern void netdev_upper_dev_unlink(struct net_device *dev,
struct net_device *upper_dev);
-extern int netdev_set_master(struct net_device *dev, struct 
net_device *master);
-extern int netdev_set_bond_master(struct net_device *dev,
- struct net_device *master);
 extern int skb_checksum_help(struct sk_buff *skb);
 extern struct sk_buff *skb_gso_segment(struct sk_buff *skb,
netdev_features_t features);
diff --git a/net/core/dev.c b/net/core/dev.c
index 3cd8424..ba50a17 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4826,69 +4826,6 @@ void netdev_upper_dev_unlink(struct net_device *dev,
 }
 EXPORT_SYMBOL(netdev_upper_dev_unlink);
 
-/**
- * netdev_set_master   -   set up master pointer
- * @slave: slave device
- * @master: new master device
- *
- * Changes the master device of the slave. Pass %NULL to break the
- * bonding. The caller must hold the RTNL semaphore. On a failure
- * a negative errno code is returned. On success the reference counts
- * are adjusted and the function returns zero.
- */
-int netdev_set_master(struct net_device *slave, struct net_device *master)
-{
-   struct net_device *old = slave->master;
-   int err;
-
-   ASSERT_RTNL();
-
-   if (master) {
-   if (old)
-   return -EBUSY;
-   err = netdev_master_upper_dev_link(slave, master);
-   if (err)
-   return err;
-   }
-
-   slave->master = master;
-
-   if (old)
-   netdev_upper_dev_unlink(slave, master);
-
-   return 0;
-}
-EXPORT_SYMBOL(netdev_set_master);
-
-/**
- * netdev_set_bond_master  -   set up bonding master/slave pair
- * @slave: slave device
- * @master: new master device
- *
- * Changes the master device of the slave. Pass %NULL to break the
- * bonding. The caller must hold the RTNL semaphore. On a failure
- * a negative errno code is returned. On success %RTM_NEWLINK is sent
- * to the routing socket and the function returns zero.
- */
-int netdev_set_bond_master(struct net_device *slave, struct net_device *master)
-{
-   int err;
-
-   ASSERT_RTNL();
-
-   err = netdev_set_master(slave, master);
-   if (err)
-   return err;
-   if (master)
-   slave->flags |= IFF_SLAVE;
-   else
-   slave->flags &= ~IFF_SLAVE;
-
-   rtmsg_ifinfo(RTM_NEWLINK, slave, IFF_SLAVE);
-   return 0;
-}
-EXPORT_SYMBOL(netdev_set_bond_master);
-
 static void dev_change_rx_flags(struct net_device *dev, int flags)
 {
const struct net_device_ops *ops = dev->netdev_ops;
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 12/15] nes: remove usage of dev->master

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 drivers/infiniband/hw/nes/nes.c| 8 +---
 drivers/infiniband/hw/nes/nes_cm.c | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 748db2d..d129c36 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -135,6 +135,7 @@ static int nes_inetaddr_event(struct notifier_block 
*notifier,
struct net_device *event_netdev = ifa->ifa_dev->dev;
struct nes_device *nesdev;
struct net_device *netdev;
+   struct net_device *upper_dev;
struct nes_vnic *nesvnic;
unsigned int is_bonded;
 
@@ -145,8 +146,9 @@ static int nes_inetaddr_event(struct notifier_block 
*notifier,
nesdev, nesdev->netdev[0]->name);
netdev = nesdev->netdev[0];
nesvnic = netdev_priv(netdev);
+   upper_dev = netdev_master_upper_dev_get(netdev);
is_bonded = netif_is_bond_slave(netdev) &&
-   (netdev->master == event_netdev);
+   (upper_dev == event_netdev);
if ((netdev == event_netdev) || is_bonded) {
if (nesvnic->rdma_enabled == 0) {
nes_debug(NES_DBG_NETDEV, "Returning without 
processing event for %s since"
@@ -179,9 +181,9 @@ static int nes_inetaddr_event(struct notifier_block 
*notifier,
/* fall through */
case NETDEV_CHANGEADDR:
/* Add the address to the IP table */
-   if (netdev->master)
+   if (upper_dev)
nesvnic->local_ipaddr =
-   ((struct in_device 
*)netdev->master->ip_ptr)->ifa_list->ifa_address;
+   ((struct in_device 
*)upper_dev->ip_ptr)->ifa_list->ifa_address;
else
nesvnic->local_ipaddr = 
ifa->ifa_address;
 
diff --git a/drivers/infiniband/hw/nes/nes_cm.c 
b/drivers/infiniband/hw/nes/nes_cm.c
index 22ea67e..24b9f1a 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1340,7 +1340,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic 
*nesvnic, u32 dst_ip, int arpi
}
 
if (netif_is_bond_slave(nesvnic->netdev))
-   netdev = nesvnic->netdev->master;
+   netdev = netdev_master_upper_dev_get(nesvnic->netdev);
else
netdev = nesvnic->netdev;
 
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [trivial] h8300: Fix home page URL in h8300/README

2013-01-04 Thread Masanari Iida
Correct home page URL in h8300/README.

Signed-off-by: Masanari Iida 
---
 arch/h8300/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/h8300/README b/arch/h8300/README
index 637f5a0..efa805f 100644
--- a/arch/h8300/README
+++ b/arch/h8300/README
@@ -11,7 +11,7 @@ H8/300H and H8S
 2.AE 3068/AE 3069
   more information 
   MICROTRONIQUE 
-  Akizuki Denshi Tsusho Ltd.  (Japanese Only)
+  Akizuki Denshi Tsusho Ltd.  (Japanese Only)
 
 3.H8MAX 
   see http://ip-sol.jp/h8max/ (Japanese Only)
-- 
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 11/15] vlan: remove usage of dev->master in __vlan_find_dev_deep()

2013-01-04 Thread Jiri Pirko
Also, since all users call __vlan_find_dev_deep() with rcu_read_lock,
make no possibility to call this with rtnl mutex held only.

Signed-off-by: Jiri Pirko 
---
 net/8021q/vlan_core.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 65e06ab..380440b 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -60,21 +60,25 @@ bool vlan_do_receive(struct sk_buff **skbp)
return true;
 }
 
-/* Must be invoked with rcu_read_lock or with RTNL. */
-struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
+/* Must be invoked with rcu_read_lock. */
+struct net_device *__vlan_find_dev_deep(struct net_device *dev,
u16 vlan_id)
 {
-   struct vlan_info *vlan_info = rcu_dereference_rtnl(real_dev->vlan_info);
+   struct vlan_info *vlan_info = rcu_dereference(dev->vlan_info);
 
if (vlan_info) {
return vlan_group_get_device(&vlan_info->grp, vlan_id);
} else {
/*
-* Bonding slaves do not have grp assigned to themselves.
-* Grp is assigned to bonding master instead.
+* Lower devices of master uppers (bonding, team) do not have
+* grp assigned to themselves. Grp is assigned to upper device
+* instead.
 */
-   if (netif_is_bond_slave(real_dev))
-   return __vlan_find_dev_deep(real_dev->master, vlan_id);
+   struct net_device *upper_dev;
+
+   upper_dev = netdev_master_upper_dev_get_rcu(dev);
+   if (upper_dev)
+   return __vlan_find_dev_deep(upper_dev, vlan_id);
}
 
return NULL;
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 08/15] cxgb3: remove usage of dev->master

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c 
b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
index 942dace..3f1f501 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
@@ -182,14 +182,17 @@ static struct net_device *get_iff_from_mac(struct adapter 
*adapter,
struct net_device *dev = adapter->port[i];
 
if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) {
+   rcu_read_lock();
if (vlan && vlan != VLAN_VID_MASK) {
-   rcu_read_lock();
dev = __vlan_find_dev_deep(dev, vlan);
-   rcu_read_unlock();
} else if (netif_is_bond_slave(dev)) {
-   while (dev->master)
-   dev = dev->master;
+   struct net_device *upper_dev;
+
+   while ((upper_dev =
+   netdev_master_upper_dev_get_rcu(dev)))
+   dev = upper_dev;
}
+   rcu_read_unlock();
return dev;
}
}
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 07/15] netpoll: remove usage of dev->master

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 net/core/netpoll.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 3151acf..d2bda8e 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -210,9 +210,12 @@ static void netpoll_poll_dev(struct net_device *dev)
 
if (dev->flags & IFF_SLAVE) {
if (ni) {
-   struct net_device *bond_dev = dev->master;
+   struct net_device *bond_dev;
struct sk_buff *skb;
-   struct netpoll_info *bond_ni = 
rcu_dereference_bh(bond_dev->npinfo);
+   struct netpoll_info *bond_ni;
+
+   bond_dev = netdev_master_upper_dev_get_rcu(dev);
+   bond_ni = rcu_dereference_bh(bond_dev->npinfo);
while ((skb = skb_dequeue(&ni->arp_tx))) {
skb->dev = bond_dev;
skb_queue_tail(&bond_ni->arp_tx, skb);
@@ -815,7 +818,7 @@ int netpoll_setup(struct netpoll *np)
return -ENODEV;
}
 
-   if (ndev->master) {
+   if (netdev_master_upper_dev_get(ndev)) {
np_err(np, "%s is a slave device, aborting\n", np->dev_name);
err = -EBUSY;
goto put;
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 02/15] macvlan: add link to upper device

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 drivers/net/macvlan.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 68a43fe..b7b614f 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -765,16 +765,22 @@ int macvlan_common_newlink(struct net *src_net, struct 
net_device *dev,
memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN);
}
 
+   err = netdev_upper_dev_link(lowerdev, dev);
+   if (err)
+   goto destroy_port;
+
port->count += 1;
err = register_netdevice(dev);
if (err < 0)
-   goto destroy_port;
+   goto upper_dev_unlink;
 
list_add_tail(&vlan->list, &port->vlans);
netif_stacked_transfer_operstate(lowerdev, dev);
 
return 0;
 
+upper_dev_unlink:
+   netdev_upper_dev_unlink(lowerdev, dev);
 destroy_port:
port->count -= 1;
if (!port->count)
@@ -798,6 +804,7 @@ void macvlan_dellink(struct net_device *dev, struct 
list_head *head)
 
list_del(&vlan->list);
unregister_netdevice_queue(dev, head);
+   netdev_upper_dev_unlink(vlan->lowerdev, dev);
 }
 EXPORT_SYMBOL_GPL(macvlan_dellink);
 
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 01/15] net: introduce upper device lists

2013-01-04 Thread Jiri Pirko
This lists are supposed to serve for storing pointers to all upper devices.
Eventually it will replace dev->master pointer which is used for
bonding, bridge, team but it cannot be used for vlan, macvlan where
there might be multiple upper present. In case the upper link is
replacement for dev->master, it is marked with "master" flag.

New upper device list resolves this limitation. Also, the information
stored in lists is used for preventing looping setups like
"bond->somethingelse->samebond"

Signed-off-by: Jiri Pirko 
---
 include/linux/netdevice.h |  14 +++
 net/core/dev.c| 239 +-
 2 files changed, 249 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6835b58..52d1146 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1172,6 +1172,8 @@ struct net_device {
  * which this device is member of.
  */
 
+   struct list_headupper_dev_list; /* List of upper devices */
+
/* Interface address info used in eth_type_trans() */
unsigned char   *dev_addr;  /* hw address, (before bcast
   because most packets are
@@ -2634,6 +2636,18 @@ extern int   netdev_max_backlog;
 extern int netdev_tstamp_prequeue;
 extern int weight_p;
 extern int bpf_jit_enable;
+
+extern bool netdev_has_upper_dev(struct net_device *dev,
+struct net_device *upper_dev);
+extern bool netdev_has_any_upper_dev(struct net_device *dev);
+extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
+extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device 
*dev);
+extern int netdev_upper_dev_link(struct net_device *dev,
+struct net_device *upper_dev);
+extern int netdev_master_upper_dev_link(struct net_device *dev,
+   struct net_device *upper_dev);
+extern void netdev_upper_dev_unlink(struct net_device *dev,
+   struct net_device *upper_dev);
 extern int netdev_set_master(struct net_device *dev, struct 
net_device *master);
 extern int netdev_set_bond_master(struct net_device *dev,
  struct net_device *master);
diff --git a/net/core/dev.c b/net/core/dev.c
index 21c5b97..3cd8424 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4600,6 +4600,232 @@ static int __init dev_proc_init(void)
 #endif /* CONFIG_PROC_FS */
 
 
+struct netdev_upper {
+   struct net_device *dev;
+   bool master;
+   struct list_head list;
+   struct rcu_head rcu;
+   struct list_head search_list;
+};
+
+static void __append_search_uppers(struct list_head *search_list,
+  struct net_device *dev)
+{
+   struct netdev_upper *upper;
+
+   list_for_each_entry(upper, &dev->upper_dev_list, list) {
+   /* check if this upper is not already in search list */
+   if (list_empty(&upper->search_list))
+   list_add_tail(&upper->search_list, search_list);
+   }
+}
+
+static bool __netdev_search_upper_dev(struct net_device *dev,
+ struct net_device *upper_dev)
+{
+   LIST_HEAD(search_list);
+   struct netdev_upper *upper;
+   struct netdev_upper *tmp;
+   bool ret = false;
+
+   __append_search_uppers(&search_list, dev);
+   list_for_each_entry(upper, &search_list, search_list) {
+   if (upper->dev == upper_dev) {
+   ret = true;
+   break;
+   }
+   __append_search_uppers(&search_list, upper->dev);
+   }
+   list_for_each_entry_safe(upper, tmp, &search_list, search_list)
+   INIT_LIST_HEAD(&upper->search_list);
+   return ret;
+}
+
+static struct netdev_upper *__netdev_find_upper(struct net_device *dev,
+   struct net_device *upper_dev)
+{
+   struct netdev_upper *upper;
+
+   list_for_each_entry(upper, &dev->upper_dev_list, list) {
+   if (upper->dev == upper_dev)
+   return upper;
+   }
+   return NULL;
+}
+
+/**
+ * netdev_has_upper_dev - Check if device is linked to an upper device
+ * @dev: device
+ * @upper_dev: upper device to check
+ *
+ * Find out if a device is linked to specified upper device and return true
+ * in case it is. Note that this checks only immediate upper device,
+ * not through a complete stack of devices. The caller must hold the RTNL lock.
+ */
+bool netdev_has_upper_dev(struct net_device *dev,
+ struct net_device *upper_dev)
+{
+   ASSERT_RTNL();
+
+   return __netdev_find_upper(dev, upper_dev);
+}
+EXPORT_SYMBOL(netdev_has_u

[patch net-next V6 06/15] bridge: remove usage of netdev_set_master()

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 net/bridge/br_if.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 1edd71d..2148d47 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -148,7 +148,7 @@ static void del_nbp(struct net_bridge_port *p)
netdev_rx_handler_unregister(dev);
synchronize_net();
 
-   netdev_set_master(dev, NULL);
+   netdev_upper_dev_unlink(dev, br->dev);
 
br_multicast_del_port(p);
 
@@ -364,7 +364,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
if (br_netpoll_info(br) && ((err = br_netpoll_enable(p, GFP_KERNEL
goto err3;
 
-   err = netdev_set_master(dev, br->dev);
+   err = netdev_master_upper_dev_link(dev, br->dev);
if (err)
goto err4;
 
@@ -403,7 +403,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
return 0;
 
 err5:
-   netdev_set_master(dev, NULL);
+   netdev_upper_dev_unlink(dev, br->dev);
 err4:
br_netpoll_disable(p);
 err3:
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch net-next V6 03/15] vlan: add link to upper device

2013-01-04 Thread Jiri Pirko
Signed-off-by: Jiri Pirko 
---
 net/8021q/vlan.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index a292e80..babfde9 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -105,6 +105,8 @@ void unregister_vlan_dev(struct net_device *dev, struct 
list_head *head)
 */
unregister_netdevice_queue(dev, head);
 
+   netdev_upper_dev_unlink(real_dev, dev);
+
if (grp->nr_vlan_devs == 0)
vlan_gvrp_uninit_applicant(real_dev);
 
@@ -162,9 +164,13 @@ int register_vlan_dev(struct net_device *dev)
if (err < 0)
goto out_uninit_applicant;
 
+   err = netdev_upper_dev_link(real_dev, dev);
+   if (err)
+   goto out_uninit_applicant;
+
err = register_netdevice(dev);
if (err < 0)
-   goto out_uninit_applicant;
+   goto out_upper_dev_unlink;
 
/* Account for reference in struct vlan_dev_priv */
dev_hold(real_dev);
@@ -180,6 +186,8 @@ int register_vlan_dev(struct net_device *dev)
 
return 0;
 
+out_upper_dev_unlink:
+   netdev_upper_dev_unlink(real_dev, dev);
 out_uninit_applicant:
if (grp->nr_vlan_devs == 0)
vlan_gvrp_uninit_applicant(real_dev);
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git pull] Input updates for 3.8-rc2

2013-01-04 Thread Dmitry Torokhov
Hi Linus,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem. Just a couple of driver
fixes this time.

Thanks!

Changelog:
-

Christophe TORDEUX (1):
  Input: sentelic - only report position of first finger as ST coordinates

Dmitry Torokhov (1):
  Input: gpio_keys - defer probing if GPIO probing is deferred

Gabor Juhos (1):
  Input: gpio_keys_polled - defer probing if GPIO probing is deferred


Diffstat:


 drivers/input/keyboard/gpio_keys.c| 13 -
 drivers/input/keyboard/gpio_keys_polled.c | 13 -
 drivers/input/mouse/sentelic.c|  2 +-
 3 files changed, 25 insertions(+), 3 deletions(-)

-- 
Dmitry



pgpLArmyKxK4V.pgp
Description: PGP signature


[RFC PATCH] mm: memblock: fix wrong memmove size in memblock_merge_regions()

2013-01-04 Thread Lin Feng
The memmove span covers from (next+1) to the end of the array, and the index
of next is (i+1), so the index of (next+1) is (i+2). So the size of remaining
array elements is (type->cnt - (i + 2)).

PS. It seems that memblock_merge_regions() could be made some improvement:
we need't memmove the remaining array elements until we find a none-mergable
element, but now we memmove everytime we find a neighboring compatible region.
I'm not sure if the trial is worth though.

Cc: Tejun Heo 
Signed-off-by: Lin Feng 
---
 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 6259055..85ce056 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -314,7 +314,7 @@ static void __init_memblock memblock_merge_regions(struct 
memblock_type *type)
}
 
this->size += next->size;
-   memmove(next, next + 1, (type->cnt - (i + 1)) * sizeof(*next));
+   memmove(next, next + 1, (type->cnt - (i + 2)) * sizeof(*next));
type->cnt--;
}
 }
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 net-next] softirq: reduce latencies

2013-01-04 Thread Joe Perches
On Fri, 2013-01-04 at 00:23 -0800, Eric Dumazet wrote:
> On Fri, 2013-01-04 at 00:15 -0800, Joe Perches wrote:
> > Perhaps MAX_SOFTIRQ_TIME should be
> > #define MAX_SOFTIRQ_TIME msecs_to_jiffies(2)
> > though it would be nicer if it were a compile time constant.
> 
> If you send a patch to convert msecs_to_jiffies() to an inline function
> when HZ = 1000, I will gladly use it instead of (2*HZ/1000)
> 
> Right now, max(1, msecs_to_jiffies(2)) uses way too many instructions,
> while it should be the constant 2, known at compile time.

Something like this might work.

This is incomplete, it just does msecs_to_jiffies,
and it should convert usecs_to_jiffies and the
jiffies_to_ types too.

Maybe it's worthwhile.

It does reduce object size by 16 bytes per call site
(x86-32) when the argument is a constant. There are
about 800 of these jiffies conversions in kernel sources.

What do you think?

 include/linux/jiffies.h | 49 -
 kernel/time.c   | 42 +++---
 2 files changed, 51 insertions(+), 40 deletions(-)

diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 82ed068..c67ddcf 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -291,7 +291,54 @@ extern unsigned long preset_lpj;
  */
 extern unsigned int jiffies_to_msecs(const unsigned long j);
 extern unsigned int jiffies_to_usecs(const unsigned long j);
-extern unsigned long msecs_to_jiffies(const unsigned int m);
+extern unsigned long __msecs_to_jiffies(const unsigned int m);
+
+static inline unsigned long __inline_msecs_to_jiffies(const unsigned int m)
+{
+   /*
+* Negative value, means infinite timeout:
+*/
+   if ((int)m < 0)
+   return MAX_JIFFY_OFFSET;
+
+#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
+   /*
+* HZ is equal to or smaller than 1000, and 1000 is a nice
+* round multiple of HZ, divide with the factor between them,
+* but round upwards:
+*/
+   return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
+#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
+   /*
+* HZ is larger than 1000, and HZ is a nice round multiple of
+* 1000 - simply multiply with the factor between them.
+*
+* But first make sure the multiplication result cannot
+* overflow:
+*/
+   if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
+   return MAX_JIFFY_OFFSET;
+
+   return m * (HZ / MSEC_PER_SEC);
+#else
+   /*
+* Generic case - multiply, round and divide. But first
+* check that if we are doing a net multiplication, that
+* we wouldn't overflow:
+*/
+   if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
+   return MAX_JIFFY_OFFSET;
+
+   return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
+   >> MSEC_TO_HZ_SHR32;
+#endif
+}
+
+#define msecs_to_jiffies(x)\
+   (__builtin_constant_p(x) ?  \
+__inline_msecs_to_jiffies(x) : \
+__msecs_to_jiffies(x))
+
 extern unsigned long usecs_to_jiffies(const unsigned int u);
 extern unsigned long timespec_to_jiffies(const struct timespec *value);
 extern void jiffies_to_timespec(const unsigned long jiffies,
diff --git a/kernel/time.c b/kernel/time.c
index d226c6a..231f2ac 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -425,47 +425,11 @@ EXPORT_SYMBOL(ns_to_timeval);
  *
  * We must also be careful about 32-bit overflows.
  */
-unsigned long msecs_to_jiffies(const unsigned int m)
+unsigned long __msecs_to_jiffies(const unsigned int m)
 {
-   /*
-* Negative value, means infinite timeout:
-*/
-   if ((int)m < 0)
-   return MAX_JIFFY_OFFSET;
-
-#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
-   /*
-* HZ is equal to or smaller than 1000, and 1000 is a nice
-* round multiple of HZ, divide with the factor between them,
-* but round upwards:
-*/
-   return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
-#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
-   /*
-* HZ is larger than 1000, and HZ is a nice round multiple of
-* 1000 - simply multiply with the factor between them.
-*
-* But first make sure the multiplication result cannot
-* overflow:
-*/
-   if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
-   return MAX_JIFFY_OFFSET;
-
-   return m * (HZ / MSEC_PER_SEC);
-#else
-   /*
-* Generic case - multiply, round and divide. But first
-* check that if we are doing a net multiplication, that
-* we wouldn't overflow:
-*/
-   if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
-   return MAX_JIFFY_OFFSET;
-
-   return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
-   >> MSEC_TO_HZ_SHR32;
-#endif
+   return __inline_msecs_to_

Re: [PATCH 3/4 v5 RESEND] rtc: add rtc-driver for HID sensors of type time

2013-01-04 Thread Jiri Kosina
On Thu, 3 Jan 2013, Andrew Morton wrote:

> > This driver makes the time from HID sensors (hubs) which are offering
> > such available like any other RTC does.
> > 
> > It is necessary that all values like year, month etc, are send as
> > 8bit values (1 byte each) and all of them in 1 report. Also the
> > spec HUTRR39b doesn't define the range of the year field, we
> > tread it as 0 - 99 because that's what most RTCs I know about are
> > offering.
> > 
> > Currently the time can only be read. Setting the time must be done
> > through sending a report (or a feature). The spec currently doesn't
> > define how and I'm not sure if I just should define something by myself.
> > 
> 
> Looks OK to me.  It sounds like Jonathan will be merging these patches
> when he's happy with them - please do proceed that way.

Yes, fine by me as well -- that's why I have provided by explicit Acks to 
those.

Jonathan, are you taking those, please?

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 29/32] block, aio: Batch completion for bios/kiocbs

2013-01-04 Thread Jens Axboe
On 2012-12-27 03:00, Kent Overstreet wrote:
> When completing a kiocb, there's some fixed overhead from touching the
> kioctx's ring buffer the kiocb belongs to. Some newer high end block
> devices can complete multiple IOs per interrupt, much like many network
> interfaces have been for some time.
> 
> This plumbs through infrastructure so we can take advantage of multiple
> completions at the interrupt level, and complete multiple kiocbs at the
> same time.
> 
> Drivers have to be converted to take advantage of this, but it's a
> simple change and the next patches will convert a few drivers.
> 
> To use it, an interrupt handler (or any code that completes bios or
> requests) declares and initializes a struct batch_complete:
> 
> struct batch_complete batch;
> batch_complete_init(&batch);
> 
> Then, instead of calling bio_endio(), it calls
> bio_endio_batch(bio, err, &batch). This just adds the bio to a list in
> the batch_complete.
> 
> At the end, it calls
> 
> batch_complete(&batch);
> 
> This completes all the bios all at once, building up a list of kiocbs;
> then the list of kiocbs are completed all at once.
> 
> Also, in order to batch up the kiocbs we have to add a different
> bio_endio function to struct bio, that takes a pointer to the
> batch_complete - this patch converts the dio code's bio_endio function.
> In order to avoid changing every bio_endio function in the kernel (there
> are many), we currently use a union and a flag to indicate what kind of
> bio endio function to call. This is admittedly a hack, but should
> suffice for now.

It is indeed a hack... Famous last words as well, I'm sure that'll stick
around forever if it goes in! Any ideas on how we can clean this up
before that?

Apart from that, I think the batching makes functional sense. For the
devices where we do get batches of completions (most of them), it's the
right thing to do. Would be nice it were better integrated though, not a
side hack.

Is the rbtree really faster than a basic (l)list and a sort before
completing them? Would be simpler.

A few small comments below.

> +void bio_endio_batch(struct bio *bio, int error, struct batch_complete 
> *batch)
> +{
> + if (error)
> + bio->bi_error = error;
> +
> + if (batch)
> + bio_list_add(&batch->bio, bio);
> + else
> + __bio_endio(bio, batch);
> +
> +}

Ugh, get rid of this 'batch' checking.

> +static inline void bio_endio(struct bio *bio, int error)
> +{
> + bio_endio_batch(bio, error, NULL);
> +}
> +

Just make that __bio_endio().

Same thing exists on the rq side, iirc.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/32] AIO performance improvements/cleanups, v3

2013-01-04 Thread Jens Axboe
On 2012-12-27 02:59, Kent Overstreet wrote:
> Last posting: http://article.gmane.org/gmane.linux.kernel.aio.general/3242
> 
> As before, changes should mostly be noted in the patch descriptions. 
> 
> Some random bits:
>  * flush_dcache_page() patch is new
>  * Rewrote the aio_read_evt() stuff again
>  * Fixed a few comments
>  * Included some more patches, notably the batch completion stuff
> 
> My git repo has Jens' aio/dio patches on top of this stuff. As of the
> latest version, I'm seeing a couple percent better throughput with the
> ring buffer, and I think Jens was seeing a couple percent better with
> his linked list approach - at this point I think the difference is
> noise, we're both testing with fairly crappy drivers.

I still see 10-15% better performance with my non-ring method, so it's a
bit faster than that. That's on the single device, driving that to the
maximum.


-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH] mm: memblock: optimize memblock_find_in_range_node() to minimize the search work

2013-01-04 Thread Lin Feng
The memblock array is in ascending order and we traverse the memblock array in
reverse order so we can add some simple check to reduce the search work.

Tejun fix a underflow bug in 5d53cb27d8, but I think we could break there for
the same reason.

Cc: Tejun Heo 
Signed-off-by: Lin Feng 
---
 mm/memblock.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 6259055..a710557 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -111,11 +111,18 @@ phys_addr_t __init_memblock 
memblock_find_in_range_node(phys_addr_t start,
end = max(start, end);
 
for_each_free_mem_range_reverse(i, nid, &this_start, &this_end, NULL) {
+   /*
+* exclude the regions out of the candidate range, since it's
+* likely to find a suitable range, we ignore the worst case.
+*/
+   if (this_start >= end)
+   continue;
+
this_start = clamp(this_start, start, end);
this_end = clamp(this_end, start, end);
 
if (this_end < size)
-   continue;
+   break;
 
cand = round_down(this_end - size, align);
if (cand >= this_start)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH resend 0/2] I2C: sis630: add sis964 support

2013-01-04 Thread Jean Delvare
On Fri, 28 Dec 2012 20:24:00 +0100, Amaury Decrême wrote:
> On Tue, Dec 18, 2012 at 12:51:05PM +0100, Jean Delvare wrote:
> > On Wed, 29 Aug 2012 03:35:13 +0200, Amaury Decrême wrote:
> > 
> > I reviewed these two patches 2 months ago, but did not hear back from
> > you since then. Do you plan to resubmit these patches with the
> > improvements I suggested? I would hate to see your work time and mine
> > wasted.
> 
> I'm sorry I gave no news. I read your improvments with interests
> when you sent it.
> 
> I changed my job at the very same moment  and didn't have a minute
> until xmas season..
> It's getting a bit better and I hope to send a working solution
> in early 2013 if the schedule is still ok.

Yes, that would be OK.

Thanks,
-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Support for Marvell 88E1510 and 88E1116R

2013-01-04 Thread Michal Simek
Hi Steve,

2013/1/2 Steven Wang :
> Hi, Michal,
>
> We do have the Ethernet support for 88E1510 (used on ZedBoard) in our 
> repository. The commit is
> https://github.com/Digilent/linux-digilent/commit/ae635e5fff35e9fe5928b4aca7264a1e5313a6b8
> Or, I can send the patch to you if you need.

I know. Can you please clean this patch and send it to mainline for review?
(Remove comment and that emacps connection).

I will add this patch to our tree to support this patch.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 0/9] Migrate Tegra to common clock framework

2013-01-04 Thread Prashant Gaikwad
This patchset does following:
1. Decompose single tegra clock structure into multiple clocks.
2. Try to use standard clock types supported by common clock framework.
3. Use dynamic initialization.
4. Move all clock code to drivers/clk/tegra from mach-tegra.
5. Add device tree support for Tegra20 and Tegra30 clocks.
6. Remove all legacy clock code from mach-tegra.

Tested on Tegra30 (Cardhu) and Tegra20 (Ventana).

Changes from v2:
Removed APB MISC node.
Fixed some issues reported by Joseph Lo.
Added function to read chip id revision register.

Changes from v1:
Rebased on linux-next for 20121224.

Prashant Gaikwad (8):
  ARM: tegra: Add function to read chipid
  clk: tegra: Add tegra specific clocks
  arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h
  ARM: Tegra: Define Tegra30 CAR binding
  clk: tegra: add clock support for tegra20
  clk: tegra: add clock support for tegra30
  arm: tegra: Migrate to new clock code
  arm: tegra: Remove legacy clock code

Stephen Warren (1):
  ARM: tegra: Define Tegra20 CAR binding

 .../bindings/clock/nvidia,tegra20-car.txt  |  205 ++
 .../bindings/clock/nvidia,tegra30-car.txt  |  270 +++
 arch/arm/boot/dts/tegra20.dtsi |6 +
 arch/arm/boot/dts/tegra30.dtsi |6 +
 arch/arm/mach-tegra/Makefile   |5 -
 arch/arm/mach-tegra/board-dt-tegra20.c |   30 -
 arch/arm/mach-tegra/board-dt-tegra30.c |   31 -
 arch/arm/mach-tegra/clock.c|  166 --
 arch/arm/mach-tegra/clock.h|  153 --
 arch/arm/mach-tegra/common.c   |   44 +-
 arch/arm/mach-tegra/cpu-tegra.c|2 +-
 arch/arm/mach-tegra/cpuidle-tegra30.c  |2 +-
 arch/arm/mach-tegra/fuse.c |   12 +-
 arch/arm/mach-tegra/hotplug.c  |2 +-
 arch/arm/mach-tegra/include/mach/clk.h |   44 -
 arch/arm/mach-tegra/pcie.c |2 +-
 arch/arm/mach-tegra/platsmp.c  |2 +-
 arch/arm/mach-tegra/pm.c   |2 +-
 arch/arm/mach-tegra/powergate.c|2 +-
 arch/arm/mach-tegra/tegra20_clocks.c   | 1623 -
 arch/arm/mach-tegra/tegra20_clocks.h   |   42 -
 arch/arm/mach-tegra/tegra20_clocks_data.c  | 1143 -
 arch/arm/mach-tegra/tegra30_clocks.c   | 2506 
 arch/arm/mach-tegra/tegra30_clocks.h   |   54 -
 arch/arm/mach-tegra/tegra30_clocks_data.c  | 1425 ---
 drivers/clk/Makefile   |1 +
 drivers/clk/tegra/Makefile |   11 +
 drivers/clk/tegra/clk-audio-sync.c |   89 +
 drivers/clk/tegra/clk-divider.c|  188 ++
 drivers/clk/tegra/clk-periph-gate.c|  182 ++
 drivers/clk/tegra/clk-periph.c |  228 ++
 drivers/clk/tegra/clk-pll-out.c|  124 +
 drivers/clk/tegra/clk-pll.c|  674 ++
 drivers/clk/tegra/clk-super.c  |  154 ++
 drivers/clk/tegra/clk-tegra20.c| 1244 ++
 drivers/clk/tegra/clk-tegra30.c| 2037 
 drivers/clk/tegra/clk.c|   85 +
 drivers/clk/tegra/clk.h|  486 
 drivers/dma/tegra20-apb-dma.c  |2 +-
 drivers/gpu/drm/tegra/dc.c |3 +-
 drivers/gpu/drm/tegra/drm.c|1 -
 drivers/gpu/drm/tegra/hdmi.c   |3 +-
 drivers/i2c/busses/i2c-tegra.c |3 +-
 drivers/input/keyboard/tegra-kbc.c |2 +-
 drivers/spi/spi-tegra20-sflash.c   |2 +-
 drivers/spi/spi-tegra20-slink.c|2 +-
 drivers/staging/nvec/nvec.c|3 +-
 .../tegra_cpu_car.h => include/linux/clk/tegra.h   |   13 +-
 include/linux/tegra-soc.h  |   22 +
 sound/soc/tegra/tegra30_ahub.c |2 +-
 50 files changed, 6048 insertions(+), 7292 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
 create mode 100644 
Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt
 delete mode 100644 arch/arm/mach-tegra/clock.c
 delete mode 100644 arch/arm/mach-tegra/clock.h
 delete mode 100644 arch/arm/mach-tegra/include/mach/clk.h
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks.c
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks.h
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks_data.c
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks.c
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks.h
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks_data.c
 create mode 100644 drivers/clk/tegra/Makefile
 create mode 100644 driver

[PATCH v3 6/9] clk: tegra: add clock support for tegra20

2013-01-04 Thread Prashant Gaikwad
Add tegra20 clock support based on common clock framework.

Signed-off-by: Prashant Gaikwad 
---
 drivers/clk/tegra/Makefile  |2 +
 drivers/clk/tegra/clk-tegra20.c | 1244 +++
 drivers/clk/tegra/clk.h |6 +
 3 files changed, 1252 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/tegra/clk-tegra20.c

diff --git a/drivers/clk/tegra/Makefile b/drivers/clk/tegra/Makefile
index 68bd353..00484fd 100644
--- a/drivers/clk/tegra/Makefile
+++ b/drivers/clk/tegra/Makefile
@@ -6,3 +6,5 @@ obj-y   += clk-periph-gate.o
 obj-y  += clk-pll.o
 obj-y  += clk-pll-out.o
 obj-y  += clk-super.o
+
+obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
new file mode 100644
index 000..bb94556
--- /dev/null
+++ b/drivers/clk/tegra/clk-tegra20.c
@@ -0,0 +1,1244 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk.h"
+
+#define RST_DEVICES_L 0x004
+#define RST_DEVICES_H 0x008
+#define RST_DEVICES_U 0x00c
+#define RST_DEVICES_SET_L 0x300
+#define RST_DEVICES_CLR_L 0x304
+#define RST_DEVICES_SET_H 0x308
+#define RST_DEVICES_CLR_H 0x30c
+#define RST_DEVICES_SET_U 0x310
+#define RST_DEVICES_CLR_U 0x314
+#define RST_DEVICES_NUM 3
+
+#define CLK_OUT_ENB_L 0x010
+#define CLK_OUT_ENB_H 0x014
+#define CLK_OUT_ENB_U 0x018
+#define CLK_OUT_ENB_SET_L 0x320
+#define CLK_OUT_ENB_CLR_L 0x324
+#define CLK_OUT_ENB_SET_H 0x328
+#define CLK_OUT_ENB_CLR_H 0x32c
+#define CLK_OUT_ENB_SET_U 0x330
+#define CLK_OUT_ENB_CLR_U 0x334
+#define CLK_OUT_ENB_NUM 3
+
+#define OSC_CTRL 0x50
+#define OSC_CTRL_OSC_FREQ_MASK (3<<30)
+#define OSC_CTRL_OSC_FREQ_13MHZ (0<<30)
+#define OSC_CTRL_OSC_FREQ_19_2MHZ (1<<30)
+#define OSC_CTRL_OSC_FREQ_12MHZ (2<<30)
+#define OSC_CTRL_OSC_FREQ_26MHZ (3<<30)
+#define OSC_CTRL_MASK (0x3f2 | OSC_CTRL_OSC_FREQ_MASK)
+
+#define OSC_CTRL_PLL_REF_DIV_MASK (3<<28)
+#define OSC_CTRL_PLL_REF_DIV_1 (0<<28)
+#define OSC_CTRL_PLL_REF_DIV_2 (1<<28)
+#define OSC_CTRL_PLL_REF_DIV_4 (2<<28)
+
+#define OSC_FREQ_DET 0x58
+#define OSC_FREQ_DET_TRIG (1<<31)
+
+#define OSC_FREQ_DET_STATUS 0x5c
+#define OSC_FREQ_DET_BUSY (1<<31)
+#define OSC_FREQ_DET_CNT_MASK 0x
+
+#define PLLS_BASE 0xf0
+#define PLLS_MISC 0xf4
+#define PLLC_BASE 0x80
+#define PLLC_MISC 0x8c
+#define PLLM_BASE 0x90
+#define PLLM_MISC 0x9c
+#define PLLP_BASE 0xa0
+#define PLLP_MISC 0xac
+#define PLLA_BASE 0xb0
+#define PLLA_MISC 0xbc
+#define PLLU_BASE 0xc0
+#define PLLU_MISC 0xcc
+#define PLLD_BASE 0xd0
+#define PLLD_MISC 0xdc
+#define PLLX_BASE 0xe0
+#define PLLX_MISC 0xe4
+#define PLLE_BASE 0xe8
+#define PLLE_MISC 0xec
+
+#define PLL_BASE_LOCK 27
+#define PLLE_MISC_LOCK 11
+
+#define PLL_MISC_LOCK_ENABLE 18
+#define PLLDU_MISC_LOCK_ENABLE 22
+#define PLLE_MISC_LOCK_ENABLE 9
+
+#define PLLC_OUT 0x84
+#define PLLM_OUT 0x94
+#define PLLP_OUTA 0xa4
+#define PLLP_OUTB 0xa8
+#define PLLA_OUT 0xb4
+
+#define CCLK_BURST_POLICY 0x20
+#define SUPER_CCLK_DIVIDER 0x24
+#define SCLK_BURST_POLICY 0x28
+#define SUPER_SCLK_DIVIDER 0x2c
+#define CLK_SYSTEM_RATE 0x30
+
+#define CLK_SOURCE_I2S1 0x100
+#define CLK_SOURCE_I2S2 0x104
+#define CLK_SOURCE_SPDIF_OUT 0x108
+#define CLK_SOURCE_SPDIF_IN 0x10c
+#define CLK_SOURCE_PWM 0x110
+#define CLK_SOURCE_SPI 0x114
+#define CLK_SOURCE_SBC1 0x134
+#define CLK_SOURCE_SBC2 0x118
+#define CLK_SOURCE_SBC3 0x11c
+#define CLK_SOURCE_SBC4 0x1b4
+#define CLK_SOURCE_XIO 0x120
+#define CLK_SOURCE_TWC 0x12c
+#define CLK_SOURCE_IDE 0x144
+#define CLK_SOURCE_NDFLASH 0x160
+#define CLK_SOURCE_VFIR 0x168
+#define CLK_SOURCE_SDMMC1 0x150
+#define CLK_SOURCE_SDMMC2 0x154
+#define CLK_SOURCE_SDMMC3 0x1bc
+#define CLK_SOURCE_SDMMC4 0x164
+#define CLK_SOURCE_CVE 0x140
+#define CLK_SOURCE_TVO 0x188
+#define CLK_SOURCE_TVDAC 0x194
+#define CLK_SOURCE_HDMI 0x18c
+#define CLK_SOURCE_DISP1 0x138
+#define CLK_SOURCE_DISP2 0x13c
+#define CLK_SOURCE_CSITE 0x1d4
+#define CLK_SOURCE_LA 0x1f8
+#define CLK_SOURCE_OWR 0x1cc
+#define CLK_SOURCE_NOR 0x1d0
+#define CLK_SOURCE_MIPI 0x174
+#define CLK_SOURCE_I2C1 0x124
+#define CLK_SOURCE_I2C2 0x198
+#define CLK_SOURCE_I2C3 0x1b8
+

[PATCH v3 5/9] ARM: Tegra: Define Tegra30 CAR binding

2013-01-04 Thread Prashant Gaikwad
The device tree binding models Tegra30 CAR (Clock And Reset)
as a single monolithic clock provider.

Signed-off-by: Prashant Gaikwad 
---
 .../bindings/clock/nvidia,tegra30-car.txt  |  270 
 arch/arm/boot/dts/tegra30.dtsi |6 +
 2 files changed, 276 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt

diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt 
b/Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt
new file mode 100644
index 000..6169493
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt
@@ -0,0 +1,270 @@
+NVIDIA Tegra30 Clock And Reset Controller
+
+This binding uses the common clock binding:
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+The CAR (Clock And Reset) Controller on Tegra is the HW module responsible
+for muxing and gating Tegra's clocks, and setting their rates.
+
+Required properties :
+- compatible : Should be "nvidia,tegra30-car"
+- reg : Should contain CAR registers location and length
+- clocks : Should contain phandle and clock specifiers for two clocks:
+  the 32 KHz "32k_in", and the board-specific oscillator "osc".
+- #clock-cells : Should be 1.
+  In clock consumers, this cell represents the clock ID exposed by the CAR.
+
+  The first 130 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
+  registers. These IDs often match those in the CAR's RST_DEVICES registers,
+  but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
+  this case, those clocks are assigned IDs above 160 in order to highlight
+  this issue. Implementations that interpret these clock IDs as bit values
+  within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
+  explicitly handle these special cases.
+
+  The balance of the clocks controlled by the CAR are assigned IDs of 160 and
+  above.
+
+  0cpu
+  1unassigned
+  2unassigned
+  3unassigned
+  4rtc
+  5timer
+  6uarta
+  7unassigned  (register bit affects uartb and vfir)
+  8gpio
+  9sdmmc2
+  10   unassigned  (register bit affects spdif_in and spdif_out)
+  11   i2s1
+  12   i2c1
+  13   ndflash
+  14   sdmmc1
+  15   sdmmc4
+  16   unassigned
+  17   pwm
+  18   i2s2
+  19   epp
+  20   unassigned  (register bit affects vi and vi_sensor)
+  21   2d
+  22   usbd
+  23   isp
+  24   3d
+  25   unassigned
+  26   disp2
+  27   disp1
+  28   host1x
+  29   vcp
+  30   i2s0
+  31   cop_cache
+
+  32   mc
+  33   ahbdma
+  34   apbdma
+  35   unassigned
+  36   kbc
+  37   statmon
+  38   pmc
+  39   unassigned  (register bit affects fuse and fuse_burn)
+  40   kfuse
+  41   sbc1
+  42   nor
+  43   unassigned
+  44   sbc2
+  45   unassigned
+  46   sbc3
+  47   i2c5
+  48   dsia
+  49   unassigned  (register bit affects cve and tvo)
+  50   mipi
+  51   hdmi
+  52   csi
+  53   tvdac
+  54   i2c2
+  55   uartc
+  56   unassigned
+  57   emc
+  58   usb2
+  59   usb3
+  60   mpe
+  61   vde
+  62   bsea
+  63   bsev
+
+  64   speedo
+  65   uartd
+  66   uarte
+  67   i2c3
+  68   sbc4
+  69   sdmmc3
+  70   pcie
+  71   owr
+  72   afi
+  73   csite
+  74   pciex
+  75   avpucq
+  76   la
+  77   unassigned
+  78   unassigned
+  79   dtv
+  80   ndspeed
+  81   i2cslow
+  82   dsib
+  83   unassigned
+  84   irama
+  85   iramb
+  86   iramc
+  87   iramd
+  88   cram2
+  89   unassigned
+  90   audio_2xa/k/a audio_2x_sync_clk
+  91   unassigned
+  92   csus
+  93   cdev2
+  94   cdev1
+  95   unassigned
+
+  96   cpu_g
+  97   cpu_lp
+  98   3d2
+  99   mselect
+  100  tsensor
+  101  i2s3
+  102  i2s4
+  103  i2c4
+  104  sbc5
+  105  sbc6
+  106  d_audio
+  107  apbif
+  108  dam0
+  109  dam1
+  110  dam2
+  111  hda2codec_2x
+  112  atomics
+  113  audio0_2x
+  114  audio1_2x
+  115  audio2_2x
+  116  audio3_2x
+  117  audio4_2x
+  118  audio5_2x
+  119  actmon
+  120  extern1
+  121  extern2
+  122  extern3
+  123  sata_oob
+  124  sata
+  125  hda
+  127  se
+  128  hda2hdmi
+  129  sata_cold
+
+  160  uartb
+  161  vfir
+  162  spdif_in
+  163  spdif_out
+  164  vi
+  165  vi_sensor
+  166  fuse
+  167  fuse_burn
+  168  cve
+  169  tvo
+
+  170  clk_32k
+  171  clk_m
+  172  clk_m_div2
+  173  clk_m_div4
+  174  pll_ref
+  175  pll_c
+  176  pll_c_out1
+  177  pll_m
+  178  pll_m_out1
+  179  pll_p
+  180  pll_p_out1
+  181  pll_p_out2
+  182  pll_p_out3
+  183  pll_p_out4
+  184  pll_a
+  185  pll_a_out0
+  186  pll_d
+  187  pll_d_out0
+  188  pll_d2
+  189  pll_d2_out0
+  190  pll_u
+  191  pll_x
+  192  pll_x_out0
+  193  pll_e
+  194  spdif_in_sync
+  195  i2s0_sync
+  196  i2s1_sync
+  197  i2s2_sync
+  198  i2s3_sync
+  199  i2s4_sync
+  200  vimclk
+  201  audio0
+  202  audio1
+  203  audio2
+  204  audio3
+  205  audio4
+  206  audio5
+  207  clk_out_1 (extern1)
+  208  clk_out_2 (extern2)
+  209  clk_out_3 (extern3)
+  210  sclk

[PATCH v3 1/9] ARM: tegra: Add function to read chipid

2013-01-04 Thread Prashant Gaikwad
Add function to read chip id from APB MISC registers. This function
will also get called from clock driver to flush write operations on
apb bus.

Signed-off-by: Prashant Gaikwad 
---
 arch/arm/mach-tegra/fuse.c |   12 ++--
 include/linux/tegra-soc.h  |   22 ++
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/tegra-soc.h

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index 8121742..2cd8ac9 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "fuse.h"
 #include "iomap.h"
@@ -105,6 +106,14 @@ static void tegra_get_process_id(void)
tegra_core_process_id = (reg >> 12) & 3;
 }
 
+void tegra_read_chipid(void)
+{
+   u32 reg;
+
+   reg = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
+   tegra_chip_id = (reg >> 8) & 0xff;
+}
+
 void tegra_init_fuse(void)
 {
u32 id;
@@ -119,8 +128,7 @@ void tegra_init_fuse(void)
reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
 
-   id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
-   tegra_chip_id = (id >> 8) & 0xff;
+   tegra_read_chipid();
 
switch (tegra_chip_id) {
case TEGRA20:
diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
new file mode 100644
index 000..dcbc14c
--- /dev/null
+++ b/include/linux/tegra-soc.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#ifndef __LINUX_TEGRA_SOC_H_
+#define __LINUX_TEGRA_SOC_H_
+
+void tegra_read_chipid(void);
+
+#endif /* __LINUX_TEGRA_SOC_H_ */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 8/9] arm: tegra: Migrate to new clock code

2013-01-04 Thread Prashant Gaikwad
Migrate tegra clock support to drivers/clk/tegra, this involves
moving
1. definition of tegra_cpu_car_ops to clk.c
2. definition of reset functions to clk-peripheral.c
3. change parent of cpu clock.
4. Remove legacy clock initialization.
5. Initialize clocks using DT.
6. Remove all instance of mach/clk.h

Signed-off-by: Prashant Gaikwad 
---
 arch/arm/mach-tegra/board-dt-tegra20.c |   30 -
 arch/arm/mach-tegra/board-dt-tegra30.c |   31 --
 arch/arm/mach-tegra/clock.c|   19 -
 arch/arm/mach-tegra/common.c   |   44 +--
 arch/arm/mach-tegra/cpu-tegra.c|2 +-
 arch/arm/mach-tegra/include/mach/clk.h |3 --
 arch/arm/mach-tegra/pcie.c |2 +-
 arch/arm/mach-tegra/powergate.c|2 +-
 drivers/clk/tegra/clk-periph.c |   38 +++
 drivers/clk/tegra/clk.c|   16 +++
 drivers/dma/tegra20-apb-dma.c  |2 +-
 drivers/gpu/drm/tegra/dc.c |3 +-
 drivers/gpu/drm/tegra/drm.c|1 -
 drivers/gpu/drm/tegra/hdmi.c   |3 +-
 drivers/i2c/busses/i2c-tegra.c |3 +-
 drivers/input/keyboard/tegra-kbc.c |2 +-
 drivers/spi/spi-tegra20-sflash.c   |2 +-
 drivers/spi/spi-tegra20-slink.c|2 +-
 drivers/staging/nvec/nvec.c|3 +-
 include/linux/clk/tegra.h  |5 +++
 sound/soc/tegra/tegra30_ahub.c |2 +-
 21 files changed, 73 insertions(+), 142 deletions(-)

diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c 
b/arch/arm/mach-tegra/board-dt-tegra20.c
index 8e35aae..c774a80 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -42,7 +42,6 @@
 #include 
 
 #include "board.h"
-#include "clock.h"
 #include "common.h"
 #include "iomap.h"
 
@@ -104,37 +103,8 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata 
= {
{}
 };
 
-static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
-   /* name parent  rateenabled */
-   { "uarta",  "pll_p",21600,  true },
-   { "uartd",  "pll_p",21600,  true },
-   { "usbd",   "clk_m",1200,   false },
-   { "usb2",   "clk_m",1200,   false },
-   { "usb3",   "clk_m",1200,   false },
-   { "pll_a",  "pll_p_out1",   56448000,   true },
-   { "pll_a_out0", "pll_a",11289600,   true },
-   { "cdev1",  NULL,   0,  true },
-   { "blink",  "clk_32k",  32768,  true },
-   { "i2s1",   "pll_a_out0",   11289600,   false},
-   { "i2s2",   "pll_a_out0",   11289600,   false},
-   { "sdmmc1", "pll_p",4800,   false},
-   { "sdmmc3", "pll_p",4800,   false},
-   { "sdmmc4", "pll_p",4800,   false},
-   { "spi","pll_p",2000,   false },
-   { "sbc1",   "pll_p",1,  false },
-   { "sbc2",   "pll_p",1,  false },
-   { "sbc3",   "pll_p",1,  false },
-   { "sbc4",   "pll_p",1,  false },
-   { "host1x", "pll_c",15000,  false },
-   { "disp1",  "pll_p",6,  false },
-   { "disp2",  "pll_p",6,  false },
-   { NULL, NULL,   0,  0},
-};
-
 static void __init tegra_dt_init(void)
 {
-   tegra_clk_init_from_table(tegra_dt_clk_init_table);
-
/*
 * Finished with the static registrations now; fill in the missing
 * devices
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c 
b/arch/arm/mach-tegra/board-dt-tegra30.c
index a9ed15d..35ddf72 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -35,7 +35,6 @@
 #include 
 
 #include "board.h"
-#include "clock.h"
 #include "common.h"
 #include "iomap.h"
 
@@ -67,38 +66,8 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
{}
 };
 
-static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
-   /* name parent  rateenabled */
-   { "uarta",  "pll_p",40800,  true },
-   { "pll_a",  "pll_p_out1",   56448,  true },
-   { "pll_a_out0", "pll_a",11289600,   true },
-   { "extern1","pll_a_out0",   0,  true },
-   { "clk_out_1",  "extern1",  0,  true },
-   { "blink",  "clk_32k",  32768,  true },
-   { "i2s0",   "pll_a_out0",   11289600,   false},
-   { "i2s1",   "pll_a_out0",   11289600,   false},
-   { "i2s2",   "pll_a_out0",   11289600,   false},
-   { "i2s3",  

[PATCH v3 3/9] arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h

2013-01-04 Thread Prashant Gaikwad
tegra_cpu_car_ops struct is going to be accessed from drivers/clk/tegra.
Move the tegra_cpu_car_ops to include/linux/clk/tegra.h.

Signed-off-by: Prashant Gaikwad 
---
 arch/arm/mach-tegra/clock.c|2 +-
 arch/arm/mach-tegra/cpuidle-tegra30.c  |2 +-
 arch/arm/mach-tegra/hotplug.c  |2 +-
 arch/arm/mach-tegra/platsmp.c  |2 +-
 arch/arm/mach-tegra/pm.c   |2 +-
 arch/arm/mach-tegra/tegra20_clocks.c   |2 +-
 arch/arm/mach-tegra/tegra20_clocks_data.c  |2 +-
 arch/arm/mach-tegra/tegra30_clocks.c   |2 +-
 arch/arm/mach-tegra/tegra30_clocks_data.c  |2 +-
 .../tegra_cpu_car.h => include/linux/clk/tegra.h   |6 +++---
 10 files changed, 12 insertions(+), 12 deletions(-)
 rename arch/arm/mach-tegra/tegra_cpu_car.h => include/linux/clk/tegra.h (96%)

diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index 867bf8b..8c0ff06 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -26,10 +26,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "board.h"
 #include "clock.h"
-#include "tegra_cpu_car.h"
 
 /* Global data of Tegra CPU CAR ops */
 struct tegra_cpu_car_ops *tegra_cpu_car_ops;
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c 
b/arch/arm/mach-tegra/cpuidle-tegra30.c
index 5e8cbf5..0b8c667 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra30.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra30.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -32,7 +33,6 @@
 
 #include "pm.h"
 #include "sleep.h"
-#include "tegra_cpu_car.h"
 
 #ifdef CONFIG_PM_SLEEP
 static int tegra30_idle_lp2(struct cpuidle_device *dev,
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index dca5141..2faea56 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -10,12 +10,12 @@
  */
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
 #include "sleep.h"
-#include "tegra_cpu_car.h"
 
 static void (*tegra_hotplug_shutdown)(void);
 
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 1b926df..dec6704 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -29,7 +30,6 @@
 #include "fuse.h"
 #include "flowctrl.h"
 #include "reset.h"
-#include "tegra_cpu_car.h"
 
 #include "common.h"
 #include "iomap.h"
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 1b11707..db44cd5 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -36,7 +37,6 @@
 #include "reset.h"
 #include "flowctrl.h"
 #include "sleep.h"
-#include "tegra_cpu_car.h"
 
 #define TEGRA_POWER_CPU_PWRREQ_OE  (1 << 16)  /* CPU pwr req enable */
 
diff --git a/arch/arm/mach-tegra/tegra20_clocks.c 
b/arch/arm/mach-tegra/tegra20_clocks.c
index 4eb6bc8..1a80ff6 100644
--- a/arch/arm/mach-tegra/tegra20_clocks.c
+++ b/arch/arm/mach-tegra/tegra20_clocks.c
@@ -26,12 +26,12 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "clock.h"
 #include "fuse.h"
 #include "iomap.h"
 #include "tegra2_emc.h"
-#include "tegra_cpu_car.h"
 
 #define RST_DEVICES0x004
 #define RST_DEVICES_SET0x300
diff --git a/arch/arm/mach-tegra/tegra20_clocks_data.c 
b/arch/arm/mach-tegra/tegra20_clocks_data.c
index a23a073..022cdae 100644
--- a/arch/arm/mach-tegra/tegra20_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra20_clocks_data.c
@@ -26,12 +26,12 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "clock.h"
 #include "fuse.h"
 #include "tegra2_emc.h"
 #include "tegra20_clocks.h"
-#include "tegra_cpu_car.h"
 
 /* Clock definitions */
 
diff --git a/arch/arm/mach-tegra/tegra30_clocks.c 
b/arch/arm/mach-tegra/tegra30_clocks.c
index d714777..4330787 100644
--- a/arch/arm/mach-tegra/tegra30_clocks.c
+++ b/arch/arm/mach-tegra/tegra30_clocks.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -36,7 +37,6 @@
 #include "clock.h"
 #include "fuse.h"
 #include "iomap.h"
-#include "tegra_cpu_car.h"
 
 #define USE_PLL_LOCK_BITS 0
 
diff --git a/arch/arm/mach-tegra/tegra30_clocks_data.c 
b/arch/arm/mach-tegra/tegra30_clocks_data.c
index 6942c7a..ee01711 100644
--- a/arch/arm/mach-tegra/tegra30_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra30_clocks_data.c
@@ -28,11 +28,11 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "clock.h"
 #include "fuse.h"
 #include "tegra30_clocks.h"
-#include "tegra_cpu_car.h"
 
 #define DEFINE_CLK_TEGRA(_name, _rate, _ops, _flags,   \
   _parent_names, _parents, _parent)\
diff --git a/arch/arm/mach-tegra/tegra_cpu_car.h b/include/linux/clk/tegra.h
similarity index 96%
rename from arch/arm/mach-tegra/tegra_cpu_car

[PATCH v3 4/9] ARM: tegra: Define Tegra20 CAR binding

2013-01-04 Thread Prashant Gaikwad
From: Stephen Warren 

The Tegra20 CAR (Clock And Reset) Controller controls most aspects of
most clocks within Tegra20. The device tree binding models this as a
single monolithic clock provider, which exports many clocks. This reduces
the number of nodes needed in device tree to represent these clocks.

This binding is only useful for Tegra20; the set of clocks that exists on
Tegra30 is sufficiently different to merit its own binding.

Signed-off-by: Stephen Warren 
Acked-by: Simon Glass 
[pgaikwad: Added mux clk ids and sorted CAR node]
Signed-off-by: Prashant Gaikwad 
---
 .../bindings/clock/nvidia,tegra20-car.txt  |  205 
 arch/arm/boot/dts/tegra20.dtsi |6 +
 2 files changed, 211 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt

diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt 
b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
new file mode 100644
index 000..0921fac
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
@@ -0,0 +1,205 @@
+NVIDIA Tegra20 Clock And Reset Controller
+
+This binding uses the common clock binding:
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+The CAR (Clock And Reset) Controller on Tegra is the HW module responsible
+for muxing and gating Tegra's clocks, and setting their rates.
+
+Required properties :
+- compatible : Should be "nvidia,tegra20-car"
+- reg : Should contain CAR registers location and length
+- clocks : Should contain phandle and clock specifiers for two clocks:
+  the 32 KHz "32k_in", and the board-specific oscillator "osc".
+- #clock-cells : Should be 1.
+  In clock consumers, this cell represents the clock ID exposed by the CAR.
+
+  The first 96 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
+  registers. These IDs often match those in the CAR's RST_DEVICES registers,
+  but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
+  this case, those clocks are assigned IDs above 95 in order to highlight
+  this issue. Implementations that interpret these clock IDs as bit values
+  within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
+  explicitly handle these special cases.
+
+  The balance of the clocks controlled by the CAR are assigned IDs of 96 and
+  above.
+
+  0cpu
+  1unassigned
+  2unassigned
+  3ac97
+  4rtc
+  5tmr
+  6uart1
+  7unassigned  (register bit affects uart2 and vfir)
+  8gpio
+  9sdmmc2
+  10   unassigned  (register bit affects spdif_in and spdif_out)
+  11   i2s1
+  12   i2c1
+  13   ndflash
+  14   sdmmc1
+  15   sdmmc4
+  16   twc
+  17   pwm
+  18   i2s2
+  19   epp
+  20   unassigned  (register bit affects vi and vi_sensor)
+  21   2d
+  22   usbd
+  23   isp
+  24   3d
+  25   ide
+  26   disp2
+  27   disp1
+  28   host1x
+  29   vcp
+  30   unassigned
+  31   cache2
+
+  32   mem
+  33   ahbdma
+  34   apbdma
+  35   unassigned
+  36   kbc
+  37   stat_mon
+  38   pmc
+  39   fuse
+  40   kfuse
+  41   sbc1
+  42   snor
+  43   spi1
+  44   sbc2
+  45   xio
+  46   sbc3
+  47   dvc
+  48   dsi
+  49   unassigned  (register bit affects tvo and cve)
+  50   mipi
+  51   hdmi
+  52   csi
+  53   tvdac
+  54   i2c2
+  55   uart3
+  56   unassigned
+  57   emc
+  58   usb2
+  59   usb3
+  60   mpe
+  61   vde
+  62   bsea
+  63   bsev
+
+  64   speedo
+  65   uart4
+  66   uart5
+  67   i2c3
+  68   sbc4
+  69   sdmmc3
+  70   pcie
+  71   owr
+  72   afi
+  73   csite
+  74   unassigned
+  75   avpucq
+  76   la
+  77   unassigned
+  78   unassigned
+  79   unassigned
+  80   unassigned
+  81   unassigned
+  82   unassigned
+  83   unassigned
+  84   irama
+  85   iramb
+  86   iramc
+  87   iramd
+  88   cram2
+  89   audio_2xa/k/a audio_2x_sync_clk
+  90   clk_d
+  91   unassigned
+  92   sus
+  93   cdev1
+  94   cdev2
+  95   unassigned
+
+  96   uart2
+  97   vfir
+  98   spdif_in
+  99   spdif_out
+  100  vi
+  101  vi_sensor
+  102  tvo
+  103  cve
+  104  osc
+  105  clk_32k a/k/a clk_s
+  106  clk_m
+  107  sclk
+  108  cclk
+  109  hclk
+  110  pclk
+  111  blink
+  112  pll_a
+  113  pll_a_out0
+  114  pll_c
+  115  pll_c_out1
+  116  pll_d
+  117  pll_d_out0
+  118  pll_e
+  119  pll_m
+  120  pll_m_out1
+  121  pll_p
+  122  pll_p_out1
+  123  pll_p_out2
+  124  pll_p_out3
+  125  pll_p_out4
+  126  pll_s
+  127  pll_u
+  128  pll_x
+  129  cop a/k/a avp
+  130  audio   a/k/a audio_sync_clk
+  131  pll_ref
+  132  twd
+
+Example SoC include file:
+
+/ {
+   tegra_car: clock {
+   compatible = "nvidia,tegra20-car";
+   reg = <0x60006000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+   usb@c5004000 {
+   clocks = <&tegra_car 58>; /* usb2 */
+   };
+};
+
+Example board file:
+
+/ {
+   clocks {
+   compat

[PATCH 1/7] ARM: dt: tegra20: Add clock information

2013-01-04 Thread Prashant Gaikwad
Add clock information to device nodes.

Signed-off-by: Prashant Gaikwad 
---
Tested on Ventana (Tegra20) and Cardhu (Tegra30).
This series depends on ccf-rework patch series.
---
 arch/arm/boot/dts/tegra20.dtsi |   41 
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index be3421d..8cc5295 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -17,6 +17,7 @@
reg = <0x5000 0x00024000>;
interrupts = <0 65 0x04   /* mpcore syncpt */
  0 67 0x04>; /* mpcore general */
+   clocks = <&tegra_car 28>;
 
#address-cells = <1>;
#size-cells = <1>;
@@ -27,41 +28,48 @@
compatible = "nvidia,tegra20-mpe";
reg = <0x5404 0x0004>;
interrupts = <0 68 0x04>;
+   clocks = <&tegra_car 60>;
};
 
vi {
compatible = "nvidia,tegra20-vi";
reg = <0x5408 0x0004>;
interrupts = <0 69 0x04>;
+   clocks = <&tegra_car 100>;
};
 
epp {
compatible = "nvidia,tegra20-epp";
reg = <0x540c 0x0004>;
interrupts = <0 70 0x04>;
+   clocks = <&tegra_car 19>;
};
 
isp {
compatible = "nvidia,tegra20-isp";
reg = <0x5410 0x0004>;
interrupts = <0 71 0x04>;
+   clocks = <&tegra_car 23>;
};
 
gr2d {
compatible = "nvidia,tegra20-gr2d";
reg = <0x5414 0x0004>;
interrupts = <0 72 0x04>;
+   clocks = <&tegra_car 21>;
};
 
gr3d {
compatible = "nvidia,tegra20-gr3d";
reg = <0x5418 0x0004>;
+   clocks = <&tegra_car 24>;
};
 
dc@5420 {
compatible = "nvidia,tegra20-dc";
reg = <0x5420 0x0004>;
interrupts = <0 73 0x04>;
+   clocks = <&tegra_car 27>;
 
rgb {
status = "disabled";
@@ -72,6 +80,7 @@
compatible = "nvidia,tegra20-dc";
reg = <0x5424 0x0004>;
interrupts = <0 74 0x04>;
+   clocks = <&tegra_car 26>;
 
rgb {
status = "disabled";
@@ -83,6 +92,7 @@
reg = <0x5428 0x0004>;
interrupts = <0 75 0x04>;
status = "disabled";
+   clocks = <&tegra_car 51>;
};
 
tvo {
@@ -90,12 +100,14 @@
reg = <0x542c 0x0004>;
interrupts = <0 76 0x04>;
status = "disabled";
+   clocks = <&tegra_car 102>;
};
 
dsi {
compatible = "nvidia,tegra20-dsi";
reg = <0x5430 0x0004>;
status = "disabled";
+   clocks = <&tegra_car 48>;
};
};
 
@@ -156,6 +168,7 @@
  0 117 0x04
  0 118 0x04
  0 119 0x04>;
+   clocks = <&tegra_car 34>;
};
 
ahb {
@@ -198,6 +211,7 @@
interrupts = <0 13 0x04>;
nvidia,dma-request-selector = <&apbdma 2>;
status = "disabled";
+   clocks = <&tegra_car 11>;
};
 
tegra_i2s2: i2s@70002a00 {
@@ -206,6 +220,7 @@
interrupts = <0 3 0x04>;
nvidia,dma-request-selector = <&apbdma 1>;
status = "disabled";
+   clocks = <&tegra_car 18>;
};
 
/*
@@ -222,6 +237,7 @@
interrupts = <0 36 0x04>;
nvidia,dma-request-selector = <&apbdma 8>;
status = "disabled";
+   clocks = <&tegra_car 6>;
};
 
uartb: serial@70006040 {
@@ -231,6 +247,7 @@
interrupts = <0 37 0x04>;
nvidia,dma-request-selector = <&apbdma 9>;
status = "disabled";
+   clocks = <&tegra_car 96>;
};
 
uartc: serial@70006200 {
@@ -240,6 +257,7 @@
interrupts = <0 46 0x04>;
nvidia,dma-request-selector = <&apbdma 10>

[PATCH 4/7] arm: tegra20: remove auxdata

2013-01-04 Thread Prashant Gaikwad
Remove AUXDATA as clock are initialized from device node.

Signed-off-by: Prashant Gaikwad 
---
 arch/arm/mach-tegra/board-dt-tegra20.c |   24 
 1 files changed, 0 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c 
b/arch/arm/mach-tegra/board-dt-tegra20.c
index c774a80..2b5fed7 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -70,36 +70,12 @@ struct tegra_ehci_platform_data tegra_ehci3_pdata = {
 };
 
 struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, 
"sdhci-tegra.0", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, 
"sdhci-tegra.1", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, 
"sdhci-tegra.2", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC4_BASE, 
"sdhci-tegra.3", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C_BASE, "tegra-i2c.0", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C2_BASE, "tegra-i2c.1", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C3_BASE, "tegra-i2c.2", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c-dvc", TEGRA_DVC_BASE, "tegra-i2c.3", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra20-i2s.0", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S2_BASE, "tegra20-i2s.1", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, 
"tegra20-das", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB_BASE, "tegra-ehci.0",
   &tegra_ehci1_pdata),
OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB2_BASE, "tegra-ehci.1",
   &tegra_ehci2_pdata),
OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB3_BASE, "tegra-ehci.2",
   &tegra_ehci3_pdata),
-   OF_DEV_AUXDATA("nvidia,tegra20-apbdma", TEGRA_APB_DMA_BASE, 
"tegra-apbdma", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-pwm", TEGRA_PWFM_BASE, "tegra-pwm", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-sflash", 0x7000c380, "spi", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D400, "spi_tegra.0", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D600, "spi_tegra.1", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D800, "spi_tegra.2", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000DA00, "spi_tegra.3", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-host1x", 0x5000, "host1x", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-dc", 0x5420, "tegradc.0", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-dc", 0x5424, "tegradc.1", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-hdmi", 0x5428, "hdmi", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-dsi", 0x5430, "dsi", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-tvo", 0x542c, "tvo", NULL),
{}
 };
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/7] clk: tegra20: remove unused TEGRA_CLK_DUPLICATE()s

2013-01-04 Thread Prashant Gaikwad
With device tree support added for Tegra clocks look up is done from
device tree, remove unused TEGRA_CLK_DUPLICATE()s.

Signed-off-by: Prashant Gaikwad 
---
 drivers/clk/tegra/clk-tegra20.c |   17 -
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
index bb94556..92c1190 100644
--- a/drivers/clk/tegra/clk-tegra20.c
+++ b/drivers/clk/tegra/clk-tegra20.c
@@ -1164,28 +1164,11 @@ static __initdata struct tegra_clk_init_table 
init_table[] = {
  * table under two names.
  */
 static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
-   TEGRA_CLK_DUPLICATE(uarta,  "serial8250.0", NULL),
-   TEGRA_CLK_DUPLICATE(uartb,  "serial8250.1", NULL),
-   TEGRA_CLK_DUPLICATE(uartc,  "serial8250.2", NULL),
-   TEGRA_CLK_DUPLICATE(uartd,  "serial8250.3", NULL),
-   TEGRA_CLK_DUPLICATE(uarte,  "serial8250.4", NULL),
TEGRA_CLK_DUPLICATE(usbd,   "utmip-pad",NULL),
TEGRA_CLK_DUPLICATE(usbd,   "tegra-ehci.0", NULL),
TEGRA_CLK_DUPLICATE(usbd,   "tegra-otg",NULL),
-   TEGRA_CLK_DUPLICATE(hdmi,   "tegradc.0","hdmi"),
-   TEGRA_CLK_DUPLICATE(hdmi,   "tegradc.1","hdmi"),
-   TEGRA_CLK_DUPLICATE(host1x, "tegra_grhost", "host1x"),
-   TEGRA_CLK_DUPLICATE(gr2d,   "tegra_grhost", "gr2d"),
-   TEGRA_CLK_DUPLICATE(gr3d,   "tegra_grhost", "gr3d"),
-   TEGRA_CLK_DUPLICATE(epp,"tegra_grhost", "epp"),
-   TEGRA_CLK_DUPLICATE(mpe,"tegra_grhost", "mpe"),
-   TEGRA_CLK_DUPLICATE(vde,"tegra-aes","vde"),
TEGRA_CLK_DUPLICATE(cclk,   NULL,   "cpu"),
TEGRA_CLK_DUPLICATE(twd,"smp_twd",  NULL),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.0", "fast-clk"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.1", "fast-clk"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.2", "fast-clk"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.3", "fast-clk"),
TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */
 };
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/7] ARM: dt: tegra30: Add clock information

2013-01-04 Thread Prashant Gaikwad
Add clock information to device nodes.

Signed-off-by: Prashant Gaikwad 
---
 arch/arm/boot/dts/tegra30.dtsi |   52 +++-
 1 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index e254d59..758962e 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -17,6 +17,7 @@
reg = <0x5000 0x00024000>;
interrupts = <0 65 0x04   /* mpcore syncpt */
  0 67 0x04>; /* mpcore general */
+   clocks = <&tegra_car 28>;
 
#address-cells = <1>;
#size-cells = <1>;
@@ -27,41 +28,48 @@
compatible = "nvidia,tegra30-mpe";
reg = <0x5404 0x0004>;
interrupts = <0 68 0x04>;
+   clocks = <&tegra_car 60>;
};
 
vi {
compatible = "nvidia,tegra30-vi";
reg = <0x5408 0x0004>;
interrupts = <0 69 0x04>;
+   clocks = <&tegra_car 164>;
};
 
epp {
compatible = "nvidia,tegra30-epp";
reg = <0x540c 0x0004>;
interrupts = <0 70 0x04>;
+   clocks = <&tegra_car 19>;
};
 
isp {
compatible = "nvidia,tegra30-isp";
reg = <0x5410 0x0004>;
interrupts = <0 71 0x04>;
+   clocks = <&tegra_car 23>;
};
 
gr2d {
compatible = "nvidia,tegra30-gr2d";
reg = <0x5414 0x0004>;
interrupts = <0 72 0x04>;
+   clocks = <&tegra_car 21>;
};
 
gr3d {
compatible = "nvidia,tegra30-gr3d";
reg = <0x5418 0x0004>;
+   clocks = <&tegra_car 24>;
};
 
dc@5420 {
compatible = "nvidia,tegra30-dc";
reg = <0x5420 0x0004>;
interrupts = <0 73 0x04>;
+   clocks = <&tegra_car 27>;
 
rgb {
status = "disabled";
@@ -72,6 +80,7 @@
compatible = "nvidia,tegra30-dc";
reg = <0x5424 0x0004>;
interrupts = <0 74 0x04>;
+   clocks = <&tegra_car 26>;
 
rgb {
status = "disabled";
@@ -83,6 +92,7 @@
reg = <0x5428 0x0004>;
interrupts = <0 75 0x04>;
status = "disabled";
+   clocks = <&tegra_car 51>;
};
 
tvo {
@@ -90,12 +100,14 @@
reg = <0x542c 0x0004>;
interrupts = <0 76 0x04>;
status = "disabled";
+   clocks = <&tegra_car 169>;
};
 
dsi {
compatible = "nvidia,tegra30-dsi";
reg = <0x5430 0x0004>;
status = "disabled";
+   clocks = <&tegra_car 48>;
};
};
 
@@ -174,6 +186,7 @@
  0 141 0x04
  0 142 0x04
  0 143 0x04>;
+   clocks = <&tegra_car 34>;
};
 
ahb: ahb {
@@ -219,6 +232,7 @@
interrupts = <0 36 0x04>;
nvidia,dma-request-selector = <&apbdma 8>;
status = "disabled";
+   clocks = <&tegra_car 6>;
};
 
uartb: serial@70006040 {
@@ -228,6 +242,7 @@
interrupts = <0 37 0x04>;
nvidia,dma-request-selector = <&apbdma 9>;
status = "disabled";
+   clocks = <&tegra_car 160>;
};
 
uartc: serial@70006200 {
@@ -237,6 +252,7 @@
interrupts = <0 46 0x04>;
nvidia,dma-request-selector = <&apbdma 10>;
status = "disabled";
+   clocks = <&tegra_car 55>;
};
 
uartd: serial@70006300 {
@@ -246,6 +262,7 @@
interrupts = <0 90 0x04>;
nvidia,dma-request-selector = <&apbdma 19>;
status = "disabled";
+   clocks = <&tegra_car 65>;
};
 
uarte: serial@70006400 {
@@ -255,12 +272,14 @@
interrupts = <0 91 0x04>;
nvidia,dma-request-selector = <&apbdma 20>;
status = "disabled";
+   clocks = <&tegra

[PATCH 5/7] arm: tegra30: remove auxdata

2013-01-04 Thread Prashant Gaikwad
Remove AUXDATA as clocks are initialized from device node.

Signed-off-by: Prashant Gaikwad 
---
 arch/arm/mach-tegra/board-dt-tegra30.c |   31 +--
 1 files changed, 1 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c 
b/arch/arm/mach-tegra/board-dt-tegra30.c
index 35ddf72..5b58b64 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -38,38 +38,9 @@
 #include "common.h"
 #include "iomap.h"
 
-struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x7800, "sdhci-tegra.0", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000200, "sdhci-tegra.1", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000400, "sdhci-tegra.2", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000600, "sdhci-tegra.3", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C000, "tegra-i2c.0", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C400, "tegra-i2c.1", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C500, "tegra-i2c.2", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000C700, "tegra-i2c.3", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-i2c", 0x7000D000, "tegra-i2c.4", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-ahub", 0x7008, "tegra30-ahub", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-apbdma", 0x6000a000, "tegra-apbdma", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-pwm", TEGRA_PWFM_BASE, "tegra-pwm", 
NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000D400, "spi_tegra.0", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000D600, "spi_tegra.1", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000D800, "spi_tegra.2", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DA00, "spi_tegra.3", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DC00, "spi_tegra.4", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DE00, "spi_tegra.5", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-host1x", 0x5000, "host1x", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-dc", 0x5420, "tegradc.0", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-dc", 0x5424, "tegradc.1", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-hdmi", 0x5428, "hdmi", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-dsi", 0x5430, "dsi", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-tvo", 0x542c, "tvo", NULL),
-   {}
-};
-
 static void __init tegra30_dt_init(void)
 {
-   of_platform_populate(NULL, of_default_bus_match_table,
-   tegra30_auxdata_lookup, NULL);
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 static const char *tegra30_dt_board_compat[] = {
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/7] clk: tegra30: remove unused TEGRA_CLK_DUPLICATE()s

2013-01-04 Thread Prashant Gaikwad
With device tree support added for Tegra clocks look up is done from
device tree, remove unused TEGRA_CLK_DUPLICATE()s.

Signed-off-by: Prashant Gaikwad 
---
 drivers/clk/tegra/clk-tegra30.c |   34 --
 1 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c
index 2b3b4f7..57db77d 100644
--- a/drivers/clk/tegra/clk-tegra30.c
+++ b/drivers/clk/tegra/clk-tegra30.c
@@ -1932,18 +1932,9 @@ static __initdata struct tegra_clk_init_table 
init_table[] = {
  * table under two names.
  */
 static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
-   TEGRA_CLK_DUPLICATE(uarta,  "serial8250.0", NULL),
-   TEGRA_CLK_DUPLICATE(uartb,  "serial8250.1", NULL),
-   TEGRA_CLK_DUPLICATE(uartc,  "serial8250.2", NULL),
-   TEGRA_CLK_DUPLICATE(uartd,  "serial8250.3", NULL),
-   TEGRA_CLK_DUPLICATE(uarte,  "serial8250.4", NULL),
TEGRA_CLK_DUPLICATE(usbd, "utmip-pad", NULL),
TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL),
TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL),
-   TEGRA_CLK_DUPLICATE(hdmi, "tegradc.0", "hdmi"),
-   TEGRA_CLK_DUPLICATE(hdmi, "tegradc.1", "hdmi"),
-   TEGRA_CLK_DUPLICATE(dsib, "tegradc.0", "dsib"),
-   TEGRA_CLK_DUPLICATE(dsia, "tegradc.1", "dsia"),
TEGRA_CLK_DUPLICATE(bsev, "tegra-avp", "bsev"),
TEGRA_CLK_DUPLICATE(bsev, "nvavp", "bsev"),
TEGRA_CLK_DUPLICATE(vde, "tegra-aes", "vde"),
@@ -1952,33 +1943,8 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] 
= {
TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL),
TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"),
TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"),
-   TEGRA_CLK_DUPLICATE(i2c1, "tegra-i2c-slave.0", NULL),
-   TEGRA_CLK_DUPLICATE(i2c2, "tegra-i2c-slave.1", NULL),
-   TEGRA_CLK_DUPLICATE(i2c3, "tegra-i2c-slave.2", NULL),
-   TEGRA_CLK_DUPLICATE(i2c4, "tegra-i2c-slave.3", NULL),
-   TEGRA_CLK_DUPLICATE(i2c5, "tegra-i2c-slave.4", NULL),
-   TEGRA_CLK_DUPLICATE(sbc1, "spi_slave_tegra.0", NULL),
-   TEGRA_CLK_DUPLICATE(sbc2, "spi_slave_tegra.1", NULL),
-   TEGRA_CLK_DUPLICATE(sbc3, "spi_slave_tegra.2", NULL),
-   TEGRA_CLK_DUPLICATE(sbc4, "spi_slave_tegra.3", NULL),
-   TEGRA_CLK_DUPLICATE(sbc5, "spi_slave_tegra.4", NULL),
-   TEGRA_CLK_DUPLICATE(sbc6, "spi_slave_tegra.5", NULL),
TEGRA_CLK_DUPLICATE(twd, "smp_twd", NULL),
TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"),
-   TEGRA_CLK_DUPLICATE(i2s0, NULL, "i2s0"),
-   TEGRA_CLK_DUPLICATE(i2s1, NULL, "i2s1"),
-   TEGRA_CLK_DUPLICATE(i2s2, NULL, "i2s2"),
-   TEGRA_CLK_DUPLICATE(i2s3, NULL, "i2s3"),
-   TEGRA_CLK_DUPLICATE(i2s4, NULL, "i2s4"),
-   TEGRA_CLK_DUPLICATE(dam0, NULL, "dam0"),
-   TEGRA_CLK_DUPLICATE(dam1, NULL, "dam1"),
-   TEGRA_CLK_DUPLICATE(dam2, NULL, "dam2"),
-   TEGRA_CLK_DUPLICATE(spdif_in, NULL, "spdif_in"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.0", "fast-clk"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.1", "fast-clk"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.2", "fast-clk"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.3", "fast-clk"),
-   TEGRA_CLK_DUPLICATE(pll_p_out3, "tegra-i2c.4", "fast-clk"),
TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */
 };
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: build failure after merge of the pekey tree

2013-01-04 Thread David Howells
Stephen Rothwell  wrote:

> After merging the pekey tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> ERROR: "modsign_keyring" [crypto/asymmetric_keys/pefile_key_parser.ko] 
> undefined!

Interesting.  That first one isn't due to a missing EXPORT_SYMBOL_GPL().  That
is there.  The problem is that linux/export.h is not #included.  Why does the
C file even build, I wonder?

Anyway, the revised version is pushed.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/7] ASoC: tegra: remove auxdata

2013-01-04 Thread Prashant Gaikwad
Configlink clock information is added to device tree. Get the clocks
using device node. Remove AUXDATA.

Signed-off-by: Prashant Gaikwad 
---
 sound/soc/tegra/tegra30_ahub.c |   14 ++
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index bb31c41..2355630 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -299,15 +299,6 @@ static const char * const configlink_clocks[] = {
"spdif_in",
 };
 
-struct of_dev_auxdata ahub_auxdata[] = {
-   OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080300, "tegra30-i2s.0", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080400, "tegra30-i2s.1", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080500, "tegra30-i2s.2", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080600, "tegra30-i2s.3", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080700, "tegra30-i2s.4", NULL),
-   {}
-};
-
 #define LAST_REG(name) \
(TEGRA30_AHUB_##name + \
 (TEGRA30_AHUB_##name##_STRIDE * TEGRA30_AHUB_##name##_COUNT) - 4)
@@ -451,7 +442,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev)
 * Ensure that here.
 */
for (i = 0; i < ARRAY_SIZE(configlink_clocks); i++) {
-   clk = clk_get_sys(NULL, configlink_clocks[i]);
+   clk = clk_get(&pdev->dev, configlink_clocks[i]);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "Can't get clock %s\n",
configlink_clocks[i]);
@@ -569,8 +560,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev)
goto err_pm_disable;
}
 
-   of_platform_populate(pdev->dev.of_node, NULL, ahub_auxdata,
-&pdev->dev);
+   of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
 
return 0;
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH][trivial] xtensa: Fix home page URL in Kconfig

2013-01-04 Thread Jiri Kosina
On Fri, 4 Jan 2013, Masanari Iida wrote:

> This home page address has moved to new one.
> 
> Signed-off-by: Masanari Iida 
> ---
>  arch/xtensa/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
> index 0d1f36a..75fb260 100644
> --- a/arch/xtensa/Kconfig
> +++ b/arch/xtensa/Kconfig
> @@ -22,7 +22,7 @@ config XTENSA
> configurable and extensible.  The Linux port to the Xtensa
> architecture supports all processor configurations and extensions,
> with reasonable minimum requirements.  The Xtensa Linux project has
> -   a home page at .
> +   a home page at .
>  
>  config RWSEM_XCHGADD_ALGORITHM
>   def_bool y

I am taking it, thanks.

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 1/2] ASoC: davinci-mcasp: Add pinctrl support

2013-01-04 Thread Hebbar Gururaja
From: "Hebbar, Gururaja" 

Signed-off-by: Hebbar, Gururaja 
---
Changes in V2
- no change

:100644 100644 55e2bf6... 83d96eb... M  sound/soc/davinci/davinci-mcasp.c
 sound/soc/davinci/davinci-mcasp.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/davinci/davinci-mcasp.c 
b/sound/soc/davinci/davinci-mcasp.c
index 55e2bf6..83d96eb 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1080,6 +1081,7 @@ static int davinci_mcasp_probe(struct platform_device 
*pdev)
struct resource *mem, *ioarea, *res;
struct snd_platform_data *pdata;
struct davinci_audio_dev *dev;
+   struct pinctrl *pinctrl;
int ret;
 
if (!pdev->dev.platform_data && !pdev->dev.of_node) {
@@ -,6 +1113,11 @@ static int davinci_mcasp_probe(struct platform_device 
*pdev)
return -EBUSY;
}
 
+   pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+   if (IS_ERR(pinctrl))
+   dev_warn(&pdev->dev,
+   "pins are not configured from the driver\n");
+
pm_runtime_enable(&pdev->dev);
 
ret = pm_runtime_get_sync(&pdev->dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 0/2] ARM/ASoC: Davinci: Device Tree Update

2013-01-04 Thread Hebbar Gururaja
1. Add pinctrl for McASP Module
2. Add DT support for Davinci machine platform

This patch-set is tested on Davinci platform (DA850 EVM). This series applies on
top of tag next-20130103 git tree
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

These patches cannot be tested directly on mainline kernel (DT based).
This is because dma is not yet completely ported to Davinci ASoC. I had to add
few hacks to get Audio working on Davinci DA850 platform.

For reference, I have placed the entire working tree @ 
Tree : https://gitorious.org/davinci-asoc-dt/davinci-asoc-dt
Branch : dev_next-20130103_davinci_asoc_dt

Changes in V2
 - Remove reference to Linux & software details from DT binding

Hebbar, Gururaja (2):
  ASoC: davinci-mcasp: Add pinctrl support
  ASoC: Davinci: machine: Add device tree binding

 .../bindings/sound/davinci-evm-audio.txt   |   53 ++
 sound/soc/davinci/davinci-evm.c|  179 +---
 sound/soc/davinci/davinci-mcasp.c  |7 +
 3 files changed, 219 insertions(+), 20 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/davinci-evm-audio.txt

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 2/2] ASoC: Davinci: machine: Add device tree binding

2013-01-04 Thread Hebbar Gururaja
From: "Hebbar, Gururaja" 

Device tree support for Davinci Machine driver

When the board boots with device tree, the driver will receive card,
codec, dai interface details (like the card name, DAPM routing map,
phandle for the audio components described in the dts file, codec mclk
speed).
The card will be set up based on this information.
Since the routing is provided via DT we can mark the card fully routed
so core can take care of disconnecting the unused pins.

Signed-off-by: Hebbar, Gururaja 
---
Changes in V2
 - Remove reference to Linux & software details from DT binding

:00 100644 000... 25f7180... A  
Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
:100644 100644 d55e647... 91a32e5... M  sound/soc/davinci/davinci-evm.c
 .../bindings/sound/davinci-evm-audio.txt   |   53 ++
 sound/soc/davinci/davinci-evm.c|  179 +---
 2 files changed, 212 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt 
b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
new file mode 100644
index 000..25f7180
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
@@ -0,0 +1,53 @@
+* Texas Instruments SoC audio setups with TLV320AIC3X Codec
+
+Required properties:
+- compatible :
+   "ti,dm365-voice-codec-audio": for DM365 platforms with Voice Codec
+   "ti,da830-evm-audio": for DM365/DA8xx/OMAPL1x/AM33xx
+
+- ti,model : The user-visible name of this sound complex.
+- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
+- ti,mcasp-controller : The phandle of the McASP controller
+- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec
+- ti,audio-routing : A list of the connections between audio components.
+  Each entry is a pair of strings, the first being the connection's sink,
+  the second being the connection's source. Valid names for sources and
+  sinks are the codec's pins, and the jacks on the board:
+
+  Codec pins:
+
+  * MIC3L
+  * MIC3R
+  * LINE1L
+  * LINE2L
+  * LINE1R
+  * LINE2R
+
+  Board connectors:
+
+  * Headphone Jack
+  * Line Out
+  * Mic Jack
+
+
+Example:
+
+sound {
+   compatible = "ti,da830-evm-audio";
+   ti,model = "DA830 EVM";
+   ti,audio-codec = <&tlv320aic3x>;
+   ti,mcasp-controller = <&mcasp1>;
+   ti,codec-clock-rate = <1200>;
+   ti,audio-routing =
+   "Headphone Jack",   "HPLOUT",
+   "Headphone Jack",   "HPROUT",
+   "Line Out", "LLOUT",
+   "Line Out", "RLOUT",
+   "MIC3L","Mic Bias 2V",
+   "MIC3R","Mic Bias 2V",
+   "Mic Bias 2V",  "Mic Jack",
+   "LINE1L",   "Line In",
+   "LINE2L",   "Line In",
+   "LINE1R",   "Line In",
+   "LINE2R",   "Line In";
+};
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index d55e647..91a32e5 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,27 +35,38 @@ static int evm_hw_params(struct snd_pcm_substream 
*substream,
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+   struct snd_soc_codec *codec = rtd->codec;
+   struct snd_soc_card *soc_card = codec->card;
+   struct device_node *np = soc_card->dev->of_node;
int ret = 0;
unsigned sysclk;
 
-   /* ASP1 on DM355 EVM is clocked by an external oscillator */
-   if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() ||
-   machine_is_davinci_dm365_evm())
-   sysclk = 2700;
-
-   /* ASP0 in DM6446 EVM is clocked by U55, as configured by
-* board-dm644x-evm.c using GPIOs from U18.  There are six
-* options; here we "know" we use a 48 KHz sample rate.
-*/
-   else if (machine_is_davinci_evm())
-   sysclk = 12288000;
-
-   else if (machine_is_davinci_da830_evm() ||
-   machine_is_davinci_da850_evm())
-   sysclk = 24576000;
-
-   else
-   return -EINVAL;
+   if (np) {
+   ret = of_property_read_u32(np, "ti,codec-clock-rate", &sysclk);
+   if (ret < 0)
+   return ret;
+   } else {
+   /* ASP1 on DM355 EVM is clocked by an external oscillator */
+   if (machine_is_davinci_dm355_evm() ||
+   machine_is_davinci_dm6467_evm() ||
+   machine_is_davinci_dm365_evm())
+   sysclk = 2700;
+
+   /*
+* 

Re: [PATCH] [trivial] h8300: Fix home page URL in h8300/README

2013-01-04 Thread Jiri Kosina
On Fri, 4 Jan 2013, Masanari Iida wrote:

> Correct home page URL in h8300/README.
> 
> Signed-off-by: Masanari Iida 
> ---
>  arch/h8300/README | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/h8300/README b/arch/h8300/README
> index 637f5a0..efa805f 100644
> --- a/arch/h8300/README
> +++ b/arch/h8300/README
> @@ -11,7 +11,7 @@ H8/300H and H8S
>  2.AE 3068/AE 3069
>more information 
>MICROTRONIQUE 
> -  Akizuki Denshi Tsusho Ltd.  (Japanese Only)
> +  Akizuki Denshi Tsusho Ltd.  (Japanese Only)

Applied.

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sound: Add support for Creative BT-D1 via usb sound quirks

2013-01-04 Thread Takashi Iwai
At Thu, 03 Jan 2013 12:59:07 +0100,
Alexander Schremmer wrote:
> 
> On 03.01.2013 10:58, Takashi Iwai wrote:
> 
> > Thanks for the patch.  The changes look OK, but could you fix trivial
> > coding issues reported by scripts/checkpatch.pl and resend?
> 
> Oops, my sending workflow ate the tabs, here it is again (hopefully now
> working correctly):
> 
> 
> From: Alexander Schremmer 
> 
> Support the Creative BT-D1 Bluetooth USB audio device. Before this
> patch, Linux had trouble finding the correct USB descriptors and bailed
> out with these messages:
> 
>  no or invalid class specific endpoint descriptor
> 
> Now it still prints these messages on hotplug:
> 
>  snd-usb-audio: probe of ...:1.0 failed with error -5
>  snd-usb-audio: probe of ...:1.2 failed with error -5
>  snd-usb-audio: probe of ...:1.3 failed with error -5
> 
> But the device works correctly, including the HID support.
> 
> The patch is diff'ed against 3.8-rc1 but should apply to older kernels
> as well.
> 
> Signed-off-by: Alexander Schremmer 

Thanks, applied.


Takashi

> 
> ---
> diff -uprN linux-3.8-rc1/sound/usb/quirks-table.h
> linux-3.8-rc1-mod/sound/usb/quirks-table.h
> --- linux-3.8-rc1/sound/usb/quirks-table.h2012-12-22 02:19:00.0
> +0100
> +++ linux-3.8-rc1-mod/sound/usb/quirks-table.h2012-12-26
> 11:41:28.0 +0100
> @@ -50,6 +50,28 @@
>   }
>  },
> 
> +{
> + /* Creative BT-D1 */
> + USB_DEVICE(0x041e, 0x0005),
> + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
> + .ifnum = 1,
> + .type = QUIRK_AUDIO_FIXED_ENDPOINT,
> + .data = &(const struct audioformat) {
> + .formats = SNDRV_PCM_FMTBIT_S16_LE,
> + .channels = 2,
> + .iface = 1,
> + .altsetting = 1,
> + .altset_idx = 1,
> + .endpoint = 0x03,
> + .ep_attr = USB_ENDPOINT_XFER_ISOC,
> + .attributes = 0,
> + .rates = SNDRV_PCM_RATE_CONTINUOUS,
> + .rate_min = 48000,
> + .rate_max = 48000,
> + }
> + }
> +},
> +
>  /* Creative/Toshiba Multimedia Center SB-0500 */
>  {
>   USB_DEVICE(0x041e, 0x3048),
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Tux3 report: New news for the new year

2013-01-04 Thread OGAWA Hirofumi
Tero Roponen  writes:

>> martin@merkaba:~[…]> sudo ./tux3fuse tux3.img /mnt/zeit
>> [sudo] password for martin: 
>> 
>> martin@merkaba:~[…]> mount | grep fuse
>> fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
>> tux3.img on /mnt/zeit type fuse.tux3.img 
>> (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
>> 
>> 
>> 
>> But I am stuck with accessing it:
>> 
>> martin@merkaba:~[…]> LANG=C ls -l /mnt/zeit
>> ls: cannot access /mnt/zeit: Permission denied
>> 
>> martin@merkaba:~[…]> LANG=C sudo chown martin:martin /mnt/zeit
>> chown: cannot access '/mnt/zeit': Transport endpoint is not connected
>> martin@merkaba:~[…]> LANG=C sudo ls -l /mnt/zeit
>> ls: cannot access /mnt/zeit: Transport endpoint is not connected
>> martin@merkaba:~[…]>
>
> Hi,
>
> I have not looked at Tux3 for a long time, but there seems to be
> a simple fix for at least this problem, and two workarounds:
>
> 1) Run the program in foreground (-f):
>
>sudo ./tux3fuse tux3.img /mnt/zeit -f
>
> 2) Use absolute path for image file:
>
>sudo ./tux3fuse $(pwd)/tux3.img /mnt/zeit
>
> The following patch should hopefully fix this for good.

Thanks for report, Martin. Thanks for fixing, Tero.

Applied with free() for make valgrind happy to temp-atomic-commit branch
(will be merged to master soon).

Thanks!

> commit efc0cf49f6dd00dfbb84e88336d2c5d147a09ed0
> Author: Tero Roponen 
> Date:   Wed Jan 2 11:20:46 2013 +0200
>
> Use absolute path for volume name
> 
> If fuse_daemonize() puts us into background it also switches our
> working directory to '/', breaking the use of relative paths.
> 
> This patch fixes the problem by converting the relative path to
> an absolute one.
> 
> Signed-off-by: Tero Roponen 
>
> diff --git a/user/tux3fuse.c b/user/tux3fuse.c
> index 6401204..5047cab 100644
> --- a/user/tux3fuse.c
> +++ b/user/tux3fuse.c
> @@ -993,7 +993,7 @@ int main(int argc, char *argv[])
>   goto error;
>  
>   struct tux3fuse tux3fuse = {
> - .volname = argv[1],
> + .volname = canonicalize_file_name(argv[1]),
>   };
>   fs = fuse_lowlevel_new(&args, &tux3_ops, sizeof(tux3_ops), &tux3fuse);
>   if (fs) {

-- 
OGAWA Hirofumi 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v2 6/8] gpu: drm: tegra: Remove redundant host1x

2013-01-04 Thread Terje Bergström
On 21.12.2012 23:19, Stephen Warren wrote:
> I see the situation more like:
> 
> * There's host1x hardware.
> 
> * There's a low-level driver just for host1x itself; the host1x driver.
> 
> * There's a high-level driver for the entire host1x complex of devices.
> That is tegradrm. There may be more high-level drivers in the future
> (e.g. v4l2 camera driver if it needs to aggregate a bunch of host1x
> sub-devices liek tegradrm does).
> 
> * The presence of the host1x DT node logically implies that both the two
> drivers in the previous two points should be instantiated.
> 
> * Linux instantiates a single device per DT node.
> 
> * So, it's host1x's responsibility to instantiate the other device(s). I
> think it's reasonable for the host1x driver to know exactly what
> features the host1x HW complex supports; raw host1x access being one,
> and the higher level concept of a tegradrm being another. So, it's
> reasonable for host1x to trigger the instantiation of tegradrm.
> 
> * If DRM core didn't stomp on the device object's drvdata (or whichever
> field it is), I would recommend not creating a dummy device at all, but
> rather having the host1x driver directly implement multiple driver
> interfaces. There are many examples like this already in the kernel,
> e.g. combined GPIO+IRQ driver, combined GPIO+IRQ+pinctrl driver, etc.

We had a phone call with Stephen yesterday, and I finally understood why
unbroken chain from DT to tegra-drm is important. The goals are to be
able to modprobe tegra-drm without ill effects, and to auto-load
tegra-drm module. I had been chasing a totally different goal.

Sorry about all the churn.

I think we have now two ways to go forward with cons and pros:
 1) Keep host1x and tegra-drm as separate driver
   + Code almost done
   - we need dummy device and dummy driver
   - extra code and API when host1x creates dummy device and its passed
to tegra-drm
   - tegra-drm device would need to be a child of host1x device. Having
virtual and real devices as host1x children sounds weird.

 2) Merge host1x and tegra-drm into one module. drm is a subcomponent,
and whatever other personalities we wish would also be subcomponents of
host1x. host1x calls tegra-drm directly to handle preparation for drm
initialization. As they're in the same module, circular dependency is ok.
   + Simpler conceptually (no dummy device/driver)
   + Less code
   - Proposal doesn't yet exist

Thierry, what do you think? I'd prefer option 2, as that keeps things
simple and still fulfills the requirements. We probably would redo the
patch "Remove redundant host1x" to actually move drm under host1x, and
adds calls from host1x to parse_dt() directly. We'd probably leave the
code otherwise mostly as it is now, so we'll drop whatever modifications
we've done so far in my proposals. You can later pick up some things
from our proposals if you want, but it's then up to you.

We could also later think about generalizing some of the list management
to belong to host1x, but that'd be a follow-up and we can decide that later.

Terje
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 22/44] metag: Time keeping

2013-01-04 Thread Vineet Gupta
Hi James,

On Wednesday 05 December 2012 09:38 PM, James Hogan wrote:

> +static unsigned int hwtimer_freq = HARDWARE_FREQ;
> +static DEFINE_PER_CPU(struct clock_event_device, local_clockevent);
> +static DEFINE_PER_CPU(char [11], local_clockevent_name);

> +void __cpuinit local_timer_setup(unsigned int cpu)
> +{
> + unsigned int txdivtime;
> + struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
> + char *name = per_cpu(local_clockevent_name, cpu);
> +
> + txdivtime = TBI_GETREG(TXDIVTIME);
> +
> + txdivtime &= ~TXDIVTIME_DIV_BITS;
> + txdivtime |= (HARDWARE_DIV & TXDIVTIME_DIV_BITS);
> +
> + TBI_SETREG(TXDIVTIME, txdivtime);
> +
> + sprintf(name, "META %d", cpu);
> + clk->name = name;
> + clk->features = CLOCK_EVT_FEAT_ONESHOT,
> +
> + clk->rating = 200,
> + clk->shift = 12,
> + clk->irq = TBID_SIGNUM_TRT,
> + clk->set_mode = metag_timer_set_mode,
> + clk->set_next_event = metag_timer_set_next_event,
> +
> + clk->mult = div_sc(hwtimer_freq, NSEC_PER_SEC, clk->shift);
> + clk->max_delta_ns = clockevent_delta2ns(0x7fff, clk);
> + clk->min_delta_ns = clockevent_delta2ns(0xf, clk);
> + clk->cpumask = cpumask_of(cpu);
> +
> + clockevents_register_device(clk);
> +
> + /*
> +  * For all non-boot CPUs we need to synchronize our free
> +  * running clock (TXTIMER) with the boot CPU's clock.
> +  *
> +  * While this won't be accurate, it should be close enough.
> +  */
> + if (cpu) {
> + unsigned int thread0 = cpu_2_hwthread_id[0];
> + unsigned long val;
> +
> + val = core_reg_read(TXUCT_ID, TXTIMER_REGNUM, thread0);
> +
> + asm volatile("MOV TXTIMER, %0\n" : : "r" (val));
> + }
> +}
> +
> +void __init time_init(void)
> +{
> + /*
> +  * On Meta 2 SoCs, the actual frequency of the timer is based on the
> +  * Meta core clock speed divided by an integer, so it is only
> +  * approximately 1MHz. Calculating the real frequency here drastically
> +  * reduces clock skew on these SoCs.
> +  */
> +#ifdef CONFIG_METAG_META21
> + hwtimer_freq = get_coreclock() / (metag_in32(EXPAND_TIMER_DIV) + 1);
> +#endif
> + clocksource_register_hz(&clocksource_metag, hwtimer_freq);
> +
> + setup_irq(TBID_SIGNUM_TRT, &metag_timer_irq);
> +
> + local_timer_setup(smp_processor_id());
> +}

I have a kludge in ARC port in this subsystem - which I hope you could help 
clear.

ARC also has a local timer device used for clockevent on each CPU. A one-time
setup_irq() with IRQF_PERCPU - would indeed setup the generic IRQ subsystem - 
for
making registration effective for all CPUs. However don't you need some per-cpu
magic - say enabling the IRQ at cpu or embedded interrupt controller level -
assuming you starts off with all IRQs disabled (which ARC Linux does).

So we end up using different APIs - request_percpu_irq() as equivalent of
setup_irq() on boot-cpu only and then each CPU calling enable_percpu_irq() to do
the local magic. request_percpu_irq() in turn requires an apriori call to
irq_set_percpu_devid().

https://lkml.org/lkml/2012/11/7/128

Do don't seem to be requiring all of this hence I'm wondering how it works for 
you!

-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/3] power: bq2415x_charger: Some cleanup

2013-01-04 Thread Sachin Kamat
Hi,

On 27 November 2012 11:28, Sachin Kamat  wrote:
> This series is build tested againt the linux-next tree (20121126)
>
> Sachin Kamat (3):
>   power: bq2415x_charger: Remove unneeded version.h inclusion
>   power: bq2415x_charger: Use module_i2c_driver
>   power: bq2415x_charger: Use devm_kzalloc()
>
>  drivers/power/bq2415x_charger.c |   28 +++-
>  1 files changed, 7 insertions(+), 21 deletions(-)

Any comments on this series?


>
> --
> 1.7.4.1
>



-- 
With warm regards,
Sachin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Fwd: Linux - AMD SB950 USB Regression

2013-01-04 Thread dAgeCKo


Hello,

Some months ago I noticed that my USB controler (and also my network
controler) does not work anymore on newer kernels from my debian wheezy
distribution.

I then reported a bug for the former one here:

https://bugzilla.kernel.org/show_bug.cgi?id=47791

With some helps and time, I could locate the source of the regression,
that is an old commit from the year 2010 you seem to commit. Git
besection identified the commit as:

git bisect bad 5c80cc78de46aef6cd5e714208da05c3f7f548f8

Someone from the usb kernel mailing list (Alan Stern) then asked me to
write an email to you, in my hope the bug to be solved.

Some informations were said on the bug tracker, but if you need any
other information that could help you in any manner, please let me know.

Please note that the regression only involves USB2 ports of the
mainboard, not the USB3 ports.

Regards.

---
Jean-Dominique Frattini
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: What is asmlinkage ?

2013-01-04 Thread anish singh
On Fri, Jan 4, 2013 at 3:41 PM, Rajat Sharma  wrote:
>> Is this correct for all architectures?
>
> I guess not, asmlinkage is undefined for arm, so I assume this mechanism is
> not there for arm.
then how do they do it?
>
>
>
> On Fri, Jan 4, 2013 at 2:24 PM, 卜弋天  wrote:
>>
>>
>>
>> 在 2013-1-4,15:38,"Rajat Sharma"  写道:
>>
>> > So with asmlinkage we request compiler to put args on stack. What is
>> > advantage of this to start_kernel or in general to other functions ?
>>
>> See its about implementation ease and little of performance too. Assuming
>> the default model of keeping arguments in registers is used. lets say
>> arguments are assumed to be in registers R1, R2, R3, R4, R5, R6 and beyond
>> that in stack. Since system call number is a transparent argument which is
>> chopped off when calling the actual kernel handler and if R1 had the system
>> call number, then you have to shift all register values and stack arguments
>> too.
>>
>>Is this correct for all architectures?
>>
>>As I remembered, ARM uses SWI instruction to implement the system call,
>> it will pass system call number by register R7, and use normal register
>> R0~R3 to pass parameters.
>>
>>
>>
>> Now consider that all arguments are pushed on stack (as enforced by
>> asmlinkage), you have all function argument in the beginning of the stack
>> and the system call number on top of the stack. you just need to pop out
>> stack top to remove system call number from function argument.
>>
>> You might argue that why not always keep system call number on stack top
>> and use registers for function arguments? But thats part of the compiler ABI
>> and if you had fewer arguments lets say 2 only and used up R1 and R2 only,
>> you may not jump to stack top directly for storing system call as its turn
>> for R3 as argument.
>>
>> So, isn't it simpler implementation with everything on stack?
>>
>> -Rajat
>>
>>
>> On Fri, Jan 4, 2013 at 12:13 PM, Rahul Bedarkar  wrote:
>>>
>>> Thanks. So with asmlinkage we request compiler to put args on stack. What
>>> is advantage of this to start_kernel or in general to other functions ?
>>>
>>> Regards,
>>> Rahul
>>>
>>>
>>> On Thu, Jan 3, 2013 at 9:34 PM, Mulyadi Santosa
>>>  wrote:

 On Thu, Jan 3, 2013 at 7:40 PM, Rahul Bedarkar 
 wrote:
 > Hi,
 >
 > I was searching for asmlinkage and found that it is already explained
 > at
 > http://kernelnewbies.org/FAQ/asmlinkage
 >
 > But I didn't get this. Can someone tell me about it in brief ?

 the point is, parameters which is usually passed via stack, is passed
 using different way.

 A good example is system call they are passed using registers IIRC


 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com
>>>
>>>
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> kernelnewb...@kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>
>> ___
>> Kernelnewbies mailing list
>> kernelnewb...@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> ___
> Kernelnewbies mailing list
> kernelnewb...@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 3.8-rc2: EFI framebuffer lock inversion...

2013-01-04 Thread Sedat Dilek
On Thu, Jan 3, 2013 at 3:39 PM, Daniel J Blueman  wrote:
> On 3 January 2013 22:11, Sedat Dilek  wrote:
>> Hi Daniel,
>>
>> just wanted to test the fb-fix [2] from Alan and followed the thread in [1].
>> Me is also working with i915 KMS.
>>
>> I looked at nouveau KMS driver and adapted the part for i915:
>>
>> drivers/gpu/drm/nouveau/nouveau_drm.c-200-  /* remove conflicting
>> drivers (vesafb, efifb etc) */
>> drivers/gpu/drm/nouveau/nouveau_drm.c:201:  aper = alloc_apertures(3);
>> drivers/gpu/drm/nouveau/nouveau_drm.c-202-  if (!aper)
>> drivers/gpu/drm/nouveau/nouveau_drm.c-203-  return -ENOMEM;
>>
>> Untested by me, feel free to test.
>>
>> Maybe some of the i915 and/or fb driver experts can comment on the problem.
>
> The structure array from alloc_apertures is just used for the PCI base
> address registers, so it's important here.
>
> I'll take a look at the efifb locking later.
>

You had a chance to look at this?

- Sedat -

> Thanks,
>   Daniel
> --
> Daniel J Blueman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/4] input: keyboard: tegra: cleanups and DT supports

2013-01-04 Thread Laxman Dewangan
This patch series:
 - fix build warning,
 - use devm_* for allocation,
 - make column/rows configuration through DT and
 - remove the rarely used  key mapping table.

Laxman Dewangan (4):
  input: keyboard: tegra: fix build warning
  input: keyboard: tegra: use devm_* for resource allocation
  input: keyboard: tegra: add support for rows/cols configuration from
dt
  input: keyboard: tegra: remove default key mapping

 .../bindings/input/nvidia,tegra20-kbc.txt  |   22 ++
 drivers/input/keyboard/tegra-kbc.c |  346 ++--
 2 files changed, 120 insertions(+), 248 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] input: keyboard: tegra: add support for rows/cols configuration from dt

2013-01-04 Thread Laxman Dewangan
The NVIDIA's Tegra KBC has maximum 24 pins to make matrix keypad.
Any pin can be configured as row or column. The maximum column pin
can be 8 and maximum row pin can be 16.

Remove the assumption that all first 16 pins will be used as row
and remaining as columns and Add the property for configuring pins
to either row or column from DT. Update the devicetree binding
document accordingly.

Signed-off-by: Laxman Dewangan 
---
 .../bindings/input/nvidia,tegra20-kbc.txt  |   22 ++
 drivers/input/keyboard/tegra-kbc.c |   73 +++
 2 files changed, 79 insertions(+), 16 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt 
b/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt
index 72683be..71c17d9 100644
--- a/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt
+++ b/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt
@@ -1,7 +1,18 @@
 * Tegra keyboard controller
+The key controller has maximum 24 pins to make matrix keypad. Any pin
+can be configured as row or column. The maximum column pin can be 8
+and maximum row pins can be 16 for Tegra20/Tegra30.
 
 Required properties:
 - compatible: "nvidia,tegra20-kbc"
+- reg: Register base address of KBC.
+- interrupts: Interrupt number for the KBC.
+- nvidia,kbc-rows: The KBC pins which are configured as row. This is the
+  array of pinmnumber.
+- nvidia,kbc-cols: The KBC pins which are configured as column. This is the
+  array of pinmnumber.
+- linux,keymap: The keymap for keys as described in the binding document
+  devicetree/bindings/input/matrix-keymap.txt.
 
 Optional properties, in addition to those specified by the shared
 matrix-keyboard bindings:
@@ -19,5 +30,16 @@ Example:
 keyboard: keyboard {
compatible = "nvidia,tegra20-kbc";
reg = <0x7000e200 0x100>;
+   interrupts = <0 85 0x04>;
nvidia,ghost-filter;
+   nvidia,debounce-delay-ms = <640>;
+   nvidia,kbc-rows = <0 1 2>;/* pin 0, 1 and 2 are mapped as rows */
+   nvidia,kbc-cols = <11 12 13>; /* pin 11, 12 and 13 are mapped as cols */
+   linux,keymap = < 0x0074
+0x00010067
+0x00020066
+0x01010068
+0x0269
+0x02010070
+0x02020071 >;
 };
diff --git a/drivers/input/keyboard/tegra-kbc.c 
b/drivers/input/keyboard/tegra-kbc.c
index c036425..69f8b04 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -614,13 +614,16 @@ static struct tegra_kbc_platform_data 
*tegra_kbc_dt_parse_pdata(
struct device_node *np = pdev->dev.of_node;
u32 prop;
int i;
-
-   if (!np)
-   return NULL;
+   u32 num_rows = 0;
+   u32 num_cols = 0;
+   u32 cols_cfg[KBC_MAX_GPIO];
+   u32 rows_cfg[KBC_MAX_GPIO];
+   int proplen;
+   int ret;
 
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
-   return NULL;
+   return ERR_PTR(-ENOMEM);
 
if (!of_property_read_u32(np, "nvidia,debounce-delay-ms", &prop))
pdata->debounce_cnt = prop;
@@ -634,18 +637,56 @@ static struct tegra_kbc_platform_data 
*tegra_kbc_dt_parse_pdata(
if (of_find_property(np, "nvidia,wakeup-source", NULL))
pdata->wakeup = true;
 
-   /*
-* All currently known keymaps with device tree support use the same
-* pin_cfg, so set it up here.
-*/
-   for (i = 0; i < KBC_MAX_ROW; i++) {
+   if (!of_get_property(np, "nvidia,kbc-rows", &proplen)) {
+   dev_err(&pdev->dev, "property nvidia,kbc-rows not defined\n");
+   return ERR_PTR(-ENOENT);
+   }
+   num_rows = proplen / sizeof(u32);
+
+   if (!of_get_property(np, "nvidia,kbc-cols", &proplen)) {
+   dev_err(&pdev->dev, "property nvidia,kbc-cols not defined\n");
+   return ERR_PTR(-ENOENT);
+   }
+   num_cols = proplen / sizeof(u32);
+
+   if (!of_get_property(np, "linux,keymap", &proplen)) {
+   dev_err(&pdev->dev, "property nvidia,kbc-cols not defined\n");
+   return ERR_PTR(-ENOENT);
+   }
+
+   if (!num_rows || !num_cols || ((num_rows + num_cols) > KBC_MAX_GPIO)) {
+   dev_err(&pdev->dev, "keypad rows/columns not porperly 
specified\n");
+   return ERR_PTR(-EINVAL);
+   }
+
+   /* Set all pins as non-configured */
+   for (i = 0; i < KBC_MAX_GPIO; i++) {
pdata->pin_cfg[i].num = i;
-   pdata->pin_cfg[i].type = PIN_CFG_ROW;
+   pdata->pin_cfg[i].type = PIN_CFG_IGNORE;
+   }
+
+   ret = of_property_read_u32_array(np, "nvidia,kbc-rows",
+   rows_cfg, num_rows);
+   if (ret < 0) {
+   dev_err(&pdev->dev, "Rows configurations are not proper\n");
+   

[PATCH 1/4] input: keyboard: tegra: fix build warning

2013-01-04 Thread Laxman Dewangan
Fix the following build warning when building driver with CONFIG_PM_SLEEP
not selected.

tegra-kbc.c:360:13: warning: 'tegra_kbc_set_keypress_interrupt' defined but not 
used [-Wunused-function]

Signed-off-by: Laxman Dewangan 
---
 drivers/input/keyboard/tegra-kbc.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/input/keyboard/tegra-kbc.c 
b/drivers/input/keyboard/tegra-kbc.c
index c76f968..f1d3ba0 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -357,18 +357,6 @@ static void tegra_kbc_set_fifo_interrupt(struct tegra_kbc 
*kbc, bool enable)
writel(val, kbc->mmio + KBC_CONTROL_0);
 }
 
-static void tegra_kbc_set_keypress_interrupt(struct tegra_kbc *kbc, bool 
enable)
-{
-   u32 val;
-
-   val = readl(kbc->mmio + KBC_CONTROL_0);
-   if (enable)
-   val |= KBC_CONTROL_KEYPRESS_INT_EN;
-   else
-   val &= ~KBC_CONTROL_KEYPRESS_INT_EN;
-   writel(val, kbc->mmio + KBC_CONTROL_0);
-}
-
 static void tegra_kbc_keypress_timer(unsigned long data)
 {
struct tegra_kbc *kbc = (struct tegra_kbc *)data;
@@ -866,6 +854,18 @@ static int tegra_kbc_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
+static void tegra_kbc_set_keypress_interrupt(struct tegra_kbc *kbc, bool 
enable)
+{
+   u32 val;
+
+   val = readl(kbc->mmio + KBC_CONTROL_0);
+   if (enable)
+   val |= KBC_CONTROL_KEYPRESS_INT_EN;
+   else
+   val &= ~KBC_CONTROL_KEYPRESS_INT_EN;
+   writel(val, kbc->mmio + KBC_CONTROL_0);
+}
+
 static int tegra_kbc_suspend(struct device *dev)
 {
struct platform_device *pdev = to_platform_device(dev);
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] input: keyboard: tegra: use devm_* for resource allocation

2013-01-04 Thread Laxman Dewangan
Use devm_* for memory, clock, input device allocation. This reduces
code for freeing these resources.

Signed-off-by: Laxman Dewangan 
---
 drivers/input/keyboard/tegra-kbc.c |   93 +++-
 1 files changed, 28 insertions(+), 65 deletions(-)

diff --git a/drivers/input/keyboard/tegra-kbc.c 
b/drivers/input/keyboard/tegra-kbc.c
index f1d3ba0..c036425 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -618,7 +618,7 @@ static struct tegra_kbc_platform_data 
*tegra_kbc_dt_parse_pdata(
if (!np)
return NULL;
 
-   pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+   pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return NULL;
 
@@ -700,33 +700,36 @@ static int tegra_kbc_probe(struct platform_device *pdev)
if (!pdata)
pdata = tegra_kbc_dt_parse_pdata(pdev);
 
-   if (!pdata)
+   if (!pdata) {
+   dev_err(&pdev->dev, "Platform data missing\n");
return -EINVAL;
-
-   if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) {
-   err = -EINVAL;
-   goto err_free_pdata;
}
 
+   if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows))
+   return -EINVAL;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "failed to get I/O memory\n");
-   err = -ENXIO;
-   goto err_free_pdata;
+   return -ENXIO;
}
 
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get keyboard IRQ\n");
-   err = -ENXIO;
-   goto err_free_pdata;
+   return -ENXIO;
+   }
+
+   kbc = devm_kzalloc(&pdev->dev, sizeof(*kbc), GFP_KERNEL);
+   if (!kbc) {
+   dev_err(&pdev->dev, "failed to alloc memory for kbc\n");
+   return -ENOMEM;
}
 
-   kbc = kzalloc(sizeof(*kbc), GFP_KERNEL);
-   input_dev = input_allocate_device();
-   if (!kbc || !input_dev) {
-   err = -ENOMEM;
-   goto err_free_mem;
+   input_dev = devm_input_allocate_device(&pdev->dev);
+   if (!input_dev) {
+   dev_err(&pdev->dev, "failed to allocate input device\n");
+   return -ENOMEM;
}
 
kbc->pdata = pdata;
@@ -735,25 +738,16 @@ static int tegra_kbc_probe(struct platform_device *pdev)
spin_lock_init(&kbc->lock);
setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc);
 
-   res = request_mem_region(res->start, resource_size(res), pdev->name);
-   if (!res) {
-   dev_err(&pdev->dev, "failed to request I/O memory\n");
-   err = -EBUSY;
-   goto err_free_mem;
-   }
-
-   kbc->mmio = ioremap(res->start, resource_size(res));
+   kbc->mmio = devm_request_and_ioremap(&pdev->dev, res);
if (!kbc->mmio) {
-   dev_err(&pdev->dev, "failed to remap I/O memory\n");
-   err = -ENXIO;
-   goto err_free_mem_region;
+   dev_err(&pdev->dev, "Cannot request memregion/iomap address\n");
+   return -EADDRNOTAVAIL;
}
 
-   kbc->clk = clk_get(&pdev->dev, NULL);
+   kbc->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(kbc->clk)) {
dev_err(&pdev->dev, "failed to get keyboard clock\n");
-   err = PTR_ERR(kbc->clk);
-   goto err_iounmap;
+   return PTR_ERR(kbc->clk);
}
 
/*
@@ -778,9 +772,9 @@ static int tegra_kbc_probe(struct platform_device *pdev)
input_dev->close = tegra_kbc_close;
 
err = tegra_kbd_setup_keymap(kbc);
-   if (err) {
+   if (err < 0) {
dev_err(&pdev->dev, "failed to setup keymap\n");
-   goto err_put_clk;
+   return err;
}
 
__set_bit(EV_REP, input_dev->evbit);
@@ -790,15 +784,15 @@ static int tegra_kbc_probe(struct platform_device *pdev)
 
err = request_irq(kbc->irq, tegra_kbc_isr,
  IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc);
-   if (err) {
+   if (err < 0) {
dev_err(&pdev->dev, "failed to request keyboard IRQ\n");
-   goto err_put_clk;
+   return err;
}
 
disable_irq(kbc->irq);
 
err = input_register_device(kbc->idev);
-   if (err) {
+   if (err < 0) {
dev_err(&pdev->dev, "failed to register input device\n");
goto err_free_irq;
}
@@ -810,46 +804,15 @@ static int tegra_kbc_probe(struct platform_device *pdev)
 
 err_free_irq:
free_irq(kbc->irq, pdev);
-err_put_clk:
-   clk_put(kbc->clk);
-err_iounmap:
-   iounmap(kbc->mmio);
-err_free_mem_region:
-   release_mem_region(res->start, resource_size(res));
-err

[PATCH 4/4] input: keyboard: tegra: remove default key mapping

2013-01-04 Thread Laxman Dewangan
Tegra KBC driver have the default key mapping for 16x8 configuration.
The key mapping can be provided through platform data or through DT
and the mapping varies from platform to platform, hence this default
mapping is not so useful. Remove the default mapping to reduce the code
lines of the driver.

Signed-off-by: Laxman Dewangan 
---
 drivers/input/keyboard/tegra-kbc.c |  156 +---
 1 files changed, 1 insertions(+), 155 deletions(-)

diff --git a/drivers/input/keyboard/tegra-kbc.c 
b/drivers/input/keyboard/tegra-kbc.c
index 69f8b04..4e33929 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -87,147 +87,6 @@ struct tegra_kbc {
struct clk *clk;
 };
 
-static const u32 tegra_kbc_default_keymap[] = {
-   KEY(0, 2, KEY_W),
-   KEY(0, 3, KEY_S),
-   KEY(0, 4, KEY_A),
-   KEY(0, 5, KEY_Z),
-   KEY(0, 7, KEY_FN),
-
-   KEY(1, 7, KEY_LEFTMETA),
-
-   KEY(2, 6, KEY_RIGHTALT),
-   KEY(2, 7, KEY_LEFTALT),
-
-   KEY(3, 0, KEY_5),
-   KEY(3, 1, KEY_4),
-   KEY(3, 2, KEY_R),
-   KEY(3, 3, KEY_E),
-   KEY(3, 4, KEY_F),
-   KEY(3, 5, KEY_D),
-   KEY(3, 6, KEY_X),
-
-   KEY(4, 0, KEY_7),
-   KEY(4, 1, KEY_6),
-   KEY(4, 2, KEY_T),
-   KEY(4, 3, KEY_H),
-   KEY(4, 4, KEY_G),
-   KEY(4, 5, KEY_V),
-   KEY(4, 6, KEY_C),
-   KEY(4, 7, KEY_SPACE),
-
-   KEY(5, 0, KEY_9),
-   KEY(5, 1, KEY_8),
-   KEY(5, 2, KEY_U),
-   KEY(5, 3, KEY_Y),
-   KEY(5, 4, KEY_J),
-   KEY(5, 5, KEY_N),
-   KEY(5, 6, KEY_B),
-   KEY(5, 7, KEY_BACKSLASH),
-
-   KEY(6, 0, KEY_MINUS),
-   KEY(6, 1, KEY_0),
-   KEY(6, 2, KEY_O),
-   KEY(6, 3, KEY_I),
-   KEY(6, 4, KEY_L),
-   KEY(6, 5, KEY_K),
-   KEY(6, 6, KEY_COMMA),
-   KEY(6, 7, KEY_M),
-
-   KEY(7, 1, KEY_EQUAL),
-   KEY(7, 2, KEY_RIGHTBRACE),
-   KEY(7, 3, KEY_ENTER),
-   KEY(7, 7, KEY_MENU),
-
-   KEY(8, 4, KEY_RIGHTSHIFT),
-   KEY(8, 5, KEY_LEFTSHIFT),
-
-   KEY(9, 5, KEY_RIGHTCTRL),
-   KEY(9, 7, KEY_LEFTCTRL),
-
-   KEY(11, 0, KEY_LEFTBRACE),
-   KEY(11, 1, KEY_P),
-   KEY(11, 2, KEY_APOSTROPHE),
-   KEY(11, 3, KEY_SEMICOLON),
-   KEY(11, 4, KEY_SLASH),
-   KEY(11, 5, KEY_DOT),
-
-   KEY(12, 0, KEY_F10),
-   KEY(12, 1, KEY_F9),
-   KEY(12, 2, KEY_BACKSPACE),
-   KEY(12, 3, KEY_3),
-   KEY(12, 4, KEY_2),
-   KEY(12, 5, KEY_UP),
-   KEY(12, 6, KEY_PRINT),
-   KEY(12, 7, KEY_PAUSE),
-
-   KEY(13, 0, KEY_INSERT),
-   KEY(13, 1, KEY_DELETE),
-   KEY(13, 3, KEY_PAGEUP),
-   KEY(13, 4, KEY_PAGEDOWN),
-   KEY(13, 5, KEY_RIGHT),
-   KEY(13, 6, KEY_DOWN),
-   KEY(13, 7, KEY_LEFT),
-
-   KEY(14, 0, KEY_F11),
-   KEY(14, 1, KEY_F12),
-   KEY(14, 2, KEY_F8),
-   KEY(14, 3, KEY_Q),
-   KEY(14, 4, KEY_F4),
-   KEY(14, 5, KEY_F3),
-   KEY(14, 6, KEY_1),
-   KEY(14, 7, KEY_F7),
-
-   KEY(15, 0, KEY_ESC),
-   KEY(15, 1, KEY_GRAVE),
-   KEY(15, 2, KEY_F5),
-   KEY(15, 3, KEY_TAB),
-   KEY(15, 4, KEY_F1),
-   KEY(15, 5, KEY_F2),
-   KEY(15, 6, KEY_CAPSLOCK),
-   KEY(15, 7, KEY_F6),
-
-   /* Software Handled Function Keys */
-   KEY(20, 0, KEY_KP7),
-
-   KEY(21, 0, KEY_KP9),
-   KEY(21, 1, KEY_KP8),
-   KEY(21, 2, KEY_KP4),
-   KEY(21, 4, KEY_KP1),
-
-   KEY(22, 1, KEY_KPSLASH),
-   KEY(22, 2, KEY_KP6),
-   KEY(22, 3, KEY_KP5),
-   KEY(22, 4, KEY_KP3),
-   KEY(22, 5, KEY_KP2),
-   KEY(22, 7, KEY_KP0),
-
-   KEY(27, 1, KEY_KPASTERISK),
-   KEY(27, 3, KEY_KPMINUS),
-   KEY(27, 4, KEY_KPPLUS),
-   KEY(27, 5, KEY_KPDOT),
-
-   KEY(28, 5, KEY_VOLUMEUP),
-
-   KEY(29, 3, KEY_HOME),
-   KEY(29, 4, KEY_END),
-   KEY(29, 5, KEY_BRIGHTNESSDOWN),
-   KEY(29, 6, KEY_VOLUMEDOWN),
-   KEY(29, 7, KEY_BRIGHTNESSUP),
-
-   KEY(30, 0, KEY_NUMLOCK),
-   KEY(30, 1, KEY_SCROLLLOCK),
-   KEY(30, 2, KEY_MUTE),
-
-   KEY(31, 4, KEY_HELP),
-};
-
-static const
-struct matrix_keymap_data tegra_kbc_default_keymap_data = {
-   .keymap = tegra_kbc_default_keymap,
-   .keymap_size= ARRAY_SIZE(tegra_kbc_default_keymap),
-};
-
 static void tegra_kbc_report_released_keys(struct input_dev *input,
   unsigned short old_keycodes[],
   unsigned int old_num_keys,
@@ -704,26 +563,13 @@ static int tegra_kbd_setup_keymap(struct tegra_kbc *kbc)
const struct tegra_kbc_platform_data *pdata = kbc->pdata;
const struct matrix_keymap_data *keymap_data = pdata->keymap_data;
unsigned int keymap_rows = KBC_MAX_KEY;
-   int retval;
 
if (keymap_data && pdata->use_fn_map)
keymap_rows *= 2;
 
-   retval = matrix_keypad_build_keymap(keymap_data, NULL,
+   return matrix_keypad_build_keymap(keymap_data, NU

[PATCH] ARM: tegra: config: enable KEYBOARD_TEGRA

2013-01-04 Thread Laxman Dewangan
Signed-off-by: Laxman Dewangan 
---
 arch/arm/configs/tegra_defconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 0becd9f..c14a9fb 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -106,6 +106,7 @@ CONFIG_BRCMFMAC=m
 CONFIG_RT2X00=y
 CONFIG_RT2800USB=m
 CONFIG_INPUT_EVDEV=y
+CONFIG_KEYBOARD_TEGRA=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MPU3050=y
 # CONFIG_LEGACY_PTYS is not set
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: DT: tegra: add DT entry for KBC controller

2013-01-04 Thread Laxman Dewangan
NVIDIA's Tegra SoCs have the matrix keyboard controller which
supports 16x8 type of matrix. The number of rows and columns
are configurable.

Add DT entry for KBC controller.

Signed-off-by: Laxman Dewangan 
---
 arch/arm/boot/dts/tegra20.dtsi |7 +++
 arch/arm/boot/dts/tegra30.dtsi |7 +++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index fe35c72..133d00d 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -352,6 +352,13 @@
status = "disabled";
};
 
+   kbc {
+   compatible = "nvidia,tegra20-kbc";
+   reg = <0x7000e200 0x100>;
+   interrupts = <0 85 0x04>;
+   status = "disabled";
+   };
+
pmc {
compatible = "nvidia,tegra20-pmc";
reg = <0x7000e400 0x400>;
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index f534a50..bc9f702 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -368,6 +368,13 @@
status = "disabled";
};
 
+   kbc {
+   compatible = "nvidia,tegra30-kbc", nvidia,tegra20-kbc";
+   reg = <0x7000e200 0x100>;
+   interrupts = <0 85 0x04>;
+   status = "disabled";
+   };
+
pmc {
compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc";
reg = <0x7000e400 0x400>;
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 Resend 3/4] workqueue: Schedule work on non-idle cpu instead of current one

2013-01-04 Thread Viresh Kumar
Hi Tejun,

On 27 November 2012 10:49, Viresh Kumar  wrote:
> On 26 November 2012 22:45, Tejun Heo  wrote:
>> On Tue, Nov 06, 2012 at 04:08:45PM +0530, Viresh Kumar wrote:
>
>> I'm pretty skeptical about this.  queue_work() w/o explicit CPU
>> assignment has always guaranteed that the work item will be executed
>> on the same CPU.  I don't think there are too many users depending on
>> that but am not sure at all that there are none.  I asked you last
>> time that you would at the very least need to audit most users but it
>> doesn't seem like there has been any effort there.
>
> My bad. I completely missed/forgot that comment from your earlier mails.
> Will do it.

And this is the first thing i did this year :)

So there are almost 1200 files which are using: queue_work, queue_delayed_work,
schedule_work, schedule_delayed_work or schedule_on_each_cpu

Obviously i can't try to understand all of them :) , and so i tried to
search two
strings in them: "cpu" or "processor_id". So, this would catch every
file of these 1200
odd files which use some variables/comment/code with cpu or smp_processor_id or
raw_processor_id, etc..

I got around 650 files with these two searches.. Then i went into
these files to see if
there is anything noticeable, which may break due to this patch...

I got a list of files where cpu/processor_id strings are found, which
may break with
this patch (still can't guarantee as i don't have knowledge of these drivers)...

- arch/powerpc/mm/numa.c
- arch/s390/appldata/appldata_base.c
- arch/s390/kernel/time.c
- arch/s390/kernel/topology.c
- arch/s390/oprofile/hwsampler.c
- arch/x86/kernel/cpu/mcheck/mce.c
- arch/x86/kernel/tsc.c
- arch/x86/kvm/x86.c
- block/blk-core.c
- block/blk-throttle.c
- block/blk-genhd.c
- crypto/cryptd.c
- drivers/base/power/domain.c
- drivers/cpufreq/cpufreq.c
- drivers/hv/vmbus_drv.c
- drivers/infiniband/hw/qib/qib_iba7322.c and
drivers/infiniband/hw/qib/qib_init.c
- drivers/md/dm-crypt.c
- drivers/md/md.c
- drivers/net/ethernet/sfc/efx.c
- drivers/net/ethernet/tile/tilepro.c
- drivers/net/team/team_mode_loadbalance.c
- drivers/oprofile/cpu_buffer.c
- drivers/s390/kvm/kvm_virtio.c
- drivers/scsi/fcoe/fcoe.c
- drivers/tty/sysrq.c
- drivers/xen/pcpu.c
- fs/file.c, file_table.c, fs/fscache/object.c
- include/linux/stop_machine.h, kernel/stop_machine.c
- mm/percpu.c
- mm/slab.c
- mm/vmstat.c
- net/core/flow.c
- net/iucv/iucv.c

I am not sure what to do now :) , can you assist ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: radeon 0000:02:00.0: GPU lockup CP stall for more than 10000msec

2013-01-04 Thread Boszormenyi Zoltan

2013-01-04 08:40 keltezéssel, Borislav Petkov írta:

On Wed, Jan 02, 2013 at 06:37:23PM -0500, Alex Deucher wrote:

From: Alex Deucher 
Date: Wed, 2 Jan 2013 18:30:21 -0500
Subject: [PATCH] drm/radeon/r6xx: fix DMA engine for ttm bo transfers

count must be a multiple of 2.

Cc: Borislav Petkov 
Cc: Markus Trippelsdorf 
Signed-off-by: Alex Deucher 

Thanks, will run it on the box in question next week when I have access.

Btw, you could add the note about count needing to be a multiple of 2 as
a comment in the code below, for future reference.


---
  drivers/gpu/drm/radeon/r600.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 2aaf147..9f4ce5e 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2636,8 +2636,8 @@ int r600_copy_dma(struct radeon_device *rdev,
  
  	for (i = 0; i < num_loops; i++) {

cur_size_in_dw = size_in_dw;
-   if (cur_size_in_dw > 0x)
-   cur_size_in_dw = 0x;
+   if (cur_size_in_dw > 0xFFFE)
+   cur_size_in_dw = 0xFFFE;


How about any other odd numbers? Like 0xFFFB, or 0x0003?
They will get passed as is after this change, no? Shouldn't they
be also fixed? Something like this below?

  if (cur_size_in_dw & 0x0001)
   cur_size_in_dw &= ~1;




size_in_dw -= cur_size_in_dw;
radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, 
cur_size_in_dw));
radeon_ring_write(ring, dst_offset & 0xfffc);
--
1.7.7.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Regression: Bacula jobs fail with kernel 3.8-rc1

2013-01-04 Thread Tilman Schmidt
On 31.12.2012 16:07, /me wrote:
> With kernel 3.8-rc1, my nightly Bacula backup job reproducibly aborts
> 20 minutes into spooling with a "broken pipe" error on the network
> socket connecting the file and storage daemons:
[...]
> Returning to kernel 3.7.1 makes it work again.

Update/correction: in the meantime

- I had some jobs succeed on kernel 3.8-rc1,
  so the failure is not fully reproducible

- it happened with kernel 3.7.1 too, though much less frequently

- I went back to 3.6.11 where I the failure hasn't occurred so far

BTW the fact that the job spends 20 minutes spooling appears to be
part of the problem; a job which aborted after 20 mins on 3.7.1
completed in 3 mins on 3.6.11.

-- 
Tilman SchmidtE-Mail: til...@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)




signature.asc
Description: OpenPGP digital signature


Re: [PATCH v3 0/9] Migrate Tegra to common clock framework

2013-01-04 Thread Joseph Lo
On Fri, 2013-01-04 at 17:40 +0800, Prashant Gaikwad wrote:
> This patchset does following:
> 1. Decompose single tegra clock structure into multiple clocks.
> 2. Try to use standard clock types supported by common clock framework.
> 3. Use dynamic initialization.
> 4. Move all clock code to drivers/clk/tegra from mach-tegra.
> 5. Add device tree support for Tegra20 and Tegra30 clocks.
> 6. Remove all legacy clock code from mach-tegra.
> 
> Tested on Tegra30 (Cardhu) and Tegra20 (Ventana).
> 
> Changes from v2:
> Removed APB MISC node.
> Fixed some issues reported by Joseph Lo.
> Added function to read chip id revision register.
> 
> Changes from v1:
> Rebased on linux-next for 20121224.
> 
> Prashant Gaikwad (8):
>   ARM: tegra: Add function to read chipid
>   clk: tegra: Add tegra specific clocks
>   arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h
>   ARM: Tegra: Define Tegra30 CAR binding
>   clk: tegra: add clock support for tegra20
>   clk: tegra: add clock support for tegra30
>   arm: tegra: Migrate to new clock code
>   arm: tegra: Remove legacy clock code
> 
> Stephen Warren (1):
>   ARM: tegra: Define Tegra20 CAR binding
> 

Good job, Prashant. :-)

This series :
Tested-by: Joseph Lo 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/7] ARM: dt: tegra20: Add clock information

2013-01-04 Thread Joseph Lo
On Fri, 2013-01-04 at 17:46 +0800, Prashant Gaikwad wrote:
> Add clock information to device nodes.
> 
> Signed-off-by: Prashant Gaikwad 
> ---
> Tested on Ventana (Tegra20) and Cardhu (Tegra30).
> This series depends on ccf-rework patch series.
> ---

This series :
Tested-by: Joseph Lo 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] cpufreq: Manage only online cpus

2013-01-04 Thread Rafael J. Wysocki
On Friday, January 04, 2013 10:44:36 AM Viresh Kumar wrote:
> On 3 January 2013 17:32, Rafael J. Wysocki  wrote:
> > True, but have those bugs been introduced recently (ie. in v3.8-rc1 or 
> > later)?
> 
> Don't know... I feel they were always there, its just that nobody
> tested it that way :)

That exactly is my point. :-)

If they have always been there, I don't see much reason for hurrying with the
fixes, so I'll queue them up for v3.9.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Alternative 2][PATCH] ACPI / PCI: Set root bridge ACPI handle in advance

2013-01-04 Thread Rafael J. Wysocki
On Thursday, January 03, 2013 06:00:38 PM Bjorn Helgaas wrote:
> On Thu, Jan 03, 2013 at 11:56:55PM +0100, Rafael J. Wysocki wrote:
> 
> > OK, I now have sent no less than three working version of the patch that 
> > fixes
> > the current code which _is_ insane.  You haven't even responded to the last
> > one, but for the first two the reason why you didn't like them was something
> > similar to "it may conflict with some future changes I'm planning".  Well,
> > that might be used to reject prety much any change and I'm not considering 
> > it
> > as a good enough reason for blocking a fix.  Sorry about that.
> 
> I think your memory is faulty.  My response to the first
> (https://lkml.org/lkml/2012/12/20/407) was "Thanks for cleaning this up, I
> have an interface concern, here's an outline of a possible alternative."
> 
> My response to the second (https://lkml.org/lkml/2012/12/26/72) was "I like
> this much better, Acked-by: Bjorn Helgaas."  Then Yinghai noticed the issue
> with non-ACPI host bridges, and you abandoned that approach.

I thought it was helpelss, but I was clearly wrong.  I should have spent more
time on figuring out why it failed, so thank for taking the time to do that.

> I took a few days of vacation, then spent the better part of yesterday
> exploring the reasons why x86 and ia64 don't use the "parent" argument when
> several other arches do, and worked up a patch
> (https://lkml.org/lkml/2013/1/2/285).  It turned out to have a fatal flaw,
> but was done in good faith.

I know.

> It's true I haven't responded to the third one, posted about 12 hours ago.

Oh, that's a simple patch. ;-)

But you're right, I should be more patient.  Sorry about that.

> I still like the approach of the second patch.  What would you think
> of the following incremental change to it?

I'm fine with it.

> I did reproduce Yinghai's
> issue with non-ACPI host bridges, and this change resolves it for me.

If you don't mind, I'll fold the patch below into

https://patchwork.kernel.org/patch/1910181/

and post the complete patch.

Thanks,
Rafael


> diff -u b/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
> --- b/arch/x86/pci/acpi.c
> +++ b/arch/x86/pci/acpi.c
> @@ -522,6 +522,7 @@
>   sd = &info->sd;
>   sd->domain = domain;
>   sd->node = node;
> + sd->acpi_handle = device->handle;
>   /*
>* Maybe the desired pci bus has been already scanned. In such case
>* it is unnecessary to scan the pci bus with the given domain,busnum.
> @@ -596,9 +597,8 @@
>  int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
>  {
>   struct pci_sysdata *sd = bridge->bus->sysdata;
> - struct pci_root_info *info = container_of(sd, struct pci_root_info, sd);
>  
> - ACPI_HANDLE_SET(&bridge->dev, info->bridge->handle);
> + ACPI_HANDLE_SET(&bridge->dev, sd->acpi_handle);
>   return 0;
>  }
>  
> --- a/arch/x86/include/asm/pci.h
> +++ b/arch/x86/include/asm/pci.h
> @@ -14,6 +14,7 @@
>  struct pci_sysdata {
>   int domain; /* PCI domain */
>   int node;   /* NUMA node */
> + void*acpi_handle;
>  #ifdef CONFIG_X86_64
>   void*iommu; /* IOMMU private data */
>  #endif
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7u1 31/31] x86, 64bit, mm: hibernate use generic mapping_init

2013-01-04 Thread Rafael J. Wysocki
On Thursday, January 03, 2013 04:48:51 PM Yinghai Lu wrote:
> Make it only map range in pfn_mapped array.

Can you please explain why that should be sufficient?

Have you tested it?

> and it has kernel mapping with EXEC.

That's because it needs to execute code from one of those pages and it
doesn't know in advance which one that's going to be.

Thanks,
Rafael


> Signed-off-by: Yinghai Lu 
> Cc: Pavel Machek 
> Cc: Rafael J. Wysocki 
> Cc: linux...@vger.kernel.org
> ---
>  arch/x86/power/hibernate_64.c |   66 
> ++---
>  1 file changed, 22 insertions(+), 44 deletions(-)
> 
> diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
> index 460f314..a0fde91 100644
> --- a/arch/x86/power/hibernate_64.c
> +++ b/arch/x86/power/hibernate_64.c
> @@ -11,6 +11,8 @@
>  #include 
>  #include 
>  #include 
> +
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -39,41 +41,21 @@ pgd_t *temp_level4_pgt;
>  
>  void *relocated_restore_code;
>  
> -static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned 
> long end)
> +static void *alloc_pgt_page(void *context)
>  {
> - long i, j;
> -
> - i = pud_index(address);
> - pud = pud + i;
> - for (; i < PTRS_PER_PUD; pud++, i++) {
> - unsigned long paddr;
> - pmd_t *pmd;
> -
> - paddr = address + i*PUD_SIZE;
> - if (paddr >= end)
> - break;
> -
> - pmd = (pmd_t *)get_safe_page(GFP_ATOMIC);
> - if (!pmd)
> - return -ENOMEM;
> - set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE));
> - for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) {
> - unsigned long pe;
> -
> - if (paddr >= end)
> - break;
> - pe = __PAGE_KERNEL_LARGE_EXEC | paddr;
> - pe &= __supported_pte_mask;
> - set_pmd(pmd, __pmd(pe));
> - }
> - }
> - return 0;
> + return (void *)get_safe_page(GFP_ATOMIC);
>  }
>
>  static int set_up_temporary_mappings(void)
>  {
> - unsigned long start, end, next;
> - int error;
> + struct x86_mapping_info info = {
> + .alloc_pgt_page = alloc_pgt_page,
> + .pmd_flag   = __PAGE_KERNEL_LARGE_EXEC,
> + .kernel_mapping = true,
> + };
> + unsigned long mstart, mend;
> + int result;
> + int i;
>  
>   temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC);
>   if (!temp_level4_pgt)
> @@ -84,21 +66,17 @@ static int set_up_temporary_mappings(void)
>   init_level4_pgt[pgd_index(__START_KERNEL_map)]);
>  
>   /* Set up the direct mapping from scratch */
> - start = (unsigned long)pfn_to_kaddr(0);
> - end = (unsigned long)pfn_to_kaddr(max_pfn);
> -
> - for (; start < end; start = next) {
> - pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC);
> - if (!pud)
> - return -ENOMEM;
> - next = start + PGDIR_SIZE;
> - if (next > end)
> - next = end;
> - if ((error = res_phys_pud_init(pud, __pa(start), __pa(next
> - return error;
> - set_pgd(temp_level4_pgt + pgd_index(start),
> - mk_kernel_pgd(__pa(pud)));
> + for (i = 0; i < nr_pfn_mapped; i++) {
> + mstart = pfn_mapped[i].start << PAGE_SHIFT;
> + mend   = pfn_mapped[i].end << PAGE_SHIFT;
> +
> + result = kernel_ident_mapping_init(&info, temp_level4_pgt,
> +mstart, mend);
> +
> + if (result)
> + return result;
>   }
> +
>   return 0;
>  }
>  
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 1/2] ASoC: davinci-mcasp: Add pinctrl support

2013-01-04 Thread Mark Brown
On Fri, Jan 04, 2013 at 03:24:36PM +0530, Hebbar Gururaja wrote:
> From: "Hebbar, Gururaja" 
> 
> Signed-off-by: Hebbar, Gururaja 

Linus has a change for this in the core which currently looks like it'll
get merged in v3.8 so there doesn't seem to be any pressing need for
driver specific changes that just set the defaults.


signature.asc
Description: Digital signature


Re: sched: Consequences of integrating the Per Entity Load Tracking Metric into the Load Balancer

2013-01-04 Thread Mike Galbraith
On Thu, 2013-01-03 at 16:08 +0530, Preeti U Murthy wrote: 
> Hi Mike,
> 
> Thank you very much for your feedback.Considering your suggestions,I have 
> posted out a 
> proposed solution to prevent select_idle_sibling() from becoming a 
> disadvantage to normal
> load balancing,rather aiding it.
> 
> **This patch is *without* the enablement of the per entity load tracking 
> metric.**
> 
> This is with an intention to correct the existing select_idle_sibling() mess 
> before
> going ahead.

Well, on the bright side, this is much kinder to light load tbench on
4x10 core (+ht) box than current bounce happy select_idle_sibling().  At
the heavy load end I'm losing heaping truckloads of throughput though,
likely some migration rate limiting would fix that up.

select_idle_sibling() doesn't have much of a pretty face these days, but
its evil hag face shows more prominently than ever, so making it dead is
a great goal ;-)

-Mike

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Add #includes needed to permit the removal of asm/system.h - sha1 96f951edb1f1bdbbc99b0cd458f9808bb83d58ae

2013-01-04 Thread Michal Simek
2013/1/3 David Howells :
> Michal Simek  wrote:
>
>> It is because microblaze uses cmpxchg_local which is defined
>> asm-generic/atomic.h file.
>> Arnds patch has added it to atomic.h
>> asm-generic: add generic atomic.h and io.h
>> (sha1: 3f7e212df82ca0459d44c91d9e019efd1b5f936c)
>>
>> What about to move cmpxchg_local and cmpxchg64_local from atomic.h to
>> cmpxchg-local.h?
>
> Hmmm...  cmpxchg_local() should be obtained through asm/cmpxchg.h, not
> asm/atomic.h.  See:
>
> grep -r define\\s*cmpxchg_local arch

But it is also here which Microblaze uses.

[linux-2.6.x]$ grep -r define\\s*cmpxchg_local include/asm-generic/
include/asm-generic/atomic.h:#define cmpxchg_local(ptr, o, n)   
   \

(not checked on the latest but probably it is the same)
m68k, arm contains the same copy for one case
c6x, unicore, cris, blackfin, h8300, sparc32

Probably make sense to move these two macros
cmpxchg64_local and cmpxchg_local to asm-generic/cmpxchg-local.h
with #ifndef cmpxchg_local ...etc. and remove it from architectures above.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 29/49] mm: numa: Add pte updates, hinting and migration stats

2013-01-04 Thread Simon Jeons
On Fri, 2012-12-07 at 10:23 +, Mel Gorman wrote:
> It is tricky to quantify the basic cost of automatic NUMA placement in a
> meaningful manner. This patch adds some vmstats that can be used as part
> of a basic costing model.

Hi Gorman, 

> 
> u= basic unit = sizeof(void *)
> Ca   = cost of struct page access = sizeof(struct page) / u
> Cpte = Cost PTE access = Ca
> Cupdate = Cost PTE update = (2 * Cpte) + (2 * Wlock)
>   where Cpte is incurred twice for a read and a write and Wlock
>   is a constant representing the cost of taking or releasing a
>   lock
> Cnumahint = Cost of a minor page fault = some high constant e.g. 1000
> Cpagerw = Cost to read or write a full page = Ca + PAGE_SIZE/u

Why cpagerw = Ca + PAGE_SIZE/u instead of Cpte + PAGE_SIZE/u ?

> Ci = Cost of page isolation = Ca + Wi
>   where Wi is a constant that should reflect the approximate cost
>   of the locking operation
> Cpagecopy = Cpagerw + (Cpagerw * Wnuma) + Ci + (Ci * Wnuma)
>   where Wnuma is the approximate NUMA factor. 1 is local. 1.2
>   would imply that remote accesses are 20% more expensive
> 
> Balancing cost = Cpte * numa_pte_updates +
>   Cnumahint * numa_hint_faults +
>   Ci * numa_pages_migrated +
>   Cpagecopy * numa_pages_migrated
> 

Since Cpagecopy has already accumulated ci why count ci twice ?

> Note that numa_pages_migrated is used as a measure of how many pages
> were isolated even though it would miss pages that failed to migrate. A
> vmstat counter could have been added for it but the isolation cost is
> pretty marginal in comparison to the overall cost so it seemed overkill.
> 
> The ideal way to measure automatic placement benefit would be to count
> the number of remote accesses versus local accesses and do something like
> 
>   benefit = (remote_accesses_before - remove_access_after) * Wnuma
> 
> but the information is not readily available. As a workload converges, the
> expection would be that the number of remote numa hints would reduce to 0.
> 
>   convergence = numa_hint_faults_local / numa_hint_faults
>   where this is measured for the last N number of
>   numa hints recorded. When the workload is fully
>   converged the value is 1.
> 

convergence tend to 0 is better or 1 is better? If tend to 1, Cpte *
numa_pte_updates + Cnumahint * numa_hint_faults are just waste, where I
miss?

> This can measure if the placement policy is converging and how fast it is
> doing it.
> 
> Signed-off-by: Mel Gorman 
> Acked-by: Rik van Riel 
> ---
>  include/linux/vm_event_item.h |6 ++
>  include/linux/vmstat.h|8 
>  mm/huge_memory.c  |5 +
>  mm/memory.c   |   12 
>  mm/mempolicy.c|2 ++
>  mm/migrate.c  |3 ++-
>  mm/vmstat.c   |6 ++
>  7 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> index a1f750b..dded0af 100644
> --- a/include/linux/vm_event_item.h
> +++ b/include/linux/vm_event_item.h
> @@ -38,6 +38,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
>   KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
>   KSWAPD_SKIP_CONGESTION_WAIT,
>   PAGEOUTRUN, ALLOCSTALL, PGROTATED,
> +#ifdef CONFIG_BALANCE_NUMA
> + NUMA_PTE_UPDATES,
> + NUMA_HINT_FAULTS,
> + NUMA_HINT_FAULTS_LOCAL,
> + NUMA_PAGE_MIGRATE,
> +#endif
>  #ifdef CONFIG_MIGRATION
>   PGMIGRATE_SUCCESS, PGMIGRATE_FAIL,
>  #endif
> diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
> index 92a86b2..dffccfa 100644
> --- a/include/linux/vmstat.h
> +++ b/include/linux/vmstat.h
> @@ -80,6 +80,14 @@ static inline void vm_events_fold_cpu(int cpu)
>  
>  #endif /* CONFIG_VM_EVENT_COUNTERS */
>  
> +#ifdef CONFIG_BALANCE_NUMA
> +#define count_vm_numa_event(x) count_vm_event(x)
> +#define count_vm_numa_events(x, y) count_vm_events(x, y)
> +#else
> +#define count_vm_numa_event(x) do {} while (0)
> +#define count_vm_numa_events(x, y) do {} while (0)
> +#endif /* CONFIG_BALANCE_NUMA */
> +
>  #define __count_zone_vm_events(item, zone, delta) \
>   __count_vm_events(item##_NORMAL - ZONE_NORMAL + \
>   zone_idx(zone), delta)
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index b3d4c4b..66e73cc 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1025,6 +1025,7 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct 
> vm_area_struct *vma,
>   struct page *page = NULL;
>   unsigned long haddr = addr & HPAGE_PMD_MASK;
>   int target_nid;
> + int current_nid = -1;
>  
>   spin_lock(&mm->page_table_lock);
>   if (unlikely(!pmd_same(pmd, *pmdp)))
> @@ -1033,6 +1034,10 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct 
> vm_area_struct *vma,
>   

[PATCH] nfsd: Remove write permission from file content

2013-01-04 Thread ycnian
From: Yanchuan Nian 

The write function doesn't be implemented in file content, and it's meaningless
to write data into this file directly. Remove write permission from it.

Signed-off-by: Yanchuan Nian 
---
 net/sunrpc/cache.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9afa439..9f84703 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1614,7 +1614,7 @@ static int create_cache_proc_entries(struct cache_detail 
*cd, struct net *net)
goto out_nomem;
}
if (cd->cache_show) {
-   p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR,
+   p = proc_create_data("content", S_IFREG|S_IRUSR,
cd->u.procfs.proc_ent,
&content_file_operations_procfs, cd);
cd->u.procfs.content_ent = p;
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] RFC: leds-pwm: don't disable pwm when setting brightness to 0

2013-01-04 Thread Sascha Hauer
On Thu, Jan 03, 2013 at 10:01:18AM +0100, Thierry Reding wrote:
> On Thu, Oct 25, 2012 at 04:03:49PM +0800, Shawn Guo wrote:
> > On Wed, Oct 24, 2012 at 03:52:46PM +0200, Uwe Kleine-König wrote:
> > > This fixes disabling the LED on i.MX28. The PWM hardware delays using
> > > the newly set pwm-config until the beginning of a new period.  It's very
> > > likely that pwm_disable is called before the current period ends. In
> > > case the LED was on brightness=max before the LED stays on because in
> > > the disabled PWM block the period never ends.
> > > 
> > > It's unclear if the mxs-pwm driver doesn't implement the API as expected
> > > (i.e. it should block until the newly set config is effective) or if the
> > > leds-pwm driver makes wrong assumptions. This patch assumes the latter.
> > > 
> > > Signed-off-by: Uwe Kleine-König 
> > > ---
> > > Hello,
> > > 
> > > I'm not sure this is correct, but this is the workaround I'm using until
> > > I get some feed back.
> > 
> > I'm fine with it, since it fixes a real problem.  Let's see what
> > Thierry says.
> 
> I lost track of this thread somehow, so sorry for not getting back to
> you earlier. The root cause of this problem seems to be that it isn't
> very well defined (actually not at all) what is supposed to happen in
> the case when a PWM is disabled.
> 
> There really are only two ways forward: a) we need to write down what
> the PWM subsystem expects to happen when a PWM is disabled or b) keep
> the currently undefined behaviour. With the latter I expect this kind
> of issue to keep popping up every once in a while with all sorts of
> ad-hoc solutions being implemented to solve the problem.
> 
> I think the best option would be to have some definition about what the
> PWM signal should look like after a call to pwm_disable(). However this
> doesn't turn out to be as trivial as it sounds. For instance, the most
> straightforward definition in my opinion would be to specify that a PWM
> signal should be constantly low after the call to pwm_disable(). It is
> what I think most people would assume is the natural disable state of a
> PWM.
> 
> However, one case where a similar problem was encountered involved a
> hardware design that used an external inverter to change the polarity of
> a PWM signal that was used to drive a backlight. In such a case, if the
> controller were programmed to keep the output low when disabling, the
> display would in fact be fully lit. This is further complicated by the
> fact that the controller allows the output level of the disabled PWM
> signal to be configured. This is nice because it means that pretty much
> any scenario is covered, but it also doesn't make it any easier to put
> this into a generic framework.
> 
> Having said that, I'm tempted to go with a simple definition like the
> above anyway and handle obscure cases with board-specific quirks. I
> don't see any other alternative that would allow the PWM framework to
> stay relatively simple and clean.
> 
> Now I only have access to a limited amount of hardware and use-cases, so
> any comments and suggestions as well as requirements on other platforms
> are very welcome.

How about keeping the current behaviour, so:

duty cycle 0-> output constant low
duty cycle 100% -> output constant high
pwm disabled-> output unspecified

This would allow the pwm drivers to implement whatever powersaving is
possible for 0/100%, or, if that's not possible, use pwm_disable for
powersaving. A pwm client driver wouldn't have to call pwm_en|disable at
all anymore during runtime (only pwm_enable during probe)

Background is that some board here needs 100% duty cycle to set the
backlight dark. This inversion can be easily archieved in software, but
on this board we would expect the pwm_disable output state to be high
whereas on most other boards we would expect the pwm_disable output
state to be low. The inversion could also be made in the pwm hardware
(possible on i.MX for example), I currently don't know what this means
for the pwm_disable output state.

Overall I think with this a client driver would have full control over
the output and we would avoid confusion with the pwm_en|disable calls.

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 25/49] mm: numa: Add fault driven placement and migration

2013-01-04 Thread Simon Jeons
On Fri, 2012-12-07 at 10:23 +, Mel Gorman wrote:
> From: Peter Zijlstra 
> 
> NOTE: This patch is based on "sched, numa, mm: Add fault driven
>   placement and migration policy" but as it throws away all the policy
>   to just leave a basic foundation I had to drop the signed-offs-by.
> 
> This patch creates a bare-bones method for setting PTEs pte_numa in the
> context of the scheduler that when faulted later will be faulted onto the
> node the CPU is running on.  In itself this does nothing useful but any
> placement policy will fundamentally depend on receiving hints on placement
> from fault context and doing something intelligent about it.
> 
> Signed-off-by: Mel Gorman 
> Acked-by: Rik van Riel 
> ---
>  arch/sh/mm/Kconfig   |1 +
>  arch/x86/Kconfig |2 +
>  include/linux/mm_types.h |   11 
>  include/linux/sched.h|   20 
>  kernel/sched/core.c  |   13 +
>  kernel/sched/fair.c  |  125 
> ++
>  kernel/sched/features.h  |7 +++
>  kernel/sched/sched.h |6 +++
>  kernel/sysctl.c  |   24 -
>  mm/huge_memory.c |5 +-
>  mm/memory.c  |   14 +-
>  11 files changed, 224 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
> index cb8f992..0f7c852 100644
> --- a/arch/sh/mm/Kconfig
> +++ b/arch/sh/mm/Kconfig
> @@ -111,6 +111,7 @@ config VSYSCALL
>  config NUMA
>   bool "Non Uniform Memory Access (NUMA) Support"
>   depends on MMU && SYS_SUPPORTS_NUMA && EXPERIMENTAL
> + select ARCH_WANT_NUMA_VARIABLE_LOCALITY
>   default n
>   help
> Some SH systems have many various memories scattered around
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 46c3bff..1137028 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -22,6 +22,8 @@ config X86
>   def_bool y
>   select HAVE_AOUT if X86_32
>   select HAVE_UNSTABLE_SCHED_CLOCK
> + select ARCH_SUPPORTS_NUMA_BALANCING
> + select ARCH_WANTS_PROT_NUMA_PROT_NONE
>   select HAVE_IDE
>   select HAVE_OPROFILE
>   select HAVE_PCSPKR_PLATFORM
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 31f8a3a..d82accb 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -398,6 +398,17 @@ struct mm_struct {
>  #ifdef CONFIG_CPUMASK_OFFSTACK
>   struct cpumask cpumask_allocation;
>  #endif
> +#ifdef CONFIG_BALANCE_NUMA
> + /*
> +  * numa_next_scan is the next time when the PTEs will me marked

s/me/be

> +  * pte_numa to gather statistics and migrate pages to new nodes
> +  * if necessary
> +  */
> + unsigned long numa_next_scan;
> +
> + /* numa_scan_seq prevents two threads setting pte_numa */
> + int numa_scan_seq;
> +#endif
>   struct uprobes_state uprobes_state;
>  };
>  
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 0dd42a0..ac71181 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1479,6 +1479,14 @@ struct task_struct {
>   short il_next;
>   short pref_node_fork;
>  #endif
> +#ifdef CONFIG_BALANCE_NUMA
> + int numa_scan_seq;
> + int numa_migrate_seq;
> + unsigned int numa_scan_period;
> + u64 node_stamp; /* migration stamp  */
> + struct callback_head numa_work;
> +#endif /* CONFIG_BALANCE_NUMA */
> +
>   struct rcu_head rcu;
>  
>   /*
> @@ -1553,6 +1561,14 @@ struct task_struct {
>  /* Future-safe accessor for struct task_struct's cpus_allowed. */
>  #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
>  
> +#ifdef CONFIG_BALANCE_NUMA
> +extern void task_numa_fault(int node, int pages);
> +#else
> +static inline void task_numa_fault(int node, int pages)
> +{
> +}
> +#endif
> +
>  /*
>   * Priority of a process goes from 0..MAX_PRIO-1, valid RT
>   * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
> @@ -1990,6 +2006,10 @@ enum sched_tunable_scaling {
>  };
>  extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
>  
> +extern unsigned int sysctl_balance_numa_scan_period_min;
> +extern unsigned int sysctl_balance_numa_scan_period_max;
> +extern unsigned int sysctl_balance_numa_settle_count;
> +
>  #ifdef CONFIG_SCHED_DEBUG
>  extern unsigned int sysctl_sched_migration_cost;
>  extern unsigned int sysctl_sched_nr_migrate;
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 2d8927f..81fa185 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1533,6 +1533,19 @@ static void __sched_fork(struct task_struct *p)
>  #ifdef CONFIG_PREEMPT_NOTIFIERS
>   INIT_HLIST_HEAD(&p->preempt_notifiers);
>  #endif
> +
> +#ifdef CONFIG_BALANCE_NUMA
> + if (p->mm && atomic_read(&p->mm->mm_users) == 1) {
> + p->mm->numa_next_scan = jiffies;
> + p->mm->numa_scan_seq = 0;
> + }
> +
> + p->node_stamp = 0ULL;
> + p->numa_scan_seq = p->mm ? p->mm->numa_scan_seq : 0;
> +  

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

2013-01-04 Thread Laxman Dewangan

On Friday 04 January 2013 09:30 AM, Stephen Warren wrote:

On 01/03/2013 08:23 PM, Prashant Gaikwad wrote:

On Friday 04 January 2013 08:35 AM, Stephen Warren wrote:

On 01/03/2013 06:48 PM, Prashant Gaikwad wrote:

On Thursday 03 January 2013 09:41 PM, Stephen Warren wrote:

...

OK. It sounds like we need a true APB MISC driver then, to abstract the
differences; the clock driver really shouldn't be touching the APB MISC
registers in all likelihood, unless a subset of the sections you
mention
above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all
registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample
on a set of registers they don't own.


Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can
you just read those?

It is not about variables or some value, we have to read some apb
register to flush the write operation in apb bus before we disable
peripheral clock.
We are using chip id revision register for this purpose.

Ah. That's definitely not something the clock driver should be doing
directly. It's probably OK to add a custom Tegra-specific function to
some file in arch/arm/mach-tegra to implement this. Even better would be
a full bus driver for the APB bus, but that's probably too much bloat
for now.


I think individual driver should take care of flushing the write 
operation inplace of clock driver.
Atleast I moved flushing to i2c and spi for these drivers. Polluting 
clock driver here does not make sense here.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net-next] softirq: reduce latencies

2013-01-04 Thread Sedat Dilek
On Fri, Jan 4, 2013 at 5:41 AM, Eric Dumazet  wrote:
> On Thu, 2013-01-03 at 11:41 -0800, Rick Jones wrote:
>
>> In terms of netperf overhead, once you specify P99_LATENCY, you are
>> already in for the pound of cost but only getting the penny of output
>> (so to speak).  While it would clutter the output, one could go ahead
>> and ask for the other latency stats and it won't "cost" anything more:
>>
>> ... -- -k
>> RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
>>
>> Additional information about how the omni output selectors work can be
>> found at
>> http://www.netperf.org/svn/netperf2/trunk/doc/netperf.html#Omni-Output-Selection
>>
>> happy benchmarking,
>>
>> rick jones
>>
>> BTW - you will likely see some differences between RT_LATENCY, which is
>> calculated from the average transactions per second, and MEAN_LATENCY,
>> which is calculated from the histogram of individual latencies
>> maintained when any of the _LATENCY outputs other than RT_LATENCY is
>> requested.  Kudos to the folks at Google who did the extensions to the
>> then-existing histogram code to enable it to be used for more reasonably
>> accurate statistics.
>>
>
> Yeah ;)
>
> Here are the before/after_patch results, cpu 2 handling the NIC irqs :
>
>
> Before patch :
>
> # netperf -H 7.7.7.84 -t TCP_RR -T2,2 -- -k
> RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
> MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
> to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
> RT_LATENCY=550110.424
> MIN_LATENCY=146858
> MAX_LATENCY=997109
> P50_LATENCY=305000
> P90_LATENCY=55
> P99_LATENCY=71
> MEAN_LATENCY=376989.12
> STDDEV_LATENCY=184046.92
>
> After patch :
>
> # netperf -H 7.7.7.84 -t TCP_RR -T2,2 -- -k
> RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
> MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
> to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
> RT_LATENCY=40545.492
> MIN_LATENCY=9834
> MAX_LATENCY=78366
> P50_LATENCY=33583
> P90_LATENCY=59000
> P99_LATENCY=69000
> MEAN_LATENCY=38364.67
> STDDEV_LATENCY=12865.26
>

I also wanted to give some numbers.
But with localhost as default (no netserver running on a remote-host)
I am not sure if these numbers give any helpful feedback.
( I have not tested yet w/o your patch. )

- Sedat -
# netperf -H localhost -t TCP_RR -T2,2 -- -k 
RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 
localhost (127.0.0.1) port 0 AF_INET : demo : first burst 0 : cpu bind
RT_LATENCY=11.407
MIN_LATENCY=10
MAX_LATENCY=152
P50_LATENCY=11
P90_LATENCY=12
P99_LATENCY=13
MEAN_LATENCY=11.31
STDDEV_LATENCY=0.95

# netperf -H localhost -t TCP_RR -T2,2 -- -k 
RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 
localhost (127.0.0.1) port 0 AF_INET : demo : first burst 0 : cpu bind
RT_LATENCY=11.364
MIN_LATENCY=10
MAX_LATENCY=156
P50_LATENCY=11
P90_LATENCY=12
P99_LATENCY=13
MEAN_LATENCY=11.27
STDDEV_LATENCY=1.06

# netperf -H localhost -t TCP_RR -T2,2 -- -k 
RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 
localhost (127.0.0.1) port 0 AF_INET : demo : first burst 0 : cpu bind
RT_LATENCY=11.408
MIN_LATENCY=10
MAX_LATENCY=156
P50_LATENCY=11
P90_LATENCY=12
P99_LATENCY=13
MEAN_LATENCY=11.31
STDDEV_LATENCY=1.07

# netperf -H localhost -t TCP_RR -T2,2 -- -k 
RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 
localhost (127.0.0.1) port 0 AF_INET : demo : first burst 0 : cpu bind
RT_LATENCY=11.312
MIN_LATENCY=10
MAX_LATENCY=151
P50_LATENCY=11
P90_LATENCY=12
P99_LATENCY=13
MEAN_LATENCY=11.22
STDDEV_LATENCY=0.94

# netperf -H localhost -t TCP_RR -T2,2 -- -k 
RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 
localhost (127.0.0.1) port 0 AF_INET : demo : first burst 0 : cpu bind
RT_LATENCY=11.345
MIN_LATENCY=10
MAX_LATENCY=159
P50_LATENCY=11
P90_LATENCY=12
P99_LATENCY=13
MEAN_LATENCY=11.25
STDDEV_LATENCY=1.03


-dileks // 04-Jan-2013



Re: mmap() scalability in the presence of the MAP_POPULATE flag

2013-01-04 Thread Michel Lespinasse
On Fri, Jan 04, 2013 at 12:09:37AM +0700, Roman Dubtsov wrote:
> On Wed, 2013-01-02 at 16:09 -0800, Michel Lespinasse wrote:
> > > Is there an interest in fixing this or concurrent mmaps() from the same
> > > process are too much of a corner case to worry about it?
> > 
> > Funny this comes up again. I actually have a patch series that is
> > supposed to do that:
> > [PATCH 0/9] Avoid populating unbounded num of ptes with mmap_sem held
> > 
> > However, the patches are still pending, didn't get much review
> > (probably not enough for Andrew to take them at this point), and I
> > think everyone forgot about them during the winter break.
> > 
> > Care to have a look at that thread and see if it works for you ?
> > 
> > (caveat: you will possibly also need "[PATCH 10/9] mm: make
> > do_mmap_pgoff return populate as a size in bytes, not as a bool" to
> > make the series actually work for you)
> 
> I applied the patches on top of 3.7.1. Here're the results for 4 threads
> concurrently mmap()-ing 10 64MB buffers in a loop without munmap()-s.
> The data is from a Nehalem i7-920 single-socket 4-core CPU. I've also
> added the older data I have for the 3.6.11 (patched and not) for
> reference.
> 
> 3.6.11 vanilla, do not populate: 0.001 seconds
> 3.6.11 vanilla, populate via a loop: 0.216 seconds
> 3.6.11 vanilla, populate via MAP_POPULATE: 0.358 seconds 
> 
> 3.6.11 + crude patch, do not populate: 0.002 seconds
> 3.6.11 + crude patch, populate via loop: 0.215 seconds
> 3.6.11 + crude patch, populate via MAP_POPULATE: 0.217 seconds
> 
> 3.7.1 vanilla, do not populate: 0.001 seconds
> 3.7.1 vanilla, populate via a loop: 0.216 seconds
> 3.7.1 vanilla, populate via MAP_POPULATE: 0.411 seconds
> 
> 3.7.1 + patch series, do not populate: 0.001 seconds
> 3.7.1 + patch series, populate via loop: 0.216 seconds
> 3.7.1 + patch series, populate via MAP_POPULATE: 0.273 seconds
> 
> So, the patch series mentioned above do improve performance but as far
> as I can read the benchmarking data there's still some performance left
> on the table.

Interesting. I expect you are using anon memory, so it's likely that
mm_populate() holds the mmap_sem read side for the entire duration of
the 64MB populate.

Just curious, does the following help ?

diff --git a/mm/memory.c b/mm/memory.c
index e4ab66b94bb8..f65a4b3b2141 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1627,6 +1627,12 @@ static inline int stack_guard_page(struct vm_area_struct 
*vma, unsigned long add
   stack_guard_page_end(vma, addr+PAGE_SIZE);
 }
 
+/* not upstreamable as is, just for the sake of testing */
+static inline int rwsem_is_contended(struct rw_semaphore *sem)
+{
+   return (sem->count < 0);
+}
+
 /**
  * __get_user_pages() - pin user pages in memory
  * @tsk:   task_struct of target task
@@ -1854,6 +1860,11 @@ next_page:
i++;
start += PAGE_SIZE;
nr_pages--;
+   if (nonblocking && rwsem_is_contended(&mm->mmap_sem)) {
+   up_read(&mm->mmap_sem);
+   *nonblocking = 0;
+   return i;
+   }
} while (nr_pages && start < vma->vm_end);
} while (nr_pages);
return i;

Linus didn't like rwsem_is_contended() when I implemented the mlock
side of this a couple years ago, but maybe we can change his mind now.

If this doesn't help, could you please send me your test case ? I
think you described enough of it that I would be able to reproduce it
given some time, but it's just easier if you send me a short C file :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] drm/i915: Treat crtc->mode.clock == 0 as disabled

2013-01-04 Thread Chris Wilson
Prevent a divide-by-zero by consistently treating an 'active' CRTC
without a mode set as actually disabled.
---
 drivers/gpu/drm/i915/intel_pm.c |   22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index e6f54ff..c929a4e 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -44,6 +44,11 @@
  * i915.i915_enable_fbc parameter
  */
 
+static bool intel_crtc_active(struct drm_crtc *crtc)
+{
+   return to_intel_crtc(crtc)->active && crtc->fb && crtc->mode.clock;
+}
+
 static void i8xx_disable_fbc(struct drm_device *dev)
 {
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -405,9 +410,8 @@ void intel_update_fbc(struct drm_device *dev)
 *   - going to an unsupported config (interlace, pixel multiply, etc.)
 */
list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) {
-   if (to_intel_crtc(tmp_crtc)->active &&
-   !to_intel_crtc(tmp_crtc)->primary_disabled &&
-   tmp_crtc->fb) {
+   if (intel_crtc_active(tmp_crtc) &&
+   !to_intel_crtc(tmp_crtc)->primary_disabled) {
if (crtc) {
DRM_DEBUG_KMS("more than one pipe active, 
disabling compression\n");
dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES;
@@ -992,7 +996,7 @@ static struct drm_crtc *single_enabled_crtc(struct 
drm_device *dev)
struct drm_crtc *crtc, *enabled = NULL;
 
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-   if (to_intel_crtc(crtc)->active && crtc->fb) {
+   if (intel_crtc_active(crtc)) {
if (enabled)
return NULL;
enabled = crtc;
@@ -1086,7 +1090,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
int entries, tlb_miss;
 
crtc = intel_get_crtc_for_plane(dev, plane);
-   if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
+   if (!intel_crtc_active(crtc)) {
*cursor_wm = cursor->guard_size;
*plane_wm = display->guard_size;
return false;
@@ -1215,7 +1219,7 @@ static bool vlv_compute_drain_latency(struct drm_device 
*dev,
int entries;
 
crtc = intel_get_crtc_for_plane(dev, plane);
-   if (crtc->fb == NULL || !to_intel_crtc(crtc)->active)
+   if (!intel_crtc_active(crtc))
return false;
 
clock = crtc->mode.clock;   /* VESA DOT Clock */
@@ -1476,7 +1480,7 @@ static void i9xx_update_wm(struct drm_device *dev)
 
fifo_size = dev_priv->display.get_fifo_size(dev, 0);
crtc = intel_get_crtc_for_plane(dev, 0);
-   if (to_intel_crtc(crtc)->active && crtc->fb) {
+   if (intel_crtc_active(crtc)) {
int cpp = crtc->fb->bits_per_pixel / 8;
if (IS_GEN2(dev))
cpp = 4;
@@ -1490,7 +1494,7 @@ static void i9xx_update_wm(struct drm_device *dev)
 
fifo_size = dev_priv->display.get_fifo_size(dev, 1);
crtc = intel_get_crtc_for_plane(dev, 1);
-   if (to_intel_crtc(crtc)->active && crtc->fb) {
+   if (intel_crtc_active(crtc)) {
int cpp = crtc->fb->bits_per_pixel / 8;
if (IS_GEN2(dev))
cpp = 4;
@@ -2044,7 +2048,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int 
plane,
int entries, tlb_miss;
 
crtc = intel_get_crtc_for_plane(dev, plane);
-   if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
+   if (!intel_crtc_active(crtc)) {
*sprite_wm = display->guard_size;
return false;
}
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] Revert "nohz: Fix idle ticks in cpu summary line of /proc/stat" (commit 7386cdbf2f57ea8cff3c9fde93f206e58b9fe13f).

2013-01-04 Thread Sergei Shtylyov

Hello.

On 04-01-2013 6:58, Srivatsa Vaddagiri wrote:


With offline cpus no longer beeing seen in nohz mode (ts->idle_active=0), we
don't need the check for cpu_online() introduced in commit 7386cdbf. Offline


   Please also specify the summary of that commit in parens (or however you 
like).



cpu's idle time as last recorded in its ts->idle_sleeptime will be reported
(thus excluding its offline time as part of idle time statistics).



Cc: mho...@suse.cz
Cc: srivatsa.b...@linux.vnet.ibm.com
Signed-off-by: Srivatsa Vaddagiri 


WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 22/44] metag: Time keeping

2013-01-04 Thread James Hogan
On 04/01/13 10:05, Vineet Gupta wrote:
> Hi James,
> 
> On Wednesday 05 December 2012 09:38 PM, James Hogan wrote:
> 
>> +static unsigned int hwtimer_freq = HARDWARE_FREQ;
>> +static DEFINE_PER_CPU(struct clock_event_device, local_clockevent);
>> +static DEFINE_PER_CPU(char [11], local_clockevent_name);
> 
>> +void __cpuinit local_timer_setup(unsigned int cpu)
>> +{
>> +unsigned int txdivtime;
>> +struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
>> +char *name = per_cpu(local_clockevent_name, cpu);
>> +
>> +txdivtime = TBI_GETREG(TXDIVTIME);
>> +
>> +txdivtime &= ~TXDIVTIME_DIV_BITS;
>> +txdivtime |= (HARDWARE_DIV & TXDIVTIME_DIV_BITS);
>> +
>> +TBI_SETREG(TXDIVTIME, txdivtime);
>> +
>> +sprintf(name, "META %d", cpu);
>> +clk->name = name;
>> +clk->features = CLOCK_EVT_FEAT_ONESHOT,
>> +
>> +clk->rating = 200,
>> +clk->shift = 12,
>> +clk->irq = TBID_SIGNUM_TRT,
>> +clk->set_mode = metag_timer_set_mode,
>> +clk->set_next_event = metag_timer_set_next_event,
>> +
>> +clk->mult = div_sc(hwtimer_freq, NSEC_PER_SEC, clk->shift);
>> +clk->max_delta_ns = clockevent_delta2ns(0x7fff, clk);
>> +clk->min_delta_ns = clockevent_delta2ns(0xf, clk);
>> +clk->cpumask = cpumask_of(cpu);
>> +
>> +clockevents_register_device(clk);
>> +
>> +/*
>> + * For all non-boot CPUs we need to synchronize our free
>> + * running clock (TXTIMER) with the boot CPU's clock.
>> + *
>> + * While this won't be accurate, it should be close enough.
>> + */
>> +if (cpu) {
>> +unsigned int thread0 = cpu_2_hwthread_id[0];
>> +unsigned long val;
>> +
>> +val = core_reg_read(TXUCT_ID, TXTIMER_REGNUM, thread0);
>> +
>> +asm volatile("MOV TXTIMER, %0\n" : : "r" (val));
>> +}
>> +}
>> +
>> +void __init time_init(void)
>> +{
>> +/*
>> + * On Meta 2 SoCs, the actual frequency of the timer is based on the
>> + * Meta core clock speed divided by an integer, so it is only
>> + * approximately 1MHz. Calculating the real frequency here drastically
>> + * reduces clock skew on these SoCs.
>> + */
>> +#ifdef CONFIG_METAG_META21
>> +hwtimer_freq = get_coreclock() / (metag_in32(EXPAND_TIMER_DIV) + 1);
>> +#endif
>> +clocksource_register_hz(&clocksource_metag, hwtimer_freq);
>> +
>> +setup_irq(TBID_SIGNUM_TRT, &metag_timer_irq);
>> +
>> +local_timer_setup(smp_processor_id());
>> +}
> 
> I have a kludge in ARC port in this subsystem - which I hope you could help 
> clear.
> 
> ARC also has a local timer device used for clockevent on each CPU. A one-time
> setup_irq() with IRQF_PERCPU - would indeed setup the generic IRQ subsystem - 
> for
> making registration effective for all CPUs. However don't you need some 
> per-cpu
> magic - say enabling the IRQ at cpu or embedded interrupt controller level -
> assuming you starts off with all IRQs disabled (which ARC Linux does).

Hi Vineet,

For Meta this is done in secondary_start_kernel in
arch/metag/kernel/smp.c (see
https://github.com/jahogan/metag-linux/blob/metag-core/arch/metag/kernel/smp.c#L276).
It uses tbi_startup_interrupt which is also called by the irq_startup
callback for the root irq_chip.

> So we end up using different APIs - request_percpu_irq() as equivalent of
> setup_irq() on boot-cpu only and then each CPU calling enable_percpu_irq() to 
> do
> the local magic. request_percpu_irq() in turn requires an apriori call to
> irq_set_percpu_devid().

For Meta we could probably do something similar if we moved it's root
irq_startup irq_chip callback code into irq_enable or irq_unmask.

Cheers
James

> 
> https://lkml.org/lkml/2012/11/7/128
> 
> Do don't seem to be requiring all of this hence I'm wondering how it works 
> for you!
> 
> -Vineet
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 2/2] ASoC: Davinci: machine: Add device tree binding

2013-01-04 Thread Mark Brown
On Fri, Jan 04, 2013 at 03:24:37PM +0530, Hebbar Gururaja wrote:

> + "MIC3L","Mic Bias 2V",
> + "MIC3R","Mic Bias 2V",
> + "Mic Bias 2V",  "Mic Jack",

The CODEC driver biases should be changed over to be supplies, this
makes the above much more natural - the routing there is a hack for
older versions of ASoc.  Otherwise this looks fine.


signature.asc
Description: Digital signature


[PATCH] pnfs: Increase the refcount when LAYOUTGET fails the first time

2013-01-04 Thread ycnian
From: Yanchuan Nian 

The layout will be set unusable if LAYOUTGET fails. Is it reasonable to
increase the refcount iff LAYOUTGET fails the first time?

Signed-off-by: Yanchuan Nian 
---
 fs/nfs/pnfs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e7165d9..d00260b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -254,7 +254,7 @@ static void
 pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit)
 {
lo->plh_retry_timestamp = jiffies;
-   if (test_and_set_bit(fail_bit, &lo->plh_flags))
+   if (!test_and_set_bit(fail_bit, &lo->plh_flags))
atomic_inc(&lo->plh_refcount);
 }
 
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


drm/nouveau E[ DRM] fail ttm_validate

2013-01-04 Thread Kees Bakker

Hi,

Right after I upgraded to Ubuntu quantal I started seeing these
messages:
Jan  4 12:18:12 koli kernel: [ 3705.970720] nouveau E[ DRM] fail 
ttm_validate
Jan  4 12:18:12 koli kernel: [ 3705.970726] nouveau E[ DRM] validate 
vram_list
Jan  4 12:18:12 koli kernel: [ 3705.970760] nouveau E[ DRM] validate: -12

A few times I had corrupted graphics, and I had to stop X. Restarting didn't
help and I had to reboot.

I'm running my own 3.7.1 kernel, so I also installed the 3.7.0 development 
kernel
from Ubuntu (3.7.0-7). And that kernel shows these messages too.

With the Ubuntu kernel the graphics corruption is milder. I can continue to 
work. Sometimes
I get a burst of the messages, but I have no clue how it is triggered.

Now the strange thing is that I was running my 3.7.1 kernel on Ubuntu precise
and I have never seen these messages before. What could be the case is that
xorg is doing something new and that is causing the errors.

xserver-xorg-video-nouveau
  precise 1:1.0.2-0ubuntu3
  quantal 1:0.0.16+git20111201+b5534a1-1build2

Some more details
/var/log/syslog:Jan  4 11:16:42 koli kernel: [0.00] Linux version 
3.7.0-7-generic (root@koli) (gcc version 4.7.2 (Ubuntu/Lin
/var/log/syslog:Jan  4 11:16:44 koli kernel: [   18.081288] [drm] Initialized 
drm 1.1.0 20060810
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.615246] nouveau  [  
DEVICE][:01:00.0] BOOT0  : 0x04b300b1
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.615251] nouveau  [  
DEVICE][:01:00.0] Chipset: G73 (NV4B)
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.615254] nouveau  [  
DEVICE][:01:00.0] Family : NV40
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.616802] nouveau  [   
VBIOS][:01:00.0] checking PRAMIN for image...
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.655315] nouveau  [   
VBIOS][:01:00.0] ... appears to be valid
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.655320] nouveau  [   
VBIOS][:01:00.0] using image from PRAMIN
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.655505] nouveau  [   
VBIOS][:01:00.0] BIT signature found
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.655509] nouveau  [   
VBIOS][:01:00.0] version 05.73.22.67
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.660805] nouveau  [ 
PFB][:01:00.0] RAM type: DDR2
/var/log/syslog:Jan  4 11:16:45 koli kernel: [   18.660811] nouveau  [ 
PFB][:01:00.0] RAM size: 256 MiB

--
Kees Bakker

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Oops on aoe module removal

2013-01-04 Thread Josh Boyer
On Thu, Jan 03, 2013 at 04:00:46PM -0500, Josh Boyer wrote:
> On Thu, Jan 03, 2013 at 02:50:46PM -0600, Ed Cashin wrote:
> > >>> The blk_alloc_queue has already done a bdi_init, so do not bdi_init 
> > >>> again in
> > >>> aoeblk_gdalloc.
> > >>> 
> > >>> The patch below applies to v3.5.6, with its v47 aoe driver.  On my 
> > >>> system it
> > >>> eliminates the list_del corruption messages.
> > >> 
> > >> Since the patch doesn't apply to current -git, does the problem not
> > >> exist there?
> > > 
> > > The original post is about an older kernel with the v47 aoe driver.  The 
> > > current mainline has a v81 aoe driver, so the patch for v3.5.6 isn't 
> > > expected to apply to the mainline.
> > > 
> > > I'm currently investigating the state of the mainline with relation to 
> > > this issue.
> > 
> > I don't see the extra call to bdi_init in aoe driver v81 in the mainline 
> > git tree, and
> > I don't see the symptoms under discussion, either, when performing the same 
> > test steps.
> > 
> > Kernels with aoe v47 can use the patch I just posted.
> > 
> > I'm going to go through the stable kernels and check, but I believe kernels 
> > after
> > v47 but before commit 0a41409c5180 should apply the fix in 0a41409c5180:
> > 
> >   commit 0a41409c518083133e79015092585d68915865be
> >   Author: Ed Cashin 
> >   Date:   Mon Dec 17 16:03:58 2012 -0800
> >   
> >   aoe: remove vestigial request queue allocation
> > 
> > Josh, can you confirm that the patch I posted in this thread today works 
> > for 
> > your customer?
> 
> Sure.  I'll get a test kernel built with that patch and ask them to
> test.

Dimitar confirmed in the bug that the kernel I built with the patch no
longer oopses on rmmod.  Thanks for the quick turn around!

josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 22/44] metag: Time keeping

2013-01-04 Thread Vineet Gupta
On Friday 04 January 2013 05:51 PM, James Hogan wrote:
> On 04/01/13 10:05, Vineet Gupta wrote:
>>
>> I have a kludge in ARC port in this subsystem - which I hope you could help 
>> clear.
>>
>> ARC also has a local timer device used for clockevent on each CPU. A one-time
>> setup_irq() with IRQF_PERCPU - would indeed setup the generic IRQ subsystem 
>> - for
>> making registration effective for all CPUs. However don't you need some 
>> per-cpu
>> magic - say enabling the IRQ at cpu or embedded interrupt controller level -
>> assuming you starts off with all IRQs disabled (which ARC Linux does).
> Hi Vineet,
>
> For Meta this is done in secondary_start_kernel in
> arch/metag/kernel/smp.c (see
> https://github.com/jahogan/metag-linux/blob/metag-core/arch/metag/kernel/smp.c#L276).
> It uses tbi_startup_interrupt which is also called by the irq_startup
> callback for the root irq_chip.

Aha, I see. Actually even that way is not bad - although doing that in
local_timer_setup ( ) makes it much cleaner/obvious. So I can do the same and 
get
rid of the obscure request/enable API and their dependency API - and it's
workaround API  which are used in only one more arch inexactly 1 place in 
the
whole kernel.

Another question if you don't mind. In our setup we have a UART (non-standard 
ARC
specific) which is wired up to the boot CPU (only). Now if the init/rcS happens 
to
run on non-boot CPU, the setup/request_irq( ) and hence consequential low level
cpu irq unmasking will only happen on *that* cpu. Now if user were to type a
key-stroke, the interrupt will be asserted on boot-cpu, which has interrupt
masked. How is this handled.

Many thx for your quick response.
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   >