* Re: [PATCH v6 10/12] usb: dbc: add handshake between debug target and host [not found] <201601261754.HqYDuGWL%fengguang.wu@intel.com> @ 2016-01-26 10:40 ` Julia Lawall 2016-01-26 11:01 ` Lu Baolu 0 siblings, 1 reply; 3+ messages in thread From: Julia Lawall @ 2016-01-26 10:40 UTC (permalink / raw) To: Lu Baolu; +Cc: kbuild-all, Greg Kroah-Hartman, linux-usb, linux-kernel Please check. As far as I can see, the call to early_xdbc_read ends up at xdbc_bulk_transfer, which return negative error codes on failure. julia On Tue, 26 Jan 2016, kbuild test robot wrote: > CC: kbuild-all@01.org > In-Reply-To: <1453781665-4714-11-git-send-email-baolu.lu@linux.intel.com> > TO: Lu Baolu <baolu.lu@linux.intel.com> > CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > CC: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com> > > Hi Lu, > > [auto build test WARNING on usb/usb-testing] > [also build test WARNING on v4.5-rc1 next-20160125] > [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] > > url: https://github.com/0day-ci/linux/commits/Lu-Baolu/usb-early-add-support-for-early-printk-through-USB3-debug-port/20160126-122049 > base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing > :::::: branch date: 5 hours ago > :::::: commit date: 5 hours ago > > >> drivers/usb/early/xhci-dbc.c:917:6-10: WARNING: Unsigned expression compared with zero: size > 0 > > git remote add linux-review https://github.com/0day-ci/linux > git remote update linux-review > git checkout cdae956781925bbc269faa7f40c931a2825be11a > vim +917 drivers/usb/early/xhci-dbc.c > > 5319db53 Lu Baolu 2016-01-26 901 > 5319db53 Lu Baolu 2016-01-26 902 /* hand over the owner of host from BIOS */ > 5319db53 Lu Baolu 2016-01-26 903 xdbc_bios_handoff(); > 5319db53 Lu Baolu 2016-01-26 904 > 5319db53 Lu Baolu 2016-01-26 905 ret = xdbc_setup(); > 5319db53 Lu Baolu 2016-01-26 906 if (ret < 0) { > 5319db53 Lu Baolu 2016-01-26 907 pr_notice("failed to setup xHCI DbC connection\n"); > 5319db53 Lu Baolu 2016-01-26 908 xdbcp->xhci_base = NULL; > 5319db53 Lu Baolu 2016-01-26 909 xdbcp->xdbc_reg = NULL; > 12cd5775 Lu Baolu 2016-01-26 910 xdbc_dump_debug_buffer(); > 5319db53 Lu Baolu 2016-01-26 911 return ret; > 5319db53 Lu Baolu 2016-01-26 912 } > 5319db53 Lu Baolu 2016-01-26 913 > cdae9567 Lu Baolu 2016-01-26 914 while (retry > 0) { > cdae9567 Lu Baolu 2016-01-26 915 early_xdbc_write(NULL, ping, strlen(ping)); > cdae9567 Lu Baolu 2016-01-26 916 size = early_xdbc_read(NULL, pong, 64); > cdae9567 Lu Baolu 2016-01-26 @917 if (size > 0) { > cdae9567 Lu Baolu 2016-01-26 918 xdbc_trace("%s: pong message: %s\n", __func__, pong); > cdae9567 Lu Baolu 2016-01-26 919 if (pong[0] == 'Y' || pong[0] == 'y') > cdae9567 Lu Baolu 2016-01-26 920 break; > cdae9567 Lu Baolu 2016-01-26 921 } else { > cdae9567 Lu Baolu 2016-01-26 922 xdbc_trace("%s: pong message error %d\n", > cdae9567 Lu Baolu 2016-01-26 923 __func__, size); > cdae9567 Lu Baolu 2016-01-26 924 } > cdae9567 Lu Baolu 2016-01-26 925 > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v6 10/12] usb: dbc: add handshake between debug target and host 2016-01-26 10:40 ` [PATCH v6 10/12] usb: dbc: add handshake between debug target and host Julia Lawall @ 2016-01-26 11:01 ` Lu Baolu 0 siblings, 0 replies; 3+ messages in thread From: Lu Baolu @ 2016-01-26 11:01 UTC (permalink / raw) To: Julia Lawall; +Cc: kbuild-all, Greg Kroah-Hartman, linux-usb, linux-kernel On 01/26/2016 06:40 PM, Julia Lawall wrote: > Please check. As far as I can see, the call to early_xdbc_read ends up at > xdbc_bulk_transfer, which return negative error codes on failure. Good catch. Thank you. I will correct it. > > julia > > On Tue, 26 Jan 2016, kbuild test robot wrote: > >> CC: kbuild-all@01.org >> In-Reply-To: <1453781665-4714-11-git-send-email-baolu.lu@linux.intel.com> >> TO: Lu Baolu <baolu.lu@linux.intel.com> >> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org> >> CC: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com> >> >> Hi Lu, >> >> [auto build test WARNING on usb/usb-testing] >> [also build test WARNING on v4.5-rc1 next-20160125] >> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] >> >> url: https://github.com/0day-ci/linux/commits/Lu-Baolu/usb-early-add-support-for-early-printk-through-USB3-debug-port/20160126-122049 >> base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing >> :::::: branch date: 5 hours ago >> :::::: commit date: 5 hours ago >> >>>> drivers/usb/early/xhci-dbc.c:917:6-10: WARNING: Unsigned expression compared with zero: size > 0 >> git remote add linux-review https://github.com/0day-ci/linux >> git remote update linux-review >> git checkout cdae956781925bbc269faa7f40c931a2825be11a >> vim +917 drivers/usb/early/xhci-dbc.c >> >> 5319db53 Lu Baolu 2016-01-26 901 >> 5319db53 Lu Baolu 2016-01-26 902 /* hand over the owner of host from BIOS */ >> 5319db53 Lu Baolu 2016-01-26 903 xdbc_bios_handoff(); >> 5319db53 Lu Baolu 2016-01-26 904 >> 5319db53 Lu Baolu 2016-01-26 905 ret = xdbc_setup(); >> 5319db53 Lu Baolu 2016-01-26 906 if (ret < 0) { >> 5319db53 Lu Baolu 2016-01-26 907 pr_notice("failed to setup xHCI DbC connection\n"); >> 5319db53 Lu Baolu 2016-01-26 908 xdbcp->xhci_base = NULL; >> 5319db53 Lu Baolu 2016-01-26 909 xdbcp->xdbc_reg = NULL; >> 12cd5775 Lu Baolu 2016-01-26 910 xdbc_dump_debug_buffer(); >> 5319db53 Lu Baolu 2016-01-26 911 return ret; >> 5319db53 Lu Baolu 2016-01-26 912 } >> 5319db53 Lu Baolu 2016-01-26 913 >> cdae9567 Lu Baolu 2016-01-26 914 while (retry > 0) { >> cdae9567 Lu Baolu 2016-01-26 915 early_xdbc_write(NULL, ping, strlen(ping)); >> cdae9567 Lu Baolu 2016-01-26 916 size = early_xdbc_read(NULL, pong, 64); >> cdae9567 Lu Baolu 2016-01-26 @917 if (size > 0) { >> cdae9567 Lu Baolu 2016-01-26 918 xdbc_trace("%s: pong message: %s\n", __func__, pong); >> cdae9567 Lu Baolu 2016-01-26 919 if (pong[0] == 'Y' || pong[0] == 'y') >> cdae9567 Lu Baolu 2016-01-26 920 break; >> cdae9567 Lu Baolu 2016-01-26 921 } else { >> cdae9567 Lu Baolu 2016-01-26 922 xdbc_trace("%s: pong message error %d\n", >> cdae9567 Lu Baolu 2016-01-26 923 __func__, size); >> cdae9567 Lu Baolu 2016-01-26 924 } >> cdae9567 Lu Baolu 2016-01-26 925 >> >> --- >> 0-DAY kernel test infrastructure Open Source Technology Center >> https://lists.01.org/pipermail/kbuild-all Intel Corporation >> ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v6 00/12] usb: early: add support for early printk through USB3 debug port
@ 2016-01-26 4:14 Lu Baolu
2016-01-26 4:14 ` [PATCH v6 10/12] usb: dbc: add handshake between debug target and host Lu Baolu
0 siblings, 1 reply; 3+ messages in thread
From: Lu Baolu @ 2016-01-26 4:14 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Lu Baolu
Hi,
This patch series adds support for early printk through USB3 debug port.
USB3 debug port is described in xHCI specification as an optional extended
capability.
The first patch adds a file in sysfs, through which users can check
whether the debug capability is supported by a specific host controller,
and the hardware state.
Patch 2 to 10 add the driver for xHCI debug capability. It interfaces with
the register set and provides the required ops (read/write/control) to upper
layers. Early printk is one consumer of these ops. The hooks for early printk
are introduced in patch 9. This design is similar to what we have done in
drivers/usb/early/ehci-dbgp.c.
Patch 11 is a minor change to usb_debug module. This change is required to
bind usb_debug with the USB3 debug device.
Patch 12 is the design document and user guide.
Change log:
v1->v2:
(1) Patch 1 re-implemented. "debugfs" has been replaced with sysfs.
The scope reduced from all extended capabilities to debug port
specific.
(2) Patch 11 changed. Removed unnecessary .bulk_out_size setting.
v2->v3:
(1) Patch 11 got acked by Johan Hovold.
v3->v4:
(1) Patch 1 code refactored by using xhci_find_ext_cap_by_id() helper.
(2) Patch 3 "bus hung state" changed to "port hung state" in commit message.
(3) Patch 12 added verified platform information.
v4->v5:
(1) Patch 1 & 3 code refactored by using xhci_find_next_ext_cap() helper.
(2) Patch 12 updated with more user guide information.
(3) All patches rebased to the new usb-next branch which contains commit
d5ddcdf(xhci: rework xhci extended capability list parsing functions).
v5->v6:
(1) refresh the patches against 4.5-rc1.
(2) change "usb: xhci: dbc" to "usb: dbc" in the patch titles as they
are not part of xhci driver.
Lu Baolu (12):
usb: xhci: add sysfs file for xHCI debug port
x86: fixmap: add permanent fixmap for xhci debug port
usb: dbc: probe and setup xhci debug capability
usb: dbc: add support for Intel xHCI dbc quirk
usb: dbc: add debug buffer
usb: dbc: add bulk out and bulk in interfaces
usb: dbc: handle dbc-configured exit
usb: dbc: handle endpoint stall
x86: early_printk: add USB3 debug port earlyprintk support
usb: dbc: add handshake between debug target and host
usb: serial: usb_debug: add support for dbc debug device
usb: doc: add document for xHCI DbC driver
.../ABI/testing/sysfs-bus-pci-drivers-xhci_hcd | 23 +
Documentation/kernel-parameters.txt | 1 +
Documentation/usb/xhci-dbc.txt | 350 +++++
MAINTAINERS | 8 +
arch/x86/Kconfig.debug | 12 +
arch/x86/include/asm/fixmap.h | 4 +
arch/x86/kernel/early_printk.c | 5 +
drivers/usb/early/Makefile | 1 +
drivers/usb/early/xhci-dbc.c | 1394 ++++++++++++++++++++
drivers/usb/host/Makefile | 2 +-
drivers/usb/host/xhci-ext-caps.h | 5 +
drivers/usb/host/xhci-sysfs.c | 65 +
drivers/usb/host/xhci.c | 4 +
drivers/usb/host/xhci.h | 4 +
drivers/usb/serial/usb_debug.c | 28 +-
include/linux/usb/xhci-dbc.h | 224 ++++
16 files changed, 2126 insertions(+), 4 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd
create mode 100644 Documentation/usb/xhci-dbc.txt
create mode 100644 drivers/usb/early/xhci-dbc.c
create mode 100644 drivers/usb/host/xhci-sysfs.c
create mode 100644 include/linux/usb/xhci-dbc.h
--
2.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v6 10/12] usb: dbc: add handshake between debug target and host 2016-01-26 4:14 [PATCH v6 00/12] usb: early: add support for early printk through USB3 debug port Lu Baolu @ 2016-01-26 4:14 ` Lu Baolu 0 siblings, 0 replies; 3+ messages in thread From: Lu Baolu @ 2016-01-26 4:14 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Lu Baolu After DbC setup, debug target needs to wait until tty driver and application (e.g. mincom) on debug taget start. Otherwise, out messages might be ignored. This patch adds a ping/pong mechanism between debug target and host. Debug target will be waiting there until user presses 'Y' or 'y' in the tty application. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> --- drivers/usb/early/xhci-dbc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c index 6c24ba0..37c5c87 100644 --- a/drivers/usb/early/xhci-dbc.c +++ b/drivers/usb/early/xhci-dbc.c @@ -32,6 +32,9 @@ static struct xdbc_state xdbc_stat; static struct xdbc_state *xdbcp = &xdbc_stat; +static int early_xdbc_read(struct console *con, char *str, unsigned n); +static void early_xdbc_write(struct console *con, const char *str, u32 n); + #ifdef DBC_DEBUG #define XDBC_DEBUG_BUF_SIZE (PAGE_SIZE * 32) #define MSG_MAX_LINE 128 @@ -860,8 +863,12 @@ int __init early_xdbc_init(char *s) { u32 bus = 0, dev = 0, func = 0; unsigned long dbgp_num = 0; + char *ping = "Press Y to continue...\n"; + char pong[64]; + size_t size; u32 offset; int ret; + int retry = 20; if (!early_pci_allowed()) return -EPERM; @@ -904,6 +911,21 @@ int __init early_xdbc_init(char *s) return ret; } + while (retry > 0) { + early_xdbc_write(NULL, ping, strlen(ping)); + size = early_xdbc_read(NULL, pong, 64); + if (size > 0) { + xdbc_trace("%s: pong message: %s\n", __func__, pong); + if (pong[0] == 'Y' || pong[0] == 'y') + break; + } else { + xdbc_trace("%s: pong message error %d\n", + __func__, size); + } + + retry--; + } + return 0; } @@ -1325,6 +1347,11 @@ int xdbc_bulk_write(const char *bytes, int size) * Start a bulk-in or bulk-out transfer, wait until transfer completion * or error. Return the count of actually transferred bytes or error. */ +static int early_xdbc_read(struct console *con, char *str, unsigned n) +{ + return xdbc_bulk_read(str, n, 0); +} + static void early_xdbc_write(struct console *con, const char *str, u32 n) { int chunk, ret; -- 2.1.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-26 11:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <201601261754.HqYDuGWL%fengguang.wu@intel.com>
2016-01-26 10:40 ` [PATCH v6 10/12] usb: dbc: add handshake between debug target and host Julia Lawall
2016-01-26 11:01 ` Lu Baolu
2016-01-26 4:14 [PATCH v6 00/12] usb: early: add support for early printk through USB3 debug port Lu Baolu
2016-01-26 4:14 ` [PATCH v6 10/12] usb: dbc: add handshake between debug target and host Lu Baolu
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.