From patchwork Wed Aug 28 08:00:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11118151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D54921398 for ; Wed, 28 Aug 2019 08:02:10 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BBFB22339E for ; Wed, 28 Aug 2019 08:02:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBFB22339E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i2ssr-0001kM-LX; Wed, 28 Aug 2019 08:00:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i2ssq-0001kD-QU for xen-devel@lists.xenproject.org; Wed, 28 Aug 2019 08:00:48 +0000 X-Inumbo-ID: eb240aff-c969-11e9-ae43-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id eb240aff-c969-11e9-ae43-12813bfff9fa; Wed, 28 Aug 2019 08:00:37 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E53AAAD79; Wed, 28 Aug 2019 08:00:35 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 28 Aug 2019 10:00:25 +0200 Message-Id: <20190828080028.18205-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190828080028.18205-1-jgross@suse.com> References: <20190828080028.18205-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v3 1/4] xen: use common output function in debugtrace X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Today dumping the debugtrace buffers is done via sercon_puts(), while direct printing of trace entries (after toggling output to the console) is using serial_puts(). Use sercon_puts() in both cases, as the difference between both is not really making sense. In order to prepare moving debugtrace functionality to an own source file rename sercon_puts() to console_serial_puts() and make it globally visible. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- xen/drivers/char/console.c | 18 +++++++++--------- xen/include/xen/console.h | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index d67e1993f2..f49c6f29a8 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -346,7 +346,7 @@ void console_giveback(int id) serial_steal_fn = NULL; } -static void sercon_puts(const char *s, size_t nr) +void console_serial_puts(const char *s, size_t nr) { if ( serial_steal_fn != NULL ) serial_steal_fn(s, nr); @@ -388,7 +388,7 @@ static void dump_console_ring_key(unsigned char key) c += len; } - sercon_puts(buf, sofar); + console_serial_puts(buf, sofar); video_puts(buf, sofar); free_xenheap_pages(buf, order); @@ -547,7 +547,7 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, /* Use direct console output as it could be interactive */ spin_lock_irq(&console_lock); - sercon_puts(kbuf, kcount); + console_serial_puts(kbuf, kcount); video_puts(kbuf, kcount); #ifdef CONFIG_X86 @@ -674,7 +674,7 @@ static void __putstr(const char *str) ASSERT(spin_is_locked(&console_lock)); - sercon_puts(str, len); + console_serial_puts(str, len); video_puts(str, len); #ifdef CONFIG_X86 @@ -1186,12 +1186,12 @@ static void debugtrace_dump_worker(void) /* Print oldest portion of the ring. */ ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0); if ( debugtrace_buf[debugtrace_prd] != '\0' ) - sercon_puts(&debugtrace_buf[debugtrace_prd], - debugtrace_bytes - debugtrace_prd - 1); + console_serial_puts(&debugtrace_buf[debugtrace_prd], + debugtrace_bytes - debugtrace_prd - 1); /* Print youngest portion of the ring. */ debugtrace_buf[debugtrace_prd] = '\0'; - sercon_puts(&debugtrace_buf[0], debugtrace_prd); + console_serial_puts(&debugtrace_buf[0], debugtrace_prd); memset(debugtrace_buf, '\0', debugtrace_bytes); @@ -1274,8 +1274,8 @@ void debugtrace_printk(const char *fmt, ...) { unsigned int n = scnprintf(cntbuf, sizeof(cntbuf), "%u ", ++count); - serial_puts(sercon_handle, cntbuf, n); - serial_puts(sercon_handle, buf, nr); + console_serial_puts(cntbuf, n); + console_serial_puts(buf, nr); } else { diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h index ba914f9e5b..53c56191ba 100644 --- a/xen/include/xen/console.h +++ b/xen/include/xen/console.h @@ -46,6 +46,9 @@ void console_giveback(int id); int console_suspend(void); int console_resume(void); +/* Emit a string via the serial console. */ +void console_serial_puts(const char *s, size_t nr); + extern int8_t opt_console_xen; #endif /* __CONSOLE_H__ */