Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-12 Thread Thomas Gleixner
On Sat, 12 Nov 2016, Lu Baolu wrote: > On 11/11/2016 08:28 PM, Peter Zijlstra wrote: > > Again, a UART rules. Make a virtual UART in hardware, that'd be totally > > awesome. This thing, I'm not convinced its worth having. > > This is the initial work. It helps at least in cases where people need >

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-11 Thread Lu Baolu
Hi Peter, On 11/11/2016 08:28 PM, Peter Zijlstra wrote: > On Fri, Nov 11, 2016 at 12:33:29PM +0800, Lu Baolu wrote: > >> Things become complicated when it comes to USB debug port. >> But it's still addressable. >> >> At this time, we can do it like this. >> >> write() >> { >> if (in_nmi() &&

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-11 Thread Peter Zijlstra
On Fri, Nov 11, 2016 at 12:33:29PM +0800, Lu Baolu wrote: > Things become complicated when it comes to USB debug port. > But it's still addressable. > > At this time, we can do it like this. > > write() > { > if (in_nmi() && raw_spin_is_locked(&lock)) > return; > > raw

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi Peter, On 11/10/2016 07:44 PM, Peter Zijlstra wrote: > On Thu, Nov 10, 2016 at 09:56:41AM +0100, Thomas Gleixner wrote: >> On Thu, 10 Nov 2016, Lu Baolu wrote: >>> This seems to be a common issue for all early printk drivers. >> No. The other early printk drivers like serial do not have that pr

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi, On 11/11/2016 10:24 AM, Lu Baolu wrote: >> The only thing you can do to make this work is to prevent printing in NMI >> > context: >> > >> > write() >> > { >> >if (in_nmi()) >> >return; >> > >> >raw_spinlock_irqsave(&lock, flags); >> > >> > >> > That fully seria

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi, On 11/10/2016 04:56 PM, Thomas Gleixner wrote: > On Thu, 10 Nov 2016, Lu Baolu wrote: >> On 11/09/2016 05:37 PM, Thomas Gleixner wrote: >>> On Tue, 1 Nov 2016, Lu Baolu wrote: +static void early_xdbc_write(struct console *con, const char *str, u32 n) +{ + int chunk, ret; +

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Peter Zijlstra
On Thu, Nov 10, 2016 at 09:56:41AM +0100, Thomas Gleixner wrote: > On Thu, 10 Nov 2016, Lu Baolu wrote: > > This seems to be a common issue for all early printk drivers. > > No. The other early printk drivers like serial do not have that problem as > they simply do: > >while (*buf) { >

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Thomas Gleixner
On Thu, 10 Nov 2016, Lu Baolu wrote: > On 11/09/2016 05:37 PM, Thomas Gleixner wrote: > > On Tue, 1 Nov 2016, Lu Baolu wrote: > >> +static void early_xdbc_write(struct console *con, const char *str, u32 n) > >> +{ > >> + int chunk, ret; > >> + static char buf[XDBC_MAX_PACKET]; > >> + int use_cr

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Lu Baolu
Hi, On 11/09/2016 05:37 PM, Thomas Gleixner wrote: > On Tue, 1 Nov 2016, Lu Baolu wrote: >> +static void early_xdbc_write(struct console *con, const char *str, u32 n) >> +{ >> +int chunk, ret; >> +static char buf[XDBC_MAX_PACKET]; >> +int use_cr = 0; >> + >> +if (!xdbc.xdbc_reg) >>

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Lu Baolu
Hi, On 11/09/2016 05:23 PM, Thomas Gleixner wrote: > On Tue, 1 Nov 2016, Lu Baolu wrote: >> +static int __init xdbc_init(void) >> +{ > ... >> +base = ioremap_nocache(xdbc.xhci_start, xdbc.xhci_length); >> +if (!base) { >> +xdbc_trace("failed to remap the io address\n"); >> +

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Thomas Gleixner
On Tue, 1 Nov 2016, Lu Baolu wrote: > +static void early_xdbc_write(struct console *con, const char *str, u32 n) > +{ > + int chunk, ret; > + static char buf[XDBC_MAX_PACKET]; > + int use_cr = 0; > + > + if (!xdbc.xdbc_reg) > + return; > + memset(buf, 0, XDBC_MAX_PAC

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Thomas Gleixner
On Tue, 1 Nov 2016, Lu Baolu wrote: > +static int __init xdbc_init(void) > +{ ... > + base = ioremap_nocache(xdbc.xhci_start, xdbc.xhci_length); > + if (!base) { > + xdbc_trace("failed to remap the io address\n"); > + ret = -ENOMEM; > + goto free_and_quit

[PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-10-31 Thread Lu Baolu
xHCI debug capability (DbC) is an optional but standalone functionality provided by an xHCI host controller. Software learns this capability by walking through the extended capability list of the host. xHCI specification describes DbC in section 7.6. This patch introduces the code to probe and ini