Re: [PATCH v2 1/6] random: Addition of kernel_pool

2015-04-26 Thread Herbert Xu
On Sat, Apr 25, 2015 at 05:40:41PM +0200, Stephan Mueller wrote:
>
> + if (p->entropy_count <=
> + p->poolinfo->poolfracbits / 4) {

There appears to be a "3 *" missing.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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] tty: serial: 8250_mtk: Add support for second clock

2015-04-26 Thread Sascha Hauer
The following changes since commit b787f68c36d49bb1d9236f403813641efa74a031:

  Linux 4.1-rc1 (2015-04-26 17:59:10 -0700)

are available in the git repository at:

  git://git.pengutronix.de/git/sha/linux-2.6.git tags/v4.1-mtk-uart-clk-v2

for you to fetch changes up to 02e3f747bea47f6c02dc3f52e40869ea8ce5342a:

  tty: serial: 8250_mtk: Add support for bus clock (2015-04-27 08:39:06 +0200)


This series adds support for the second clock on the Mediatek UART.
This is necessary for SoCs needing a bus clock to be enabled before
the UART can be accessed.

Changes since v1:
- keep support old binding with unnamed clk
- hopefully clarify commit message
- do not leak in if() with unnecessary braces.


Sascha Hauer (4):
  tty: serial: 8250_mtk: remove unnecessary test
  tty: serial: 8250_mtk: Use devm_clk_get
  tty: serial: 8250_mtk: use pm_runtime callbacks for enabling
  tty: serial: 8250_mtk: Add support for bus clock

 .../devicetree/bindings/serial/mtk-uart.txt|  12 ++-
 drivers/tty/serial/8250/8250_mtk.c | 104 -
 2 files changed, 70 insertions(+), 46 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] tty: serial: 8250_mtk: use pm_runtime callbacks for enabling

2015-04-26 Thread Sascha Hauer
The pm_runtime callbacks already enable and disable the device.
Use them in probe() and remove() instead of duplicating the
code. This allows us to concentrate more code for enabling/disabling
the UART in a single place.

Signed-off-by: Sascha Hauer 
---
 drivers/tty/serial/8250/8250_mtk.c | 69 --
 1 file changed, 36 insertions(+), 33 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c 
b/drivers/tty/serial/8250/8250_mtk.c
index bcfaa8dc..2f28bd0 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -115,6 +115,29 @@ mtk8250_set_termios(struct uart_port *port, struct 
ktermios *termios,
tty_termios_encode_baud_rate(termios, baud, baud);
 }
 
+static int mtk8250_runtime_suspend(struct device *dev)
+{
+   struct mtk8250_data *data = dev_get_drvdata(dev);
+
+   clk_disable_unprepare(data->uart_clk);
+
+   return 0;
+}
+
+static int mtk8250_runtime_resume(struct device *dev)
+{
+   struct mtk8250_data *data = dev_get_drvdata(dev);
+   int err;
+
+   err = clk_prepare_enable(data->uart_clk);
+   if (err) {
+   dev_warn(dev, "Can't enable clock\n");
+   return err;
+   }
+
+   return 0;
+}
+
 static void
 mtk8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)
 {
@@ -130,19 +153,12 @@ mtk8250_do_pm(struct uart_port *port, unsigned int state, 
unsigned int old)
 static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p,
   struct mtk8250_data *data)
 {
-   int err;
-
data->uart_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(data->uart_clk)) {
dev_warn(&pdev->dev, "Can't get uart clock\n");
return PTR_ERR(data->uart_clk);
}
 
-   err = clk_prepare_enable(data->uart_clk);
-   if (err) {
-   dev_warn(&pdev->dev, "Can't prepare clock\n");
-   return err;
-   }
p->uartclk = clk_get_rate(data->uart_clk);
 
return 0;
@@ -193,14 +209,18 @@ static int mtk8250_probe(struct platform_device *pdev)
writel(0x0, uart.port.membase +
(MTK_UART_RATE_FIX << uart.port.regshift));
 
-   data->line = serial8250_register_8250_port(&uart);
-   if (data->line < 0)
-   return data->line;
-
platform_set_drvdata(pdev, data);
 
-   pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
+   if (!pm_runtime_enabled(&pdev->dev)) {
+   err = mtk8250_runtime_resume(&pdev->dev);
+   if (err)
+   return err;
+   }
+
+   data->line = serial8250_register_8250_port(&uart);
+   if (data->line < 0)
+   return data->line;
 
return 0;
 }
@@ -212,10 +232,13 @@ static int mtk8250_remove(struct platform_device *pdev)
pm_runtime_get_sync(&pdev->dev);
 
serial8250_unregister_port(data->line);
-   clk_disable_unprepare(data->uart_clk);
 
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
+
+   if (!pm_runtime_status_suspended(&pdev->dev))
+   mtk8250_runtime_suspend(&pdev->dev);
+
return 0;
 }
 
@@ -239,26 +262,6 @@ static int mtk8250_resume(struct device *dev)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-#ifdef CONFIG_PM
-static int mtk8250_runtime_suspend(struct device *dev)
-{
-   struct mtk8250_data *data = dev_get_drvdata(dev);
-
-   clk_disable_unprepare(data->uart_clk);
-
-   return 0;
-}
-
-static int mtk8250_runtime_resume(struct device *dev)
-{
-   struct mtk8250_data *data = dev_get_drvdata(dev);
-
-   clk_prepare_enable(data->uart_clk);
-
-   return 0;
-}
-#endif
-
 static const struct dev_pm_ops mtk8250_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mtk8250_suspend, mtk8250_resume)
SET_RUNTIME_PM_OPS(mtk8250_runtime_suspend, mtk8250_runtime_resume,
-- 
2.1.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/


[PATCH 4/4] tty: serial: 8250_mtk: Add support for bus clock

2015-04-26 Thread Sascha Hauer
The mtk 8250 needs two clocks, one for providing the baudrate and
one that needs to be enabled for register accesses. The latter has
not been supported, this patch adds support for it. It is optional
for now since not all SoCs provide a bus clock.

Signed-off-by: Sascha Hauer 
---
 .../devicetree/bindings/serial/mtk-uart.txt| 12 --
 drivers/tty/serial/8250/8250_mtk.c | 28 ++
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/serial/mtk-uart.txt 
b/Documentation/devicetree/bindings/serial/mtk-uart.txt
index 4415226..8d63f1d 100644
--- a/Documentation/devicetree/bindings/serial/mtk-uart.txt
+++ b/Documentation/devicetree/bindings/serial/mtk-uart.txt
@@ -14,7 +14,14 @@ Required properties:
 
 - interrupts: A single interrupt specifier.
 
-- clocks: Clock driving the hardware.
+- clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
+- clock-names:
+  - "baud": The clock the baudrate is derived from
+  - "bus": The bus clock for register accesses (optional)
+
+For compatibility with older device trees an unnamed clock is used for the
+baud clock if the baudclk does not exist. Do not use this for new designs.
 
 Example:
 
@@ -22,5 +29,6 @@ Example:
compatible = "mediatek,mt6589-uart", "mediatek,mt6577-uart";
reg = <0x11006000 0x400>;
interrupts = ;
-   clocks = <&uart_clk>;
+   clocks = <&uart_clk>, <&bus_clk>;
+   clock-names = "baud", "bus";
};
diff --git a/drivers/tty/serial/8250/8250_mtk.c 
b/drivers/tty/serial/8250/8250_mtk.c
index 2f28bd0..8eb3876 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -34,6 +34,7 @@
 struct mtk8250_data {
int line;
struct clk  *uart_clk;
+   struct clk  *bus_clk;
 };
 
 static void
@@ -120,6 +121,7 @@ static int mtk8250_runtime_suspend(struct device *dev)
struct mtk8250_data *data = dev_get_drvdata(dev);
 
clk_disable_unprepare(data->uart_clk);
+   clk_disable_unprepare(data->bus_clk);
 
return 0;
 }
@@ -135,6 +137,12 @@ static int mtk8250_runtime_resume(struct device *dev)
return err;
}
 
+   err = clk_prepare_enable(data->bus_clk);
+   if (err) {
+   dev_warn(dev, "Can't enable bus clock\n");
+   return err;
+   }
+
return 0;
 }
 
@@ -153,13 +161,24 @@ mtk8250_do_pm(struct uart_port *port, unsigned int state, 
unsigned int old)
 static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p,
   struct mtk8250_data *data)
 {
-   data->uart_clk = devm_clk_get(&pdev->dev, NULL);
+   data->uart_clk = devm_clk_get(&pdev->dev, "baud");
if (IS_ERR(data->uart_clk)) {
-   dev_warn(&pdev->dev, "Can't get uart clock\n");
-   return PTR_ERR(data->uart_clk);
+   /*
+* For compatibility with older device trees try unnamed
+* clk when no baud clk can be found.
+*/
+   data->uart_clk = devm_clk_get(&pdev->dev, NULL);
+   if (IS_ERR(data->uart_clk)) {
+   dev_warn(&pdev->dev, "Can't get uart clock\n");
+   return PTR_ERR(data->uart_clk);
+   }
+
+   return 0;
}
 
-   p->uartclk = clk_get_rate(data->uart_clk);
+   data->bus_clk = devm_clk_get(&pdev->dev, "bus");
+   if (IS_ERR(data->bus_clk))
+   return PTR_ERR(data->bus_clk);
 
return 0;
 }
@@ -204,6 +223,7 @@ static int mtk8250_probe(struct platform_device *pdev)
uart.port.regshift = 2;
uart.port.private_data = data;
uart.port.set_termios = mtk8250_set_termios;
+   uart.port.uartclk = clk_get_rate(data->uart_clk);
 
/* Disable Rate Fix function */
writel(0x0, uart.port.membase +
-- 
2.1.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/


[RFC PATCH RESEND 2/4] lib/plist: Provide plist_add_head() for nodes with the same prio

2015-04-26 Thread Xunlei Pang
From: Xunlei Pang 

If there're multiple nodes with the same prio as @node, currently
plist_add() will add @node behind all of them. Now we need to add
@node before all of these nodes for SMP RT scheduler.

This patch adds a common __plist_add() for adding @node before or
after existing nodes with the same prio, then adds plist_add_head()
and plist_add_tail() inline wrapper functions for convenient uses.

Finally, change plist_add() to an inline wrapper using plist_add_tail()
which has the same behaviour as before.

Reviewed-by: Dan Streetman 
Reviewed-by: Steven Rostedt 
Signed-off-by: Xunlei Pang 
---
 include/linux/plist.h | 34 +-
 lib/plist.c   | 28 +++-
 2 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/include/linux/plist.h b/include/linux/plist.h
index 9788360..d060f28 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -138,7 +138,39 @@ static inline void plist_node_init(struct plist_node 
*node, int prio)
INIT_LIST_HEAD(&node->node_list);
 }
 
-extern void plist_add(struct plist_node *node, struct plist_head *head);
+extern void __plist_add(struct plist_node *node,
+   struct plist_head *head, bool is_head);
+
+/**
+ * plist_add_head - add @node to @head, before all existing same-prio nodes
+ *
+ * @node:  The plist_node to be added to @head
+ * @head:  The plist_head that @node is being added to
+ */
+static inline
+void plist_add_head(struct plist_node *node, struct plist_head *head)
+{
+   __plist_add(node, head, true);
+}
+
+/**
+ * plist_add_tail - add @node to @head, after all existing same-prio nodes
+ *
+ * @node:  The plist_node to be added to @head
+ * @head:  The plist_head that @node is being added to
+ */
+static inline
+void plist_add_tail(struct plist_node *node, struct plist_head *head)
+{
+   __plist_add(node, head, false);
+}
+
+static inline
+void plist_add(struct plist_node *node, struct plist_head *head)
+{
+   plist_add_tail(node, head);
+}
+
 extern void plist_del(struct plist_node *node, struct plist_head *head);
 
 extern void plist_requeue(struct plist_node *node, struct plist_head *head);
diff --git a/lib/plist.c b/lib/plist.c
index 3a30c53..c1ee2b0 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -66,12 +66,18 @@ static void plist_check_head(struct plist_head *head)
 #endif
 
 /**
- * plist_add - add @node to @head
+ * __plist_add - add @node to @head
  *
- * @node:  &struct plist_node pointer
- * @head:  &struct plist_head pointer
+ * @node:The plist_node to be added to @head
+ * @head:The plist_head that @node is being added to
+ * @is_head: True if adding to head of prio list, false otherwise
+ *
+ * For nodes of the same prio, @node will be added at the
+ * head of previously added nodes if @is_head is true, or
+ * it will be added at the tail of previously added nodes
+ * if @is_head is false.
  */
-void plist_add(struct plist_node *node, struct plist_head *head)
+void __plist_add(struct plist_node *node, struct plist_head *head, bool 
is_head)
 {
struct plist_node *first, *iter, *prev = NULL;
struct list_head *node_next = &head->node_list;
@@ -96,8 +102,20 @@ void plist_add(struct plist_node *node, struct plist_head 
*head)
struct plist_node, prio_list);
} while (iter != first);
 
-   if (!prev || prev->prio != node->prio)
+   if (!prev || prev->prio != node->prio) {
list_add_tail(&node->prio_list, &iter->prio_list);
+   } else if (is_head) {
+   /*
+* prev has the same priority as the node that is being
+* added. It is also the first node for this priority,
+* but the new node needs to be added ahead of it.
+* To accomplish this, replace prev in the prio_list
+* with node. Then set node_next to prev->node_list so
+* that the new node gets added before prev and not iter.
+*/
+   list_replace_init(&prev->prio_list, &node->prio_list);
+   node_next = &prev->node_list;
+   }
 ins_node:
list_add_tail(&node->node_list, node_next);
 
-- 
1.9.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/


[RFC PATCH RESEND 3/4] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-26 Thread Xunlei Pang
From: Xunlei Pang 

We know, there are two main queues each cpu for RT scheduler:
Let's call them "run queue" and "pushable queue" respectively.

For RT tasks, the scheduler uses "plist" to manage the pushable queue,
so when there are multiple tasks queued at the same priority, they get
queued in the strict FIFO order.

Currently, when an rt task gets queued, it is put to the head or the
tail of its "run queue" at the same priority according to different
scenarios. Then if it is migratable, it will also and always be put to
the tail of its "pushable queue" at the same priority.

For one cpu, assuming initially it has some migratable tasks queued
at the same priority as current(RT) both in "run queue" and "pushable
queue" in the same order. At some time, when current gets preempted, it
will be put behind these tasks in the "pushable queue", while it still
stays ahead of these tasks in the "run queue". Afterwards, if there comes
a pull from other cpu or a push from local cpu, the task behind current
in the "run queue" will be removed from the "pushable queue" and gets
running, as the global rt scheduler fetches tasks from the head of the
"pushable queue" to do pulling or pushing.

Obviously, to maintain the right order for the two queues, when current
is preempted(not involving re-queue in the "run queue"), we want to put it
ahead of all those tasks queued at the same priority in the "pushable queue".

So, if a task is running and gets preempted by a higher priority
task or even with same priority for migrating, this patch ensures
that it is put ahead of any existing task with the same priority in
the "pushable queue".

The handling logic used here:
 - Add a new variable named "rt_preempt"(define a new flag named
   RT_PREEMPT_QUEUEAHEAD for it) in task_struct, used by RT.
 - When doing preempted resched_curr() for current RT, set the flag.
   Create a new resched_curr_preempted_rt() for this function, and
   replace all the possible resched_curr() used for rt preemption with
   resched_curr_preempted_rt().
 - In put_prev_task_rt(), test RT_PREEMPT_QUEUEAHEAD if set, enqueue
   the task ahead in the "pushable queue" and clear the flag.

Signed-off-by: Xunlei Pang 
---
 include/linux/sched.h|  5 +++
 include/linux/sched/rt.h | 16 
 kernel/sched/core.c  |  6 ++-
 kernel/sched/rt.c| 96 ++--
 4 files changed, 110 insertions(+), 13 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f74d4cc..24e0f72 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1321,6 +1321,11 @@ struct task_struct {
const struct sched_class *sched_class;
struct sched_entity se;
struct sched_rt_entity rt;
+
+#ifdef CONFIG_SMP
+   unsigned long rt_preempt; /* Used by rt */
+#endif
+
 #ifdef CONFIG_CGROUP_SCHED
struct task_group *sched_task_group;
 #endif
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 6341f5b..69e3c82 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -15,6 +15,22 @@ static inline int rt_task(struct task_struct *p)
return rt_prio(p->prio);
 }
 
+struct rq;
+
+#ifdef CONFIG_SMP
+extern void resched_curr_preempted_rt(struct rq *rq);
+
+static inline void resched_curr_preempted(struct rq *rq)
+{
+   resched_curr_preempted_rt(rq);
+}
+#else
+static inline void resched_curr_preempted(struct rq *rq)
+{
+   rsched_curr(rq);
+}
+#endif
+
 #ifdef CONFIG_RT_MUTEXES
 extern int rt_mutex_getprio(struct task_struct *p);
 extern void rt_mutex_setprio(struct task_struct *p, int prio);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f9123a8..d13fc13 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1002,7 +1002,7 @@ void check_preempt_curr(struct rq *rq, struct task_struct 
*p, int flags)
if (class == rq->curr->sched_class)
break;
if (class == p->sched_class) {
-   resched_curr(rq);
+   resched_curr_preempted(rq);
break;
}
}
@@ -1833,6 +1833,10 @@ static void __sched_fork(unsigned long clone_flags, 
struct task_struct *p)
 
INIT_LIST_HEAD(&p->rt.run_list);
 
+#ifdef CONFIG_SMP
+   p->rt_preempt = 0;
+#endif
+
 #ifdef CONFIG_PREEMPT_NOTIFIERS
INIT_HLIST_HEAD(&p->preempt_notifiers);
 #endif
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 0c0f4df..7439121 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -254,8 +254,33 @@ int alloc_rt_sched_group(struct task_group *tg, struct 
task_group *parent)
 }
 #endif /* CONFIG_RT_GROUP_SCHED */
 
+
 #ifdef CONFIG_SMP
 
+#define RT_PREEMPT_QUEUEAHEAD1UL
+
+/*
+ * p(current) was preempted, and to be put ahead of
+ * any task with the same priority in pushable queue.
+ */
+static inline bool rt_preempted(struct task_struct *p)
+{
+   

Re: [linux-sunxi] [PATCH 2/3] spidev: Add DT binding example.

2015-04-26 Thread Michal Suchanek
On 26 April 2015 at 17:47, Maxime Ripard
 wrote:
> On Sun, Apr 26, 2015 at 04:40:50PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> I've a feeling everyone in this thread is ignoring the
>> raspberry pi use-case. Where the board is specifically
>> designed for educational purposes and used with lots of
>> peripherals which are usually programmed from userspace
>> using e.g. python bindings for i2c-dev or spidev, for
>> such a setup we really want spidev to be loaded on the
>> spibus by default and we really do not have a proper
>> compatible for a child device.
>
> I'm not sure we're ignoring it, it just is the exact same use case
> than the whole spidev use case: people want to write SPI userspace
> drivers, the rpi really is not special here, except maybe for its user
> space code base, but it really boils down to the same issue.
>
>> And no having to use per device devicetree overlays
>> for this is not the answer, this needs to be really
>> really easy. With pre device-tree kernels this just
>> works, we should be able to match that ease of use
>> with devicetree.
>
> We do agree on that. We repeatedly told that the DT was not a good
> solution, overlays or not, and this is exactly one of the reasons.
>

Ok, so how about skipping the bindings altogether.

Just instantiate a spidev for each SPI bus and each CS the SPI core
knows of once spidev is loaded.

Thanks

Michal
--
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] tty: serial: 8250_mtk: Use devm_clk_get

2015-04-26 Thread Sascha Hauer
When a struct device * is present clk_get should be used rather
than of_clk_get. Use the devm variant of this function to be able to
drop the clk_put in the error and remove pathes. While at it fix
a wrong error message.

Signed-off-by: Sascha Hauer 
---
 drivers/tty/serial/8250/8250_mtk.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c 
b/drivers/tty/serial/8250/8250_mtk.c
index 1297827..bcfaa8dc 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -131,18 +131,16 @@ static int mtk8250_probe_of(struct platform_device *pdev, 
struct uart_port *p,
   struct mtk8250_data *data)
 {
int err;
-   struct device_node *np = pdev->dev.of_node;
 
-   data->uart_clk = of_clk_get(np, 0);
+   data->uart_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(data->uart_clk)) {
-   dev_warn(&pdev->dev, "Can't get timer clock\n");
+   dev_warn(&pdev->dev, "Can't get uart clock\n");
return PTR_ERR(data->uart_clk);
}
 
err = clk_prepare_enable(data->uart_clk);
if (err) {
dev_warn(&pdev->dev, "Can't prepare clock\n");
-   clk_put(data->uart_clk);
return err;
}
p->uartclk = clk_get_rate(data->uart_clk);
@@ -215,7 +213,6 @@ static int mtk8250_remove(struct platform_device *pdev)
 
serial8250_unregister_port(data->line);
clk_disable_unprepare(data->uart_clk);
-   clk_put(data->uart_clk);
 
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
-- 
2.1.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/


[RFC PATCH RESEND 4/4] sched/rt: Requeue p back if the preemption initiated by check_preempt_equal_prio_common() failed

2015-04-26 Thread Xunlei Pang
From: Xunlei Pang 

In check_preempt_equal_prio_common(), it requeues "next" ahead
in the "run queue" and want to push current away. But when doing
the actual pushing, if the system state changes, the pushing may
fail as a result.

In this case, p finally becomes the new current and gets running,
while previous current was queued back waiting in the same "run
queue". This broke FIFO.

This patch adds a flag named RT_PREEMPT_PUSHAWAY for task_struct::
rt_preempt, sets it when doing check_preempt_equal_prio_common(),
and clears it if current is away(it will call dequeued). So we can
test this flag in p's post_schedule_rt() to judge if the pushing
has happened. If the pushing failed, requeue previous current back
to the head of its "run queue" and start a rescheduling.

Signed-off-by: Xunlei Pang 
---
 kernel/sched/rt.c | 87 ++-
 1 file changed, 79 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7439121..d1cecd6 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -258,6 +258,8 @@ int alloc_rt_sched_group(struct task_group *tg, struct 
task_group *parent)
 #ifdef CONFIG_SMP
 
 #define RT_PREEMPT_QUEUEAHEAD1UL
+#define RT_PREEMPT_PUSHAWAY  2UL
+#define RT_PREEMPT_MASK  3UL
 
 /*
  * p(current) was preempted, and to be put ahead of
@@ -273,6 +275,30 @@ static inline void clear_rt_preempted(struct task_struct 
*p)
p->rt_preempt = 0;
 }
 
+static inline struct task_struct *rt_preempting_target(struct task_struct *p)
+{
+   return (struct task_struct *) (p->rt_preempt & ~RT_PREEMPT_MASK);
+}
+
+/*
+ * p(new current) is preempting and pushing previous current away.
+ */
+static inline bool rt_preempting(struct task_struct *p)
+{
+   if ((p->rt_preempt & RT_PREEMPT_PUSHAWAY) && rt_preempting_target(p))
+   return true;
+
+   return false;
+}
+
+static inline void clear_rt_preempting(struct task_struct *p)
+{
+   if (rt_preempting(p))
+   put_task_struct(rt_preempting_target(p));
+
+   p->rt_preempt = 0;
+}
+
 void resched_curr_preempted_rt(struct rq *rq)
 {
if (rt_task(rq->curr))
@@ -375,13 +401,17 @@ static inline int has_pushable_tasks(struct rq *rq)
return !plist_head_empty(&rq->rt.pushable_tasks);
 }
 
-static inline void set_post_schedule(struct rq *rq)
+static inline void set_post_schedule(struct rq *rq, struct task_struct *p)
 {
-   /*
-* We detect this state here so that we can avoid taking the RQ
-* lock again later if there is no need to push
-*/
-   rq->post_schedule = has_pushable_tasks(rq);
+   if (rt_preempting(p))
+   /* Forced post schedule */
+   rq->post_schedule = 1;
+   else
+   /*
+* We detect this state here so that we can avoid taking
+* the RQ lock again later if there is no need to push
+*/
+   rq->post_schedule = has_pushable_tasks(rq);
 }
 
 static void
@@ -434,6 +464,15 @@ static inline void clear_rt_preempted(struct task_struct 
*p)
 {
 }
 
+static inline bool rt_preempting(struct task_struct *p)
+{
+   return false;
+}
+
+static inline void clear_rt_preempting(struct task_struct *p)
+{
+}
+
 static inline void resched_curr_preempted_rt(struct rq *rq)
 {
resched_curr(rq);
@@ -472,7 +511,7 @@ static inline int pull_rt_task(struct rq *this_rq)
return 0;
 }
 
-static inline void set_post_schedule(struct rq *rq)
+static inline void set_post_schedule(struct rq *rq, struct task_struct *p)
 {
 }
 #endif /* CONFIG_SMP */
@@ -1330,6 +1369,7 @@ static void dequeue_task_rt(struct rq *rq, struct 
task_struct *p, int flags)
dequeue_rt_entity(rt_se);
 
dequeue_pushable_task(rq, p);
+   clear_rt_preempting(p);
 }
 
 /*
@@ -1468,6 +1508,11 @@ static void check_preempt_equal_prio_common(struct rq 
*rq)
 * to try and push current away.
 */
requeue_task_rt(rq, next, 1);
+
+   get_task_struct(curr);
+   curr->rt_preempt |= RT_PREEMPT_PUSHAWAY;
+   next->rt_preempt = (unsigned long) curr;
+   next->rt_preempt |= RT_PREEMPT_PUSHAWAY;
resched_curr_preempted_rt(rq);
 }
 
@@ -1590,7 +1635,7 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev)
/* The running task is never eligible for pushing */
dequeue_pushable_task(rq, p);
 
-   set_post_schedule(rq);
+   set_post_schedule(rq, p);
 
return p;
 }
@@ -2151,6 +2196,32 @@ skip:
 static void post_schedule_rt(struct rq *rq)
 {
push_rt_tasks(rq);
+
+   if (rt_preempting(current)) {
+   struct task_struct *target;
+
+   target = rt_preempting_target(current);
+   current->rt_preempt = 0;
+   if (!(target->rt_preempt & RT_PREEMPT_PUSHAWAY))
+   goto out;
+
+   /*
+* target still has RT_PREEMPT_PUSHAWAY set which
+ 

[PATCH 1/4] tty: serial: 8250_mtk: remove unnecessary test

2015-04-26 Thread Sascha Hauer
When the driver has probed successfully the clk pointer is always valid,
so no need to test for it.

Signed-off-by: Sascha Hauer 
---
 drivers/tty/serial/8250/8250_mtk.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c 
b/drivers/tty/serial/8250/8250_mtk.c
index 7a11fac..1297827 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -214,10 +214,8 @@ static int mtk8250_remove(struct platform_device *pdev)
pm_runtime_get_sync(&pdev->dev);
 
serial8250_unregister_port(data->line);
-   if (!IS_ERR(data->uart_clk)) {
-   clk_disable_unprepare(data->uart_clk);
-   clk_put(data->uart_clk);
-   }
+   clk_disable_unprepare(data->uart_clk);
+   clk_put(data->uart_clk);
 
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
@@ -249,8 +247,7 @@ static int mtk8250_runtime_suspend(struct device *dev)
 {
struct mtk8250_data *data = dev_get_drvdata(dev);
 
-   if (!IS_ERR(data->uart_clk))
-   clk_disable_unprepare(data->uart_clk);
+   clk_disable_unprepare(data->uart_clk);
 
return 0;
 }
@@ -259,8 +256,7 @@ static int mtk8250_runtime_resume(struct device *dev)
 {
struct mtk8250_data *data = dev_get_drvdata(dev);
 
-   if (!IS_ERR(data->uart_clk))
-   clk_prepare_enable(data->uart_clk);
+   clk_prepare_enable(data->uart_clk);
 
return 0;
 }
-- 
2.1.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/


[RFC PATCH RESEND 0/4] Maintain the FIFO order for same priority RT tasks

2015-04-26 Thread Xunlei Pang
From: Xunlei Pang 

1. TWO FIFO QUEUES
We know, there are two main queues each cpu for RT SMP scheduler. Let's
name them "run queue" and "pushable queue" respectively. 

"run queue" is from the intra-cpu's perspective, while "pushable queue" is
from the inter-cpu's perspective. "pushable queue" also has a very close 
relationship with task affinity. The two queues separately maintain their
FIFO order for tasks queued at the same priority.

If we got a wrong FIFO order of any of the two queues, we say it broke FIFO.


2. THE WAY THEY WORK
Currently, when an rt task gets queued, it can be put to the head or
tail of its "run queue" at the same priority according to different
scenarios. Further if it is migratable, it will also and always be put
to the tail of its "pushable queue" at the same priority because "plist"
is used to manage this queue in strict FIFO order.

a) If a task got enqueued or dequeued, it got added to or removed from the
"run queue", and also "pushable queue"(added to tail) if it is migratable.

b) If a runnable task acquires cpu(current task), it stays in the front of
the "run queue", but got removed from the "pushable queue". 

c) If a runnable task releases cpu, it stays in the "run queue"(if it 
releases cpu involuntarily, stays just behind new current in this queue; 
if it releases cpu voluntarily like yield, usually was requeued behind 
other tasks queued at the same priority in this queue), and got added to 
the tail of its "pushable queue" at the same priority if it is migratable.

d) If a tasks's affinity is changed from one cpu to multiple cpus, it got
added to the tail of "pushable queue" at the same priority.

e) If a tasks's affinity is changed from multiple cpus to one cpu, it got
removed from the "pushable queue".


3. PROBLEMATIC CASES
Unfortunately, in current kernel implementations, as far as I know, c) 
described in "2. THE WAY THEY WORK" have some cases that broke FIFO of 
one of the two queues for tasks queued at the same priority.

- Case 1: current task gets preempted by a higher priority task
current will be enqueued behind other tasks with the same priority in the
"pushable queue", while it actually stays ahead of these tasks in the "run
queue". Afterwards, if there comes a pull from other cpu or a push from
local cpu, the task behind current in the "run queue" will be removed from
the "pushable queue" and gets running, as the global rt scheduler fetches
tasks from the head of the "pushable queue" to do the pulling or pushing.
The kernel broke FIFO in this case.

current task gets preempted by an equal priority task:
This is done in check_preempt_equal_prio(), and can be divided into 3 sub cases.
  - Case 2 : p is the only one has the same priority as current.
 p preempts current successfully, but the kernel still had the 
 same problem as in Case 1 during the preempting.
  - Case 3 : p is not the only one has the same priority as current, let's
 say q is already queued before p. so, in this case we should
 choose q to do the preempting, not p. So the kernel broke FIFO in 
 this case.
  - Case 4 : p is going to preempt current, but when doing the actual 
preempting,
 current isn't pushed away due to the change of system status. so
 eventually p becomes the new current and gets running, while 
 current is queued back waiting in the same "run queue". Obviously, 
 the kernel broke FIFO in this case.

NOTE: when a task's affinity is changed and it becomes migratable(see d) 
described 
in "2. THE WAY THEY WORK"), in current kernel implementation it will be queued 
behind other tasks with the same priority in the "pushable queue". This may 
seems 
contratry to the corresponding order in the "run queue". But from "pushable 
queue"'s 
prospective, when a task's affinity is changed and further got removed from or 
added to the "pushable queue" because of that, it means requeuing. In my view, 
I 
don't think this broke FIFO of the "pushable queue". Any discussion?

But for "case 1" and "case 2", the task eventually wasn't got removed from or 
added 
to the "pushable queue" due to affinity changing, so its "pushable queue" FIFO 
order should also stays unchanged, and must be the same as its "run queue" 
order.
So we say "case 1" and "case 2" broke FIFO of its "pushable queue".

4. SUMMARY
case 1 : broke its "pushable queue" FIFO order.
case 2 : broke its "pushable queue" FIFO order.
case 3 : broke its "run queue" FIFO order.
case 4 : broke its "run queue" FIFO order.

5. PATCHSET
Patch 1 : Fix "Case 3".
Patch 2 : Prerequisite for Patch 3 - Provide plist_add_head() for "pushable 
queue".
Patch 3 : Fix "Case 1" and "Case 2".
Patch 4 : Fix "Case 4".

Xunlei Pang (4):
  sched/rt: Modify check_preempt_equal_prio() for multiple tasks queued
at the same priority
  lib/plist: Provide plist_add_head() for nodes with the same prio
  sched/rt: Fix wrong SMP scheduler behavior 

[RFC PATCH RESEND 1/4] sched/rt: Modify check_preempt_equal_prio() for multiple tasks queued at the same priority

2015-04-26 Thread Xunlei Pang
From: Xunlei Pang 

In check_preempt_equal_prio(), when p is queued, there may be other
tasks already queued at the same priority in the "run queue", so we
should peek the most front one to do the preemption, not the p.

This patch modified it and moved the preemption job to a new function
named check_preempt_equal_prio_common() to make the logic clearer.

Signed-off-by: Xunlei Pang 
---
 kernel/sched/rt.c | 70 ++-
 1 file changed, 54 insertions(+), 16 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 575da76..0c0f4df 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1366,33 +1366,66 @@ out:
return cpu;
 }
 
-static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
+static struct task_struct *peek_next_task_rt(struct rq *rq);
+
+static void check_preempt_equal_prio_common(struct rq *rq)
 {
+   struct task_struct *curr = rq->curr;
+   struct task_struct *next;
+
+   /* Current can't be migrated, useless to reschedule */
+   if (curr->nr_cpus_allowed == 1 ||
+   !cpupri_find(&rq->rd->cpupri, curr, NULL))
+   return;
+
/*
-* Current can't be migrated, useless to reschedule,
-* let's hope p can move out.
+* Can we find any task with the same priority as
+* curr? To accomplish this, firstly requeue curr
+* to the tail, then peek next, finally put curr
+* back to the head if a different task was peeked.
 */
-   if (rq->curr->nr_cpus_allowed == 1 ||
-   !cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
+   requeue_task_rt(rq, curr, 0);
+   next = peek_next_task_rt(rq);
+   if (next == curr)
+   return;
+
+   requeue_task_rt(rq, curr, 1);
+
+   if (next->prio != curr->prio)
return;
 
/*
-* p is migratable, so let's not schedule it and
-* see if it is pushed or pulled somewhere else.
+* Got the right "next" queued with the same priority
+* as current. If next is migratable, don't schedule
+* it as it will be pushed or pulled somewhere else.
 */
-   if (p->nr_cpus_allowed != 1
-   && cpupri_find(&rq->rd->cpupri, p, NULL))
+   if (next->nr_cpus_allowed != 1 &&
+   cpupri_find(&rq->rd->cpupri, next, NULL))
return;
 
/*
 * There appears to be other cpus that can accept
-* current and none to run 'p', so lets reschedule
-* to try and push current away:
+* current and none to run next, so lets reschedule
+* to try and push current away.
 */
-   requeue_task_rt(rq, p, 1);
+   requeue_task_rt(rq, next, 1);
resched_curr(rq);
 }
 
+static inline
+void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
+{
+   /*
+* p is migratable, so let's not schedule it and
+* see if it is pushed or pulled somewhere else.
+*/
+   if (p->nr_cpus_allowed != 1 &&
+   cpupri_find(&rq->rd->cpupri, p, NULL))
+   return;
+
+   check_preempt_equal_prio_common(rq);
+}
+
 #endif /* CONFIG_SMP */
 
 /*
@@ -1440,10 +1473,9 @@ static struct sched_rt_entity 
*pick_next_rt_entity(struct rq *rq,
return next;
 }
 
-static struct task_struct *_pick_next_task_rt(struct rq *rq)
+static struct task_struct *peek_next_task_rt(struct rq *rq)
 {
struct sched_rt_entity *rt_se;
-   struct task_struct *p;
struct rt_rq *rt_rq  = &rq->rt;
 
do {
@@ -1452,9 +1484,15 @@ static struct task_struct *_pick_next_task_rt(struct rq 
*rq)
rt_rq = group_rt_rq(rt_se);
} while (rt_rq);
 
-   p = rt_task_of(rt_se);
-   p->se.exec_start = rq_clock_task(rq);
+   return rt_task_of(rt_se);
+}
 
+static inline struct task_struct *_pick_next_task_rt(struct rq *rq)
+{
+   struct task_struct *p;
+
+   p = peek_next_task_rt(rq);
+   p->se.exec_start = rq_clock_task(rq);
return p;
 }
 
-- 
1.9.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 0/2] powerpc/kvm: Enable running guests on RT Linux

2015-04-26 Thread Purcareata Bogdan

On 24.04.2015 00:26, Scott Wood wrote:

On Thu, 2015-04-23 at 15:31 +0300, Purcareata Bogdan wrote:

On 23.04.2015 03:30, Scott Wood wrote:

On Wed, 2015-04-22 at 15:06 +0300, Purcareata Bogdan wrote:

On 21.04.2015 03:52, Scott Wood wrote:

On Mon, 2015-04-20 at 13:53 +0300, Purcareata Bogdan wrote:

There was a weird situation for .kvmppc_mpic_set_epr - its corresponding inner
function is kvmppc_set_epr, which is a static inline. Removing the static inline
yields a compiler crash (Segmentation fault (core dumped) -
scripts/Makefile.build:441: recipe for target 'arch/powerpc/kvm/kvm.o' failed),
but that's a different story, so I just let it be for now. Point is the time may
include other work after the lock has been released, but before the function
actually returned. I noticed this was the case for .kvm_set_msi, which could
work up to 90 ms, not actually under the lock. This made me change what I'm
looking at.


kvm_set_msi does pretty much nothing outside the lock -- I suspect
you're measuring an interrupt that happened as soon as the lock was
released.


That's exactly right. I've seen things like a timer interrupt occuring right
after the spinlock_irqrestore, but before kvm_set_msi actually returned.

[...]


Or perhaps a different stress scenario involving a lot of VCPUs
and external interrupts?


You could instrument the MPIC code to find out how many loop iterations
you maxed out on, and compare that to the theoretical maximum.


Numbers are pretty low, and I'll try to explain based on my observations.

The problematic section in openpic_update_irq is this [1], since it loops
through all VCPUs, and IRQ_local_pipe further calls IRQ_check, which loops
through all pending interrupts for a VCPU [2].

The guest interfaces are virtio-vhostnet, which are based on MSI
(/proc/interrupts in guest shows they are MSI). For external interrupts to the
guest, the irq_source destmask is currently 0, and last_cpu is 0 (unitialized),
so [1] will go on and deliver the interrupt directly and unicast (no VCPUs 
loop).

I activated the pr_debugs in arch/powerpc/kvm/mpic.c, to see how many interrupts
are actually pending for the destination VCPU. At most, there were 3 interrupts
- n_IRQ = {224,225,226} - even for 24 flows of ping flood. I understand that
guest virtio interrupts are cascaded over 1 or a couple of shared MSI 
interrupts.

So worst case, in this scenario, was checking the priorities for 3 pending
interrupts for 1 VCPU. Something like this (some of my prints included):

[61010.582033] openpic_update_irq: destmask 1 last_cpu 0
[61010.582034] openpic_update_irq: Only one CPU is allowed to receive this IRQ
[61010.582036] IRQ_local_pipe: IRQ 224 active 0 was 1
[61010.582037] IRQ_check: irq 226 set ivpr_pr=8 pr=-1
[61010.582038] IRQ_check: irq 225 set ivpr_pr=8 pr=-1
[61010.582039] IRQ_check: irq 224 set ivpr_pr=8 pr=-1

It would be really helpful to get your comments regarding whether these are
realistical number for everyday use, or they are relevant only to this
particular scenario.


RT isn't about "realistic numbers for everyday use".  It's about worst
cases.


- Can these interrupts be used in directed delivery, so that the destination
mask can include multiple VCPUs?


The Freescale MPIC does not support multiple destinations for most
interrupts, but the (non-FSL-specific) emulation code appears to allow
it.


   The MPIC manual states that timer and IPI
interrupts are supported for directed delivery, altough I'm not sure how much of
this is used in the emulation. I know that kvmppc uses the decrementer outside
of the MPIC.

- How are virtio interrupts cascaded over the shared MSI interrupts?
/proc/device-tree/soc@e000/msi@41600/interrupts in the guest shows 8 values
- 224 - 231 - so at most there might be 8 pending interrupts in IRQ_check, is
that correct?


It looks like that's currently the case, but actual hardware supports
more than that, so it's possible (albeit unlikely any time soon) that
the emulation eventually does as well.

But it's possible to have interrupts other than MSIs...


Right.

So given that the raw spinlock conversion is not suitable for all the scenarios
supported by the OpenPIC emulation, is it ok that my next step would be to send
a patch containing both the raw spinlock conversion and a mandatory disable of
the in-kernel MPIC? This is actually the last conclusion we came up with some
time ago, but I guess it was good to get some more insight on how things
actually work (at least for me).


Fine with me.  Have you given any thought to ways to restructure the
code to eliminate the problem?


My first thought would be to create a separate lock for each VCPU pending 
interrupts queue, so that we make the whole openpic_irq_update more granular. 
However, this is just a very preliminary thought. Before I can come up with 
anything worthy of consideration, I must read the OpenPIC specification and the 
current KVM emulated OpenPIC implementation thoroughly. I currently have ot

Re: ARM: Remove mach-msm: some leftovers

2015-04-26 Thread Valentin Rothberg
Hi Stephen,

this is just a kind reminder that the issue below is still present and
made its way to v4.1-rc1.  Any news from the maintainers' side?

Kind regards,
 Valentin

On Wed, Apr 8, 2015 at 12:57 AM, Stephen Boyd  wrote:
> On 04/07/15 07:12, Valentin Rothberg wrote:
>> On Tue, Apr 7, 2015 at 4:07 PM, Valentin Rothberg
>>  wrote:
>>> Hi Stephen,
>>>
>>> your commit c0c89fafa289 ("ARM: Remove mach-msm and associated ARM
>>> architecture code") removes config ARCH_MSM from Kconfig but leaves a
>>> few references untouched:
>>>
>>> arch/arm/Kconfig.debug:1563:default "debug/uncompress.h" if
>>> ARCH_MULTIPLATFORM || ARCH_MSM || \
>>> drivers/phy/Kconfig:289:depends on OF && ARCH_MSM
>>> drivers/scsi/ufs/Kconfig:76:depends on SCSI_UFSHCD_PLATFORM && ARCH_MSM
>>> drivers/video/fbdev/Kconfig:2331:   depends on FB && ARCH_MSM
>>>
>>> Is there a reason to keep those leftovers or is it an accident?
>>>
>>> I detected this issues with ./scripts/checkkconfigsymbols.py by
>>> comparing today's and the previous linux-next tree (--diff
>>> commit1..commit2).
>>>
>>> Kind regards,
>>>  Valentin
>> Same issue applies to the Kconfig option MSM_SMD:
>>
>> drivers/char/Kconfig:596:   depends on MSM_SMD
>> drivers/tty/serial/Kconfig:1384:depends on MSM_SMD
>
> I'm currently waiting on the maintainers of said subsystems to apply the
> patches that I've already sent to the list. I can resend the series
> minus the patches that have already been picked up, but I can't do much
> more than that.
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
--
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] Staging: vt6655: Checkpatch fix: c99 comment headings

2015-04-26 Thread Derek Robson
This patch fixes some of the following checkpatch.pl errors in mib.h
ERROR: do not use C99 // comments

This patch reformats all single line c99 style comments to the
preferred style.

Signed-off-by: Derek Robson 
---
 drivers/staging/vt6655/mib.h | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h
index 5cb59b8..6edf8fb 100644
--- a/drivers/staging/vt6655/mib.h
+++ b/drivers/staging/vt6655/mib.h
@@ -31,9 +31,7 @@

 #include "desc.h"

-//
-// 802.11 counter
-//
+/* 802.11 counter */

 typedef struct tagSDot11Counters {
unsigned long long   RTSSuccessCount;
@@ -42,9 +40,9 @@ typedef struct tagSDot11Counters {
unsigned long long   FCSErrorCount;
 } SDot11Counters, *PSDot11Counters;

-//
-// Custom counter
-//
+
+/* Custom counter */
+
 typedef struct tagSISRCounters {
unsigned long dwIsrTx0OK;
unsigned long dwIsrAC0TxOK;
@@ -64,9 +62,7 @@ typedef struct tagSISRCounters {
unsigned long dwIsrSTIMER1Int;
 } SISRCounters, *PSISRCounters;

-//
-// statistic counter
-//
+/* statistic counter */
 typedef struct tagSStatCounter {
SISRCounters ISRStat;
 } SStatCounter, *PSStatCounter;
@@ -79,4 +75,4 @@ void STAvUpdate802_11Counter(
unsigned long dwCounter
 );

-#endif // __MIB_H__
+#endif /* __MIB_H__ */
--
2.3.6

--
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] ARM: sunxi: dts: Add A10 uarts pin muxing options

2015-04-26 Thread Richard Genoud
2015-04-26 18:11 GMT+02:00 Maxime Ripard :
> Hi Richard,
>
> On Sun, Apr 26, 2015 at 12:15:38PM +0200, Richard Genoud wrote:
>> The A10 has 8 uarts, only uart0 and uart1 where filled.
>> This patch adds all the missing uarts(2 to 7) pin muxing to the dtsi.
>>
>> Signed-off-by: Richard Genoud 
>
> It's obviously correct, but I'd rather not add new pinctrl nodes that
> don't have any users so that it doesn't bloat the DT without any
> particular reason.
>
> Feel free to resubmit this patch if one of these nodes become actually
> useful.

Ok, I'll resend-it with only the uarts accessible via the cubieboard
A10 expansion headers.
--
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] perf tools: Add a option 'all' to perf-config.

2015-04-26 Thread Taeung Song
A option 'all' is to display both current config variables and
all possible config variables with default values.
The syntax examples are like below

perf config [options]

display all perf config with default values.
# perf config
or
# perf config -a | --all

Signed-off-by: Taeung Song 
---
 tools/perf/Documentation/perf-config.txt |  6 +++
 tools/perf/builtin-config.c  | 49 
 tools/perf/util/PERFCONFIG-DEFAULT   | 65 
 tools/perf/util/cache.h  |  1 +
 tools/perf/util/config.c |  2 +-
 5 files changed, 122 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/util/PERFCONFIG-DEFAULT

diff --git a/tools/perf/Documentation/perf-config.txt 
b/tools/perf/Documentation/perf-config.txt
index b2b3321..1c9027e 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -11,6 +11,8 @@ SYNOPSIS
 'perf config' [section.subkey[=value] ...]
 or
 'perf config' -l | --list
+or
+'perf config' -a | --all
 
 DESCRIPTION
 ---
@@ -23,6 +25,10 @@ OPTIONS
 --list::
Show current config variables with key and value into each sections.
 
+-a::
+--all::
+   Show current and all possible config variables with default values.
+
 CONFIGURATION FILE
 --
 
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 99292f6..a67aea3 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -17,6 +17,7 @@ static struct {
bool list_action;
bool get_action;
bool set_action;
+   bool all_action;
 } params;
 
 struct list_head *sections;
@@ -28,6 +29,8 @@ static const char * const config_usage[] = {
 static const struct option config_options[] = {
OPT_GROUP("Action"),
OPT_BOOLEAN('l', "list", ¶ms.list_action, "show current config 
variables"),
+   OPT_BOOLEAN('a', "all", ¶ms.all_action,
+   "show current and all possible config variables with 
default values"),
OPT_END()
 };
 
@@ -204,6 +207,49 @@ static int collect_config(const char *var, const char 
*value,
return add_config_element(§ion_node->element_head, subkey, value);
 }
 
+static int merge_config(const char *var, const char *value,
+   void *cb __maybe_unused)
+{
+   const char *section_name, *subkey;
+   parse_key(var, §ion_name, &subkey);
+   return set_config(section_name, subkey, value);
+}
+
+static int show_all_config(void)
+{
+   int ret = 0;
+   struct config_section *section_node;
+   struct config_element *element_node;
+   char *pwd, *all_config;
+
+   pwd = getenv("PWD");
+   all_config = strdup(mkpath("%s/util/PERFCONFIG-DEFAULT", pwd));
+
+   if (!all_config) {
+   pr_err("%s: strdup failed\n", __func__);
+   return -1;
+   }
+
+   sections = zalloc(sizeof(*sections));
+   if (!sections)
+   return -1;
+   INIT_LIST_HEAD(sections);
+
+   ret += perf_config_from_file(collect_config, all_config, NULL);
+   ret += perf_config(merge_config, NULL);
+
+   list_for_each_entry(section_node, sections, list) {
+   list_for_each_entry(element_node, §ion_node->element_head, 
list) {
+   if (element_node->value)
+   printf("%s.%s = %s\n", section_node->name,
+  element_node->subkey, 
element_node->value);
+   else
+   printf("%s.%s =\n", section_node->name, 
element_node->subkey);
+   }
+   }
+   return ret;
+}
+
 static int perf_configset_with_option(configset_fn_t fn, const char *var)
 {
int i, num_dot = 0, num_equals = 0;
@@ -301,6 +347,7 @@ int cmd_config(int argc, const char **argv, const char 
*prefix __maybe_unused)
if (!is_option && argc >= 0) {
switch (argc) {
case 0:
+   params.all_action = true;
break;
default:
for (i = 0; argv[i]; i++) {
@@ -318,6 +365,8 @@ int cmd_config(int argc, const char **argv, const char 
*prefix __maybe_unused)
 
if (params.list_action && argc == 0)
ret = perf_config(show_config, NULL);
+   else if (params.all_action && argc == 0)
+   ret = show_all_config();
else {
pr_warning("Error: Unknown argument.\n");
usage_with_options(config_usage, config_options);
diff --git a/tools/perf/util/PERFCONFIG-DEFAULT 
b/tools/perf/util/PERFCONFIG-DEFAULT
new file mode 100644
index 000..ddb67db
--- /dev/null
+++ b/tools/perf/util/PERFCONFIG-DEFAULT
@@ -0,0 +1,65 @@
+[colors]
+   top = red, default
+   medium = green, default
+   normal = lightgray, default
+   selected = white, lightgray
+   code = blue, default
+   addr =

[PATCH 2/4] perf tools: Add functions which can get or set perf config variables.

2015-04-26 Thread Taeung Song
This patch consists of functions
which can get, set specific config variables.
For the syntax examples,

   perf config [options] [section.subkey[=value] ...]

   display key-value pairs of specific config variables
   # perf config report.queue-size report.children

   set specific config variables
   # perf config report.queue-size=100M report.children=true

Signed-off-by: Taeung Song 
---
 tools/perf/Documentation/perf-config.txt |   2 +
 tools/perf/builtin-config.c  | 276 ++-
 tools/perf/util/cache.h  |  17 ++
 tools/perf/util/config.c |  30 +++-
 4 files changed, 320 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt 
b/tools/perf/Documentation/perf-config.txt
index 489c2c6..b2b3321 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -8,6 +8,8 @@ perf-config - Get and set variables in configuration file.
 SYNOPSIS
 
 [verse]
+'perf config' [section.subkey[=value] ...]
+or
 'perf config' -l | --list
 
 DESCRIPTION
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 9e4ba72..99292f6 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -15,10 +15,14 @@
 
 static struct {
bool list_action;
+   bool get_action;
+   bool set_action;
 } params;
 
+struct list_head *sections;
+
 static const char * const config_usage[] = {
-   "perf config [options]",
+   "perf config [options] [section.subkey[=value] ...]",
NULL
 };
 static const struct option config_options[] = {
@@ -27,6 +31,74 @@ static const struct option config_options[] = {
OPT_END()
 };
 
+static struct config_section *find_config_section(const char *section_name)
+{
+   struct config_section *section_node;
+   list_for_each_entry(section_node, sections, list)
+   if (!strcmp(section_node->name, section_name))
+   return section_node;
+
+   return NULL;
+}
+
+static struct config_element *find_config_element(const char *subkey,
+ struct config_section 
*section_node)
+{
+   struct config_element *element_node;
+
+   list_for_each_entry(element_node, §ion_node->element_head, list)
+   if (!strcmp(element_node->subkey, subkey))
+   return element_node;
+
+   return NULL;
+}
+
+static struct config_section *init_config_section(const char *section_name)
+{
+   struct config_section *section_node;
+
+   section_node = zalloc(sizeof(*section_node));
+   if (!section_node)
+   return NULL;
+
+   INIT_LIST_HEAD(§ion_node->element_head);
+   section_node->name = strdup(section_name);
+   if (!section_node->name) {
+   pr_err("%s: strdup failed\n", __func__);
+   free(section_node);
+   return NULL;
+   }
+
+   return section_node;
+}
+
+static int add_config_element(struct list_head *head,
+ const char *subkey, const char *value)
+{
+   struct config_element *element_node;
+   element_node = zalloc(sizeof(*element_node));
+   element_node->subkey = strdup(subkey);
+   if (!element_node->subkey) {
+   pr_err("%s: strdup failed\n", __func__);
+   goto out_free;
+   }
+   if (value) {
+   element_node->value = strdup(value);
+   if (!element_node->value) {
+   pr_err("%s: strdup failed\n", __func__);
+   goto out_free;
+   }
+   } else
+   element_node->value = NULL;
+
+   list_add_tail(&element_node->list, head);
+   return 0;
+
+out_free:
+   free(element_node);
+   return -1;
+}
+
 static int show_config(const char *key, const char *value,
   void *cb __maybe_unused)
 {
@@ -38,12 +110,211 @@ static int show_config(const char *key, const char *value,
return 0;
 }
 
-int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
+static void find_config(struct config_section **section_node, struct 
config_element **element_node,
+   const char *given_section_name, const char 
*given_subkey)
+{
+   *section_node = find_config_section(given_section_name);
+
+   if (*section_node != NULL)
+   *element_node = find_config_element(given_subkey, 
*section_node);
+   else
+   *element_node = NULL;
+}
+
+static int show_spec_config(const char *section_name, const char *subkey,
+   const char *value __maybe_unused)
+{
+   struct config_section *section_node = NULL;
+   struct config_element *element_node = NULL;
+   char key[BUFSIZ];
+
+   find_config(§ion_node, &element_node, section_name, subkey);
+
+   if (section_node && element_node) {
+   scnprintf(key, sizeof(key), "%s

[PATCH 4/4] perf tools: Add a option 'remove' to perf-config.

2015-04-26 Thread Taeung Song
A option 'remove' is to remove specific config variables.
For the syntax examples,

# perf config -r | --remove [section.subkey ...]

Signed-off-by: Taeung Song 
---
 tools/perf/Documentation/perf-config.txt |  6 
 tools/perf/builtin-config.c  | 48 +++-
 2 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt 
b/tools/perf/Documentation/perf-config.txt
index 1c9027e..fb8ca74 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -13,6 +13,8 @@ or
 'perf config' -l | --list
 or
 'perf config' -a | --all
+or
+'perf config' -r | --remove [section.subkey ...]
 
 DESCRIPTION
 ---
@@ -29,6 +31,10 @@ OPTIONS
 --all::
Show current and all possible config variables with default values.
 
+-r::
+--remove::
+   Remove specific config variables.
+
 CONFIGURATION FILE
 --
 
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index a67aea3..ff49c22 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -18,6 +18,7 @@ static struct {
bool get_action;
bool set_action;
bool all_action;
+   bool remove_action;
 } params;
 
 struct list_head *sections;
@@ -31,6 +32,7 @@ static const struct option config_options[] = {
OPT_BOOLEAN('l', "list", ¶ms.list_action, "show current config 
variables"),
OPT_BOOLEAN('a', "all", ¶ms.all_action,
"show current and all possible config variables with 
default values"),
+   OPT_BOOLEAN('r', "remove", ¶ms.remove_action, "remove specific 
variables: [section.subkey ...]"),
OPT_END()
 };
 
@@ -150,19 +152,26 @@ static int set_config(const char *section_name, const 
char *subkey,
 
find_config(§ion_node, &element_node, section_name, subkey);
 
-   /* if there isn't existent section, add a new section */
-   if (!section_node) {
-   section_node = init_config_section(section_name);
-   if (!section_node)
-   return -1;
-   list_add_tail(§ion_node->list, sections);
+   if (!value) {
+   /* value == NULL means remove the variable */
+   if (section_node && element_node)
+   element_node->value = NULL;
+   else
+   pr_err("Error: Failed to find the variable.\n");
+   } else {
+   /* if there isn't existent section, add a new section */
+   if (!section_node) {
+   section_node = init_config_section(section_name);
+   if (!section_node)
+   return -1;
+   list_add_tail(§ion_node->list, sections);
+   }
+   /* if nothing to replace, add a new element which contains 
key-value pair. */
+   if (!element_node)
+   return add_config_element(§ion_node->element_head, 
subkey, value);
+   else
+   element_node->value = (char *)value;;
}
-   /* if nothing to replace, add a new element which contains key-value 
pair. */
-   if (!element_node)
-   return add_config_element(§ion_node->element_head, subkey, 
value);
-   else
-   element_node->value = (char *)value;
-
return 0;
 }
 
@@ -367,7 +376,20 @@ int cmd_config(int argc, const char **argv, const char 
*prefix __maybe_unused)
ret = perf_config(show_config, NULL);
else if (params.all_action && argc == 0)
ret = show_all_config();
-   else {
+   else if (params.remove_action) {
+   for (i = 0; argv[i]; i++) {
+   value = strrchr(argv[i], '=');
+   if (value == NULL || value == argv[0])
+   ret = 
perf_configset_with_option(set_spec_config, argv[i]);
+   else {
+   pr_err("invalid key: %s", argv[i]);
+   return -1;
+   }
+   if (ret < 0)
+   goto out;
+   }
+   } else {
+
pr_warning("Error: Unknown argument.\n");
usage_with_options(config_usage, config_options);
}
-- 
1.9.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 1/4] perf tools: Add 'perf-config' command

2015-04-26 Thread Taeung Song
The perf configuration file contains many variables which can make
the perf command's action more effective and more skilful.
But looking through state of configuration is difficult and
there's no knowing what kind of other variables except variables in 
perfconfig.example exist.
So This patch adds 'perf-config' command with '--list' option and a document 
for it.

Signed-off-by: Taeung Song 
---
 tools/perf/Build|   1 +
 tools/perf/Documentation/perf-config.txt| 436 
 tools/perf/Documentation/perfconfig.example |  68 -
 tools/perf/builtin-config.c |  56 
 tools/perf/builtin.h|   1 +
 tools/perf/command-list.txt |   1 +
 tools/perf/perf.c   |   1 +
 7 files changed, 553 insertions(+), 11 deletions(-)
 create mode 100644 tools/perf/Documentation/perf-config.txt
 create mode 100644 tools/perf/builtin-config.c

diff --git a/tools/perf/Build b/tools/perf/Build
index b77370e..3c1f437 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -1,5 +1,6 @@
 perf-y += builtin-bench.o
 perf-y += builtin-annotate.o
+perf-y += builtin-config.o
 perf-y += builtin-diff.o
 perf-y += builtin-evlist.o
 perf-y += builtin-help.o
diff --git a/tools/perf/Documentation/perf-config.txt 
b/tools/perf/Documentation/perf-config.txt
new file mode 100644
index 000..489c2c6
--- /dev/null
+++ b/tools/perf/Documentation/perf-config.txt
@@ -0,0 +1,436 @@
+perf-config(1)
+==
+
+NAME
+
+perf-config - Get and set variables in configuration file.
+
+SYNOPSIS
+
+[verse]
+'perf config' -l | --list
+
+DESCRIPTION
+---
+You can manage variables in configuration file with this command.
+
+OPTIONS
+---
+
+-l::
+--list::
+   Show current config variables with key and value into each sections.
+
+CONFIGURATION FILE
+--
+
+The Perf configuration file contain many variables which can make
+the perf command's action more effective, more skilful.
+The '$HOME/.perfconfig' file is used to store a per-user configuration.
+The file 'etc/perfconfig' or '$(sysconfdir)/perfconfig' can be used to
+store a system-wide default configuration.
+
+The variables are divided into sections. In each sections, the variables
+can contain a key and values.
+
+Syntax
+~~
+
+The file consists of sections and subkeys. A section begins with
+the name of the section in square brackets and continues until the next
+section begins. Each variable have to belong to some section, which means
+there must be a section header before the first setting of a variable, as 
below:
+Each variable are in the form 'subkey = value'.
+
+   [section]
+   subkey1 = value1
+   subkey2 = value2
+
+Subsection names are case sensitive and can contain any characters except
+newline (doublequote `"` and backslash have to be escaped as `\"` and `\\`,
+respectively).  Section headers cannot span multiple
+lines.  Variables may belong directly to a section or to a given subsection.
+
+Example
+~~~
+
+Given a $HOME/.perfconfig like this:
+
+#
+# This is the config file, and
+# a '#' and ';' character indicates a comment
+#
+
+[colors]
+   # Color variables
+   top = red, default
+   medium = green, default
+   normal = lightgray, default
+   selected = white, lightgray
+   code = blue, default
+   addr = magenta, default
+   root = white, blue
+
+[tui]
+   # Defaults if linked with libslang
+   report = on
+   annotate = on
+   top = on
+
+[buildid]
+   # Default, disable using /dev/null
+   dir = /root/.debug
+
+[annotate]
+   # Defaults
+   hide_src_code = false
+   use_offset = true
+   jump_arrows = true
+   show_nr_jumps = false
+
+[help]
+   # Format can be man, info, web or html
+   format = man
+   autocorrect = 0
+
+[ui]
+   show-headers= true
+
+[call-graph]
+   # fp (framepointer), dwarf
+   record-mode = fp
+   print-type = graph
+   order = caller
+   sort-key = function
+
+Variables
+~
+
+colors.*::
+   Color variables can appoint colors of the output which is printed out
+   from ‘report’, ‘top’,’annotate’ on tui.
+   Color variables is composed of foreground and background
+   and should have two values for them. If you want to set as colors
+   of your terminal, you should use ‘default’ for color value.
+The kind of color which can be used as below.
+   red, green, default, black, blue, white, magenta, lightgray
+
+   colors.top::
+   ‘top’ means a overhead percentage which has more than 5%.
+   And values of it’s variable specify colors of percentage.
+   Basic key values are foreground-color ’red’ and
+   background-color ’default’.
+   colors.medium::
+   ‘medium’ means a overhead percentage which has more than 0.5%.
+   D

RE: [PATCH 1/1] Documentation: Add dt-binding for TI-btwilink driver

2015-04-26 Thread Reizer, Eyal
Hi Marcel,

> -Original Message-
> From: Marcel Holtmann [mailto:mar...@holtmann.org]
> Sent: Monday, April 27, 2015 7:32 AM
> To: Gigi Joseph
> Cc: devicet...@vger.kernel.org; Rob Herring; Pawel Moll; Mark Rutland; Ian
> Campbell; Kumar Gala; linux-kernel@vger.kernel.org; Gigi, Joseph
> Subject: Re: [PATCH 1/1] Documentation: Add dt-binding for TI-btwilink driver
> 
> Hi Gigi,
> 
> > btwilink binds bluetooth hci0 interface with the shared transport
> > driver
> >
> > Signed-off-by: Gigi Joseph 
> > ---
> > Documentation/devicetree/bindings/btwilink.txt | 15 +++
> > 1 file changed, 15 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/btwilink.txt
> >
> > diff --git a/Documentation/devicetree/bindings/btwilink.txt
> > b/Documentation/devicetree/bindings/btwilink.txt
> > new file mode 100644
> > index 000..d286aea
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/btwilink.txt
> > @@ -0,0 +1,15 @@
> > +btwilink
> > +
> > +
> > +Required properties:
> > +
> > +   - compatible : must be "ti,btwilink"
> > +
> > +Example:
> > +
> > +Enable the btwilink driver to bind the bluetooth hci0 interface with
> > +ti-st shared transport driver
> > +
> > +btwilink {
> > +   compatible = "ti,btwilink";
> > +};
> 
> actually I wonder if someone finally starts re-writing the TI-ST driver to
> integrate with the new Bluetooth subsystem features (like hdev->setup,
> __hci_cmd_sync and h4_recv_buf) so that this complicated setup is no longer
> needed.
> 
> I do not think we actually would need a shared transport at all. We should
> have a Bluetooth HCI driver that can have children for FM radio and GPS
> exposed. Exposing proper platform devices with Bluetooth HCI as parent
> makes sense. The shared transport is not really a parent. First and foremost,
> this is a Bluetooth chip. The FM radio and GPS features are just glued on top 
> of
> it.
> 

Thank you for your suggestion!
One clarification: Wilink8 is not a Bluetooth chip.
It is a combo device that includes wlan subsystem (connected over sdio) and 
bluetooth+gps connected using a single physical uart.
The shared transport abstracts this single uart to look like two separated 
devices to the system.
It was written in the past and is being used today by all the wilink family 
based products.
My suggestion is to take a two steps approach here:

1. For the short term we need it updated in upstream (right now it is broken 
since 3.8 as it is lacking support for device tree) and all customers need to 
patch it manually.
2. Once we have it updated we can look into switching from using shared 
transport to the mechanism you describe above. 
We would need to study it and make sure it can fully replace the shared 
transport driver.

Best Regards,
Eyal
--
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/4] tty: serial: 8250_mtk: Use devm_clk_get

2015-04-26 Thread Sascha Hauer
On Fri, Apr 24, 2015 at 12:53:08PM +0200, Matthias Brugger wrote:
> 2015-04-24 12:31 GMT+02:00 Sascha Hauer :
> > On Fri, Apr 24, 2015 at 12:28:33PM +0200, Matthias Brugger wrote:
> >> 2015-04-23 10:51 GMT+02:00 Sascha Hauer :
> >> > Just because of_clk_get() doesn't mean it should be used. Use 
> >> > devm_clk_get
> >> > which is the correct function when a struct device * is available. Also
> >> > since it's a devm function we can drop the calls to clk_put(). While at
> >> > it also fix a wrong debug message.
> >> >
> >> > Signed-off-by: Sascha Hauer 
> >> > ---
> >> >  drivers/tty/serial/8250/8250_mtk.c | 7 ++-
> >> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >> >
> >> > diff --git a/drivers/tty/serial/8250/8250_mtk.c 
> >> > b/drivers/tty/serial/8250/8250_mtk.c
> >> > index 7a11fac..c6901dc 100644
> >> > --- a/drivers/tty/serial/8250/8250_mtk.c
> >> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> >> > @@ -131,18 +131,16 @@ static int mtk8250_probe_of(struct platform_device 
> >> > *pdev, struct uart_port *p,
> >> >struct mtk8250_data *data)
> >> >  {
> >> > int err;
> >> > -   struct device_node *np = pdev->dev.of_node;
> >> >
> >> > -   data->uart_clk = of_clk_get(np, 0);
> >> > +   data->uart_clk = devm_clk_get(&pdev->dev, NULL);
> >> > if (IS_ERR(data->uart_clk)) {
> >> > -   dev_warn(&pdev->dev, "Can't get timer clock\n");
> >> > +   dev_warn(&pdev->dev, "Can't get uart clock\n");
> >> > return PTR_ERR(data->uart_clk);
> >> > }
> >> >
> >> > err = clk_prepare_enable(data->uart_clk);
> >> > if (err) {
> >> > dev_warn(&pdev->dev, "Can't prepare clock\n");
> >> > -   clk_put(data->uart_clk);
> >> > return err;
> >> > }
> >> > p->uartclk = clk_get_rate(data->uart_clk);
> >> > @@ -216,7 +214,6 @@ static int mtk8250_remove(struct platform_device 
> >> > *pdev)
> >> > serial8250_unregister_port(data->line);
> >> > if (!IS_ERR(data->uart_clk)) {
> >> > clk_disable_unprepare(data->uart_clk);
> >> > -   clk_put(data->uart_clk);
> >> > }
> >>
> >> Please delete the braces.
> >
> > The if() is removed completly in the next patch anyway.
> 
> You are right. I propose to merge patch 2 and 3, so you get a clean code.

Patches 1 and 2 are different topics, I see no reason merging them. I
changed the order of the two patches, maybe this makes it better
readable.

> On the way, can you have a look on the commit message? For me it is
> not clear what you want to say.

Changed to:

When a struct device * is present clk_get should be used rather
than of_clk_get. Use the devm variant of this function to be able to
drop the clk_put in the error and remove pathes. While at it fix
a wrong error message.

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 v7 2/3] leds: ktd2692: add device tree bindings for ktd2692

2015-04-26 Thread Ingi Kim
Hi Jacek,

Thanks for the review.


On 2015년 04월 24일 22:29, Jacek Anaszewski wrote:
> On Thu, 23 Apr 2015 22:18:04 +0900
> Hi Ingi,
> 
> Ingi Kim  wrote:
> 
>> This patch adds the device tree bindings for ktd2692 flash LEDs.
>> Add Optional properties of child node for Flash LED
>>
>> Signed-off-by: Ingi Kim 
>> Acked-by: Seung-Woo Kim 
>> ---
>>  .../devicetree/bindings/leds/leds-ktd2692.txt  | 47
>> ++ 1 file changed, 47 insertions(+)
>>  create mode 100644
>> Documentation/devicetree/bindings/leds/leds-ktd2692.txt
>>
>> diff --git a/Documentation/devicetree/bindings/leds/leds-ktd2692.txt
>> b/Documentation/devicetree/bindings/leds/leds-ktd2692.txt new file
>> mode 100644 index 000..708f2d4
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/leds/leds-ktd2692.txt
>> @@ -0,0 +1,47 @@
>> +* Kinetic Technologies - KTD2692 Flash LED Driver
>> +
>> +KTD2692 is the ideal power solution for high-power flash LEDs.
>> +It uses ExpressWire single-wire programming for maximum flexibility.
>> +
>> +The ExpressWire interface through CTRL pin can control LED on/off and
>> +enable/disable the IC, Movie(max 1/3 of Flash current) / Flash mode
>> current, +Flash timeout, LVP(low voltage protection).
>> +
>> +Also, When the AUX pin is pulled high while CTRL pin is high,
>> +LED current will be ramped up to the flash-mode current level.
>> +
>> +Required properties:
>> +- compatible: "kinetic,ktd2692"
>> +- ctrl-gpio : gpio pin in order control CTRL pin
>> +- aux-gpio : gpio pin in order control AUX pin
>> +
>> +Optional properties:
>> +- vin-supply : "vin" LED supply (2.7V to 5.5V)
>> +  See Documentation/devicetree/bindings/regulator/regulator.txt
>> +
>> +A discrete LED element connected to the device must be represented
>> by a child +node - see
>> Documentation/devicetree/bindings/leds/common.txt. +
>> +Required properties for flash LED child nodes:
>> +  See Documentation/devicetree/bindings/leds/common.txt
>> +- flash-max-microamp : Flash LED maximum current
>> +  Formula : I(mA) = 15000 / Rset
>> +- flash-max-timeout-us : Flash LED maximum timeout
> 
> Patch [1] makes the led-max-microamp property mandatory for
> the LEDs with configurable current for non-flash modes.
> 
> It hasn't been merged yet as we are waiting for ack from DT maintainer.
> 
> 

Ok, I'll add it.

I saw discussion about introduction of new properties for Flash LED,
I also hope that patch[1] would be merged as soon as possible :)

>> +
>> +Optional properties for flash LED child nodes:
>> +- label : see Documentation/devicetree/bindings/leds/common.txt
>> +
>> +Example:
>> +
>> +ktd2692 {
>> +compatible = "kinetic,ktd2692";
>> +ctrl-gpio = <&gpc0 1 0>;
>> +aux-gpio = <&gpc0 2 0>;
>> +vin-supply = <&vbat>;
>> +
>> +flash-led {
>> +label = "ktd2692-flash";
>> +flash-max-microamp = <150>;
>> +flash-max-timeout-us = <1835000>;
>> +};
>> +};
> 
> [1] [PATCH v6] DT: leds: Improve description of flash LEDs related
> properties
> 
--
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: ARCH_EXYNOS5433 missing in Kconfig

2015-04-26 Thread Valentin Rothberg
Hi Chanwoo,

this is a kind reminder that the issue mentioned below is still
present and made its way to v4.1-rc1.

Kind regards,
 Valentin

On Wed, Mar 11, 2015 at 2:10 AM, Chanwoo Choi  wrote:
> Hi Valentin,
>
> I sent the Exynos5433 clock patch and then separately I'm sending the
> Exynos5433 devicetree patch-set[1].
> [1] [PATCH v6 0/9] arm64: Add the support for new Exynos5433 SoC
> - https://lkml.org/lkml/2015/3/9/1036
>
> But, according to Arnd bergmann's comment[2], latest Exynos5433 dt 
> patch-set[1]
> removed the CONFIG_ARCH_EXYNOS5433.
> [2] https://lkml.org/lkml/2015/2/24/85
>
>
> So, I have plan to send following patch.
>
> ---
> clk: samsung: Use CONFIG_ARCH_EXYNOS instead of Exynos-specific 
> configuration
>
> This patch removes the CONFIG_ARCH_EXYNOS{5433|7} and then use only the
> CONFIG_ARCH_EXYNOS for ARM-64bit Exynos SoC.
>
> Cc: Sylwester Nawrocki 
> Cc: Tomasz Figa 
> Cc: Arnd Bergmann 
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/clk/samsung/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
> index 17e9af7..561719d 100644
> --- a/drivers/clk/samsung/Makefile
> +++ b/drivers/clk/samsung/Makefile
> @@ -10,11 +10,11 @@ obj-$(CONFIG_SOC_EXYNOS5250)+= clk-exynos5250.o
>  obj-$(CONFIG_SOC_EXYNOS5260)   += clk-exynos5260.o
>  obj-$(CONFIG_SOC_EXYNOS5410)   += clk-exynos5410.o
>  obj-$(CONFIG_SOC_EXYNOS5420)   += clk-exynos5420.o
> -obj-$(CONFIG_ARCH_EXYNOS5433)  += clk-exynos5433.o
> +obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos5433.o
>  obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
>  obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
>  obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-clkout.o
>
>
> Regards,
> Chanwoo Choi
>
>
> On 03/11/2015 12:32 AM, Valentin Rothberg wrote:
>> Hi Chanwoo,
>>
>> your commit 96bd6224f07b ("clk: samsung: exynos5433: Add clocks using
>> common clock framework") is included in today's linux-next tree (i.e.,
>> next-20150310).
>>
>> This patch conditionally compiles clk-exynos5433.c depending on the
>> Kconfig option ARCH_EXYNOS5433.  However, this option is not defined
>> in Kconfig, so that the driver cannot be compiled at the current
>> state:
>>
>> +obj-$(CONFIG_ARCH_EXYNOS5433)  += clk-exynos5433.o
>>
>> Is there a patch queued somewhere that adds this Kconfig symbol?  I
>> detected the issue by running undertaker-checkpatch from the
>> Undertaker tool suite (undertaker.cs.fau.de).  There is also a tool in
>> the git tree that can detect such issues (i.e.,
>> scripts/checkkconfigsymbols.py).
>>
>> Kind regards,
>>  Valentin
>>
>
--
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 v10 00/29] Refine PCI scan interfaces and make generic pci host bridge

2015-04-26 Thread Yijing Wang
On 2015/4/27 12:09, Daniel Axtens wrote:
> Hi Yijing,
> 
> I'm wondering if you might get some more momentum on these changes if
> we could split them into a few smaller patch sets. I think we might
> then be able to start getting bits of this in for 4.2, which should help
> with getting the rest of it in.

Yes, I think this is a good idea, the whole series maybe a bit heavy,
split it to several parts make it easier for folks to review and test the 
patchset.

> 
> I think there are a few things that would be easy to pull out.
> 
>   * #1 (xen/PCI: Don't use deprecated function
>  pci_scan_bus_parented()) can go directly to Xen people and should
>  be easy to merge. #2 (PCI: Remove deprecated
>  pci_scan_bus_parented()) is then an easy fixup.

I will poke Konrad to try to get some feedback.

> 
>   * I think #12 (powerpc/PCI: Rename pcibios_root_bridge_prepare() to
> pcibios_set_root_bus_speed()) could go to the PowerPC folks
> individually. I'm not sure, however, that it's worth renaming it
> and creating another function and another hook when no other arch
> uses it. If mpe and benh don't want to pick it up, it'd be pretty
> easy to take out set_root_bus_speed from the host_bridge_ops
> struct, and this way we can still advance other parts of the
> series.
> 
>   * #16 (PCI: Introduce pci_bus_child_max_busnr()) is self-contained
>  and already has a user, so that should go in easily.
> 
>   * The domain/bus numbering cleanup stuff could be broken out:
> #3  (PCI: Save domain in pci_host_bridge)
> #4  (PCI: Move pci_bus_assign_domain_nr() declaration into
> drivers/pci/pci.h)
> #8  (PCI: Introduce pci_host_assign_domain_nr() to assign domain),
> #28 (PCI: Remove platform specific pci_domain_nr())
> #29 (PCI: Remove pci_bus_assign_domain_nr())
> 

The domain number related changes could be pulled out first, in this part,
try to remove arch spec pci_domain_nr().

> 
> 
> I've done a bunch of rebasing and compiles to try to make sure all of
> these proposed divisions work and there are no dependencies that I've
> missed. It it's helpful, you can see what I've done at
> https://github.com/daxtens/linux in the YijingWang-enumer10
> branch. Feel free to use it as you wish.
> 
> I think the remaining 20 patches could probably be split again at least
> once - it looks like the bus/bus numbering stuff might be easy to split
> out? I might have a look again in a few days.

Hi Daniel, thanks very much!
I will try to reorganize these patches in two days.

Thanks!
Yijing.

> 
> Regards,
> Daniel
> 
> My final set of series, using your original patch names:
> 
> Set 1 (Xen cleanup):
>   xen/PCI: Don't use deprecated function pci_scan_bus_parented()
>   PCI: Remove deprecated pci_scan_bus_parented()
> 
> Set 2 (PowerPC cleanup):
>   powerpc/PCI: Rename pcibios_root_bridge_prepare() to
> pcibios_set_root_bus_speed()
> 
> Set 3: (could possibly be merged with set 4)
>   PCI: Introduce pci_bus_child_max_busnr()
> 
> Set 4: (_nr and friends)
>   PCI: Save domain in pci_host_bridge
>   PCI: Move pci_bus_assign_domain_nr() declaration into
>drivers/pci/pci.h
>   PCI: Introduce pci_host_assign_domain_nr() to assign domain
>   PCI: Remove platform specific pci_domain_nr()
>   PCI: Remove pci_bus_assign_domain_nr()
> 
> Remainder:
>   PCI: Remove argument bus for pci_create_root_bus()
>   PCI: Alloc busn resource dynamically for pci_scan_bus()
>   PCI: Allocate busn resource for pci_scan_root_bus()
>   PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
>   PCI: Introduce pci_host_bridge_list to manage host bridges
>   PCI: Save sysdata in pci_host_bridge drvdata  
>   PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge()
>   PCI: Introduce pci_host_bridge_ops to support host specific
> operations
>   PCI: Introduce new scan function pci_scan_host_bridge()
>   x86/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
>   ia64/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
>   powerpc/pci: Use pci_scan_host_bridge() for simplicity
>   PCI: Remove pcibios_root_bridge_prepare() and
> pcibos_set_root_bus_speed()
>   sparc/PCI: Use pci_scan_host_bridge() for simplicity
>   parisc/PCI: Use pci_scan_root_bus() for simplicity
>   PCI/mvebu: Use pci_common_init_dev() to simplify code
>   PCI/tegra: Remove redundant tegra_pcie_scan_bus()
>   PCI/designware: Use pci_scan_root_bus() for simplicity
>   PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
>   PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
> 
> On Tue, 2015-04-21 at 19:34 +0800, Yijing Wang wrote:
>> This series could be pulled from:
>> https://github.com/YijingWang/linux-pci.git enumer10
>>
>> v9->v10:
>>  Dynamically allocate busn resource if callers don't supply.
>>  Try to adjust busn resource if host bridge busn resource conlict.
>>  Rebase whole series on Bjorn's latest pci-next branch.
>>  M

Re: [PATCH v2] MAINTAINERS: Remove Mohit Kumar (email bounces)

2015-04-26 Thread Viresh Kumar
On Mon, Apr 27, 2015 at 11:13 AM, Viresh Kumar  wrote:
> Anyway, please hold on this patch and I will update it for them.

Ahh, its already gone. :)

Okay, I will let them handle it now. Guys please fix your email-ids in kernel.
--
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] MAINTAINERS: Remove Mohit Kumar (email bounces)

2015-04-26 Thread Viresh Kumar
[Fixing Mohit's and Pratyush's email ids]

On Wed, Apr 22, 2015 at 1:58 AM, Bjorn Helgaas  wrote:
> Email to Mohit Kumar  has been bouncing, so remove the
> address from MAINTAINERS and add an entry in CREDITS.
>
> Signed-off-by: Bjorn Helgaas 
> ---
>  CREDITS |4 
>  MAINTAINERS |4 +---
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/CREDITS b/CREDITS
> index 843e17647f3b..6bb0d51e83de 100644
> --- a/CREDITS
> +++ b/CREDITS
> @@ -2045,6 +2045,10 @@ D: pirq addr, CS5535 alsa audio driver
>  S: Gurgaon, India
>  S: Kuala Lumpur, Malaysia
>
> +N: Mohit Kumar
> +D: ST Microelectronics SPEAr13xx PCI host bridge driver
> +D: Synopsys Designware PCI host bridge driver
> +
>  N: Gabor Kuti
>  M: seas...@falcon.sch.bme.hu
>  M: seas...@makosteszta.sote.hu
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a123c39b4f0e..1c95b707a5f6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7490,7 +7490,6 @@ S:Maintained
>  F: drivers/pci/host/pci-exynos.c
>
>  PCI DRIVER FOR SYNOPSIS DESIGNWARE
> -M: Mohit Kumar 
>  M: Jingoo Han 
>  L: linux-...@vger.kernel.org
>  S: Maintained
> @@ -7505,9 +7504,8 @@ F:
> Documentation/devicetree/bindings/pci/host-generic-pci.txt
>  F: drivers/pci/host/pci-host-generic.c
>
>  PCIE DRIVER FOR ST SPEAR13XX
> -M: Mohit Kumar 
>  L: linux-...@vger.kernel.org
> -S: Maintained
> +S: Orphan
>  F: drivers/pci/host/*spear*
>
>  PCMCIA SUBSYSTEM

Its really sad that we have to get down to this, these two
should have done it..

Anyway, please hold on this patch and I will update it for them.
--
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 3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

2015-04-26 Thread NeilBrown
On Mon, 20 Apr 2015 02:48:55 -0700 Christoph Hellwig 
wrote:

> On Mon, Apr 20, 2015 at 10:46:49AM +0100, David Howells wrote:
> > NeilBrown  wrote:
> > 
> > > Missing patch 2 of the 3-patch series?
> > 
> > Yes. :-)
> > 
> > Do ext4 and xfs support this, do you know?
> 
> Yes.  As do f2fs, ocfs2, gfs2, ceph and NFSv4.2

Are you sure about NFSv4.2?

I see that it *can* report holes, but is there any guarantee that if you
create a new file and write only the 5th block, then READ_PLUS will reliably
report that the first 4 block are holes??

Because if it doesn't guarantee that, then NFSv4.2 doesn't fit the with the
others where SEEK_HOLE reliable reports holes.
On the other hand if NFSv4.2 *does* guarantee that then the current READ_PLUS
server patches are broken because they just use vfs_llseek and assume that
trust what it says.

It would be really nice if SEEK_{DATA,HOLE} either reported holes reliably or
returned ENXIO, but I guess there was a goo reason not to do that.

Thanks,
NeilBrown


pgplq8OqNgsRG.pgp
Description: OpenPGP digital signature


[PATCH v9 02/17] h8300: UAPI headers

2015-04-26 Thread Yoshinori Sato
Signed-off-by: Yoshinori Sato 
---
 arch/h8300/include/uapi/asm/Kbuild   |  29 
 arch/h8300/include/uapi/asm/auxvec.h |   4 ++
 arch/h8300/include/uapi/asm/byteorder.h  |   6 ++
 arch/h8300/include/uapi/asm/ptrace.h |  42 +++
 arch/h8300/include/uapi/asm/sigcontext.h |  18 +
 arch/h8300/include/uapi/asm/signal.h | 115 +++
 arch/h8300/include/uapi/asm/swab.h   |   1 +
 arch/h8300/include/uapi/asm/unistd.h |   3 +
 8 files changed, 218 insertions(+)
 create mode 100644 arch/h8300/include/uapi/asm/Kbuild
 create mode 100644 arch/h8300/include/uapi/asm/auxvec.h
 create mode 100644 arch/h8300/include/uapi/asm/byteorder.h
 create mode 100644 arch/h8300/include/uapi/asm/ptrace.h
 create mode 100644 arch/h8300/include/uapi/asm/sigcontext.h
 create mode 100644 arch/h8300/include/uapi/asm/signal.h
 create mode 100644 arch/h8300/include/uapi/asm/swab.h
 create mode 100644 arch/h8300/include/uapi/asm/unistd.h

diff --git a/arch/h8300/include/uapi/asm/Kbuild 
b/arch/h8300/include/uapi/asm/Kbuild
new file mode 100644
index 000..077e720
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/Kbuild
@@ -0,0 +1,29 @@
+# UAPI Header export list
+include include/uapi/asm-generic/Kbuild.asm
+
+header-y += auxvec.h
+header-y += bitsperlong.h
+header-y += errno.h
+header-y += fcntl.h
+header-y += ioctl.h
+header-y += ioctls.h
+header-y += ipcbuf.h
+header-y += kvm_para.h
+header-y += mman.h
+header-y += msgbuf.h
+header-y += param.h
+header-y += poll.h
+header-y += posix_types.h
+header-y += resource.h
+header-y += sembuf.h
+header-y += setup.h
+header-y += shmbuf.h
+header-y += siginfo.h
+header-y += socket.h
+header-y += sockios.h
+header-y += stat.h
+header-y += statfs.h
+header-y += termbits.h
+header-y += termios.h
+header-y += types.h
+header-y += unistd.h
diff --git a/arch/h8300/include/uapi/asm/auxvec.h 
b/arch/h8300/include/uapi/asm/auxvec.h
new file mode 100644
index 000..1d36fe38
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/auxvec.h
@@ -0,0 +1,4 @@
+#ifndef __ASMH8300_AUXVEC_H
+#define __ASMH8300_AUXVEC_H
+
+#endif
diff --git a/arch/h8300/include/uapi/asm/byteorder.h 
b/arch/h8300/include/uapi/asm/byteorder.h
new file mode 100644
index 000..13539da
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/byteorder.h
@@ -0,0 +1,6 @@
+#ifndef _H8300_BYTEORDER_H
+#define _H8300_BYTEORDER_H
+
+#include 
+
+#endif /* _H8300_BYTEORDER_H */
diff --git a/arch/h8300/include/uapi/asm/ptrace.h 
b/arch/h8300/include/uapi/asm/ptrace.h
new file mode 100644
index 000..e132670d
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/ptrace.h
@@ -0,0 +1,42 @@
+#ifndef _UAPI_H8300_PTRACE_H
+#define _UAPI_H8300_PTRACE_H
+
+#ifndef __ASSEMBLY__
+
+#define PT_ER10
+#define PT_ER21
+#define PT_ER32
+#define PT_ER43
+#define PT_ER54
+#define PT_ER65
+#define PT_ER06
+#define PT_USP7
+#define PT_ORIG_ER0   8
+#define PT_CCR9
+#define PT_PC 10
+#define PT_EXR 11
+
+/* this struct defines the way the registers are stored on the
+   stack during a system call. */
+
+struct pt_regs {
+   long retpc;
+   long er4;
+   long er5;
+   long er6;
+   long er3;
+   long er2;
+   long er1;
+   long orig_er0;
+   long sp;
+   unsigned short   ccr;
+   long er0;
+   long vector;
+#if defined(__H8300S__)
+   unsigned short   exr;
+#endif
+   unsigned long  pc;
+} __attribute__((aligned(2), packed));
+
+#endif /* __ASSEMBLY__ */
+#endif /* _UAPI_H8300_PTRACE_H */
diff --git a/arch/h8300/include/uapi/asm/sigcontext.h 
b/arch/h8300/include/uapi/asm/sigcontext.h
new file mode 100644
index 000..c41fdaa
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/sigcontext.h
@@ -0,0 +1,18 @@
+#ifndef _ASM_H8300_SIGCONTEXT_H
+#define _ASM_H8300_SIGCONTEXT_H
+
+struct sigcontext {
+   unsigned long  sc_mask; /* old sigmask */
+   unsigned long  sc_usp;  /* old user stack pointer */
+   unsigned long  sc_er0;
+   unsigned long  sc_er1;
+   unsigned long  sc_er2;
+   unsigned long  sc_er3;
+   unsigned long  sc_er4;
+   unsigned long  sc_er5;
+   unsigned long  sc_er6;
+   unsigned short sc_ccr;
+   unsigned long  sc_pc;
+};
+
+#endif
diff --git a/arch/h8300/include/uapi/asm/signal.h 
b/arch/h8300/include/uapi/asm/signal.h
new file mode 100644
index 000..af3a6c3
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/signal.h
@@ -0,0 +1,115 @@
+#ifndef _UAPI_H8300_SIGNAL_H
+#define _UAPI_H8300_SIGNAL_H
+
+#include 
+
+/* Avoid too many header ordering problems.  */
+struct siginfo;
+
+#ifndef __KERNEL__
+/* Here we must cater to libcs that poke about in kernel headers.  */
+
+#define NSIG   32
+typedef unsigned long sigset_t;
+
+#endif /* __KERNEL__ */
+
+#define SIGHUP  1
+#define SIGINT  2
+#define SIGQUIT 3
+#define SIGILL  4
+#define SIGTRAP

[PATCH v9 05/17] h8300: process and signals

2015-04-26 Thread Yoshinori Sato
process management helper and signal handling

Signed-off-by: Yoshinori Sato 
---
 arch/h8300/kernel/process.c | 171 ++
 arch/h8300/kernel/ptrace.c  | 203 +++
 arch/h8300/kernel/signal.c  | 289 
 3 files changed, 663 insertions(+)
 create mode 100644 arch/h8300/kernel/process.c
 create mode 100644 arch/h8300/kernel/ptrace.c
 create mode 100644 arch/h8300/kernel/signal.c

diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
new file mode 100644
index 000..dee4125
--- /dev/null
+++ b/arch/h8300/kernel/process.c
@@ -0,0 +1,171 @@
+/*
+ *  linux/arch/h8300/kernel/process.c
+ *
+ * Yoshinori Sato 
+ *
+ *  Based on:
+ *
+ *  linux/arch/m68knommu/kernel/process.c
+ *
+ *  Copyright (C) 1998  D. Jeff Dionne ,
+ *  Kenneth Albanowski ,
+ *  The Silver Hammer Group, Ltd.
+ *
+ *  linux/arch/m68k/kernel/process.c
+ *
+ *  Copyright (C) 1995  Hamish Macdonald
+ *
+ *  68060 fixes by Jesper Skov
+ */
+
+/*
+ * This file handles the architecture-dependent parts of process handling..
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+void (*pm_power_off)(void) = NULL;
+EXPORT_SYMBOL(pm_power_off);
+
+asmlinkage void ret_from_fork(void);
+asmlinkage void ret_from_kernel_thread(void);
+
+/*
+ * The idle loop on an H8/300..
+ */
+void arch_cpu_idle(void)
+{
+   local_irq_enable();
+   __asm__("sleep");
+}
+
+void machine_restart(char *__unused)
+{
+   local_irq_disable();
+   __asm__("jmp @@0");
+}
+
+void machine_halt(void)
+{
+   local_irq_disable();
+   __asm__("sleep");
+   for (;;)
+   ;
+}
+
+void machine_power_off(void)
+{
+   local_irq_disable();
+   __asm__("sleep");
+   for (;;)
+   ;
+}
+
+void show_regs(struct pt_regs *regs)
+{
+   show_regs_print_info(KERN_DEFAULT);
+
+   pr_notice("\n");
+   pr_notice("PC: %08lx  Status: %02x\n",
+  regs->pc, regs->ccr);
+   pr_notice("ORIG_ER0: %08lx ER0: %08lx ER1: %08lx\n",
+  regs->orig_er0, regs->er0, regs->er1);
+   pr_notice("ER2: %08lx ER3: %08lx ER4: %08lx ER5: %08lx\n",
+  regs->er2, regs->er3, regs->er4, regs->er5);
+   pr_notice("ER6' %08lx ", regs->er6);
+   if (user_mode(regs))
+   printk("USP: %08lx\n", rdusp());
+   else
+   printk("\n");
+}
+
+void flush_thread(void)
+{
+}
+
+int copy_thread(unsigned long clone_flags,
+   unsigned long usp, unsigned long topstk,
+   struct task_struct *p)
+{
+   struct pt_regs *childregs;
+
+   childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
+
+   if (unlikely(p->flags & PF_KTHREAD)) {
+   memset(childregs, 0, sizeof(struct pt_regs));
+   childregs->retpc = (unsigned long) ret_from_kernel_thread;
+   childregs->er4 = topstk; /* arg */
+   childregs->er5 = usp; /* fn */
+   }  else {
+   *childregs = *current_pt_regs();
+   childregs->er0 = 0;
+   childregs->retpc = (unsigned long) ret_from_fork;
+   p->thread.usp = usp ?: rdusp();
+   }
+   p->thread.ksp = (unsigned long)childregs;
+
+   return 0;
+}
+
+unsigned long thread_saved_pc(struct task_struct *tsk)
+{
+   return ((struct pt_regs *)tsk->thread.esp0)->pc;
+}
+
+unsigned long get_wchan(struct task_struct *p)
+{
+   unsigned long fp, pc;
+   unsigned long stack_page;
+   int count = 0;
+
+   if (!p || p == current || p->state == TASK_RUNNING)
+   return 0;
+
+   stack_page = (unsigned long)p;
+   fp = ((struct pt_regs *)p->thread.ksp)->er6;
+   do {
+   if (fp < stack_page+sizeof(struct thread_info) ||
+   fp >= 8184+stack_page)
+   return 0;
+   pc = ((unsigned long *)fp)[1];
+   if (!in_sched_functions(pc))
+   return pc;
+   fp = *(unsigned long *) fp;
+   } while (count++ < 16);
+   return 0;
+}
+
+/* generic sys_clone is not enough registers */
+asmlinkage int sys_clone(unsigned long __user *args)
+{
+   unsigned long clone_flags;
+   unsigned long  newsp;
+   uintptr_t parent_tidptr;
+   uintptr_t child_tidptr;
+
+   get_user(clone_flags, &args[0]);
+   get_user(newsp, &args[1]);
+   get_user(parent_tidptr, &args[2]);
+   get_user(child_tidptr, &args[3]);
+   return do_fork(clone_flags, newsp, 0,
+  (int __user *)parent_tidptr, (int __user *)child_tidptr);
+}
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c
new file mode 100644
index 000..9207554
--- /dev/null
+++ b/arch/h8300/kernel/ptrace.

[PATCH v9 01/17] h8300: Assembly headers.

2015-04-26 Thread Yoshinori Sato
Signed-off-by: Yoshinori Sato 
---
 arch/h8300/include/asm/Kbuild  |  66 ++
 arch/h8300/include/asm/asm-offsets.h   |   1 +
 arch/h8300/include/asm/atomic.h| 159 +++
 arch/h8300/include/asm/bitops.h| 185 +
 arch/h8300/include/asm/bootparams.h|  17 ++
 arch/h8300/include/asm/bug.h   |  12 ++
 arch/h8300/include/asm/cache.h |  11 +
 arch/h8300/include/asm/checksum.h  | 102 ++
 arch/h8300/include/asm/cmpxchg.h   |  65 ++
 arch/h8300/include/asm/delay.h |  38 
 arch/h8300/include/asm/device.h|   6 +
 arch/h8300/include/asm/dma-mapping.h   | 124 
 arch/h8300/include/asm/elf.h   | 101 ++
 arch/h8300/include/asm/emergency-restart.h |   6 +
 arch/h8300/include/asm/flat.h  |  27 +++
 arch/h8300/include/asm/io.h| 314 +
 arch/h8300/include/asm/irq.h   |  26 +++
 arch/h8300/include/asm/irqflags.h  |  96 +
 arch/h8300/include/asm/mc146818rtc.h   |   9 +
 arch/h8300/include/asm/mutex.h |   9 +
 arch/h8300/include/asm/page.h  |  18 ++
 arch/h8300/include/asm/page_offset.h   |   2 +
 arch/h8300/include/asm/pci.h   |  19 ++
 arch/h8300/include/asm/pgtable.h   |  49 +
 arch/h8300/include/asm/processor.h | 144 +
 arch/h8300/include/asm/ptrace.h|  36 
 arch/h8300/include/asm/segment.h   |  49 +
 arch/h8300/include/asm/signal.h|  22 ++
 arch/h8300/include/asm/smp.h   |   1 +
 arch/h8300/include/asm/spinlock.h  |   6 +
 arch/h8300/include/asm/string.h|  17 ++
 arch/h8300/include/asm/switch_to.h |  51 +
 arch/h8300/include/asm/syscall.h   |  56 +
 arch/h8300/include/asm/thread_info.h   | 108 ++
 arch/h8300/include/asm/timer.h |  31 +++
 arch/h8300/include/asm/tlb.h   |   8 +
 arch/h8300/include/asm/topology.h  |   6 +
 arch/h8300/include/asm/traps.h |  41 
 arch/h8300/include/asm/uaccess.h   | 136 +
 arch/h8300/include/asm/unaligned.h |  11 +
 arch/h8300/include/asm/user.h  |  74 +++
 41 files changed, 2259 insertions(+)
 create mode 100644 arch/h8300/include/asm/Kbuild
 create mode 100644 arch/h8300/include/asm/asm-offsets.h
 create mode 100644 arch/h8300/include/asm/atomic.h
 create mode 100644 arch/h8300/include/asm/bitops.h
 create mode 100644 arch/h8300/include/asm/bootparams.h
 create mode 100644 arch/h8300/include/asm/bug.h
 create mode 100644 arch/h8300/include/asm/cache.h
 create mode 100644 arch/h8300/include/asm/checksum.h
 create mode 100644 arch/h8300/include/asm/cmpxchg.h
 create mode 100644 arch/h8300/include/asm/delay.h
 create mode 100644 arch/h8300/include/asm/device.h
 create mode 100644 arch/h8300/include/asm/dma-mapping.h
 create mode 100644 arch/h8300/include/asm/elf.h
 create mode 100644 arch/h8300/include/asm/emergency-restart.h
 create mode 100644 arch/h8300/include/asm/flat.h
 create mode 100644 arch/h8300/include/asm/io.h
 create mode 100644 arch/h8300/include/asm/irq.h
 create mode 100644 arch/h8300/include/asm/irqflags.h
 create mode 100644 arch/h8300/include/asm/mc146818rtc.h
 create mode 100644 arch/h8300/include/asm/mutex.h
 create mode 100644 arch/h8300/include/asm/page.h
 create mode 100644 arch/h8300/include/asm/page_offset.h
 create mode 100644 arch/h8300/include/asm/pci.h
 create mode 100644 arch/h8300/include/asm/pgtable.h
 create mode 100644 arch/h8300/include/asm/processor.h
 create mode 100644 arch/h8300/include/asm/ptrace.h
 create mode 100644 arch/h8300/include/asm/segment.h
 create mode 100644 arch/h8300/include/asm/signal.h
 create mode 100644 arch/h8300/include/asm/smp.h
 create mode 100644 arch/h8300/include/asm/spinlock.h
 create mode 100644 arch/h8300/include/asm/string.h
 create mode 100644 arch/h8300/include/asm/switch_to.h
 create mode 100644 arch/h8300/include/asm/syscall.h
 create mode 100644 arch/h8300/include/asm/thread_info.h
 create mode 100644 arch/h8300/include/asm/timer.h
 create mode 100644 arch/h8300/include/asm/tlb.h
 create mode 100644 arch/h8300/include/asm/topology.h
 create mode 100644 arch/h8300/include/asm/traps.h
 create mode 100644 arch/h8300/include/asm/uaccess.h
 create mode 100644 arch/h8300/include/asm/unaligned.h
 create mode 100644 arch/h8300/include/asm/user.h

diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
new file mode 100644
index 000..9e9f4f3
--- /dev/null
+++ b/arch/h8300/include/asm/Kbuild
@@ -0,0 +1,66 @@
+generic-y += barrier.h
+generic-y += bitsperlong.h
+generic-y += bugs.h
+generic-y += cacheflush.h
+generic-y += clkdev.h
+generic-y += cputime.h
+generic-y += current.h
+generic-y += div64.h
+generic-y += dma.h
+generic-y += emergency-restart.h
+generic-y += errno.

[PATCH v9 03/17] h8300: Exception and Interrupt handling

2015-04-26 Thread Yoshinori Sato
h8300 exception entry and exception / interrupt handling

Signed-off-by: Yoshinori Sato 
---
 arch/h8300/kernel/entry.S | 414 ++
 arch/h8300/kernel/irq.c   | 100 +++
 arch/h8300/kernel/traps.c | 161 ++
 3 files changed, 675 insertions(+)
 create mode 100644 arch/h8300/kernel/entry.S
 create mode 100644 arch/h8300/kernel/irq.c
 create mode 100644 arch/h8300/kernel/traps.c

diff --git a/arch/h8300/kernel/entry.S b/arch/h8300/kernel/entry.S
new file mode 100644
index 000..797dfa8
--- /dev/null
+++ b/arch/h8300/kernel/entry.S
@@ -0,0 +1,414 @@
+/*
+ *
+ *  linux/arch/h8300/kernel/entry.S
+ *
+ *  Yoshinori Sato 
+ *  David McCullough 
+ *
+ */
+
+/*
+ *  entry.S
+ *  include exception/interrupt gateway
+ *  system call entry
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#if defined(CONFIG_CPU_H8300H)
+#define USERRET 8
+INTERRUPTS = 64
+   .h8300h
+   .macro  SHLL2 reg
+   shll.l  \reg
+   shll.l  \reg
+   .endm
+   .macro  SHLR2 reg
+   shlr.l  \reg
+   shlr.l  \reg
+   .endm
+   .macro  SAVEREGS
+   mov.l   er0,@-sp
+   mov.l   er1,@-sp
+   mov.l   er2,@-sp
+   mov.l   er3,@-sp
+   .endm
+   .macro  RESTOREREGS
+   mov.l   @sp+,er3
+   mov.l   @sp+,er2
+   .endm
+   .macro  SAVEEXR
+   .endm
+   .macro  RESTOREEXR
+   .endm
+#endif
+#if defined(CONFIG_CPU_H8S)
+#define USERRET 10
+#define USEREXR 8
+INTERRUPTS = 128
+   .h8300s
+   .macro  SHLL2 reg
+   shll.l  #2,\reg
+   .endm
+   .macro  SHLR2 reg
+   shlr.l  #2,\reg
+   .endm
+   .macro  SAVEREGS
+   stm.l   er0-er3,@-sp
+   .endm
+   .macro  RESTOREREGS
+   ldm.l   @sp+,er2-er3
+   .endm
+   .macro  SAVEEXR
+   mov.w   @(USEREXR:16,er0),r1
+   mov.w   r1,@(LEXR-LER3:16,sp)   /* copy EXR */
+   .endm
+   .macro  RESTOREEXR
+   mov.w   @(LEXR-LER1:16,sp),r1   /* restore EXR */
+   mov.b   r1l,r1h
+   mov.w   r1,@(USEREXR:16,er0)
+   .endm
+#endif
+
+
+/* CPU context save/restore macros. */
+
+   .macro  SAVE_ALL
+   mov.l   er0,@-sp
+   stc ccr,r0l /* check kernel mode */
+   btst#4,r0l
+   bne 5f
+
+   /* user mode */
+   mov.l   sp,@_sw_usp
+   mov.l   @sp,er0 /* restore saved er0 */
+   orc #0x10,ccr   /* switch kernel stack */
+   mov.l   @_sw_ksp,sp
+   sub.l   #(LRET-LORIG),sp/* allocate LORIG - LRET */
+   SAVEREGS
+   mov.l   @_sw_usp,er0
+   mov.l   @(USERRET:16,er0),er1   /* copy the RET addr */
+   mov.l   er1,@(LRET-LER3:16,sp)
+   SAVEEXR
+
+   mov.l   @(LORIG-LER3:16,sp),er0
+   mov.l   er0,@(LER0-LER3:16,sp)  /* copy ER0 */
+   mov.w   e1,r1   /* e1 highbyte = ccr */
+   and #0xef,r1h   /* mask mode? flag */
+   bra 6f
+5:
+   /* kernel mode */
+   mov.l   @sp,er0 /* restore saved er0 */
+   subs#2,sp   /* set dummy ccr */
+   subs#4,sp   /* set dummp sp */
+   SAVEREGS
+   mov.w   @(LRET-LER3:16,sp),r1   /* copy old ccr */
+6:
+   mov.b   r1h,r1l
+   mov.b   #0,r1h
+   mov.w   r1,@(LCCR-LER3:16,sp)   /* set ccr */
+   mov.l   @_sw_usp,er2
+   mov.l   er2,@(LSP-LER3:16,sp)   /* set usp */
+   mov.l   er6,@-sp/* syscall arg #6 */
+   mov.l   er5,@-sp/* syscall arg #5 */
+   mov.l   er4,@-sp/* syscall arg #4 */
+   .endm   /* r1 = ccr */
+
+   .macro  RESTORE_ALL
+   mov.l   @sp+,er4
+   mov.l   @sp+,er5
+   mov.l   @sp+,er6
+   RESTOREREGS
+   mov.w   @(LCCR-LER1:16,sp),r0   /* check kernel mode */
+   btst#4,r0l
+   bne 7f
+
+   orc #0xc0,ccr
+   mov.l   @(LSP-LER1:16,sp),er0
+   mov.l   @(LER0-LER1:16,sp),er1  /* restore ER0 */
+   mov.l   er1,@er0
+   RESTOREEXR
+   mov.w   @(LCCR-LER1:16,sp),r1   /* restore the RET addr */
+   mov.b   r1l,r1h
+   mov.b   @(LRET+1-LER1:16,sp),r1l
+   mov.w   r1,e1
+   mov.w   @(LRET+2-LER1:16,sp),r1
+   mov.l   er1,@(USERRET:16,er0)
+
+   mov.l   @sp+,er1
+   add.l   #(LRET-LER1),sp /* remove LORIG - LRET */
+   mov.l   sp,@_sw_ksp
+   andc#0xef,ccr   /* switch to user mode */
+   mov.l   er0,sp
+   bra 8f
+7:
+   mov.l   @sp+,er1
+   add.l   #10,sp
+8:
+   mov.l   @sp+,er0
+   adds#4,sp   /* remove the sw created LVEC */
+   rte
+   .endm
+
+.gl

[PATCH v9 04/17] h8300: kernel booting

2015-04-26 Thread Yoshinori Sato
zImage startup / kernel entry point / arch depend startup

Signed-off-by: Yoshinori Sato 
---
 arch/h8300/boot/Makefile   |  26 +
 arch/h8300/boot/compressed/Makefile|  37 +++
 arch/h8300/boot/compressed/head.S  |  48 +
 arch/h8300/boot/compressed/misc.c  |  74 ++
 arch/h8300/boot/compressed/vmlinux.lds |  32 ++
 arch/h8300/boot/compressed/vmlinux.scr |   9 ++
 arch/h8300/kernel/head_ram.S   |  60 
 arch/h8300/kernel/head_rom.S   | 108 
 arch/h8300/kernel/setup.c  | 174 +
 9 files changed, 568 insertions(+)
 create mode 100644 arch/h8300/boot/Makefile
 create mode 100644 arch/h8300/boot/compressed/Makefile
 create mode 100644 arch/h8300/boot/compressed/head.S
 create mode 100644 arch/h8300/boot/compressed/misc.c
 create mode 100644 arch/h8300/boot/compressed/vmlinux.lds
 create mode 100644 arch/h8300/boot/compressed/vmlinux.scr
 create mode 100644 arch/h8300/kernel/head_ram.S
 create mode 100644 arch/h8300/kernel/head_rom.S
 create mode 100644 arch/h8300/kernel/setup.c

diff --git a/arch/h8300/boot/Makefile b/arch/h8300/boot/Makefile
new file mode 100644
index 000..2f6393a
--- /dev/null
+++ b/arch/h8300/boot/Makefile
@@ -0,0 +1,26 @@
+# arch/h8300/boot/Makefile
+
+targets := vmlinux.srec vmlinux.bin zImage
+subdir- := compressed
+
+OBJCOPYFLAGS_vmlinux.srec := -Osrec
+OBJCOPYFLAGS_vmlinux.bin  := -Obinary
+OBJCOPYFLAGS_zImage := -O binary -R .note -R .comment -R .stab -R .stabstr -S
+
+UIMAGE_LOADADDR = $(CONFIG_RAMBASE)
+UIMAGE_ENTRYADDR = $(shell /bin/bash -c 'printf "0x%08x" \
+   $$[$(CONFIG_RAMBASE) + $(CONFIG_OFFSET)]')
+
+$(obj)/vmlinux.srec $(obj)/vmlinux.bin:  vmlinux FORCE
+   $(call if_changed,objcopy)
+
+$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
+   $(call if_changed,objcopy)
+
+$(obj)/compressed/vmlinux: FORCE
+   $(Q)$(MAKE) $(build)=$(obj)/compressed $@
+
+$(obj)/uImage.bin: $(obj)/vmlinux.bin
+   $(call if_changed,uimage,none)
+
+CLEAN_FILES += arch/$(ARCH)/vmlinux.bin arch/$(ARCH)/vmlinux.srec 
arch/$(ARCH)/uImage.bin
diff --git a/arch/h8300/boot/compressed/Makefile 
b/arch/h8300/boot/compressed/Makefile
new file mode 100644
index 000..87d03b7
--- /dev/null
+++ b/arch/h8300/boot/compressed/Makefile
@@ -0,0 +1,37 @@
+#
+# linux/arch/sh/boot/compressed/Makefile
+#
+# create a compressed vmlinux image from the original vmlinux
+#
+
+targets:= vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o 
piggy.o
+
+OBJECTS = $(obj)/head.o $(obj)/misc.o
+
+#
+# IMAGE_OFFSET is the load offset of the compression loader
+# Assign dummy values if these 2 variables are not defined,
+# in order to suppress error message.
+#
+CONFIG_MEMORY_START ?= 0x0040
+CONFIG_BOOT_LINK_OFFSET ?= 0x0014
+IMAGE_OFFSET := $(shell printf "0x%08x" 
$$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET
+
+LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
+LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup $(obj)/vmlinux.lds
+
+$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
+   $(call if_changed,ld)
+   @:
+
+$(obj)/vmlinux.bin: vmlinux FORCE
+   $(call if_changed,objcopy)
+
+$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
+   $(call if_changed,gzip)
+
+LDFLAGS_piggy.o := -r --format binary --oformat elf32-h8300-linux -T
+OBJCOPYFLAGS := -O binary
+
+$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
+   $(call if_changed,ld)
diff --git a/arch/h8300/boot/compressed/head.S 
b/arch/h8300/boot/compressed/head.S
new file mode 100644
index 000..74c0d8cc
--- /dev/null
+++ b/arch/h8300/boot/compressed/head.S
@@ -0,0 +1,48 @@
+/*
+ *  linux/arch/h8300/boot/compressed/head.S
+ *
+ *  Copyright (C) 2006 Yoshinori Sato
+ */
+
+#include 
+
+   .section.text..startup,"ax"
+   .global startup
+startup:
+   mov.l   er0, er4
+   mov.l   er0, sp
+   mov.l   #__sbss, er0
+   mov.l   #__ebss, er1
+   sub.l   er0, er1
+   shlrer1
+   shlrer1
+   sub.l   er2, er2
+1:
+   mov.l   er2, @er0
+   adds#4, er0
+   dec.l   #1, er1
+   bne 1b
+   jsr @decompress_kernel
+   mov.l   er4, er0
+   jmp @0x40
+
+   .align  9
+fake_headers_as_bzImage:
+   .word   0
+   .ascii  "HdrS"  ; header signature
+   .word   0x0202  ; header version number (>= 0x0105)
+   ; or else old loadlin-1.5 will fail)
+   .word   0   ; default_switch
+   .word   0   ; SETUPSEG
+   .word   0x1000
+   .word   0   ; pointing to kernel version string
+   .byte   0   ; = 0, old one (LILO, Loadlin,
+   ; 0xTV: T=0 for LILO
+   ;   V = version
+   .byte   1   ; Load flags bzImage=1
+   .word   0x8000

Re: Sharing credentials in general (Re: [GIT PULL] kdbus for 4.1-rc1)

2015-04-26 Thread George Spelvin
Linus wrote:
> It would be insane to say that the open system call should have an
> explicit argument saying that the vfs layer should take your privileges
> into account.

On the contrary, it would be a big improvement on the current interface.

To be clearer, it would be great if the open system call took an explicit
argument saying *which* privileges it should take into account.

All that screwing around with uid, euid and fsuid and crap would be
a lot simpler if it was explicit in the open() call which permissions
were desired.

In my "If I had a time machine and could go back and talk to Ken & Dennis"
fantasy, there would be no open(), only openat(), and the permissions
would be associated with the dirfd.

In addition to the now-current standard three fds, there would be
additional ones for root and cwd.  And, in a setuid program,
a separate set for effective uids.

So openat(fd, path, flags) would use the real or effective permissions
depending on which fd was in use.  A process could drop permissions
by closing the associated fd.  Etc.

(And a program which was written without setuid awareness would only
use the real-uid dirfds, and the setuidness would do nothing.)
--
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 v9 06/17] h8300: CPU depend helpers

2015-04-26 Thread Yoshinori Sato
H8/3069 and H8S2678 have little different specification
(peripheral, interrupt and trace).
Its difference is absorbed here.

Signed-off-by: Yoshinori Sato 
---
 arch/h8300/kernel/cpu/Makefile |   4 +
 arch/h8300/kernel/cpu/h83069/Makefile  |   1 +
 arch/h8300/kernel/cpu/h83069/setup.c   | 202 ++
 arch/h8300/kernel/cpu/h8s2678/Makefile |   1 +
 arch/h8300/kernel/cpu/h8s2678/setup.c  | 161 +
 arch/h8300/kernel/cpu/irq_h.c  |  62 
 arch/h8300/kernel/cpu/irq_s.c  |  70 +
 arch/h8300/kernel/cpu/ptrace_h.c   | 256 +
 arch/h8300/kernel/cpu/ptrace_s.c   |  44 ++
 9 files changed, 801 insertions(+)
 create mode 100644 arch/h8300/kernel/cpu/Makefile
 create mode 100644 arch/h8300/kernel/cpu/h83069/Makefile
 create mode 100644 arch/h8300/kernel/cpu/h83069/setup.c
 create mode 100644 arch/h8300/kernel/cpu/h8s2678/Makefile
 create mode 100644 arch/h8300/kernel/cpu/h8s2678/setup.c
 create mode 100644 arch/h8300/kernel/cpu/irq_h.c
 create mode 100644 arch/h8300/kernel/cpu/irq_s.c
 create mode 100644 arch/h8300/kernel/cpu/ptrace_h.c
 create mode 100644 arch/h8300/kernel/cpu/ptrace_s.c

diff --git a/arch/h8300/kernel/cpu/Makefile b/arch/h8300/kernel/cpu/Makefile
new file mode 100644
index 000..684475c
--- /dev/null
+++ b/arch/h8300/kernel/cpu/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_CPU_H8300H) += ptrace_h.o irq_h.o
+obj-$(CONFIG_CPU_H8S) += ptrace_s.o irq_s.o
+obj-$(CONFIG_H83069) += h83069/
+obj-$(CONFIG_H8S2678) += h8s2678/
diff --git a/arch/h8300/kernel/cpu/h83069/Makefile 
b/arch/h8300/kernel/cpu/h83069/Makefile
new file mode 100644
index 000..49d283e
--- /dev/null
+++ b/arch/h8300/kernel/cpu/h83069/Makefile
@@ -0,0 +1 @@
+obj-y = setup.o
diff --git a/arch/h8300/kernel/cpu/h83069/setup.c 
b/arch/h8300/kernel/cpu/h83069/setup.c
new file mode 100644
index 000..99c2716
--- /dev/null
+++ b/arch/h8300/kernel/cpu/h83069/setup.c
@@ -0,0 +1,202 @@
+/*
+ * H8/3069 Internal peripheral setup
+ *
+ *  Copyright (C) 2009,2014 Yoshinori Sato 
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct resource sci0_resources[] = {
+   DEFINE_RES_MEM(0xb0, 8),
+   DEFINE_RES_IRQ(52),
+   DEFINE_RES_IRQ(53),
+   DEFINE_RES_IRQ(54),
+   DEFINE_RES_IRQ(55),
+};
+
+
+static struct plat_sci_port sci0_platform_data = {
+   .flags  = UPF_BOOT_AUTOCONF,
+   .scscr  = SCSCR_RE | SCSCR_TE,
+   .type   = PORT_SCI,
+};
+
+static struct resource sci1_resources[] = {
+   DEFINE_RES_MEM(0xb8, 8),
+   DEFINE_RES_IRQ(56),
+   DEFINE_RES_IRQ(57),
+   DEFINE_RES_IRQ(58),
+   DEFINE_RES_IRQ(59),
+};
+
+static struct plat_sci_port sci1_platform_data = {
+   .flags  = UPF_BOOT_AUTOCONF,
+   .scscr  = SCSCR_RE | SCSCR_TE,
+   .type   = PORT_SCI,
+};
+
+static struct platform_device sci0_device = {
+   .name   = "sh-sci",
+   .id = 0,
+   .resource   = sci0_resources,
+   .num_resources  = ARRAY_SIZE(sci0_resources),
+   .dev= {
+   .platform_data  = &sci0_platform_data,
+   },
+};
+
+static struct platform_device sci1_device = {
+   .name   = "sh-sci",
+   .id = 1,
+   .resource   = sci1_resources,
+   .num_resources  = ARRAY_SIZE(sci1_resources),
+   .dev= {
+   .platform_data  = &sci1_platform_data,
+   },
+};
+
+static struct h8300_timer8_config tm8_unit0_platform_data = {
+   .mode   = H8300_TMR8_CLKEVTDEV,
+   .div= H8300_TMR8_DIV_8,
+};
+
+static struct resource tm8_unit0_resources[] = {
+   DEFINE_RES_MEM(0x80, 9),
+   DEFINE_RES_IRQ(36),
+   DEFINE_RES_IRQ(39),
+};
+
+static struct platform_device timer8_unit0_device = {
+   .name   = "h8300-8timer",
+   .id = 0,
+   .dev = {
+   .platform_data  = &tm8_unit0_platform_data,
+   },
+   .resource   = tm8_unit0_resources,
+   .num_resources  = ARRAY_SIZE(tm8_unit0_resources),
+};
+
+static struct h8300_timer8_config tm8_unit1_platform_data = {
+   .mode   = H8300_TMR8_CLKSRC,
+   .div= H8300_TMR8_DIV_8,
+};
+
+static struct resource tm8_unit1_resources[] = {
+   DEFINE_RES_MEM(0x90, 9),
+   DEFINE_RES_IRQ(40),
+   DEFINE_RES_IRQ(43),
+};
+
+static struct platform_device timer8_unit1_device = {
+   .name   = "h8300-8timer",
+   .id = 1,
+   .dev = {
+   .platform_data  = &tm8_unit1_platform_data,
+   },
+   .resource   = tm8_unit1_resources,
+   .num_resources  = ARRAY_SIZE(tm8_unit1_resources),
+};
+
+
+static struct h8300_timer16_config t

[PATCH v9 07/17] h8300: miscellaneous functions

2015-04-26 Thread Yoshinori Sato
Signed-off-by: Yoshinori Sato 
---
 arch/h8300/kernel/asm-offsets.c | 67 +
 arch/h8300/kernel/dma.c | 95 +
 arch/h8300/kernel/h8300_ksyms.c | 34 +++
 arch/h8300/kernel/module.c  | 70 ++
 arch/h8300/kernel/sim-console.c | 79 ++
 arch/h8300/kernel/syscalls.c| 14 ++
 6 files changed, 359 insertions(+)
 create mode 100644 arch/h8300/kernel/asm-offsets.c
 create mode 100644 arch/h8300/kernel/dma.c
 create mode 100644 arch/h8300/kernel/h8300_ksyms.c
 create mode 100644 arch/h8300/kernel/module.c
 create mode 100644 arch/h8300/kernel/sim-console.c
 create mode 100644 arch/h8300/kernel/syscalls.c

diff --git a/arch/h8300/kernel/asm-offsets.c b/arch/h8300/kernel/asm-offsets.c
new file mode 100644
index 000..dc2d16c
--- /dev/null
+++ b/arch/h8300/kernel/asm-offsets.c
@@ -0,0 +1,67 @@
+/*
+ * This program is used to generate definitions needed by
+ * assembly language modules.
+ *
+ * We use the technique used in the OSF Mach kernel code:
+ * generate asm statements containing #defines,
+ * compile this file to assembler, and then extract the
+ * #defines from the assembly-language output.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main(void)
+{
+   /* offsets into the task struct */
+   OFFSET(TASK_STATE, task_struct, state);
+   OFFSET(TASK_FLAGS, task_struct, flags);
+   OFFSET(TASK_PTRACE, task_struct, ptrace);
+   OFFSET(TASK_BLOCKED, task_struct, blocked);
+   OFFSET(TASK_THREAD, task_struct, thread);
+   OFFSET(TASK_THREAD_INFO, task_struct, stack);
+   OFFSET(TASK_MM, task_struct, mm);
+   OFFSET(TASK_ACTIVE_MM, task_struct, active_mm);
+
+   /* offsets into the irq_cpustat_t struct */
+   DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t,
+__softirq_pending));
+
+   /* offsets into the thread struct */
+   OFFSET(THREAD_KSP, thread_struct, ksp);
+   OFFSET(THREAD_USP, thread_struct, usp);
+   OFFSET(THREAD_CCR, thread_struct, ccr);
+
+   /* offsets into the pt_regs struct */
+   DEFINE(LER0,  offsetof(struct pt_regs, er0)  - sizeof(long));
+   DEFINE(LER1,  offsetof(struct pt_regs, er1)  - sizeof(long));
+   DEFINE(LER2,  offsetof(struct pt_regs, er2)  - sizeof(long));
+   DEFINE(LER3,  offsetof(struct pt_regs, er3)  - sizeof(long));
+   DEFINE(LER4,  offsetof(struct pt_regs, er4)  - sizeof(long));
+   DEFINE(LER5,  offsetof(struct pt_regs, er5)  - sizeof(long));
+   DEFINE(LER6,  offsetof(struct pt_regs, er6)  - sizeof(long));
+   DEFINE(LORIG, offsetof(struct pt_regs, orig_er0) - sizeof(long));
+   DEFINE(LSP,   offsetof(struct pt_regs, sp)   - sizeof(long));
+   DEFINE(LCCR,  offsetof(struct pt_regs, ccr)  - sizeof(long));
+   DEFINE(LVEC,  offsetof(struct pt_regs, vector)   - sizeof(long));
+#if defined(CONFIG_CPU_H8S)
+   DEFINE(LEXR,  offsetof(struct pt_regs, exr)  - sizeof(long));
+#endif
+   DEFINE(LRET,  offsetof(struct pt_regs, pc)   - sizeof(long));
+
+   DEFINE(PT_PTRACED, PT_PTRACED);
+
+   /* offsets in thread_info structure */
+   OFFSET(TI_TASK, thread_info, task);
+   OFFSET(TI_FLAGS, thread_info, flags);
+   OFFSET(TI_CPU, thread_info, cpu);
+   OFFSET(TI_PRE, thread_info, preempt_count);
+
+   return 0;
+}
diff --git a/arch/h8300/kernel/dma.c b/arch/h8300/kernel/dma.c
new file mode 100644
index 000..061f3c3
--- /dev/null
+++ b/arch/h8300/kernel/dma.c
@@ -0,0 +1,95 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#undef DEBUG
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+void *dma_alloc_coherent(struct device *dev, size_t size,
+  dma_addr_t *dma_handle, gfp_t gfp)
+{
+   void *ret;
+   /* ignore region specifiers */
+   gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
+
+   if (dev == NULL || (*dev->dma_mask < 0x))
+   gfp |= GFP_DMA;
+   ret = (void *)__get_free_pages(gfp, get_order(size));
+
+   if (ret != NULL) {
+   memset(ret, 0, size);
+   *dma_handle = virt_to_phys(ret);
+   }
+   return ret;
+}
+EXPORT_SYMBOL(dma_alloc_coherent);
+
+void dma_free_coherent(struct device *dev, size_t size,
+void *vaddr, dma_addr_t dma_handle)
+{
+   free_pages((unsigned long)vaddr, get_order(size));
+}
+EXPORT_SYMBOL(dma_free_coherent);
+
+void dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
+   size_t size, enum dma_data_direction dir)
+{
+}
+EXPORT_SYMBOL(dma_sync_single_for_device);
+
+void dma

[PATCH v9 13/17] h8300: configs

2015-04-26 Thread Yoshinori Sato
h8300h-sim_defconfig: H8/300H simulator config.
h8s-sim_defconfig:H8S simulator config.
edosk2674_defconfig:  EDOSK2674R evalution board config.

Signed-off-by: Yoshinori Sato 
---
 arch/h8300/configs/h8300h-sim_defconfig | 53 +
 arch/h8300/configs/h8s-sim_defconfig| 53 +
 2 files changed, 106 insertions(+)
 create mode 100644 arch/h8300/configs/h8300h-sim_defconfig
 create mode 100644 arch/h8300/configs/h8s-sim_defconfig

diff --git a/arch/h8300/configs/h8300h-sim_defconfig 
b/arch/h8300/configs/h8300h-sim_defconfig
new file mode 100644
index 000..bad1a1e
--- /dev/null
+++ b/arch/h8300/configs/h8300h-sim_defconfig
@@ -0,0 +1,53 @@
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_USELIB is not set
+# CONFIG_INIT_FALLBACK is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+# CONFIG_UID16 is not set
+# CONFIG_SYSFS_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
+# CONFIG_BASE_FULL is not set
+# CONFIG_FUTEX is not set
+# CONFIG_EPOLL is not set
+# CONFIG_SIGNALFD is not set
+# CONFIG_TIMERFD is not set
+# CONFIG_EVENTFD is not set
+# CONFIG_AIO is not set
+# CONFIG_ADVISE_SYSCALLS is not set
+CONFIG_EMBEDDED=y
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLOB=y
+# CONFIG_BLOCK is not set
+CONFIG_H8300H_SIM=y
+CONFIG_CPU_CLOCK=2000
+CONFIG_RAMSIZE=0x20
+# CONFIG_BINFMT_SCRIPT is not set
+CONFIG_BINFMT_FLAT=y
+# CONFIG_COREDUMP is not set
+# CONFIG_UEVENT_HELPER is not set
+# CONFIG_STANDALONE is not set
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+# CONFIG_FW_LOADER is not set
+# CONFIG_ALLOW_DEV_COREDUMP is not set
+# CONFIG_INPUT is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_UNIX98_PTYS is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_HWMON is not set
+# CONFIG_USB_SUPPORT is not set
+# CONFIG_IOMMU_SUPPORT is not set
+# CONFIG_FILE_LOCKING is not set
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY_USER is not set
+# CONFIG_PROC_FS is not set
+# CONFIG_SYSFS is not set
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_DEBUG_INFO=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_CRC32 is not set
diff --git a/arch/h8300/configs/h8s-sim_defconfig 
b/arch/h8300/configs/h8s-sim_defconfig
new file mode 100644
index 000..025cdd8
--- /dev/null
+++ b/arch/h8300/configs/h8s-sim_defconfig
@@ -0,0 +1,53 @@
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_USELIB is not set
+# CONFIG_INIT_FALLBACK is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+# CONFIG_UID16 is not set
+# CONFIG_SYSFS_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
+# CONFIG_BASE_FULL is not set
+# CONFIG_FUTEX is not set
+# CONFIG_EPOLL is not set
+# CONFIG_SIGNALFD is not set
+# CONFIG_TIMERFD is not set
+# CONFIG_EVENTFD is not set
+# CONFIG_AIO is not set
+# CONFIG_ADVISE_SYSCALLS is not set
+CONFIG_EMBEDDED=y
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLOB=y
+# CONFIG_BLOCK is not set
+CONFIG_H8S_SIM=y
+CONFIG_CPU_CLOCK=
+CONFIG_RAMSIZE=0x20
+# CONFIG_BINFMT_SCRIPT is not set
+CONFIG_BINFMT_FLAT=y
+# CONFIG_COREDUMP is not set
+# CONFIG_UEVENT_HELPER is not set
+# CONFIG_STANDALONE is not set
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+# CONFIG_FW_LOADER is not set
+# CONFIG_ALLOW_DEV_COREDUMP is not set
+# CONFIG_INPUT is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_UNIX98_PTYS is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_HWMON is not set
+# CONFIG_USB_SUPPORT is not set
+# CONFIG_IOMMU_SUPPORT is not set
+# CONFIG_FILE_LOCKING is not set
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY_USER is not set
+# CONFIG_PROC_FS is not set
+# CONFIG_SYSFS is not set
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_DEBUG_INFO=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_CRC32 is not set
-- 
2.1.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/


[PATCH v9 10/17] h8300: Build scripts

2015-04-26 Thread Yoshinori Sato
h8300's Makefile, Kconfig and memory layout.

Signed-off-by: Yoshinori Sato 
---
 arch/h8300/Kconfig  |  73 ++
 arch/h8300/Kconfig.cpu  | 111 
 arch/h8300/Makefile |  45 
 arch/h8300/kernel/Makefile  |  16 ++
 arch/h8300/kernel/vmlinux.lds.S |  67 
 5 files changed, 312 insertions(+)
 create mode 100644 arch/h8300/Kconfig
 create mode 100644 arch/h8300/Kconfig.cpu
 create mode 100644 arch/h8300/Makefile
 create mode 100644 arch/h8300/kernel/Makefile
 create mode 100644 arch/h8300/kernel/vmlinux.lds.S

diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
new file mode 100644
index 000..9e352e6
--- /dev/null
+++ b/arch/h8300/Kconfig
@@ -0,0 +1,73 @@
+config H8300
+   bool
+   default y
+   select GENERIC_ATOMIC64
+   select HAVE_UID16
+   select VIRT_TO_BUS
+   select ARCH_WANT_IPC_PARSE_VERSION
+   select GENERIC_IRQ_SHOW
+   select FRAME_POINTER
+   select GENERIC_CPU_DEVICES
+   select MODULES_USE_ELF_RELA
+   select GENERIC_CLOCKEVENTS
+   select CLKDEV_LOOKUP
+   select COMMON_CLK
+   select ARCH_WANT_FRAME_POINTERS
+
+config RWSEM_GENERIC_SPINLOCK
+   def_bool y
+
+config GENERIC_HWEIGHT
+   def_bool y
+
+config GENERIC_CALIBRATE_DELAY
+   def_bool y
+
+config NO_IOPORT_MAP
+   def_bool y
+
+config HZ
+   int
+   default 100
+
+config NR_CPUS
+   int
+   default 1
+
+source "init/Kconfig"
+
+source "kernel/Kconfig.freezer"
+
+source "arch/h8300/Kconfig.cpu"
+
+menu "Kernel Features"
+
+source "kernel/Kconfig.preempt"
+
+source "mm/Kconfig"
+
+endmenu
+
+menu "Executable file formats"
+
+source "fs/Kconfig.binfmt"
+
+endmenu
+
+source "net/Kconfig"
+
+source "drivers/Kconfig"
+
+source "fs/Kconfig"
+
+menu "Kernel hacking"
+
+source "lib/Kconfig.debug"
+
+endmenu
+
+source "security/Kconfig"
+
+source "crypto/Kconfig"
+
+source "lib/Kconfig"
diff --git a/arch/h8300/Kconfig.cpu b/arch/h8300/Kconfig.cpu
new file mode 100644
index 000..fdacf92
--- /dev/null
+++ b/arch/h8300/Kconfig.cpu
@@ -0,0 +1,111 @@
+config CPU_H8300H
+   bool
+
+config CPU_H8S
+   bool
+
+config H83069
+   bool
+   select CPU_H8300H
+   select H8300_TMR16
+
+config H8S2678
+   bool
+   select CPU_H8S
+   select H8300_TPU
+
+config RAMKERNEL
+   bool
+
+config ROMKERNEL
+   bool
+
+menu "Processor type and features"
+
+choice
+prompt "H8/300 platform"
+
+config H8300_AE3068
+   bool "AE-3068/69"
+   select H83069
+   select RAMKERNEL
+   help
+ AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support
+ More Information. (Japanese Only)
+ 
+ AE-3068/69 Evaluation Board Support
+ More Information.
+ 
+
+config H8300_H8MAX
+   bool "H8MAX"
+   select H83069
+   select RAMKERNEL
+   select HAVE_IDE
+   help
+ H8MAX Evaluation Board Support
+ More Information. (Japanese Only)
+ 
+
+config H8300_KANEBEBE
+   bool "KaneBebe"
+   select H83069
+   select RAMKERNEL
+   help
+ KaneBebe Evalition Board Support
+ More Information. (Japanese Only)
+ 
+
+config H8300H_SIM
+   bool "H8/300H GDB Simulator"
+   select H83069
+   select ROMKERNEL
+   help
+ GDB Simulator Support
+ More Information.
+ 
+
+config H8S_EDOSK2674
+   bool "EDOSK-2674"
+   select H8S2678
+   select RAMKERNEL
+   help
+ Renesas EDOSK-2674 Evaluation Board Support
+ More Information.
+ 
+ 

+
+config H8S_SIM
+   bool "H8S GDB Simulator"
+   select H8S2678
+   select ROMKERNEL
+   help
+ GDB Simulator Support
+ More Information.
+ 
+
+endchoice
+
+if ROMKERNEL
+config CPU_CLOCK
+   int "CPU Clock Frequency"
+   help
+ CPU Clock Frequency
+
+config ROMSIZE
+   hex "ROM size"
+   default 0x20
+
+config RAMSIZE
+   hex "RAM size"
+endif
+
+config RAMBASE
+   hex "RAM base address"
+   default 0x40
+
+config OFFSET
+hex "Load offset"
+   default 0
+
+endmenu
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
new file mode 100644
index 000..44e915c
--- /dev/null
+++ b/arch/h8300/Makefile
@@ -0,0 +1,45 @@
+#
+# arch/h8300/Makefile
+#
+# This file is subject to the terms and conditions of the GNU General Public
+# License.  See the file "C

[PATCH v9 09/17] h8300: library functions

2015-04-26 Thread Yoshinori Sato
h8300 assembly functions and private libgcc.

Signed-off-by: Yoshinori Sato 
---
 arch/h8300/lib/Makefile|   7 ++
 arch/h8300/lib/abs.S   |  20 ++
 arch/h8300/lib/ashldi3.c   |  24 +++
 arch/h8300/lib/ashrdi3.c   |  24 +++
 arch/h8300/lib/checksum.c  | 167 +
 arch/h8300/lib/libgcc.h|  77 +
 arch/h8300/lib/lshrdi3.c   |  23 +++
 arch/h8300/lib/memcpy.S|  85 +++
 arch/h8300/lib/memset.S|  69 +++
 arch/h8300/lib/moddivsi3.S |  72 +++
 arch/h8300/lib/modsi3.S|  72 +++
 arch/h8300/lib/muldi3.c|  44 
 arch/h8300/lib/mulsi3.S|  38 +++
 arch/h8300/lib/strncpy.S   |  34 +
 arch/h8300/lib/ucmpdi2.c   |  17 +
 arch/h8300/lib/udivsi3.S   |  76 +
 16 files changed, 849 insertions(+)
 create mode 100644 arch/h8300/lib/Makefile
 create mode 100644 arch/h8300/lib/abs.S
 create mode 100644 arch/h8300/lib/ashldi3.c
 create mode 100644 arch/h8300/lib/ashrdi3.c
 create mode 100644 arch/h8300/lib/checksum.c
 create mode 100644 arch/h8300/lib/libgcc.h
 create mode 100644 arch/h8300/lib/lshrdi3.c
 create mode 100644 arch/h8300/lib/memcpy.S
 create mode 100644 arch/h8300/lib/memset.S
 create mode 100644 arch/h8300/lib/moddivsi3.S
 create mode 100644 arch/h8300/lib/modsi3.S
 create mode 100644 arch/h8300/lib/muldi3.c
 create mode 100644 arch/h8300/lib/mulsi3.S
 create mode 100644 arch/h8300/lib/strncpy.S
 create mode 100644 arch/h8300/lib/ucmpdi2.c
 create mode 100644 arch/h8300/lib/udivsi3.S

diff --git a/arch/h8300/lib/Makefile b/arch/h8300/lib/Makefile
new file mode 100644
index 000..8311a9f
--- /dev/null
+++ b/arch/h8300/lib/Makefile
@@ -0,0 +1,7 @@
+#
+# Makefile for H8/300-specific library files..
+#
+
+lib-y  = checksum.o memcpy.o memset.o abs.o strncpy.o \
+mulsi3.o udivsi3.o muldi3.o moddivsi3.o \
+ashldi3.o lshrdi3.o ashrdi3.o ucmpdi2.o
diff --git a/arch/h8300/lib/abs.S b/arch/h8300/lib/abs.S
new file mode 100644
index 000..efda749
--- /dev/null
+++ b/arch/h8300/lib/abs.S
@@ -0,0 +1,20 @@
+;;; abs.S
+
+#include 
+
+#if defined(CONFIG_CPU_H8300H)
+   .h8300h
+#endif
+#if defined(CONFIG_CPU_H8S)
+   .h8300s
+#endif
+   .text
+.global _abs
+
+;;; int abs(int n)
+_abs:
+   mov.l   er0,er0
+   bpl 1f
+   neg.l   er0
+1:
+   rts
diff --git a/arch/h8300/lib/ashldi3.c b/arch/h8300/lib/ashldi3.c
new file mode 100644
index 000..c6aa8ea
--- /dev/null
+++ b/arch/h8300/lib/ashldi3.c
@@ -0,0 +1,24 @@
+#include "libgcc.h"
+
+DWtype
+__ashldi3(DWtype u, word_type b)
+{
+   const DWunion uu = {.ll = u};
+   const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
+   DWunion w;
+
+   if (b == 0)
+   return u;
+
+   if (bm <= 0) {
+   w.s.low = 0;
+   w.s.high = (UWtype) uu.s.low << -bm;
+   } else {
+   const UWtype carries = (UWtype) uu.s.low >> bm;
+
+   w.s.low = (UWtype) uu.s.low << b;
+   w.s.high = ((UWtype) uu.s.high << b) | carries;
+   }
+
+   return w.ll;
+}
diff --git a/arch/h8300/lib/ashrdi3.c b/arch/h8300/lib/ashrdi3.c
new file mode 100644
index 000..070adf9
--- /dev/null
+++ b/arch/h8300/lib/ashrdi3.c
@@ -0,0 +1,24 @@
+#include "libgcc.h"
+
+DWtype __ashrdi3(DWtype u, word_type b)
+{
+   const DWunion uu = {.ll = u};
+   const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
+   DWunion w;
+
+   if (b == 0)
+   return u;
+
+   if (bm <= 0) {
+   /* w.s.high = 1..1 or 0..0 */
+   w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1);
+   w.s.low = uu.s.high >> -bm;
+   } else {
+   const UWtype carries = (UWtype) uu.s.high << bm;
+
+   w.s.high = uu.s.high >> b;
+   w.s.low = ((UWtype) uu.s.low >> b) | carries;
+   }
+
+   return w.ll;
+}
diff --git a/arch/h8300/lib/checksum.c b/arch/h8300/lib/checksum.c
new file mode 100644
index 000..ae28469
--- /dev/null
+++ b/arch/h8300/lib/checksum.c
@@ -0,0 +1,167 @@
+/*
+ * INETAn implementation of the TCP/IP protocol suite for the 
LINUX
+ * operating system.  INET is implemented using the  BSD Socket
+ * interface as the means of communication with the user level.
+ *
+ * IP/TCP/UDP checksumming routines
+ *
+ * Authors:Jorge Cwik, 
+ * Arnt Gulbrandsen, 
+ * Tom May, 
+ * Andreas Schwab, 
+ * Lots of code moved from tcp.c and ip.c; see those files
+ * for more names.
+ *
+ * 03/02/96Jes Sorensen, Andreas Schwab, Roman Hodek:
+ * Fixed some nasty bugs, causing some horrible crashes.
+ * A: At some points, the sum (%0) was used as
+ * length-counter instead of the length counter
+ * (%1). Thanks 

[PATCH v9 17/17] Add H8/300 entry

2015-04-26 Thread Yoshinori Sato
Signed-off-by: Yoshinori Sato 
---
 CREDITS |  5 -
 MAINTAINERS | 11 +++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/CREDITS b/CREDITS
index 40cc4bf..e88b597 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3219,11 +3219,6 @@ N: Dipankar Sarma
 E: dipan...@in.ibm.com
 D: RCU
 
-N: Yoshinori Sato
-E: ys...@users.sourceforge.jp
-D: uClinux for Renesas H8/300 (H8300)
-D: http://uclinux-h8.sourceforge.jp/
-
 N: Hannu Savolainen
 E: ha...@opensound.com
 D: Maintainer of the sound drivers until 2.1.x days.
diff --git a/MAINTAINERS b/MAINTAINERS
index 2e5bbc0..3c9c6f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4473,6 +4473,17 @@ T:   git git://linuxtv.org/media_tree.git
 S: Maintained
 F: drivers/media/usb/stk1160/
 
+H8/300 ARCHITECTURE
+M: Yoshinori Sato 
+L: uclinux-h8-de...@lists.sourceforge.jp
+W: http://uclinux-h8.sourceforge.jp
+T: git git://git.sourceforge.jp/gitroot/uclinux-h8/linux.git
+S: Maintained
+F: arch/h8300/
+F: drivers/clocksource/h8300/
+F: drivers/clk/clk-h83069.c
+F: drivers/clk/clk-h8s2678.c
+
 HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
 M: Frank Seidel 
 L: platform-driver-...@vger.kernel.org
-- 
2.1.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/


[PATCH v9 15/17] Add ELF machine

2015-04-26 Thread Yoshinori Sato
Signed-off-by: Yoshinori Sato 
---
 include/uapi/linux/elf-em.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index ae99f77..b088296 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -25,6 +25,7 @@
 #define EM_ARM 40  /* ARM 32 bit */
 #define EM_SH  42  /* SuperH */
 #define EM_SPARCV9 43  /* SPARC v9 64-bit */
+#define EM_H8_300  46  /* Renesas H8/300 */
 #define EM_IA_64   50  /* HP/Intel IA-64 */
 #define EM_X86_64  62  /* AMD x86-64 */
 #define EM_S39022  /* IBM S/390 */
-- 
2.1.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/


[PATCH v9 16/17] mksysmap: Add h8300 local symbol pattern

2015-04-26 Thread Yoshinori Sato
h8300's nm output have a lot of local symbols.
ex)
 N .Lframe0
0013 N .LLST1
0026 N .LLST2
0039 N .LLST3
004c N .LLST4
Added new pattern " .L" to filter rule.

Signed-off-by: Yoshinori Sato 
---
 scripts/mksysmap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/mksysmap b/scripts/mksysmap
index 7ada35a..a35acc0 100755
--- a/scripts/mksysmap
+++ b/scripts/mksysmap
@@ -41,4 +41,4 @@
 # so we just ignore them to let readprofile continue to work.
 # (At least sparc64 has __crc_ in the middle).
 
-$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2
+$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2
-- 
2.1.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/


[PATCH v9 14/17] serial: Add H8300.

2015-04-26 Thread Yoshinori Sato
h8300 internal serial controller of same as sh-sci.
So h8300 use SH_SCI.

Signed-off-by: Yoshinori Sato 
---
 drivers/tty/serial/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index f8120c1..130f201 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -728,7 +728,7 @@ config SERIAL_IP22_ZILOG_CONSOLE
 
 config SERIAL_SH_SCI
tristate "SuperH SCI(F) serial port support"
-   depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
+   depends on SUPERH || ARCH_SHMOBILE || H8300 || COMPILE_TEST 
select SERIAL_CORE
 
 config SERIAL_SH_SCI_NR_UARTS
-- 
2.1.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/


[PATCH v9 12/17] h8300: clocksource

2015-04-26 Thread Yoshinori Sato
H8/300 internal timer driver.
h8300_timer8 - 8bit Timer driver.
h8300_timer16 - 16bit Timer driver (only H8/3069).
h8300_tpu - Timer Pulse Unit driver (only H8S2678).

Signed-off-by: Yoshinori Sato 
---
 drivers/clocksource/Kconfig |   6 +
 drivers/clocksource/Makefile|   3 +
 drivers/clocksource/h8300_timer16.c | 332 ++
 drivers/clocksource/h8300_timer8.c  | 398 
 drivers/clocksource/h8300_tpu.c | 203 ++
 5 files changed, 942 insertions(+)
 create mode 100644 drivers/clocksource/h8300_timer16.c
 create mode 100644 drivers/clocksource/h8300_timer8.c
 create mode 100644 drivers/clocksource/h8300_tpu.c

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 51d7865f..96e2513 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -258,4 +258,10 @@ config CLKSRC_PXA
help
  This enables OST0 support available on PXA and SA-11x0
  platforms.
+config H8300_TMR16
+bool
+
+config H8300_TPU
+bool
+
 endmenu
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 5b85f6a..8288c4e 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -52,3 +52,6 @@ obj-$(CONFIG_ARCH_INTEGRATOR_AP)  += timer-integrator-ap.o
 obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o
 obj-$(CONFIG_CLKSRC_MIPS_GIC)  += mips-gic-timer.o
 obj-$(CONFIG_ASM9260_TIMER)+= asm9260_timer.o
+obj-$(CONFIG_H8300)+= h8300_timer8.o
+obj-$(CONFIG_H8300_TMR16)  += h8300_timer16.o
+obj-$(CONFIG_H8300_TPU)+= h8300_tpu.o
diff --git a/drivers/clocksource/h8300_timer16.c 
b/drivers/clocksource/h8300_timer16.c
new file mode 100644
index 000..5427cd0
--- /dev/null
+++ b/drivers/clocksource/h8300_timer16.c
@@ -0,0 +1,332 @@
+/*
+ *  linux/arch/h8300/kernel/timer/timer16.c
+ *
+ *  Yoshinori Sato 
+ *
+ *  16bit Timer clockevent device
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define TSTR   0
+#define TSNC   1
+#define TMDR   2
+#define TOLR   3
+#define TISRA  4
+#define TISRB  5
+#define TISRC  6
+
+#define TCR0
+#define TIOR   1
+#define TCNT   2
+#define GRA4
+#define GRB6
+
+#define FLAG_REPROGRAM (1 << 0)
+#define FLAG_SKIPEVENT (1 << 1)
+#define FLAG_IRQCONTEXT (1 << 2)
+#define FLAG_STARTED (1 << 3)
+
+#define ONESHOT  0
+#define PERIODIC 1
+
+#define RELATIVE 0
+#define ABSOLUTE 1
+
+struct timer16_priv {
+   struct platform_device *pdev;
+   struct clock_event_device ced;
+   struct irqaction irqaction;
+   unsigned long mapbase;
+   unsigned long mapcommon;
+   unsigned long flags;
+   unsigned int rate;
+   unsigned short gra;
+   unsigned char enb;
+   unsigned char imfa;
+   unsigned char imiea;
+   unsigned char ovf;
+   raw_spinlock_t lock;
+   struct clk *clk;
+};
+
+static unsigned long timer16_get_counter(struct timer16_priv *p)
+{
+   unsigned long v1, v2, v3;
+   int o1, o2;
+
+   o1 = ctrl_inb(p->mapcommon + TISRC) & p->ovf;
+
+   /* Make sure the timer value is stable. Stolen from acpi_pm.c */
+   do {
+   o2 = o1;
+   v1 = ctrl_inw(p->mapbase + TCNT);
+   v2 = ctrl_inw(p->mapbase + TCNT);
+   v3 = ctrl_inw(p->mapbase + TCNT);
+   o1 = ctrl_inb(p->mapcommon + TISRC) & p->ovf;
+   } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3)
+ || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2)));
+
+   v2 |= 0x1;
+   return v2;
+}
+
+
+static irqreturn_t timer16_interrupt(int irq, void *dev_id)
+{
+   struct timer16_priv *p = (struct timer16_priv *)dev_id;
+
+   ctrl_outb(ctrl_inb(p->mapcommon + TISRA) & ~p->imfa,
+ p->mapcommon + TISRA);
+
+   p->flags |= FLAG_IRQCONTEXT;
+   ctrl_outw(p->gra, p->mapbase + GRA);
+   if (!(p->flags & FLAG_SKIPEVENT)) {
+   if (p->ced.mode == CLOCK_EVT_MODE_ONESHOT) {
+   ctrl_outb(ctrl_inb(p->mapcommon + TSTR) & ~p->enb,
+ p->mapcommon + TISRA);
+   }
+   p->ced.event_handler(&p->ced);
+   }
+
+   p->flags &= ~(FLAG_SKIPEVENT | FLAG_IRQCONTEXT);
+
+   return IRQ_HANDLED;
+}
+
+static void timer16_set_next(struct timer16_priv *p, unsigned long delta)
+{
+   unsigned long flags;
+   unsigned long now;
+
+   raw_spin_lock_irqsave(&p->lock, flags);
+   if (delta >= 0x1)
+   dev_warn(&p->pdev->dev, "delta out of range\n");
+   now = timer16_get_counter(p);
+   p->gra = delta;
+   ctrl_outb(ctrl_inb(p->mapcommon + TISRA) | p->imiea,
+ p->mapcommon + TISRA);
+   if (delta > now)
+   c

[PATCH v9 11/17] h8300: clock driver

2015-04-26 Thread Yoshinori Sato
h8300 clock generator drivers.
H8/3069 is simple oscillator.
H8S2678 is PLL multiplier support.

Signed-off-by: Yoshinori Sato 
---
 drivers/clk/Makefile|   1 +
 drivers/clk/h8300/Makefile  |   2 +
 drivers/clk/h8300/clk-h83069.c  |  80 +++
 drivers/clk/h8300/clk-h8s2678.c | 171 
 include/linux/clk-provider.h|  12 +++
 5 files changed, 266 insertions(+)
 create mode 100644 drivers/clk/h8300/Makefile
 create mode 100644 drivers/clk/h8300/clk-h83069.c
 create mode 100644 drivers/clk/h8300/clk-h8s2678.c

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 3d00c25..9df871d 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -73,3 +73,4 @@ obj-$(CONFIG_ARCH_U8500)  += ux500/
 obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/
 obj-$(CONFIG_X86)  += x86/
 obj-$(CONFIG_ARCH_ZYNQ)+= zynq/
+obj-$(CONFIG_H8300)+= h8300/
diff --git a/drivers/clk/h8300/Makefile b/drivers/clk/h8300/Makefile
new file mode 100644
index 000..82eab42
--- /dev/null
+++ b/drivers/clk/h8300/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_H83069) += clk-h83069.o
+obj-$(CONFIG_H8S2678) += clk-h8s2678.o
diff --git a/drivers/clk/h8300/clk-h83069.c b/drivers/clk/h8300/clk-h83069.c
new file mode 100644
index 000..0a20dd5
--- /dev/null
+++ b/drivers/clk/h8300/clk-h83069.c
@@ -0,0 +1,80 @@
+/*
+ * H8/3069 clock driver
+ *
+ * Copyright 2015 Yoshinori Sato 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static DEFINE_SPINLOCK(clklock);
+
+#define DIVCR ((unsigned char *)0xfee01b)
+#define DEVNAME "h83069-cpg"
+
+static int clk_probe(struct platform_device *pdev)
+{
+   struct clk *clk;
+   int *hz = dev_get_platdata(&pdev->dev);
+
+   clk = clk_register_fixed_rate(&pdev->dev, "master_clk", NULL,
+ CLK_IS_ROOT, *hz);
+   if (IS_ERR(clk)) {
+   dev_err(&pdev->dev, "failed to register clock");
+   return PTR_ERR(clk);
+   }
+   clk_register_clkdev(clk, "master_clk", DEVNAME ".%d", 0);
+
+   clk = clk_register_divider(&pdev->dev, "core_clk", "master_clk",
+  CLK_SET_RATE_GATE, DIVCR, 0, 2,
+  CLK_DIVIDER_POWER_OF_TWO, &clklock);
+   if (IS_ERR(clk)) {
+   dev_err(&pdev->dev, "failed to register clock");
+   return PTR_ERR(clk);
+   }
+   clk_register_clkdev(clk, "core_clk", DEVNAME ".%d", 0);
+
+   clk = clk_register_fixed_factor(&pdev->dev, "peripheral_clk", 
"core_clk",
+   0, 1, 1);
+   if (IS_ERR(clk)) {
+   dev_err(&pdev->dev, "failed to register clock");
+   return PTR_ERR(clk);
+   }
+   clk_register_clkdev(clk, "peripheral_clk", NULL);
+   return 0;
+}
+
+static struct platform_driver cpg_driver = {
+   .driver = {
+   .name = DEVNAME,
+   },
+   .probe = clk_probe,
+};
+
+early_platform_init(DEVNAME, &cpg_driver);
+
+static struct platform_device clk_device = {
+   .name   = DEVNAME,
+   .id = 0,
+};
+
+static struct platform_device *devices[] __initdata = {
+   &clk_device,
+};
+
+int __init h8300_clk_init(int hz)
+{
+   static int master_hz;
+
+   master_hz = hz;
+   clk_device.dev.platform_data = &master_hz;
+   early_platform_add_devices(devices,
+  ARRAY_SIZE(devices));
+   early_platform_driver_register_all(DEVNAME);
+   early_platform_driver_probe(DEVNAME, 1, 0);
+   return 0;
+}
diff --git a/drivers/clk/h8300/clk-h8s2678.c b/drivers/clk/h8300/clk-h8s2678.c
new file mode 100644
index 000..55b490c
--- /dev/null
+++ b/drivers/clk/h8300/clk-h8s2678.c
@@ -0,0 +1,171 @@
+/*
+ * H8S2678 clock driver
+ *
+ * Copyright 2015 Yoshinori Sato 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static DEFINE_SPINLOCK(clklock);
+
+#define SCKCR 0x3b
+#define PLLCR 0x45
+#define DEVNAME "h8s2678-cpg"
+#define MAX_FREQ 
+#define MIN_FREQ  800
+
+static unsigned long pll_recalc_rate(struct clk_hw *hw,
+   unsigned long parent_rate)
+{
+   int mul = 1 << (ctrl_inb(PLLCR) & 3);
+
+   return parent_rate * mul;
+}
+
+static long pll_round_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long *prate)
+{
+   int i, m = -1;
+   long offset[3];
+
+   if (rate > MAX_FREQ)
+   rate = MAX_FREQ;
+   if (rate < MIN_FREQ)
+   rate = MIN_FREQ;
+
+   for (i = 0; i < 3; i++)
+   offset[i] = abs(rate - (*prate * (1 << i)));
+   for (i = 0; i < 3; i++)
+   if (m < 0)
+   m = i;
+   else
+   m = (offset[i] < offset[m])?i:m;
+
+   return *prate * (1 << m);
+}
+
+static int pll_s

[PATCH v9 08/17] h8300: Memory management

2015-04-26 Thread Yoshinori Sato
Signed-off-by: Yoshinori Sato 
---
 arch/h8300/mm/Makefile |   5 ++
 arch/h8300/mm/fault.c  |  57 +
 arch/h8300/mm/init.c   | 133 +
 arch/h8300/mm/kmap.c   |  61 +++
 arch/h8300/mm/memory.c |  53 
 5 files changed, 309 insertions(+)
 create mode 100644 arch/h8300/mm/Makefile
 create mode 100644 arch/h8300/mm/fault.c
 create mode 100644 arch/h8300/mm/init.c
 create mode 100644 arch/h8300/mm/kmap.c
 create mode 100644 arch/h8300/mm/memory.c

diff --git a/arch/h8300/mm/Makefile b/arch/h8300/mm/Makefile
new file mode 100644
index 000..117d71f
--- /dev/null
+++ b/arch/h8300/mm/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the linux h8300-specific parts of the memory manager.
+#
+
+obj-y   := init.o fault.o memory.o kmap.o
diff --git a/arch/h8300/mm/fault.c b/arch/h8300/mm/fault.c
new file mode 100644
index 000..5924ff5
--- /dev/null
+++ b/arch/h8300/mm/fault.c
@@ -0,0 +1,57 @@
+/*
+ *  linux/arch/h8300/mm/fault.c
+ *
+ *  Copyright (C) 1998  D. Jeff Dionne ,
+ *  Copyright (C) 2000  Lineo, Inc.  (www.lineo.com)
+ *
+ *  Based on:
+ *
+ *  linux/arch/m68knommu/mm/fault.c
+ *  linux/arch/m68k/mm/fault.c
+ *
+ *  Copyright (C) 1995  Hamish Macdonald
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+void die(const char *str, struct pt_regs *fp, unsigned long err);
+
+/*
+ * This routine handles page faults.  It determines the problem, and
+ * then passes it off to one of the appropriate routines.
+ *
+ * error_code:
+ * bit 0 == 0 means no page found, 1 means protection fault
+ * bit 1 == 0 means read, 1 means write
+ *
+ * If this routine detects a bad access, it returns 1, otherwise it
+ * returns 0.
+ */
+asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
+ unsigned long error_code)
+{
+#ifdef DEBUG
+   pr_debug("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n",
+regs->sr, regs->pc, address, error_code);
+#endif
+
+/*
+ * Oops. The kernel tried to access some bad page. We'll have to
+ * terminate things with extreme prejudice.
+ */
+   if ((unsigned long) address < PAGE_SIZE)
+   pr_alert("Unable to handle kernel NULL pointer dereference");
+   else
+   pr_alert("Unable to handle kernel access");
+   printk(" at virtual address %08lx\n", address);
+   if (!user_mode(regs))
+   die("Oops", regs, error_code);
+   do_exit(SIGKILL);
+
+   return 1;
+}
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
new file mode 100644
index 000..98028b1
--- /dev/null
+++ b/arch/h8300/mm/init.c
@@ -0,0 +1,133 @@
+/*
+ *  linux/arch/h8300/mm/init.c
+ *
+ *  Copyright (C) 1998  D. Jeff Dionne ,
+ *  Kenneth Albanowski ,
+ *  Copyright (C) 2000  Lineo, Inc.  (www.lineo.com)
+ *
+ *  Based on:
+ *
+ *  linux/arch/m68knommu/mm/init.c
+ *  linux/arch/m68k/mm/init.c
+ *
+ *  Copyright (C) 1995  Hamish Macdonald
+ *
+ *  JAN/1999 -- hacked to support ColdFire (g...@snapgear.com)
+ *  DEC/2000 -- linux 2.4 support 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * BAD_PAGE is the page that is used for page faults when linux
+ * is out-of-memory. Older versions of linux just did a
+ * do_exit(), but using this instead means there is less risk
+ * for a process dying in kernel mode, possibly leaving a inode
+ * unused etc..
+ *
+ * BAD_PAGETABLE is the accompanying page-table: it is initialized
+ * to point to BAD_PAGE entries.
+ *
+ * ZERO_PAGE is a special page that is used for zero-initialized
+ * data and COW.
+ */
+static unsigned long empty_bad_page_table;
+static unsigned long empty_bad_page;
+unsigned long empty_zero_page;
+
+/*
+ * paging_init() continues the virtual memory environment setup which
+ * was begun by the code in arch/head.S.
+ * The parameters are pointers to where to stick the starting and ending
+ * addresses of available kernel virtual memory.
+ */
+void __init paging_init(void)
+{
+   /*
+* Make sure start_mem is page aligned,  otherwise bootmem and
+* page_alloc get different views og the world.
+*/
+   unsigned long start_mem = PAGE_ALIGN(memory_start);
+   unsigned long end_mem   = memory_end & PAGE_MASK;
+
+   pr_debug("start_mem is %#lx\nvirtual_end is %#lx\n",
+start_mem, end_mem);
+
+   /*
+* Initialize the bad page table and bad page to point
+* to a couple of allocated pages.
+*/
+   empty_bad_page_table = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
+   empty_bad_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
+   empty_zero_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
+   memset((void *)empty_zero_page, 0, P

[PATCH v9 00/17] Re-introduce h8300 architecture

2015-04-26 Thread Yoshinori Sato
Hello.
I will re-introducing h8300.

Changes for v9
- remove exec domain
- timer update
- rebase to v4.1-rc1

Changes for v8
- rebase to v4.0

Changes for v7
- Add MAINTAINERS

Changes for v6
- rebase to v4.0-rc3
- remove unused headers
- optimized atomic operation
- System.map cleanup

Changes for v5
- Signal handling fix
- LD script cleanup

Changes for v4
- Remove signal mapping
- Organize Kconfig
- Coding style fix

Changes for v3
- Fix clone
- Add dma functions
- Add missing library
- Fix various errors

Changes for v2
- Use Common Clock Framework
- Use common unistd.h
- Use common ptrace function
- clocksource driver move to drivers/clocksource
- some cleanup

Changes for latest relase (v3.12)
- standard ELF toolchain (h8300-linux)
- use common driver support
- exception handling fix
- too many cleanup

git repository
git://git.sourceforge.jp/gitroot/uclinux-h8/linux.git h8300

Yoshinori Sato (17):
  h8300: Assembly headers.
  h8300: UAPI headers
  h8300: Exception and Interrupt handling
  h8300: kernel booting
  h8300: process and signals
  h8300: CPU depend helpers
  h8300: miscellaneous functions
  h8300: Memory management
  h8300: library functions
  h8300: Build scripts
  h8300: clock driver
  h8300: clocksource
  h8300: configs
  serial: Add H8300.
  Add ELF machine
  mksysmap: Add h8300 local symbol pattern
  Add H8/300 entry

 CREDITS|   5 -
 MAINTAINERS|  11 +
 arch/h8300/Kconfig |  73 +
 arch/h8300/Kconfig.cpu | 111 
 arch/h8300/Makefile|  45 
 arch/h8300/boot/Makefile   |  26 ++
 arch/h8300/boot/compressed/Makefile|  37 +++
 arch/h8300/boot/compressed/head.S  |  48 
 arch/h8300/boot/compressed/misc.c  |  74 ++
 arch/h8300/boot/compressed/vmlinux.lds |  32 +++
 arch/h8300/boot/compressed/vmlinux.scr |   9 +
 arch/h8300/configs/h8300h-sim_defconfig|  53 
 arch/h8300/configs/h8s-sim_defconfig   |  53 
 arch/h8300/include/asm/Kbuild  |  66 +
 arch/h8300/include/asm/asm-offsets.h   |   1 +
 arch/h8300/include/asm/atomic.h| 159 +++
 arch/h8300/include/asm/bitops.h| 185 +
 arch/h8300/include/asm/bootparams.h|  17 ++
 arch/h8300/include/asm/bug.h   |  12 +
 arch/h8300/include/asm/cache.h |  11 +
 arch/h8300/include/asm/checksum.h  | 102 +++
 arch/h8300/include/asm/cmpxchg.h   |  65 +
 arch/h8300/include/asm/delay.h |  38 +++
 arch/h8300/include/asm/device.h|   6 +
 arch/h8300/include/asm/dma-mapping.h   | 124 +
 arch/h8300/include/asm/elf.h   | 101 +++
 arch/h8300/include/asm/emergency-restart.h |   6 +
 arch/h8300/include/asm/flat.h  |  27 ++
 arch/h8300/include/asm/io.h| 314 ++
 arch/h8300/include/asm/irq.h   |  26 ++
 arch/h8300/include/asm/irqflags.h  |  96 +++
 arch/h8300/include/asm/mc146818rtc.h   |   9 +
 arch/h8300/include/asm/mutex.h |   9 +
 arch/h8300/include/asm/page.h  |  18 ++
 arch/h8300/include/asm/page_offset.h   |   2 +
 arch/h8300/include/asm/pci.h   |  19 ++
 arch/h8300/include/asm/pgtable.h   |  49 
 arch/h8300/include/asm/processor.h | 144 ++
 arch/h8300/include/asm/ptrace.h|  36 +++
 arch/h8300/include/asm/segment.h   |  49 
 arch/h8300/include/asm/signal.h|  22 ++
 arch/h8300/include/asm/smp.h   |   1 +
 arch/h8300/include/asm/spinlock.h  |   6 +
 arch/h8300/include/asm/string.h|  17 ++
 arch/h8300/include/asm/switch_to.h |  51 
 arch/h8300/include/asm/syscall.h   |  56 
 arch/h8300/include/asm/thread_info.h   | 108 
 arch/h8300/include/asm/timer.h |  31 +++
 arch/h8300/include/asm/tlb.h   |   8 +
 arch/h8300/include/asm/topology.h  |   6 +
 arch/h8300/include/asm/traps.h |  41 +++
 arch/h8300/include/asm/uaccess.h   | 136 ++
 arch/h8300/include/asm/unaligned.h |  11 +
 arch/h8300/include/asm/user.h  |  74 ++
 arch/h8300/include/uapi/asm/Kbuild |  29 ++
 arch/h8300/include/uapi/asm/auxvec.h   |   4 +
 arch/h8300/include/uapi/asm/byteorder.h|   6 +
 arch/h8300/include/uapi/asm/ptrace.h   |  42 +++
 arch/h8300/include/uapi/asm/sigcontext.h   |  18 ++
 arch/h8300/include/uapi/asm/signal.h   | 115 
 arch/h8300/include/uapi/asm/swab.h |   1 +
 arch/h8300/include/uapi/asm/unistd.h   |   3 +
 arch/h8300/kernel/Makefile |  16 ++
 arch/h8300/kernel/asm-offsets.c|  67 +
 arch/h8300/kernel/cpu/Makefile |   4 +
 arch/h8300/kernel/cpu/h83069/Makefile  |   1 +
 arch/h8300/kernel/cpu

RE: [PATCH] elevator: fix memory leak in ->elevator_init_fn

2015-04-26 Thread Chao Yu
Hi all,

I found that when we release eq->kobj by invoking kobject_put() we had gave
misson to workqueue, so that workqueue will release the elevator queue
space in elevator_alloc() which is registered in ->release of elv_ktype object.
We should not release it again.

So, this fix is wrong, please ignore this patch, sorry for the noisy!

Regards,

> -Original Message-
> From: Chao Yu [mailto:chao2...@samsung.com]
> Sent: Friday, April 24, 2015 10:09 AM
> To: 'ax...@kernel.dk'
> Cc: 'linux-kernel@vger.kernel.org'
> Subject: [PATCH] elevator: fix memory leak in ->elevator_init_fn
> 
> In ->elevator_init_fn, if we fail to call kzalloc_node, we should release
> elevator queue space which is allocated previously, otherwise it will cause
> memory leak.
> 
> Signed-off-by: Chao Yu 
> ---
>  block/cfq-iosched.c  | 1 +
>  block/deadline-iosched.c | 1 +
>  block/noop-iosched.c | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index 5da8e6e..2793fb7 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -4391,6 +4391,7 @@ static int cfq_init_queue(struct request_queue *q, 
> struct elevator_type
> *e)
>   cfqd = kzalloc_node(sizeof(*cfqd), GFP_KERNEL, q->node);
>   if (!cfqd) {
>   kobject_put(&eq->kobj);
> + kfree(eq);
>   return -ENOMEM;
>   }
>   eq->elevator_data = cfqd;
> diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
> index a753df2..bc6d7d9 100644
> --- a/block/deadline-iosched.c
> +++ b/block/deadline-iosched.c
> @@ -349,6 +349,7 @@ static int deadline_init_queue(struct request_queue *q, 
> struct elevator_type
> *e)
>   dd = kzalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
>   if (!dd) {
>   kobject_put(&eq->kobj);
> + kfree(eq);
>   return -ENOMEM;
>   }
>   eq->elevator_data = dd;
> diff --git a/block/noop-iosched.c b/block/noop-iosched.c
> index 3de89d4..1399c78 100644
> --- a/block/noop-iosched.c
> +++ b/block/noop-iosched.c
> @@ -71,6 +71,7 @@ static int noop_init_queue(struct request_queue *q, struct 
> elevator_type *e)
>   nd = kmalloc_node(sizeof(*nd), GFP_KERNEL, q->node);
>   if (!nd) {
>   kobject_put(&eq->kobj);
> + kfree(eq);
>   return -ENOMEM;
>   }
>   eq->elevator_data = nd;
> --
> 2.3.3


--
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] [media] xilinx: Reflect dma header file move

2015-04-26 Thread Guenter Roeck

On 04/26/2015 10:22 PM, Michal Simek wrote:

On 04/24/2015 09:24 PM, Guenter Roeck wrote:

Commit 937abe88aea3 ("dmaengine: xilinx-dma: move header file to common
location") moved xilinx_dma.h to a common location but neglected to reflect
this move in all its users.

This causes compile errors for several builds.

drivers/media/platform/xilinx/xilinx-dma.c:15:35:
fatal error: linux/amba/xilinx_dma.h: No such file or directory

Cc: Kedareswara rao Appana 
Fixes: 937abe88aea3 ("dmaengine: xilinx-dma: move header file to common
location")
Signed-off-by: Guenter Roeck 
---
  drivers/media/platform/xilinx/xilinx-dma.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


FYI:
http://www.serverphorums.com/read.php?12,1179281

https://lkml.org/lkml/2015/4/25/25



Yes, I noticed Stephen's patch in mainline.

Guenter


--
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/8] rtl8712: don't duplicate ieee80211 constants for status/reason

2015-04-26 Thread Paul Gortmaker
These are all defined as a part of the standard and should not be
duplicated on a per-driver basis.  Use the global ones and delete the
local ones.

It seems that ieee80211 was already included everywhere it was needed,
since no explicit include <...> were needed to be added in order to
preserve getting a successful compile.

This isn't the totality of duplicated data removed, but it is a start.

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8712/ieee80211.h | 29 -
 1 file changed, 29 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.h 
b/drivers/staging/rtl8712/ieee80211.h
index 8269be80437a..6e813a9c1aa2 100644
--- a/drivers/staging/rtl8712/ieee80211.h
+++ b/drivers/staging/rtl8712/ieee80211.h
@@ -314,35 +314,6 @@ struct ieee80211_snap_hdr {
 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
 #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
 
-/* Status codes */
-#define WLAN_STATUS_SUCCESS 0
-#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
-#define WLAN_STATUS_CAPS_UNSUPPORTED 10
-#define WLAN_STATUS_REASSOC_NO_ASSOC 11
-#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
-#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
-#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
-#define WLAN_STATUS_CHALLENGE_FAIL 15
-#define WLAN_STATUS_AUTH_TIMEOUT 16
-#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
-#define WLAN_STATUS_ASSOC_DENIED_RATES 18
-/* 802.11b */
-#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
-#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
-#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
-
-/* Reason codes */
-#define WLAN_REASON_UNSPECIFIED 1
-#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
-#define WLAN_REASON_DEAUTH_LEAVING 3
-#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
-#define WLAN_REASON_DISASSOC_AP_BUSY 5
-#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
-#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
-#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
-#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
-
-
 /* Information Element IDs */
 #define WLAN_EID_SSID 0
 #define WLAN_EID_SUPP_RATES 1
-- 
2.2.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/8] rtl8192u: delete another embedded instance of generic reason codes

2015-04-26 Thread Paul Gortmaker
We have global copies of all these reason codes.  We don't need local
copies.  Worse is that these seem totally unused; a grep for some of
the fields comes up empty, and it still compiles after its complete
removal.

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 48 --
 1 file changed, 48 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 960769bfa15f..702bef6e2f56 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -188,54 +188,6 @@ typedef struct cb_desc {
 #define MGN_MCS14   0x8e
 #define MGN_MCS15   0x8f
 
-//
-// 802.11 Management frame Reason Code field
-//
-enum   _ReasonCode{
-   unspec_reason   = 0x1,
-   auth_not_valid  = 0x2,
-   deauth_lv_ss= 0x3,
-   inactivity  = 0x4,
-   ap_overload = 0x5,
-   class2_err  = 0x6,
-   class3_err  = 0x7,
-   disas_lv_ss = 0x8,
-   asoc_not_auth   = 0x9,
-
-   //MIC_CHECK
-   mic_failure = 0xe,
-   //END MIC_CHECK
-
-   // Reason code defined in 802.11i D10.0 p.28.
-   invalid_IE  = 0x0d,
-   four_way_tmout  = 0x0f,
-   two_way_tmout   = 0x10,
-   IE_dismatch = 0x11,
-   invalid_Gcipher = 0x12,
-   invalid_Pcipher = 0x13,
-   invalid_AKMP= 0x14,
-   unsup_RSNIEver = 0x15,
-   invalid_RSNIE   = 0x16,
-   auth_802_1x_fail= 0x17,
-   ciper_reject= 0x18,
-
-   // Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. Added by Annie, 
2005-11-15.
-   QoS_unspec  = 0x20, // 32
-   QAP_bandwidth   = 0x21, // 33
-   poor_condition  = 0x22, // 34
-   no_facility = 0x23, // 35
-   // Where is 36???
-   req_declined= 0x25, // 37
-   invalid_param   = 0x26, // 38
-   req_not_honored= 0x27,  // 39
-   TS_not_created  = 0x2F, // 47
-   DL_not_allowed  = 0x30, // 48
-   dest_not_exist  = 0x31, // 49
-   dest_not_QSTA   = 0x32, // 50
-};
-
-
-
 #define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A || \
priv->ieee80211->current_network.mode == IEEE_N_24G || \
priv->ieee80211->current_network.mode == IEEE_N_5G) ? \
-- 
2.2.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 0/8] staging/rtl8xxx: delete ieee80211 constant duplication

2015-04-26 Thread Paul Gortmaker
While looking at a non-staging wifi driver, I was searching for a constant
definition for an error code, and in addition to the expected one living
in the main include dir, I found a whole bunch of local copies in the
staging dir rtl8xxx wifi drivers.  This duplication covers the families
of WLAN_STATUS_ and WLAN_REASON_ values.

While one can understand that these things were wholesale copied at one
point to simplify out of tree building, we don't want duplicated stuff
for drivers that are in tree.  Even if they are in staging, they will
need cleanups like this if they ever want to get out of staging.

Some could be removed and trivially replaced with the associated include
of  but for a couple of others a couple of struct
fields had to be renamed to align with the main include first, and a
struct namespace collision between the main include and the local ones
had to be resolved to allow the duplicate constant removal as well.

Compile tested only, but the changes seem trivial enough so as to be
presumably zero runtime impact (famous last words)

---

Paul Gortmaker (8):
  rtl8188eu: don't duplicate ieee80211 constants for status/reason
  rtl8712: don't duplicate ieee80211 constants for status/reason
  rtl8192u: don't trample on  struct namespace
  rtl8192u: promote auth_mode to a full 8 bits
  rtl8192u: align local ieee80211_wmm_ac_param struct fields with global
  rtl8192u: don't duplicate ieee80211 constants for status/auth/reason
  rtl8192u: delete another embedded instance of generic reason codes
  rtl8192e: delete local copy of iee80211 reason codes.

 drivers/staging/rtl8188eu/core/rtw_ap.c|   2 +
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  |  10 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c  |   2 +
 drivers/staging/rtl8188eu/include/ieee80211.h  |  29 +---
 drivers/staging/rtl8188eu/include/wifi.h   |  77 --
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c |   2 +
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c   |   3 +-
 drivers/staging/rtl8192e/rtllib.h  |  39 -
 drivers/staging/rtl8192e/rtllib_softmac.c  |   3 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 171 +++--
 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  |  10 +-
 .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c  |  26 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  |  76 -
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |  32 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c  |  14 +-
 .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c|  48 +++---
 drivers/staging/rtl8192u/r8192U_core.c |  12 +-
 drivers/staging/rtl8712/ieee80211.h|  29 
 18 files changed, 150 insertions(+), 435 deletions(-)

-- 
2.2.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 4/8] rtl8192u: promote auth_mode to a full 8 bits

2015-04-26 Thread Paul Gortmaker
Currently LEAP is defined to two locally but the identically named
global constant is 128 in .  In order for us to
switch over to using the global value, we need to adjust the local
storage which is currently not enough to hold the larger value.

This is now consistent with the similar struct used in
drivers/net/wireless/ipw2x00/libipw.h and other drivers.

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index bdad6d07c574..f6db98c7824c 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -649,7 +649,7 @@ struct ieee80211_snap_hdr {
 /* Authentication algorithms */
 #define WLAN_AUTH_OPEN 0
 #define WLAN_AUTH_SHARED_KEY 1
-#define WLAN_AUTH_LEAP 2
+#define WLAN_AUTH_LEAP 128
 
 #define WLAN_AUTH_CHALLENGE_LEN 128
 
@@ -961,10 +961,10 @@ struct ieee80211_device;
 struct ieee80211_security {
u16 active_key:2,
enabled:1,
-   auth_mode:2,
auth_algo:4,
unicast_uses_group:1,
encrypt:1;
+   u8 auth_mode;
u8 key_sizes[WEP_KEYS];
u8 keys[WEP_KEYS][SCM_KEY_LEN];
u8 level;
-- 
2.2.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 1/8] rtl8188eu: don't duplicate ieee80211 constants for status/reason

2015-04-26 Thread Paul Gortmaker
These are all defined as a part of the standard and should not be
duplicated on a per-driver basis.  Use the global ones and delete the
local ones.

Note that a couple of them had slight wording differences, things like
INVALID vs. NOT_VALID or similar, so they are aligned with the global
naming conventions here, as dictated by compile testing.

This isn't the totality of duplicated data removed, but it is a start.

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c|  2 +
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  | 10 ++--
 drivers/staging/rtl8188eu/core/rtw_recv.c  |  2 +
 drivers/staging/rtl8188eu/include/ieee80211.h  | 29 +-
 drivers/staging/rtl8188eu/include/wifi.h   | 77 --
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c |  2 +
 6 files changed, 13 insertions(+), 109 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index e65ee6e858a8..1d3f72800492 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -19,6 +19,8 @@
  
**/
 #define _RTW_AP_C_
 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index be9e34a0daef..2da2e97647d6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -19,6 +19,8 @@
  
**/
 #define _RTW_MLME_EXT_C_
 
+#include 
+
 #include 
 #include 
 #include 
@@ -1048,10 +1050,10 @@ unsigned int OnAssocReq(struct adapter *padapter, 
struct recv_frame *precv_frame
pstat->wpa2_pairwise_cipher = 
pairwise_cipher&psecuritypriv->wpa2_pairwise_cipher;
 
if (!pstat->wpa2_group_cipher)
-   status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID;
+   status = WLAN_STATUS_INVALID_GROUP_CIPHER;
 
if (!pstat->wpa2_pairwise_cipher)
-   status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID;
+   status = WLAN_STATUS_INVALID_PAIRWISE_CIPHER;
} else {
status = WLAN_STATUS_INVALID_IE;
}
@@ -1069,10 +1071,10 @@ unsigned int OnAssocReq(struct adapter *padapter, 
struct recv_frame *precv_frame
pstat->wpa_pairwise_cipher = 
pairwise_cipher&psecuritypriv->wpa_pairwise_cipher;
 
if (!pstat->wpa_group_cipher)
-   status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID;
+   status = WLAN_STATUS_INVALID_GROUP_CIPHER;
 
if (!pstat->wpa_pairwise_cipher)
-   status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID;
+   status = WLAN_STATUS_INVALID_PAIRWISE_CIPHER;
} else {
status = WLAN_STATUS_INVALID_IE;
}
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index cda725a8f9cd..8501eb898824 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -19,6 +19,8 @@
  
**/
 #define _RTW_RECV_C_
 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index 8fd35dcdbb94..b129ad148b47 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -493,34 +493,7 @@ struct ieee80211_snap_hdr {
 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
 #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
 
-/* Status codes */
-#define WLAN_STATUS_SUCCESS 0
-#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
-#define WLAN_STATUS_CAPS_UNSUPPORTED 10
-#define WLAN_STATUS_REASSOC_NO_ASSOC 11
-#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
-#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
-#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
-#define WLAN_STATUS_CHALLENGE_FAIL 15
-#define WLAN_STATUS_AUTH_TIMEOUT 16
-#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
-#define WLAN_STATUS_ASSOC_DENIED_RATES 18
-/* 802.11b */
-#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
-#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
-#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
-
-/* Reason codes */
-#define WLAN_REASON_UNSPECIFIED 1
-#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
-#define WLAN_REASON_DEAUTH_LEAVING 3
-#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
-#define WLAN_REASON_DISASSOC_AP_BUSY 5
-#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
-#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
-#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
-

[PATCH 6/8] rtl8192u: don't duplicate ieee80211 constants for status/auth/reason

2015-04-26 Thread Paul Gortmaker
These are all defined as a part of the standard and should not be
duplicated on a per-driver basis.  Use the global ones and delete the
local ones.

In switching to  we have to delete a local copy of
an identical struct that we prepped earlier to have identical field
names, and we add explicit include <...> where needed in order to
preserve getting a successful compile.

This isn't the totality of duplicated data removed, but it is a start.

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 77 +-
 1 file changed, 1 insertion(+), 76 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 14ef5e193f2e..960769bfa15f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -34,6 +34,7 @@
 
 #include 
 #include 
+#include 
 
 #include "rtl819x_HT.h"
 #include "rtl819x_BA.h"
@@ -646,13 +647,6 @@ struct ieee80211_snap_hdr {
 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
 #define WLAN_GET_SEQ_SEQ(seq)  (((seq) & IEEE80211_SCTL_SEQ) >> 4)
 
-/* Authentication algorithms */
-#define WLAN_AUTH_OPEN 0
-#define WLAN_AUTH_SHARED_KEY 1
-#define WLAN_AUTH_LEAP 128
-
-#define WLAN_AUTH_CHALLENGE_LEN 128
-
 #define WLAN_CAPABILITY_BSS (1<<0)
 #define WLAN_CAPABILITY_IBSS (1<<1)
 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
@@ -671,69 +665,6 @@ struct ieee80211_snap_hdr {
 #define WLAN_ERP_USE_PROTECTION (1<<1)
 #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
 
-/* Status codes */
-enum ieee80211_statuscode {
-   WLAN_STATUS_SUCCESS = 0,
-   WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
-   WLAN_STATUS_CAPS_UNSUPPORTED = 10,
-   WLAN_STATUS_REASSOC_NO_ASSOC = 11,
-   WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
-   WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
-   WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
-   WLAN_STATUS_CHALLENGE_FAIL = 15,
-   WLAN_STATUS_AUTH_TIMEOUT = 16,
-   WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
-   WLAN_STATUS_ASSOC_DENIED_RATES = 18,
-   /* 802.11b */
-   WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
-   WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
-   WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
-   /* 802.11h */
-   WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
-   WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
-   WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
-   /* 802.11g */
-   WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
-   WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
-   /* 802.11i */
-   WLAN_STATUS_INVALID_IE = 40,
-   WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
-   WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
-   WLAN_STATUS_INVALID_AKMP = 43,
-   WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
-   WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
-   WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
-};
-
-/* Reason codes */
-enum ieee80211_reasoncode {
-   WLAN_REASON_UNSPECIFIED = 1,
-   WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
-   WLAN_REASON_DEAUTH_LEAVING = 3,
-   WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
-   WLAN_REASON_DISASSOC_AP_BUSY = 5,
-   WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
-   WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
-   WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
-   WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
-   /* 802.11h */
-   WLAN_REASON_DISASSOC_BAD_POWER = 10,
-   WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
-   /* 802.11i */
-   WLAN_REASON_INVALID_IE = 13,
-   WLAN_REASON_MIC_FAILURE = 14,
-   WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
-   WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
-   WLAN_REASON_IE_DIFFERENT = 17,
-   WLAN_REASON_INVALID_GROUP_CIPHER = 18,
-   WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
-   WLAN_REASON_INVALID_AKMP = 20,
-   WLAN_REASON_UNSUPP_RSN_VERSION = 21,
-   WLAN_REASON_INVALID_RSN_IE_CAP = 22,
-   WLAN_REASON_IEEE8021X_FAILED = 23,
-   WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
-};
-
 #define IEEE80211_STATMASK_SIGNAL (1<<0)
 #define IEEE80211_STATMASK_RSSI (1<<1)
 #define IEEE80211_STATMASK_NOISE (1<<2)
@@ -1276,12 +1207,6 @@ struct ieee80211_tim_parameters {
 } __packed;
 
 //#else
-struct ieee80211_wmm_ac_param {
-   u8 aci_aifsn;
-   u8 cw;
-   u16 txop_limit;
-};
-
 struct ieee80211_wmm_ts_info {
u8 ac_dir_tid;
u8 ac_up_psb;
-- 
2.2.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 8/8] rtl8192e: delete local copy of iee80211 reason codes.

2015-04-26 Thread Paul Gortmaker
This driver has a copy of the standard reason codes from the file
 but with slightly different name fields.

Delete the local copy and remap the only two use cases onto the names
used by the global implementation with the same values.

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c |  3 ++-
 drivers/staging/rtl8192e/rtllib.h| 39 
 drivers/staging/rtl8192e/rtllib_softmac.c|  3 ++-
 3 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 352d381b7c4a..ad0034575a18 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "rtl_core.h"
 #include "r8192E_phy.h"
 #include "r8192E_phyreg.h"
@@ -391,7 +392,7 @@ bool MgntActSet_RF_State(struct net_device *dev,
else
priv->blinked_ingpio = false;
rtllib_MgntDisconnect(priv->rtllib,
- disas_lv_ss);
+ 
WLAN_REASON_DISASSOC_STA_HAS_LEFT);
}
}
if ((ChangeSource == RF_CHANGE_BY_HW) && !priv->bHwRadioOff)
diff --git a/drivers/staging/rtl8192e/rtllib.h 
b/drivers/staging/rtl8192e/rtllib.h
index 3c8b708df5c3..bfec4fde01d1 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -261,45 +261,6 @@ struct sw_chnl_cmd {
 #defineMGN_MCS14_SG0x9e
 #defineMGN_MCS15_SG0x9f
 
-
-enum   _ReasonCode {
-   unspec_reason   = 0x1,
-   auth_not_valid  = 0x2,
-   deauth_lv_ss= 0x3,
-   inactivity  = 0x4,
-   ap_overload = 0x5,
-   class2_err  = 0x6,
-   class3_err  = 0x7,
-   disas_lv_ss = 0x8,
-   asoc_not_auth   = 0x9,
-
-   mic_failure = 0xe,
-
-   invalid_IE  = 0x0d,
-   four_way_tmout  = 0x0f,
-   two_way_tmout   = 0x10,
-   IE_dismatch = 0x11,
-   invalid_Gcipher = 0x12,
-   invalid_Pcipher = 0x13,
-   invalid_AKMP= 0x14,
-   unsup_RSNIEver = 0x15,
-   invalid_RSNIE   = 0x16,
-   auth_802_1x_fail = 0x17,
-   ciper_reject= 0x18,
-
-   QoS_unspec  = 0x20,
-   QAP_bandwidth   = 0x21,
-   poor_condition  = 0x22,
-   no_facility = 0x23,
-   req_declined= 0x25,
-   invalid_param   = 0x26,
-   req_not_honored = 0x27,
-   TS_not_created  = 0x2F,
-   DL_not_allowed  = 0x30,
-   dest_not_exist  = 0x31,
-   dest_not_QSTA   = 0x32,
-};
-
 enum hal_def_variable {
HAL_DEF_TPC_ENABLE,
HAL_DEF_INIT_GAIN,
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c 
b/drivers/staging/rtl8192e/rtllib_softmac.c
index 23b7a4c3b699..8f5e88b802c8 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "dot11d.h"
 
 short rtllib_is_54g(struct rtllib_network *net)
@@ -2983,7 +2984,7 @@ void rtllib_stop_protocol(struct rtllib_device *ieee, u8 
shutdown)
 
if (ieee->state == RTLLIB_LINKED) {
if (ieee->iw_mode == IW_MODE_INFRA)
-   SendDisassociation(ieee, 1, deauth_lv_ss);
+   SendDisassociation(ieee, 1, WLAN_REASON_DEAUTH_LEAVING);
rtllib_disassociate(ieee);
}
 
-- 
2.2.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 3/8] rtl8192u: don't trample on struct namespace

2015-04-26 Thread Paul Gortmaker
In order to start reducing the duplicated code/constants/macros in this
driver, we need to include  to provide the defacto
versions.  However this driver has structs with the same name as the
ones in the main include, so namespace collision prevents us from doing
step #1.

Since the structs actually differ in their respective fields, we can't
simply delete the local ones without impacting the runtime; a conversion
to use the global ones can be considered at a later date if desired.

Rename the ones here with a vendor specific prefix so that we won't have
the namespace collision, and hence can continue on with the cleanup.

Automated conversion done with:

for i in `find . -name '*.[ch]'` ; do \
  sed -i 's/struct ieee80211_hdr/struct rtl_80211_hdr/g' $i ; \
done

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 44 +++---
 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 10 ++--
 .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c  | 26 -
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  | 68 +++---
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c  | 14 ++---
 .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c| 48 +++
 drivers/staging/rtl8192u/r8192U_core.c | 12 ++--
 8 files changed, 127 insertions(+), 127 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 0f53c6a97578..bdad6d07c574 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -1020,20 +1020,20 @@ enum ieee80211_mfie {
 /* Minimal header; can be used for passing 802.11 frames with sufficient
  * information to determine what type of underlying data type is actually
  * stored in the data. */
-struct ieee80211_hdr {
+struct rtl_80211_hdr {
__le16 frame_ctl;
__le16 duration_id;
u8 payload[0];
 } __packed;
 
-struct ieee80211_hdr_1addr {
+struct rtl_80211_hdr_1addr {
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
u8 payload[0];
 } __packed;
 
-struct ieee80211_hdr_2addr {
+struct rtl_80211_hdr_2addr {
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
@@ -1041,7 +1041,7 @@ struct ieee80211_hdr_2addr {
u8 payload[0];
 } __packed;
 
-struct ieee80211_hdr_3addr {
+struct rtl_80211_hdr_3addr {
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
@@ -1051,7 +1051,7 @@ struct ieee80211_hdr_3addr {
u8 payload[0];
 } __packed;
 
-struct ieee80211_hdr_4addr {
+struct rtl_80211_hdr_4addr {
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
@@ -1062,7 +1062,7 @@ struct ieee80211_hdr_4addr {
u8 payload[0];
 } __packed;
 
-struct ieee80211_hdr_3addrqos {
+struct rtl_80211_hdr_3addrqos {
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
@@ -1073,7 +1073,7 @@ struct ieee80211_hdr_3addrqos {
__le16 qos_ctl;
 } __packed;
 
-struct ieee80211_hdr_4addrqos {
+struct rtl_80211_hdr_4addrqos {
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
@@ -1092,7 +1092,7 @@ struct ieee80211_info_element {
 } __packed;
 
 struct ieee80211_authentication {
-   struct ieee80211_hdr_3addr header;
+   struct rtl_80211_hdr_3addr header;
__le16 algorithm;
__le16 transaction;
__le16 status;
@@ -1101,18 +1101,18 @@ struct ieee80211_authentication {
 } __packed;
 
 struct ieee80211_disassoc {
-   struct ieee80211_hdr_3addr header;
+   struct rtl_80211_hdr_3addr header;
__le16 reason;
 } __packed;
 
 struct ieee80211_probe_request {
-   struct ieee80211_hdr_3addr header;
+   struct rtl_80211_hdr_3addr header;
/* SSID, supported rates */
struct ieee80211_info_element info_element[0];
 } __packed;
 
 struct ieee80211_probe_response {
-   struct ieee80211_hdr_3addr header;
+   struct rtl_80211_hdr_3addr header;
__le32 time_stamp[2];
__le16 beacon_interval;
__le16 capability;
@@ -1125,7 +1125,7 @@ struct ieee80211_probe_response {
 #define ieee80211_beacon ieee80211_probe_response
 
 struct ieee80211_assoc_request_frame {
-   struct ieee80211_hdr_3addr header;
+   struct rtl_80211_hdr_3addr header;
__le16 capability;
__le16 listen_interval;
/* SSID, supported rates, RSN */
@@ -1133,7 +1133,7 @@ struct ieee80211_assoc_request_frame {
 } __packed;
 
 struct ieee80211_reassoc_request_frame {
-   struct ieee80211_hdr_3addr header;
+   struct rtl_80211_hdr_3addr header;
__le16 capability;
__le16 listen_interval;
u8 current_ap[ETH_ALEN];
@@ -1142,7 +1142,7 @@ struct ieee80211_reassoc_request_frame {
 } __packed;
 
 struct ieee80211_assoc_response_frame {
-   struct ie

[PATCH 5/8] rtl8192u: align local ieee80211_wmm_ac_param struct fields with global

2015-04-26 Thread Paul Gortmaker
The  and this local file both have a struct of the
same name.  They also have the same field sizes and generally the
same fields, as can be seen here:

   ~/git/linux-head$ git grep -A4 'struct ieee80211_wmm_ac_param {'
   drivers/staging/rtl8192u/ieee80211/ieee80211.h:struct ieee80211_wmm_ac_param 
{
   drivers/staging/rtl8192u/ieee80211/ieee80211.h- u8 ac_aci_acm_aifsn;
   drivers/staging/rtl8192u/ieee80211/ieee80211.h- u8 ac_ecwmin_ecwmax;
   drivers/staging/rtl8192u/ieee80211/ieee80211.h- u16 ac_txop_limit;
   drivers/staging/rtl8192u/ieee80211/ieee80211.h-};
   --
   include/linux/ieee80211.h:struct ieee80211_wmm_ac_param {
   include/linux/ieee80211.h-  u8 aci_aifsn; /* AIFSN, ACM, ACI */
   include/linux/ieee80211.h-  u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
   include/linux/ieee80211.h-  __le16 txop_limit;
   include/linux/ieee80211.h-} __packed;
   ~/git/linux-head$

Here we just align the local field names with the main system one.  Then
we can add an include of the system one and delete the local copy in one
smooth step in a follow-on commit.

Not that the replacement:

 for i in `find . -name '*.[ch]'` ; do sed -i 's/ac_aci_acm_aifsn/aci_aifsn/g' 
$i ; done
 for i in `find . -name '*.[ch]'` ; do sed -i 's/ac_ecwmin_ecwmax/cw/g' $i ; 
done
 for i in `find . -name '*.[ch]'` ; do sed -i 's/ac_txop_limit/txop_limit/g' $i 
; done

implicitly shows that only one of the three fields is currently used.

Signed-off-by: Paul Gortmaker 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h| 6 +++---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 8 
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index f6db98c7824c..14ef5e193f2e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -1277,9 +1277,9 @@ struct ieee80211_tim_parameters {
 
 //#else
 struct ieee80211_wmm_ac_param {
-   u8 ac_aci_acm_aifsn;
-   u8 ac_ecwmin_ecwmax;
-   u16 ac_txop_limit;
+   u8 aci_aifsn;
+   u8 cw;
+   u16 txop_limit;
 };
 
 struct ieee80211_wmm_ts_info {
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index e833687c7371..b374088c5ff8 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -2366,10 +2366,10 @@ static inline void update_network(struct 
ieee80211_network *dst,
 
/* dst->last_associate is not overwritten */
dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe 
response frame.
-   if (src->wmm_param[0].ac_aci_acm_aifsn|| \
-  src->wmm_param[1].ac_aci_acm_aifsn|| \
-  src->wmm_param[2].ac_aci_acm_aifsn|| \
-  src->wmm_param[3].ac_aci_acm_aifsn) {
+   if (src->wmm_param[0].aci_aifsn|| \
+  src->wmm_param[1].aci_aifsn|| \
+  src->wmm_param[2].aci_aifsn|| \
+  src->wmm_param[3].aci_aifsn) {
  memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
}
//dst->QoS_Enable = src->QoS_Enable;
-- 
2.2.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] [media] xilinx: Reflect dma header file move

2015-04-26 Thread Michal Simek
On 04/24/2015 09:24 PM, Guenter Roeck wrote:
> Commit 937abe88aea3 ("dmaengine: xilinx-dma: move header file to common
> location") moved xilinx_dma.h to a common location but neglected to reflect
> this move in all its users.
> 
> This causes compile errors for several builds.
> 
> drivers/media/platform/xilinx/xilinx-dma.c:15:35:
>   fatal error: linux/amba/xilinx_dma.h: No such file or directory
> 
> Cc: Kedareswara rao Appana 
> Fixes: 937abe88aea3 ("dmaengine: xilinx-dma: move header file to common
>   location")
> Signed-off-by: Guenter Roeck 
> ---
>  drivers/media/platform/xilinx/xilinx-dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

FYI:
http://www.serverphorums.com/read.php?12,1179281

https://lkml.org/lkml/2015/4/25/25

Thanks,
Michal
--
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 v3] dmaengine: xgene-dma: Fix sparse wannings and coccinelle warnings

2015-04-26 Thread Fengguang Wu
On Mon, Apr 27, 2015 at 08:43:15AM +0530, Vinod Koul wrote:
> On Mon, Apr 20, 2015 at 08:38:18AM +0530, Rameshwar Sahu wrote:
> > Hi Vinod,
> >> >> @@ -2085,6 +2043,5 @@ module_platform_driver(xgene_dma_driver);
> > >>
> > >>  MODULE_DESCRIPTION("APM X-Gene SoC DMA driver");
> > >>  MODULE_AUTHOR("Rameshwar Prasad Sahu ");
> > >> -MODULE_AUTHOR("Loc Ho ");
> > > And why this?
> > 
> > I saw below warning reported by the kbuild robot test
> > 
> > drivers/dma/xgene-dma.c:2088:1: sparse: symbol
> > '__UNIQUE_ID_author__COUNTER__' has multiple initializers (originally
> > initialized at drivers/dma/xgene-dma.c:2087)
> > So, I kept only one author here.
> No that is not right, sparse shouldn't have cribbed here.
> 
> Fengguang can we get the bot to ignore this please

OK, sorry for the noises! CC sparse maintainer btw.

Thanks,
Fengguang
--
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] block: turn Oops into WARNING if bdi_register_dev fails.

2015-04-26 Thread NeilBrown

add_disk() does not return an error status, but it can
still fail if there are problems elsewhere.

In particular a recent problem caused bdi_register_dev()
to sometimes fail because the name was already in use.

In that case bdi->dev is NULL, so

retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj,
   "bdi");

triggers an oops, after having already produced warnings.

This patch causes add_disk() to WARN and return if
bdi_register_dev() fails, much like it already does if
blk_alloc_devt() fails.

This should make no difference on a correctly functioning system, but
can make a developers life a bit easier.

Signed-off-by: NeilBrown 

diff --git a/block/genhd.c b/block/genhd.c
index 0a536dc05f3b..e351fc521053 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -612,6 +612,10 @@ void add_disk(struct gendisk *disk)
/* Register BDI before referencing it from bdev */
bdi = &disk->queue->backing_dev_info;
bdi_register_dev(bdi, disk_devt(disk));
+   if (!bdi->dev) {
+   WARN_ON(1);
+   return;
+   }
 
blk_register_region(disk_devt(disk), disk->minors, NULL,
exact_match, exact_lock, disk);


pgpDN8swpNffB.pgp
Description: OpenPGP digital signature


Re: [PATCH 1/8] cpufreq: arm_big_little: add cluster regulator support

2015-04-26 Thread Viresh Kumar
On 21 April 2015 at 18:47, Bartlomiej Zolnierkiewicz
 wrote:
> Add cluster regulator support as a preparation to adding
> generic arm_big_little_dt cpufreq_dt driver support for
> ODROID-XU3 board.  This allows arm_big_little[_dt] driver

This is irrelevant here, its not about XU3 but any board that
wants to use it..

> to set not only the frequency but also the voltage (which
> is obtained from operating point's voltage value) for CPU
> clusters.
>
> Cc: Kukjin Kim 
> Cc: Doug Anderson 
> Cc: Javier Martinez Canillas 
> Cc: Andreas Faerber 
> Cc: Sachin Kamat 
> Cc: Thomas Abraham 
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  .../bindings/cpufreq/arm_big_little_dt.txt |4 +
>  drivers/cpufreq/arm_big_little.c   |  153 
> +---
>  2 files changed, 139 insertions(+), 18 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt 
> b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
> index 0715695..8ca4a12 100644
> --- a/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
> +++ b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
> @@ -18,6 +18,10 @@ Required properties:
>  Optional properties:
>  - clock-latency: Specify the possible maximum transition latency for clock,
>in unit of nanoseconds.
> +- cpu-cluster.0-supply: Provides the regulator node supplying voltage to CPU
> +  cluster 0.
> +- cpu-cluster.1-supply: Provides the regulator node supplying voltage to CPU
> +  cluster 1.

I don't think you need these..

http://permalink.gmane.org/gmane.linux.power-management.general/58548

>  Examples:
>
> diff --git a/drivers/cpufreq/arm_big_little.c 
> b/drivers/cpufreq/arm_big_little.c
> index e1a6ba6..edb461b 100644
> --- a/drivers/cpufreq/arm_big_little.c
> +++ b/drivers/cpufreq/arm_big_little.c
> @@ -31,6 +31,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #include "arm_big_little.h"
> @@ -54,6 +55,9 @@ static bool bL_switching_enabled;
>
>  static struct cpufreq_arm_bL_ops *arm_bL_ops;
>  static struct clk *clk[MAX_CLUSTERS];
> +static struct regulator *reg[MAX_CLUSTERS];
> +static struct device *cpu_devs[MAX_CLUSTERS];
> +static int transition_latencies[MAX_CLUSTERS];
>  static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1];
>  static atomic_t cluster_usage[MAX_CLUSTERS + 1];
>
> @@ -122,7 +126,76 @@ static unsigned int bL_cpufreq_get_rate(unsigned int cpu)
> }
>  }
>
> -static unsigned int
> +static int
> +bL_cpufreq_set_rate_cluster(u32 cpu, u32 cluster, u32 new_rate)
> +{
> +   unsigned long volt = 0, volt_old = 0;
> +   long freq_Hz;
> +   u32 old_rate;
> +   int ret;
> +
> +   freq_Hz = new_rate * 1000;
> +   old_rate = clk_get_rate(clk[cluster]) / 1000;
> +
> +   if (!IS_ERR(reg[cluster])) {
> +   struct dev_pm_opp *opp;
> +   unsigned long opp_freq;
> +
> +   rcu_read_lock();
> +   opp = dev_pm_opp_find_freq_ceil(cpu_devs[cluster], &freq_Hz);
> +   if (IS_ERR(opp)) {
> +   rcu_read_unlock();
> +   pr_err("%s: cpu %d, cluster: %d, failed to find OPP 
> for %ld\n",
> +   __func__, cpu, cluster, freq_Hz);
> +   return PTR_ERR(opp);
> +   }
> +   volt = dev_pm_opp_get_voltage(opp);
> +   opp_freq = dev_pm_opp_get_freq(opp);
> +   rcu_read_unlock();
> +   volt_old = regulator_get_voltage(reg[cluster]);
> +   pr_debug("%s: cpu %d, cluster: %d, Found OPP: %ld kHz, %ld 
> uV\n",
> +   __func__, cpu, cluster, opp_freq / 1000, volt);
> +   }
> +
> +   pr_debug("%s: cpu %d, cluster: %d, %u MHz, %ld mV --> %u MHz, %ld 
> mV\n",
> +   __func__, cpu, cluster,
> +   old_rate / 1000, (volt_old > 0) ? volt_old / 1000 : -1,
> +   new_rate / 1000, volt ? volt / 1000 : -1);
> +
> +   /* scaling up? scale voltage before frequency */
> +   if (!IS_ERR(reg[cluster]) && new_rate > old_rate) {
> +   ret = regulator_set_voltage_tol(reg[cluster], volt, 0);
> +   if (ret) {
> +   pr_err("%s: cpu: %d, cluster: %d, failed to scale 
> voltage up: %d\n",
> +   __func__, cpu, cluster, ret);
> +   return ret;
> +   }
> +   }
> +
> +   ret = clk_set_rate(clk[cluster], new_rate * 1000);
> +   if (WARN_ON(ret)) {
> +   pr_err("%s: clk_set_rate failed: %d, cluster: %d\n",
> +   __func__, cluster, ret);
> +   if (!IS_ERR(reg[cluster]) && volt_old > 0)
> +   regulator_set_voltage_tol(reg[cluster], volt_old, 0);
> +   return ret;
> +   }
> +
> +   /* scaling down? scale voltage after frequency */
> +   if (!IS_ERR(reg[cluster]) && new_rate < old_ra

Re: [PATCHv2 2/8] perf probe: Improve detection of file/function name in the probe pattern

2015-04-26 Thread Naveen N. Rao
On 2015/03/13 08:20PM, Masami Hiramatsu wrote:
> (2015/03/13 5:24), Arnaldo Carvalho de Melo wrote:
> > Em Mon, Dec 15, 2014 at 08:20:32PM +0530, Naveen N. Rao escreveu:
> >> Currently, perf probe considers patterns including a '.' to be a file.
> >> However, this causes problems on powerpc ABIv1 where all functions have
> >> a leading '.':
> >>
> >>   $ perf probe -F | grep schedule_timeout_interruptible
> >>   .schedule_timeout_interruptible
> >>   $ perf probe .schedule_timeout_interruptible
> >>   Semantic error :File always requires line number or lazy pattern.
> >> Error: Command Parse Error.
> >>
> >> Fix this by checking the probe pattern in more detail.
> > 
> > Masami, can I have your Acked-by or Reviewed-by?
> 
> As far as I can see, this is not enough for fixing that issue.
> Could you fold the first half of [4/8] to this patch?
> I also have some comments on it. See below.

Masami, Arnaldo,
Thanks for the review. v3 patches forthcoming...

- Naveen

--
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: [PATCHv2 5/8] perf probe powerpc: Allow matching against dot symbols

2015-04-26 Thread Naveen N. Rao
On 2015/03/12 05:30PM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Dec 15, 2014 at 08:20:35PM +0530, Naveen N. Rao escreveu:
> > Allow perf probe to work on powerpc ABIv1 without the need to specify
> > the leading dot '.' for functions. 'perf probe do_fork' works with this
> > patch.
> > 
> > Introduce HAVE_ARCH_SYMBOL_HANDLING to indicate need for special
> > handling of symbols. In this patch, we override probe_function_filter()
> > on powerpc to account for dot symbols.
> 
> This one looks better, does arch specific stuff in tools/perf/arch,
> good, some nits below.
> 
> > Signed-off-by: Naveen N. Rao 
> > ---
> > Changes from the previous patchset:
> > Introduced arch helper to override the way probe function filter works.
> > 
> >  tools/perf/arch/powerpc/Makefile|  1 +
> >  tools/perf/arch/powerpc/util/sym-handling.c | 28 
> > 
> >  tools/perf/config/Makefile  |  1 +
> >  tools/perf/util/probe-event.c   | 10 +-
> >  tools/perf/util/probe-event.h   |  5 +
> >  5 files changed, 40 insertions(+), 5 deletions(-)
> >  create mode 100644 tools/perf/arch/powerpc/util/sym-handling.c
> > 
> > diff --git a/tools/perf/arch/powerpc/Makefile 
> > b/tools/perf/arch/powerpc/Makefile
> > index 6f7782b..1c3d435 100644
> > --- a/tools/perf/arch/powerpc/Makefile
> > +++ b/tools/perf/arch/powerpc/Makefile
> > @@ -3,4 +3,5 @@ PERF_HAVE_DWARF_REGS := 1
> >  LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
> >  LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
> >  endif
> > +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/sym-handling.o
> >  LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
> > diff --git a/tools/perf/arch/powerpc/util/sym-handling.c 
> > b/tools/perf/arch/powerpc/util/sym-handling.c
> > new file mode 100644
> > index 000..0a77825
> > --- /dev/null
> > +++ b/tools/perf/arch/powerpc/util/sym-handling.c
> > @@ -0,0 +1,28 @@
> > +/*
> > + * Special symbol handling for PowerPC:
> > + * - Handle dot symbols on ABIv1
> > + *
> > + * Copyright (C) 2014 Naveen N Rao, IBM Corporation.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License
> > + * as published by the Free Software Foundation; either version
> > + * 2 of the License, or (at your option) any later version.
> > + */
> > +
> > +#include "map.h"
> > +#include "symbol.h"
> > +#include "probe-event.h"
> > +
> > +int probe_function_filter(struct map *map __maybe_unused, struct symbol 
> > *sym)
> > +{
> > +   if (sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL) {
> > +   if ((strcmp(looking_function_name, sym->name) == 0) ||
> > +   (sym->name[0] == '.' && looking_function_name[0] != '.' &&
> > +strcmp(looking_function_name, sym->name+1) == 0)) {
> > +   num_matched_functions++;
> > +   return 0;
> > +   }
> > +   }
> > +   return 1;
> > +}
> > diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> > index 5d4b039..35cf934 100644
> > --- a/tools/perf/config/Makefile
> > +++ b/tools/perf/config/Makefile
> > @@ -383,6 +383,7 @@ ifeq ($(ARCH),powerpc)
> >ifndef NO_DWARF
> >  CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
> >endif
> > +  CFLAGS += -DHAVE_ARCH_SYMBOL_HANDLING
> 
> 
> Dunno about this naming, looks too general: SYMBOL_HANDLING, but can't
> come to some better one now, anyone?
> 
> >  endif
> >  
> >  ifndef NO_LIBUNWIND
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index 74b7fef..7eb9b27 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -50,6 +50,8 @@
> >  #define PERFPROBE_GROUP "probe"
> >  
> >  bool probe_event_dry_run;  /* Dry run flag */
> > +char *looking_function_name;
> > +int num_matched_functions;
> >  
> >  #define semantic_error(msg ...) pr_err("Semantic error :" msg)
> >  
> > @@ -2210,11 +2212,8 @@ static int __add_probe_trace_events(struct 
> > perf_probe_event *pev,
> > return ret;
> >  }
> >  
> > -static char *looking_function_name;
> > -static int num_matched_functions;
> > -
> > -static int probe_function_filter(struct map *map __maybe_unused,
> > - struct symbol *sym)
> > +#ifndef HAVE_ARCH_SYMBOL_HANDLING
> > +int probe_function_filter(struct map *map __maybe_unused, struct symbol 
> > *sym)
> >  {
> > if ((sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL) &&
> > strcmp(looking_function_name, sym->name) == 0) {
> > @@ -2223,6 +,7 @@ static int probe_function_filter(struct map *map 
> > __maybe_unused,
> > }
> > return 1;
> >  }
> > +#endif /* HAVE_ARCH_SYMBOL_HANDLING */
> 
> Can't we do something like providing a weak function and let the linked
> to its work? I guess we have cases like this in tools/ already. I.e. not
> using the ifndef block. Minor nit tho.

That sounds like a good idea. I w

Re: [PATCHv2 3/8] perf probe powerpc: Fix symbol fixup issues due to ELF type

2015-04-26 Thread Naveen N. Rao
On 2015/03/12 05:23PM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Dec 15, 2014 at 08:20:33PM +0530, Naveen N. Rao escreveu:
> > If using the symbol table, symbol addresses are not being fixed up
> > properly, resulting in probes being placed at wrong addresses:
> > 
> >   # perf probe do_fork
> >   Added new event:
> > probe:do_fork(on do_fork)
> > 
> >   You can now use it in all perf tools, such as:
> > 
> >   perf record -e probe:do_fork -aR sleep 1
> > 
> >   # cat /sys/kernel/debug/tracing/kprobe_events
> >   p:probe/do_fork _text+635952
> >   # printf "%x" 635952
> >   9b430
> >   # grep do_fork /boot/System.map
> >   c00ab430 T .do_fork
> > 
> > Fix by checking for ELF type ET_DYN used by ppc64 kernels.
> 
> Sorry if this was answered already, its been a while since this was
> posted/discussed... Are you completely sure this is not a problem on
> !ppc?
> 
> Woudln't it be more conservative to somehow only adjust symbols for this
> ET_DYN type if the arch is ppc? I.e. something like moving that
> adjust_symbols logic to be arch_adjust_symbols(), provide a default and
> then override it for ppc to include also ET_DYN?

I did check and I don't think any other arch kernel uses ET_DYN, but 
yes, being conservative, I could just make this a arch helper. Will do.

- Naveen

> 
> Looking at the other patches...
> 
> - Arnaldo
> 
> > Signed-off-by: Naveen N. Rao 
> > ---
> >  tools/perf/util/symbol-elf.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> > index 06fcd1b..7ac4e4c 100644
> > --- a/tools/perf/util/symbol-elf.c
> > +++ b/tools/perf/util/symbol-elf.c
> > @@ -683,7 +683,8 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, 
> > const char *name,
> >  NULL) != NULL);
> > } else {
> > ss->adjust_symbols = ehdr.e_type == ET_EXEC ||
> > -ehdr.e_type == ET_REL;
> > +ehdr.e_type == ET_REL ||
> > +ehdr.e_type == ET_DYN;
> > }
> >  
> > ss->name   = strdup(name);
> > -- 
> > 2.1.3
> 

--
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] brcmfmac: keep WiFi chip's power during system suspension

2015-04-26 Thread Fu, Zhonghui
Need to keep the power supply for WiFi chip during system suspension.
Otherwise, the context of WiFi chip will be lost.

Signed-off-by: Zhonghui Fu 
---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index fdf8feb..03d3671 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -1251,15 +1251,17 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
brcmf_sdiod_freezer_on(sdiodev);
brcmf_sdio_wd_timer(sdiodev->bus, 0);
 
+   sdio_flags = MMC_PM_KEEP_POWER;
if (sdiodev->wowl_enabled) {
-   sdio_flags = MMC_PM_KEEP_POWER;
if (sdiodev->pdata->oob_irq_supported)
enable_irq_wake(sdiodev->pdata->oob_irq_nr);
else
-   sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
-   if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
-   brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
+   sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
}
+
+   if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
+   brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
+
return 0;
 }
 
-- 1.7.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: [PATCHv2 2/8] perf probe: Improve detection of file/function name in the probe pattern

2015-04-26 Thread Naveen N. Rao
On 2015/03/13 08:20PM, Masami Hiramatsu wrote:
> (2015/03/13 5:24), Arnaldo Carvalho de Melo wrote:
> > Em Mon, Dec 15, 2014 at 08:20:32PM +0530, Naveen N. Rao escreveu:
> >> Currently, perf probe considers patterns including a '.' to be a file.
> >> However, this causes problems on powerpc ABIv1 where all functions have
> >> a leading '.':
> >>
> >>   $ perf probe -F | grep schedule_timeout_interruptible
> >>   .schedule_timeout_interruptible
> >>   $ perf probe .schedule_timeout_interruptible
> >>   Semantic error :File always requires line number or lazy pattern.
> >> Error: Command Parse Error.
> >>
> >> Fix this by checking the probe pattern in more detail.
> > 
> > Masami, can I have your Acked-by or Reviewed-by?
> 
> As far as I can see, this is not enough for fixing that issue.
> Could you fold the first half of [4/8] to this patch?

Sure.

> I also have some comments on it. See below.
> 
> >  
> >> Signed-off-by: Naveen N. Rao 
> >> ---
> >>  tools/perf/util/probe-event.c | 23 ---
> >>  1 file changed, 20 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> >> index 28eb141..9943ff3 100644
> >> --- a/tools/perf/util/probe-event.c
> >> +++ b/tools/perf/util/probe-event.c
> >> @@ -999,6 +999,24 @@ static int parse_perf_probe_point(char *arg, struct 
> >> perf_probe_event *pev)
> >>arg = tmp;
> >>}
> >>  
> >> +  /*
> >> +   * Check arg is function or file name and copy it.
> >> +   *
> >> +   * We consider arg to be a file spec if and only if it satisfies
> >> +   * all of the below criteria::
> >> +   * - it does not include any of "+@%",
> >> +   * - it includes one of ":;", and
> >> +   * - it has a period '.' in the name.
> >> +   *
> >> +   * Otherwise, we consider arg to be a function specification.
> >> +   */
> >> +  c = 0;
> 
> Oh please, don't reuse 'char c' for a boolean flag, you should
> introduce new 'bool file_loc' etc.
> 
> >> +  if (!strpbrk(arg, "+@%") && (ptr = strpbrk(arg, ";:")) != NULL) {
> >> +  /* This is a file spec if it includes a '.' before ; or : */
> >> +  if (memchr(arg, '.', ptr-arg))
> ^^ add spaces around '-'.

Sure.

- Naveen
 

--
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] Bluetooth: Skip the shutdown routine if the interface is not up

2015-04-26 Thread David Miller
From: Marcel Holtmann 
Date: Sun, 26 Apr 2015 21:49:06 -0700

> Hi Gabriele,
> 
>> Most likely, the shutdown routine requires the interface to be up.
>> This is the case for BTUSB_INTEL: the routine tries to send a command
>> to the interface, but since this one is down, it fails and exits once
>> HCI_INIT_TIMEOUT has expired.
>> 
>> Signed-off-by: Gabriele Mazzotta 
>> ---
>> net/bluetooth/hci_core.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 476709b..4663c3d 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -1557,7 +1557,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
>> {
>>  BT_DBG("%s %p", hdev->name, hdev);
>> 
>> -if (!hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
>> +if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
>> +test_bit(HCI_UP, &hdev->flags)) {
>>  /* Execute vendor specific shutdown routine */
>>  if (hdev->shutdown)
>>  hdev->shutdown(hdev);
> 
> this is a good catch.
> 
> Acked-by: Marcel Holtmann 
> Cc: sta...@vger.kernel.org # 4.0.x
> 
> Dave, do you want to take this patch straight into your stable tree?

Please handle this via the bluetooth tree, thanks.
--
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 1/2] brcmfmac: prohibit ACPI power management for brcmfmac driver

2015-04-26 Thread Fu, Zhonghui
ACPI will manage WiFi chip's power state during suspend/resume
process on some tablet platforms(such as ASUS T100TA). This is
not supported by brcmfmac driver now, and the context of WiFi
chip will be damaged after resume. This patch disconnects the
relationship between WiFi chip and it's ACPI companion, and
prohibit ACPI PM for it.

Signed-off-by: Zhonghui Fu 
---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 9b508bd..fdf8feb 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -1114,6 +1114,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
int err;
struct brcmf_sdio_dev *sdiodev;
struct brcmf_bus *bus_if;
+   struct device *dev;
 
brcmf_dbg(SDIO, "Enter\n");
brcmf_dbg(SDIO, "Class=%x\n", func->class);
@@ -1121,6 +1122,10 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
brcmf_dbg(SDIO, "Function#: %d\n", func->num);
 
+   /* prohibit ACPI power management for this device */
+   dev = &func->dev;
+   dev->fwnode = NULL;
+
/* Consume func num 1 but dont do anything with it. */
if (func->num == 1)
return 0;
-- 1.7.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 3/3 v2] md/raid5: per hash value and exclusive wait_for_stripe

2015-04-26 Thread Yuanhan Liu
I noticed heavy spin lock contention at get_active_stripe() with fsmark
multiple thread write workloads.

Here is how this hot contention comes from. We have limited stripes, and
it's a multiple thread write workload. Hence, those stripes will be taken
soon, which puts later processes to sleep for waiting free stripes. When
enough stripes(>= 1/4 total stripes) are released, all process are woken,
trying to get the lock. But there is one only being able to get this lock
for each hash lock, making other processes spinning out there for acquiring
the lock.

Thus, it's effectiveless to wakeup all processes and let them battle for
a lock that permits one to access only each time. Instead, we could make
it be a exclusive wake up: wake up one process only. That avoids the heavy
spin lock contention naturally.

To do the exclusive wake up, we've to split wait_for_stripe into multiple
wait queues, to make it per hash value, just like the hash lock.

Here are some test results I have got with this patch applied(all test run
3 times):

`fsmark.files_per_sec'
=

next-20150317 this patch
- -
metric_value ±stddev  metric_value ±stddev change  
testbox/benchmark/testcase-params
- -    
--
  25.600 ±0.0  92.700 ±2.5  262.1% 
ivb44/fsmark/1x-64t-4BRD_12G-RAID5-btrfs-4M-30G-fsyncBeforeClose
  25.600 ±0.0  77.800 ±0.6  203.9% 
ivb44/fsmark/1x-64t-9BRD_6G-RAID5-btrfs-4M-30G-fsyncBeforeClose
  32.000 ±0.0  93.800 ±1.7  193.1% 
ivb44/fsmark/1x-64t-4BRD_12G-RAID5-ext4-4M-30G-fsyncBeforeClose
  32.000 ±0.0  81.233 ±1.7  153.9% 
ivb44/fsmark/1x-64t-9BRD_6G-RAID5-ext4-4M-30G-fsyncBeforeClose
  48.800 ±14.5 99.667 ±2.0  104.2% 
ivb44/fsmark/1x-64t-4BRD_12G-RAID5-xfs-4M-30G-fsyncBeforeClose
   6.400 ±0.0  12.800 ±0.0  100.0% 
ivb44/fsmark/1x-64t-3HDD-RAID5-btrfs-4M-40G-fsyncBeforeClose
  63.133 ±8.2  82.800 ±0.7   31.2% 
ivb44/fsmark/1x-64t-9BRD_6G-RAID5-xfs-4M-30G-fsyncBeforeClose
 245.067 ±0.7 306.567 ±7.9   25.1% 
ivb44/fsmark/1x-64t-4BRD_12G-RAID5-f2fs-4M-30G-fsyncBeforeClose
  17.533 ±0.3  21.000 ±0.8   19.8% 
ivb44/fsmark/1x-1t-3HDD-RAID5-xfs-4M-40G-fsyncBeforeClose
 188.167 ±1.9 215.033 ±3.1   14.3% 
ivb44/fsmark/1x-1t-4BRD_12G-RAID5-btrfs-4M-30G-NoSync
 254.500 ±1.8 290.733 ±2.4   14.2% 
ivb44/fsmark/1x-1t-9BRD_6G-RAID5-btrfs-4M-30G-NoSync

`time.system_time'
=

next-20150317 this patch
--
metric_value ±stddev metric_value ±stddev change   
testbox/benchmark/testcase-params
-- 
--
7235.603 ±1.2 185.163 ±1.9  -97.4% 
ivb44/fsmark/1x-64t-4BRD_12G-RAID5-btrfs-4M-30G-fsyncBeforeClose
7666.883 ±2.9 202.750 ±1.0  -97.4% 
ivb44/fsmark/1x-64t-9BRD_6G-RAID5-btrfs-4M-30G-fsyncBeforeClose
   14567.893 ±0.7 421.230 ±0.4  -97.1% 
ivb44/fsmark/1x-64t-3HDD-RAID5-btrfs-4M-40G-fsyncBeforeClose
3697.667 ±14.0148.190 ±1.7  -96.0% 
ivb44/fsmark/1x-64t-4BRD_12G-RAID5-xfs-4M-30G-fsyncBeforeClose
5572.867 ±3.8 310.717 ±1.4  -94.4% 
ivb44/fsmark/1x-64t-9BRD_6G-RAID5-ext4-4M-30G-fsyncBeforeClose
5565.050 ±0.5 313.277 ±1.5  -94.4% 
ivb44/fsmark/1x-64t-4BRD_12G-RAID5-ext4-4M-30G-fsyncBeforeClose
2420.707 ±17.1171.043 ±2.7  -92.9% 
ivb44/fsmark/1x-64t-9BRD_6G-RAID5-xfs-4M-30G-fsyncBeforeClose
3743.300 ±4.6 379.827 ±3.5  -89.9% 
ivb44/fsmark/1x-64t-3HDD-RAID5-ext4-4M-40G-fsyncBeforeClose
3308.687 ±6.3 363.050 ±2.0  -89.0% 
ivb44/fsmark/1x-64t-3HDD-RAID5-xfs-4M-40G-fsyncBeforeClose

Where,

 1x: where 'x' means iterations or loop, corresponding to the 'L' option of 
fsmark

 1t, 64t: where 't' means thread

 4M: means the single file size, corresponding to the '-s' option of fsmark
 40G, 30G, 120G: means the total test size

 4BRD_12G: BRD is the ramdisk, where '4' means 4 ramdisk, and where '12G' 
means
   the size of one ramdisk. So, it would be 48G in total. And we 
made a
   raid on those ramdisk

As you can see, though there are no much performance gain for hard disk
workload, the system time is dropped heavi

Re: [PATCH] Bluetooth: Skip the shutdown routine if the interface is not up

2015-04-26 Thread Marcel Holtmann
Hi Gabriele,

> Most likely, the shutdown routine requires the interface to be up.
> This is the case for BTUSB_INTEL: the routine tries to send a command
> to the interface, but since this one is down, it fails and exits once
> HCI_INIT_TIMEOUT has expired.
> 
> Signed-off-by: Gabriele Mazzotta 
> ---
> net/bluetooth/hci_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 476709b..4663c3d 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1557,7 +1557,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
> {
>   BT_DBG("%s %p", hdev->name, hdev);
> 
> - if (!hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
> + if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
> + test_bit(HCI_UP, &hdev->flags)) {
>   /* Execute vendor specific shutdown routine */
>   if (hdev->shutdown)
>   hdev->shutdown(hdev);

this is a good catch.

Acked-by: Marcel Holtmann 
Cc: sta...@vger.kernel.org # 4.0.x

Dave, do you want to take this patch straight into your stable tree?

Regards

Marcel

--
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 1/3] wait: introduce wait_event_cmd_exclusive

2015-04-26 Thread Yuanhan Liu
It's just a variant of wait_event_cmd, with exclusive flag being set.

For cases like RAID5, which puts many processes to sleep until 1/4
resources are free, a wake_up wakes up all processes to run, but
there is one process being able to get the resource as it's protected
by a spin lock. That ends up introducing heavy lock contentions, and
hurts performance badly.

Here introduce wait_event_cmd_exclusive to relieve the lock contention
naturally by letting wake_up() just wake up one process.

Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: Yuanhan Liu 
---
 include/linux/wait.h | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 2db8334..6c3b4de 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -358,10 +358,18 @@ do {  
\
__ret;  \
 })
 
-#define __wait_event_cmd(wq, condition, cmd1, cmd2)\
-   (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0,  \
+#define __wait_event_cmd(wq, condition, cmd1, cmd2, exclusive) \
+   (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, exclusive, 0, \
cmd1; schedule(); cmd2)
 
+
+#define wait_event_cmd_exclusive(wq, condition, cmd1, cmd2)
\
+do {   \
+   if (condition)  \
+   break;  \
+   __wait_event_cmd(wq, condition, cmd1, cmd2, 1); \
+} while (0)
+
 /**
  * wait_event_cmd - sleep until a condition gets true
  * @wq: the waitqueue to wait on
@@ -380,7 +388,7 @@ do {
\
 do {   \
if (condition)  \
break;  \
-   __wait_event_cmd(wq, condition, cmd1, cmd2);\
+   __wait_event_cmd(wq, condition, cmd1, cmd2, 0); \
 } while (0)
 
 #define __wait_event_interruptible(wq, condition)  \
-- 
1.9.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 2/3 v2] md/raid5: split wait_for_stripe and introduce wait_for_quiescent

2015-04-26 Thread Yuanhan Liu
I noticed heavy spin lock contention at get_active_stripe(), introduced
at being wake up stage, where a bunch of processes try to re-hold the
spin lock again.

After giving some thoughts on this issue, I found the lock could be
relieved(and even avoided) if we turn the wait_for_stripe to per
waitqueue for each lock hash and make the wake up exclusive: wake up
one process each time, which avoids the lock contention naturally.

Before go hacking with wait_for_stripe, I found it actually has 2
usages: for the array to enter or leave the quiescent state, and also
to wait for an available stripe in each of the hash lists.

So this patch splits the first usage off into a separate wait_queue,
wait_for_quiescent, and the next patch will turn the second usage into
one waitqueue for each hash value, and make it exclusive, to relieve
the lock contention.

v2: wake_up(wait_for_quiescent) when (active_stripes == 0)
Commit log refactor suggestion from Neil.

Signed-off-by: Yuanhan Liu 
---
 drivers/md/raid5.c | 15 +--
 drivers/md/raid5.h |  1 +
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 77dfd72..64d5bea 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -374,6 +374,8 @@ static void release_inactive_stripe_list(struct r5conf 
*conf,
 
if (do_wakeup) {
wake_up(&conf->wait_for_stripe);
+   if (atomic_read(&conf->active_stripes) == 0)
+   wake_up(&conf->wait_for_quiescent);
if (conf->retry_read_aligned)
md_wakeup_thread(conf->mddev->thread);
}
@@ -667,7 +669,7 @@ get_active_stripe(struct r5conf *conf, sector_t sector,
spin_lock_irq(conf->hash_locks + hash);
 
do {
-   wait_event_lock_irq(conf->wait_for_stripe,
+   wait_event_lock_irq(conf->wait_for_quiescent,
conf->quiesce == 0 || noquiesce,
*(conf->hash_locks + hash));
sh = __find_stripe(conf, sector, conf->generation - previous);
@@ -4729,7 +4731,7 @@ static void raid5_align_endio(struct bio *bi, int error)
 raid_bi, 0);
bio_endio(raid_bi, 0);
if (atomic_dec_and_test(&conf->active_aligned_reads))
-   wake_up(&conf->wait_for_stripe);
+   wake_up(&conf->wait_for_quiescent);
return;
}
 
@@ -4824,7 +4826,7 @@ static int chunk_aligned_read(struct mddev *mddev, struct 
bio * raid_bio)
align_bi->bi_iter.bi_sector += rdev->data_offset;
 
spin_lock_irq(&conf->device_lock);
-   wait_event_lock_irq(conf->wait_for_stripe,
+   wait_event_lock_irq(conf->wait_for_quiescent,
conf->quiesce == 0,
conf->device_lock);
atomic_inc(&conf->active_aligned_reads);
@@ -5668,7 +5670,7 @@ static int  retry_aligned_read(struct r5conf *conf, 
struct bio *raid_bio)
bio_endio(raid_bio, 0);
}
if (atomic_dec_and_test(&conf->active_aligned_reads))
-   wake_up(&conf->wait_for_stripe);
+   wake_up(&conf->wait_for_quiescent);
return handled;
 }
 
@@ -6399,6 +6401,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
goto abort;
spin_lock_init(&conf->device_lock);
seqcount_init(&conf->gen_lock);
+   init_waitqueue_head(&conf->wait_for_quiescent);
init_waitqueue_head(&conf->wait_for_stripe);
init_waitqueue_head(&conf->wait_for_overlap);
INIT_LIST_HEAD(&conf->handle_list);
@@ -7422,7 +7425,7 @@ static void raid5_quiesce(struct mddev *mddev, int state)
 * active stripes can drain
 */
conf->quiesce = 2;
-   wait_event_cmd(conf->wait_for_stripe,
+   wait_event_cmd(conf->wait_for_quiescent,
atomic_read(&conf->active_stripes) == 0 &&
atomic_read(&conf->active_aligned_reads) == 
0,
unlock_all_device_hash_locks_irq(conf),
@@ -7436,7 +7439,7 @@ static void raid5_quiesce(struct mddev *mddev, int state)
case 0: /* re-enable writes */
lock_all_device_hash_locks_irq(conf);
conf->quiesce = 0;
-   wake_up(&conf->wait_for_stripe);
+   wake_up(&conf->wait_for_quiescent);
wake_up(&conf->wait_for_overlap);
unlock_all_device_hash_locks_irq(conf);
break;
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 7dc0dd8..4cc05ec 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -508,6 +508,7 @@ struct r5conf {
struct list_headinactive_list[NR_STRIPE_HASH_LOCKS];
atomic_tempty_i

Re: [PATCH 3.10 06/31] tcp: tcp_make_synack() should clear skb->tstamp

2015-04-26 Thread David Miller
From: Willy Tarreau 
Date: Mon, 27 Apr 2015 06:02:22 +0200

> Hi Greg,
> 
> On Sun, Apr 26, 2015 at 03:46:26PM +0200, Greg Kroah-Hartman wrote:
>> 3.10-stable review patch.  If anyone has any objections, please let me know.
>> 
>> --
>> 
>> From: Eric Dumazet 
>> 
>> [ Upstream commit b50edd7812852d989f2ef09dcfc729690f54a42d ]
>> 
>> I noticed tcpdump was giving funky timestamps for locally
>> generated SYNACK messages on loopback interface.
>> 
>> 11:42:46.938990 IP 127.0.0.1.48245 > 127.0.0.2.23850: S
>> 945476042:945476042(0) win 43690 
>> 
>> 20:28:58.502209 IP 127.0.0.2.23850 > 127.0.0.1.48245: S
>> 3160535375:3160535375(0) ack 945476043 win 43690 > 65495,nop,nop,sackOK,nop,wscale 7>
>> 
>> This is because we need to clear skb->tstamp before
>> entering lower stack, otherwise net_timestamp_check()
>> does not set skb->tstamp.
>> 
>> Fixes: 7faee5c0d514 ("tcp: remove TCP_SKB_CB(skb)->when")
>> Signed-off-by: Eric Dumazet 
>> Signed-off-by: David S. Miller 
>> Signed-off-by: Greg Kroah-Hartman 
>> ---
> 
> Unless I missed something, the commit this patch fixes was not
> backported to 3.10 so I think we don't need this one. I have no
> idea whether it can have a side effect there though, Eric will
> probably know better.

Eric Dumazet mentioned this and said it's harmless.
--
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/1 linux-next] cpufreq: pxa: replace typedef pxa_freqs_t by structure

2015-04-26 Thread Viresh Kumar
On 25 April 2015 at 14:15, Fabian Frederick  wrote:
> See Documentation/CodingStyle.

Wow :)

> Signed-off-by: Fabian Frederick 
> ---
>  drivers/cpufreq/pxa2xx-cpufreq.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)

Acked-by: Viresh Kumar 
--
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] cpufreq: powernv: Register for OCC related opal_message notification

2015-04-26 Thread Viresh Kumar
On 22 April 2015 at 22:34, Shilpasri G Bhat
 wrote:
> diff --git a/drivers/cpufreq/powernv-cpufreq.c 
> b/drivers/cpufreq/powernv-cpufreq.c

> +static char throttle_reason[6][50] = { "No throttling",

Don't need to mention 6 here.

And the max length you need right now is 27, so maybe s/50/30 ?

Also, start 'No Throttling' in a new line, like below.

> +   "Power Cap",
> +   "Processor Over Temperature",
> +   "Power Supply Failure",
> +   "OverCurrent",

s/OverCurrent/Over Current/ ?

> +   "OCC Reset"
> +};
> +
> +static int powernv_cpufreq_occ_msg(struct notifier_block *nb,
> +   unsigned long msg_type, void *msg)
> +{
> +   struct opal_msg *occ_msg = msg;
> +   uint64_t token;
> +   uint64_t chip_id, reason;
> +
> +   if (msg_type != OPAL_MSG_OCC)
> +   return 0;

Blank line here.

> +   token = be64_to_cpu(occ_msg->params[0]);

Here as well..

> +   switch (token) {
> +   case 0:
> +   occ_reset = true;
> +   /*
> +* powernv_cpufreq_throttle_check() is called in
> +* target() callback which can detect the throttle state
> +* for governors like ondemand.
> +* But static governors will not call target() often thus
> +* report throttling here.
> +*/

Now, do I understand correctly that this notifier will be called as
soon as we switch throttling state ?

If yes, then do we still need the throttle_check() routine you added
earlier ? Maybe not.

> +   if (!throttled) {
> +   throttled = true;
> +   pr_crit("CPU Frequency is throttled\n");
> +   }
> +   pr_info("OCC in Reset\n");
> +   break;
> +   case 1:
> +   pr_info("OCC is Loaded\n");
> +   break;
> +   case 2:
> +   chip_id = be64_to_cpu(occ_msg->params[1]);
> +   reason = be64_to_cpu(occ_msg->params[2]);

Blank line here.

> +   if (occ_reset) {
> +   occ_reset = false;
> +   throttled = false;
> +   pr_info("OCC is Active\n");
> +   /* Sanity check for static governors */
> +   powernv_cpufreq_throttle_check(smp_processor_id());
> +   } else if (reason) {
> +   throttled = true;
> +   pr_info("Pmax reduced due to %s on chip %x\n",
> +   throttle_reason[reason], 
> (int)chip_id);
> +   } else {
> +   throttled = false;
> +   pr_info("%s on chip %x\n",
> +   throttle_reason[reason], 
> (int)chip_id);
> +   }

Run checkpatch with --strict option, and you will see some warnings.

> +   break;
> +   }
> +   return 0;
> +}
> +
> +static struct notifier_block powernv_cpufreq_opal_nb = {
> +   .notifier_call  = powernv_cpufreq_occ_msg,
> +   .next   = NULL,
> +   .priority   = 0,
> +};
> +
>  static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy)
>  {
> struct powernv_smp_call_data freq_data;
> @@ -430,6 +497,7 @@ static int __init powernv_cpufreq_init(void)
> }
>
> register_reboot_notifier(&powernv_cpufreq_reboot_nb);
> +   opal_message_notifier_register(OPAL_MSG_OCC, 
> &powernv_cpufreq_opal_nb);
> return cpufreq_register_driver(&powernv_cpufreq_driver);
>  }
>  module_init(powernv_cpufreq_init);
> --
> 1.9.3
>
--
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/1] Documentation: Add dt-binding for TI-btwilink driver

2015-04-26 Thread Marcel Holtmann
Hi Gigi,

> btwilink binds bluetooth hci0 interface with the shared transport driver
> 
> Signed-off-by: Gigi Joseph 
> ---
> Documentation/devicetree/bindings/btwilink.txt | 15 +++
> 1 file changed, 15 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/btwilink.txt
> 
> diff --git a/Documentation/devicetree/bindings/btwilink.txt 
> b/Documentation/devicetree/bindings/btwilink.txt
> new file mode 100644
> index 000..d286aea
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/btwilink.txt
> @@ -0,0 +1,15 @@
> +btwilink
> +
> +
> +Required properties:
> +
> + - compatible : must be "ti,btwilink"
> +
> +Example:
> +
> +Enable the btwilink driver to bind the bluetooth hci0 interface with
> +ti-st shared transport driver
> +
> +btwilink {
> + compatible = "ti,btwilink";
> +};

actually I wonder if someone finally starts re-writing the TI-ST driver to 
integrate with the new Bluetooth subsystem features (like hdev->setup, 
__hci_cmd_sync and h4_recv_buf) so that this complicated setup is no longer 
needed.

I do not think we actually would need a shared transport at all. We should have 
a Bluetooth HCI driver that can have children for FM radio and GPS exposed. 
Exposing proper platform devices with Bluetooth HCI as parent makes sense. The 
shared transport is not really a parent. First and foremost, this is a 
Bluetooth chip. The FM radio and GPS features are just glued on top of it.

Regards

Marcel

--
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 3.10 06/31] tcp: tcp_make_synack() should clear skb->tstamp

2015-04-26 Thread Eric Dumazet
Right.

Bug was introduced in 3.18,  the Fixes: tag tells us ;)

git describe --contains 7faee5c0d514
v3.18-rc1~52^2~148^2

Note that it does not hurt having this backport to prior kernel versions.

Field is already 0 after skb allocation/cloning.



On Sun, Apr 26, 2015 at 9:02 PM, Willy Tarreau  wrote:
> Hi Greg,
>
> On Sun, Apr 26, 2015 at 03:46:26PM +0200, Greg Kroah-Hartman wrote:
>> 3.10-stable review patch.  If anyone has any objections, please let me know.
>>
>> --
>>
>> From: Eric Dumazet 
>>
>> [ Upstream commit b50edd7812852d989f2ef09dcfc729690f54a42d ]
>>
>> I noticed tcpdump was giving funky timestamps for locally
>> generated SYNACK messages on loopback interface.
>>
>> 11:42:46.938990 IP 127.0.0.1.48245 > 127.0.0.2.23850: S
>> 945476042:945476042(0) win 43690 
>>
>> 20:28:58.502209 IP 127.0.0.2.23850 > 127.0.0.1.48245: S
>> 3160535375:3160535375(0) ack 945476043 win 43690 > 65495,nop,nop,sackOK,nop,wscale 7>
>>
>> This is because we need to clear skb->tstamp before
>> entering lower stack, otherwise net_timestamp_check()
>> does not set skb->tstamp.
>>
>> Fixes: 7faee5c0d514 ("tcp: remove TCP_SKB_CB(skb)->when")
>> Signed-off-by: Eric Dumazet 
>> Signed-off-by: David S. Miller 
>> Signed-off-by: Greg Kroah-Hartman 
>> ---
>
> Unless I missed something, the commit this patch fixes was not
> backported to 3.10 so I think we don't need this one. I have no
> idea whether it can have a side effect there though, Eric will
> probably know better.
>
> Thanks,
> Willy
>
--
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 -stable] block: destroy bdi before blockdev is unregistered.

2015-04-26 Thread NeilBrown

Because of the peculiar way that md devices are created (automatically
when the device node is opened), a new device can be created and
registered immediately after the
blk_unregister_region(disk_devt(disk), disk->minors);
call in del_gendisk().

Therefore it is important that all visible artifacts of the previous
device are removed before this call.  In particular, the 'bdi'.

Since:
commit c4db59d31e39ea067c32163ac961e9c80198fd37
Author: Christoph Hellwig 
fs: don't reassign dirty inodes to default_backing_dev_info

moved the
   device_unregister(bdi->dev);
call from bdi_unregister() to bdi_destroy() it has been quite easy to
lose a race and have a new (e.g.) "md127" be created after the
blk_unregister_region() call and before bdi_destroy() is ultimately
called by the final 'put_disk', which must come after del_gendisk().

The new device finds that the bdi name is already registered in sysfs
and complains

> [ 9627.630029] WARNING: CPU: 18 PID: 3330 at fs/sysfs/dir.c:31 
> sysfs_warn_dup+0x5a/0x70()
> [ 9627.630032] sysfs: cannot create duplicate filename 
> '/devices/virtual/bdi/9:127'

We can fix this by moving the bdi_destroy() call out of
blk_release_queue() (which can happen very late when a refcount
reaches zero) and into blk_cleanup_queue() - which happens exactly when the md
device driver calls it.

Then it is only necessary for md to call blk_cleanup_queue() before
del_gendisk().  As loop.c devices are also created on demand by
opening the device node, we make the same change there.

Fixes: c4db59d31e39ea067c32163ac961e9c80198fd37
Reported-by: Azat Khuzhin 
Cc: Christoph Hellwig 
Cc: sta...@vger.kernel.org (v4.0)
Signed-off-by: NeilBrown 

--
Hi Jens,
 if you could check this and forward on to Linus I'd really appreciate it.

Thanks,
NeilBrown


diff --git a/block/blk-core.c b/block/blk-core.c
index fd154b94447a..7871603f0a29 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -552,6 +552,8 @@ void blk_cleanup_queue(struct request_queue *q)
q->queue_lock = &q->__queue_lock;
spin_unlock_irq(lock);
 
+   bdi_destroy(&q->backing_dev_info);
+
/* @q is and will stay empty, shutdown and put */
blk_put_queue(q);
 }
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index faaf36ade7eb..2b8fd302f677 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -522,8 +522,6 @@ static void blk_release_queue(struct kobject *kobj)
 
blk_trace_shutdown(q);
 
-   bdi_destroy(&q->backing_dev_info);
-
ida_simple_remove(&blk_queue_ida, q->id);
call_rcu(&q->rcu_head, blk_free_queue_rcu);
 }
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index ae3fcb4199e9..d7173cb1ea76 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1620,8 +1620,8 @@ out:
 
 static void loop_remove(struct loop_device *lo)
 {
-   del_gendisk(lo->lo_disk);
blk_cleanup_queue(lo->lo_queue);
+   del_gendisk(lo->lo_disk);
blk_mq_free_tag_set(&lo->tag_set);
put_disk(lo->lo_disk);
kfree(lo);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d4f31e195e26..593a02476c78 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4818,12 +4818,12 @@ static void md_free(struct kobject *ko)
if (mddev->sysfs_state)
sysfs_put(mddev->sysfs_state);
 
+   if (mddev->queue)
+   blk_cleanup_queue(mddev->queue);
if (mddev->gendisk) {
del_gendisk(mddev->gendisk);
put_disk(mddev->gendisk);
}
-   if (mddev->queue)
-   blk_cleanup_queue(mddev->queue);
 
kfree(mddev);
 }


pgps91FEHzQDw.pgp
Description: OpenPGP digital signature


Re: [PATCH v10 00/29] Refine PCI scan interfaces and make generic pci host bridge

2015-04-26 Thread Daniel Axtens
Hi Yijing,

I'm wondering if you might get some more momentum on these changes if
we could split them into a few smaller patch sets. I think we might
then be able to start getting bits of this in for 4.2, which should help
with getting the rest of it in.

I think there are a few things that would be easy to pull out.

  * #1 (xen/PCI: Don't use deprecated function
 pci_scan_bus_parented()) can go directly to Xen people and should
 be easy to merge. #2 (PCI: Remove deprecated
 pci_scan_bus_parented()) is then an easy fixup.

  * I think #12 (powerpc/PCI: Rename pcibios_root_bridge_prepare() to
pcibios_set_root_bus_speed()) could go to the PowerPC folks
individually. I'm not sure, however, that it's worth renaming it
and creating another function and another hook when no other arch
uses it. If mpe and benh don't want to pick it up, it'd be pretty
easy to take out set_root_bus_speed from the host_bridge_ops
struct, and this way we can still advance other parts of the
series.

  * #16 (PCI: Introduce pci_bus_child_max_busnr()) is self-contained
 and already has a user, so that should go in easily.

  * The domain/bus numbering cleanup stuff could be broken out:
#3  (PCI: Save domain in pci_host_bridge)
#4  (PCI: Move pci_bus_assign_domain_nr() declaration into
drivers/pci/pci.h)
#8  (PCI: Introduce pci_host_assign_domain_nr() to assign domain),
#28 (PCI: Remove platform specific pci_domain_nr())
#29 (PCI: Remove pci_bus_assign_domain_nr())



I've done a bunch of rebasing and compiles to try to make sure all of
these proposed divisions work and there are no dependencies that I've
missed. It it's helpful, you can see what I've done at
https://github.com/daxtens/linux in the YijingWang-enumer10
branch. Feel free to use it as you wish.

I think the remaining 20 patches could probably be split again at least
once - it looks like the bus/bus numbering stuff might be easy to split
out? I might have a look again in a few days.

Regards,
Daniel

My final set of series, using your original patch names:

Set 1 (Xen cleanup):
  xen/PCI: Don't use deprecated function pci_scan_bus_parented()
  PCI: Remove deprecated pci_scan_bus_parented()

Set 2 (PowerPC cleanup):
  powerpc/PCI: Rename pcibios_root_bridge_prepare() to
pcibios_set_root_bus_speed()

Set 3: (could possibly be merged with set 4)
  PCI: Introduce pci_bus_child_max_busnr()

Set 4: (_nr and friends)
  PCI: Save domain in pci_host_bridge
  PCI: Move pci_bus_assign_domain_nr() declaration into
   drivers/pci/pci.h
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  PCI: Remove platform specific pci_domain_nr()
  PCI: Remove pci_bus_assign_domain_nr()

Remainder:
  PCI: Remove argument bus for pci_create_root_bus()
  PCI: Alloc busn resource dynamically for pci_scan_bus()
  PCI: Allocate busn resource for pci_scan_root_bus()
  PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  PCI: Introduce pci_host_bridge_list to manage host bridges
  PCI: Save sysdata in pci_host_bridge drvdata  
  PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge()
  PCI: Introduce pci_host_bridge_ops to support host specific
operations
  PCI: Introduce new scan function pci_scan_host_bridge()
  x86/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
  ia64/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
  powerpc/pci: Use pci_scan_host_bridge() for simplicity
  PCI: Remove pcibios_root_bridge_prepare() and
pcibos_set_root_bus_speed()
  sparc/PCI: Use pci_scan_host_bridge() for simplicity
  parisc/PCI: Use pci_scan_root_bus() for simplicity
  PCI/mvebu: Use pci_common_init_dev() to simplify code
  PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  PCI/designware: Use pci_scan_root_bus() for simplicity
  PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  PCI: Rename __pci_create_root_bus() to pci_create_root_bus()

On Tue, 2015-04-21 at 19:34 +0800, Yijing Wang wrote:
> This series could be pulled from:
> https://github.com/YijingWang/linux-pci.git enumer10
> 
> v9->v10:
>   Dynamically allocate busn resource if callers don't supply.
>   Try to adjust busn resource if host bridge busn resource conlict.
>   Rebase whole series on Bjorn's latest pci-next branch.
>   Major v9->v10 changes are in patch 5,6,7,10.
> v8->v9:
>   Add Thierry's Acked-by and Tested-by.
>   Fix the building error for powerpc found by Daniel.
>   Change pci_host_assign_domain_nr() to static.
> v7->v8:
>   Fix some cross building errors found by kbuild test.
>   Drop the rename patch for find_pci_host_bridge().
> v6->v7:
>   Drop previous patch which combined the domain and bus in one argument.
>   Make the pci_host_bridge hold the default busn resource, so we could
>   check whether new host busn resource is conflict with existing ones.
>   Move pci_host_assign_domain_nr() to drivers/pci/host-bridge.c
>  

Re: [PATCH 3.10 06/31] tcp: tcp_make_synack() should clear skb->tstamp

2015-04-26 Thread Willy Tarreau
Hi Greg,

On Sun, Apr 26, 2015 at 03:46:26PM +0200, Greg Kroah-Hartman wrote:
> 3.10-stable review patch.  If anyone has any objections, please let me know.
> 
> --
> 
> From: Eric Dumazet 
> 
> [ Upstream commit b50edd7812852d989f2ef09dcfc729690f54a42d ]
> 
> I noticed tcpdump was giving funky timestamps for locally
> generated SYNACK messages on loopback interface.
> 
> 11:42:46.938990 IP 127.0.0.1.48245 > 127.0.0.2.23850: S
> 945476042:945476042(0) win 43690 
> 
> 20:28:58.502209 IP 127.0.0.2.23850 > 127.0.0.1.48245: S
> 3160535375:3160535375(0) ack 945476043 win 43690  65495,nop,nop,sackOK,nop,wscale 7>
> 
> This is because we need to clear skb->tstamp before
> entering lower stack, otherwise net_timestamp_check()
> does not set skb->tstamp.
> 
> Fixes: 7faee5c0d514 ("tcp: remove TCP_SKB_CB(skb)->when")
> Signed-off-by: Eric Dumazet 
> Signed-off-by: David S. Miller 
> Signed-off-by: Greg Kroah-Hartman 
> ---

Unless I missed something, the commit this patch fixes was not
backported to 3.10 so I think we don't need this one. I have no
idea whether it can have a side effect there though, Eric will
probably know better.

Thanks,
Willy

--
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] dmaengine: dw: add Intel Broxton LPSS Integrated DMA support

2015-04-26 Thread Vinod Koul
On Tue, Apr 21, 2015 at 05:41:50AM +, Zha, Qipeng wrote:
> + dma maillist
Pls CC maintainer, or your patch will be missed!!

> 
> 
> 
> 
> Best wishes
> Qipeng
> 
> -Original Message-
> From: Zha, Qipeng 
> Sent: Tuesday, April 21, 2015 7:34 AM
> To: linux-kernel@vger.kernel.org
> Cc: viresh.li...@gmail.com; andriy.shevche...@linux.intel.com; Westerberg, 
> Mika; Chen, Jason CJ; Zheng, Qi; Zha, Qipeng; Zhong, Huiquan
> Subject: [PATCH] dmaengine: dw: add Intel Broxton LPSS Integrated DMA support
> 
> From: Huiquan Zhong 
> 
> Add Broxton Lower Power Sub System Integrated DMA support, Since the DMA 
> register space is very similar to DesignWare DMA register space.
> 
> Add DW_DMAC_TYPE_IDMA type to distinguish LPSS iDMA register.
> 
> Broxton LPSS iDMA's maximum block size is 0x1(128KB -1).
Looking at the patch aprt from DW_DMAC_TYPE_IDMA changes, rest are not
documented why, perhpas you cna split to multiple changes explainig what and
why. Then this is supporting BXT but I dont see any update to device table?

> 
> Signed-off-by: Huiquan Zhong 
> Signed-off-by: qipeng.zha 
> ---
>  drivers/dma/dw/core.c| 64 
> +---
>  drivers/dma/dw/internal.h|  3 --
>  drivers/dma/dw/regs.h| 14 
>  include/linux/dma/dw.h   |  8 +
>  include/linux/platform_data/dma-dw.h |  2 +-
>  5 files changed, 75 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 
> a8ad052..1d198c9 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -144,8 +144,19 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
>*/
>   BUG_ON(!dws->dma_dev || dws->dma_dev != dw->dma.dev);
>  
> - cfghi |= DWC_CFGH_DST_PER(dws->dst_id);
> - cfghi |= DWC_CFGH_SRC_PER(dws->src_id);
> + if (dw->type == DW_DMAC_TYPE_IDMA) {
> + /* Forces channel FIFO to drain while in suspension */
> + cfglo = IDMA_CFGL_CH_DRAIN;
> + /* Burst length aligned */
> + cfglo |= IDMA_CFGL_SRC_BURST_ALIGN
> + | IDMA_CFGL_DST_BURST_ALIGN;
> +
> + cfghi |= IDMA_CFGH_DST_PER(dws->dst_id);
> + cfghi |= IDMA_CFGH_SRC_PER(dws->src_id);
> + } else {
> + cfghi |= DWC_CFGH_DST_PER(dws->dst_id);
> + cfghi |= DWC_CFGH_SRC_PER(dws->src_id);
> + }
>   } else {
>   cfghi |= DWC_CFGH_DST_PER(dwc->dst_id);
>   cfghi |= DWC_CFGH_SRC_PER(dwc->src_id); @@ -346,9 +357,14 @@ 
> static void dwc_complete_all(struct dw_dma *dw, struct dw_dma_chan *dwc)
>  /* Returns how many bytes were already received from source */  static 
> inline u32 dwc_get_sent(struct dw_dma_chan *dwc)  {
> + struct dw_dma *dw = to_dw_dma(dwc->chan.device);
> +
>   u32 ctlhi = channel_readl(dwc, CTL_HI);
>   u32 ctllo = channel_readl(dwc, CTL_LO);
>  
> + if (dw->type == DW_DMAC_TYPE_IDMA)
> + return ctlhi & IDMA_CTLH_BLOCK_TS_MASK;
> +
>   return (ctlhi & DWC_CTLH_BLOCK_TS_MASK) * (1 << (ctllo >> 4 & 7));  }
>  
> @@ -775,6 +791,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct 
> scatterlist *sgl,
>   unsigned intreg_width;
>   unsigned intmem_width;
>   unsigned intdata_width;
> + unsigned intwidth_trf;
>   unsigned inti;
>   struct scatterlist  *sg;
>   size_t  total_len = 0;
> @@ -823,8 +840,14 @@ slave_sg_todev_fill_desc:
>   desc->lli.sar = mem;
>   desc->lli.dar = reg;
>   desc->lli.ctllo = ctllo | DWC_CTLL_SRC_WIDTH(mem_width);
> - if ((len >> mem_width) > dwc->block_size) {
> - dlen = dwc->block_size << mem_width;
> +
> + if (dw->type == DW_DMAC_TYPE_IDMA)
> + width_trf = 0;
why should this be zero?

> + else
> + width_trf = mem_width;
> +
> + if ((len >> width_trf) > dwc->block_size) {
> + dlen = dwc->block_size << width_trf;
>   mem += dlen;
>   len -= dlen;
>   } else {
> @@ -832,7 +855,7 @@ slave_sg_todev_fill_desc:
>   len = 0;
>   }
>  
> - desc->lli.ctlhi = dlen >> mem_width;
> + desc->lli.ctlhi = dlen >> width_trf;
>   desc->len = dlen;
>  
>   if (!first) {
> @@ -883,15 +906,20 @@ slave_sg_fromdev_fill_desc:
>   desc->lli.sar = reg;
>   desc->lli.dar = mem;
>   desc->lli.ctllo = ctllo | DWC_CT

Re: [PATCH 00/23] gpio: sysfs: fixes and clean ups

2015-04-26 Thread Alexandre Courbot
On Wed, Apr 22, 2015 at 12:42 AM, Johan Hovold  wrote:
> These patches fix a number of issues with the gpio sysfs interface,
> including
>
>  - fix memory leaks and crashes on device hotplug
>  - straighten out the convoluted locking
>  - reduce sysfs-interface latencies through more fine-grained locking
>  - more clearly separate the sysfs-interface implementation from gpiolib
>core
>
> The first patch is marked for stable and could go into 4.1.
>
> Unfortunately we can't just kill the gpio sysfs interface, but these
> patches will make it more manageable and should allow us to implement a
> new user-space interface while maintaining the old one (for a while at
> least) without losing our sanity.
>
> Note that there is still a race between chip remove and gpiod_request (and
> therefore sysfs export), which needs to be fixed separately (for instance as
> part of a generic solution to chip hotplugging).

Thanks a lot for this great series. To my embarrassment I could not
find anything big to say about it. It simply fixes some of the biggest
issues with the sysfs interface and makes things much more
maintainable.

I made a few minor comments, but globally I like this very much.

Reviewed-by: Alexandre Courbot 
--
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 07/23] gpio: sysfs: rename gpiochip registration functions

2015-04-26 Thread Alexandre Courbot
On Wed, Apr 22, 2015 at 12:42 AM, Johan Hovold  wrote:
> Rename the gpio-chip export/unexport functions to the more descriptive
> names gpiochip_register and gpiochip_unregister.

Since these functions are related to sysfs, wouldn't
gpiochip_sysfs_export (or gpiochip_sysfs_register, although the former
sounds better to me) be even more descriptive?

The renaming should probably also cover the non-static gpiod_*
functions of gpiolib-sysfs.c which are equally ambiguous. Basically
anything non-static from gpiolib-sysfs.c should have that prefix.
--
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 06/23] gpio: sysfs: clean up chip class-device handling

2015-04-26 Thread Alexandre Courbot
On Wed, Apr 22, 2015 at 12:42 AM, Johan Hovold  wrote:
> Clean gpio-chip class device registration and deregistration.
>
> The class device is registered when a gpio-chip is added (or from
> gpiolib_sysfs_init post-core init call), and deregistered when the chip
> is removed.
>
> Store the class device in struct gpio_chip directly rather than do a
> class-device lookup on deregistration. This also removes the need for
> the exported flag.
>
> Signed-off-by: Johan Hovold 
> ---
>  drivers/gpio/gpiolib-sysfs.c | 39 +--
>  include/linux/gpio/driver.h  |  4 ++--
>  2 files changed, 15 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index c433f075f349..2f8bdce792f6 100644
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -567,7 +567,7 @@ int gpiod_export(struct gpio_desc *desc, bool 
> direction_may_change)
> mutex_lock(&sysfs_lock);
>
> /* check if chip is being removed */
> -   if (!chip || !chip->exported) {
> +   if (!chip || !chip->cdev) {
> status = -ENODEV;
> goto fail_unlock;
> }
> @@ -752,7 +752,6 @@ EXPORT_SYMBOL_GPL(gpiod_unexport);
>
>  int gpiochip_export(struct gpio_chip *chip)
>  {
> -   int status;
> struct device   *dev;
>
> /* Many systems register gpio chips for SOC support very early,
> @@ -768,41 +767,29 @@ int gpiochip_export(struct gpio_chip *chip)
> chip, gpiochip_groups,
> "gpiochip%d", chip->base);
> if (IS_ERR(dev))
> -   status = PTR_ERR(dev);
> -   else
> -   status = 0;
> +   return PTR_ERR(dev);
>
> mutex_lock(&sysfs_lock);
> -   chip->exported = (status == 0);
> +   chip->cdev = dev;
> mutex_unlock(&sysfs_lock);
>
> -   if (status)
> -   chip_dbg(chip, "%s: status %d\n", __func__, status);
> -
> -   return status;
> +   return 0;
>  }
>
>  void gpiochip_unexport(struct gpio_chip *chip)
>  {
> -   int status;
> -   struct device   *dev;
> struct gpio_desc *desc;
> unsigned int i;
>
> -   dev = class_find_device(&gpio_class, NULL, chip, match_export);
> -   if (dev) {
> -   put_device(dev);
> -   device_unregister(dev);
> -   /* prevent further gpiod exports */
> -   mutex_lock(&sysfs_lock);
> -   chip->exported = false;
> -   mutex_unlock(&sysfs_lock);
> -   status = 0;
> -   } else
> -   status = -ENODEV;
> +   if (!chip->cdev)
> +   return;
>
> -   if (status)
> -   chip_dbg(chip, "%s: status %d\n", __func__, status);
> +   device_unregister(chip->cdev);
> +
> +   /* prevent further gpiod exports */
> +   mutex_lock(&sysfs_lock);
> +   chip->cdev = NULL;
> +   mutex_unlock(&sysfs_lock);
>
> /* unregister gpiod class devices owned by sysfs */
> for (i = 0; i < chip->ngpio; i++) {
> @@ -830,7 +817,7 @@ static int __init gpiolib_sysfs_init(void)
>  */
> spin_lock_irqsave(&gpio_lock, flags);
> list_for_each_entry(chip, &gpio_chips, list) {
> -   if (chip->exported)
> +   if (chip->cdev)
> continue;
>
> /*
> diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
> index f1b36593ec9f..8c26855fc6ec 100644
> --- a/include/linux/gpio/driver.h
> +++ b/include/linux/gpio/driver.h
> @@ -20,6 +20,7 @@ struct seq_file;
>   * struct gpio_chip - abstract a GPIO controller
>   * @label: for diagnostics
>   * @dev: optional device providing the GPIOs
> + * @cdev: class device (may be NULL)

Maybe a comment explaining that this field is non-NULL when a chip is
exported would be useful to understand how it is used in the code?
--
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 08/23] gpio: remove gpiod_sysfs_set_active_low

2015-04-26 Thread Alexandre Courbot
On Wed, Apr 22, 2015 at 12:42 AM, Johan Hovold  wrote:
> Remove gpiod_sysfs_set_active_low (and gpio_sysfs_set_active_low) which
> allowed code to change the polarity of a gpio line even after it had
> been exported through sysfs.
>
> Drivers should not care, and generally does not know, about gpio-line
> polarity which is a hardware feature that needs to be described by
> firmware.
>
> It is currently possible to define gpio-line polarity in device-tree and
> acpi firmware or using platform data. Userspace can also change the
> polarity through sysfs.
>
> Note that drivers using the legacy gpio interface could still use
> GPIOF_ACTIVE_LOW to change the polarity before exporting the gpio.
>
> There are no in-kernel users of this interface.
>
> Cc: Jonathan Corbet 
> Cc: Harry Wei 
> Cc: Arnd Bergmann 
> Cc: linux-...@vger.kernel.org
> Cc: linux-ker...@zh-kernel.org
> Cc: linux-a...@vger.kernel.org
> Signed-off-by: Johan Hovold 
> ---
>  Documentation/gpio/gpio-legacy.txt |  9 ---
>  Documentation/gpio/sysfs.txt   |  8 ---
>  Documentation/zh_CN/gpio.txt   |  8 ---
>  drivers/gpio/gpiolib-sysfs.c   | 48 
> ++
>  include/asm-generic/gpio.h |  5 
>  include/linux/gpio.h   |  7 --
>  include/linux/gpio/consumer.h  |  6 -
>  7 files changed, 2 insertions(+), 89 deletions(-)
>
> diff --git a/Documentation/gpio/gpio-legacy.txt 
> b/Documentation/gpio/gpio-legacy.txt
> index 6f83fa965b4b..79ab5648d69b 100644
> --- a/Documentation/gpio/gpio-legacy.txt
> +++ b/Documentation/gpio/gpio-legacy.txt
> @@ -751,9 +751,6 @@ requested using gpio_request():
> int gpio_export_link(struct device *dev, const char *name,
> unsigned gpio)
>
> -   /* change the polarity of a GPIO node in sysfs */
> -   int gpio_sysfs_set_active_low(unsigned gpio, int value);
> -
>  After a kernel driver requests a GPIO, it may only be made available in
>  the sysfs interface by gpio_export().  The driver can control whether the
>  signal direction may change.  This helps drivers prevent userspace code
> @@ -767,9 +764,3 @@ After the GPIO has been exported, gpio_export_link() 
> allows creating
>  symlinks from elsewhere in sysfs to the GPIO sysfs node.  Drivers can
>  use this to provide the interface under their own device in sysfs with
>  a descriptive name.
> -
> -Drivers can use gpio_sysfs_set_active_low() to hide GPIO line polarity
> -differences between boards from user space.  This only affects the
> -sysfs interface.  Polarity change can be done both before and after
> -gpio_export(), and previously enabled poll(2) support for either
> -rising or falling edge will be reconfigured to follow this setting.
> diff --git a/Documentation/gpio/sysfs.txt b/Documentation/gpio/sysfs.txt
> index c2c3a97f8ff7..535b6a8a7a7c 100644
> --- a/Documentation/gpio/sysfs.txt
> +++ b/Documentation/gpio/sysfs.txt
> @@ -132,9 +132,6 @@ requested using gpio_request():
> int gpiod_export_link(struct device *dev, const char *name,
>   struct gpio_desc *desc);
>
> -   /* change the polarity of a GPIO node in sysfs */
> -   int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value);
> -
>  After a kernel driver requests a GPIO, it may only be made available in
>  the sysfs interface by gpiod_export(). The driver can control whether the
>  signal direction may change. This helps drivers prevent userspace code
> @@ -148,8 +145,3 @@ After the GPIO has been exported, gpiod_export_link() 
> allows creating
>  symlinks from elsewhere in sysfs to the GPIO sysfs node. Drivers can
>  use this to provide the interface under their own device in sysfs with
>  a descriptive name.
> -
> -Drivers can use gpiod_sysfs_set_active_low() to hide GPIO line polarity
> -differences between boards from user space. Polarity change can be done both
> -before and after gpiod_export(), and previously enabled poll(2) support for
> -either rising or falling edge will be reconfigured to follow this setting.
> diff --git a/Documentation/zh_CN/gpio.txt b/Documentation/zh_CN/gpio.txt
> index d5b8f01833f4..bce972521065 100644
> --- a/Documentation/zh_CN/gpio.txt
> +++ b/Documentation/zh_CN/gpio.txt
> @@ -638,9 +638,6 @@ GPIO 控制器的路径类似 /sys/class/gpio/gpiochip42/ (对于从#42 GPIO
> int gpio_export_link(struct device *dev, const char *name,
> unsigned gpio)
>
> -   /* 改变 sysfs 中的一个 GPIO 节点的极性 */
> -   int gpio_sysfs_set_active_low(unsigned gpio, int value);
> -
>  在一个内核驱动申请一个 GPIO 之后,它可以通过 gpio_export()使其在 sysfs
>  接口中可见。该驱动可以控制信号方向是否可修改。这有助于防止用户空间代码无意间
>  破坏重要的系统状态。
> @@ -651,8 +648,3 @@ GPIO 控制器的路径类似 /sys/class/gpio/gpiochip42/ (对于从#42 GPIO
>  在 GPIO 被导出之后,gpio_export_link()允许在 sysfs 文件系统的任何地方
>  创建一个到这个 GPIO sysfs 节点的符号链接。这样驱动就可以通过一个描述性的
>  名字,在 sysfs 中他们所拥有的设备下提供一个(到这个 GPIO sysfs 节点的)接口。
> -
> -驱动可以使用 gpio_sysfs_set_active_low() 来在用户空间隐藏电路板之间
> -GPIO 线的极性差异。这个仅对 sysfs 接口起作用。极性的改变可以在 gpio_export()
> -前后进行,且之

Re: [PATCH v2] Input - mt: Fix input_mt_get_slot_by_key

2015-04-26 Thread Peter Hutterer
On Fri, Apr 24, 2015 at 08:26:39AM +0200, Henrik Rydberg wrote:
> Peter,
> 
> It may be a long time ago now, but we had very vocal discussions regarding the
> MT protocol back then, and I am quite sure all the subtleties are well
> understood. In order to fully appreciate the simplicity of the protocol, one
> only needs to stop misintepreting it. In order to do that, please imagine a
> large piece of papers, a set of brushes, and a set of colors.
> 
> The MT protocol tracks brushes. When lines are drawn, positions are updated.
> When the color on the brush changes, the tracking id changes. When the brush 
> is
> lifted, the tracking id becomes -1, the "no color" color. There is a fixed set
> of brushes. The old test application mtview works precisely this way.
> 
> The add/remove protocol tracks colors. Technichally it tracks contacts, which
> are the combined (color, brush) objects, but in this analogy, colors and
> tracking ids are interchangeable. When lines a drawn, a color is first 
> assigned
> to the color and the brush attributes on the color are updated. The positions 
> on
> the color are subsequently updated. To change color, the brush is deassign 
> from
> the first color and then the brush is assign to the new color. To lift, the
> brush is deassign from the color. This is the abstraction the seems to prevail
> in userland at the moment.
> 
> > can't you just slot in an extra event that contains only the
> > ABS_MT_TRACKING_ID -1 for the needed slots, followed by an SYN_REPORT and
> > whatever BTN_TOOL_* updates are needed? You don't need extra slots here,
> > you're just putting one extra event in the queue before handling the new
> > touches as usual.
> 
> So you want to add a rule saying that before a brush changes color, it first 
> has
> to be cleaned. That may look simple enough, but it misses out on several 
> subtleties.
> 
> 1. It is no longer possible to create beautiful contiuous tracks of varying 
> color.
>
> 2. When a brush moves quickly, it will sometimes restart the track with a new
> color. This happens on all hardware with tracking support when you approach 
> the
> sampling limit. It happens in the kernel tracking as well, for the same 
> reasons.
> Incompatible with 1.
> 
> 3. There is a difference between losing track of a brush and lifting a brush.
> This is one of the situations where the add/remove protocol has to create very
> nonintuitive restrictions and rules to cope. The reason starts with 1.
> 
> Forcing tracks (brushes) into the add/remove protocol creates problems that 
> are
> on a more fundamental level than the subtle issues one may hope to resolve.
> 
> > thing is: I've always assumed that a touch is terminated by a -1 event
> > and this hasn't been a problem until very recently.
> 
> We have talked a lot about the differences, they can hardly have escaped 
> anyone
> deeply involved. 

well, they did. I honestly barely recall any conversations about that
protocol. it's now what, 5 years ago? and since the protocol itself worked
mostly fine I never had to think much about it, short of the various issues
with SYN_DROPPED.

I read through the documentation again after the weekend with fresh eyes and
it IMO can be read both ways. Couple that with seeing tracking IDs of -1 for
a couple of years before this issue came up and here we are at the current
situation. So regardless of what will eventually get merged, I recommend
putting an extra sentence in to explicitly spell out that a tracking ID can
change directly from non-negative to non-negative, and when this is allowed
to happen and what it means to the userspace process. And add an example for
it in the examples section.

> It is true that this is not normally a problem. It only becomes
> important when the sampling rate is too low to resolve all the actions we deem
> important.
> 
> > so anything I've ever
> > touched will be broken if we start switching tracking IDs directly.
> > That
> > includes xorg input, libinput and anything that uses libevdev. sorry.
> 
> This has been in the mainline kernel for the last five years, and obvisouly
> still works well most of the time. I sometimes experience glitches in the
> trackpad usage on my laptop, and it probably stems from this issues. It is
> slightly annoying, but not broken. No reason to panic.

what you're seeing is most likely the effect of libevdev.
libevdev discards the extra tracking ID and the driver will think it's the
same touch. which fixes the various stuck touch issues that we had, along
with crashes, and a couple of memory overflows (specifically in synaptics).

> > if the kernel switches from one tracking ID to another directly,
> > libevdev will actually discard the new tracking ID.
> > http://cgit.freedesktop.org/libevdev/tree/libevdev/libevdev.c#n968
> > (sorry again) aside from the warning, it's safe to switch directly though,
> > there shouldn't be any side-effects. 
> > as for fixing this: I can add something to libevdev to allow it but I'l

[PATCH 1/1] Documentation: Add dt-binding for TI-btwilink driver

2015-04-26 Thread Gigi Joseph
btwilink binds bluetooth hci0 interface with the shared transport driver

Signed-off-by: Gigi Joseph 
---
 Documentation/devicetree/bindings/btwilink.txt | 15 +++
 1 file changed, 15 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/btwilink.txt

diff --git a/Documentation/devicetree/bindings/btwilink.txt 
b/Documentation/devicetree/bindings/btwilink.txt
new file mode 100644
index 000..d286aea
--- /dev/null
+++ b/Documentation/devicetree/bindings/btwilink.txt
@@ -0,0 +1,15 @@
+btwilink
+
+
+Required properties:
+
+   - compatible : must be "ti,btwilink"
+
+Example:
+
+Enable the btwilink driver to bind the bluetooth hci0 interface with
+ti-st shared transport driver
+
+btwilink {
+   compatible = "ti,btwilink";
+};
-- 
1.9.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: Broadcom 43340 module on iMX6DL

2015-04-26 Thread Dong Aisheng
On Thu, Apr 23, 2015 at 05:50:33PM -0700, John Tobias wrote:
> Hello Guys,
> 
> I have a follow up questions:
> 
> 
> When the I power up the brcm44340 without loading the driver, the
> sdhci-esdhc-imx host controller configured it with the following info
> (cat /sys/kernel/debug/mmc0/ios):
> clock: 5000 Hz
> actual clock: 4950 Hz
> vdd: 17 (2.9 ~ 3.0 V)
> bus mode: 2 (push-pull)
> chip select: 0 (don't care)
> power mode: 2 (on)
> bus width: 2 (4 bits)
> timing spec: 2 (sd high-speed)
> signal voltage: 0 (3.30 V)
> 
> 
> Then, when I load the bcmdhd driver, the driver changed the clock to:

It seems the host is re-enumerating the card when load bcmdhd driver...
This might be required by WiFi driver.

> clock: 40 Hz
> actual clock: 386718 Hz
> vdd: 17 (2.9 ~ 3.0 V)
> bus mode: 2 (push-pull)
> chip select: 0 (don't care)
> power mode: 2 (on)
> bus width: 0 (1 bits)
> timing spec: 0 (legacy)
> signal voltage: 0 (3.30 V)
> 
> Trace from sdhci-esdhc-imx:
> MMC0: sdhci-esdhc-imx:  desired SD clock: 40, actual: 386718
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 40, actual: 386718
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 40, actual: 386718
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 40, actual: 386718
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 40, actual: 386718
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 30, actual: 281250
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 30, actual: 281250
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 30, actual: 281250
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 30, actual: 281250
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 30, actual: 281250
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  change pinctrl state for uhs 0
> MMC0: sdhci-esdhc-imx:  desired SD clock: 20, actual: 193359
> 
> Does the driver need to change the clock when loading the firmware?.
> 
> Is it possible to tell to the driver to skip changing the clock?.
> 
> Or any work around for the problem?.
> 

It is a feature implemented by MMC core that re-try a slower clock
when enumerate fails.
See:
drivers/mmc/core/core.c
mmc_claim_host(host);
for (i = 0; i < ARRAY_SIZE(freqs); i++) {
if (!mmc_rescan_try_freq(host, max(freqs[i], host->f_min)))
break;
if (freqs[i] <= host->f_min)
break;
}
mmc_release_host(host);

Regards
Dong Aisheng

> Note: attached is a verbose logs of the driver.
> 
> Regards,
> 
> John
> 
> On Thu, Apr 23, 2015 at 12:00 PM, Arend van Spriel  wrote:
> > + John Stultz
> >
> >
> > On 04/23/15 20:44, John Tobias wrote:
> >>
> >> Thanks Dmitry for the info.
> >>
> >> Arend:
> >>
> >> Yes, it's an android... Here's the info:
> >>
> >> 00060e80  de 02 f0 18 8c 00 e8 5e  8f 00 37 a3 00 e0 5e 8a
> >> |...^..7...^.|
> >> 00060e90  f4 77 a2 00 02 de 02 f0  00 00 01 bc 60 03 00 07
> >> |.w..`...|
> >> 00060ea0  aa 01 bc 60 03 00 07 ab  01 bc 60 03 00 07 b7 01
> >> |...`..`.|
> >> 00060eb0  bc 60 13 08 17 a1 00 02  5e 02 f0 01 28 00 b0 40
> >> |.`..^...(..@|
> >> 00060ec0  67 00 17 a3 01 80 60 02  03 37 a2 00 02 5e 02 f0
> >> |g.`..7...^..|
> >> 00060ed0  01 2c 00 b0 5e 8f 00 17  a2 00 02 5e 02 f0 01 2c
> >> |.,..^..^...,|
> >> 00060ee0  00 02 de 02 f0 00 00 01  bc 60 63 00 10 7b 00 b0
> >> |.`c..{..|
> >> 00060ef0  5e 8b 00 10 7a 01 ac 60  7e f4 30 75 02 87 41 d7
> >> |^...z..`~.0u..A.|
> >> 00060f00  00 18 9c 00 02 de 02 f0  00 00 01 bc 60 63 00 10
> >> |`c..|
> >> 00060f10  7b 00 b0 5e 8b 00 10 7a  01 ac 60 be f4 30 75 02
> >> |{..^...z..`..0u.|
> >> 00060f20  87 41 d7 00 18 a1 00 02  de 02 f0 00 00 00 00 00
> >> |.A..|
> >> 00060f30  00 00 00 00 7c ac 00 00  2d cb a7 58 06 0a be 31
> >> ||...-..X...1|
> >> 00060f40  b1 8d a0 53 00 5b 07 49  45 13 20 4e 7d 7e 47 28  |...S.[.IE.
> >> N}~G(|
> >> 00060f50  08 7c 77 d2 bc 44 87 13  01 bd 32 08 01 00 34 33
> >> |.|w..D2...43|
> >> 00060f60  33 34 31 62 30 2d 72 6f  6d 6c 2f 73 64 69 6f 2d
> >> |341b0-roml/sdio-|
> >> 00060f70  61 67 2d 70 6e 6f 2d 70  32 70 2d 63 63 78 2d 65
> >> |ag-pno-p2p-ccx-e|
> >> 00060f80  78 74 73 75 70 2d 70 72  6f 70 74 78 73 74 61 74
> >> |xtsup-proptxstat|
> >> 00060f90  75 73 2d 64 6d 61 74 78  72 63 2d 72 78 6f 76 2d
> >> |us-dmatxrc-rxov-|
> >> 00060fa0  70 6b 74 66 69 6c 74 65  72 2d 6b 65 65 70 61 6c
> >> |pktfilter-keepal|
> >> 00060fb0  69 76 65 2d 61 6f 65 2d

Re: Broadcom 43340 module on iMX6DL

2015-04-26 Thread Dong Aisheng
On Fri, Apr 24, 2015 at 09:03:04PM +0200, Arend van Spriel wrote:
> On 04/24/15 20:24, John Tobias wrote:
> >Hi Arend,
> >
> >Apologize for the confusion. I am asking the repo for the device
> >driver for 43340. Looking at the link you sent, it's more userspace
> >support and didn't see the device driver there...
> 
> crap. you are right. it is userspace and firmware. You need a kernel
> repo. There are some on the site I referred to, but you may need to
> contact Freescale whether they provide it publicly like on github or
> so.
> 

One simple question:
Does the brcmfmac driver in upstream kernel also work?
I mean this one:
drivers/net/wireless/brcm80211

Regards
Dong Aisheng

> Regards,
> Arend
> 
> >Regards,
> >
> >John
> >
> >
> >On Fri, Apr 24, 2015 at 11:14 AM, Arend van Spriel  
> >wrote:
> >>On 04/24/15 19:49, John Tobias wrote:
> >>>
> >>>Hi Arend,
> >>>
> >>>I am not pretty sure if the brcm43340 driver for android is the latest
> >>>one.  May I know repo?.
> >>
> >>
> >>Not sure what you are asking. I gave the url. Did you try using the
> >>brcmfmac4334-sdio.bin firmware file. I would like to know if that one works
> >>for your device.
> >>
> >>Regards,
> >>Arend
> >>
> >>
> >>>Regards,
> >>>
> >>>John
> >>>
> >>>On Fri, Apr 24, 2015 at 1:20 AM, Arend van Spriel
> >>>wrote:
> 
> On 04/24/15 03:04, John Tobias wrote:
> >
> >
> >Btw, where I could get a copy of the latest driver?.
> 
> 
> 
> The open-source bcmdhd is in AOSP [1]. I would stick to the android
> release
> branch you are running on your device.
> 
> Regards,
> Arend
> 
> [1] https://android.googlesource.com/platform/hardware/broadcom/wlan/
> 
> 
> >Regards,
> >
> >John
> >
> >On Thu, Apr 23, 2015 at 5:59 PM, John Tobias
> >wrote:
> >>
> >>
> >>Hi John,
> >>
> >>Is it possible to have a copy of the firmware for 43340?.
> >>
> >>Regards,
> >>
> >>John
> >>
> >>On Thu, Apr 23, 2015 at 5:57 PM, John Stultz
> >>wrote:
> >>>
> >>>
> >>>On Thu, Apr 23, 2015 at 12:00 PM, Arend van Spriel
> >>>wrote:
> 
> 
> By the name of the file I suspected you did. Personally, I verified
> the
> firmware works on 43341. John Stultz tested both 43340 and 43341 with
> this
> firmware.
> >>>
> >>>
> >>>
> >>>Minor correction here, I only tested on 43341 hardware. The confusion
> >>>might be that the firmware I originally had access to claimed it was
> >>>43340.
> >>>
> >>>thanks
> >>>-john
> 
> 
> 
> >>
> 
--
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] spi: omap2-mcspi: Add support for GPIO chipselects

2015-04-26 Thread Michael Welling
This patch allows for GPIOs specified in the devicetree to be used as SPI
chipselects on TI OMAP2 SoCs.

Tested on the AM3354.

Signed-off-by: Michael Welling 
---

v2: Considers the possible use of SPI_CS_HIGH during chip select activation.

 drivers/spi/spi-omap2-mcspi.c |   13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index d1a5b9f..5e388a8 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -35,6 +35,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -246,6 +247,12 @@ static void omap2_mcspi_force_cs(struct spi_device *spi, 
int cs_active)
 {
u32 l;
 
+   if (gpio_is_valid(spi->cs_gpio)) {
+   gpio_set_value(spi->cs_gpio, (cs_active) ?
+   !!(spi->mode & SPI_CS_HIGH) :
+   !(spi->mode & SPI_CS_HIGH));
+   }
+
l = mcspi_cached_chconf0(spi);
if (cs_active)
l |= OMAP2_MCSPI_CHCONF_FORCE;
@@ -1015,6 +1022,12 @@ static int omap2_mcspi_setup(struct spi_device *spi)
if (ret < 0)
return ret;
 
+   if (gpio_is_valid(spi->cs_gpio)) {
+   if (gpio_request(spi->cs_gpio, dev_name(&spi->dev)) == 0)
+   gpio_direction_output(spi->cs_gpio,
+   !(spi->mode & SPI_CS_HIGH));
+   }
+
ret = omap2_mcspi_setup_transfer(spi, NULL);
pm_runtime_mark_last_busy(mcspi->dev);
pm_runtime_put_autosuspend(mcspi->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/


RE: [PATCH] perf/x86/intel/uncore: fix IMC missing box initialization

2015-04-26 Thread Liang, Kan

>
> > This leads me to believe that this patch:
> >
> > commit c05199e5a57a579fea1e8fa65e2b511ceb524ffc
> > Author: Kan Liang 
> > Date:   Tue Jan 20 04:54:25 2015 +
> >
> > perf/x86/intel/uncore: Move uncore_box_init() out of driver
> initialization
> >
> > If I revert it, I bet things will work again.
>
> Yes the initialization needs to be moved out of the IPI context.
>

Maybe we can move them to event init, which is not in IPI context.

What do you think of this patch?

---

>From 8a61c48144921e9d1c841656829c3bae9bfb4408 Mon Sep 17 00:00:00 2001
From: Kan Liang 
Date: Sun, 26 Apr 2015 16:24:59 -0400
Subject: [PATCH 1/1] perf/x86/intel/uncore: move uncore_box_init to uncore
 event init

commit c05199e5a57a("perf/x86/intel/uncore: Move uncore_box_init() out
of driver initialization") moves uncore_box_init into uncore_enable_box
to prevent potential boot failures. However, uncore_enable_box is not
called on some client platforms (SNB/IVB/HSW) for counting IMC event.
When it is not called, the box is not initialized, which hard locks the
system.

Additionally, uncore_enable_box along with the initialization code in it
is always called in uncore event start functions, which are in IPI
context. But the initizlization code should not be in IPI context. This
is because, for example, the IMC box initialization codes for client
platforms include ioremap, which is not allowed to be called in IPI
context.

This patch moves uncore_box_init out of IPI context, to uncore event
init. The box is initialized only when it has not yet been initialized.

Signed-off-by: Kan Liang 
---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 4 
 arch/x86/kernel/cpu/perf_event_intel_uncore.h | 2 --
 arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c | 3 +++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c 
b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index c635b8b..cbc1a93 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -623,6 +623,10 @@ static int uncore_pmu_event_init(struct perf_event *event)
box = uncore_pmu_to_box(pmu, event->cpu);
if (!box || box->cpu < 0)
return -EINVAL;
+
+   /* Init box if it's not initialized yet */
+   uncore_box_init(box);
+
event->cpu = box->cpu;

event->hw.idx = -1;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h 
b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index 6c8c1e7..1fb2905 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -273,8 +273,6 @@ static inline void uncore_disable_box(struct 
intel_uncore_box *box)

 static inline void uncore_enable_box(struct intel_uncore_box *box)
 {
-   uncore_box_init(box);
-
if (box->pmu->type->ops->enable_box)
box->pmu->type->ops->enable_box(box);
 }
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c 
b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
index 4562e9e..ead70a6 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
@@ -279,6 +279,9 @@ static int snb_uncore_imc_event_init(struct perf_event 
*event)
if (!box || box->cpu < 0)
return -EINVAL;

+   /* Init box if it's not initialized yet */
+   uncore_box_init(box);
+
event->cpu = box->cpu;

event->hw.idx = -1;

Thanks,
Kan

> -Andi
>
>
> --
> a...@linux.intel.com -- Speaking for myself only
--
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: Broadcom 43340 module on iMX6DL

2015-04-26 Thread Dong Aisheng
On Fri, Apr 24, 2015 at 09:03:04PM +0200, Arend van Spriel wrote:
> On 04/24/15 20:24, John Tobias wrote:
> >Hi Arend,
> >
> >Apologize for the confusion. I am asking the repo for the device
> >driver for 43340. Looking at the link you sent, it's more userspace
> >support and didn't see the device driver there...
> 
> crap. you are right. it is userspace and firmware. You need a kernel
> repo. There are some on the site I referred to, but you may need to
> contact Freescale whether they provide it publicly like on github or
> so.
> 

Freescale does not provide Broadcom driver currently.
It might provide it for MX7D release in the future due to MX7D SDB board
integrated a Broadcom WiFi chip.
But it depends on whether the SLA signed with Broadcom can be ready
before the release.

Regards
Dong Aisheng

> Regards,
> Arend
> 
> >Regards,
> >
> >John
> >
> >
> >On Fri, Apr 24, 2015 at 11:14 AM, Arend van Spriel  
> >wrote:
> >>On 04/24/15 19:49, John Tobias wrote:
> >>>
> >>>Hi Arend,
> >>>
> >>>I am not pretty sure if the brcm43340 driver for android is the latest
> >>>one.  May I know repo?.
> >>
> >>
> >>Not sure what you are asking. I gave the url. Did you try using the
> >>brcmfmac4334-sdio.bin firmware file. I would like to know if that one works
> >>for your device.
> >>
> >>Regards,
> >>Arend
> >>
> >>
> >>>Regards,
> >>>
> >>>John
> >>>
> >>>On Fri, Apr 24, 2015 at 1:20 AM, Arend van Spriel
> >>>wrote:
> 
> On 04/24/15 03:04, John Tobias wrote:
> >
> >
> >Btw, where I could get a copy of the latest driver?.
> 
> 
> 
> The open-source bcmdhd is in AOSP [1]. I would stick to the android
> release
> branch you are running on your device.
> 
> Regards,
> Arend
> 
> [1] https://android.googlesource.com/platform/hardware/broadcom/wlan/
> 
> 
> >Regards,
> >
> >John
> >
> >On Thu, Apr 23, 2015 at 5:59 PM, John Tobias
> >wrote:
> >>
> >>
> >>Hi John,
> >>
> >>Is it possible to have a copy of the firmware for 43340?.
> >>
> >>Regards,
> >>
> >>John
> >>
> >>On Thu, Apr 23, 2015 at 5:57 PM, John Stultz
> >>wrote:
> >>>
> >>>
> >>>On Thu, Apr 23, 2015 at 12:00 PM, Arend van Spriel
> >>>wrote:
> 
> 
> By the name of the file I suspected you did. Personally, I verified
> the
> firmware works on 43341. John Stultz tested both 43340 and 43341 with
> this
> firmware.
> >>>
> >>>
> >>>
> >>>Minor correction here, I only tested on 43341 hardware. The confusion
> >>>might be that the firmware I originally had access to claimed it was
> >>>43340.
> >>>
> >>>thanks
> >>>-john
> 
> 
> 
> >>
> 
--
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/2] ppp: mppe: fixes MPPE desync on links which don't guarantee packet ordering

2015-04-26 Thread David Miller
From: Sylvain Rochet 
Date: Sun, 26 Apr 2015 20:40:51 +0200

> I am currently having an issue with PPP over L2TP (UDP) and MPPE in
> stateless mode (default mode), UDP does not guarantee packet ordering so
> we might get out of order packet. MPPE needs to be continuously synched
> so we should drop late UDP packet.
> 
> I added a printk on the number of time we rekeyed in MPPE decompressor,
> this is what we currently have if we receive a slightly out of order UDP
> packet:
 ...
> This is obviously wrong, we missed packet 1561 and we already rekeyed 2
> times for 1562 we previously received, we can't recover the decryption
> key we need for 1561, we should drop it instead of rekeying 4095 times.
> 
> This patch series drop any packet with are not within the 4096/2 forward
> window.

Series applied, thanks Sylvain.
--
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 v3] dmaengine: xgene-dma: Fix sparse wannings and coccinelle warnings

2015-04-26 Thread Vinod Koul
On Mon, Apr 20, 2015 at 08:38:18AM +0530, Rameshwar Sahu wrote:
> Hi Vinod,
>> >> @@ -2085,6 +2043,5 @@ module_platform_driver(xgene_dma_driver);
> >>
> >>  MODULE_DESCRIPTION("APM X-Gene SoC DMA driver");
> >>  MODULE_AUTHOR("Rameshwar Prasad Sahu ");
> >> -MODULE_AUTHOR("Loc Ho ");
> > And why this?
> 
> I saw below warning reported by the kbuild robot test
> 
> drivers/dma/xgene-dma.c:2088:1: sparse: symbol
> '__UNIQUE_ID_author__COUNTER__' has multiple initializers (originally
> initialized at drivers/dma/xgene-dma.c:2087)
> So, I kept only one author here.
No that is not right, sparse shouldn't have cribbed here.

Fengguang can we get the bot to ignore this please

-- 
~Vinod

--
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 PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-26 Thread Zheng, Lv
Hi,

> From: Borislav Petkov [mailto:b...@alien8.de]
> Sent: Friday, March 27, 2015 5:23 PM
> 
> From: Jiri Kosina 
> 
> Since GHES sources are global, we theoretically need only a single CPU
> reading them per NMI instead of a thundering herd of CPUs waiting on a
> spinlock in NMI context for no reason at all.
> 
> Do that.
> 
> Signed-off-by: Jiri Kosina 
> Signed-off-by: Borislav Petkov 
> ---
>  drivers/acpi/apei/ghes.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index 94a44bad5576..2bfd53cbfe80 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -729,10 +729,10 @@ static struct llist_head ghes_estatus_llist;
>  static struct irq_work ghes_proc_irq_work;
> 
>  /*
> - * NMI may be triggered on any CPU, so ghes_nmi_lock is used for
> - * mutual exclusion.
> + * NMI may be triggered on any CPU, so ghes_in_nmi is used for
> + * having only one concurrent reader.
>   */
> -static DEFINE_RAW_SPINLOCK(ghes_nmi_lock);
> +static atomic_t ghes_in_nmi = ATOMIC_INIT(0);
> 
>  static LIST_HEAD(ghes_nmi);
> 
> @@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned int cmd, struct 
> pt_regs *regs)
>   struct ghes *ghes;
>   int sev, ret = NMI_DONE;
> 
> - raw_spin_lock(&ghes_nmi_lock);
> + if (!atomic_add_unless(&ghes_in_nmi, 1, 1))
> + return ret;
> +

Just a simple question.
Why not just using cmpxchg here instead of atomic_add_unless so that no 
atomic_dec will be needed.

Thanks and best regards
-Lv

>   list_for_each_entry_rcu(ghes, &ghes_nmi, list) {
>   if (ghes_read_estatus(ghes, 1)) {
>   ghes_clear_estatus(ghes);
> @@ -863,7 +865,7 @@ static int ghes_notify_nmi(unsigned int cmd, struct 
> pt_regs *regs)
>  #ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG
>   irq_work_queue(&ghes_proc_irq_work);
>  #endif
> - raw_spin_unlock(&ghes_nmi_lock);
> + atomic_dec(&ghes_in_nmi);
>   return ret;
>  }
> 
> --
> 2.3.3

--
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 v4 03/10] lib: public headers and API implementations for userspace programs

2015-04-26 Thread Hajime Tazaki
userspace programs which uses libos access via a public API, lib_init(),
with passed arguments struct SimImported and struct SimExported.

Signed-off-by: Hajime Tazaki 
Signed-off-by: Ryo Nakamura 
---
 arch/lib/include/sim-assert.h |  23 +++
 arch/lib/include/sim-init.h   | 134 ++
 arch/lib/include/sim-printf.h |  13 ++
 arch/lib/include/sim-types.h  |  53 ++
 arch/lib/include/sim.h|  51 ++
 arch/lib/lib-device.c | 187 +++
 arch/lib/lib-socket.c | 410 ++
 arch/lib/lib.c| 294 ++
 arch/lib/lib.h|  21 +++
 9 files changed, 1186 insertions(+)
 create mode 100644 arch/lib/include/sim-assert.h
 create mode 100644 arch/lib/include/sim-init.h
 create mode 100644 arch/lib/include/sim-printf.h
 create mode 100644 arch/lib/include/sim-types.h
 create mode 100644 arch/lib/include/sim.h
 create mode 100644 arch/lib/lib-device.c
 create mode 100644 arch/lib/lib-socket.c
 create mode 100644 arch/lib/lib.c
 create mode 100644 arch/lib/lib.h

diff --git a/arch/lib/include/sim-assert.h b/arch/lib/include/sim-assert.h
new file mode 100644
index 000..974122c
--- /dev/null
+++ b/arch/lib/include/sim-assert.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2015 INRIA, Hajime Tazaki
+ *
+ * Author: Mathieu Lacage 
+ * Hajime Tazaki 
+ */
+
+#ifndef SIM_ASSERT_H
+#define SIM_ASSERT_H
+
+#include "sim-printf.h"
+
+#define lib_assert(v) {
\
+   while (!(v)) {  \
+   lib_printf("Assert failed %s:%u \"" #v "\"\n",  \
+   __FILE__, __LINE__);\
+   char *p = 0;\
+   *p = 1; \
+   }   \
+   }
+
+
+#endif /* SIM_ASSERT_H */
diff --git a/arch/lib/include/sim-init.h b/arch/lib/include/sim-init.h
new file mode 100644
index 000..e871a59
--- /dev/null
+++ b/arch/lib/include/sim-init.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2015 INRIA, Hajime Tazaki
+ *
+ * Author: Mathieu Lacage 
+ * Hajime Tazaki 
+ */
+
+#ifndef SIM_INIT_H
+#define SIM_INIT_H
+
+#include 
+#include "sim-types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _IO_FILE;
+typedef struct _IO_FILE FILE;
+
+struct SimExported {
+   struct SimTask *(*task_create)(void *priv, unsigned long pid);
+   void (*task_destroy)(struct SimTask *task);
+   void *(*task_get_private)(struct SimTask *task);
+
+   int (*sock_socket)(int domain, int type, int protocol,
+   struct SimSocket **socket);
+   int (*sock_close)(struct SimSocket *socket);
+   ssize_t (*sock_recvmsg)(struct SimSocket *socket, struct msghdr *msg,
+   int flags);
+   ssize_t (*sock_sendmsg)(struct SimSocket *socket,
+   const struct msghdr *msg, int flags);
+   int (*sock_getsockname)(struct SimSocket *socket,
+   struct sockaddr *name, int *namelen);
+   int (*sock_getpeername)(struct SimSocket *socket,
+   struct sockaddr *name, int *namelen);
+   int (*sock_bind)(struct SimSocket *socket, const struct sockaddr *name,
+   int namelen);
+   int (*sock_connect)(struct SimSocket *socket,
+   const struct sockaddr *name, int namelen,
+   int flags);
+   int (*sock_listen)(struct SimSocket *socket, int backlog);
+   int (*sock_shutdown)(struct SimSocket *socket, int how);
+   int (*sock_accept)(struct SimSocket *socket,
+   struct SimSocket **newSocket, int flags);
+   int (*sock_ioctl)(struct SimSocket *socket, int request, char *argp);
+   int (*sock_setsockopt)(struct SimSocket *socket, int level,
+   int optname,
+   const void *optval, int optlen);
+   int (*sock_getsockopt)(struct SimSocket *socket, int level,
+   int optname,
+   void *optval, int *optlen);
+
+   void (*sock_poll)(struct SimSocket *socket, void *ret);
+   void (*sock_pollfreewait)(void *polltable);
+
+   struct SimDevice *(*dev_create)(const char *ifname, void *priv,
+   enum SimDevFlags flags);
+   void (*dev_destroy)(struct SimDevice *dev);
+   void *(*dev_get_private)(struct SimDevice *task);
+   void (*dev_set_address)(struct SimDevice *dev,
+   unsigned char buffer[6]);
+   void (*dev_set_mtu)(struct SimDevice *dev, int mtu);
+   struct SimDevicePacket (*dev_create_packet)(struct SimDevice *dev,
+   int size);
+   void 

[PATCH v4 10/10] lib: tools used for test scripts

2015-04-26 Thread Hajime Tazaki
These auxiliary files are used for testing and debugging of net/ code
with libos. a simple test is implemented with make test ARCH=lib.

Signed-off-by: Hajime Tazaki 
---
 tools/testing/libos/.gitignore   |  6 +
 tools/testing/libos/Makefile | 38 +++
 tools/testing/libos/README   | 15 +++
 tools/testing/libos/bisect.sh| 10 +++
 tools/testing/libos/dce-test.sh  | 23 
 tools/testing/libos/nuse-test.sh | 57 
 6 files changed, 149 insertions(+)
 create mode 100644 tools/testing/libos/.gitignore
 create mode 100644 tools/testing/libos/Makefile
 create mode 100644 tools/testing/libos/README
 create mode 100755 tools/testing/libos/bisect.sh
 create mode 100755 tools/testing/libos/dce-test.sh
 create mode 100755 tools/testing/libos/nuse-test.sh

diff --git a/tools/testing/libos/.gitignore b/tools/testing/libos/.gitignore
new file mode 100644
index 000..57a74a0
--- /dev/null
+++ b/tools/testing/libos/.gitignore
@@ -0,0 +1,6 @@
+*.pcap
+files-*
+bake
+buildtop
+core
+exitprocs
diff --git a/tools/testing/libos/Makefile b/tools/testing/libos/Makefile
new file mode 100644
index 000..3da25429
--- /dev/null
+++ b/tools/testing/libos/Makefile
@@ -0,0 +1,38 @@
+ADD_PARAM?=
+
+all: test
+
+bake:
+   hg clone http://code.nsnam.org/bake
+
+check_pkgs:
+   @./bake/bake.py check | grep Bazaar | grep OK || (echo "bzr is missing" 
&& ./bake/bake.py check)
+   @./bake/bake.py check | grep autoreconf | grep OK || (echo "autotools 
is missing" && ./bake/bake.py check && exit 1)
+
+testbin: bake check_pkgs
+   @cp ../../../arch/lib/tools/bakeconf-linux.xml bake/bakeconf.xml
+   @mkdir -p buildtop/build/bin_dce
+   cd buildtop ; \
+   ../bake/bake.py configure -e dce-linux-inkernel $(BAKECONF_PARAMS)
+   cd buildtop ; \
+   ../bake/bake.py show --enabledTree | grep -v  -E 
"pygoocanvas|graphviz|python-dev" | grep Missing && (echo "required packages 
are missing") || echo ""
+   cd buildtop ; \
+   ../bake/bake.py download ; \
+   ../bake/bake.py update ; \
+   ../bake/bake.py build
+
+test:
+   @./dce-test.sh ADD_PARAM=$(ADD_PARAM)
+
+test-valgrind:
+   @./dce-test.sh -g ADD_PARAM=$(ADD_PARAM)
+
+test-fault-injection:
+   @./dce-test.sh -f ADD_PARAM=$(ADD_PARAM)
+
+clean:
+#  @rm -rf buildtop
+   @rm -f *.pcap
+   @rm -rf files-*
+   @rm -f exitprocs
+   @rm -f core
diff --git a/tools/testing/libos/README b/tools/testing/libos/README
new file mode 100644
index 000..51ac5a5
--- /dev/null
+++ b/tools/testing/libos/README
@@ -0,0 +1,15 @@
+
+- bisect.sh
+a sample script to bisect an issue of network stack code with the help
+of LibOS (and ns-3 network simulator). This was used to detect the issue
+for the following patch.
+
+http://patchwork.ozlabs.org/patch/436351/
+
+- dce-test.sh
+a test script invoked by 'make test ARCH=lib'. The contents of test
+scenario are implemented as test suites of ns-3 network simulator.
+
+- nuse-test.sh
+a simple test script for Network Stack in Userspace (NUSE).
+
diff --git a/tools/testing/libos/bisect.sh b/tools/testing/libos/bisect.sh
new file mode 100755
index 000..9377ac3
--- /dev/null
+++ b/tools/testing/libos/bisect.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+git merge origin/nuse --no-commit
+make clean ARCH=lib
+make library ARCH=lib OPT=no
+make test ARCH=lib ADD_PARAM=" -s dce-umip"
+RET=$?
+git reset --hard
+
+exit $RET
diff --git a/tools/testing/libos/dce-test.sh b/tools/testing/libos/dce-test.sh
new file mode 100755
index 000..e81e2d8
--- /dev/null
+++ b/tools/testing/libos/dce-test.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+#set -x
+export LD_LOG=symbol-fail
+#VERBOSE="-v"
+VALGRIND=""
+FAULT_INJECTION=""
+
+if [ "$1" = "-g" ] ; then
+ VALGRIND="-g"
+# Not implemneted yet.
+#elif [ "$1" = "-f" ] ; then
+# FAULT_INJECTION="-f"
+fi
+
+# FIXME
+#export NS_ATTRIBUTE_DEFAULT='ns3::DceManagerHelper::LoaderFactory=ns3::\
+#DlmLoaderFactory[];ns3::TaskManager::FiberManagerType=UcontextFiberManager'
+
+cd buildtop/source/ns-3-dce
+LD_LIBRARY_PATH=${srctree} ./test.py -n ${VALGRIND} ${FAULT_INJECTION}\
+  ${VERBOSE} ${ADD_PARAM}
diff --git a/tools/testing/libos/nuse-test.sh b/tools/testing/libos/nuse-test.sh
new file mode 100755
index 000..198e7e4
--- /dev/null
+++ b/tools/testing/libos/nuse-test.sh
@@ -0,0 +1,57 @@
+#!/bin/bash -e
+
+LIBOS_TOOLS=arch/lib/tools
+
+IFNAME=`ip route |grep default | awk '{print $5}'`
+GW=`ip route |grep default | awk '{print $3}'`
+#XXX
+IPADDR=`echo $GW | sed -r "s/([0-9]+\.[0-9]+\.[0-9]+\.)([0-9]+)$/\1\`expr \2 + 
10\`/"`
+
+# ip route
+# ip address
+# ip link
+
+NUSE_CONF=/tmp/nuse.conf
+
+cat > ${NUSE_CONF} << ENDCONF
+
+interface ${IFNAME}
+   address ${IPADDR}
+   netmask 255.255.255.0
+   macaddr 00:01:01:01:01:02
+   viftype RAW
+
+route
+   network 0.0.0.0
+   netmask 0.0.0.0
+   gateway ${GW}
+
+ENDCONF
+
+cd ${LIBOS_TOOLS}

[PATCH v4 01/10] sysctl: make some functions unstatic to access by arch/lib

2015-04-26 Thread Hajime Tazaki
libos (arch/lib) emulates a sysctl-like interface by a function call of
userspace by enumerating sysctl tree from sysctl_table_root. It requires
to be publicly accessible to this symbol and related functions.

Signed-off-by: Hajime Tazaki 
---
 fs/proc/proc_sysctl.c | 36 +++-
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index fea2561..7c5924c 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -35,7 +35,7 @@ static struct ctl_table root_table[] = {
},
{ }
 };
-static struct ctl_table_root sysctl_table_root = {
+struct ctl_table_root sysctl_table_root = {
.default_set.dir.header = {
{{.count = 1,
  .nreg = 1,
@@ -77,8 +77,9 @@ static int namecmp(const char *name1, int len1, const char 
*name2, int len2)
 }
 
 /* Called under sysctl_lock */
-static struct ctl_table *find_entry(struct ctl_table_header **phead,
-   struct ctl_dir *dir, const char *name, int namelen)
+struct ctl_table *ctl_table_find_entry(struct ctl_table_header **phead,
+  struct ctl_dir *dir, const char *name,
+  int namelen)
 {
struct ctl_table_header *head;
struct ctl_table *entry;
@@ -300,7 +301,7 @@ static struct ctl_table *lookup_entry(struct 
ctl_table_header **phead,
struct ctl_table *entry;
 
spin_lock(&sysctl_lock);
-   entry = find_entry(&head, dir, name, namelen);
+   entry = ctl_table_find_entry(&head, dir, name, namelen);
if (entry && use_table(head))
*phead = head;
else
@@ -321,7 +322,7 @@ static struct ctl_node *first_usable_entry(struct rb_node 
*node)
return NULL;
 }
 
-static void first_entry(struct ctl_dir *dir,
+void ctl_table_first_entry(struct ctl_dir *dir,
struct ctl_table_header **phead, struct ctl_table **pentry)
 {
struct ctl_table_header *head = NULL;
@@ -339,7 +340,7 @@ static void first_entry(struct ctl_dir *dir,
*pentry = entry;
 }
 
-static void next_entry(struct ctl_table_header **phead, struct ctl_table 
**pentry)
+void ctl_table_next_entry(struct ctl_table_header **phead, struct ctl_table 
**pentry)
 {
struct ctl_table_header *head = *phead;
struct ctl_table *entry = *pentry;
@@ -670,7 +671,8 @@ static int proc_sys_readdir(struct file *file, struct 
dir_context *ctx)
 
pos = 2;
 
-   for (first_entry(ctl_dir, &h, &entry); h; next_entry(&h, &entry)) {
+   for (ctl_table_first_entry(ctl_dir, &h, &entry); h;
+ctl_table_next_entry(&h, &entry)) {
if (!scan(h, entry, &pos, file, ctx)) {
sysctl_head_finish(h);
break;
@@ -828,7 +830,7 @@ static struct ctl_dir *find_subdir(struct ctl_dir *dir,
struct ctl_table_header *head;
struct ctl_table *entry;
 
-   entry = find_entry(&head, dir, name, namelen);
+   entry = ctl_table_find_entry(&head, dir, name, namelen);
if (!entry)
return ERR_PTR(-ENOENT);
if (!S_ISDIR(entry->mode))
@@ -924,13 +926,13 @@ failed:
return subdir;
 }
 
-static struct ctl_dir *xlate_dir(struct ctl_table_set *set, struct ctl_dir 
*dir)
+struct ctl_dir *ctl_table_xlate_dir(struct ctl_table_set *set, struct ctl_dir 
*dir)
 {
struct ctl_dir *parent;
const char *procname;
if (!dir->header.parent)
return &set->dir;
-   parent = xlate_dir(set, dir->header.parent);
+   parent = ctl_table_xlate_dir(set, dir->header.parent);
if (IS_ERR(parent))
return parent;
procname = dir->header.ctl_table[0].procname;
@@ -951,13 +953,13 @@ static int sysctl_follow_link(struct ctl_table_header 
**phead,
spin_lock(&sysctl_lock);
root = (*pentry)->data;
set = lookup_header_set(root, namespaces);
-   dir = xlate_dir(set, (*phead)->parent);
+   dir = ctl_table_xlate_dir(set, (*phead)->parent);
if (IS_ERR(dir))
ret = PTR_ERR(dir);
else {
const char *procname = (*pentry)->procname;
head = NULL;
-   entry = find_entry(&head, dir, procname, strlen(procname));
+   entry = ctl_table_find_entry(&head, dir, procname, 
strlen(procname));
ret = -ENOENT;
if (entry && use_table(head)) {
unuse_table(*phead);
@@ -1069,7 +1071,7 @@ static bool get_links(struct ctl_dir *dir,
/* Are there links available for every entry in table? */
for (entry = table; entry->procname; entry++) {
const char *procname = entry->procname;
-   link = find_entry(&head, dir, procname, strlen(procname));
+   link = ctl_table_find_entry(&head, dir, procname, 
strlen(procname));
if (!link)
return false;
  

[PATCH v4 07/10] lib: other kernel glue layer code

2015-04-26 Thread Hajime Tazaki
These files are used to provide the same function calls so that other
network stack code keeps untouched.

Signed-off-by: Hajime Tazaki 
Signed-off-by: Christoph Paasch 
---
 arch/lib/capability.c |  25 +
 arch/lib/filemap.c|  32 ++
 arch/lib/fs.c |  70 
 arch/lib/glue.c   | 289 ++
 arch/lib/modules.c|  36 +++
 arch/lib/pid.c|  29 +
 arch/lib/print.c  |  56 ++
 arch/lib/proc.c   |  34 ++
 arch/lib/random.c |  53 +
 arch/lib/sysfs.c  |  83 +++
 arch/lib/vmscan.c |  26 +
 11 files changed, 733 insertions(+)
 create mode 100644 arch/lib/capability.c
 create mode 100644 arch/lib/filemap.c
 create mode 100644 arch/lib/fs.c
 create mode 100644 arch/lib/glue.c
 create mode 100644 arch/lib/modules.c
 create mode 100644 arch/lib/pid.c
 create mode 100644 arch/lib/print.c
 create mode 100644 arch/lib/proc.c
 create mode 100644 arch/lib/random.c
 create mode 100644 arch/lib/sysfs.c
 create mode 100644 arch/lib/vmscan.c

diff --git a/arch/lib/capability.c b/arch/lib/capability.c
new file mode 100644
index 000..3a1f301
--- /dev/null
+++ b/arch/lib/capability.c
@@ -0,0 +1,25 @@
+/*
+ * glue code for library version of Linux kernel
+ * Copyright (c) 2015 INRIA, Hajime Tazaki
+ *
+ * Author: Mathieu Lacage 
+ * Hajime Tazaki 
+ */
+
+#include "linux/capability.h"
+
+struct sock;
+struct sk_buff;
+
+int file_caps_enabled = 0;
+
+int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
+{
+   return 0;
+}
+
+bool file_ns_capable(const struct file *file, struct user_namespace *ns,
+int cap)
+{
+   return true;
+}
diff --git a/arch/lib/filemap.c b/arch/lib/filemap.c
new file mode 100644
index 000..ce424ff
--- /dev/null
+++ b/arch/lib/filemap.c
@@ -0,0 +1,32 @@
+/*
+ * glue code for library version of Linux kernel
+ * Copyright (c) 2015 INRIA, Hajime Tazaki
+ *
+ * Author: Mathieu Lacage 
+ * Hajime Tazaki 
+ * Frederic Urbani
+ */
+
+#include "sim.h"
+#include "sim-assert.h"
+#include 
+
+
+ssize_t generic_file_aio_read(struct kiocb *a, const struct iovec *b,
+ unsigned long c, loff_t d)
+{
+   lib_assert(false);
+
+   return 0;
+}
+
+int generic_file_readonly_mmap(struct file *file, struct vm_area_struct *vma)
+{
+   return -ENOSYS;
+}
+
+ssize_t
+generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
+{
+   return 0;
+}
diff --git a/arch/lib/fs.c b/arch/lib/fs.c
new file mode 100644
index 000..324e10b
--- /dev/null
+++ b/arch/lib/fs.c
@@ -0,0 +1,70 @@
+/*
+ * glue code for library version of Linux kernel
+ * Copyright (c) 2015 INRIA, Hajime Tazaki
+ *
+ * Author: Mathieu Lacage 
+ * Hajime Tazaki 
+ * Frederic Urbani
+ */
+
+#include 
+
+#include "sim-assert.h"
+
+__cacheline_aligned_in_smp DEFINE_SEQLOCK(mount_lock);
+unsigned int dirtytime_expire_interval;
+
+void __init mnt_init(void)
+{
+}
+
+/* Implementation taken from vfs_kern_mount from linux/namespace.c */
+struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
+{
+   static struct mount local_mnt;
+   static int count = 0;
+   struct mount *mnt = &local_mnt;
+   struct dentry *root = 0;
+
+   /* XXX */
+   if (count != 0) return &local_mnt.mnt;
+   count++;
+
+   memset(mnt, 0, sizeof(struct mount));
+   if (!type)
+   return ERR_PTR(-ENODEV);
+   int flags = MS_KERNMOUNT;
+   char *name = (char *)type->name;
+
+   if (flags & MS_KERNMOUNT)
+   mnt->mnt.mnt_flags = MNT_INTERNAL;
+
+   root = type->mount(type, flags, name, data);
+   if (IS_ERR(root))
+   return ERR_CAST(root);
+
+   mnt->mnt.mnt_root = root;
+   mnt->mnt.mnt_sb = root->d_sb;
+   mnt->mnt_mountpoint = mnt->mnt.mnt_root;
+   mnt->mnt_parent = mnt;
+   /* DCE is monothreaded , so we do not care of lock here */
+   list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts);
+
+   return &mnt->mnt;
+}
+void inode_wait_for_writeback(struct inode *inode)
+{
+}
+void truncate_inode_pages_final(struct address_space *mapping)
+{
+}
+int dirtytime_interval_handler(struct ctl_table *table, int write,
+  void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+   return -ENOSYS;
+}
+
+unsigned int nr_free_buffer_pages(void)
+{
+   return 1024;
+}
diff --git a/arch/lib/glue.c b/arch/lib/glue.c
new file mode 100644
index 000..93f72d1
--- /dev/null
+++ b/arch/lib/glue.c
@@ -0,0 +1,289 @@
+/*
+ * glue code for library version of Linux kernel
+ * Copyright (c) 2015 INRIA, Hajime Tazaki
+ *
+ * Author: Mathieu Lacage 
+ * Hajime Tazaki 
+ * Frederic Urbani
+ */
+
+#include /* loff_t */
+#include /* ESPIPE */
+#include   /* PAGE_CACHE_SIZE */
+#include/* NAME_MAX */
+#include/* struct kstatfs */
+#inclu

  1   2   3   4   >