Re: [PATCH] time: Remove CONFIG_TIMER_STATS

2017-02-07 Thread John Stultz
On Tue, Feb 7, 2017 at 3:40 PM, Kees Cook  wrote:
> Currently CONFIG_TIMER_STATS exposes process information across namespaces:
>
> kernel/time/timer_list.c print_timer():
>
> SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
>
> /proc/timer_list:
>
>  #11: <>, hrtimer_wakeup, S:01, do_nanosleep, cron/2570
>
> Given that the tracer can give the same information, this patch entirely
> removes CONFIG_TIMER_STATS.
>
> Suggested-by: Thomas Gleixner 
> Signed-off-by: Kees Cook 

I don't have an issue with this, but I worry this would break some
tooling out there. Should it be marked as deprecated first?

Or maybe just pulling the band-aid off is the best way?

thanks
-john


Re: [PATCH] time: Remove CONFIG_TIMER_STATS

2017-02-07 Thread John Stultz
On Tue, Feb 7, 2017 at 3:40 PM, Kees Cook  wrote:
> Currently CONFIG_TIMER_STATS exposes process information across namespaces:
>
> kernel/time/timer_list.c print_timer():
>
> SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
>
> /proc/timer_list:
>
>  #11: <>, hrtimer_wakeup, S:01, do_nanosleep, cron/2570
>
> Given that the tracer can give the same information, this patch entirely
> removes CONFIG_TIMER_STATS.
>
> Suggested-by: Thomas Gleixner 
> Signed-off-by: Kees Cook 

I don't have an issue with this, but I worry this would break some
tooling out there. Should it be marked as deprecated first?

Or maybe just pulling the band-aid off is the best way?

thanks
-john


Re: [PATCH v2] PCI: pciehp: Don't enable PME on runtime suspend

2017-02-07 Thread Lukas Wunner
On Tue, Feb 07, 2017 at 05:04:45PM +0100, Rafael J. Wysocki wrote:
> On Tuesday, February 07, 2017 07:21:01 AM Lukas Wunner wrote:
> > On Mon, Feb 06, 2017 at 04:15:02PM -0600, Bjorn Helgaas wrote:
> > > On Mon, Feb 06, 2017 at 10:20:41PM +0100, Lukas Wunner wrote:
> > > > On Mon, Feb 06, 2017 at 11:54:05AM -0600, Bjorn Helgaas wrote:
> > > > > What is the hotplug event that causes generation of this wakeup event?
> > > > 
> > > > If you had read all e-mails in this thread or looked at the bugzilla
> > > > entry I've created, you wouldn't have to ask this question.
> > > 
> > > I'm sorry, I don't necessarily have time to sort through all the
> > > emails.  My idea is that the changelog should be a self-contained
> > > justification for the patch.  The bugzilla is for supporting details
> > > and future archaeologists.
> > > 
> > > > I think it's disappointing that you're asking me to jump through
> > > > various hoops like creating a bugzilla entry, as well as threatening
> > > > to revert my patch, but are unwilling to even look at the bugzilla
> > > > entry or read the entire thread.  It is equally disappointing that
> > > > the reporter of the regression was unwilling or unable to provide
> > > > dmesg output for both machines so that we've got no real idea what
> > > > we're dealing with.
> > > 
> > > I beg your pardon?  I don't think it's fair to malign Yinghai.  He's
> > > tested at least two machines and at least two patches, and it's only
> > > been two working days since he reported the problem.
> > 
> > I think the commercialization of Linux kernel development has put this
> > open source project in a sorry state if an unpaid volunteer is told off
> > because he expresses disappointment that a paid contributor is asking
> > him to debug an issue on secret hardware using secret patches and not
> > providing secret dmesg output.
> 
> That's not like a lot has changed in that respect for the last 10 years and
> I was in your spot at that time.

Thank you Rafael, means a lot.


> The bottom line, in any case, is that the current code causes problems to
> happen somewhere and as a rule we don't release code that is known to
> cause problems to happen to anyone.  This means something needs to be done
> about that and the choice at this point is pretty much between reverting and
> quirking the affected system(s).

Quirking is not an option in this case because the PCI device IDs of the
affected hotplug ports as well as DMI data are unknown.  Yinghai Lu is
refusing to publish that, for both affected systems.

To be honest I only care about runtime suspending *Thunderbolt* hotplug
ports.  I enabled it for *all* hotplug ports in 68db9bc81436 because it
seemed like the right thing to do.  However given the murkiness of the
spec and the odd quirks Yinghai Lu reported it's probably not worth the
effort.  One must bear in mind that we've only heard of systems with
2015+ BIOSes so far.  More problem reports may pile up once we push the
BIOS limit further back.

I have submitted a patch to recognize Thunderbolt ports, so what I have
in mind is to resubmit 68db9bc81436 with an additional is_thunderbolt
condition in pci_bridge_d3_possible().  The number of Thunderbolt chips
is small and I know them fairly well, so it's easy for me to judge the
potential for regressions and deal with them.

Alternatively Bjorn could apply the patch to recognize Thunderbolt
devices now and then I can submit a one-line fix which adds the
is_thunderbolt condition to pci_bridge_d3_possible().  This would
obviate the need to revert 68db9bc81436.


> You seem to be disappointed that Yinghai has reported the problem at all,
> given that the hardware is unreleased and so on, but problem reports,
> even for systems like that, are what allows us to create code that works
> for everybody, so we (the maintainers) appreciate them very much.

No problem with reporting regressions, but with denying information
required to provide a fix.  I had asked for full dmesg output for
both machines so that the PCI device IDs and DMI data are available,
but Yinghai Lu continues to withhold that.  I am thus denied the means
to provide a fix and am forced to watch reversion of 68db9bc81436
without being able to respond.

Thanks,

Lukas


Re: [PATCH v2] PCI: pciehp: Don't enable PME on runtime suspend

2017-02-07 Thread Lukas Wunner
On Tue, Feb 07, 2017 at 05:04:45PM +0100, Rafael J. Wysocki wrote:
> On Tuesday, February 07, 2017 07:21:01 AM Lukas Wunner wrote:
> > On Mon, Feb 06, 2017 at 04:15:02PM -0600, Bjorn Helgaas wrote:
> > > On Mon, Feb 06, 2017 at 10:20:41PM +0100, Lukas Wunner wrote:
> > > > On Mon, Feb 06, 2017 at 11:54:05AM -0600, Bjorn Helgaas wrote:
> > > > > What is the hotplug event that causes generation of this wakeup event?
> > > > 
> > > > If you had read all e-mails in this thread or looked at the bugzilla
> > > > entry I've created, you wouldn't have to ask this question.
> > > 
> > > I'm sorry, I don't necessarily have time to sort through all the
> > > emails.  My idea is that the changelog should be a self-contained
> > > justification for the patch.  The bugzilla is for supporting details
> > > and future archaeologists.
> > > 
> > > > I think it's disappointing that you're asking me to jump through
> > > > various hoops like creating a bugzilla entry, as well as threatening
> > > > to revert my patch, but are unwilling to even look at the bugzilla
> > > > entry or read the entire thread.  It is equally disappointing that
> > > > the reporter of the regression was unwilling or unable to provide
> > > > dmesg output for both machines so that we've got no real idea what
> > > > we're dealing with.
> > > 
> > > I beg your pardon?  I don't think it's fair to malign Yinghai.  He's
> > > tested at least two machines and at least two patches, and it's only
> > > been two working days since he reported the problem.
> > 
> > I think the commercialization of Linux kernel development has put this
> > open source project in a sorry state if an unpaid volunteer is told off
> > because he expresses disappointment that a paid contributor is asking
> > him to debug an issue on secret hardware using secret patches and not
> > providing secret dmesg output.
> 
> That's not like a lot has changed in that respect for the last 10 years and
> I was in your spot at that time.

Thank you Rafael, means a lot.


> The bottom line, in any case, is that the current code causes problems to
> happen somewhere and as a rule we don't release code that is known to
> cause problems to happen to anyone.  This means something needs to be done
> about that and the choice at this point is pretty much between reverting and
> quirking the affected system(s).

Quirking is not an option in this case because the PCI device IDs of the
affected hotplug ports as well as DMI data are unknown.  Yinghai Lu is
refusing to publish that, for both affected systems.

To be honest I only care about runtime suspending *Thunderbolt* hotplug
ports.  I enabled it for *all* hotplug ports in 68db9bc81436 because it
seemed like the right thing to do.  However given the murkiness of the
spec and the odd quirks Yinghai Lu reported it's probably not worth the
effort.  One must bear in mind that we've only heard of systems with
2015+ BIOSes so far.  More problem reports may pile up once we push the
BIOS limit further back.

I have submitted a patch to recognize Thunderbolt ports, so what I have
in mind is to resubmit 68db9bc81436 with an additional is_thunderbolt
condition in pci_bridge_d3_possible().  The number of Thunderbolt chips
is small and I know them fairly well, so it's easy for me to judge the
potential for regressions and deal with them.

Alternatively Bjorn could apply the patch to recognize Thunderbolt
devices now and then I can submit a one-line fix which adds the
is_thunderbolt condition to pci_bridge_d3_possible().  This would
obviate the need to revert 68db9bc81436.


> You seem to be disappointed that Yinghai has reported the problem at all,
> given that the hardware is unreleased and so on, but problem reports,
> even for systems like that, are what allows us to create code that works
> for everybody, so we (the maintainers) appreciate them very much.

No problem with reporting regressions, but with denying information
required to provide a fix.  I had asked for full dmesg output for
both machines so that the PCI device IDs and DMI data are available,
but Yinghai Lu continues to withhold that.  I am thus denied the means
to provide a fix and am forced to watch reversion of 68db9bc81436
without being able to respond.

Thanks,

Lukas


Re: [PATCH v2] locking/pvqspinlock: Relax cmpxchg's to improve performance on some archs

2017-02-07 Thread Boqun Feng
On Wed, Feb 08, 2017 at 11:39:10AM +0800, Xinhui Pan wrote:
> 2016-12-26 4:26 GMT+08:00 Waiman Long :
> 
> > A number of cmpxchg calls in qspinlock_paravirt.h were replaced by more
> > relaxed versions to improve performance on architectures that use LL/SC.
> >
> > All the locking related cmpxchg's are replaced with the _acquire
> > variants:
> >  - pv_queued_spin_steal_lock()
> >  - trylock_clear_pending()
> >
> > The cmpxchg's related to hashing are replaced by either by the _release
> > or the _relaxed variants. See the inline comment for details.
> >
> > Signed-off-by: Waiman Long 
> >
> >  v1->v2:
> >   - Add comments in changelog and code for the rationale of the change.
> >
> > ---
> >  kernel/locking/qspinlock_paravirt.h | 50 --
> > ---
> >  1 file changed, 33 insertions(+), 17 deletions(-)
> >
> >
> > @@ -323,8 +329,14 @@ static void pv_wait_node(struct mcs_spinlock *node,
> > struct mcs_spinlock *prev)
> >  * If pv_kick_node() changed us to vcpu_hashed, retain that
> >  * value so that pv_wait_head_or_lock() knows to not also
> > try
> >  * to hash this lock.
> > +*
> > +* The smp_store_mb() and control dependency above will
> > ensure
> > +* that state change won't happen before that.
> > Synchronizing
> > +* with pv_kick_node() wrt hashing by this waiter or by the
> > +* lock holder is done solely by the state variable. There
> > is
> > +* no other ordering requirement.
> >  */
> > -   cmpxchg(>state, vcpu_halted, vcpu_running);
> > +   cmpxchg_relaxed(>state, vcpu_halted, vcpu_running);
> >
> > /*
> >  * If the locked flag is still not set after wakeup, it is
> > a
> > @@ -360,9 +372,12 @@ static void pv_kick_node(struct qspinlock *lock,
> > struct mcs_spinlock *node)
> >  * pv_wait_node(). If OTOH this fails, the vCPU was running and
> > will
> >  * observe its next->locked value and advance itself.
> >  *
> > -* Matches with smp_store_mb() and cmpxchg() in pv_wait_node()
> > +* Matches with smp_store_mb() and cmpxchg_relaxed() in
> > pv_wait_node().
> > +* A release barrier is used here to ensure that node->locked is
> > +* always set before changing the state. See comment in
> > pv_wait_node().
> >  */
> > -   if (cmpxchg(>state, vcpu_halted, vcpu_hashed) != vcpu_halted)
> > +   if (cmpxchg_release(>state, vcpu_halted, vcpu_hashed)
> > +   != vcpu_halted)
> > return;
> >
> > hi, Waiman
> We can't use _release here, a full barrier is needed.
> 
> There is pv_kick_node vs pv_wait_head_or_lock
> 
> [w] l->locked = _Q_SLOW_VAL  //reordered here
> 
> if (READ_ONCE(pn->state) == vcpu_hashed) //False.
> 
>lp = (struct qspinlock **)1;
> 
> [STORE] pn->state = vcpu_hashedlp = pv_hash(lock,
> pn);
> pv_hash()if
> (xchg(>locked, _Q_SLOW_VAL) == 0) // fasle, not unhashed.
> 

This analysis is correct, but..

> Then the same lock has hashed twice but only unhashed once. So at last as
> the hash table grows big, we hit RCU stall.
> 
> I hit RCU stall when I run netperf benchmark
> 

how will a big hash table hit RCU stall? Do you have the call trace for
your RCU stall?

Regards,
Boqun

> thanks
> xinhui
> 
> 
> > --
> > 1.8.3.1
> >
> >


signature.asc
Description: PGP signature


Re: [PATCH v2] locking/pvqspinlock: Relax cmpxchg's to improve performance on some archs

2017-02-07 Thread Boqun Feng
On Wed, Feb 08, 2017 at 11:39:10AM +0800, Xinhui Pan wrote:
> 2016-12-26 4:26 GMT+08:00 Waiman Long :
> 
> > A number of cmpxchg calls in qspinlock_paravirt.h were replaced by more
> > relaxed versions to improve performance on architectures that use LL/SC.
> >
> > All the locking related cmpxchg's are replaced with the _acquire
> > variants:
> >  - pv_queued_spin_steal_lock()
> >  - trylock_clear_pending()
> >
> > The cmpxchg's related to hashing are replaced by either by the _release
> > or the _relaxed variants. See the inline comment for details.
> >
> > Signed-off-by: Waiman Long 
> >
> >  v1->v2:
> >   - Add comments in changelog and code for the rationale of the change.
> >
> > ---
> >  kernel/locking/qspinlock_paravirt.h | 50 --
> > ---
> >  1 file changed, 33 insertions(+), 17 deletions(-)
> >
> >
> > @@ -323,8 +329,14 @@ static void pv_wait_node(struct mcs_spinlock *node,
> > struct mcs_spinlock *prev)
> >  * If pv_kick_node() changed us to vcpu_hashed, retain that
> >  * value so that pv_wait_head_or_lock() knows to not also
> > try
> >  * to hash this lock.
> > +*
> > +* The smp_store_mb() and control dependency above will
> > ensure
> > +* that state change won't happen before that.
> > Synchronizing
> > +* with pv_kick_node() wrt hashing by this waiter or by the
> > +* lock holder is done solely by the state variable. There
> > is
> > +* no other ordering requirement.
> >  */
> > -   cmpxchg(>state, vcpu_halted, vcpu_running);
> > +   cmpxchg_relaxed(>state, vcpu_halted, vcpu_running);
> >
> > /*
> >  * If the locked flag is still not set after wakeup, it is
> > a
> > @@ -360,9 +372,12 @@ static void pv_kick_node(struct qspinlock *lock,
> > struct mcs_spinlock *node)
> >  * pv_wait_node(). If OTOH this fails, the vCPU was running and
> > will
> >  * observe its next->locked value and advance itself.
> >  *
> > -* Matches with smp_store_mb() and cmpxchg() in pv_wait_node()
> > +* Matches with smp_store_mb() and cmpxchg_relaxed() in
> > pv_wait_node().
> > +* A release barrier is used here to ensure that node->locked is
> > +* always set before changing the state. See comment in
> > pv_wait_node().
> >  */
> > -   if (cmpxchg(>state, vcpu_halted, vcpu_hashed) != vcpu_halted)
> > +   if (cmpxchg_release(>state, vcpu_halted, vcpu_hashed)
> > +   != vcpu_halted)
> > return;
> >
> > hi, Waiman
> We can't use _release here, a full barrier is needed.
> 
> There is pv_kick_node vs pv_wait_head_or_lock
> 
> [w] l->locked = _Q_SLOW_VAL  //reordered here
> 
> if (READ_ONCE(pn->state) == vcpu_hashed) //False.
> 
>lp = (struct qspinlock **)1;
> 
> [STORE] pn->state = vcpu_hashedlp = pv_hash(lock,
> pn);
> pv_hash()if
> (xchg(>locked, _Q_SLOW_VAL) == 0) // fasle, not unhashed.
> 

This analysis is correct, but..

> Then the same lock has hashed twice but only unhashed once. So at last as
> the hash table grows big, we hit RCU stall.
> 
> I hit RCU stall when I run netperf benchmark
> 

how will a big hash table hit RCU stall? Do you have the call trace for
your RCU stall?

Regards,
Boqun

> thanks
> xinhui
> 
> 
> > --
> > 1.8.3.1
> >
> >


signature.asc
Description: PGP signature


Re: [PATCH 2/2] tty: pl011: Work around QDF2400 E44 for earlycon

2017-02-07 Thread Timur Tabi

Christopher Covington wrote:

The previous change worked around QDF2432v1 and QDF2400v1 SoC erratum 44
for the full-fledged console, when UART AMBA Port (UAP) data is available.
Additionally provide a workaround the earlycon case, again checking TXFE ==
0 instead of BUSY == 1. As earlycon is operating before UAP data is
available, the implementation is different than in the preceding patch.

Signed-off-by: Christopher Covington 
---
  drivers/tty/serial/amba-pl011.c | 28 +++-
  1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 41e51901d6ef..f25e7c994f8e 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2411,6 +2411,29 @@ static bool qdf2400_e44(void) {
cpu_var_model == MIDR_QCOM_FALKOR_V1);
  }
  
+#ifdef CONFIG_QCOM_QDF2400_ERRATUM_44

+static void qdf2400_e44_putc(struct uart_port *port, int c)
+{
+   while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
+   cpu_relax();
+   if (port->iotype == UPIO_MEM32)
+   writel(c, port->membase + UART01x_DR);
+   else
+   writeb(c, port->membase + UART01x_DR);
I believe 32-bit writes are safe on QDF2400v1, so I think you technically don't 
need the UPIO_MEM32 check.  Just always call writel.

+   while (!(readl(port->membase + UART01x_FR) & UART011_FR_TXFE))
+   cpu_relax();
+}
+
+static void qdf2400_e44_early_write(struct console *con, const char *s, 
unsigned n)
+{
+   struct earlycon_device *dev = con->data;
+
+   uart_console_write(>port, s, n, qdf2400_e44_putc);
+}
+#else
+#define qdf2400_e44_early_write pl011_early_write
+#endif

Same with patch 1/2.  If you change qdf2400_e44(), you don't need the #else 
block.

+
  static void pl011_putc(struct uart_port *port, int c)
  {
while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
@@ -2436,7 +2459,10 @@ static int __init pl011_early_console_setup(struct 
earlycon_device *device,
if (!device->port.membase)
return -ENODEV;
  
-	device->con->write = pl011_early_write;

+   if (qdf2400_e44())
+   device->con->write = qdf2400_e44_early_write;
+   else
+   device->con->write = pl011_early_write;
return 0;
  }
  OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);



--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.



Re: [PATCH 2/2] tty: pl011: Work around QDF2400 E44 for earlycon

2017-02-07 Thread Timur Tabi

Christopher Covington wrote:

The previous change worked around QDF2432v1 and QDF2400v1 SoC erratum 44
for the full-fledged console, when UART AMBA Port (UAP) data is available.
Additionally provide a workaround the earlycon case, again checking TXFE ==
0 instead of BUSY == 1. As earlycon is operating before UAP data is
available, the implementation is different than in the preceding patch.

Signed-off-by: Christopher Covington 
---
  drivers/tty/serial/amba-pl011.c | 28 +++-
  1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 41e51901d6ef..f25e7c994f8e 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2411,6 +2411,29 @@ static bool qdf2400_e44(void) {
cpu_var_model == MIDR_QCOM_FALKOR_V1);
  }
  
+#ifdef CONFIG_QCOM_QDF2400_ERRATUM_44

+static void qdf2400_e44_putc(struct uart_port *port, int c)
+{
+   while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
+   cpu_relax();
+   if (port->iotype == UPIO_MEM32)
+   writel(c, port->membase + UART01x_DR);
+   else
+   writeb(c, port->membase + UART01x_DR);
I believe 32-bit writes are safe on QDF2400v1, so I think you technically don't 
need the UPIO_MEM32 check.  Just always call writel.

+   while (!(readl(port->membase + UART01x_FR) & UART011_FR_TXFE))
+   cpu_relax();
+}
+
+static void qdf2400_e44_early_write(struct console *con, const char *s, 
unsigned n)
+{
+   struct earlycon_device *dev = con->data;
+
+   uart_console_write(>port, s, n, qdf2400_e44_putc);
+}
+#else
+#define qdf2400_e44_early_write pl011_early_write
+#endif

Same with patch 1/2.  If you change qdf2400_e44(), you don't need the #else 
block.

+
  static void pl011_putc(struct uart_port *port, int c)
  {
while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
@@ -2436,7 +2459,10 @@ static int __init pl011_early_console_setup(struct 
earlycon_device *device,
if (!device->port.membase)
return -ENODEV;
  
-	device->con->write = pl011_early_write;

+   if (qdf2400_e44())
+   device->con->write = qdf2400_e44_early_write;
+   else
+   device->con->write = pl011_early_write;
return 0;
  }
  OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);



--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.



Re: [PATCH 1/2] tty: pl011: Work around QDF2400 E44 stuck BUSY bit

2017-02-07 Thread Timur Tabi

Christopher Covington wrote:

The Qualcomm Datacenter Technologies QDF2400 family of SoCs contains a
custom (non-PrimeCell) implementation of the SBSA UART. Occasionally the
BUSY bit in the Flag Register gets stuck as 1, erratum 44 for both 2432v1
and 2400v1 SoCs. Checking that the Transmit FIFO Empty (TXFE) bit is 0,
instead of checking that the BUSY bit is 1, works around the issue. To
facilitate this substitution when UART AMBA Port (UAP) data is available,
introduce vendor-specific inversion of Feature Register bits. To keep the
change small, this patch only works around the full console case, where UAP
data is available, and does not handle the erratum for earlycon, as the UAP
data is not available then.

Signed-off-by: Christopher Covington 
Acked-by: Russell King 
---
Changes between the previous RFC [1] and this PATCH:
* don't use arch/arm64/kernel/cpu_errata.c at Will's request
* separate out earlycon case to separate patch
* rework earlycon case to not depend on UAP as suggested by Timur

Because they need a newly-defined MIDR values, the patches are currently
based on:
https://git.kernel.org/cgit/linux/kernel/git/arm64/linux.git/log/?h=for-next/core

I'm not confident that I know the best route for these two patches. Should
I request Catalin and Will to take them via arm64 as the essential MIDR
additions are their purview?

Thanks Russell for the ack. Compared to the RFC, I've made minor changes to
what is now patch 1/2 and am making an educated guess that the ack sticks
(but if not please let me know). Patch 2/2 is significantly revised from
the RFC so I've not included the ack on it.

1. https://patchwork.codeaurora.org/patch/163281/
---
 Documentation/arm64/silicon-errata.txt |  2 ++
 arch/arm64/include/asm/cputype.h   |  2 ++
 drivers/tty/serial/Kconfig | 12 ++
 drivers/tty/serial/amba-pl011.c| 40 +++---
 4 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/Documentation/arm64/silicon-errata.txt 
b/Documentation/arm64/silicon-errata.txt
index 50da8391e9dd..0993ebb3e86b 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -65,3 +65,5 @@ stable kernels.
 | Freescale/NXP  | LS2080A/LS1043A | A-008585| FSL_ERRATUM_A008585 
|
 | Qualcomm Tech. | Falkor v1   | E1003   | 
QCOM_FALKOR_ERRATUM_1003|
 | Qualcomm Tech. | Falkor v1   | E1009   | 
QCOM_FALKOR_ERRATUM_1009|
+| Qualcomm Tech. | QDF2432v1 UART  | SoC E44 | QCOM_QDF2400_ERRATUM_44 
|
+| Qualcomm Tech. | QDF2400v1 UART  | SoC E44 | QCOM_QDF2400_ERRATUM_44 
|
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index fc502713ab37..cb399c7fe6ec 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -88,12 +88,14 @@

 #define BRCM_CPU_PART_VULCAN   0x516

+#define QCOM_CPU_PART_KRYO_V1  0x281
 #define QCOM_CPU_PART_FALKOR_V10x800

 #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, 
ARM_CPU_PART_CORTEX_A53)
 #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, 
ARM_CPU_PART_CORTEX_A57)
 #define MIDR_THUNDERX  MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, 
CAVIUM_CPU_PART_THUNDERX)
 #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, 
CAVIUM_CPU_PART_THUNDERX_81XX)
+#define MIDR_QCOM_KRYO_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, 
QCOM_CPU_PART_KRYO_V1)
 #define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, 
QCOM_CPU_PART_FALKOR_V1)

 #ifndef __ASSEMBLY__
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index e9cf5b67f1b7..4cde8f48a540 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -73,6 +73,18 @@ config SERIAL_AMBA_PL011_CONSOLE
  your boot loader (lilo or loadlin) about how to pass options to the
  kernel at boot time.)

+config QCOM_QDF2400_ERRATUM_44
+   bool "Work around QDF2400 SoC E44 stuck BUSY bit"
+   depends on SERIAL_AMBA_PL011_CONSOLE=y
+   default y
+   help
+ The BUSY bit in the Flag Register of the UART on the QDF2432v1 and
+ QDF2400v1 SoCs may get stuck as 1, resulting in a hung serial console.
+ Say Y here to work around the issue by checking TXFE == 0 instead of
+ BUSY == 1 on affected systems.
+
+ If unsure, say Y.
+
 config SERIAL_EARLYCON_ARM_SEMIHOST
bool "Early console using ARM semihosting"
depends on ARM64 || ARM
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index d4171d71a258..41e51901d6ef 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -97,6 +97,7 @@ struct vendor_data {
unsigned intfr_dsr;
unsigned intfr_cts;
unsigned intfr_ri;
+   unsigned intinv_fr;
boolaccess_32b;
bool  

Re: [PATCH 1/2] tty: pl011: Work around QDF2400 E44 stuck BUSY bit

2017-02-07 Thread Timur Tabi

Christopher Covington wrote:

The Qualcomm Datacenter Technologies QDF2400 family of SoCs contains a
custom (non-PrimeCell) implementation of the SBSA UART. Occasionally the
BUSY bit in the Flag Register gets stuck as 1, erratum 44 for both 2432v1
and 2400v1 SoCs. Checking that the Transmit FIFO Empty (TXFE) bit is 0,
instead of checking that the BUSY bit is 1, works around the issue. To
facilitate this substitution when UART AMBA Port (UAP) data is available,
introduce vendor-specific inversion of Feature Register bits. To keep the
change small, this patch only works around the full console case, where UAP
data is available, and does not handle the erratum for earlycon, as the UAP
data is not available then.

Signed-off-by: Christopher Covington 
Acked-by: Russell King 
---
Changes between the previous RFC [1] and this PATCH:
* don't use arch/arm64/kernel/cpu_errata.c at Will's request
* separate out earlycon case to separate patch
* rework earlycon case to not depend on UAP as suggested by Timur

Because they need a newly-defined MIDR values, the patches are currently
based on:
https://git.kernel.org/cgit/linux/kernel/git/arm64/linux.git/log/?h=for-next/core

I'm not confident that I know the best route for these two patches. Should
I request Catalin and Will to take them via arm64 as the essential MIDR
additions are their purview?

Thanks Russell for the ack. Compared to the RFC, I've made minor changes to
what is now patch 1/2 and am making an educated guess that the ack sticks
(but if not please let me know). Patch 2/2 is significantly revised from
the RFC so I've not included the ack on it.

1. https://patchwork.codeaurora.org/patch/163281/
---
 Documentation/arm64/silicon-errata.txt |  2 ++
 arch/arm64/include/asm/cputype.h   |  2 ++
 drivers/tty/serial/Kconfig | 12 ++
 drivers/tty/serial/amba-pl011.c| 40 +++---
 4 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/Documentation/arm64/silicon-errata.txt 
b/Documentation/arm64/silicon-errata.txt
index 50da8391e9dd..0993ebb3e86b 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -65,3 +65,5 @@ stable kernels.
 | Freescale/NXP  | LS2080A/LS1043A | A-008585| FSL_ERRATUM_A008585 
|
 | Qualcomm Tech. | Falkor v1   | E1003   | 
QCOM_FALKOR_ERRATUM_1003|
 | Qualcomm Tech. | Falkor v1   | E1009   | 
QCOM_FALKOR_ERRATUM_1009|
+| Qualcomm Tech. | QDF2432v1 UART  | SoC E44 | QCOM_QDF2400_ERRATUM_44 
|
+| Qualcomm Tech. | QDF2400v1 UART  | SoC E44 | QCOM_QDF2400_ERRATUM_44 
|
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index fc502713ab37..cb399c7fe6ec 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -88,12 +88,14 @@

 #define BRCM_CPU_PART_VULCAN   0x516

+#define QCOM_CPU_PART_KRYO_V1  0x281
 #define QCOM_CPU_PART_FALKOR_V10x800

 #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, 
ARM_CPU_PART_CORTEX_A53)
 #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, 
ARM_CPU_PART_CORTEX_A57)
 #define MIDR_THUNDERX  MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, 
CAVIUM_CPU_PART_THUNDERX)
 #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, 
CAVIUM_CPU_PART_THUNDERX_81XX)
+#define MIDR_QCOM_KRYO_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, 
QCOM_CPU_PART_KRYO_V1)
 #define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, 
QCOM_CPU_PART_FALKOR_V1)

 #ifndef __ASSEMBLY__
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index e9cf5b67f1b7..4cde8f48a540 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -73,6 +73,18 @@ config SERIAL_AMBA_PL011_CONSOLE
  your boot loader (lilo or loadlin) about how to pass options to the
  kernel at boot time.)

+config QCOM_QDF2400_ERRATUM_44
+   bool "Work around QDF2400 SoC E44 stuck BUSY bit"
+   depends on SERIAL_AMBA_PL011_CONSOLE=y
+   default y
+   help
+ The BUSY bit in the Flag Register of the UART on the QDF2432v1 and
+ QDF2400v1 SoCs may get stuck as 1, resulting in a hung serial console.
+ Say Y here to work around the issue by checking TXFE == 0 instead of
+ BUSY == 1 on affected systems.
+
+ If unsure, say Y.
+
 config SERIAL_EARLYCON_ARM_SEMIHOST
bool "Early console using ARM semihosting"
depends on ARM64 || ARM
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index d4171d71a258..41e51901d6ef 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -97,6 +97,7 @@ struct vendor_data {
unsigned intfr_dsr;
unsigned intfr_cts;
unsigned intfr_ri;
+   unsigned intinv_fr;
boolaccess_32b;
booloversampling;
bool

Re: [PATCH 4/5] target: Fix multi-session dynamic se_node_acl double free OOPs

2017-02-07 Thread Nicholas A. Bellinger
On Tue, 2017-02-07 at 15:12 -0800, Christoph Hellwig wrote:
> And the real patch after compile fixing it is here of course:
> 

Getting rid of the extra se_node_acl->acl_free_comp seems to make sense
here..

The only potential issue is if returning from configfs syscall
rmdir /sys/kernel/config/target/$FABRIC/$WWN/$TPGT/acls/$INITIATOR/
before se_node_acl memory is released has implications when the
underlying ../$WWN/$TPGT/ is removed immediately after.

In any event, I'll verify this patch with the original test case and use
it instead if everything looks OK.

> diff --git a/drivers/target/target_core_internal.h 
> b/drivers/target/target_core_internal.h
> index 9ab7090f7c83..96c38f30069d 100644
> --- a/drivers/target/target_core_internal.h
> +++ b/drivers/target/target_core_internal.h
> @@ -152,6 +152,7 @@ void  target_qf_do_work(struct work_struct *work);
>  bool target_check_wce(struct se_device *dev);
>  bool target_check_fua(struct se_device *dev);
>  void __target_execute_cmd(struct se_cmd *, bool);
> +void target_put_nacl(struct se_node_acl *);
>  
>  /* target_core_stat.c */
>  void target_stat_setup_dev_default_groups(struct se_device *);
> diff --git a/drivers/target/target_core_tpg.c 
> b/drivers/target/target_core_tpg.c
> index d99752c6cd60..08738c87e5b0 100644
> --- a/drivers/target/target_core_tpg.c
> +++ b/drivers/target/target_core_tpg.c
> @@ -197,7 +197,6 @@ static struct se_node_acl *target_alloc_node_acl(struct 
> se_portal_group *tpg,
>   INIT_LIST_HEAD(>acl_sess_list);
>   INIT_HLIST_HEAD(>lun_entry_hlist);
>   kref_init(>acl_kref);
> - init_completion(>acl_free_comp);
>   spin_lock_init(>nacl_sess_lock);
>   mutex_init(>lun_entry_mutex);
>   atomic_set(>acl_pr_ref_count, 0);
> @@ -370,21 +369,6 @@ void core_tpg_del_initiator_node_acl(struct se_node_acl 
> *acl)
>   target_shutdown_sessions(acl);
>  
>   target_put_nacl(acl);
> - /*
> -  * Wait for last target_put_nacl() to complete in target_complete_nacl()
> -  * for active fabric session transport_deregister_session() callbacks.
> -  */
> - wait_for_completion(>acl_free_comp);
> -
> - core_tpg_wait_for_nacl_pr_ref(acl);
> - core_free_device_list_for_node(acl, tpg);
> -
> - pr_debug("%s_TPG[%hu] - Deleted ACL with TCQ Depth: %d for %s"
> - " Initiator Node: %s\n", tpg->se_tpg_tfo->get_fabric_name(),
> - tpg->se_tpg_tfo->tpg_get_tag(tpg), acl->queue_depth,
> - tpg->se_tpg_tfo->get_fabric_name(), acl->initiatorname);
> -
> - kfree(acl);
>  }
>  
>  /*   core_tpg_set_initiator_node_queue_depth():
> diff --git a/drivers/target/target_core_transport.c 
> b/drivers/target/target_core_transport.c
> index 1cadc9eefa21..9ebd86a8ef41 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -453,19 +453,25 @@ ssize_t target_show_dynamic_sessions(struct 
> se_portal_group *se_tpg, char *page)
>  }
>  EXPORT_SYMBOL(target_show_dynamic_sessions);
>  
> -static void target_complete_nacl(struct kref *kref)
> +static void target_destroy_nacl(struct kref *kref)
>  {
>   struct se_node_acl *nacl = container_of(kref,
>   struct se_node_acl, acl_kref);
> + struct se_portal_group *se_tpg = nacl->se_tpg;
>  
> - complete(>acl_free_comp);
> + mutex_lock(_tpg->acl_node_mutex);
> + list_del(>acl_list);
> + mutex_unlock(_tpg->acl_node_mutex);
> +
> + core_tpg_wait_for_nacl_pr_ref(nacl);
> + core_free_device_list_for_node(nacl, se_tpg);
> + kfree(nacl);
>  }
>  
>  void target_put_nacl(struct se_node_acl *nacl)
>  {
> - kref_put(>acl_kref, target_complete_nacl);
> + kref_put(>acl_kref, target_destroy_nacl);
>  }
> -EXPORT_SYMBOL(target_put_nacl);
>  
>  void transport_deregister_session_configfs(struct se_session *se_sess)
>  {
> @@ -499,12 +505,40 @@ EXPORT_SYMBOL(transport_deregister_session_configfs);
>  void transport_free_session(struct se_session *se_sess)
>  {
>   struct se_node_acl *se_nacl = se_sess->se_node_acl;
> +
>   /*
>* Drop the se_node_acl->nacl_kref obtained from within
>* core_tpg_get_initiator_node_acl().
>*/
>   if (se_nacl) {
> + struct se_portal_group *se_tpg = se_nacl->se_tpg;
> + const struct target_core_fabric_ops *se_tfo = 
> se_tpg->se_tpg_tfo;
> + unsigned long flags;
> + bool stop = false;
> +
>   se_sess->se_node_acl = NULL;
> +
> + /*
> +  * Also determine if we need to drop the extra ->cmd_kref if
> +  * it had been previously dynamically generated, and
> +  * the endpoint is not caching dynamic ACLs.
> +  */
> + mutex_lock(_tpg->acl_node_mutex);
> + if (se_nacl->dynamic_node_acl &&
> + !se_tfo->tpg_check_demo_mode_cache(se_tpg)) {
> + spin_lock_irqsave(_nacl->nacl_sess_lock, flags);
> 

Re: [PATCH 4/5] target: Fix multi-session dynamic se_node_acl double free OOPs

2017-02-07 Thread Nicholas A. Bellinger
On Tue, 2017-02-07 at 15:12 -0800, Christoph Hellwig wrote:
> And the real patch after compile fixing it is here of course:
> 

Getting rid of the extra se_node_acl->acl_free_comp seems to make sense
here..

The only potential issue is if returning from configfs syscall
rmdir /sys/kernel/config/target/$FABRIC/$WWN/$TPGT/acls/$INITIATOR/
before se_node_acl memory is released has implications when the
underlying ../$WWN/$TPGT/ is removed immediately after.

In any event, I'll verify this patch with the original test case and use
it instead if everything looks OK.

> diff --git a/drivers/target/target_core_internal.h 
> b/drivers/target/target_core_internal.h
> index 9ab7090f7c83..96c38f30069d 100644
> --- a/drivers/target/target_core_internal.h
> +++ b/drivers/target/target_core_internal.h
> @@ -152,6 +152,7 @@ void  target_qf_do_work(struct work_struct *work);
>  bool target_check_wce(struct se_device *dev);
>  bool target_check_fua(struct se_device *dev);
>  void __target_execute_cmd(struct se_cmd *, bool);
> +void target_put_nacl(struct se_node_acl *);
>  
>  /* target_core_stat.c */
>  void target_stat_setup_dev_default_groups(struct se_device *);
> diff --git a/drivers/target/target_core_tpg.c 
> b/drivers/target/target_core_tpg.c
> index d99752c6cd60..08738c87e5b0 100644
> --- a/drivers/target/target_core_tpg.c
> +++ b/drivers/target/target_core_tpg.c
> @@ -197,7 +197,6 @@ static struct se_node_acl *target_alloc_node_acl(struct 
> se_portal_group *tpg,
>   INIT_LIST_HEAD(>acl_sess_list);
>   INIT_HLIST_HEAD(>lun_entry_hlist);
>   kref_init(>acl_kref);
> - init_completion(>acl_free_comp);
>   spin_lock_init(>nacl_sess_lock);
>   mutex_init(>lun_entry_mutex);
>   atomic_set(>acl_pr_ref_count, 0);
> @@ -370,21 +369,6 @@ void core_tpg_del_initiator_node_acl(struct se_node_acl 
> *acl)
>   target_shutdown_sessions(acl);
>  
>   target_put_nacl(acl);
> - /*
> -  * Wait for last target_put_nacl() to complete in target_complete_nacl()
> -  * for active fabric session transport_deregister_session() callbacks.
> -  */
> - wait_for_completion(>acl_free_comp);
> -
> - core_tpg_wait_for_nacl_pr_ref(acl);
> - core_free_device_list_for_node(acl, tpg);
> -
> - pr_debug("%s_TPG[%hu] - Deleted ACL with TCQ Depth: %d for %s"
> - " Initiator Node: %s\n", tpg->se_tpg_tfo->get_fabric_name(),
> - tpg->se_tpg_tfo->tpg_get_tag(tpg), acl->queue_depth,
> - tpg->se_tpg_tfo->get_fabric_name(), acl->initiatorname);
> -
> - kfree(acl);
>  }
>  
>  /*   core_tpg_set_initiator_node_queue_depth():
> diff --git a/drivers/target/target_core_transport.c 
> b/drivers/target/target_core_transport.c
> index 1cadc9eefa21..9ebd86a8ef41 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -453,19 +453,25 @@ ssize_t target_show_dynamic_sessions(struct 
> se_portal_group *se_tpg, char *page)
>  }
>  EXPORT_SYMBOL(target_show_dynamic_sessions);
>  
> -static void target_complete_nacl(struct kref *kref)
> +static void target_destroy_nacl(struct kref *kref)
>  {
>   struct se_node_acl *nacl = container_of(kref,
>   struct se_node_acl, acl_kref);
> + struct se_portal_group *se_tpg = nacl->se_tpg;
>  
> - complete(>acl_free_comp);
> + mutex_lock(_tpg->acl_node_mutex);
> + list_del(>acl_list);
> + mutex_unlock(_tpg->acl_node_mutex);
> +
> + core_tpg_wait_for_nacl_pr_ref(nacl);
> + core_free_device_list_for_node(nacl, se_tpg);
> + kfree(nacl);
>  }
>  
>  void target_put_nacl(struct se_node_acl *nacl)
>  {
> - kref_put(>acl_kref, target_complete_nacl);
> + kref_put(>acl_kref, target_destroy_nacl);
>  }
> -EXPORT_SYMBOL(target_put_nacl);
>  
>  void transport_deregister_session_configfs(struct se_session *se_sess)
>  {
> @@ -499,12 +505,40 @@ EXPORT_SYMBOL(transport_deregister_session_configfs);
>  void transport_free_session(struct se_session *se_sess)
>  {
>   struct se_node_acl *se_nacl = se_sess->se_node_acl;
> +
>   /*
>* Drop the se_node_acl->nacl_kref obtained from within
>* core_tpg_get_initiator_node_acl().
>*/
>   if (se_nacl) {
> + struct se_portal_group *se_tpg = se_nacl->se_tpg;
> + const struct target_core_fabric_ops *se_tfo = 
> se_tpg->se_tpg_tfo;
> + unsigned long flags;
> + bool stop = false;
> +
>   se_sess->se_node_acl = NULL;
> +
> + /*
> +  * Also determine if we need to drop the extra ->cmd_kref if
> +  * it had been previously dynamically generated, and
> +  * the endpoint is not caching dynamic ACLs.
> +  */
> + mutex_lock(_tpg->acl_node_mutex);
> + if (se_nacl->dynamic_node_acl &&
> + !se_tfo->tpg_check_demo_mode_cache(se_tpg)) {
> + spin_lock_irqsave(_nacl->nacl_sess_lock, flags);
> 

Re: [PATCH v2 1/2] sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications

2017-02-07 Thread kbuild test robot
Hi Stefan,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.10-rc7]
[cannot apply to next-20170207]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Stefan-Br-ns/sierra_net-Add-support-for-IPv6-and-Dual-Stack-Link-Sense-Indications/20170207-105111
config: x86_64-randconfig-b0-02081035 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/net/usb/sierra_net.c: In function 'sierra_net_bind':
>> drivers/net/usb/sierra_net.c:687: warning: unused variable 'eth'

vim +/eth +687 drivers/net/usb/sierra_net.c

f7385ec9 Ming Lei  2012-10-24  671  if (result < 0)
eb4fd8cd Elina Pasheva 2010-04-27  672  return -EIO;
eb4fd8cd Elina Pasheva 2010-04-27  673  
f7385ec9 Ming Lei  2012-10-24  674  *datap = le16_to_cpu(attrdata);
eb4fd8cd Elina Pasheva 2010-04-27  675  return result;
eb4fd8cd Elina Pasheva 2010-04-27  676  }
eb4fd8cd Elina Pasheva 2010-04-27  677  
eb4fd8cd Elina Pasheva 2010-04-27  678  /*
eb4fd8cd Elina Pasheva 2010-04-27  679   * collects the bulk endpoints, the 
status endpoint.
eb4fd8cd Elina Pasheva 2010-04-27  680   */
eb4fd8cd Elina Pasheva 2010-04-27  681  static int sierra_net_bind(struct 
usbnet *dev, struct usb_interface *intf)
eb4fd8cd Elina Pasheva 2010-04-27  682  {
eb4fd8cd Elina Pasheva 2010-04-27  683  u8  ifacenum;
eb4fd8cd Elina Pasheva 2010-04-27  684  u8  numendpoints;
eb4fd8cd Elina Pasheva 2010-04-27  685  u16 fwattr = 0;
eb4fd8cd Elina Pasheva 2010-04-27  686  int status;
eb4fd8cd Elina Pasheva 2010-04-27 @687  struct ethhdr *eth;
eb4fd8cd Elina Pasheva 2010-04-27  688  struct sierra_net_data *priv;
eb4fd8cd Elina Pasheva 2010-04-27  689  static const u8 
sync_tmplate[sizeof(priv->sync_msg)] = {
eb4fd8cd Elina Pasheva 2010-04-27  690  0x00, 0x00, 
SIERRA_NET_HIP_MSYNC_ID, 0x00};
eb4fd8cd Elina Pasheva 2010-04-27  691  static const u8 
shdwn_tmplate[sizeof(priv->shdwn_msg)] = {
eb4fd8cd Elina Pasheva 2010-04-27  692  0x00, 0x00, 
SIERRA_NET_HIP_SHUTD_ID, 0x00};
eb4fd8cd Elina Pasheva 2010-04-27  693  
eb4fd8cd Elina Pasheva 2010-04-27  694  dev_dbg(>udev->dev, "%s", 
__func__);
eb4fd8cd Elina Pasheva 2010-04-27  695  

:: The code at line 687 was first introduced by commit
:: eb4fd8cd355c8ec425a12ec6cbdac614e8a4819d net/usb: add sierra_net.c driver

:: TO: Elina Pasheva <epash...@sierrawireless.com>
:: CC: David S. Miller <da...@davemloft.net>

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v2 1/2] sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications

2017-02-07 Thread kbuild test robot
Hi Stefan,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.10-rc7]
[cannot apply to next-20170207]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Stefan-Br-ns/sierra_net-Add-support-for-IPv6-and-Dual-Stack-Link-Sense-Indications/20170207-105111
config: x86_64-randconfig-b0-02081035 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/net/usb/sierra_net.c: In function 'sierra_net_bind':
>> drivers/net/usb/sierra_net.c:687: warning: unused variable 'eth'

vim +/eth +687 drivers/net/usb/sierra_net.c

f7385ec9 Ming Lei  2012-10-24  671  if (result < 0)
eb4fd8cd Elina Pasheva 2010-04-27  672  return -EIO;
eb4fd8cd Elina Pasheva 2010-04-27  673  
f7385ec9 Ming Lei  2012-10-24  674  *datap = le16_to_cpu(attrdata);
eb4fd8cd Elina Pasheva 2010-04-27  675  return result;
eb4fd8cd Elina Pasheva 2010-04-27  676  }
eb4fd8cd Elina Pasheva 2010-04-27  677  
eb4fd8cd Elina Pasheva 2010-04-27  678  /*
eb4fd8cd Elina Pasheva 2010-04-27  679   * collects the bulk endpoints, the 
status endpoint.
eb4fd8cd Elina Pasheva 2010-04-27  680   */
eb4fd8cd Elina Pasheva 2010-04-27  681  static int sierra_net_bind(struct 
usbnet *dev, struct usb_interface *intf)
eb4fd8cd Elina Pasheva 2010-04-27  682  {
eb4fd8cd Elina Pasheva 2010-04-27  683  u8  ifacenum;
eb4fd8cd Elina Pasheva 2010-04-27  684  u8  numendpoints;
eb4fd8cd Elina Pasheva 2010-04-27  685  u16 fwattr = 0;
eb4fd8cd Elina Pasheva 2010-04-27  686  int status;
eb4fd8cd Elina Pasheva 2010-04-27 @687  struct ethhdr *eth;
eb4fd8cd Elina Pasheva 2010-04-27  688  struct sierra_net_data *priv;
eb4fd8cd Elina Pasheva 2010-04-27  689  static const u8 
sync_tmplate[sizeof(priv->sync_msg)] = {
eb4fd8cd Elina Pasheva 2010-04-27  690  0x00, 0x00, 
SIERRA_NET_HIP_MSYNC_ID, 0x00};
eb4fd8cd Elina Pasheva 2010-04-27  691  static const u8 
shdwn_tmplate[sizeof(priv->shdwn_msg)] = {
eb4fd8cd Elina Pasheva 2010-04-27  692  0x00, 0x00, 
SIERRA_NET_HIP_SHUTD_ID, 0x00};
eb4fd8cd Elina Pasheva 2010-04-27  693  
eb4fd8cd Elina Pasheva 2010-04-27  694  dev_dbg(>udev->dev, "%s", 
__func__);
eb4fd8cd Elina Pasheva 2010-04-27  695  

:: The code at line 687 was first introduced by commit
:: eb4fd8cd355c8ec425a12ec6cbdac614e8a4819d net/usb: add sierra_net.c driver

:: TO: Elina Pasheva 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH v3 2/3] ASoC: zx-i2s: introduce pclk for zx2967 family

2017-02-07 Thread Baoyou Xie
ZTE's zx2967 I2S controller driver introduces pclk, this
patch documents this fact.

Signed-off-by: Baoyou Xie 
---
 Documentation/devicetree/bindings/sound/zte,zx-i2s.txt | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt 
b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
index 7e5aa6f..77390c0 100644
--- a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
@@ -4,7 +4,7 @@ Required properties:
  - compatible : Must be "zte,zx296702-i2s"
  - reg : Must contain I2S core's registers location and length
  - clocks : Pairs of phandle and specifier referencing the controller's clocks.
- - clock-names: "tx" for the clock to the I2S interface.
+ - clock-names: "wclk" for the wclk, "pclk" for the pclk to the I2S interface.
  - dmas: Pairs of phandle and specifier for the DMA channel that is used by
the core. The core expects two dma channels for transmit.
  - dma-names : Must be "tx" and "rx"
@@ -15,13 +15,17 @@ please check:
* clock/clock-bindings.txt
* dma/dma.txt
 
+Please note that ZTE ZX296702 I2S controller driver is compatible for zx296702
+and zx296718, so compatible string might be set as follow:
+   "zte,zx296718-i2s", "zte,zx296702-i2s"
+
 Example:
i2s0: i2s0@0b005000 {
#sound-dai-cells = <0>;
-   compatible = "zte,zx296702-i2s";
+   compatible = "zte,zx296718-i2s", "zte,zx296702-i2s";
reg = <0x0b005000 0x1000>;
-   clocks = < ZX296702_I2S0_DIV>;
-   clock-names = "tx";
+   clocks = < AUDIO_I2S0_WCLK>, < 
AUDIO_I2S0_PCLK>;
+   clock-names = "wclk", "pclk";
interrupts = ;
dmas = < 5>, < 6>;
dma-names = "tx", "rx";
-- 
2.7.4



[PATCH v3 2/3] ASoC: zx-i2s: introduce pclk for zx2967 family

2017-02-07 Thread Baoyou Xie
ZTE's zx2967 I2S controller driver introduces pclk, this
patch documents this fact.

Signed-off-by: Baoyou Xie 
---
 Documentation/devicetree/bindings/sound/zte,zx-i2s.txt | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt 
b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
index 7e5aa6f..77390c0 100644
--- a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt
@@ -4,7 +4,7 @@ Required properties:
  - compatible : Must be "zte,zx296702-i2s"
  - reg : Must contain I2S core's registers location and length
  - clocks : Pairs of phandle and specifier referencing the controller's clocks.
- - clock-names: "tx" for the clock to the I2S interface.
+ - clock-names: "wclk" for the wclk, "pclk" for the pclk to the I2S interface.
  - dmas: Pairs of phandle and specifier for the DMA channel that is used by
the core. The core expects two dma channels for transmit.
  - dma-names : Must be "tx" and "rx"
@@ -15,13 +15,17 @@ please check:
* clock/clock-bindings.txt
* dma/dma.txt
 
+Please note that ZTE ZX296702 I2S controller driver is compatible for zx296702
+and zx296718, so compatible string might be set as follow:
+   "zte,zx296718-i2s", "zte,zx296702-i2s"
+
 Example:
i2s0: i2s0@0b005000 {
#sound-dai-cells = <0>;
-   compatible = "zte,zx296702-i2s";
+   compatible = "zte,zx296718-i2s", "zte,zx296702-i2s";
reg = <0x0b005000 0x1000>;
-   clocks = < ZX296702_I2S0_DIV>;
-   clock-names = "tx";
+   clocks = < AUDIO_I2S0_WCLK>, < 
AUDIO_I2S0_PCLK>;
+   clock-names = "wclk", "pclk";
interrupts = ;
dmas = < 5>, < 6>;
dma-names = "tx", "rx";
-- 
2.7.4



[PATCH v3 3/3] ASoC: zx-i2s: introduce pclk for zx2967 family

2017-02-07 Thread Baoyou Xie
The pclk is necessary for zx2967 I2S controller. the driver
currently doesn't handle it. This is something we need to fix.

In turn, the driver supports zx296718's I2S controller.

By the way, this patch also change the clock name from tx to wclk
to make it clear.

Signed-off-by: Baoyou Xie 
---
 sound/soc/zte/zx-i2s.c | 37 -
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c
index ed7a56d..2d486ea 100644
--- a/sound/soc/zte/zx-i2s.c
+++ b/sound/soc/zte/zx-i2s.c
@@ -95,7 +95,7 @@
 struct zx_i2s_info {
struct snd_dmaengine_dai_dma_data   dma_playback;
struct snd_dmaengine_dai_dma_data   dma_capture;
-   struct clk  *dai_clk;
+   struct clk  *dai_wclk, *dai_pclk;
void __iomem*reg_base;
int master;
resource_size_t mapbase;
@@ -275,8 +275,9 @@ static int zx_i2s_hw_params(struct snd_pcm_substream 
*substream,
writel_relaxed(val, i2s->reg_base + ZX_I2S_TIMING_CTRL);
 
if (i2s->master)
-   ret = clk_set_rate(i2s->dai_clk,
-  params_rate(params) * ch_num * CLK_RAT);
+   ret = clk_set_rate(i2s->dai_wclk,
+   params_rate(params) * ch_num * CLK_RAT);
+
return ret;
 }
 
@@ -328,8 +329,19 @@ static int zx_i2s_startup(struct snd_pcm_substream 
*substream,
  struct snd_soc_dai *dai)
 {
struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev);
+   int ret;
+
+   ret = clk_prepare_enable(zx_i2s->dai_wclk);
+   if (ret)
+   return ret;
+
+   ret = clk_prepare_enable(zx_i2s->dai_pclk);
+   if (ret) {
+   clk_disable_unprepare(zx_i2s->dai_wclk);
+   return ret;
+   }
 
-   return clk_prepare_enable(zx_i2s->dai_clk);
+   return ret;
 }
 
 static void zx_i2s_shutdown(struct snd_pcm_substream *substream,
@@ -337,7 +349,8 @@ static void zx_i2s_shutdown(struct snd_pcm_substream 
*substream,
 {
struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev);
 
-   clk_disable_unprepare(zx_i2s->dai_clk);
+   clk_disable_unprepare(zx_i2s->dai_wclk);
+   clk_disable_unprepare(zx_i2s->dai_pclk);
 }
 
 static struct snd_soc_dai_ops zx_i2s_dai_ops = {
@@ -381,10 +394,16 @@ static int zx_i2s_probe(struct platform_device *pdev)
if (!zx_i2s)
return -ENOMEM;
 
-   zx_i2s->dai_clk = devm_clk_get(>dev, "tx");
-   if (IS_ERR(zx_i2s->dai_clk)) {
-   dev_err(>dev, "Fail to get clk\n");
-   return PTR_ERR(zx_i2s->dai_clk);
+   zx_i2s->dai_wclk = devm_clk_get(>dev, "wclk");
+   if (IS_ERR(zx_i2s->dai_wclk)) {
+   dev_err(>dev, "Fail to get wclk\n");
+   return PTR_ERR(zx_i2s->dai_wclk);
+   }
+
+   zx_i2s->dai_pclk = devm_clk_get(>dev, "pclk");
+   if (IS_ERR(zx_i2s->dai_pclk)) {
+   dev_info(>dev, "have no pclk\n");
+   zx_i2s->dai_pclk = NULL;
}
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- 
2.7.4



[PATCH v3 3/3] ASoC: zx-i2s: introduce pclk for zx2967 family

2017-02-07 Thread Baoyou Xie
The pclk is necessary for zx2967 I2S controller. the driver
currently doesn't handle it. This is something we need to fix.

In turn, the driver supports zx296718's I2S controller.

By the way, this patch also change the clock name from tx to wclk
to make it clear.

Signed-off-by: Baoyou Xie 
---
 sound/soc/zte/zx-i2s.c | 37 -
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c
index ed7a56d..2d486ea 100644
--- a/sound/soc/zte/zx-i2s.c
+++ b/sound/soc/zte/zx-i2s.c
@@ -95,7 +95,7 @@
 struct zx_i2s_info {
struct snd_dmaengine_dai_dma_data   dma_playback;
struct snd_dmaengine_dai_dma_data   dma_capture;
-   struct clk  *dai_clk;
+   struct clk  *dai_wclk, *dai_pclk;
void __iomem*reg_base;
int master;
resource_size_t mapbase;
@@ -275,8 +275,9 @@ static int zx_i2s_hw_params(struct snd_pcm_substream 
*substream,
writel_relaxed(val, i2s->reg_base + ZX_I2S_TIMING_CTRL);
 
if (i2s->master)
-   ret = clk_set_rate(i2s->dai_clk,
-  params_rate(params) * ch_num * CLK_RAT);
+   ret = clk_set_rate(i2s->dai_wclk,
+   params_rate(params) * ch_num * CLK_RAT);
+
return ret;
 }
 
@@ -328,8 +329,19 @@ static int zx_i2s_startup(struct snd_pcm_substream 
*substream,
  struct snd_soc_dai *dai)
 {
struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev);
+   int ret;
+
+   ret = clk_prepare_enable(zx_i2s->dai_wclk);
+   if (ret)
+   return ret;
+
+   ret = clk_prepare_enable(zx_i2s->dai_pclk);
+   if (ret) {
+   clk_disable_unprepare(zx_i2s->dai_wclk);
+   return ret;
+   }
 
-   return clk_prepare_enable(zx_i2s->dai_clk);
+   return ret;
 }
 
 static void zx_i2s_shutdown(struct snd_pcm_substream *substream,
@@ -337,7 +349,8 @@ static void zx_i2s_shutdown(struct snd_pcm_substream 
*substream,
 {
struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev);
 
-   clk_disable_unprepare(zx_i2s->dai_clk);
+   clk_disable_unprepare(zx_i2s->dai_wclk);
+   clk_disable_unprepare(zx_i2s->dai_pclk);
 }
 
 static struct snd_soc_dai_ops zx_i2s_dai_ops = {
@@ -381,10 +394,16 @@ static int zx_i2s_probe(struct platform_device *pdev)
if (!zx_i2s)
return -ENOMEM;
 
-   zx_i2s->dai_clk = devm_clk_get(>dev, "tx");
-   if (IS_ERR(zx_i2s->dai_clk)) {
-   dev_err(>dev, "Fail to get clk\n");
-   return PTR_ERR(zx_i2s->dai_clk);
+   zx_i2s->dai_wclk = devm_clk_get(>dev, "wclk");
+   if (IS_ERR(zx_i2s->dai_wclk)) {
+   dev_err(>dev, "Fail to get wclk\n");
+   return PTR_ERR(zx_i2s->dai_wclk);
+   }
+
+   zx_i2s->dai_pclk = devm_clk_get(>dev, "pclk");
+   if (IS_ERR(zx_i2s->dai_pclk)) {
+   dev_info(>dev, "have no pclk\n");
+   zx_i2s->dai_pclk = NULL;
}
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- 
2.7.4



Re: [PATCH v3 3/4] cpufreq: bmips-cpufreq: CPUfreq driver for Broadcom's BMIPS SoCs

2017-02-07 Thread Viresh Kumar
On 07-02-17, 13:58, Markus Mayer wrote:
> From: Markus Mayer 
> 
> Add the MIPS CPUfreq driver. This driver currently supports CPUfreq on
> BMIPS5xxx-based SoCs.
> 
> Signed-off-by: Markus Mayer 
> ---
>  drivers/cpufreq/Kconfig |  10 +++
>  drivers/cpufreq/Makefile|   1 +
>  drivers/cpufreq/bmips-cpufreq.c | 188 
> 
>  3 files changed, 199 insertions(+)
>  create mode 100644 drivers/cpufreq/bmips-cpufreq.c

Acked-by: Viresh Kumar 

-- 
viresh


Re: [PATCH v3 3/4] cpufreq: bmips-cpufreq: CPUfreq driver for Broadcom's BMIPS SoCs

2017-02-07 Thread Viresh Kumar
On 07-02-17, 13:58, Markus Mayer wrote:
> From: Markus Mayer 
> 
> Add the MIPS CPUfreq driver. This driver currently supports CPUfreq on
> BMIPS5xxx-based SoCs.
> 
> Signed-off-by: Markus Mayer 
> ---
>  drivers/cpufreq/Kconfig |  10 +++
>  drivers/cpufreq/Makefile|   1 +
>  drivers/cpufreq/bmips-cpufreq.c | 188 
> 
>  3 files changed, 199 insertions(+)
>  create mode 100644 drivers/cpufreq/bmips-cpufreq.c

Acked-by: Viresh Kumar 

-- 
viresh


Re: [PATCH v2] security: selinux: allow changing labels for cgroupfs

2017-02-07 Thread Paul Moore
On Thu, Feb 2, 2017 at 10:22 AM, Antonio Murdaca  wrote:
> This patch allows changing labels for cgroup mounts. Previously, running
> chcon on cgroupfs would throw an "Operation not supported". This patch
> specifically whitelist cgroupfs.
>
> The patch could also allow containers to write only to the systemd cgroup
> for instance, while the other cgroups are kept with cgroup_t label.
>
> Signed-off-by: Antonio Murdaca 
> ---
> Changes in v2:
>   - whitelist cgroup2 fs type
>
>  security/selinux/hooks.c | 2 ++
>  1 file changed, 2 insertions(+)

Merged into selinux/next, thanks.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 3b955c6..2789f0a 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -480,6 +480,8 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)
> sbsec->behavior == SECURITY_FS_USE_NATIVE ||
> /* Special handling. Genfs but also in-core setxattr handler 
> */
> !strcmp(sb->s_type->name, "sysfs") ||
> +   !strcmp(sb->s_type->name, "cgroup") ||
> +   !strcmp(sb->s_type->name, "cgroup2") ||
> !strcmp(sb->s_type->name, "pstore") ||
> !strcmp(sb->s_type->name, "debugfs") ||
> !strcmp(sb->s_type->name, "tracefs") ||
> --
> 2.9.3

-- 
paul moore
www.paul-moore.com


Re: [PATCH v2] security: selinux: allow changing labels for cgroupfs

2017-02-07 Thread Paul Moore
On Thu, Feb 2, 2017 at 10:22 AM, Antonio Murdaca  wrote:
> This patch allows changing labels for cgroup mounts. Previously, running
> chcon on cgroupfs would throw an "Operation not supported". This patch
> specifically whitelist cgroupfs.
>
> The patch could also allow containers to write only to the systemd cgroup
> for instance, while the other cgroups are kept with cgroup_t label.
>
> Signed-off-by: Antonio Murdaca 
> ---
> Changes in v2:
>   - whitelist cgroup2 fs type
>
>  security/selinux/hooks.c | 2 ++
>  1 file changed, 2 insertions(+)

Merged into selinux/next, thanks.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 3b955c6..2789f0a 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -480,6 +480,8 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)
> sbsec->behavior == SECURITY_FS_USE_NATIVE ||
> /* Special handling. Genfs but also in-core setxattr handler 
> */
> !strcmp(sb->s_type->name, "sysfs") ||
> +   !strcmp(sb->s_type->name, "cgroup") ||
> +   !strcmp(sb->s_type->name, "cgroup2") ||
> !strcmp(sb->s_type->name, "pstore") ||
> !strcmp(sb->s_type->name, "debugfs") ||
> !strcmp(sb->s_type->name, "tracefs") ||
> --
> 2.9.3

-- 
paul moore
www.paul-moore.com


linux-next: build failure after merge of the kvm tree

2017-02-07 Thread Stephen Rothwell
Hi all,

After merging the kvm tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

arch/x86/kvm/x86.c: In function 'kvm_pv_clock_pairing':
arch/x86/kvm/x86.c:6157:2: error: unknown type name 'cycle_t'
  cycle_t cycle;
  ^
arch/x86/kvm/x86.c:6163:42: error: passing argument 2 of 
'kvm_get_walltime_and_clockread' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  if (kvm_get_walltime_and_clockread(, ) == false)
  ^
arch/x86/kvm/x86.c:1665:13: note: expected 'u64 * {aka long long unsigned int 
*}' but argument is of type 'int *'
 static bool kvm_get_walltime_and_clockread(struct timespec *ts,
 ^

Caused by commit

  55dd00a73a51 ("KVM: x86: add KVM_HC_CLOCK_PAIRING hypercall")

I have used the version fo the kvm tree from next-20170207 for today.

-- 
Cheers,
Stephen Rothwell


linux-next: build failure after merge of the kvm tree

2017-02-07 Thread Stephen Rothwell
Hi all,

After merging the kvm tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

arch/x86/kvm/x86.c: In function 'kvm_pv_clock_pairing':
arch/x86/kvm/x86.c:6157:2: error: unknown type name 'cycle_t'
  cycle_t cycle;
  ^
arch/x86/kvm/x86.c:6163:42: error: passing argument 2 of 
'kvm_get_walltime_and_clockread' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  if (kvm_get_walltime_and_clockread(, ) == false)
  ^
arch/x86/kvm/x86.c:1665:13: note: expected 'u64 * {aka long long unsigned int 
*}' but argument is of type 'int *'
 static bool kvm_get_walltime_and_clockread(struct timespec *ts,
 ^

Caused by commit

  55dd00a73a51 ("KVM: x86: add KVM_HC_CLOCK_PAIRING hypercall")

I have used the version fo the kvm tree from next-20170207 for today.

-- 
Cheers,
Stephen Rothwell


Re: v4.9, 4.4-final: 28 bioset threads on small notebook, 36 threads on cellphone

2017-02-07 Thread Mike Galbraith
On Tue, 2017-02-07 at 21:39 +0100, Pavel Machek wrote:
> On Mon 2017-02-06 17:49:06, Kent Overstreet wrote:
> > On Mon, Feb 06, 2017 at 04:47:24PM -0900, Kent Overstreet wrote:
> > > On Mon, Feb 06, 2017 at 01:53:09PM +0100, Pavel Machek wrote:
> > > > Still there on v4.9, 36 threads on nokia n900 cellphone.
> > > > 
> > > > So.. what needs to be done there?
> > 
> > > But, I just got an idea for how to handle this that might be halfway 
> > > sane, maybe
> > > I'll try and come up with a patch...
> > 
> > Ok, here's such a patch, only lightly tested:
> 
> I guess it would be nice for me to test it... but what it is against?
> I tried after v4.10-rc5 and linux-next, but got rejects in both cases.

It wedged into master easily enough (box still seems to work.. but I'll
be rebooting in a very few seconds just in case:), but threads on my
desktop box only dropped from 73 to 71.  Poo.

-Mike


Re: v4.9, 4.4-final: 28 bioset threads on small notebook, 36 threads on cellphone

2017-02-07 Thread Mike Galbraith
On Tue, 2017-02-07 at 21:39 +0100, Pavel Machek wrote:
> On Mon 2017-02-06 17:49:06, Kent Overstreet wrote:
> > On Mon, Feb 06, 2017 at 04:47:24PM -0900, Kent Overstreet wrote:
> > > On Mon, Feb 06, 2017 at 01:53:09PM +0100, Pavel Machek wrote:
> > > > Still there on v4.9, 36 threads on nokia n900 cellphone.
> > > > 
> > > > So.. what needs to be done there?
> > 
> > > But, I just got an idea for how to handle this that might be halfway 
> > > sane, maybe
> > > I'll try and come up with a patch...
> > 
> > Ok, here's such a patch, only lightly tested:
> 
> I guess it would be nice for me to test it... but what it is against?
> I tried after v4.10-rc5 and linux-next, but got rejects in both cases.

It wedged into master easily enough (box still seems to work.. but I'll
be rebooting in a very few seconds just in case:), but threads on my
desktop box only dropped from 73 to 71.  Poo.

-Mike


Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection

2017-02-07 Thread David Carrillo-Cisneros
On Tue, Feb 7, 2017 at 11:47 AM, Arnaldo Carvalho de Melo
 wrote:
> Em Wed, Feb 01, 2017 at 10:38:01PM -0800, David Carrillo-Cisneros escreveu:
>> Python's CC and link Makefile variables were not passed to feature
>> detection, causing feature detection to use system's Python rather than
>> PYTHON_CONFIG's one. This created a mismatch between the detected Python
>> support and the one actually used by perf when PYTHON_CONFIG is specified.
>>
>> Fix it by moving Python's variable initialization to before feature
>> detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
>> build target.
>
> So, all builds on Ubuntu with the devel files for perf end up with:
>
> ubuntu:12.04.5, 14.04.4, 16.04, 16.10 (cross builds, native ones)
>
>   GEN  /tmp/build/perf/libtraceevent-dynamic-list
> /bin/sh: 1: [: U: unexpected operator
> Either missing one of [ /tmp/build/perf/plugin_jbd2.so 
> /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so 
> /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so 
> /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so 
> /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so 
> /tmp/build/perf/plugin_cfg80211.so] or bad version of nm
>
> Details:
>
> perfbuilder@341e71da5019:/git/linux$ cat /etc/os-release
> NAME="Ubuntu"
> VERSION="16.10 (Yakkety Yak)"
> ID=ubuntu
> ID_LIKE=debian
> PRETTY_NAME="Ubuntu 16.10"
> VERSION_ID="16.10"
> HOME_URL="http://www.ubuntu.com/;
> SUPPORT_URL="http://help.ubuntu.com/;
> BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/;
> PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy;
> VERSION_CODENAME=yakkety
> UBUNTU_CODENAME=yakkety
> perfbuilder@341e71da5019:/git/linux$ ls -la /tmp/build/perf/plugin_jbd2.so 
> /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so 
> /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so 
> /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so 
> /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so 
> /tmp/build/perf/plugin_cfg80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13576 Feb  7 19:38 
> /tmp/build/perf/plugin_cfg80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 20256 Feb  7 19:38 
> /tmp/build/perf/plugin_function.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13680 Feb  7 19:38 
> /tmp/build/perf/plugin_hrtimer.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13760 Feb  7 19:38 
> /tmp/build/perf/plugin_jbd2.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13976 Feb  7 19:38 
> /tmp/build/perf/plugin_kmem.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 28680 Feb  7 19:38 
> /tmp/build/perf/plugin_kvm.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 14248 Feb  7 19:38 
> /tmp/build/perf/plugin_mac80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 18800 Feb  7 19:38 
> /tmp/build/perf/plugin_sched_switch.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 20136 Feb  7 19:38 
> /tmp/build/perf/plugin_scsi.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 14504 Feb  7 19:38 
> /tmp/build/perf/plugin_xen.so
> perfbuilder@341e71da5019:/git/linux$
>
> perfbuilder@341e71da5019:/git/linux$ file=/tmp/build/perf/plugin_jbd2.so ; nm 
> -u -D $file | awk 'NF>1 {print $$file}' | sort -u
>  U pevent_register_print_function
>  U pevent_unregister_print_function
>  U trace_seq_printf
> perfbuilder@341e71da5019:/git/linux$
>
>

Thanks for testing it.

I found that some *.so files in Ubuntu have the "w" value in nm's
otput symbol type. From man nm:

   "W"
   "w" The symbol is a weak symbol that has not been
specifically tagged as a weak object symbol.  When a
   weak defined symbol is linked with a normal defined
symbol, the normal defined symbol is used with
   no error.  When a weak undefined symbol is linked and
the symbol is not defined, the value of the
   symbol is determined in a system-specific manner
without error.  On some systems, uppercase
   indicates that a default value has been specified.


I'll send an updated patch that expects and includes undefined weak symbols.

Thanks,
David


Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection

2017-02-07 Thread David Carrillo-Cisneros
On Tue, Feb 7, 2017 at 11:47 AM, Arnaldo Carvalho de Melo
 wrote:
> Em Wed, Feb 01, 2017 at 10:38:01PM -0800, David Carrillo-Cisneros escreveu:
>> Python's CC and link Makefile variables were not passed to feature
>> detection, causing feature detection to use system's Python rather than
>> PYTHON_CONFIG's one. This created a mismatch between the detected Python
>> support and the one actually used by perf when PYTHON_CONFIG is specified.
>>
>> Fix it by moving Python's variable initialization to before feature
>> detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
>> build target.
>
> So, all builds on Ubuntu with the devel files for perf end up with:
>
> ubuntu:12.04.5, 14.04.4, 16.04, 16.10 (cross builds, native ones)
>
>   GEN  /tmp/build/perf/libtraceevent-dynamic-list
> /bin/sh: 1: [: U: unexpected operator
> Either missing one of [ /tmp/build/perf/plugin_jbd2.so 
> /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so 
> /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so 
> /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so 
> /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so 
> /tmp/build/perf/plugin_cfg80211.so] or bad version of nm
>
> Details:
>
> perfbuilder@341e71da5019:/git/linux$ cat /etc/os-release
> NAME="Ubuntu"
> VERSION="16.10 (Yakkety Yak)"
> ID=ubuntu
> ID_LIKE=debian
> PRETTY_NAME="Ubuntu 16.10"
> VERSION_ID="16.10"
> HOME_URL="http://www.ubuntu.com/;
> SUPPORT_URL="http://help.ubuntu.com/;
> BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/;
> PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy;
> VERSION_CODENAME=yakkety
> UBUNTU_CODENAME=yakkety
> perfbuilder@341e71da5019:/git/linux$ ls -la /tmp/build/perf/plugin_jbd2.so 
> /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so 
> /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so 
> /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so 
> /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so 
> /tmp/build/perf/plugin_cfg80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13576 Feb  7 19:38 
> /tmp/build/perf/plugin_cfg80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 20256 Feb  7 19:38 
> /tmp/build/perf/plugin_function.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13680 Feb  7 19:38 
> /tmp/build/perf/plugin_hrtimer.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13760 Feb  7 19:38 
> /tmp/build/perf/plugin_jbd2.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13976 Feb  7 19:38 
> /tmp/build/perf/plugin_kmem.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 28680 Feb  7 19:38 
> /tmp/build/perf/plugin_kvm.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 14248 Feb  7 19:38 
> /tmp/build/perf/plugin_mac80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 18800 Feb  7 19:38 
> /tmp/build/perf/plugin_sched_switch.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 20136 Feb  7 19:38 
> /tmp/build/perf/plugin_scsi.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 14504 Feb  7 19:38 
> /tmp/build/perf/plugin_xen.so
> perfbuilder@341e71da5019:/git/linux$
>
> perfbuilder@341e71da5019:/git/linux$ file=/tmp/build/perf/plugin_jbd2.so ; nm 
> -u -D $file | awk 'NF>1 {print $$file}' | sort -u
>  U pevent_register_print_function
>  U pevent_unregister_print_function
>  U trace_seq_printf
> perfbuilder@341e71da5019:/git/linux$
>
>

Thanks for testing it.

I found that some *.so files in Ubuntu have the "w" value in nm's
otput symbol type. From man nm:

   "W"
   "w" The symbol is a weak symbol that has not been
specifically tagged as a weak object symbol.  When a
   weak defined symbol is linked with a normal defined
symbol, the normal defined symbol is used with
   no error.  When a weak undefined symbol is linked and
the symbol is not defined, the value of the
   symbol is determined in a system-specific manner
without error.  On some systems, uppercase
   indicates that a default value has been specified.


I'll send an updated patch that expects and includes undefined weak symbols.

Thanks,
David


[PATCH v2 2/2] Documentation/kconfig: add search jump feature description

2017-02-07 Thread changbin . du
From: Changbin Du 

Kernel menuconfig support direct jumping function from the search
result. This is a very convenient feature but not documented. So
add a short description to the kconfig documentation to let more
developers know it.

v2: correct spell (Jim)

Signed-off-by: Changbin Du 
Reviewed-by: Jim Davis 
---
 Documentation/kbuild/kconfig.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt
index bbc99c0..fdac2cd 100644
--- a/Documentation/kbuild/kconfig.txt
+++ b/Documentation/kbuild/kconfig.txt
@@ -178,6 +178,10 @@ Searching in menuconfig:
first (and in alphabetical order), then come all other symbols,
sorted in alphabetical order.
 
+   In the search result textbox, each symbol has a jump number on
+   left side if the symbol is visible. You can type the number
+   to jump to target menu to configure that symbol.
+
 __
 User interface options for 'menuconfig'
 
-- 
2.7.4



[PATCH v2 2/2] Documentation/kconfig: add search jump feature description

2017-02-07 Thread changbin . du
From: Changbin Du 

Kernel menuconfig support direct jumping function from the search
result. This is a very convenient feature but not documented. So
add a short description to the kconfig documentation to let more
developers know it.

v2: correct spell (Jim)

Signed-off-by: Changbin Du 
Reviewed-by: Jim Davis 
---
 Documentation/kbuild/kconfig.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt
index bbc99c0..fdac2cd 100644
--- a/Documentation/kbuild/kconfig.txt
+++ b/Documentation/kbuild/kconfig.txt
@@ -178,6 +178,10 @@ Searching in menuconfig:
first (and in alphabetical order), then come all other symbols,
sorted in alphabetical order.
 
+   In the search result textbox, each symbol has a jump number on
+   left side if the symbol is visible. You can type the number
+   to jump to target menu to configure that symbol.
+
 __
 User interface options for 'menuconfig'
 
-- 
2.7.4



[PATCH v2 1/2] kconfig/mconf: add jumping tip in title of search result textbox

2017-02-07 Thread changbin . du
From: Changbin Du 

Prompt user how to quickly jump to the item he/she is interested in.

Signed-off-by: Changbin Du 
Reviewed-by: Jani Nikula 
---
 scripts/kconfig/mconf.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 315ce2c..23d5681 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -443,10 +443,10 @@ static void search_conf(void)
 
res = get_relations_str(sym_arr, );
set_subtitle();
-   dres = show_textbox_ext(_("Search Results"), (char *)
-   str_get(), 0, 0, keys, ,
-   , _text, (void *)
-   );
+   dres = show_textbox_ext(
+   _("Search Results (type the number to jump)"),
+   (char *)str_get(), 0, 0, keys, ,
+   , _text, (void *));
again = false;
for (i = 0; i < JUMP_NB && keys[i]; i++)
if (dres == keys[i]) {
-- 
2.7.4



[PATCH v2 1/2] kconfig/mconf: add jumping tip in title of search result textbox

2017-02-07 Thread changbin . du
From: Changbin Du 

Prompt user how to quickly jump to the item he/she is interested in.

Signed-off-by: Changbin Du 
Reviewed-by: Jani Nikula 
---
 scripts/kconfig/mconf.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 315ce2c..23d5681 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -443,10 +443,10 @@ static void search_conf(void)
 
res = get_relations_str(sym_arr, );
set_subtitle();
-   dres = show_textbox_ext(_("Search Results"), (char *)
-   str_get(), 0, 0, keys, ,
-   , _text, (void *)
-   );
+   dres = show_textbox_ext(
+   _("Search Results (type the number to jump)"),
+   (char *)str_get(), 0, 0, keys, ,
+   , _text, (void *));
again = false;
for (i = 0; i < JUMP_NB && keys[i]; i++)
if (dres == keys[i]) {
-- 
2.7.4



[PATCH v2 0/2] kconfig/mconf: propagate jumping function in search result view

2017-02-07 Thread changbin . du
From: Changbin Du 

While I am searching something in menuconfig, I hope if I can jump to interested
items directly. I even try to add this feature. When I check the code just 
found 
it has already been there but not documented. So why let more developers know 
it?

v2: correct spell (Jim)
   
Changbin Du (2):
  kconfig/mconf: add jumping tip in title of search result textbox
  Documentation/kconfig: add search jump feature description

 Documentation/kbuild/kconfig.txt | 4 
 scripts/kconfig/mconf.c  | 8 
 2 files changed, 8 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH v2 0/2] kconfig/mconf: propagate jumping function in search result view

2017-02-07 Thread changbin . du
From: Changbin Du 

While I am searching something in menuconfig, I hope if I can jump to interested
items directly. I even try to add this feature. When I check the code just 
found 
it has already been there but not documented. So why let more developers know 
it?

v2: correct spell (Jim)
   
Changbin Du (2):
  kconfig/mconf: add jumping tip in title of search result textbox
  Documentation/kconfig: add search jump feature description

 Documentation/kbuild/kconfig.txt | 4 
 scripts/kconfig/mconf.c  | 8 
 2 files changed, 8 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH v3 1/3] clk: zte: add i2s clocks for zx296718

2017-02-07 Thread Baoyou Xie
The i2s related clock support is missing from the existing zx296718
clock driver. This patch adds it, so that the upstream ZX I2S driver
can work out.

Signed-off-by: Baoyou Xie 
---
 drivers/clk/zte/clk-zx296718.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/zte/clk-zx296718.c b/drivers/clk/zte/clk-zx296718.c
index ad5d1df..f106d40 100644
--- a/drivers/clk/zte/clk-zx296718.c
+++ b/drivers/clk/zte/clk-zx296718.c
@@ -941,6 +941,10 @@ static struct zx_clk_gate audio_gate_clk[] = {
GATE(AUDIO_SPDIF1_WCLK, "spdif1_wclk", "spdif1_wclk_div", 
AUDIO_SPDIF1_CLK, 9, CLK_SET_RATE_PARENT, 0),
GATE(AUDIO_TDM_WCLK, "tdm_wclk", "tdm_wclk_div", AUDIO_TDM_CLK, 17, 
CLK_SET_RATE_PARENT, 0),
GATE(AUDIO_TS_PCLK, "tempsensor_pclk", "clk49m5", AUDIO_TS_CLK, 1, 0, 
0),
+   GATE(AUDIO_I2S0_PCLK, "i2s0_pclk", "clk49m5", AUDIO_I2S0_CLK, 8, 0, 0),
+   GATE(AUDIO_I2S1_PCLK, "i2s1_pclk", "clk49m5", AUDIO_I2S1_CLK, 8, 0, 0),
+   GATE(AUDIO_I2S2_PCLK, "i2s2_pclk", "clk49m5", AUDIO_I2S2_CLK, 8, 0, 0),
+   GATE(AUDIO_I2S3_PCLK, "i2s3_pclk", "clk49m5", AUDIO_I2S3_CLK, 8, 0, 0),
 };
 
 static struct clk_hw_onecell_data audio_hw_onecell_data = {
-- 
2.7.4



[PATCH v3 1/3] clk: zte: add i2s clocks for zx296718

2017-02-07 Thread Baoyou Xie
The i2s related clock support is missing from the existing zx296718
clock driver. This patch adds it, so that the upstream ZX I2S driver
can work out.

Signed-off-by: Baoyou Xie 
---
 drivers/clk/zte/clk-zx296718.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/zte/clk-zx296718.c b/drivers/clk/zte/clk-zx296718.c
index ad5d1df..f106d40 100644
--- a/drivers/clk/zte/clk-zx296718.c
+++ b/drivers/clk/zte/clk-zx296718.c
@@ -941,6 +941,10 @@ static struct zx_clk_gate audio_gate_clk[] = {
GATE(AUDIO_SPDIF1_WCLK, "spdif1_wclk", "spdif1_wclk_div", 
AUDIO_SPDIF1_CLK, 9, CLK_SET_RATE_PARENT, 0),
GATE(AUDIO_TDM_WCLK, "tdm_wclk", "tdm_wclk_div", AUDIO_TDM_CLK, 17, 
CLK_SET_RATE_PARENT, 0),
GATE(AUDIO_TS_PCLK, "tempsensor_pclk", "clk49m5", AUDIO_TS_CLK, 1, 0, 
0),
+   GATE(AUDIO_I2S0_PCLK, "i2s0_pclk", "clk49m5", AUDIO_I2S0_CLK, 8, 0, 0),
+   GATE(AUDIO_I2S1_PCLK, "i2s1_pclk", "clk49m5", AUDIO_I2S1_CLK, 8, 0, 0),
+   GATE(AUDIO_I2S2_PCLK, "i2s2_pclk", "clk49m5", AUDIO_I2S2_CLK, 8, 0, 0),
+   GATE(AUDIO_I2S3_PCLK, "i2s3_pclk", "clk49m5", AUDIO_I2S3_CLK, 8, 0, 0),
 };
 
 static struct clk_hw_onecell_data audio_hw_onecell_data = {
-- 
2.7.4



[PATCH 1/4] ACPICA: Linuxize: Restore and fix intel compiler build

2017-02-07 Thread Lv Zheng
ACPICA commit b59347d0b8b676cb555fe8da5cad08fcd4eeb0d3

The following commit cleans up compiler specific inclusions:
  Commit: 9fa1cebdbfff3db8953cebca8ee327d75edefc40
  Subject: ACPICA: OSL: Cleanup the inclusion order of the
   compiler-specific headers
But breaks one thing due to the following old issue:
 Buidling Linux kernel with Intel compiler originally depends on acgcc.h
 not acintel.h.
So after making Intel compiler build working in ACPICA upstream by
correctly using acintel.h, it becomes unable to build Linux kernel using
Intel compiler as there is no acintel.h in the kernel source tree.

This patch releases acintel.h to Linux kernel and fixes its inclusion in
acenv.h.

Fixes: 9fa1cebdbfff ("ACPICA: OSL: Cleanup the inclusion order of the 
compiler-specific headers")
Cc: sta...@vger.kernel.org # 4.9+
Link: https://github.com/acpica/acpica/commit/b59347d0
Tested-by: Stepan M Mishura 
Signed-off-by: Lv Zheng 
---
 include/acpi/platform/acenv.h   |  2 +-
 include/acpi/platform/acintel.h | 87 +
 2 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 include/acpi/platform/acintel.h

diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 926efe9..6fa9c52 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -178,7 +178,7 @@
 #include "acmsvc.h"
 
 #elif defined(__INTEL_COMPILER)
-#include "acintel.h"
+#include 
 
 #endif
 
diff --git a/include/acpi/platform/acintel.h b/include/acpi/platform/acintel.h
new file mode 100644
index 000..17bd3b7
--- /dev/null
+++ b/include/acpi/platform/acintel.h
@@ -0,0 +1,87 @@
+/**
+ *
+ * Name: acintel.h - VC specific defines, etc.
+ *
+ */
+
+/*
+ * Copyright (C) 2000 - 2017, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions, and the following disclaimer,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *substantially similar to the "NO WARRANTY" disclaimer below
+ *("Disclaimer") and any redistribution must be conditioned upon
+ *including a substantially similar Disclaimer requirement for further
+ *binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *of any contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACINTEL_H__
+#define __ACINTEL_H__
+
+/*
+ * Use compiler specific  is a good practice for even when
+ * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
+ */
+#include 
+
+/* Configuration specific to Intel 64-bit C compiler */
+
+#define COMPILER_DEPENDENT_INT64__int64
+#define COMPILER_DEPENDENT_UINT64   unsigned __int64
+#define ACPI_INLINE __inline
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE- Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE  - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE  - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* remark 981 - operands evaluated in no particular order */
+#pragma warning(disable:981)
+
+/* warn C4100: unreferenced formal parameter */
+#pragma warning(disable:4100)
+
+/* warn C4127: conditional expression is constant */
+#pragma warning(disable:4127)
+
+/* warn C4706: assignment within conditional expression */
+#pragma 

[PATCH 1/4] ACPICA: Linuxize: Restore and fix intel compiler build

2017-02-07 Thread Lv Zheng
ACPICA commit b59347d0b8b676cb555fe8da5cad08fcd4eeb0d3

The following commit cleans up compiler specific inclusions:
  Commit: 9fa1cebdbfff3db8953cebca8ee327d75edefc40
  Subject: ACPICA: OSL: Cleanup the inclusion order of the
   compiler-specific headers
But breaks one thing due to the following old issue:
 Buidling Linux kernel with Intel compiler originally depends on acgcc.h
 not acintel.h.
So after making Intel compiler build working in ACPICA upstream by
correctly using acintel.h, it becomes unable to build Linux kernel using
Intel compiler as there is no acintel.h in the kernel source tree.

This patch releases acintel.h to Linux kernel and fixes its inclusion in
acenv.h.

Fixes: 9fa1cebdbfff ("ACPICA: OSL: Cleanup the inclusion order of the 
compiler-specific headers")
Cc: sta...@vger.kernel.org # 4.9+
Link: https://github.com/acpica/acpica/commit/b59347d0
Tested-by: Stepan M Mishura 
Signed-off-by: Lv Zheng 
---
 include/acpi/platform/acenv.h   |  2 +-
 include/acpi/platform/acintel.h | 87 +
 2 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 include/acpi/platform/acintel.h

diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 926efe9..6fa9c52 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -178,7 +178,7 @@
 #include "acmsvc.h"
 
 #elif defined(__INTEL_COMPILER)
-#include "acintel.h"
+#include 
 
 #endif
 
diff --git a/include/acpi/platform/acintel.h b/include/acpi/platform/acintel.h
new file mode 100644
index 000..17bd3b7
--- /dev/null
+++ b/include/acpi/platform/acintel.h
@@ -0,0 +1,87 @@
+/**
+ *
+ * Name: acintel.h - VC specific defines, etc.
+ *
+ */
+
+/*
+ * Copyright (C) 2000 - 2017, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions, and the following disclaimer,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *substantially similar to the "NO WARRANTY" disclaimer below
+ *("Disclaimer") and any redistribution must be conditioned upon
+ *including a substantially similar Disclaimer requirement for further
+ *binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *of any contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACINTEL_H__
+#define __ACINTEL_H__
+
+/*
+ * Use compiler specific  is a good practice for even when
+ * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
+ */
+#include 
+
+/* Configuration specific to Intel 64-bit C compiler */
+
+#define COMPILER_DEPENDENT_INT64__int64
+#define COMPILER_DEPENDENT_UINT64   unsigned __int64
+#define ACPI_INLINE __inline
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE- Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE  - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE  - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* remark 981 - operands evaluated in no particular order */
+#pragma warning(disable:981)
+
+/* warn C4100: unreferenced formal parameter */
+#pragma warning(disable:4100)
+
+/* warn C4127: conditional expression is constant */
+#pragma warning(disable:4127)
+
+/* warn C4706: assignment within conditional expression */
+#pragma warning(disable:4706)
+
+/* warn C4214: bit 

[PATCH 4/4] ACPICA: Update version to 20170119

2017-02-07 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 711a8c19d3c646fdc069c38912d9037c7fa5e718

Version 20170119.

Link: https://github.com/acpica/acpica/commit/711a8c19
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index bb23cf7..3795386 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in MMDD format */
 
-#define ACPI_CA_VERSION 0x20161222
+#define ACPI_CA_VERSION 0x20170119
 
 #include 
 #include 
-- 
2.7.4



[PATCH_v4.1_3_3] Make core_pattern support namespace

2017-02-07 Thread Cao Shufeng
From: Zhao Lei 

Currently, each container shared one copy of coredump setting
with the host system, if host system changed the setting, each
running containers will be affected.
Same story happened when container changed core_pattern, both
host and other container will be affected.

For container based on namespace design, it is good to allow
each container keeping their own coredump setting.

It will bring us following benefit:
1: Each container can change their own coredump setting
   based on operation on /proc/sys/kernel/core_pattern
2: Coredump setting changed in host will not affect
   running containers.
3: Support both case of "putting coredump in guest" and
   "putting curedump in host".

Each namespace-based software(lxc, docker, ..) can use this function
to custom their dump setting.

And this function makes each continer working as separate system,
it fit for design goal of namespace.

Test(in lxc):
 # In the host
 # 
 # echo host_core >/proc/sys/kernel/core_pattern
 # cat /proc/sys/kernel/core_pattern
 host_core
 # ulimit -c 1024000
 # ./make_dump
 Segmentation fault (core dumped)
 # ls -l
 -rw--- 1 root root 331776 Feb  4 18:02 host_core.2175
 -rwxr-xr-x 1 root root 759731 Feb  4 18:01 make_dump
 #

 # In the container
 # 
 # cat /proc/sys/kernel/core_pattern
 host_core
 # echo container_core >/proc/sys/kernel/core_pattern
 # ./make_dump
 Segmentation fault (core dumped)
 # ls -l
 -rwxr-xr-x1 root root   759731 Feb  4 10:45 make_dump
 -rw---1 root root   331776 Feb  4 10:45 container_core.16
 #

 # Return to host
 # 
 # cat /proc/sys/kernel/core_pattern
 host_core
 # ls
 host_core.2175  make_dump  make_dump.c
 # rm -f host_core.2175
 # ./make_dump
 Segmentation fault (core dumped)
 # ls -l
 -rw--- 1 root root 331776 Feb  4 18:49 host_core.2351
 -rwxr-xr-x 1 root root 759731 Feb  4 18:01 make_dump
 #

Signed-off-by: Zhao Lei 
---
 fs/coredump.c | 25 --
 include/linux/pid_namespace.h |  3 +++
 kernel/pid.c  |  2 ++
 kernel/pid_namespace.c|  2 ++
 kernel/sysctl.c   | 50 ++-
 5 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 83282d7..4bab7bf 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -50,7 +50,6 @@
 
 int core_uses_pid;
 unsigned int core_pipe_limit;
-char core_pattern[CORENAME_MAX_SIZE] = "core";
 static int core_name_size = CORENAME_MAX_SIZE;
 
 struct core_name {
@@ -58,8 +57,6 @@ struct core_name {
int used, size;
 };
 
-/* The maximal length of core_pattern is also specified in sysctl.c */
-
 static int expand_corename(struct core_name *cn, int size)
 {
char *corename = krealloc(cn->corename, size, GFP_KERNEL);
@@ -184,10 +181,10 @@ static int cn_print_exe_file(struct core_name *cn)
  * name into corename, which must have space for at least
  * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
  */
-static int format_corename(struct core_name *cn, struct coredump_params *cprm)
+static int format_corename(struct core_name *cn, const char *pat_ptr,
+  struct coredump_params *cprm)
 {
const struct cred *cred = current_cred();
-   const char *pat_ptr = core_pattern;
int ispipe = (*pat_ptr == '|');
int pid_in_pattern = 0;
int err = 0;
@@ -666,6 +663,8 @@ void do_coredump(const siginfo_t *siginfo)
 */
.mm_flags = mm->flags,
};
+   struct pid_namespace *pid_ns;
+   char core_pattern[CORENAME_MAX_SIZE];
 
audit_core_dumps(siginfo->si_signo);
 
@@ -675,6 +674,18 @@ void do_coredump(const siginfo_t *siginfo)
if (!__get_dumpable(cprm.mm_flags))
goto fail;
 
+   pid_ns = task_active_pid_ns(current);
+   spin_lock(_ns->core_pattern_lock);
+   while (pid_ns != _pid_ns) {
+   if (pid_ns->core_pattern[0])
+   break;
+   spin_unlock(_ns->core_pattern_lock);
+   pid_ns = pid_ns->parent,
+   spin_lock(_ns->core_pattern_lock);
+   }
+   strcpy(core_pattern, pid_ns->core_pattern);
+   spin_unlock(_ns->core_pattern_lock);
+
cred = prepare_creds();
if (!cred)
goto fail;
@@ -696,7 +707,7 @@ void do_coredump(const siginfo_t *siginfo)
 
old_cred = override_creds(cred);
 
-   ispipe = format_corename(, );
+   ispipe = format_corename(, core_pattern, );
 
if (ispipe) {
int dump_count;
@@ -743,7 +754,7 @@ void do_coredump(const siginfo_t *siginfo)
}
 
rcu_read_lock();
-   vinit_task = find_task_by_vpid(1);
+   vinit_task = find_task_by_pid_ns(1, pid_ns);
rcu_read_unlock();
if (!vinit_task) {
  

[PATCH_v4.1_0_3] Make core_pattern support namespace

2017-02-07 Thread Cao Shufeng
This patchset includes following function points:
1: Let usermodehelper function possible to set pid namespace
   done by: [PATCH v4 1/3] Make call_usermodehelper_exec possible
   to set pid namespace.
2: Let pipe_type core_pattern write dump into container's rootfs
   done by: [PATCH v4 2/3] Limit dump_pipe program's permission to
   init for container.
2: Make separate core_pattern setting for each container
   done by: [PATCH v4 3/3] Make core_pattern support namespace
3: Compatibility with current system
   also included in: [PATCH v4 3/3] Make core_pattern support namespace
   If container hadn't change core_pattern setting, it will keep
   same setting with host.

Test:
1: Pass a test script for each function of this patchset
   ## TEST IN HOST ##
   [root@kerneldev dumptest]# ./test_host
   Set file core_pattern: OK
   ./test_host: line 41:  2366 Segmentation fault  (core dumped) "$SCRI=
PT_BASE_DIR"/make_dump
   Checking dumpfile: OK
   Set file core_pattern: OK
   ./test_host: line 41:  2369 Segmentation fault  (core dumped) "$SCRI=
PT_BASE_DIR"/make_dump
   Checking dump_pipe triggered: OK
   Checking rootfs: OK
   Checking dumpfile: OK
   Checking namespace: OK
   Checking process list: OK
   Checking capabilities: OK

   ## TEST IN GUEST ##
   # ./test
   Segmentation fault (core dumped)
   Checking dump_pipe triggered: OK
   Checking rootfs: OK
   Checking dumpfile: OK
   Checking namespace: OK
   Checking process list: OK
   Checking cg pids: OK
   Checking capabilities: OK
   [   64.940734] make_dump[2432]: segfault at 0 ip 0040049d sp 000=
07ffc4af025f0 error 6 in make_dump[40+a6000]
   #
2: Pass other test(which is not easy to do in script) by hand.

Changelog v4-v4.1:
1. Fix kernel panic pointed out by:
   xiaolong...@intel.com

Changelog v3.1-v4:
1. remove extra fork pointed out by:
   Andrei Vagin 

Changelog v3-v3.1:
1. Switch "pwd" of pipe program to container's root fs.
2. Rebase on top of v4.9-rc1

Changelog v2->v3:
1: Fix problem of setting pid namespace, pointed out by:
   Andrei Vagin 

Changelog v1(RFC)->v2:
1: Add [PATCH 2/2] which was todo in [RFC v1].
2: Pass a test script for each function.
3: Rebase on top of v4.7.

Suggested-by: Eric W. Biederman 
Suggested-by: KOSAKI Motohiro 
Signed-off-by: Zhao Lei 
Signed-off-by: Cao Shufeng 

Cao Shufeng (2):
  Make call_usermodehelper_exec possible to set namespaces
  Limit dump_pipe program's permission to init for container

Zhao Lei (1):
  Make core_pattern support namespace

 fs/coredump.c | 150 +++---
 include/linux/binfmts.h   |   2 +
 include/linux/kmod.h  |   5 ++
 include/linux/pid_namespace.h |   3 +
 init/do_mounts_initrd.c   |   3 +-
 kernel/kmod.c |  55 +---
 kernel/pid.c  |   2 +
 kernel/pid_namespace.c|   2 +
 kernel/sysctl.c   |  50 --
 lib/kobject_uevent.c  |   3 +-
 security/keys/request_key.c   |   4 +-
 11 files changed, 253 insertions(+), 26 deletions(-)

-- 
2.9.3





[PATCH 4/4] ACPICA: Update version to 20170119

2017-02-07 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 711a8c19d3c646fdc069c38912d9037c7fa5e718

Version 20170119.

Link: https://github.com/acpica/acpica/commit/711a8c19
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index bb23cf7..3795386 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in MMDD format */
 
-#define ACPI_CA_VERSION 0x20161222
+#define ACPI_CA_VERSION 0x20170119
 
 #include 
 #include 
-- 
2.7.4



[PATCH_v4.1_3_3] Make core_pattern support namespace

2017-02-07 Thread Cao Shufeng
From: Zhao Lei 

Currently, each container shared one copy of coredump setting
with the host system, if host system changed the setting, each
running containers will be affected.
Same story happened when container changed core_pattern, both
host and other container will be affected.

For container based on namespace design, it is good to allow
each container keeping their own coredump setting.

It will bring us following benefit:
1: Each container can change their own coredump setting
   based on operation on /proc/sys/kernel/core_pattern
2: Coredump setting changed in host will not affect
   running containers.
3: Support both case of "putting coredump in guest" and
   "putting curedump in host".

Each namespace-based software(lxc, docker, ..) can use this function
to custom their dump setting.

And this function makes each continer working as separate system,
it fit for design goal of namespace.

Test(in lxc):
 # In the host
 # 
 # echo host_core >/proc/sys/kernel/core_pattern
 # cat /proc/sys/kernel/core_pattern
 host_core
 # ulimit -c 1024000
 # ./make_dump
 Segmentation fault (core dumped)
 # ls -l
 -rw--- 1 root root 331776 Feb  4 18:02 host_core.2175
 -rwxr-xr-x 1 root root 759731 Feb  4 18:01 make_dump
 #

 # In the container
 # 
 # cat /proc/sys/kernel/core_pattern
 host_core
 # echo container_core >/proc/sys/kernel/core_pattern
 # ./make_dump
 Segmentation fault (core dumped)
 # ls -l
 -rwxr-xr-x1 root root   759731 Feb  4 10:45 make_dump
 -rw---1 root root   331776 Feb  4 10:45 container_core.16
 #

 # Return to host
 # 
 # cat /proc/sys/kernel/core_pattern
 host_core
 # ls
 host_core.2175  make_dump  make_dump.c
 # rm -f host_core.2175
 # ./make_dump
 Segmentation fault (core dumped)
 # ls -l
 -rw--- 1 root root 331776 Feb  4 18:49 host_core.2351
 -rwxr-xr-x 1 root root 759731 Feb  4 18:01 make_dump
 #

Signed-off-by: Zhao Lei 
---
 fs/coredump.c | 25 --
 include/linux/pid_namespace.h |  3 +++
 kernel/pid.c  |  2 ++
 kernel/pid_namespace.c|  2 ++
 kernel/sysctl.c   | 50 ++-
 5 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 83282d7..4bab7bf 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -50,7 +50,6 @@
 
 int core_uses_pid;
 unsigned int core_pipe_limit;
-char core_pattern[CORENAME_MAX_SIZE] = "core";
 static int core_name_size = CORENAME_MAX_SIZE;
 
 struct core_name {
@@ -58,8 +57,6 @@ struct core_name {
int used, size;
 };
 
-/* The maximal length of core_pattern is also specified in sysctl.c */
-
 static int expand_corename(struct core_name *cn, int size)
 {
char *corename = krealloc(cn->corename, size, GFP_KERNEL);
@@ -184,10 +181,10 @@ static int cn_print_exe_file(struct core_name *cn)
  * name into corename, which must have space for at least
  * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
  */
-static int format_corename(struct core_name *cn, struct coredump_params *cprm)
+static int format_corename(struct core_name *cn, const char *pat_ptr,
+  struct coredump_params *cprm)
 {
const struct cred *cred = current_cred();
-   const char *pat_ptr = core_pattern;
int ispipe = (*pat_ptr == '|');
int pid_in_pattern = 0;
int err = 0;
@@ -666,6 +663,8 @@ void do_coredump(const siginfo_t *siginfo)
 */
.mm_flags = mm->flags,
};
+   struct pid_namespace *pid_ns;
+   char core_pattern[CORENAME_MAX_SIZE];
 
audit_core_dumps(siginfo->si_signo);
 
@@ -675,6 +674,18 @@ void do_coredump(const siginfo_t *siginfo)
if (!__get_dumpable(cprm.mm_flags))
goto fail;
 
+   pid_ns = task_active_pid_ns(current);
+   spin_lock(_ns->core_pattern_lock);
+   while (pid_ns != _pid_ns) {
+   if (pid_ns->core_pattern[0])
+   break;
+   spin_unlock(_ns->core_pattern_lock);
+   pid_ns = pid_ns->parent,
+   spin_lock(_ns->core_pattern_lock);
+   }
+   strcpy(core_pattern, pid_ns->core_pattern);
+   spin_unlock(_ns->core_pattern_lock);
+
cred = prepare_creds();
if (!cred)
goto fail;
@@ -696,7 +707,7 @@ void do_coredump(const siginfo_t *siginfo)
 
old_cred = override_creds(cred);
 
-   ispipe = format_corename(, );
+   ispipe = format_corename(, core_pattern, );
 
if (ispipe) {
int dump_count;
@@ -743,7 +754,7 @@ void do_coredump(const siginfo_t *siginfo)
}
 
rcu_read_lock();
-   vinit_task = find_task_by_vpid(1);
+   vinit_task = find_task_by_pid_ns(1, pid_ns);
rcu_read_unlock();
if (!vinit_task) {
printk(KERN_WARNING "failed getting init 

[PATCH_v4.1_0_3] Make core_pattern support namespace

2017-02-07 Thread Cao Shufeng
This patchset includes following function points:
1: Let usermodehelper function possible to set pid namespace
   done by: [PATCH v4 1/3] Make call_usermodehelper_exec possible
   to set pid namespace.
2: Let pipe_type core_pattern write dump into container's rootfs
   done by: [PATCH v4 2/3] Limit dump_pipe program's permission to
   init for container.
2: Make separate core_pattern setting for each container
   done by: [PATCH v4 3/3] Make core_pattern support namespace
3: Compatibility with current system
   also included in: [PATCH v4 3/3] Make core_pattern support namespace
   If container hadn't change core_pattern setting, it will keep
   same setting with host.

Test:
1: Pass a test script for each function of this patchset
   ## TEST IN HOST ##
   [root@kerneldev dumptest]# ./test_host
   Set file core_pattern: OK
   ./test_host: line 41:  2366 Segmentation fault  (core dumped) "$SCRI=
PT_BASE_DIR"/make_dump
   Checking dumpfile: OK
   Set file core_pattern: OK
   ./test_host: line 41:  2369 Segmentation fault  (core dumped) "$SCRI=
PT_BASE_DIR"/make_dump
   Checking dump_pipe triggered: OK
   Checking rootfs: OK
   Checking dumpfile: OK
   Checking namespace: OK
   Checking process list: OK
   Checking capabilities: OK

   ## TEST IN GUEST ##
   # ./test
   Segmentation fault (core dumped)
   Checking dump_pipe triggered: OK
   Checking rootfs: OK
   Checking dumpfile: OK
   Checking namespace: OK
   Checking process list: OK
   Checking cg pids: OK
   Checking capabilities: OK
   [   64.940734] make_dump[2432]: segfault at 0 ip 0040049d sp 000=
07ffc4af025f0 error 6 in make_dump[40+a6000]
   #
2: Pass other test(which is not easy to do in script) by hand.

Changelog v4-v4.1:
1. Fix kernel panic pointed out by:
   xiaolong...@intel.com

Changelog v3.1-v4:
1. remove extra fork pointed out by:
   Andrei Vagin 

Changelog v3-v3.1:
1. Switch "pwd" of pipe program to container's root fs.
2. Rebase on top of v4.9-rc1

Changelog v2->v3:
1: Fix problem of setting pid namespace, pointed out by:
   Andrei Vagin 

Changelog v1(RFC)->v2:
1: Add [PATCH 2/2] which was todo in [RFC v1].
2: Pass a test script for each function.
3: Rebase on top of v4.7.

Suggested-by: Eric W. Biederman 
Suggested-by: KOSAKI Motohiro 
Signed-off-by: Zhao Lei 
Signed-off-by: Cao Shufeng 

Cao Shufeng (2):
  Make call_usermodehelper_exec possible to set namespaces
  Limit dump_pipe program's permission to init for container

Zhao Lei (1):
  Make core_pattern support namespace

 fs/coredump.c | 150 +++---
 include/linux/binfmts.h   |   2 +
 include/linux/kmod.h  |   5 ++
 include/linux/pid_namespace.h |   3 +
 init/do_mounts_initrd.c   |   3 +-
 kernel/kmod.c |  55 +---
 kernel/pid.c  |   2 +
 kernel/pid_namespace.c|   2 +
 kernel/sysctl.c   |  50 --
 lib/kobject_uevent.c  |   3 +-
 security/keys/request_key.c   |   4 +-
 11 files changed, 253 insertions(+), 26 deletions(-)

-- 
2.9.3





[PATCH_v4.1_1_3] Make call_usermodehelper_exec possible to set namespaces

2017-02-07 Thread Cao Shufeng
Current call_usermodehelper_work() can not set namespaces for
the executed program.

This patch add above function for call_usermodehelper_work().
The init_intermediate is introduced for init works which should
be done before fork(). So that we get a method to set namespaces
for children. The cleanup_intermediate is introduced for cleaning
up what we have done in init_intermediate, like switching back
the namespace.

This function is helpful for coredump to run pipe_program in
specific container environment.

Signed-off-by: Cao Shufeng 
Co-author-by: Zhao Lei 
---
 fs/coredump.c   |  3 ++-
 include/linux/kmod.h|  5 +
 init/do_mounts_initrd.c |  3 ++-
 kernel/kmod.c   | 55 +
 lib/kobject_uevent.c|  3 ++-
 security/keys/request_key.c |  4 ++--
 6 files changed, 59 insertions(+), 14 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index eb9c92c..9abf4e5 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -644,7 +644,8 @@ void do_coredump(const siginfo_t *siginfo)
retval = -ENOMEM;
sub_info = call_usermodehelper_setup(helper_argv[0],
helper_argv, NULL, GFP_KERNEL,
-   umh_pipe_setup, NULL, );
+   NULL, NULL, umh_pipe_setup,
+   NULL, );
if (sub_info)
retval = call_usermodehelper_exec(sub_info,
  UMH_WAIT_EXEC);
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index fcfd2bf..0e474d4 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -61,6 +61,9 @@ struct subprocess_info {
char **envp;
int wait;
int retval;
+   bool cleaned;
+   void (*init_intermediate)(struct subprocess_info *info);
+   void (*cleanup_intermediate)(struct subprocess_info *info);
int (*init)(struct subprocess_info *info, struct cred *new);
void (*cleanup)(struct subprocess_info *info);
void *data;
@@ -71,6 +74,8 @@ call_usermodehelper(char *path, char **argv, char **envp, int 
wait);
 
 extern struct subprocess_info *
 call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask,
+ void (*init_intermediate)(struct subprocess_info 
*info),
+ void (*cleanup_intermediate)(struct subprocess_info 
*info),
  int (*init)(struct subprocess_info *info, struct cred 
*new),
  void (*cleanup)(struct subprocess_info *), void 
*data);
 
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index a1000ca..59d11c9 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -72,7 +72,8 @@ static void __init handle_initrd(void)
current->flags |= PF_FREEZER_SKIP;
 
info = call_usermodehelper_setup("/linuxrc", argv, envp_init,
-GFP_KERNEL, init_linuxrc, NULL, NULL);
+GFP_KERNEL, NULL, NULL, init_linuxrc,
+NULL, NULL);
if (!info)
return;
call_usermodehelper_exec(info, UMH_WAIT_PROC);
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 0277d12..dcaa17d 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -91,7 +92,8 @@ static int call_modprobe(char *module_name, int wait)
argv[4] = NULL;
 
info = call_usermodehelper_setup(modprobe_path, argv, envp, GFP_KERNEL,
-NULL, free_modprobe_argv, NULL);
+NULL, NULL, NULL, free_modprobe_argv,
+ NULL);
if (!info)
goto free_module_name;
 
@@ -205,8 +207,15 @@ static void umh_complete(struct subprocess_info *sub_info)
 */
if (comp)
complete(comp);
-   else
+   else {
+   for(;;) {
+   if (sub_info->cleaned == false)
+   udelay(20);
+   else
+   break;
+   }
call_usermodehelper_freeinfo(sub_info);
+   }
 }
 
 /*
@@ -301,6 +310,10 @@ static void call_usermodehelper_exec_sync(struct 
subprocess_info *sub_info)
/* Restore default kernel sig handler */
kernel_sigaction(SIGCHLD, SIG_IGN);
 
+   if(sub_info->cleanup_intermediate) {
+   sub_info->cleanup_intermediate(sub_info);
+   }
+   sub_info->cleaned = true;
umh_complete(sub_info);
 }
 
@@ -322,6 +335,9 @@ static void call_usermodehelper_exec_work(struct 
work_struct *work)
 {
struct 

[PATCH_v4.1_2_3] Limit dump_pipe program's permission to init for container

2017-02-07 Thread Cao Shufeng
Currently when we set core_pattern to a pipe, the pipe program is
forked by kthread running with root's permission, and write dumpfile
into host's filesystem.
Same thing happened for container, the dumper and dumpfile are also
in host(not in container).

It have following program:
1: Not consistent with file_type core_pattern
   When we set core_pattern to a file, the container will write dump
   into container's filesystem instead of host.
2: Not safe for privileged container
   In a privileged container, user can destroy host system by following
   command:
   # # In a container
   # echo "|/bin/dd of=/boot/vmlinuz" >/proc/sys/kernel/core_pattern
   # make_dump

This patch switch dumper program's environment to init task, so, for
container, dumper program have same environment with init task in
container, which make dumper program put in container's filesystem, and
write coredump into container's filesystem.
The dumper's permission is also limited into subset of container's init
process.

Suggested-by: Eric W. Biederman 
Suggested-by: KOSAKI Motohiro 

Signed-off-by: Cao ShuFeng
---
 fs/coredump.c   | 126 +++-
 include/linux/binfmts.h |   2 +
 2 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 9abf4e5..83282d7 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -505,6 +505,45 @@ static void wait_for_dump_helpers(struct file *file)
 }
 
 /*
+ * umh_ns_setup
+ * set the namesapces to the bask task of a container.
+ * we need to switch back to the original namespaces
+ * so that the thread of workqueue is not influlenced.
+ *
+ * this method runs in workqueue kernel thread.
+ */
+static void umh_ns_setup(struct subprocess_info *info)
+{
+   struct coredump_params *cp = (struct coredump_params *)info->data;
+   struct task_struct *base_task = cp->base_task;
+
+   if (base_task) {
+   cp->current_task_nsproxy = current->nsproxy;
+   //prevent current namespace from being freed
+   get_nsproxy(current->nsproxy);
+   /* Set namespaces to base_task */
+   get_nsproxy(base_task->nsproxy);
+   switch_task_namespaces(current, base_task->nsproxy);
+   }
+}
+
+/*
+ * umh_ns_cleanup
+ * cleanup what we have done in umh_ns_setup.
+ *
+ * this method runs in workqueue kernel thread.
+ */
+static void umh_ns_cleanup(struct subprocess_info *info)
+{
+   struct coredump_params *cp = (struct coredump_params *)info->data;
+   struct nsproxy *current_task_nsproxy = cp->current_task_nsproxy;
+   if (current_task_nsproxy) {
+   /* switch workqueue's original namespace back */
+   switch_task_namespaces(current, current_task_nsproxy);
+   }
+}
+
+/*
  * umh_pipe_setup
  * helper function to customize the process used
  * to collect the core in userspace.  Specifically
@@ -519,6 +558,8 @@ static int umh_pipe_setup(struct subprocess_info *info, 
struct cred *new)
 {
struct file *files[2];
struct coredump_params *cp = (struct coredump_params *)info->data;
+   struct task_struct *base_task;
+
int err = create_pipe_files(files, 0);
if (err)
return err;
@@ -527,10 +568,76 @@ static int umh_pipe_setup(struct subprocess_info *info, 
struct cred *new)
 
err = replace_fd(0, files[0], 0);
fput(files[0]);
+   if (err)
+   return err;
+
/* and disallow core files too */
current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};
 
-   return err;
+   base_task = cp->base_task;
+   if (base_task) {
+   const struct cred *base_cred;
+
+   /* Set fs_root to base_task */
+   spin_lock(_task->fs->lock);
+   set_fs_root(current->fs, _task->fs->root);
+   set_fs_pwd(current->fs, _task->fs->pwd);
+   spin_unlock(_task->fs->lock);
+
+   /* Set cgroup to base_task */
+   current->flags &= ~PF_NO_SETAFFINITY;
+   err = cgroup_attach_task_all(base_task, current);
+   if (err < 0)
+   return err;
+
+   /* Set cred to base_task */
+   base_cred = get_task_cred(base_task);
+
+   new->uid   = base_cred->uid;
+   new->gid   = base_cred->gid;
+   new->suid  = base_cred->suid;
+   new->sgid  = base_cred->sgid;
+   new->euid  = base_cred->euid;
+   new->egid  = base_cred->egid;
+   new->fsuid = base_cred->fsuid;
+   new->fsgid = base_cred->fsgid;
+
+   new->securebits = base_cred->securebits;
+
+   new->cap_inheritable = base_cred->cap_inheritable;
+   new->cap_permitted   = base_cred->cap_permitted;
+   new->cap_effective   = 

[PATCH_v4.1_1_3] Make call_usermodehelper_exec possible to set namespaces

2017-02-07 Thread Cao Shufeng
Current call_usermodehelper_work() can not set namespaces for
the executed program.

This patch add above function for call_usermodehelper_work().
The init_intermediate is introduced for init works which should
be done before fork(). So that we get a method to set namespaces
for children. The cleanup_intermediate is introduced for cleaning
up what we have done in init_intermediate, like switching back
the namespace.

This function is helpful for coredump to run pipe_program in
specific container environment.

Signed-off-by: Cao Shufeng 
Co-author-by: Zhao Lei 
---
 fs/coredump.c   |  3 ++-
 include/linux/kmod.h|  5 +
 init/do_mounts_initrd.c |  3 ++-
 kernel/kmod.c   | 55 +
 lib/kobject_uevent.c|  3 ++-
 security/keys/request_key.c |  4 ++--
 6 files changed, 59 insertions(+), 14 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index eb9c92c..9abf4e5 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -644,7 +644,8 @@ void do_coredump(const siginfo_t *siginfo)
retval = -ENOMEM;
sub_info = call_usermodehelper_setup(helper_argv[0],
helper_argv, NULL, GFP_KERNEL,
-   umh_pipe_setup, NULL, );
+   NULL, NULL, umh_pipe_setup,
+   NULL, );
if (sub_info)
retval = call_usermodehelper_exec(sub_info,
  UMH_WAIT_EXEC);
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index fcfd2bf..0e474d4 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -61,6 +61,9 @@ struct subprocess_info {
char **envp;
int wait;
int retval;
+   bool cleaned;
+   void (*init_intermediate)(struct subprocess_info *info);
+   void (*cleanup_intermediate)(struct subprocess_info *info);
int (*init)(struct subprocess_info *info, struct cred *new);
void (*cleanup)(struct subprocess_info *info);
void *data;
@@ -71,6 +74,8 @@ call_usermodehelper(char *path, char **argv, char **envp, int 
wait);
 
 extern struct subprocess_info *
 call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask,
+ void (*init_intermediate)(struct subprocess_info 
*info),
+ void (*cleanup_intermediate)(struct subprocess_info 
*info),
  int (*init)(struct subprocess_info *info, struct cred 
*new),
  void (*cleanup)(struct subprocess_info *), void 
*data);
 
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index a1000ca..59d11c9 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -72,7 +72,8 @@ static void __init handle_initrd(void)
current->flags |= PF_FREEZER_SKIP;
 
info = call_usermodehelper_setup("/linuxrc", argv, envp_init,
-GFP_KERNEL, init_linuxrc, NULL, NULL);
+GFP_KERNEL, NULL, NULL, init_linuxrc,
+NULL, NULL);
if (!info)
return;
call_usermodehelper_exec(info, UMH_WAIT_PROC);
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 0277d12..dcaa17d 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -91,7 +92,8 @@ static int call_modprobe(char *module_name, int wait)
argv[4] = NULL;
 
info = call_usermodehelper_setup(modprobe_path, argv, envp, GFP_KERNEL,
-NULL, free_modprobe_argv, NULL);
+NULL, NULL, NULL, free_modprobe_argv,
+ NULL);
if (!info)
goto free_module_name;
 
@@ -205,8 +207,15 @@ static void umh_complete(struct subprocess_info *sub_info)
 */
if (comp)
complete(comp);
-   else
+   else {
+   for(;;) {
+   if (sub_info->cleaned == false)
+   udelay(20);
+   else
+   break;
+   }
call_usermodehelper_freeinfo(sub_info);
+   }
 }
 
 /*
@@ -301,6 +310,10 @@ static void call_usermodehelper_exec_sync(struct 
subprocess_info *sub_info)
/* Restore default kernel sig handler */
kernel_sigaction(SIGCHLD, SIG_IGN);
 
+   if(sub_info->cleanup_intermediate) {
+   sub_info->cleanup_intermediate(sub_info);
+   }
+   sub_info->cleaned = true;
umh_complete(sub_info);
 }
 
@@ -322,6 +335,9 @@ static void call_usermodehelper_exec_work(struct 
work_struct *work)
 {
struct subprocess_info *sub_info =

[PATCH_v4.1_2_3] Limit dump_pipe program's permission to init for container

2017-02-07 Thread Cao Shufeng
Currently when we set core_pattern to a pipe, the pipe program is
forked by kthread running with root's permission, and write dumpfile
into host's filesystem.
Same thing happened for container, the dumper and dumpfile are also
in host(not in container).

It have following program:
1: Not consistent with file_type core_pattern
   When we set core_pattern to a file, the container will write dump
   into container's filesystem instead of host.
2: Not safe for privileged container
   In a privileged container, user can destroy host system by following
   command:
   # # In a container
   # echo "|/bin/dd of=/boot/vmlinuz" >/proc/sys/kernel/core_pattern
   # make_dump

This patch switch dumper program's environment to init task, so, for
container, dumper program have same environment with init task in
container, which make dumper program put in container's filesystem, and
write coredump into container's filesystem.
The dumper's permission is also limited into subset of container's init
process.

Suggested-by: Eric W. Biederman 
Suggested-by: KOSAKI Motohiro 

Signed-off-by: Cao ShuFeng
---
 fs/coredump.c   | 126 +++-
 include/linux/binfmts.h |   2 +
 2 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 9abf4e5..83282d7 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -505,6 +505,45 @@ static void wait_for_dump_helpers(struct file *file)
 }
 
 /*
+ * umh_ns_setup
+ * set the namesapces to the bask task of a container.
+ * we need to switch back to the original namespaces
+ * so that the thread of workqueue is not influlenced.
+ *
+ * this method runs in workqueue kernel thread.
+ */
+static void umh_ns_setup(struct subprocess_info *info)
+{
+   struct coredump_params *cp = (struct coredump_params *)info->data;
+   struct task_struct *base_task = cp->base_task;
+
+   if (base_task) {
+   cp->current_task_nsproxy = current->nsproxy;
+   //prevent current namespace from being freed
+   get_nsproxy(current->nsproxy);
+   /* Set namespaces to base_task */
+   get_nsproxy(base_task->nsproxy);
+   switch_task_namespaces(current, base_task->nsproxy);
+   }
+}
+
+/*
+ * umh_ns_cleanup
+ * cleanup what we have done in umh_ns_setup.
+ *
+ * this method runs in workqueue kernel thread.
+ */
+static void umh_ns_cleanup(struct subprocess_info *info)
+{
+   struct coredump_params *cp = (struct coredump_params *)info->data;
+   struct nsproxy *current_task_nsproxy = cp->current_task_nsproxy;
+   if (current_task_nsproxy) {
+   /* switch workqueue's original namespace back */
+   switch_task_namespaces(current, current_task_nsproxy);
+   }
+}
+
+/*
  * umh_pipe_setup
  * helper function to customize the process used
  * to collect the core in userspace.  Specifically
@@ -519,6 +558,8 @@ static int umh_pipe_setup(struct subprocess_info *info, 
struct cred *new)
 {
struct file *files[2];
struct coredump_params *cp = (struct coredump_params *)info->data;
+   struct task_struct *base_task;
+
int err = create_pipe_files(files, 0);
if (err)
return err;
@@ -527,10 +568,76 @@ static int umh_pipe_setup(struct subprocess_info *info, 
struct cred *new)
 
err = replace_fd(0, files[0], 0);
fput(files[0]);
+   if (err)
+   return err;
+
/* and disallow core files too */
current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};
 
-   return err;
+   base_task = cp->base_task;
+   if (base_task) {
+   const struct cred *base_cred;
+
+   /* Set fs_root to base_task */
+   spin_lock(_task->fs->lock);
+   set_fs_root(current->fs, _task->fs->root);
+   set_fs_pwd(current->fs, _task->fs->pwd);
+   spin_unlock(_task->fs->lock);
+
+   /* Set cgroup to base_task */
+   current->flags &= ~PF_NO_SETAFFINITY;
+   err = cgroup_attach_task_all(base_task, current);
+   if (err < 0)
+   return err;
+
+   /* Set cred to base_task */
+   base_cred = get_task_cred(base_task);
+
+   new->uid   = base_cred->uid;
+   new->gid   = base_cred->gid;
+   new->suid  = base_cred->suid;
+   new->sgid  = base_cred->sgid;
+   new->euid  = base_cred->euid;
+   new->egid  = base_cred->egid;
+   new->fsuid = base_cred->fsuid;
+   new->fsgid = base_cred->fsgid;
+
+   new->securebits = base_cred->securebits;
+
+   new->cap_inheritable = base_cred->cap_inheritable;
+   new->cap_permitted   = base_cred->cap_permitted;
+   new->cap_effective   = base_cred->cap_effective;
+   new->cap_bset= base_cred->cap_bset;
+ 

[PATCH 3/4] ACPICA: Tools: Update common signon, remove compilation bit width

2017-02-07 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 43e04e75a9849072a1557b674004d8093bddb9ef

Remove the bit width of the compiler that generated the tool
from the tool signon. This was confusing and unnecessary.

Changed the iASL signon to add "disassembler" to the name.

Link: https://github.com/acpica/acpica/commit/43e04e75
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/acapps.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h
index c32bbe4..b65f273 100644
--- a/drivers/acpi/acpica/acapps.h
+++ b/drivers/acpi/acpica/acapps.h
@@ -54,23 +54,23 @@
 #define ACPICA_COPYRIGHT"Copyright (c) 2000 - 2017 Intel 
Corporation"
 
 #if ACPI_MACHINE_WIDTH == 64
-#define ACPI_WIDTH  "-64"
+#define ACPI_WIDTH  " (64-bit version)"
 
 #elif ACPI_MACHINE_WIDTH == 32
-#define ACPI_WIDTH  "-32"
+#define ACPI_WIDTH  " (32-bit version)"
 
 #else
 #error unknown ACPI_MACHINE_WIDTH
-#define ACPI_WIDTH  "-??"
+#define ACPI_WIDTH  " (unknown bit width, not 32 or 64)"
 
 #endif
 
 /* Macros for signons and file headers */
 
 #define ACPI_COMMON_SIGNON(utility_name) \
-   "\n%s\n%s version %8.8X%s\n%s\n\n", \
+   "\n%s\n%s version %8.8X\n%s\n\n", \
ACPICA_NAME, \
-   utility_name, ((u32) ACPI_CA_VERSION), ACPI_WIDTH, \
+   utility_name, ((u32) ACPI_CA_VERSION), \
ACPICA_COPYRIGHT
 
 #define ACPI_COMMON_HEADER(utility_name, prefix) \
-- 
2.7.4



[PATCH 2/4] ACPICA: Source tree: Update copyright notices to 2017

2017-02-07 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 16577e5265923f4999b4d2c0addb2343b18135e1

Affects all files.

Link: https://github.com/acpica/acpica/commit/16577e52
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/acapps.h | 4 ++--
 drivers/acpi/acpica/accommon.h   | 2 +-
 drivers/acpi/acpica/acdebug.h| 2 +-
 drivers/acpi/acpica/acdispat.h   | 2 +-
 drivers/acpi/acpica/acevents.h   | 2 +-
 drivers/acpi/acpica/acglobal.h   | 2 +-
 drivers/acpi/acpica/achware.h| 2 +-
 drivers/acpi/acpica/acinterp.h   | 2 +-
 drivers/acpi/acpica/aclocal.h| 2 +-
 drivers/acpi/acpica/acmacros.h   | 2 +-
 drivers/acpi/acpica/acnamesp.h   | 2 +-
 drivers/acpi/acpica/acobject.h   | 2 +-
 drivers/acpi/acpica/acopcode.h   | 2 +-
 drivers/acpi/acpica/acparser.h   | 2 +-
 drivers/acpi/acpica/acpredef.h   | 2 +-
 drivers/acpi/acpica/acresrc.h| 2 +-
 drivers/acpi/acpica/acstruct.h   | 2 +-
 drivers/acpi/acpica/actables.h   | 2 +-
 drivers/acpi/acpica/acutils.h| 2 +-
 drivers/acpi/acpica/amlcode.h| 2 +-
 drivers/acpi/acpica/amlresrc.h   | 2 +-
 drivers/acpi/acpica/dbcmds.c | 2 +-
 drivers/acpi/acpica/dbconvert.c  | 2 +-
 drivers/acpi/acpica/dbdisply.c   | 2 +-
 drivers/acpi/acpica/dbexec.c | 2 +-
 drivers/acpi/acpica/dbfileio.c   | 2 +-
 drivers/acpi/acpica/dbhistry.c   | 2 +-
 drivers/acpi/acpica/dbinput.c| 2 +-
 drivers/acpi/acpica/dbmethod.c   | 2 +-
 drivers/acpi/acpica/dbnames.c| 2 +-
 drivers/acpi/acpica/dbobject.c   | 2 +-
 drivers/acpi/acpica/dbstats.c| 2 +-
 drivers/acpi/acpica/dbtest.c | 2 +-
 drivers/acpi/acpica/dbutils.c| 2 +-
 drivers/acpi/acpica/dbxface.c| 2 +-
 drivers/acpi/acpica/dsargs.c | 2 +-
 drivers/acpi/acpica/dscontrol.c  | 2 +-
 drivers/acpi/acpica/dsdebug.c| 2 +-
 drivers/acpi/acpica/dsfield.c| 2 +-
 drivers/acpi/acpica/dsinit.c | 2 +-
 drivers/acpi/acpica/dsmethod.c   | 2 +-
 drivers/acpi/acpica/dsmthdat.c   | 2 +-
 drivers/acpi/acpica/dsobject.c   | 2 +-
 drivers/acpi/acpica/dsopcode.c   | 2 +-
 drivers/acpi/acpica/dsutils.c| 2 +-
 drivers/acpi/acpica/dswexec.c| 2 +-
 drivers/acpi/acpica/dswload.c| 2 +-
 drivers/acpi/acpica/dswload2.c   | 2 +-
 drivers/acpi/acpica/dswscope.c   | 2 +-
 drivers/acpi/acpica/dswstate.c   | 2 +-
 drivers/acpi/acpica/evevent.c| 2 +-
 drivers/acpi/acpica/evglock.c| 2 +-
 drivers/acpi/acpica/evgpe.c  | 2 +-
 drivers/acpi/acpica/evgpeblk.c   | 2 +-
 drivers/acpi/acpica/evgpeinit.c  | 2 +-
 drivers/acpi/acpica/evgpeutil.c  | 2 +-
 drivers/acpi/acpica/evhandler.c  | 2 +-
 drivers/acpi/acpica/evmisc.c | 2 +-
 drivers/acpi/acpica/evregion.c   | 2 +-
 drivers/acpi/acpica/evrgnini.c   | 2 +-
 drivers/acpi/acpica/evsci.c  | 2 +-
 drivers/acpi/acpica/evxface.c| 2 +-
 drivers/acpi/acpica/evxfevnt.c   | 2 +-
 drivers/acpi/acpica/evxfgpe.c| 2 +-
 drivers/acpi/acpica/evxfregn.c   | 2 +-
 drivers/acpi/acpica/exconcat.c   | 2 +-
 drivers/acpi/acpica/exconfig.c   | 2 +-
 drivers/acpi/acpica/exconvrt.c   | 2 +-
 drivers/acpi/acpica/excreate.c   | 2 +-
 drivers/acpi/acpica/exdebug.c| 2 +-
 drivers/acpi/acpica/exdump.c | 2 +-
 drivers/acpi/acpica/exfield.c| 2 +-
 drivers/acpi/acpica/exfldio.c   

[PATCH 3/4] ACPICA: Tools: Update common signon, remove compilation bit width

2017-02-07 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 43e04e75a9849072a1557b674004d8093bddb9ef

Remove the bit width of the compiler that generated the tool
from the tool signon. This was confusing and unnecessary.

Changed the iASL signon to add "disassembler" to the name.

Link: https://github.com/acpica/acpica/commit/43e04e75
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/acapps.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h
index c32bbe4..b65f273 100644
--- a/drivers/acpi/acpica/acapps.h
+++ b/drivers/acpi/acpica/acapps.h
@@ -54,23 +54,23 @@
 #define ACPICA_COPYRIGHT"Copyright (c) 2000 - 2017 Intel 
Corporation"
 
 #if ACPI_MACHINE_WIDTH == 64
-#define ACPI_WIDTH  "-64"
+#define ACPI_WIDTH  " (64-bit version)"
 
 #elif ACPI_MACHINE_WIDTH == 32
-#define ACPI_WIDTH  "-32"
+#define ACPI_WIDTH  " (32-bit version)"
 
 #else
 #error unknown ACPI_MACHINE_WIDTH
-#define ACPI_WIDTH  "-??"
+#define ACPI_WIDTH  " (unknown bit width, not 32 or 64)"
 
 #endif
 
 /* Macros for signons and file headers */
 
 #define ACPI_COMMON_SIGNON(utility_name) \
-   "\n%s\n%s version %8.8X%s\n%s\n\n", \
+   "\n%s\n%s version %8.8X\n%s\n\n", \
ACPICA_NAME, \
-   utility_name, ((u32) ACPI_CA_VERSION), ACPI_WIDTH, \
+   utility_name, ((u32) ACPI_CA_VERSION), \
ACPICA_COPYRIGHT
 
 #define ACPI_COMMON_HEADER(utility_name, prefix) \
-- 
2.7.4



[PATCH 2/4] ACPICA: Source tree: Update copyright notices to 2017

2017-02-07 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 16577e5265923f4999b4d2c0addb2343b18135e1

Affects all files.

Link: https://github.com/acpica/acpica/commit/16577e52
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/acapps.h | 4 ++--
 drivers/acpi/acpica/accommon.h   | 2 +-
 drivers/acpi/acpica/acdebug.h| 2 +-
 drivers/acpi/acpica/acdispat.h   | 2 +-
 drivers/acpi/acpica/acevents.h   | 2 +-
 drivers/acpi/acpica/acglobal.h   | 2 +-
 drivers/acpi/acpica/achware.h| 2 +-
 drivers/acpi/acpica/acinterp.h   | 2 +-
 drivers/acpi/acpica/aclocal.h| 2 +-
 drivers/acpi/acpica/acmacros.h   | 2 +-
 drivers/acpi/acpica/acnamesp.h   | 2 +-
 drivers/acpi/acpica/acobject.h   | 2 +-
 drivers/acpi/acpica/acopcode.h   | 2 +-
 drivers/acpi/acpica/acparser.h   | 2 +-
 drivers/acpi/acpica/acpredef.h   | 2 +-
 drivers/acpi/acpica/acresrc.h| 2 +-
 drivers/acpi/acpica/acstruct.h   | 2 +-
 drivers/acpi/acpica/actables.h   | 2 +-
 drivers/acpi/acpica/acutils.h| 2 +-
 drivers/acpi/acpica/amlcode.h| 2 +-
 drivers/acpi/acpica/amlresrc.h   | 2 +-
 drivers/acpi/acpica/dbcmds.c | 2 +-
 drivers/acpi/acpica/dbconvert.c  | 2 +-
 drivers/acpi/acpica/dbdisply.c   | 2 +-
 drivers/acpi/acpica/dbexec.c | 2 +-
 drivers/acpi/acpica/dbfileio.c   | 2 +-
 drivers/acpi/acpica/dbhistry.c   | 2 +-
 drivers/acpi/acpica/dbinput.c| 2 +-
 drivers/acpi/acpica/dbmethod.c   | 2 +-
 drivers/acpi/acpica/dbnames.c| 2 +-
 drivers/acpi/acpica/dbobject.c   | 2 +-
 drivers/acpi/acpica/dbstats.c| 2 +-
 drivers/acpi/acpica/dbtest.c | 2 +-
 drivers/acpi/acpica/dbutils.c| 2 +-
 drivers/acpi/acpica/dbxface.c| 2 +-
 drivers/acpi/acpica/dsargs.c | 2 +-
 drivers/acpi/acpica/dscontrol.c  | 2 +-
 drivers/acpi/acpica/dsdebug.c| 2 +-
 drivers/acpi/acpica/dsfield.c| 2 +-
 drivers/acpi/acpica/dsinit.c | 2 +-
 drivers/acpi/acpica/dsmethod.c   | 2 +-
 drivers/acpi/acpica/dsmthdat.c   | 2 +-
 drivers/acpi/acpica/dsobject.c   | 2 +-
 drivers/acpi/acpica/dsopcode.c   | 2 +-
 drivers/acpi/acpica/dsutils.c| 2 +-
 drivers/acpi/acpica/dswexec.c| 2 +-
 drivers/acpi/acpica/dswload.c| 2 +-
 drivers/acpi/acpica/dswload2.c   | 2 +-
 drivers/acpi/acpica/dswscope.c   | 2 +-
 drivers/acpi/acpica/dswstate.c   | 2 +-
 drivers/acpi/acpica/evevent.c| 2 +-
 drivers/acpi/acpica/evglock.c| 2 +-
 drivers/acpi/acpica/evgpe.c  | 2 +-
 drivers/acpi/acpica/evgpeblk.c   | 2 +-
 drivers/acpi/acpica/evgpeinit.c  | 2 +-
 drivers/acpi/acpica/evgpeutil.c  | 2 +-
 drivers/acpi/acpica/evhandler.c  | 2 +-
 drivers/acpi/acpica/evmisc.c | 2 +-
 drivers/acpi/acpica/evregion.c   | 2 +-
 drivers/acpi/acpica/evrgnini.c   | 2 +-
 drivers/acpi/acpica/evsci.c  | 2 +-
 drivers/acpi/acpica/evxface.c| 2 +-
 drivers/acpi/acpica/evxfevnt.c   | 2 +-
 drivers/acpi/acpica/evxfgpe.c| 2 +-
 drivers/acpi/acpica/evxfregn.c   | 2 +-
 drivers/acpi/acpica/exconcat.c   | 2 +-
 drivers/acpi/acpica/exconfig.c   | 2 +-
 drivers/acpi/acpica/exconvrt.c   | 2 +-
 drivers/acpi/acpica/excreate.c   | 2 +-
 drivers/acpi/acpica/exdebug.c| 2 +-
 drivers/acpi/acpica/exdump.c | 2 +-
 drivers/acpi/acpica/exfield.c| 2 +-
 drivers/acpi/acpica/exfldio.c| 2 +-
 drivers/acpi/acpica/exmisc.c   

[PATCH 0/4] ACPICA 20170119 Release

2017-02-07 Thread Lv Zheng
The 20170119 ACPICA kernel-resident subsystem updates are linuxized based
on the linux-pm/linux-next branch.

The patchset has passed the following build/boot tests.
Build tests are performed as follows:
1. i386 + allyes
2. i386 + allno
3. i386 + default + ACPI_DEBUGGER=y
4. i386 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
5. i386 + default + ACPI_DEBUG=n + ACPI=y
6. i386 + default + ACPI=n
7. x86_64 + allyes
8. x86_64 + allno
9. x86_64 + default + ACPI_DEBUGGER=y
10.x86_64 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
11.x86_64 + default + ACPI_DEBUG=n + ACPI=y
12.x86_64 + default + ACPI=n
Boot tests are performed as follows:
1. x86_64 + default + ACPI_DEBUGGER=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "Microsoft Surface Pro 3"
3. default: kernel configuration with following items enabled:
   All hardware drivers related to the machines of i386/x86_64
   All "drivers/acpi" configurations
   All "drivers/platform" drivers
   All other drivers that link the APIs provided by ACPICA subsystem

The divergences checking result:
Before applying (20161222 Release):
  369 lines
After applying (20170119 Release):
  369 lines

Bob Moore (3):
  ACPICA: Source tree: Update copyright notices to 2017
  ACPICA: Tools: Update common signon, remove compilation bit width
  ACPICA: Update version to 20170119

Lv Zheng (1):
  ACPICA: Linuxize: Restore and fix intel compiler build

 drivers/acpi/acpica/acapps.h   | 14 ++--
 drivers/acpi/acpica/accommon.h |  2 +-
 drivers/acpi/acpica/acdebug.h  |  2 +-
 drivers/acpi/acpica/acdispat.h |  2 +-
 drivers/acpi/acpica/acevents.h |  2 +-
 drivers/acpi/acpica/acglobal.h |  2 +-
 drivers/acpi/acpica/achware.h  |  2 +-
 drivers/acpi/acpica/acinterp.h |  2 +-
 drivers/acpi/acpica/aclocal.h  |  2 +-
 drivers/acpi/acpica/acmacros.h |  2 +-
 drivers/acpi/acpica/acnamesp.h |  2 +-
 drivers/acpi/acpica/acobject.h |  2 +-
 drivers/acpi/acpica/acopcode.h |  2 +-
 drivers/acpi/acpica/acparser.h |  2 +-
 drivers/acpi/acpica/acpredef.h |  2 +-
 drivers/acpi/acpica/acresrc.h  |  2 +-
 drivers/acpi/acpica/acstruct.h |  2 +-
 drivers/acpi/acpica/actables.h |  2 +-
 drivers/acpi/acpica/acutils.h  |  2 +-
 drivers/acpi/acpica/amlcode.h  |  2 +-
 drivers/acpi/acpica/amlresrc.h |  2 +-
 drivers/acpi/acpica/dbcmds.c   |  2 +-
 drivers/acpi/acpica/dbconvert.c|  2 +-
 drivers/acpi/acpica/dbdisply.c |  2 +-
 drivers/acpi/acpica/dbexec.c   |  2 +-
 drivers/acpi/acpica/dbfileio.c |  2 +-
 drivers/acpi/acpica/dbhistry.c |  2 +-
 drivers/acpi/acpica/dbinput.c  |  2 +-
 drivers/acpi/acpica/dbmethod.c |  2 +-
 drivers/acpi/acpica/dbnames.c  |  2 +-
 drivers/acpi/acpica/dbobject.c |  2 +-
 drivers/acpi/acpica/dbstats.c  |  2 +-
 drivers/acpi/acpica/dbtest.c   |  2 +-
 drivers/acpi/acpica/dbutils.c  |  2 +-
 drivers/acpi/acpica/dbxface.c  |  2 +-
 drivers/acpi/acpica/dsargs.c   |  2 +-
 drivers/acpi/acpica/dscontrol.c|  2 +-
 drivers/acpi/acpica/dsdebug.c  |  2 +-
 drivers/acpi/acpica/dsfield.c  |  2 +-
 drivers/acpi/acpica/dsinit.c   |  2 +-
 drivers/acpi/acpica/dsmethod.c |  2 +-
 drivers/acpi/acpica/dsmthdat.c |  2 +-
 drivers/acpi/acpica/dsobject.c |  2 +-
 drivers/acpi/acpica/dsopcode.c |  2 +-
 drivers/acpi/acpica/dsutils.c  |  2 +-
 drivers/acpi/acpica/dswexec.c  |  2 +-
 drivers/acpi/acpica/dswload.c  |  2 +-
 drivers/acpi/acpica/dswload2.c |  2 +-
 drivers/acpi/acpica/dswscope.c |  2 +-
 drivers/acpi/acpica/dswstate.c |  2 +-
 drivers/acpi/acpica/evevent.c  |  2 +-
 drivers/acpi/acpica/evglock.c  |  2 +-
 drivers/acpi/acpica/evgpe.c|  2 +-
 drivers/acpi/acpica/evgpeblk.c |  2 +-
 drivers/acpi/acpica/evgpeinit.c|  2 +-
 drivers/acpi/acpica/evgpeutil.c|  2 +-
 drivers/acpi/acpica/evhandler.c|  2 +-
 drivers/acpi/acpica/evmisc.c   |  2 +-
 drivers/acpi/acpica/evregion.c |  2 +-
 

[PATCH 0/4] ACPICA 20170119 Release

2017-02-07 Thread Lv Zheng
The 20170119 ACPICA kernel-resident subsystem updates are linuxized based
on the linux-pm/linux-next branch.

The patchset has passed the following build/boot tests.
Build tests are performed as follows:
1. i386 + allyes
2. i386 + allno
3. i386 + default + ACPI_DEBUGGER=y
4. i386 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
5. i386 + default + ACPI_DEBUG=n + ACPI=y
6. i386 + default + ACPI=n
7. x86_64 + allyes
8. x86_64 + allno
9. x86_64 + default + ACPI_DEBUGGER=y
10.x86_64 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
11.x86_64 + default + ACPI_DEBUG=n + ACPI=y
12.x86_64 + default + ACPI=n
Boot tests are performed as follows:
1. x86_64 + default + ACPI_DEBUGGER=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "Microsoft Surface Pro 3"
3. default: kernel configuration with following items enabled:
   All hardware drivers related to the machines of i386/x86_64
   All "drivers/acpi" configurations
   All "drivers/platform" drivers
   All other drivers that link the APIs provided by ACPICA subsystem

The divergences checking result:
Before applying (20161222 Release):
  369 lines
After applying (20170119 Release):
  369 lines

Bob Moore (3):
  ACPICA: Source tree: Update copyright notices to 2017
  ACPICA: Tools: Update common signon, remove compilation bit width
  ACPICA: Update version to 20170119

Lv Zheng (1):
  ACPICA: Linuxize: Restore and fix intel compiler build

 drivers/acpi/acpica/acapps.h   | 14 ++--
 drivers/acpi/acpica/accommon.h |  2 +-
 drivers/acpi/acpica/acdebug.h  |  2 +-
 drivers/acpi/acpica/acdispat.h |  2 +-
 drivers/acpi/acpica/acevents.h |  2 +-
 drivers/acpi/acpica/acglobal.h |  2 +-
 drivers/acpi/acpica/achware.h  |  2 +-
 drivers/acpi/acpica/acinterp.h |  2 +-
 drivers/acpi/acpica/aclocal.h  |  2 +-
 drivers/acpi/acpica/acmacros.h |  2 +-
 drivers/acpi/acpica/acnamesp.h |  2 +-
 drivers/acpi/acpica/acobject.h |  2 +-
 drivers/acpi/acpica/acopcode.h |  2 +-
 drivers/acpi/acpica/acparser.h |  2 +-
 drivers/acpi/acpica/acpredef.h |  2 +-
 drivers/acpi/acpica/acresrc.h  |  2 +-
 drivers/acpi/acpica/acstruct.h |  2 +-
 drivers/acpi/acpica/actables.h |  2 +-
 drivers/acpi/acpica/acutils.h  |  2 +-
 drivers/acpi/acpica/amlcode.h  |  2 +-
 drivers/acpi/acpica/amlresrc.h |  2 +-
 drivers/acpi/acpica/dbcmds.c   |  2 +-
 drivers/acpi/acpica/dbconvert.c|  2 +-
 drivers/acpi/acpica/dbdisply.c |  2 +-
 drivers/acpi/acpica/dbexec.c   |  2 +-
 drivers/acpi/acpica/dbfileio.c |  2 +-
 drivers/acpi/acpica/dbhistry.c |  2 +-
 drivers/acpi/acpica/dbinput.c  |  2 +-
 drivers/acpi/acpica/dbmethod.c |  2 +-
 drivers/acpi/acpica/dbnames.c  |  2 +-
 drivers/acpi/acpica/dbobject.c |  2 +-
 drivers/acpi/acpica/dbstats.c  |  2 +-
 drivers/acpi/acpica/dbtest.c   |  2 +-
 drivers/acpi/acpica/dbutils.c  |  2 +-
 drivers/acpi/acpica/dbxface.c  |  2 +-
 drivers/acpi/acpica/dsargs.c   |  2 +-
 drivers/acpi/acpica/dscontrol.c|  2 +-
 drivers/acpi/acpica/dsdebug.c  |  2 +-
 drivers/acpi/acpica/dsfield.c  |  2 +-
 drivers/acpi/acpica/dsinit.c   |  2 +-
 drivers/acpi/acpica/dsmethod.c |  2 +-
 drivers/acpi/acpica/dsmthdat.c |  2 +-
 drivers/acpi/acpica/dsobject.c |  2 +-
 drivers/acpi/acpica/dsopcode.c |  2 +-
 drivers/acpi/acpica/dsutils.c  |  2 +-
 drivers/acpi/acpica/dswexec.c  |  2 +-
 drivers/acpi/acpica/dswload.c  |  2 +-
 drivers/acpi/acpica/dswload2.c |  2 +-
 drivers/acpi/acpica/dswscope.c |  2 +-
 drivers/acpi/acpica/dswstate.c |  2 +-
 drivers/acpi/acpica/evevent.c  |  2 +-
 drivers/acpi/acpica/evglock.c  |  2 +-
 drivers/acpi/acpica/evgpe.c|  2 +-
 drivers/acpi/acpica/evgpeblk.c |  2 +-
 drivers/acpi/acpica/evgpeinit.c|  2 +-
 drivers/acpi/acpica/evgpeutil.c|  2 +-
 drivers/acpi/acpica/evhandler.c|  2 +-
 drivers/acpi/acpica/evmisc.c   |  2 +-
 drivers/acpi/acpica/evregion.c |  2 +-
 

Re: [PATCH v2 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)

Please add me into the cc list of all of the 5 patches.

Thank you.

On 2017/2/7 4:40, Mickaël Salaün wrote:

Include stddef.h to define size_t.

Signed-off-by: Mickaël Salaün 
Cc: Alexei Starovoitov 
Cc: Arnaldo Carvalho de Melo 
Cc: Daniel Borkmann 
Cc: Wang Nan 
---
  tools/lib/bpf/bpf.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index a2f9853dd882..df6e186da788 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -22,6 +22,7 @@
  #define __BPF_BPF_H
  
  #include 

+#include 
  
  int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,

   int max_entries, __u32 map_flags);





Re: [PATCH v2 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)

Please add me into the cc list of all of the 5 patches.

Thank you.

On 2017/2/7 4:40, Mickaël Salaün wrote:

Include stddef.h to define size_t.

Signed-off-by: Mickaël Salaün 
Cc: Alexei Starovoitov 
Cc: Arnaldo Carvalho de Melo 
Cc: Daniel Borkmann 
Cc: Wang Nan 
---
  tools/lib/bpf/bpf.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index a2f9853dd882..df6e186da788 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -22,6 +22,7 @@
  #define __BPF_BPF_H
  
  #include 

+#include 
  
  int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,

   int max_entries, __u32 map_flags);





Re: [PATCH 1/9] virtio_pci: remove struct virtio_pci_vq_info

2017-02-07 Thread Jason Wang



On 2017年02月07日 17:38, Christoph Hellwig wrote:

On Tue, Feb 07, 2017 at 03:17:02PM +0800, Jason Wang wrote:

The check is still there.

Meh, I could swear I fixed it up.  Here is an updated version:

---
 From bf5e3b7fd272aea32388570503f00d0ab592fc2a Mon Sep 17 00:00:00 2001
From: Christoph Hellwig 
Date: Wed, 25 Jan 2017 13:40:21 +0100
Subject: virtio_pci: remove struct virtio_pci_vq_info

We don't really need struct virtio_pci_vq_info, as most field in there
are redundant:

  - the vq backpointer is not strictly neede to start with
  - the entry in the vqs list is not needed - the generic virtqueue already
has list, we only need to check if it has a callback to get the same
semantics
  - we can use a simple array to look up the MSI-X vec if needed.
  - That simple array now also duoble serves to replace the per_vq_vectors
flag

Signed-off-by: Christoph Hellwig 


Reviewed-by: Jason Wang 


---
  drivers/virtio/virtio_pci_common.c | 117 +++--
  drivers/virtio/virtio_pci_common.h |  25 +---
  drivers/virtio/virtio_pci_legacy.c |   6 +-
  drivers/virtio/virtio_pci_modern.c |   6 +-
  4 files changed, 39 insertions(+), 115 deletions(-)

diff --git a/drivers/virtio/virtio_pci_common.c 
b/drivers/virtio/virtio_pci_common.c
index 186cbab327b8..1f9fac7dad61 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -62,16 +62,13 @@ static irqreturn_t vp_config_changed(int irq, void *opaque)
  static irqreturn_t vp_vring_interrupt(int irq, void *opaque)
  {
struct virtio_pci_device *vp_dev = opaque;
-   struct virtio_pci_vq_info *info;
irqreturn_t ret = IRQ_NONE;
-   unsigned long flags;
+   struct virtqueue *vq;
  
-	spin_lock_irqsave(_dev->lock, flags);

-   list_for_each_entry(info, _dev->virtqueues, node) {
-   if (vring_interrupt(irq, info->vq) == IRQ_HANDLED)
+   list_for_each_entry(vq, _dev->vdev.vqs, list) {
+   if (vring_interrupt(irq, vq) == IRQ_HANDLED)
ret = IRQ_HANDLED;
}
-   spin_unlock_irqrestore(_dev->lock, flags);
  
  	return ret;

  }
@@ -167,55 +164,6 @@ static int vp_request_msix_vectors(struct virtio_device 
*vdev, int nvectors,
return err;
  }
  
-static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned index,

-void (*callback)(struct virtqueue *vq),
-const char *name,
-u16 msix_vec)
-{
-   struct virtio_pci_device *vp_dev = to_vp_device(vdev);
-   struct virtio_pci_vq_info *info = kmalloc(sizeof *info, GFP_KERNEL);
-   struct virtqueue *vq;
-   unsigned long flags;
-
-   /* fill out our structure that represents an active queue */
-   if (!info)
-   return ERR_PTR(-ENOMEM);
-
-   vq = vp_dev->setup_vq(vp_dev, info, index, callback, name, msix_vec);
-   if (IS_ERR(vq))
-   goto out_info;
-
-   info->vq = vq;
-   if (callback) {
-   spin_lock_irqsave(_dev->lock, flags);
-   list_add(>node, _dev->virtqueues);
-   spin_unlock_irqrestore(_dev->lock, flags);
-   } else {
-   INIT_LIST_HEAD(>node);
-   }
-
-   vp_dev->vqs[index] = info;
-   return vq;
-
-out_info:
-   kfree(info);
-   return vq;
-}
-
-static void vp_del_vq(struct virtqueue *vq)
-{
-   struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
-   struct virtio_pci_vq_info *info = vp_dev->vqs[vq->index];
-   unsigned long flags;
-
-   spin_lock_irqsave(_dev->lock, flags);
-   list_del(>node);
-   spin_unlock_irqrestore(_dev->lock, flags);
-
-   vp_dev->del_vq(info);
-   kfree(info);
-}
-
  /* the config->del_vqs() implementation */
  void vp_del_vqs(struct virtio_device *vdev)
  {
@@ -224,16 +172,15 @@ void vp_del_vqs(struct virtio_device *vdev)
int i;
  
  	list_for_each_entry_safe(vq, n, >vqs, list) {

-   if (vp_dev->per_vq_vectors) {
-   int v = vp_dev->vqs[vq->index]->msix_vector;
+   if (vp_dev->msix_vector_map) {
+   int v = vp_dev->msix_vector_map[vq->index];
  
  			if (v != VIRTIO_MSI_NO_VECTOR)

free_irq(pci_irq_vector(vp_dev->pci_dev, v),
vq);
}
-   vp_del_vq(vq);
+   vp_dev->del_vq(vq);
}
-   vp_dev->per_vq_vectors = false;
  
  	if (vp_dev->intx_enabled) {

free_irq(vp_dev->pci_dev->irq, vp_dev);
@@ -261,8 +208,8 @@ void vp_del_vqs(struct virtio_device *vdev)
vp_dev->msix_names = NULL;
kfree(vp_dev->msix_affinity_masks);
vp_dev->msix_affinity_masks = NULL;
-   kfree(vp_dev->vqs);
-   vp_dev->vqs = NULL;
+   kfree(vp_dev->msix_vector_map);
+   

Re: [PATCH 1/9] virtio_pci: remove struct virtio_pci_vq_info

2017-02-07 Thread Jason Wang



On 2017年02月07日 17:38, Christoph Hellwig wrote:

On Tue, Feb 07, 2017 at 03:17:02PM +0800, Jason Wang wrote:

The check is still there.

Meh, I could swear I fixed it up.  Here is an updated version:

---
 From bf5e3b7fd272aea32388570503f00d0ab592fc2a Mon Sep 17 00:00:00 2001
From: Christoph Hellwig 
Date: Wed, 25 Jan 2017 13:40:21 +0100
Subject: virtio_pci: remove struct virtio_pci_vq_info

We don't really need struct virtio_pci_vq_info, as most field in there
are redundant:

  - the vq backpointer is not strictly neede to start with
  - the entry in the vqs list is not needed - the generic virtqueue already
has list, we only need to check if it has a callback to get the same
semantics
  - we can use a simple array to look up the MSI-X vec if needed.
  - That simple array now also duoble serves to replace the per_vq_vectors
flag

Signed-off-by: Christoph Hellwig 


Reviewed-by: Jason Wang 


---
  drivers/virtio/virtio_pci_common.c | 117 +++--
  drivers/virtio/virtio_pci_common.h |  25 +---
  drivers/virtio/virtio_pci_legacy.c |   6 +-
  drivers/virtio/virtio_pci_modern.c |   6 +-
  4 files changed, 39 insertions(+), 115 deletions(-)

diff --git a/drivers/virtio/virtio_pci_common.c 
b/drivers/virtio/virtio_pci_common.c
index 186cbab327b8..1f9fac7dad61 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -62,16 +62,13 @@ static irqreturn_t vp_config_changed(int irq, void *opaque)
  static irqreturn_t vp_vring_interrupt(int irq, void *opaque)
  {
struct virtio_pci_device *vp_dev = opaque;
-   struct virtio_pci_vq_info *info;
irqreturn_t ret = IRQ_NONE;
-   unsigned long flags;
+   struct virtqueue *vq;
  
-	spin_lock_irqsave(_dev->lock, flags);

-   list_for_each_entry(info, _dev->virtqueues, node) {
-   if (vring_interrupt(irq, info->vq) == IRQ_HANDLED)
+   list_for_each_entry(vq, _dev->vdev.vqs, list) {
+   if (vring_interrupt(irq, vq) == IRQ_HANDLED)
ret = IRQ_HANDLED;
}
-   spin_unlock_irqrestore(_dev->lock, flags);
  
  	return ret;

  }
@@ -167,55 +164,6 @@ static int vp_request_msix_vectors(struct virtio_device 
*vdev, int nvectors,
return err;
  }
  
-static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned index,

-void (*callback)(struct virtqueue *vq),
-const char *name,
-u16 msix_vec)
-{
-   struct virtio_pci_device *vp_dev = to_vp_device(vdev);
-   struct virtio_pci_vq_info *info = kmalloc(sizeof *info, GFP_KERNEL);
-   struct virtqueue *vq;
-   unsigned long flags;
-
-   /* fill out our structure that represents an active queue */
-   if (!info)
-   return ERR_PTR(-ENOMEM);
-
-   vq = vp_dev->setup_vq(vp_dev, info, index, callback, name, msix_vec);
-   if (IS_ERR(vq))
-   goto out_info;
-
-   info->vq = vq;
-   if (callback) {
-   spin_lock_irqsave(_dev->lock, flags);
-   list_add(>node, _dev->virtqueues);
-   spin_unlock_irqrestore(_dev->lock, flags);
-   } else {
-   INIT_LIST_HEAD(>node);
-   }
-
-   vp_dev->vqs[index] = info;
-   return vq;
-
-out_info:
-   kfree(info);
-   return vq;
-}
-
-static void vp_del_vq(struct virtqueue *vq)
-{
-   struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
-   struct virtio_pci_vq_info *info = vp_dev->vqs[vq->index];
-   unsigned long flags;
-
-   spin_lock_irqsave(_dev->lock, flags);
-   list_del(>node);
-   spin_unlock_irqrestore(_dev->lock, flags);
-
-   vp_dev->del_vq(info);
-   kfree(info);
-}
-
  /* the config->del_vqs() implementation */
  void vp_del_vqs(struct virtio_device *vdev)
  {
@@ -224,16 +172,15 @@ void vp_del_vqs(struct virtio_device *vdev)
int i;
  
  	list_for_each_entry_safe(vq, n, >vqs, list) {

-   if (vp_dev->per_vq_vectors) {
-   int v = vp_dev->vqs[vq->index]->msix_vector;
+   if (vp_dev->msix_vector_map) {
+   int v = vp_dev->msix_vector_map[vq->index];
  
  			if (v != VIRTIO_MSI_NO_VECTOR)

free_irq(pci_irq_vector(vp_dev->pci_dev, v),
vq);
}
-   vp_del_vq(vq);
+   vp_dev->del_vq(vq);
}
-   vp_dev->per_vq_vectors = false;
  
  	if (vp_dev->intx_enabled) {

free_irq(vp_dev->pci_dev->irq, vp_dev);
@@ -261,8 +208,8 @@ void vp_del_vqs(struct virtio_device *vdev)
vp_dev->msix_names = NULL;
kfree(vp_dev->msix_affinity_masks);
vp_dev->msix_affinity_masks = NULL;
-   kfree(vp_dev->vqs);
-   vp_dev->vqs = NULL;
+   kfree(vp_dev->msix_vector_map);
+   vp_dev->msix_vector_map = NULL;
  }
  
  static int 

Re: [PATCH v3 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)



On 2017/2/8 4:56, Mickaël Salaün wrote:

Include stddef.h to define size_t.

Signed-off-by: Mickaël Salaün 
Cc: Alexei Starovoitov 
Cc: Arnaldo Carvalho de Melo 
Cc: Daniel Borkmann 
Cc: Wang Nan 
---
  tools/lib/bpf/bpf.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index a2f9853dd882..df6e186da788 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -22,6 +22,7 @@
  #define __BPF_BPF_H
  
  #include 

+#include 
  
  int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,

   int max_entries, __u32 map_flags);

Looks good to me.

Thank you.



Re: [PATCH v3 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)



On 2017/2/8 4:56, Mickaël Salaün wrote:

Include stddef.h to define size_t.

Signed-off-by: Mickaël Salaün 
Cc: Alexei Starovoitov 
Cc: Arnaldo Carvalho de Melo 
Cc: Daniel Borkmann 
Cc: Wang Nan 
---
  tools/lib/bpf/bpf.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index a2f9853dd882..df6e186da788 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -22,6 +22,7 @@
  #define __BPF_BPF_H
  
  #include 

+#include 
  
  int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,

   int max_entries, __u32 map_flags);

Looks good to me.

Thank you.



Re: [PATCH v2 1/4] Documentation: devicetree: Add document bindings for leds-mt6323

2017-02-07 Thread Andrew Lunn
> + led0: isink0 {
> + lebel = "LED0"

label, not lebel.

   Andrew


Re: v4.9, 4.4-final: 28 bioset threads on small notebook, 36 threads on cellphone

2017-02-07 Thread Ming Lei
On Tue, Feb 7, 2017 at 10:49 AM, Kent Overstreet
 wrote:
> On Mon, Feb 06, 2017 at 04:47:24PM -0900, Kent Overstreet wrote:
>> On Mon, Feb 06, 2017 at 01:53:09PM +0100, Pavel Machek wrote:
>> > Still there on v4.9, 36 threads on nokia n900 cellphone.
>> >
>> > So.. what needs to be done there?
>
>> But, I just got an idea for how to handle this that might be halfway sane, 
>> maybe
>> I'll try and come up with a patch...
>
> Ok, here's such a patch, only lightly tested:
>
> -- >8 --
> Subject: [PATCH] block: Make rescuer threads per request_queue, not per bioset
>
> Note: this patch is very lightly tested.
>
> Also, trigger rescuing whenever with bios on current->bio_list, instead
> of only when we block in bio_alloc_bioset(). This is more correct, and
> should result in fewer rescuer threads.

Looks the rescuer stuff gets simplified much with this patch.

>
> XXX: The current->bio_list plugging needs to be unified with the
> blk_plug mechanism.

Yeah, that can be another benefit, :-)

>
> TODO: If we change normal request_queue drivers to handle arbitrary size
> bios by processing requests incrementally, instead of splitting bios,
> then we can get rid of rescuer threads from those devices.

Also the rescue threads are often from some reserved block devices, such as
loop/nbd, and we should have allowed these drivers to delay allocating
the thread
just before the disk is activated. Then the thread number can get descreased
a lot.

> ---
>  block/bio.c| 107 
> -
>  block/blk-core.c   |  58 ---
>  block/blk-sysfs.c  |   2 +
>  include/linux/bio.h|  16 
>  include/linux/blkdev.h |  10 +
>  include/linux/sched.h  |   2 +-
>  kernel/sched/core.c|   4 ++
>  7 files changed, 83 insertions(+), 116 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index f3b5786202..9ad54a9b12 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -336,54 +336,6 @@ void bio_chain(struct bio *bio, struct bio *parent)
>  }
>  EXPORT_SYMBOL(bio_chain);
>
> -static void bio_alloc_rescue(struct work_struct *work)
> -{
> -   struct bio_set *bs = container_of(work, struct bio_set, rescue_work);
> -   struct bio *bio;
> -
> -   while (1) {
> -   spin_lock(>rescue_lock);
> -   bio = bio_list_pop(>rescue_list);
> -   spin_unlock(>rescue_lock);
> -
> -   if (!bio)
> -   break;
> -
> -   generic_make_request(bio);
> -   }
> -}
> -
> -static void punt_bios_to_rescuer(struct bio_set *bs)
> -{
> -   struct bio_list punt, nopunt;
> -   struct bio *bio;
> -
> -   /*
> -* In order to guarantee forward progress we must punt only bios that
> -* were allocated from this bio_set; otherwise, if there was a bio on
> -* there for a stacking driver higher up in the stack, processing it
> -* could require allocating bios from this bio_set, and doing that 
> from
> -* our own rescuer would be bad.
> -*
> -* Since bio lists are singly linked, pop them all instead of trying 
> to
> -* remove from the middle of the list:
> -*/
> -
> -   bio_list_init();
> -   bio_list_init();
> -
> -   while ((bio = bio_list_pop(current->bio_list)))
> -   bio_list_add(bio->bi_pool == bs ?  : , bio);
> -
> -   *current->bio_list = nopunt;
> -
> -   spin_lock(>rescue_lock);
> -   bio_list_merge(>rescue_list, );
> -   spin_unlock(>rescue_lock);
> -
> -   queue_work(bs->rescue_workqueue, >rescue_work);
> -}
> -
>  /**
>   * bio_alloc_bioset - allocate a bio for I/O
>   * @gfp_mask:   the GFP_ mask given to the slab allocator
> @@ -421,54 +373,27 @@ static void punt_bios_to_rescuer(struct bio_set *bs)
>   */
>  struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set 
> *bs)
>  {
> -   gfp_t saved_gfp = gfp_mask;
> unsigned front_pad;
> unsigned inline_vecs;
> struct bio_vec *bvl = NULL;
> struct bio *bio;
> void *p;
>
> -   if (!bs) {
> -   if (nr_iovecs > UIO_MAXIOV)
> -   return NULL;
> +   WARN(current->bio_list &&
> +!current->bio_list->q->rescue_workqueue,
> +"allocating bio beneath generic_make_request() without rescuer");
>
> +   if (nr_iovecs > UIO_MAXIOV)
> +   return NULL;
> +
> +   if (!bs) {
> p = kmalloc(sizeof(struct bio) +
> nr_iovecs * sizeof(struct bio_vec),
> gfp_mask);
> front_pad = 0;
> inline_vecs = nr_iovecs;
> } else {
> -   /*
> -* generic_make_request() converts recursion to iteration; 
> this
> -* means if we're running beneath it, any bios we allocate and
> -* submit will not be 

Re: [PATCH v2 1/4] Documentation: devicetree: Add document bindings for leds-mt6323

2017-02-07 Thread Andrew Lunn
> + led0: isink0 {
> + lebel = "LED0"

label, not lebel.

   Andrew


Re: v4.9, 4.4-final: 28 bioset threads on small notebook, 36 threads on cellphone

2017-02-07 Thread Ming Lei
On Tue, Feb 7, 2017 at 10:49 AM, Kent Overstreet
 wrote:
> On Mon, Feb 06, 2017 at 04:47:24PM -0900, Kent Overstreet wrote:
>> On Mon, Feb 06, 2017 at 01:53:09PM +0100, Pavel Machek wrote:
>> > Still there on v4.9, 36 threads on nokia n900 cellphone.
>> >
>> > So.. what needs to be done there?
>
>> But, I just got an idea for how to handle this that might be halfway sane, 
>> maybe
>> I'll try and come up with a patch...
>
> Ok, here's such a patch, only lightly tested:
>
> -- >8 --
> Subject: [PATCH] block: Make rescuer threads per request_queue, not per bioset
>
> Note: this patch is very lightly tested.
>
> Also, trigger rescuing whenever with bios on current->bio_list, instead
> of only when we block in bio_alloc_bioset(). This is more correct, and
> should result in fewer rescuer threads.

Looks the rescuer stuff gets simplified much with this patch.

>
> XXX: The current->bio_list plugging needs to be unified with the
> blk_plug mechanism.

Yeah, that can be another benefit, :-)

>
> TODO: If we change normal request_queue drivers to handle arbitrary size
> bios by processing requests incrementally, instead of splitting bios,
> then we can get rid of rescuer threads from those devices.

Also the rescue threads are often from some reserved block devices, such as
loop/nbd, and we should have allowed these drivers to delay allocating
the thread
just before the disk is activated. Then the thread number can get descreased
a lot.

> ---
>  block/bio.c| 107 
> -
>  block/blk-core.c   |  58 ---
>  block/blk-sysfs.c  |   2 +
>  include/linux/bio.h|  16 
>  include/linux/blkdev.h |  10 +
>  include/linux/sched.h  |   2 +-
>  kernel/sched/core.c|   4 ++
>  7 files changed, 83 insertions(+), 116 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index f3b5786202..9ad54a9b12 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -336,54 +336,6 @@ void bio_chain(struct bio *bio, struct bio *parent)
>  }
>  EXPORT_SYMBOL(bio_chain);
>
> -static void bio_alloc_rescue(struct work_struct *work)
> -{
> -   struct bio_set *bs = container_of(work, struct bio_set, rescue_work);
> -   struct bio *bio;
> -
> -   while (1) {
> -   spin_lock(>rescue_lock);
> -   bio = bio_list_pop(>rescue_list);
> -   spin_unlock(>rescue_lock);
> -
> -   if (!bio)
> -   break;
> -
> -   generic_make_request(bio);
> -   }
> -}
> -
> -static void punt_bios_to_rescuer(struct bio_set *bs)
> -{
> -   struct bio_list punt, nopunt;
> -   struct bio *bio;
> -
> -   /*
> -* In order to guarantee forward progress we must punt only bios that
> -* were allocated from this bio_set; otherwise, if there was a bio on
> -* there for a stacking driver higher up in the stack, processing it
> -* could require allocating bios from this bio_set, and doing that 
> from
> -* our own rescuer would be bad.
> -*
> -* Since bio lists are singly linked, pop them all instead of trying 
> to
> -* remove from the middle of the list:
> -*/
> -
> -   bio_list_init();
> -   bio_list_init();
> -
> -   while ((bio = bio_list_pop(current->bio_list)))
> -   bio_list_add(bio->bi_pool == bs ?  : , bio);
> -
> -   *current->bio_list = nopunt;
> -
> -   spin_lock(>rescue_lock);
> -   bio_list_merge(>rescue_list, );
> -   spin_unlock(>rescue_lock);
> -
> -   queue_work(bs->rescue_workqueue, >rescue_work);
> -}
> -
>  /**
>   * bio_alloc_bioset - allocate a bio for I/O
>   * @gfp_mask:   the GFP_ mask given to the slab allocator
> @@ -421,54 +373,27 @@ static void punt_bios_to_rescuer(struct bio_set *bs)
>   */
>  struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set 
> *bs)
>  {
> -   gfp_t saved_gfp = gfp_mask;
> unsigned front_pad;
> unsigned inline_vecs;
> struct bio_vec *bvl = NULL;
> struct bio *bio;
> void *p;
>
> -   if (!bs) {
> -   if (nr_iovecs > UIO_MAXIOV)
> -   return NULL;
> +   WARN(current->bio_list &&
> +!current->bio_list->q->rescue_workqueue,
> +"allocating bio beneath generic_make_request() without rescuer");
>
> +   if (nr_iovecs > UIO_MAXIOV)
> +   return NULL;
> +
> +   if (!bs) {
> p = kmalloc(sizeof(struct bio) +
> nr_iovecs * sizeof(struct bio_vec),
> gfp_mask);
> front_pad = 0;
> inline_vecs = nr_iovecs;
> } else {
> -   /*
> -* generic_make_request() converts recursion to iteration; 
> this
> -* means if we're running beneath it, any bios we allocate and
> -* submit will not be submitted (and thus freed) 

Re: [PATCH v3 2/5] bpf: Simplify bpf_load_program() error handling in the library

2017-02-07 Thread Wangnan (F)



On 2017/2/8 4:56, Mickaël Salaün wrote:

Do not call a second time bpf(2) when a program load failed.


BPF_PROG_LOAD should success most of the time. Setting log_level to
0 by default and require log buffer when failure can make it faster
in normal case.

Thank you.


Signed-off-by: Mickaël Salaün 
Cc: Alexei Starovoitov 
Cc: Arnaldo Carvalho de Melo 
Cc: Daniel Borkmann 
Cc: Wang Nan 
---
  tools/lib/bpf/bpf.c | 18 ++
  1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 3ddb58a36d3c..fda3f494f1cd 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -73,7 +73,6 @@ int bpf_load_program(enum bpf_prog_type type, struct bpf_insn 
*insns,
 size_t insns_cnt, char *license,
 __u32 kern_version, char *log_buf, size_t log_buf_sz)
  {
-   int fd;
union bpf_attr attr;
  
  	bzero(, sizeof(attr));

@@ -81,20 +80,15 @@ int bpf_load_program(enum bpf_prog_type type, struct 
bpf_insn *insns,
attr.insn_cnt = (__u32)insns_cnt;
attr.insns = ptr_to_u64(insns);
attr.license = ptr_to_u64(license);
-   attr.log_buf = ptr_to_u64(NULL);
-   attr.log_size = 0;
-   attr.log_level = 0;
+   attr.log_buf = ptr_to_u64(log_buf);
+   attr.log_size = log_buf_sz;
attr.kern_version = kern_version;
  
-	fd = sys_bpf(BPF_PROG_LOAD, , sizeof(attr));

-   if (fd >= 0 || !log_buf || !log_buf_sz)
-   return fd;
+   if (log_buf && log_buf_sz > 0) {
+   attr.log_level = 1;
+   log_buf[0] = 0;
+   }
  
-	/* Try again with log */

-   attr.log_buf = ptr_to_u64(log_buf);
-   attr.log_size = log_buf_sz;
-   attr.log_level = 1;
-   log_buf[0] = 0;
return sys_bpf(BPF_PROG_LOAD, , sizeof(attr));
  }
  





Re: [PATCH v3 2/5] bpf: Simplify bpf_load_program() error handling in the library

2017-02-07 Thread Wangnan (F)



On 2017/2/8 4:56, Mickaël Salaün wrote:

Do not call a second time bpf(2) when a program load failed.


BPF_PROG_LOAD should success most of the time. Setting log_level to
0 by default and require log buffer when failure can make it faster
in normal case.

Thank you.


Signed-off-by: Mickaël Salaün 
Cc: Alexei Starovoitov 
Cc: Arnaldo Carvalho de Melo 
Cc: Daniel Borkmann 
Cc: Wang Nan 
---
  tools/lib/bpf/bpf.c | 18 ++
  1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 3ddb58a36d3c..fda3f494f1cd 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -73,7 +73,6 @@ int bpf_load_program(enum bpf_prog_type type, struct bpf_insn 
*insns,
 size_t insns_cnt, char *license,
 __u32 kern_version, char *log_buf, size_t log_buf_sz)
  {
-   int fd;
union bpf_attr attr;
  
  	bzero(, sizeof(attr));

@@ -81,20 +80,15 @@ int bpf_load_program(enum bpf_prog_type type, struct 
bpf_insn *insns,
attr.insn_cnt = (__u32)insns_cnt;
attr.insns = ptr_to_u64(insns);
attr.license = ptr_to_u64(license);
-   attr.log_buf = ptr_to_u64(NULL);
-   attr.log_size = 0;
-   attr.log_level = 0;
+   attr.log_buf = ptr_to_u64(log_buf);
+   attr.log_size = log_buf_sz;
attr.kern_version = kern_version;
  
-	fd = sys_bpf(BPF_PROG_LOAD, , sizeof(attr));

-   if (fd >= 0 || !log_buf || !log_buf_sz)
-   return fd;
+   if (log_buf && log_buf_sz > 0) {
+   attr.log_level = 1;
+   log_buf[0] = 0;
+   }
  
-	/* Try again with log */

-   attr.log_buf = ptr_to_u64(log_buf);
-   attr.log_size = log_buf_sz;
-   attr.log_level = 1;
-   log_buf[0] = 0;
return sys_bpf(BPF_PROG_LOAD, , sizeof(attr));
  }
  





[PATCH v6 3/6] drm/rockchip/dsi: dw-mipi: correct the coding style

2017-02-07 Thread Chris Zhong
correct the coding style, according the checkpatch scripts

Signed-off-by: Chris Zhong 
Reviewed-by: Sean Paul 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 8f60b89..6795190 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -157,7 +157,6 @@
 #define LPRX_TO_CNT(p) ((p) & 0x)
 
 #define DSI_BTA_TO_CNT 0x8c
-
 #define DSI_LPCLK_CTRL 0x94
 #define AUTO_CLKLANE_CTRL  BIT(1)
 #define PHY_TXREQUESTCLKHS BIT(0)
@@ -223,11 +222,11 @@
 
 #define HSFREQRANGE_SEL(val)   (((val) & 0x3f) << 1)
 
-#define INPUT_DIVIDER(val) ((val - 1) & 0x7f)
+#define INPUT_DIVIDER(val) (((val) - 1) & 0x7f)
 #define LOW_PROGRAM_EN 0
 #define HIGH_PROGRAM_ENBIT(7)
-#define LOOP_DIV_LOW_SEL(val)  ((val - 1) & 0x1f)
-#define LOOP_DIV_HIGH_SEL(val) (((val - 1) >> 5) & 0x1f)
+#define LOOP_DIV_LOW_SEL(val)  (((val) - 1) & 0x1f)
+#define LOOP_DIV_HIGH_SEL(val) val) - 1) >> 5) & 0x1f)
 #define PLL_LOOP_DIV_ENBIT(5)
 #define PLL_INPUT_DIV_EN   BIT(4)
 
@@ -369,6 +368,7 @@ static inline struct dw_mipi_dsi *encoder_to_dsi(struct 
drm_encoder *encoder)
 {
return container_of(encoder, struct dw_mipi_dsi, encoder);
 }
+
 static inline void dsi_write(struct dw_mipi_dsi *dsi, u32 reg, u32 val)
 {
writel(val, dsi->base + reg);
@@ -380,7 +380,7 @@ static inline u32 dsi_read(struct dw_mipi_dsi *dsi, u32 reg)
 }
 
 static void dw_mipi_dsi_phy_write(struct dw_mipi_dsi *dsi, u8 test_code,
-u8 test_data)
+ u8 test_data)
 {
/*
 * With the falling edge on TESTCLK, the TESTDIN[7:0] signal content
@@ -496,7 +496,6 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
dsi_write(dsi, DSI_PHY_RSTZ, PHY_ENFORCEPLL | PHY_ENABLECLK |
 PHY_UNRSTZ | PHY_UNSHUTDOWNZ);
 
-
ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS,
 val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US);
if (ret < 0) {
@@ -571,7 +570,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host 
*host,
 
if (device->lanes > dsi->pdata->max_data_lanes) {
dev_err(dsi->dev, "the number of data lanes(%u) is too many\n",
-   device->lanes);
+   device->lanes);
return -EINVAL;
}
 
@@ -1060,14 +1059,14 @@ dw_mipi_dsi_encoder_atomic_check(struct drm_encoder 
*encoder,
return 0;
 }
 
-static struct drm_encoder_helper_funcs
+static const struct drm_encoder_helper_funcs
 dw_mipi_dsi_encoder_helper_funcs = {
.enable = dw_mipi_dsi_encoder_enable,
.disable = dw_mipi_dsi_encoder_disable,
.atomic_check = dw_mipi_dsi_encoder_atomic_check,
 };
 
-static struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = {
+static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };
 
@@ -1103,7 +1102,7 @@ static void dw_mipi_dsi_drm_connector_destroy(struct 
drm_connector *connector)
drm_connector_cleanup(connector);
 }
 
-static struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = {
+static const struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = dw_mipi_dsi_drm_connector_destroy,
@@ -1113,7 +1112,7 @@ static struct drm_connector_funcs 
dw_mipi_dsi_atomic_connector_funcs = {
 };
 
 static int dw_mipi_dsi_register(struct drm_device *drm,
- struct dw_mipi_dsi *dsi)
+   struct dw_mipi_dsi *dsi)
 {
struct drm_encoder *encoder = >encoder;
struct drm_connector *connector = >connector;
@@ -1134,14 +1133,14 @@ static int dw_mipi_dsi_register(struct drm_device *drm,
drm_encoder_helper_add(>encoder,
   _mipi_dsi_encoder_helper_funcs);
ret = drm_encoder_init(drm, >encoder, _mipi_dsi_encoder_funcs,
-DRM_MODE_ENCODER_DSI, NULL);
+  DRM_MODE_ENCODER_DSI, NULL);
if (ret) {
dev_err(dev, "Failed to initialize encoder with drm\n");
return ret;
}
 
drm_connector_helper_add(connector,
-   _mipi_dsi_connector_helper_funcs);
+_mipi_dsi_connector_helper_funcs);
 
drm_connector_init(drm, >connector,
   _mipi_dsi_atomic_connector_funcs,

[PATCH v6 3/6] drm/rockchip/dsi: dw-mipi: correct the coding style

2017-02-07 Thread Chris Zhong
correct the coding style, according the checkpatch scripts

Signed-off-by: Chris Zhong 
Reviewed-by: Sean Paul 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 8f60b89..6795190 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -157,7 +157,6 @@
 #define LPRX_TO_CNT(p) ((p) & 0x)
 
 #define DSI_BTA_TO_CNT 0x8c
-
 #define DSI_LPCLK_CTRL 0x94
 #define AUTO_CLKLANE_CTRL  BIT(1)
 #define PHY_TXREQUESTCLKHS BIT(0)
@@ -223,11 +222,11 @@
 
 #define HSFREQRANGE_SEL(val)   (((val) & 0x3f) << 1)
 
-#define INPUT_DIVIDER(val) ((val - 1) & 0x7f)
+#define INPUT_DIVIDER(val) (((val) - 1) & 0x7f)
 #define LOW_PROGRAM_EN 0
 #define HIGH_PROGRAM_ENBIT(7)
-#define LOOP_DIV_LOW_SEL(val)  ((val - 1) & 0x1f)
-#define LOOP_DIV_HIGH_SEL(val) (((val - 1) >> 5) & 0x1f)
+#define LOOP_DIV_LOW_SEL(val)  (((val) - 1) & 0x1f)
+#define LOOP_DIV_HIGH_SEL(val) val) - 1) >> 5) & 0x1f)
 #define PLL_LOOP_DIV_ENBIT(5)
 #define PLL_INPUT_DIV_EN   BIT(4)
 
@@ -369,6 +368,7 @@ static inline struct dw_mipi_dsi *encoder_to_dsi(struct 
drm_encoder *encoder)
 {
return container_of(encoder, struct dw_mipi_dsi, encoder);
 }
+
 static inline void dsi_write(struct dw_mipi_dsi *dsi, u32 reg, u32 val)
 {
writel(val, dsi->base + reg);
@@ -380,7 +380,7 @@ static inline u32 dsi_read(struct dw_mipi_dsi *dsi, u32 reg)
 }
 
 static void dw_mipi_dsi_phy_write(struct dw_mipi_dsi *dsi, u8 test_code,
-u8 test_data)
+ u8 test_data)
 {
/*
 * With the falling edge on TESTCLK, the TESTDIN[7:0] signal content
@@ -496,7 +496,6 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
dsi_write(dsi, DSI_PHY_RSTZ, PHY_ENFORCEPLL | PHY_ENABLECLK |
 PHY_UNRSTZ | PHY_UNSHUTDOWNZ);
 
-
ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS,
 val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US);
if (ret < 0) {
@@ -571,7 +570,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host 
*host,
 
if (device->lanes > dsi->pdata->max_data_lanes) {
dev_err(dsi->dev, "the number of data lanes(%u) is too many\n",
-   device->lanes);
+   device->lanes);
return -EINVAL;
}
 
@@ -1060,14 +1059,14 @@ dw_mipi_dsi_encoder_atomic_check(struct drm_encoder 
*encoder,
return 0;
 }
 
-static struct drm_encoder_helper_funcs
+static const struct drm_encoder_helper_funcs
 dw_mipi_dsi_encoder_helper_funcs = {
.enable = dw_mipi_dsi_encoder_enable,
.disable = dw_mipi_dsi_encoder_disable,
.atomic_check = dw_mipi_dsi_encoder_atomic_check,
 };
 
-static struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = {
+static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };
 
@@ -1103,7 +1102,7 @@ static void dw_mipi_dsi_drm_connector_destroy(struct 
drm_connector *connector)
drm_connector_cleanup(connector);
 }
 
-static struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = {
+static const struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = dw_mipi_dsi_drm_connector_destroy,
@@ -1113,7 +1112,7 @@ static struct drm_connector_funcs 
dw_mipi_dsi_atomic_connector_funcs = {
 };
 
 static int dw_mipi_dsi_register(struct drm_device *drm,
- struct dw_mipi_dsi *dsi)
+   struct dw_mipi_dsi *dsi)
 {
struct drm_encoder *encoder = >encoder;
struct drm_connector *connector = >connector;
@@ -1134,14 +1133,14 @@ static int dw_mipi_dsi_register(struct drm_device *drm,
drm_encoder_helper_add(>encoder,
   _mipi_dsi_encoder_helper_funcs);
ret = drm_encoder_init(drm, >encoder, _mipi_dsi_encoder_funcs,
-DRM_MODE_ENCODER_DSI, NULL);
+  DRM_MODE_ENCODER_DSI, NULL);
if (ret) {
dev_err(dev, "Failed to initialize encoder with drm\n");
return ret;
}
 
drm_connector_helper_add(connector,
-   _mipi_dsi_connector_helper_funcs);
+_mipi_dsi_connector_helper_funcs);
 
drm_connector_init(drm, >connector,
   _mipi_dsi_atomic_connector_funcs,
@@ -1216,7 +1215,7 @@ static const struct 

[PATCH v6 5/6] dt-bindings: add power domain node for dw-mipi-rockchip

2017-02-07 Thread Chris Zhong
Signed-off-by: Chris Zhong 
Acked-by: Rob Herring 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt  | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
index 0f82568..188f6f7 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
@@ -15,6 +15,9 @@ Required properties:
 - ports: contain a port node with endpoint definitions as defined in [2].
   For vopb,set the reg = <0> and set the reg = <1> for vopl.
 
+Optional properties:
+- power-domains: a phandle to mipi dsi power domain node.
+
 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
 [2] Documentation/devicetree/bindings/media/video-interfaces.txt
 
-- 
2.6.3



[PATCH v6 6/6] drm/rockchip/dsi: add dw-mipi power domain support

2017-02-07 Thread Chris Zhong
Reference the power domain incase dw-mipi power down when
in use.

Signed-off-by: Chris Zhong 
Reviewed-by: Sean Paul 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index a2b4ec4..2ee2317 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -293,6 +294,7 @@ struct dw_mipi_dsi {
struct clk *pclk;
struct clk *phy_cfg_clk;
 
+   int dpms_mode;
unsigned int lane_mbps; /* per lane */
u32 channel;
u32 lanes;
@@ -960,6 +962,9 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
 {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
 
+   if (dsi->dpms_mode != DRM_MODE_DPMS_ON)
+   return;
+
if (clk_prepare_enable(dsi->pclk)) {
dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
return;
@@ -971,7 +976,9 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
drm_panel_unprepare(dsi->panel);
 
dw_mipi_dsi_disable(dsi);
+   pm_runtime_put(dsi->dev);
clk_disable_unprepare(dsi->pclk);
+   dsi->dpms_mode = DRM_MODE_DPMS_OFF;
 }
 
 static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder)
@@ -987,11 +994,15 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
if (ret < 0)
return;
 
+   if (dsi->dpms_mode == DRM_MODE_DPMS_ON)
+   return;
+
if (clk_prepare_enable(dsi->pclk)) {
dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
return;
}
 
+   pm_runtime_get_sync(dsi->dev);
dw_mipi_dsi_init(dsi);
dw_mipi_dsi_dpi_config(dsi, mode);
dw_mipi_dsi_packet_handler_config(dsi);
@@ -1027,6 +1038,7 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
 
regmap_write(dsi->grf_regmap, pdata->grf_switch_reg, val);
dev_dbg(dsi->dev, "vop %s output to dsi0\n", (mux) ? "LIT" : "BIG");
+   dsi->dpms_mode = DRM_MODE_DPMS_ON;
 }
 
 static int
@@ -1194,6 +1206,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 
dsi->dev = dev;
dsi->pdata = pdata;
+   dsi->dpms_mode = DRM_MODE_DPMS_OFF;
 
ret = rockchip_mipi_parse_dt(dsi);
if (ret)
@@ -1274,6 +1287,8 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 
dev_set_drvdata(dev, dsi);
 
+   pm_runtime_enable(dev);
+
dsi->dsi_host.ops = _mipi_dsi_host_ops;
dsi->dsi_host.dev = dev;
ret = mipi_dsi_host_register(>dsi_host);
@@ -1296,6 +1311,7 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct 
device *master,
struct dw_mipi_dsi *dsi = dev_get_drvdata(dev);
 
mipi_dsi_host_unregister(>dsi_host);
+   pm_runtime_disable(dev);
clk_disable_unprepare(dsi->pllref_clk);
 }
 
-- 
2.6.3



[PATCH v6 5/6] dt-bindings: add power domain node for dw-mipi-rockchip

2017-02-07 Thread Chris Zhong
Signed-off-by: Chris Zhong 
Acked-by: Rob Herring 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt  | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
index 0f82568..188f6f7 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
@@ -15,6 +15,9 @@ Required properties:
 - ports: contain a port node with endpoint definitions as defined in [2].
   For vopb,set the reg = <0> and set the reg = <1> for vopl.
 
+Optional properties:
+- power-domains: a phandle to mipi dsi power domain node.
+
 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
 [2] Documentation/devicetree/bindings/media/video-interfaces.txt
 
-- 
2.6.3



[PATCH v6 6/6] drm/rockchip/dsi: add dw-mipi power domain support

2017-02-07 Thread Chris Zhong
Reference the power domain incase dw-mipi power down when
in use.

Signed-off-by: Chris Zhong 
Reviewed-by: Sean Paul 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index a2b4ec4..2ee2317 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -293,6 +294,7 @@ struct dw_mipi_dsi {
struct clk *pclk;
struct clk *phy_cfg_clk;
 
+   int dpms_mode;
unsigned int lane_mbps; /* per lane */
u32 channel;
u32 lanes;
@@ -960,6 +962,9 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
 {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
 
+   if (dsi->dpms_mode != DRM_MODE_DPMS_ON)
+   return;
+
if (clk_prepare_enable(dsi->pclk)) {
dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
return;
@@ -971,7 +976,9 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
drm_panel_unprepare(dsi->panel);
 
dw_mipi_dsi_disable(dsi);
+   pm_runtime_put(dsi->dev);
clk_disable_unprepare(dsi->pclk);
+   dsi->dpms_mode = DRM_MODE_DPMS_OFF;
 }
 
 static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder)
@@ -987,11 +994,15 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
if (ret < 0)
return;
 
+   if (dsi->dpms_mode == DRM_MODE_DPMS_ON)
+   return;
+
if (clk_prepare_enable(dsi->pclk)) {
dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
return;
}
 
+   pm_runtime_get_sync(dsi->dev);
dw_mipi_dsi_init(dsi);
dw_mipi_dsi_dpi_config(dsi, mode);
dw_mipi_dsi_packet_handler_config(dsi);
@@ -1027,6 +1038,7 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
 
regmap_write(dsi->grf_regmap, pdata->grf_switch_reg, val);
dev_dbg(dsi->dev, "vop %s output to dsi0\n", (mux) ? "LIT" : "BIG");
+   dsi->dpms_mode = DRM_MODE_DPMS_ON;
 }
 
 static int
@@ -1194,6 +1206,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 
dsi->dev = dev;
dsi->pdata = pdata;
+   dsi->dpms_mode = DRM_MODE_DPMS_OFF;
 
ret = rockchip_mipi_parse_dt(dsi);
if (ret)
@@ -1274,6 +1287,8 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 
dev_set_drvdata(dev, dsi);
 
+   pm_runtime_enable(dev);
+
dsi->dsi_host.ops = _mipi_dsi_host_ops;
dsi->dsi_host.dev = dev;
ret = mipi_dsi_host_register(>dsi_host);
@@ -1296,6 +1311,7 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct 
device *master,
struct dw_mipi_dsi *dsi = dev_get_drvdata(dev);
 
mipi_dsi_host_unregister(>dsi_host);
+   pm_runtime_disable(dev);
clk_disable_unprepare(dsi->pllref_clk);
 }
 
-- 
2.6.3



[PATCH v6 1/6] dt-bindings: add rk3399 support for dw-mipi-rockchip

2017-02-07 Thread Chris Zhong
The dw-mipi-dsi of rk3399 is almost the same as rk3288, the rk3399 has
additional phy config clock.

Signed-off-by: Chris Zhong 
Acked-by: Rob Herring 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
index 1753f0c..0f82568 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
@@ -5,10 +5,12 @@ Required properties:
 - #address-cells: Should be <1>.
 - #size-cells: Should be <0>.
 - compatible: "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi".
+ "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi".
 - reg: Represent the physical address range of the controller.
 - interrupts: Represent the controller's interrupt to the CPU(s).
 - clocks, clock-names: Phandles to the controller's pll reference
-  clock(ref) and APB clock(pclk), as described in [1].
+  clock(ref) and APB clock(pclk). For RK3399, a phy config clock
+  (phy_cfg) is additional required. As described in [1].
 - rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
 - ports: contain a port node with endpoint definitions as defined in [2].
   For vopb,set the reg = <0> and set the reg = <1> for vopl.
-- 
2.6.3



[PATCH v6 1/6] dt-bindings: add rk3399 support for dw-mipi-rockchip

2017-02-07 Thread Chris Zhong
The dw-mipi-dsi of rk3399 is almost the same as rk3288, the rk3399 has
additional phy config clock.

Signed-off-by: Chris Zhong 
Acked-by: Rob Herring 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
index 1753f0c..0f82568 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
@@ -5,10 +5,12 @@ Required properties:
 - #address-cells: Should be <1>.
 - #size-cells: Should be <0>.
 - compatible: "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi".
+ "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi".
 - reg: Represent the physical address range of the controller.
 - interrupts: Represent the controller's interrupt to the CPU(s).
 - clocks, clock-names: Phandles to the controller's pll reference
-  clock(ref) and APB clock(pclk), as described in [1].
+  clock(ref) and APB clock(pclk). For RK3399, a phy config clock
+  (phy_cfg) is additional required. As described in [1].
 - rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
 - ports: contain a port node with endpoint definitions as defined in [2].
   For vopb,set the reg = <0> and set the reg = <1> for vopl.
-- 
2.6.3



[PATCH v6 2/6] drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi

2017-02-07 Thread Chris Zhong
The vopb/vopl switch register of RK3399 mipi is different from RK3288,
the default setting for mipi dsi mode is different too, so add a
of_device_id structure to distinguish them, and make sure set the
correct mode before mipi phy init.

Signed-off-by: Chris Zhong 
Signed-off-by: Mark Yao 

---

Changes in v6:
- no need check phy_cfg_clk before enable/disable

Changes in v5:
- check the error of phy_cfg_clk in dw_mipi_dsi_bind

Changes in v4:
- remove the unrelated change

Changes in v3:
- base on John Keeping's patch series

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 72 +-
 1 file changed, 62 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 3f24333..8f60b89 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -29,9 +29,17 @@
 
 #define DRIVER_NAME"dw-mipi-dsi"
 
-#define GRF_SOC_CON60x025c
-#define DSI0_SEL_VOP_LIT(1 << 6)
-#define DSI1_SEL_VOP_LIT(1 << 9)
+#define RK3288_GRF_SOC_CON60x025c
+#define RK3288_DSI0_SEL_VOP_LITBIT(6)
+#define RK3288_DSI1_SEL_VOP_LITBIT(9)
+
+#define RK3399_GRF_SOC_CON19   0x6250
+#define RK3399_DSI0_SEL_VOP_LITBIT(0)
+#define RK3399_DSI1_SEL_VOP_LITBIT(4)
+
+/* disable turnrequest, turndisable, forcetxstopmode, forcerxmode */
+#define RK3399_GRF_SOC_CON22   0x6258
+#define RK3399_GRF_DSI_MODE0x
 
 #define DSI_VERSION0x00
 #define DSI_PWR_UP 0x04
@@ -265,6 +273,11 @@ enum {
 };
 
 struct dw_mipi_dsi_plat_data {
+   u32 dsi0_en_bit;
+   u32 dsi1_en_bit;
+   u32 grf_switch_reg;
+   u32 grf_dsi0_mode;
+   u32 grf_dsi0_mode_reg;
unsigned int max_data_lanes;
enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
   struct drm_display_mode *mode);
@@ -281,6 +294,7 @@ struct dw_mipi_dsi {
 
struct clk *pllref_clk;
struct clk *pclk;
+   struct clk *phy_cfg_clk;
 
unsigned int lane_mbps; /* per lane */
u32 channel;
@@ -425,6 +439,12 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_TESTCLR);
dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_UNTESTCLR);
 
+   ret = clk_prepare_enable(dsi->phy_cfg_clk);
+   if (ret) {
+   dev_err(dsi->dev, "Failed to enable phy_cfg_clk\n");
+   return ret;
+   }
+
dw_mipi_dsi_phy_write(dsi, 0x10, BYPASS_VCO_RANGE |
 VCO_RANGE_CON_SEL(vco) |
 VCO_IN_CAP_CON_LOW |
@@ -481,17 +501,18 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
 val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US);
if (ret < 0) {
dev_err(dsi->dev, "failed to wait for phy lock state\n");
-   return ret;
+   goto phy_init_end;
}
 
ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS,
 val, val & STOP_STATE_CLK_LANE, 1000,
 PHY_STATUS_TIMEOUT_US);
-   if (ret < 0) {
+   if (ret < 0)
dev_err(dsi->dev,
"failed to wait for phy clk lane stop state\n");
-   return ret;
-   }
+
+phy_init_end:
+   clk_disable_unprepare(dsi->phy_cfg_clk);
 
return ret;
 }
@@ -960,6 +981,7 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
 {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
struct drm_display_mode *mode = >crtc->state->adjusted_mode;
+   const struct dw_mipi_dsi_plat_data *pdata = dsi->pdata;
int mux = drm_of_encoder_active_endpoint_id(dsi->dev->of_node, encoder);
u32 val;
int ret;
@@ -985,6 +1007,10 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
dw_mipi_dsi_dphy_interface_config(dsi);
dw_mipi_dsi_clear_err(dsi);
 
+   if (pdata->grf_dsi0_mode_reg)
+   regmap_write(dsi->grf_regmap, pdata->grf_dsi0_mode_reg,
+pdata->grf_dsi0_mode);
+
dw_mipi_dsi_phy_init(dsi);
dw_mipi_dsi_wait_for_two_frames(mode);
 
@@ -998,11 +1024,11 @@ static void dw_mipi_dsi_encoder_enable(struct 
drm_encoder *encoder)
clk_disable_unprepare(dsi->pclk);
 
if (mux)
-   val = DSI0_SEL_VOP_LIT | (DSI0_SEL_VOP_LIT << 16);
+   val = pdata->dsi0_en_bit | (pdata->dsi0_en_bit << 16);
else
-   val = DSI0_SEL_VOP_LIT << 16;
+   val = pdata->dsi0_en_bit << 16;
 
-   regmap_write(dsi->grf_regmap, GRF_SOC_CON6, val);
+   regmap_write(dsi->grf_regmap, 

[PATCH v6 2/6] drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi

2017-02-07 Thread Chris Zhong
The vopb/vopl switch register of RK3399 mipi is different from RK3288,
the default setting for mipi dsi mode is different too, so add a
of_device_id structure to distinguish them, and make sure set the
correct mode before mipi phy init.

Signed-off-by: Chris Zhong 
Signed-off-by: Mark Yao 

---

Changes in v6:
- no need check phy_cfg_clk before enable/disable

Changes in v5:
- check the error of phy_cfg_clk in dw_mipi_dsi_bind

Changes in v4:
- remove the unrelated change

Changes in v3:
- base on John Keeping's patch series

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 72 +-
 1 file changed, 62 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 3f24333..8f60b89 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -29,9 +29,17 @@
 
 #define DRIVER_NAME"dw-mipi-dsi"
 
-#define GRF_SOC_CON60x025c
-#define DSI0_SEL_VOP_LIT(1 << 6)
-#define DSI1_SEL_VOP_LIT(1 << 9)
+#define RK3288_GRF_SOC_CON60x025c
+#define RK3288_DSI0_SEL_VOP_LITBIT(6)
+#define RK3288_DSI1_SEL_VOP_LITBIT(9)
+
+#define RK3399_GRF_SOC_CON19   0x6250
+#define RK3399_DSI0_SEL_VOP_LITBIT(0)
+#define RK3399_DSI1_SEL_VOP_LITBIT(4)
+
+/* disable turnrequest, turndisable, forcetxstopmode, forcerxmode */
+#define RK3399_GRF_SOC_CON22   0x6258
+#define RK3399_GRF_DSI_MODE0x
 
 #define DSI_VERSION0x00
 #define DSI_PWR_UP 0x04
@@ -265,6 +273,11 @@ enum {
 };
 
 struct dw_mipi_dsi_plat_data {
+   u32 dsi0_en_bit;
+   u32 dsi1_en_bit;
+   u32 grf_switch_reg;
+   u32 grf_dsi0_mode;
+   u32 grf_dsi0_mode_reg;
unsigned int max_data_lanes;
enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
   struct drm_display_mode *mode);
@@ -281,6 +294,7 @@ struct dw_mipi_dsi {
 
struct clk *pllref_clk;
struct clk *pclk;
+   struct clk *phy_cfg_clk;
 
unsigned int lane_mbps; /* per lane */
u32 channel;
@@ -425,6 +439,12 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_TESTCLR);
dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_UNTESTCLR);
 
+   ret = clk_prepare_enable(dsi->phy_cfg_clk);
+   if (ret) {
+   dev_err(dsi->dev, "Failed to enable phy_cfg_clk\n");
+   return ret;
+   }
+
dw_mipi_dsi_phy_write(dsi, 0x10, BYPASS_VCO_RANGE |
 VCO_RANGE_CON_SEL(vco) |
 VCO_IN_CAP_CON_LOW |
@@ -481,17 +501,18 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
 val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US);
if (ret < 0) {
dev_err(dsi->dev, "failed to wait for phy lock state\n");
-   return ret;
+   goto phy_init_end;
}
 
ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS,
 val, val & STOP_STATE_CLK_LANE, 1000,
 PHY_STATUS_TIMEOUT_US);
-   if (ret < 0) {
+   if (ret < 0)
dev_err(dsi->dev,
"failed to wait for phy clk lane stop state\n");
-   return ret;
-   }
+
+phy_init_end:
+   clk_disable_unprepare(dsi->phy_cfg_clk);
 
return ret;
 }
@@ -960,6 +981,7 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
 {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
struct drm_display_mode *mode = >crtc->state->adjusted_mode;
+   const struct dw_mipi_dsi_plat_data *pdata = dsi->pdata;
int mux = drm_of_encoder_active_endpoint_id(dsi->dev->of_node, encoder);
u32 val;
int ret;
@@ -985,6 +1007,10 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
dw_mipi_dsi_dphy_interface_config(dsi);
dw_mipi_dsi_clear_err(dsi);
 
+   if (pdata->grf_dsi0_mode_reg)
+   regmap_write(dsi->grf_regmap, pdata->grf_dsi0_mode_reg,
+pdata->grf_dsi0_mode);
+
dw_mipi_dsi_phy_init(dsi);
dw_mipi_dsi_wait_for_two_frames(mode);
 
@@ -998,11 +1024,11 @@ static void dw_mipi_dsi_encoder_enable(struct 
drm_encoder *encoder)
clk_disable_unprepare(dsi->pclk);
 
if (mux)
-   val = DSI0_SEL_VOP_LIT | (DSI0_SEL_VOP_LIT << 16);
+   val = pdata->dsi0_en_bit | (pdata->dsi0_en_bit << 16);
else
-   val = DSI0_SEL_VOP_LIT << 16;
+   val = pdata->dsi0_en_bit << 16;
 
-   regmap_write(dsi->grf_regmap, GRF_SOC_CON6, val);
+   regmap_write(dsi->grf_regmap, pdata->grf_switch_reg, val);
dev_dbg(dsi->dev, 

[PATCH v2 2/4] Documentation: devicetree: Add LED subnode binding for MT6323 PMIC

2017-02-07 Thread sean.wang
From: Sean Wang 

This patch adds documentation for devicetree bindings
for LED support as the subnode of MT6323 PMIC

Signed-off-by: Sean Wang 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/mfd/mt6397.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt 
b/Documentation/devicetree/bindings/mfd/mt6397.txt
index 949c85f..c568d52 100644
--- a/Documentation/devicetree/bindings/mfd/mt6397.txt
+++ b/Documentation/devicetree/bindings/mfd/mt6397.txt
@@ -34,6 +34,10 @@ Optional subnodes:
 - clk
Required properties:
- compatible: "mediatek,mt6397-clk"
+- led
+   Required properties:
+   - compatible: "mediatek,mt6323-led"
+   see Documentation/devicetree/bindings/leds/leds-mt6323.txt
 
 Example:
pwrap: pwrap@1000f000 {
-- 
1.9.1



[PATCH v2 1/4] Documentation: devicetree: Add document bindings for leds-mt6323

2017-02-07 Thread sean.wang
From: Sean Wang 

This patch adds documentation for devicetree bindings
for LED support on MT6323 PMIC

Signed-off-by: Sean Wang 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/leds/leds-mt6323.txt   | 60 ++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt 
b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
new file mode 100644
index 000..82bbf0c
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
@@ -0,0 +1,60 @@
+Device Tree Bindings for LED support on MT6323 PMIC
+
+MT6323 LED controller is subfunction provided by
+MT6323 PMIC, so the LED controller are defined as
+the subnode of the function node provided by MT6323
+PMIC controller that is being defined as one kind of
+Muti-Function Device (MFD) using shared bus called
+PMIC wrapper for each subfunction to access remote
+MT6323 PMIC hardware.
+
+For MT6323 MFD bindings see:
+Documentation/devicetree/bindings/mfd/mt6397.txt
+For MediaTek PMIC wrapper bindings see:
+Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
+
+There's sub-node for the LED controller that describes
+the initial behavior for each LED physcially and currently
+only four LED sub-nodes could be supported.
+
+Required properties:
+- compatible : must be "mediatek,mt6323-led"
+
+Optional properties:
+- label : (optional)
+  see Documentation/devicetree/bindings/leds/common.txt
+- linux,default-trigger : (optional)
+  see Documentation/devicetree/bindings/leds/common.txt
+- default-state: (optional) The initial state of the LED
+  see Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+
+ {
+   pmic: mt6323 {
+   compatible = "mediatek,mt6323";
+   interrupt-parent = <>;
+   interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+
+   mt6323led: mt6323led{
+   compatible = "mediatek,mt6323-led";
+
+   led0: isink0 {
+   lebel = "LED0"
+   linux,default-trigger = "timer";
+   default-state = "on";
+   };
+   led1: isink1 {
+   label = "LED1";
+   default-state = "on";
+   };
+   led2: isink2 {
+   label = "LED2";
+   linux,default-trigger = "timer";
+   default-state = "off";
+   };
+   };
+   };
+};
-- 
1.9.1



[PATCH v2 2/4] Documentation: devicetree: Add LED subnode binding for MT6323 PMIC

2017-02-07 Thread sean.wang
From: Sean Wang 

This patch adds documentation for devicetree bindings
for LED support as the subnode of MT6323 PMIC

Signed-off-by: Sean Wang 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/mfd/mt6397.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt 
b/Documentation/devicetree/bindings/mfd/mt6397.txt
index 949c85f..c568d52 100644
--- a/Documentation/devicetree/bindings/mfd/mt6397.txt
+++ b/Documentation/devicetree/bindings/mfd/mt6397.txt
@@ -34,6 +34,10 @@ Optional subnodes:
 - clk
Required properties:
- compatible: "mediatek,mt6397-clk"
+- led
+   Required properties:
+   - compatible: "mediatek,mt6323-led"
+   see Documentation/devicetree/bindings/leds/leds-mt6323.txt
 
 Example:
pwrap: pwrap@1000f000 {
-- 
1.9.1



[PATCH v2 1/4] Documentation: devicetree: Add document bindings for leds-mt6323

2017-02-07 Thread sean.wang
From: Sean Wang 

This patch adds documentation for devicetree bindings
for LED support on MT6323 PMIC

Signed-off-by: Sean Wang 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/leds/leds-mt6323.txt   | 60 ++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt 
b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
new file mode 100644
index 000..82bbf0c
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
@@ -0,0 +1,60 @@
+Device Tree Bindings for LED support on MT6323 PMIC
+
+MT6323 LED controller is subfunction provided by
+MT6323 PMIC, so the LED controller are defined as
+the subnode of the function node provided by MT6323
+PMIC controller that is being defined as one kind of
+Muti-Function Device (MFD) using shared bus called
+PMIC wrapper for each subfunction to access remote
+MT6323 PMIC hardware.
+
+For MT6323 MFD bindings see:
+Documentation/devicetree/bindings/mfd/mt6397.txt
+For MediaTek PMIC wrapper bindings see:
+Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
+
+There's sub-node for the LED controller that describes
+the initial behavior for each LED physcially and currently
+only four LED sub-nodes could be supported.
+
+Required properties:
+- compatible : must be "mediatek,mt6323-led"
+
+Optional properties:
+- label : (optional)
+  see Documentation/devicetree/bindings/leds/common.txt
+- linux,default-trigger : (optional)
+  see Documentation/devicetree/bindings/leds/common.txt
+- default-state: (optional) The initial state of the LED
+  see Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+
+ {
+   pmic: mt6323 {
+   compatible = "mediatek,mt6323";
+   interrupt-parent = <>;
+   interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+
+   mt6323led: mt6323led{
+   compatible = "mediatek,mt6323-led";
+
+   led0: isink0 {
+   lebel = "LED0"
+   linux,default-trigger = "timer";
+   default-state = "on";
+   };
+   led1: isink1 {
+   label = "LED1";
+   default-state = "on";
+   };
+   led2: isink2 {
+   label = "LED2";
+   linux,default-trigger = "timer";
+   default-state = "off";
+   };
+   };
+   };
+};
-- 
1.9.1



[PATCH v2 4/4] mfd: mt6397: Add MT6323 LED support into MT6397 driver

2017-02-07 Thread sean.wang
From: Sean Wang 

Add compatible string as "mt6323-led" that will make
the OF core spawn child devices for the LED subnode
of that MT6323 MFD device.

Signed-off-by: Sean Wang 
---
 drivers/mfd/mt6397-core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index e14d8b0..8e601c8 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -48,6 +48,10 @@
.name = "mt6323-regulator",
.of_compatible = "mediatek,mt6323-regulator"
},
+   {
+   .name = "mt6323-led",
+   .of_compatible = "mediatek,mt6323-led"
+   },
 };
 
 static const struct mfd_cell mt6397_devs[] = {
-- 
1.9.1



[PATCH v2 4/4] mfd: mt6397: Add MT6323 LED support into MT6397 driver

2017-02-07 Thread sean.wang
From: Sean Wang 

Add compatible string as "mt6323-led" that will make
the OF core spawn child devices for the LED subnode
of that MT6323 MFD device.

Signed-off-by: Sean Wang 
---
 drivers/mfd/mt6397-core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index e14d8b0..8e601c8 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -48,6 +48,10 @@
.name = "mt6323-regulator",
.of_compatible = "mediatek,mt6323-regulator"
},
+   {
+   .name = "mt6323-led",
+   .of_compatible = "mediatek,mt6323-led"
+   },
 };
 
 static const struct mfd_cell mt6397_devs[] = {
-- 
1.9.1



[PATCH v6 0/6] Rockchip dw-mipi-dsi driver

2017-02-07 Thread Chris Zhong
Hi all

This patch serial is for RK3399 MIPI DSI. The MIPI DSI controller of
RK3399 is almost the same as RK3288, except a little bit of difference
in phy clock controlling and port id selection register. These patches
add RK3399 support and the power domain support.

And these patches base on John Keeping's v3 patches[0], it fixes many bugs,
they have been tested on rk3288 evb board.

[0]:
[01/24] https://patchwork.kernel.org/patch/9544089
[02/24] https://patchwork.kernel.org/patch/9544061
[03/24] https://patchwork.kernel.org/patch/9544065
[04/24] https://patchwork.kernel.org/patch/9544077
[05/24] https://patchwork.kernel.org/patch/9544033
[06/24] https://patchwork.kernel.org/patch/9544037
[07/24] https://patchwork.kernel.org/patch/9544029
[08/24] https://patchwork.kernel.org/patch/9544031
[09/24] https://patchwork.kernel.org/patch/9544083
[10/24] https://patchwork.kernel.org/patch/9544063
[11/24] https://patchwork.kernel.org/patch/9544085
[12/24] https://patchwork.kernel.org/patch/9544093
[13/24] https://patchwork.kernel.org/patch/9544081
[14/24] https://patchwork.kernel.org/patch/9544057
[15/24] https://patchwork.kernel.org/patch/9544079
[16/24] https://patchwork.kernel.org/patch/9544035
[17/24] https://patchwork.kernel.org/patch/9544105
[18/24] https://patchwork.kernel.org/patch/9544059
[21/24] https://patchwork.kernel.org/patch/9544009
[22/24] https://patchwork.kernel.org/patch/9544049
[23/24] https://patchwork.kernel.org/patch/9544055
[24/24] https://patchwork.kernel.org/patch/9544109


Changes in v6:
- no need check phy_cfg_clk before enable/disable

Changes in v5:
- check the error of phy_cfg_clk in dw_mipi_dsi_bind

Changes in v4:
- remove the unrelated change

Changes in v3:
- base on John Keeping's patch series

Chris Zhong (6):
  dt-bindings: add rk3399 support for dw-mipi-rockchip
  drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi
  drm/rockchip/dsi: dw-mipi: correct the coding style
  drm/rockchip/dsi: remove mode_valid function
  dt-bindings: add power domain node for dw-mipi-rockchip
  drm/rockchip/dsi: add dw-mipi power domain support

 .../display/rockchip/dw_mipi_dsi_rockchip.txt  |   7 +-
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 156 -
 2 files changed, 98 insertions(+), 65 deletions(-)

-- 
2.6.3



[PATCH v6 0/6] Rockchip dw-mipi-dsi driver

2017-02-07 Thread Chris Zhong
Hi all

This patch serial is for RK3399 MIPI DSI. The MIPI DSI controller of
RK3399 is almost the same as RK3288, except a little bit of difference
in phy clock controlling and port id selection register. These patches
add RK3399 support and the power domain support.

And these patches base on John Keeping's v3 patches[0], it fixes many bugs,
they have been tested on rk3288 evb board.

[0]:
[01/24] https://patchwork.kernel.org/patch/9544089
[02/24] https://patchwork.kernel.org/patch/9544061
[03/24] https://patchwork.kernel.org/patch/9544065
[04/24] https://patchwork.kernel.org/patch/9544077
[05/24] https://patchwork.kernel.org/patch/9544033
[06/24] https://patchwork.kernel.org/patch/9544037
[07/24] https://patchwork.kernel.org/patch/9544029
[08/24] https://patchwork.kernel.org/patch/9544031
[09/24] https://patchwork.kernel.org/patch/9544083
[10/24] https://patchwork.kernel.org/patch/9544063
[11/24] https://patchwork.kernel.org/patch/9544085
[12/24] https://patchwork.kernel.org/patch/9544093
[13/24] https://patchwork.kernel.org/patch/9544081
[14/24] https://patchwork.kernel.org/patch/9544057
[15/24] https://patchwork.kernel.org/patch/9544079
[16/24] https://patchwork.kernel.org/patch/9544035
[17/24] https://patchwork.kernel.org/patch/9544105
[18/24] https://patchwork.kernel.org/patch/9544059
[21/24] https://patchwork.kernel.org/patch/9544009
[22/24] https://patchwork.kernel.org/patch/9544049
[23/24] https://patchwork.kernel.org/patch/9544055
[24/24] https://patchwork.kernel.org/patch/9544109


Changes in v6:
- no need check phy_cfg_clk before enable/disable

Changes in v5:
- check the error of phy_cfg_clk in dw_mipi_dsi_bind

Changes in v4:
- remove the unrelated change

Changes in v3:
- base on John Keeping's patch series

Chris Zhong (6):
  dt-bindings: add rk3399 support for dw-mipi-rockchip
  drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi
  drm/rockchip/dsi: dw-mipi: correct the coding style
  drm/rockchip/dsi: remove mode_valid function
  dt-bindings: add power domain node for dw-mipi-rockchip
  drm/rockchip/dsi: add dw-mipi power domain support

 .../display/rockchip/dw_mipi_dsi_rockchip.txt  |   7 +-
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 156 -
 2 files changed, 98 insertions(+), 65 deletions(-)

-- 
2.6.3



[PATCH v6 4/6] drm/rockchip/dsi: remove mode_valid function

2017-02-07 Thread Chris Zhong
The MIPI DSI do not need check the validity of resolution, the max
resolution should depend VOP. Hence, remove rk3288_mipi_dsi_mode_valid
here.

Signed-off-by: Chris Zhong 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 39 --
 1 file changed, 39 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 6795190..a2b4ec4 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -278,8 +278,6 @@ struct dw_mipi_dsi_plat_data {
u32 grf_dsi0_mode;
u32 grf_dsi0_mode_reg;
unsigned int max_data_lanes;
-   enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
-  struct drm_display_mode *mode);
 };
 
 struct dw_mipi_dsi {
@@ -1077,23 +1075,8 @@ static int dw_mipi_dsi_connector_get_modes(struct 
drm_connector *connector)
return drm_panel_get_modes(dsi->panel);
 }
 
-static enum drm_mode_status dw_mipi_dsi_mode_valid(
-   struct drm_connector *connector,
-   struct drm_display_mode *mode)
-{
-   struct dw_mipi_dsi *dsi = con_to_dsi(connector);
-
-   enum drm_mode_status mode_status = MODE_OK;
-
-   if (dsi->pdata->mode_valid)
-   mode_status = dsi->pdata->mode_valid(connector, mode);
-
-   return mode_status;
-}
-
 static struct drm_connector_helper_funcs dw_mipi_dsi_connector_helper_funcs = {
.get_modes = dw_mipi_dsi_connector_get_modes,
-   .mode_valid = dw_mipi_dsi_mode_valid,
 };
 
 static void dw_mipi_dsi_drm_connector_destroy(struct drm_connector *connector)
@@ -1164,33 +1147,11 @@ static int rockchip_mipi_parse_dt(struct dw_mipi_dsi 
*dsi)
return 0;
 }
 
-static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
-   struct drm_connector *connector,
-   struct drm_display_mode *mode)
-{
-   /*
-* The VID_PKT_SIZE field in the DSI_VID_PKT_CFG
-* register is 11-bit.
-*/
-   if (mode->hdisplay > 0x7ff)
-   return MODE_BAD_HVALUE;
-
-   /*
-* The V_ACTIVE_LINES field in the DSI_VTIMING_CFG
-* register is 11-bit.
-*/
-   if (mode->vdisplay > 0x7ff)
-   return MODE_BAD_VVALUE;
-
-   return MODE_OK;
-}
-
 static struct dw_mipi_dsi_plat_data rk3288_mipi_dsi_drv_data = {
.dsi0_en_bit = RK3288_DSI0_SEL_VOP_LIT,
.dsi1_en_bit = RK3288_DSI1_SEL_VOP_LIT,
.grf_switch_reg = RK3288_GRF_SOC_CON6,
.max_data_lanes = 4,
-   .mode_valid = rk3288_mipi_dsi_mode_valid,
 };
 
 static struct dw_mipi_dsi_plat_data rk3399_mipi_dsi_drv_data = {
-- 
2.6.3



[PATCH v6 4/6] drm/rockchip/dsi: remove mode_valid function

2017-02-07 Thread Chris Zhong
The MIPI DSI do not need check the validity of resolution, the max
resolution should depend VOP. Hence, remove rk3288_mipi_dsi_mode_valid
here.

Signed-off-by: Chris Zhong 
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 39 --
 1 file changed, 39 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 6795190..a2b4ec4 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -278,8 +278,6 @@ struct dw_mipi_dsi_plat_data {
u32 grf_dsi0_mode;
u32 grf_dsi0_mode_reg;
unsigned int max_data_lanes;
-   enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
-  struct drm_display_mode *mode);
 };
 
 struct dw_mipi_dsi {
@@ -1077,23 +1075,8 @@ static int dw_mipi_dsi_connector_get_modes(struct 
drm_connector *connector)
return drm_panel_get_modes(dsi->panel);
 }
 
-static enum drm_mode_status dw_mipi_dsi_mode_valid(
-   struct drm_connector *connector,
-   struct drm_display_mode *mode)
-{
-   struct dw_mipi_dsi *dsi = con_to_dsi(connector);
-
-   enum drm_mode_status mode_status = MODE_OK;
-
-   if (dsi->pdata->mode_valid)
-   mode_status = dsi->pdata->mode_valid(connector, mode);
-
-   return mode_status;
-}
-
 static struct drm_connector_helper_funcs dw_mipi_dsi_connector_helper_funcs = {
.get_modes = dw_mipi_dsi_connector_get_modes,
-   .mode_valid = dw_mipi_dsi_mode_valid,
 };
 
 static void dw_mipi_dsi_drm_connector_destroy(struct drm_connector *connector)
@@ -1164,33 +1147,11 @@ static int rockchip_mipi_parse_dt(struct dw_mipi_dsi 
*dsi)
return 0;
 }
 
-static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
-   struct drm_connector *connector,
-   struct drm_display_mode *mode)
-{
-   /*
-* The VID_PKT_SIZE field in the DSI_VID_PKT_CFG
-* register is 11-bit.
-*/
-   if (mode->hdisplay > 0x7ff)
-   return MODE_BAD_HVALUE;
-
-   /*
-* The V_ACTIVE_LINES field in the DSI_VTIMING_CFG
-* register is 11-bit.
-*/
-   if (mode->vdisplay > 0x7ff)
-   return MODE_BAD_VVALUE;
-
-   return MODE_OK;
-}
-
 static struct dw_mipi_dsi_plat_data rk3288_mipi_dsi_drv_data = {
.dsi0_en_bit = RK3288_DSI0_SEL_VOP_LIT,
.dsi1_en_bit = RK3288_DSI1_SEL_VOP_LIT,
.grf_switch_reg = RK3288_GRF_SOC_CON6,
.max_data_lanes = 4,
-   .mode_valid = rk3288_mipi_dsi_mode_valid,
 };
 
 static struct dw_mipi_dsi_plat_data rk3399_mipi_dsi_drv_data = {
-- 
2.6.3



[PATCH v2 3/4] leds: Add LED support for MT6323 PMIC

2017-02-07 Thread sean.wang
From: Sean Wang 

MT6323 PMIC is a multi-function device that includes
LED function. It allows attaching upto 4 LEDs which can
either be on, off or dimmed and/or blinked with the the
controller.

Signed-off-by: Sean Wang 
---
 drivers/leds/Kconfig   |   8 +
 drivers/leds/Makefile  |   1 +
 drivers/leds/leds-mt6323.c | 464 +
 3 files changed, 473 insertions(+)
 create mode 100644 drivers/leds/leds-mt6323.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index c621cbb..30095fc 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -117,6 +117,14 @@ config LEDS_MIKROTIK_RB532
  This option enables support for the so called "User LED" of
  Mikrotik's Routerboard 532.
 
+config LEDS_MT6323
+   tristate "LED Support for Mediatek MT6323 PMIC"
+   depends on LEDS_CLASS
+   depends on MFD_MT6397
+   help
+ This option enables support for on-chip LED drivers found on
+ Mediatek MT6323 PMIC.
+
 config LEDS_S3C24XX
tristate "LED Support for Samsung S3C24XX GPIO LEDs"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 6b82737..4feb332 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -72,6 +72,7 @@ obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
 obj-$(CONFIG_LEDS_PM8058)  += leds-pm8058.o
 obj-$(CONFIG_LEDS_MLXCPLD) += leds-mlxcpld.o
 obj-$(CONFIG_LEDS_NIC78BX) += leds-nic78bx.o
+obj-$(CONFIG_LEDS_MT6323)  += leds-mt6323.o
 
 # LED SPI Drivers
 obj-$(CONFIG_LEDS_DAC124S085)  += leds-dac124s085.o
diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c
new file mode 100644
index 000..f6eeb6c
--- /dev/null
+++ b/drivers/leds/leds-mt6323.c
@@ -0,0 +1,464 @@
+/*
+ * LED driver for Mediatek MT6323 PMIC
+ *
+ * Copyright (C) 2017 Sean Wang 
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Register field for MT6323_TOP_CKPDN0 to enable
+ * 32K clock common for LED device
+ */
+#define MT6323_RG_DRV_32K_CK_PDN   BIT(11)
+#define MT6323_RG_DRV_32K_CK_PDN_MASK  BIT(11)
+
+/*
+ * Register field for MT6323_TOP_CKPDN2 to enable
+ * individual clock for LED device
+ */
+#define MT6323_RG_ISINK_CK_PDN(i)  BIT(i)
+#define MT6323_RG_ISINK_CK_PDN_MASK(i) BIT(i)
+
+/*
+ * Register field for MT6323_TOP_CKCON1 to select
+ * clock source
+ */
+#define MT6323_RG_ISINK_CK_SEL_MASK(i) (BIT(10) << (i))
+
+/*
+ * Register for MT6323_ISINK_CON0 to setup the
+ * duty cycle of the blink
+ */
+#define MT6323_ISINK_CON0(i)   (MT6323_ISINK0_CON0 + 0x8 * (i))
+#define MT6323_ISINK_DIM_DUTY_MASK (0x1f << 8)
+#define MT6323_ISINK_DIM_DUTY(i)   (((i) << 8) & \
+   MT6323_ISINK_DIM_DUTY_MASK)
+
+/*
+ * Register to setup the period of the blink
+ */
+#define MT6323_ISINK_CON1(i)   (MT6323_ISINK0_CON1 + 0x8 * (i))
+#define MT6323_ISINK_DIM_FSEL_MASK (0x)
+#define MT6323_ISINK_DIM_FSEL(i)   ((i) & MT6323_ISINK_DIM_FSEL_MASK)
+
+/*
+ * Register to control the brightness
+ */
+#define MT6323_ISINK_CON2(i)   (MT6323_ISINK0_CON2 + 0x8 * (i))
+#define MT6323_ISINK_CH_STEP_SHIFT 12
+#define MT6323_ISINK_CH_STEP_MASK  (0x7 << 12)
+#define MT6323_ISINK_CH_STEP(i)(((i) << 12) & \
+   MT6323_ISINK_CH_STEP_MASK)
+#define MT6323_ISINK_SFSTR0_TC_MASK(0x3 << 1)
+#define MT6323_ISINK_SFSTR0_TC(i)  (((i) << 1) & \
+   MT6323_ISINK_SFSTR0_TC_MASK)
+#define MT6323_ISINK_SFSTR0_EN_MASKBIT(0)
+#define MT6323_ISINK_SFSTR0_EN BIT(0)
+
+/*
+ * Register to LED channel enablement
+ */
+#define MT6323_ISINK_CH_EN_MASK(i) BIT(i)
+#define MT6323_ISINK_CH_EN(i)  BIT(i)
+
+#define MTK_MAX_PERIOD   1
+#define MTK_MAX_DEVICES  4
+#define MTK_MAX_BRIGHTNESS   6
+#define MTK_UNIT_DUTY 3125
+
+struct mtk_leds;
+
+/**
+ * struct mtk_led - state container for the LED device
+ * @id: the identifier in MT6323 LED device
+ * @parent: the pointer to MT6323 LED controller
+ * @cdev: LED class device for this LED device
+ * @current_brightness: current state of the LED device
+ */
+struct mtk_led {
+   intid;
+   

[PATCH v2 3/4] leds: Add LED support for MT6323 PMIC

2017-02-07 Thread sean.wang
From: Sean Wang 

MT6323 PMIC is a multi-function device that includes
LED function. It allows attaching upto 4 LEDs which can
either be on, off or dimmed and/or blinked with the the
controller.

Signed-off-by: Sean Wang 
---
 drivers/leds/Kconfig   |   8 +
 drivers/leds/Makefile  |   1 +
 drivers/leds/leds-mt6323.c | 464 +
 3 files changed, 473 insertions(+)
 create mode 100644 drivers/leds/leds-mt6323.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index c621cbb..30095fc 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -117,6 +117,14 @@ config LEDS_MIKROTIK_RB532
  This option enables support for the so called "User LED" of
  Mikrotik's Routerboard 532.
 
+config LEDS_MT6323
+   tristate "LED Support for Mediatek MT6323 PMIC"
+   depends on LEDS_CLASS
+   depends on MFD_MT6397
+   help
+ This option enables support for on-chip LED drivers found on
+ Mediatek MT6323 PMIC.
+
 config LEDS_S3C24XX
tristate "LED Support for Samsung S3C24XX GPIO LEDs"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 6b82737..4feb332 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -72,6 +72,7 @@ obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
 obj-$(CONFIG_LEDS_PM8058)  += leds-pm8058.o
 obj-$(CONFIG_LEDS_MLXCPLD) += leds-mlxcpld.o
 obj-$(CONFIG_LEDS_NIC78BX) += leds-nic78bx.o
+obj-$(CONFIG_LEDS_MT6323)  += leds-mt6323.o
 
 # LED SPI Drivers
 obj-$(CONFIG_LEDS_DAC124S085)  += leds-dac124s085.o
diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c
new file mode 100644
index 000..f6eeb6c
--- /dev/null
+++ b/drivers/leds/leds-mt6323.c
@@ -0,0 +1,464 @@
+/*
+ * LED driver for Mediatek MT6323 PMIC
+ *
+ * Copyright (C) 2017 Sean Wang 
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Register field for MT6323_TOP_CKPDN0 to enable
+ * 32K clock common for LED device
+ */
+#define MT6323_RG_DRV_32K_CK_PDN   BIT(11)
+#define MT6323_RG_DRV_32K_CK_PDN_MASK  BIT(11)
+
+/*
+ * Register field for MT6323_TOP_CKPDN2 to enable
+ * individual clock for LED device
+ */
+#define MT6323_RG_ISINK_CK_PDN(i)  BIT(i)
+#define MT6323_RG_ISINK_CK_PDN_MASK(i) BIT(i)
+
+/*
+ * Register field for MT6323_TOP_CKCON1 to select
+ * clock source
+ */
+#define MT6323_RG_ISINK_CK_SEL_MASK(i) (BIT(10) << (i))
+
+/*
+ * Register for MT6323_ISINK_CON0 to setup the
+ * duty cycle of the blink
+ */
+#define MT6323_ISINK_CON0(i)   (MT6323_ISINK0_CON0 + 0x8 * (i))
+#define MT6323_ISINK_DIM_DUTY_MASK (0x1f << 8)
+#define MT6323_ISINK_DIM_DUTY(i)   (((i) << 8) & \
+   MT6323_ISINK_DIM_DUTY_MASK)
+
+/*
+ * Register to setup the period of the blink
+ */
+#define MT6323_ISINK_CON1(i)   (MT6323_ISINK0_CON1 + 0x8 * (i))
+#define MT6323_ISINK_DIM_FSEL_MASK (0x)
+#define MT6323_ISINK_DIM_FSEL(i)   ((i) & MT6323_ISINK_DIM_FSEL_MASK)
+
+/*
+ * Register to control the brightness
+ */
+#define MT6323_ISINK_CON2(i)   (MT6323_ISINK0_CON2 + 0x8 * (i))
+#define MT6323_ISINK_CH_STEP_SHIFT 12
+#define MT6323_ISINK_CH_STEP_MASK  (0x7 << 12)
+#define MT6323_ISINK_CH_STEP(i)(((i) << 12) & \
+   MT6323_ISINK_CH_STEP_MASK)
+#define MT6323_ISINK_SFSTR0_TC_MASK(0x3 << 1)
+#define MT6323_ISINK_SFSTR0_TC(i)  (((i) << 1) & \
+   MT6323_ISINK_SFSTR0_TC_MASK)
+#define MT6323_ISINK_SFSTR0_EN_MASKBIT(0)
+#define MT6323_ISINK_SFSTR0_EN BIT(0)
+
+/*
+ * Register to LED channel enablement
+ */
+#define MT6323_ISINK_CH_EN_MASK(i) BIT(i)
+#define MT6323_ISINK_CH_EN(i)  BIT(i)
+
+#define MTK_MAX_PERIOD   1
+#define MTK_MAX_DEVICES  4
+#define MTK_MAX_BRIGHTNESS   6
+#define MTK_UNIT_DUTY 3125
+
+struct mtk_leds;
+
+/**
+ * struct mtk_led - state container for the LED device
+ * @id: the identifier in MT6323 LED device
+ * @parent: the pointer to MT6323 LED controller
+ * @cdev: LED class device for this LED device
+ * @current_brightness: current state of the LED device
+ */
+struct mtk_led {
+   intid;
+   struct mtk_leds *parent;
+   struct led_classdev cdev;
+   u8 

[PATCH v2 0/4] leds: add leds-mt6323 support on MT7623 SoC

2017-02-07 Thread sean.wang
From: Sean Wang 

MT7623 SoC uses MT6323 PMIC as the default power supply
which has LED function insides. The patchset introduces
the LED support for MT6323 with on, off and hardware
dimmed and blinked and it should work on other similar
SoCs if also using MT6323.

Changes since v1:
All changes only within 0003-leds-Add-LED-support-for-MT6323-PMIC.patch, 
including below items
- fixed typo in the comments
- sorted include directives alphabetically
- applied all register definitions with MT6323 prefix
- removed the redundant structure declaration
- fixed coding style defined in kernel doc format consistently
- added error handling into all the occurrences where regmap APIs
  are used
- removed loudly debug message
- made magic constant into meaningful macro
- added missing mutex_destroy when module removed called
- updated module license with GPL
- fixed sparse warnings


Sean Wang (4):
  Documentation: devicetree: Add document bindings for leds-mt6323
  Documentation: devicetree: Add LED subnode binding for MT6323 PMIC
  leds: Add LED support for MT6323 PMIC
  mfd: mt6397: Add MT6323 LED support into MT6397 driver

 .../devicetree/bindings/leds/leds-mt6323.txt   |  60 +++
 Documentation/devicetree/bindings/mfd/mt6397.txt   |   4 +
 drivers/leds/Kconfig   |   8 +
 drivers/leds/Makefile  |   1 +
 drivers/leds/leds-mt6323.c | 464 +
 drivers/mfd/mt6397-core.c  |   4 +
 6 files changed, 541 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt
 create mode 100644 drivers/leds/leds-mt6323.c

-- 
1.9.1



[PATCH v2 0/4] leds: add leds-mt6323 support on MT7623 SoC

2017-02-07 Thread sean.wang
From: Sean Wang 

MT7623 SoC uses MT6323 PMIC as the default power supply
which has LED function insides. The patchset introduces
the LED support for MT6323 with on, off and hardware
dimmed and blinked and it should work on other similar
SoCs if also using MT6323.

Changes since v1:
All changes only within 0003-leds-Add-LED-support-for-MT6323-PMIC.patch, 
including below items
- fixed typo in the comments
- sorted include directives alphabetically
- applied all register definitions with MT6323 prefix
- removed the redundant structure declaration
- fixed coding style defined in kernel doc format consistently
- added error handling into all the occurrences where regmap APIs
  are used
- removed loudly debug message
- made magic constant into meaningful macro
- added missing mutex_destroy when module removed called
- updated module license with GPL
- fixed sparse warnings


Sean Wang (4):
  Documentation: devicetree: Add document bindings for leds-mt6323
  Documentation: devicetree: Add LED subnode binding for MT6323 PMIC
  leds: Add LED support for MT6323 PMIC
  mfd: mt6397: Add MT6323 LED support into MT6397 driver

 .../devicetree/bindings/leds/leds-mt6323.txt   |  60 +++
 Documentation/devicetree/bindings/mfd/mt6397.txt   |   4 +
 drivers/leds/Kconfig   |   8 +
 drivers/leds/Makefile  |   1 +
 drivers/leds/leds-mt6323.c | 464 +
 drivers/mfd/mt6397-core.c  |   4 +
 6 files changed, 541 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt
 create mode 100644 drivers/leds/leds-mt6323.c

-- 
1.9.1



Re: [PATCH v3 2/4] BMIPS: Enable prerequisites for CPUfreq in MIPS Kconfig.

2017-02-07 Thread Florian Fainelli
On 02/07/2017 01:58 PM, Markus Mayer wrote:
> From: Markus Mayer 
> 
> Turn on CPU_SUPPORTS_CPUFREQ and MIPS_EXTERNAL_TIMER for BMIPS.
> 
> Signed-off-by: Markus Mayer 

Acked-by: Florian Fainelli 
-- 
Florian


Re: [PATCH v3 2/4] BMIPS: Enable prerequisites for CPUfreq in MIPS Kconfig.

2017-02-07 Thread Florian Fainelli
On 02/07/2017 01:58 PM, Markus Mayer wrote:
> From: Markus Mayer 
> 
> Turn on CPU_SUPPORTS_CPUFREQ and MIPS_EXTERNAL_TIMER for BMIPS.
> 
> Signed-off-by: Markus Mayer 

Acked-by: Florian Fainelli 
-- 
Florian


Re: [PATCH v3 3/4] cpufreq: bmips-cpufreq: CPUfreq driver for Broadcom's BMIPS SoCs

2017-02-07 Thread Florian Fainelli
On 02/07/2017 01:58 PM, Markus Mayer wrote:
> From: Markus Mayer 
> 
> Add the MIPS CPUfreq driver. This driver currently supports CPUfreq on
> BMIPS5xxx-based SoCs.
> 
> Signed-off-by: Markus Mayer 

Acked-by: Florian Fainelli 
-- 
Florian


[PATCH v2] [media] mtk-vcodec: fix build errors without DEBUG

2017-02-07 Thread Minghsiu Tsai
After removing DEBUG from mtk_vcodec_util.h, some build errors are
generated as the following:
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c: In function 
'vcodec_vpu_send_msg':
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c:73:11: warning: unused 
variable 'msg_id' [-Wunused-variable]
  uint32_t msg_id = *(uint32_t *)msg;
   ^
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c: In function 
'vb2ops_vdec_buf_queue':
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:1129:7: warning: unused 
variable 'log_level' [-Wunused-variable]
   int log_level = ret ? 0 : 1;
   ^
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c: In function 
'vpu_enc_send_msg':
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c:82:12: warning: unused 
variable 'msg_id' [-Wunused-variable]
   uint32_t msg_id = *(uint32_t *)msg;
^

It is because mtk_vcodec_debug() and mtk_vcodec_err() are defined as empty
macros. Without DEBUG definition, the variable for debugging is not used
anymore. Fixing build errors is just by moving the assignment of the
variable to the argument of mtk_vcodec_debug() and mtk_vcodec_err().
Within the patch, build pass with/without DEBUG definition, and functions
still work fine.

Signed-off-by: Minghsiu Tsai 
Reviewed-by: Daniel Kurtz 
---
Changes in v2:
. Update commit message
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 9 -
 drivers/media/platform/mtk-vcodec/vdec_vpu_if.c| 5 ++---
 drivers/media/platform/mtk-vcodec/venc_vpu_if.c| 4 +---
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
index 0746592..6219c7d 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
@@ -1126,15 +1126,14 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb)
 * if there is no SPS header or picture info
 * in bs
 */
-   int log_level = ret ? 0 : 1;
 
src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf),
VB2_BUF_STATE_DONE);
-   mtk_v4l2_debug(log_level,
-   "[%d] vdec_if_decode() src_buf=%d, size=%zu, 
fail=%d, res_chg=%d",
-   ctx->id, src_buf->index,
-   src_mem.size, ret, res_chg);
+   mtk_v4l2_debug(ret ? 0 : 1,
+  "[%d] vdec_if_decode() src_buf=%d, size=%zu, 
fail=%d, res_chg=%d",
+  ctx->id, src_buf->index,
+  src_mem.size, ret, res_chg);
return;
}
 
diff --git a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c 
b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
index 5a24c51..1abd14e 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
@@ -70,9 +70,8 @@ void vpu_dec_ipi_handler(void *data, unsigned int len, void 
*priv)
 static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)
 {
int err;
-   uint32_t msg_id = *(uint32_t *)msg;
 
-   mtk_vcodec_debug(vpu, "id=%X", msg_id);
+   mtk_vcodec_debug(vpu, "id=%X", *(uint32_t *)msg);
 
vpu->failure = 0;
vpu->signaled = 0;
@@ -80,7 +79,7 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, 
void *msg, int len)
err = vpu_ipi_send(vpu->dev, vpu->id, msg, len);
if (err) {
mtk_vcodec_err(vpu, "send fail vpu_id=%d msg_id=%X status=%d",
-  vpu->id, msg_id, err);
+  vpu->id, *(uint32_t *)msg, err);
return err;
}
 
diff --git a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c 
b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index a01c759..0d882ac 100644
--- a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
@@ -79,10 +79,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void 
*msg,
 
status = vpu_ipi_send(vpu->dev, vpu->id, msg, len);
if (status) {
-   uint32_t msg_id = *(uint32_t *)msg;
-
mtk_vcodec_err(vpu, "vpu_ipi_send msg_id %x len %d fail %d",
-  msg_id, len, status);
+  *(uint32_t *)msg, len, status);
return -EINVAL;
}
if (vpu->failure)
-- 
1.9.1



Re: [PATCH v3 3/4] cpufreq: bmips-cpufreq: CPUfreq driver for Broadcom's BMIPS SoCs

2017-02-07 Thread Florian Fainelli
On 02/07/2017 01:58 PM, Markus Mayer wrote:
> From: Markus Mayer 
> 
> Add the MIPS CPUfreq driver. This driver currently supports CPUfreq on
> BMIPS5xxx-based SoCs.
> 
> Signed-off-by: Markus Mayer 

Acked-by: Florian Fainelli 
-- 
Florian


[PATCH v2] [media] mtk-vcodec: fix build errors without DEBUG

2017-02-07 Thread Minghsiu Tsai
After removing DEBUG from mtk_vcodec_util.h, some build errors are
generated as the following:
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c: In function 
'vcodec_vpu_send_msg':
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c:73:11: warning: unused 
variable 'msg_id' [-Wunused-variable]
  uint32_t msg_id = *(uint32_t *)msg;
   ^
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c: In function 
'vb2ops_vdec_buf_queue':
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:1129:7: warning: unused 
variable 'log_level' [-Wunused-variable]
   int log_level = ret ? 0 : 1;
   ^
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c: In function 
'vpu_enc_send_msg':
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c:82:12: warning: unused 
variable 'msg_id' [-Wunused-variable]
   uint32_t msg_id = *(uint32_t *)msg;
^

It is because mtk_vcodec_debug() and mtk_vcodec_err() are defined as empty
macros. Without DEBUG definition, the variable for debugging is not used
anymore. Fixing build errors is just by moving the assignment of the
variable to the argument of mtk_vcodec_debug() and mtk_vcodec_err().
Within the patch, build pass with/without DEBUG definition, and functions
still work fine.

Signed-off-by: Minghsiu Tsai 
Reviewed-by: Daniel Kurtz 
---
Changes in v2:
. Update commit message
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 9 -
 drivers/media/platform/mtk-vcodec/vdec_vpu_if.c| 5 ++---
 drivers/media/platform/mtk-vcodec/venc_vpu_if.c| 4 +---
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
index 0746592..6219c7d 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
@@ -1126,15 +1126,14 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb)
 * if there is no SPS header or picture info
 * in bs
 */
-   int log_level = ret ? 0 : 1;
 
src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf),
VB2_BUF_STATE_DONE);
-   mtk_v4l2_debug(log_level,
-   "[%d] vdec_if_decode() src_buf=%d, size=%zu, 
fail=%d, res_chg=%d",
-   ctx->id, src_buf->index,
-   src_mem.size, ret, res_chg);
+   mtk_v4l2_debug(ret ? 0 : 1,
+  "[%d] vdec_if_decode() src_buf=%d, size=%zu, 
fail=%d, res_chg=%d",
+  ctx->id, src_buf->index,
+  src_mem.size, ret, res_chg);
return;
}
 
diff --git a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c 
b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
index 5a24c51..1abd14e 100644
--- a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
@@ -70,9 +70,8 @@ void vpu_dec_ipi_handler(void *data, unsigned int len, void 
*priv)
 static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)
 {
int err;
-   uint32_t msg_id = *(uint32_t *)msg;
 
-   mtk_vcodec_debug(vpu, "id=%X", msg_id);
+   mtk_vcodec_debug(vpu, "id=%X", *(uint32_t *)msg);
 
vpu->failure = 0;
vpu->signaled = 0;
@@ -80,7 +79,7 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, 
void *msg, int len)
err = vpu_ipi_send(vpu->dev, vpu->id, msg, len);
if (err) {
mtk_vcodec_err(vpu, "send fail vpu_id=%d msg_id=%X status=%d",
-  vpu->id, msg_id, err);
+  vpu->id, *(uint32_t *)msg, err);
return err;
}
 
diff --git a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c 
b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index a01c759..0d882ac 100644
--- a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
@@ -79,10 +79,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void 
*msg,
 
status = vpu_ipi_send(vpu->dev, vpu->id, msg, len);
if (status) {
-   uint32_t msg_id = *(uint32_t *)msg;
-
mtk_vcodec_err(vpu, "vpu_ipi_send msg_id %x len %d fail %d",
-  msg_id, len, status);
+  *(uint32_t *)msg, len, status);
return -EINVAL;
}
if (vpu->failure)
-- 
1.9.1



[PATCH v3 2/2] sierra_net: Skip validating irrelevant fields for IDLE LSIs

2017-02-07 Thread Stefan Brüns
When the context is deactivated, the link_type is set to 0xff, which
triggers a warning message, and results in a wrong link status, as
the LSI is ignored.

Signed-off-by: Stefan Brüns 
---
 drivers/net/usb/sierra_net.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index 6300a4454ae5..0b5a84c9022c 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -385,6 +385,13 @@ static int sierra_net_parse_lsi(struct usbnet *dev, char 
*data, int datalen)
return -1;
}
 
+   /* Validate the session state */
+   if (lsi->session_state == SIERRA_NET_SESSION_IDLE) {
+   netdev_err(dev->net, "Session idle, 0x%02x\n",
+  lsi->session_state);
+   return 0;
+   }
+
/* Validate the protocol  - only support UMTS for now */
if (lsi->protocol == SIERRA_NET_PROTOCOL_UMTS) {
struct lsi_umts_single *single = (struct lsi_umts_single *)lsi;
@@ -418,13 +425,6 @@ static int sierra_net_parse_lsi(struct usbnet *dev, char 
*data, int datalen)
return 0;
}
 
-   /* Validate the session state */
-   if (lsi->session_state == SIERRA_NET_SESSION_IDLE) {
-   netdev_err(dev->net, "Session idle, 0x%02x\n",
-   lsi->session_state);
-   return 0;
-   }
-
/* Set link_sense true */
return 1;
 }
-- 
2.11.0



[PATCH v3 2/2] sierra_net: Skip validating irrelevant fields for IDLE LSIs

2017-02-07 Thread Stefan Brüns
When the context is deactivated, the link_type is set to 0xff, which
triggers a warning message, and results in a wrong link status, as
the LSI is ignored.

Signed-off-by: Stefan Brüns 
---
 drivers/net/usb/sierra_net.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index 6300a4454ae5..0b5a84c9022c 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -385,6 +385,13 @@ static int sierra_net_parse_lsi(struct usbnet *dev, char 
*data, int datalen)
return -1;
}
 
+   /* Validate the session state */
+   if (lsi->session_state == SIERRA_NET_SESSION_IDLE) {
+   netdev_err(dev->net, "Session idle, 0x%02x\n",
+  lsi->session_state);
+   return 0;
+   }
+
/* Validate the protocol  - only support UMTS for now */
if (lsi->protocol == SIERRA_NET_PROTOCOL_UMTS) {
struct lsi_umts_single *single = (struct lsi_umts_single *)lsi;
@@ -418,13 +425,6 @@ static int sierra_net_parse_lsi(struct usbnet *dev, char 
*data, int datalen)
return 0;
}
 
-   /* Validate the session state */
-   if (lsi->session_state == SIERRA_NET_SESSION_IDLE) {
-   netdev_err(dev->net, "Session idle, 0x%02x\n",
-   lsi->session_state);
-   return 0;
-   }
-
/* Set link_sense true */
return 1;
 }
-- 
2.11.0



[PATCH v3 0/2] Fixes for sierra_net driver

2017-02-07 Thread Stefan Brüns
When trying to initiate a dual-stack (ipv4v6) connection, a MC7710, FW
version SWI9200X_03.05.24.00ap answers with an unsupported LSI. Add support
for this LSI.
Also the link_type should be ignored when going idle, otherwise the modem
is stuck in a bad link state.
Tested on MC7710, T-Mobile DE, APN internet.telekom, IPv4v6 PDP type. Both
IPv4 and IPv6 connections work.

v2: Do not overwrite protocol field in rx_fixup
v3: Remove leftover struct ethhdr *eth declaration

Stefan Brüns (2):
  sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications
  sierra_net: Skip validating irrelevant fields for IDLE LSIs

 drivers/net/usb/sierra_net.c | 111 +++
 1 file changed, 71 insertions(+), 40 deletions(-)

-- 
2.11.0



[PATCH v3 1/2] sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications

2017-02-07 Thread Stefan Brüns
If a context is configured as dualstack ("IPv4v6"), the modem indicates
the context activation with a slightly different indication message.
The dual-stack indication omits the link_type (IPv4/v6) and adds
additional address fields.
IPv6 LSIs are identical to IPv4 LSIs, but have a different link type.

Signed-off-by: Stefan Brüns 
---
v2: Do not overwrite protocol field in rx_fixup
v3: Remove leftover struct ethhdr *eth declaration

Example LSI LINK UP indication:

   00 ed 78 00 04 01 00 e9 0a 14 00 54 00 65 00 6c  ..xT.e.l
0010   00 65 00 6b 00 6f 00 6d 00 2e 00 64 00 65 48 03  .e.k.o.m...d.eH.
0020   c8 be d1 00 62 00 00 00 2c 80 f0 01 00 00 00 00  b...,...
0030   30 cb 04 4c 49 4e 4b 20 55 50 00 00 00 00 00 00  0..LINK UP..
0040   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
0050   00 00 00 00 04 0a 23 38 db 10 2a 01 05 98 88 c0  ..#8..*.
0060   1f da 00 01 00 01 91 23 a8 f9 00 00 00 00 00 00  ...#
0070   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
0080   00 04 0a 4a d2 d2 10 2a 01 05 98 07 ff 00 00 00  ...J...*
0090   10 00 74 02 10 02 10 04 0a 4a d2 d3 10 2a 01 05  ..t..J...*..
00a0   98 07 ff 00 00 00 10 00 74 02 10 02 11 00 00 00  t...
00b0   00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff 00  
00c0   00 00 00 00 00 c3 50 04 00 00 00 00 10 fe 80 00  ..P.
00d0   00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00  
00e0   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
00f0   00
---
 drivers/net/usb/sierra_net.c | 101 ---
 1 file changed, 66 insertions(+), 35 deletions(-)

diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index a251588762ec..6300a4454ae5 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -73,8 +73,6 @@ staticatomic_t iface_counter = ATOMIC_INIT(0);
 /* Private data structure */
 struct sierra_net_data {
 
-   u8 ethr_hdr_tmpl[ETH_HLEN]; /* ethernet header template for rx'd pkts */
-
u16 link_up;/* air link up or down */
u8 tx_hdr_template[4];  /* part of HIP hdr for tx'd packets */
 
@@ -122,6 +120,7 @@ struct param {
 
 /* LSI Protocol types */
 #define SIERRA_NET_PROTOCOL_UMTS  0x01
+#define SIERRA_NET_PROTOCOL_UMTS_DS   0x04
 /* LSI Coverage */
 #define SIERRA_NET_COVERAGE_NONE  0x00
 #define SIERRA_NET_COVERAGE_NOPACKET  0x01
@@ -129,7 +128,8 @@ struct param {
 /* LSI Session */
 #define SIERRA_NET_SESSION_IDLE   0x00
 /* LSI Link types */
-#define SIERRA_NET_AS_LINK_TYPE_IPv4  0x00
+#define SIERRA_NET_AS_LINK_TYPE_IPV4  0x00
+#define SIERRA_NET_AS_LINK_TYPE_IPV6  0x02
 
 struct lsi_umts {
u8 protocol;
@@ -137,9 +137,14 @@ struct lsi_umts {
__be16 length;
/* eventually use a union for the rest - assume umts for now */
u8 coverage;
-   u8 unused2[41];
+   u8 network_len; /* network name len */
+   u8 network[40]; /* network name (UCS2, bigendian) */
u8 session_state;
u8 unused3[33];
+} __packed;
+
+struct lsi_umts_single {
+   struct lsi_umts lsi;
u8 link_type;
u8 pdp_addr_len; /* NW-supplied PDP address len */
u8 pdp_addr[16]; /* NW-supplied PDP address (bigendian)) */
@@ -158,10 +163,31 @@ struct lsi_umts {
u8 reserved[8];
 } __packed;
 
+struct lsi_umts_dual {
+   struct lsi_umts lsi;
+   u8 pdp_addr4_len; /* NW-supplied PDP IPv4 address len */
+   u8 pdp_addr4[4];  /* NW-supplied PDP IPv4 address (bigendian)) */
+   u8 pdp_addr6_len; /* NW-supplied PDP IPv6 address len */
+   u8 pdp_addr6[16]; /* NW-supplied PDP IPv6 address (bigendian)) */
+   u8 unused4[23];
+   u8 dns1_addr4_len; /* NW-supplied 1st DNS v4 address len (bigendian) */
+   u8 dns1_addr4[4];  /* NW-supplied 1st DNS v4 address */
+   u8 dns1_addr6_len; /* NW-supplied 1st DNS v6 address len */
+   u8 dns1_addr6[16]; /* NW-supplied 1st DNS v6 address (bigendian)*/
+   u8 dns2_addr4_len; /* NW-supplied 2nd DNS v4 address len (bigendian) */
+   u8 dns2_addr4[4];  /* NW-supplied 2nd DNS v4 address */
+   u8 dns2_addr6_len; /* NW-supplied 2nd DNS v6 address len */
+   u8 dns2_addr6[16]; /* NW-supplied 2nd DNS v6 address (bigendian)*/
+   u8 unused5[68];
+} __packed;
+
 #define SIERRA_NET_LSI_COMMON_LEN  4
-#define SIERRA_NET_LSI_UMTS_LEN(sizeof(struct lsi_umts))
+#define SIERRA_NET_LSI_UMTS_LEN(sizeof(struct lsi_umts_single))
 #define SIERRA_NET_LSI_UMTS_STATUS_LEN \
(SIERRA_NET_LSI_UMTS_LEN - SIERRA_NET_LSI_COMMON_LEN)
+#define SIERRA_NET_LSI_UMTS_DS_LEN (sizeof(struct lsi_umts_dual))
+#define SIERRA_NET_LSI_UMTS_DS_STATUS_LEN \
+   (SIERRA_NET_LSI_UMTS_DS_LEN - SIERRA_NET_LSI_COMMON_LEN)
 
 /* Forward definitions */
 static void sierra_sync_timer(unsigned long syncdata);
@@ -191,10 +217,11 @@ 

<    1   2   3   4   5   6   7   8   9   10   >