From patchwork Thu Apr 23 10:19:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11505431 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 0C5AE913 for ; Thu, 23 Apr 2020 10:22:17 +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 DD3A120704 for ; Thu, 23 Apr 2020 10:22:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="TUB8DkG4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD3A120704 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.de Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jRYyD-0000DC-Bk; Thu, 23 Apr 2020 10:20:37 +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.92) (envelope-from ) id 1jRYyC-0000Cf-97 for xen-devel@lists.xen.org; Thu, 23 Apr 2020 10:20:36 +0000 X-Inumbo-ID: 121e585a-854c-11ea-933f-12813bfff9fa Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 121e585a-854c-11ea-933f-12813bfff9fa; Thu, 23 Apr 2020 10:20:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587637236; x=1619173236; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=UEPw6O3BljFwct47izeBxnxQHVPFN3vhQxafqb4+2o0=; b=TUB8DkG4tjLKAkHS0Yxn/ZQGIfJRRKv+Nfn0OQ1+6mYGIoC0CrPkCNlt fIMzIjj2xSbEIQ1utjNHMEoK2IoQAJo9PEXM7kIVgAEaQ/+DOWP2/4gL7 mxLMpjyZowBMnG+6JVKbpbZknXNmS8nxXKzAnm9HSzRKaviYj5+iLoGON U=; IronPort-SDR: pE/Vkb8G3n4UPrsL4P+p6sU4qAL/VOKEtuXsUVsH+a21YJdftrc4H6v2Z69Z4vKp41Icb2c8yc ap/6DAKwgfyg== X-IronPort-AV: E=Sophos;i="5.73,306,1583193600"; d="scan'208";a="39000814" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 23 Apr 2020 10:20:35 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id F003F1A096C; Thu, 23 Apr 2020 10:20:34 +0000 (UTC) Received: from EX13D05EUC001.ant.amazon.com (10.43.164.118) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:03 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D05EUC001.ant.amazon.com (10.43.164.118) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:02 +0000 Received: from dev-dsk-wipawel-1a-0c4e6d58.eu-west-1.amazon.com (10.4.134.33) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Apr 2020 10:20:01 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF v2 v2 1/4] lib: Add XEN_MAJOR() and XEN_MINOR() macros Date: Thu, 23 Apr 2020 10:19:52 +0000 Message-ID: <20200423101955.13761-2-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200423101955.13761-1-wipawel@amazon.de> References: <20200423101955.13761-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: julien@xen.org, wipawel@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, wipawel@amazon.de, nmanthey@amazon.de Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" These are just a simple macros obtaining major, minor values as returned by xen_version hypercall. Signed-off-by: Pawel Wieczorkiewicz --- include/xtf/lib.h | 3 +++ tests/xsa-213/main.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/xtf/lib.h b/include/xtf/lib.h index 3348464..40e5731 100644 --- a/include/xtf/lib.h +++ b/include/xtf/lib.h @@ -20,6 +20,9 @@ #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +#define XEN_MAJOR(v) (((v) >> 16) & 0xFFFF) +#define XEN_MINOR(v) ((v) & 0xFFFF) + void __noreturn panic(const char *fmt, ...) __printf(1, 2); #define ASSERT(cond) \ diff --git a/tests/xsa-213/main.c b/tests/xsa-213/main.c index 64e7065..0353168 100644 --- a/tests/xsa-213/main.c +++ b/tests/xsa-213/main.c @@ -121,8 +121,8 @@ void test_main(void) { long rc, xen_version = hypercall_xen_version(XENVER_version, NULL); - printk("Found Xen %ld.%ld\n", - (xen_version >> 16) & 0xffff, xen_version & 0xffff); + printk("Found Xen %ld.%ld\n", XEN_MAJOR(xen_version), + XEN_MINOR(xen_version)); xtf_set_idte(X86_VEC_AVAIL, &idte); From patchwork Thu Apr 23 10:19:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11505415 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 583BA913 for ; Thu, 23 Apr 2020 10:20:55 +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 2C76720704 for ; Thu, 23 Apr 2020 10:20:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="GSdEeXrT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C76720704 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.de Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jRYyG-0000Ep-LW; Thu, 23 Apr 2020 10:20:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jRYyF-0000EQ-Lm for xen-devel@lists.xen.org; Thu, 23 Apr 2020 10:20:39 +0000 X-Inumbo-ID: 1451a91a-854c-11ea-b4f4-bc764e2007e4 Received: from smtp-fw-6002.amazon.com (unknown [52.95.49.90]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1451a91a-854c-11ea-b4f4-bc764e2007e4; Thu, 23 Apr 2020 10:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587637239; x=1619173239; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=j3FfvDGo3qJ5fQVQXM9t+enbQsU+W2azdmSHMXpnb3c=; b=GSdEeXrT4yJAXvX0AYbSsqOuut8UaGIicNq8g+KRdGJCmyt3WYibXFcC SKfRJ9600pkSOCNW3eQrAb+b2ouE9Xp1Pcx2OvMl7s5bA/5eNi0PYQoqg kMp/ozUq7O7s/jkKCBADY2NMVdmi5wlWy6Aj5Hh7uU0k+lVJc9wCDHB+C M=; IronPort-SDR: rbU6kMBziHV1szQVK5WuWQIjmpuakKme6MeqhKcZJasEf/NfJOmBftSy5gESGJTu8LImbnCk5A bd1wItlvqVpg== X-IronPort-AV: E=Sophos;i="5.73,306,1583193600"; d="scan'208";a="26939148" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-397e131e.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 23 Apr 2020 10:20:38 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2c-397e131e.us-west-2.amazon.com (Postfix) with ESMTPS id B2B38A271A; Thu, 23 Apr 2020 10:20:37 +0000 (UTC) Received: from EX13D02EUB001.ant.amazon.com (10.43.166.150) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:05 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D02EUB001.ant.amazon.com (10.43.166.150) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:05 +0000 Received: from dev-dsk-wipawel-1a-0c4e6d58.eu-west-1.amazon.com (10.4.134.33) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Apr 2020 10:20:03 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF v2 v2 2/4] lib: always append CR after LF in vsnprintf() Date: Thu, 23 Apr 2020 10:19:53 +0000 Message-ID: <20200423101955.13761-3-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200423101955.13761-1-wipawel@amazon.de> References: <20200423101955.13761-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: julien@xen.org, wipawel@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, wipawel@amazon.de, nmanthey@amazon.de Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The explicit LFCR sequence guarantees proper line by line formatting in the output. The '\n' character alone on some terminals is not automatically converted to LFCR. Signed-off-by: Pawel Wieczorkiewicz --- Changed since v1: * Emit CRLF instead of LFCR common/libc/vsnprintf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/libc/vsnprintf.c b/common/libc/vsnprintf.c index a49fd30..b9a4fab 100644 --- a/common/libc/vsnprintf.c +++ b/common/libc/vsnprintf.c @@ -284,7 +284,17 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) /* Put regular characters into the destination. */ if ( *fmt != '%' ) { + /* + * The '\n' character alone on some terminals is not automatically + * converted to CRLF. + * The explicit CRLF sequence guarantees proper line by line + * formatting in the output. + */ + if ( *fmt == '\n' && str < end ) + PUT('\r'); + PUT(*fmt); + continue; } From patchwork Thu Apr 23 10:19:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11505427 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 B840E1667 for ; Thu, 23 Apr 2020 10:22:07 +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 9464C20704 for ; Thu, 23 Apr 2020 10:22:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="Iw/V6jbK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9464C20704 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.de Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jRYyJ-0000GE-0Y; Thu, 23 Apr 2020 10:20:43 +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.92) (envelope-from ) id 1jRYyH-0000FJ-98 for xen-devel@lists.xen.org; Thu, 23 Apr 2020 10:20:41 +0000 X-Inumbo-ID: 14fe0462-854c-11ea-933f-12813bfff9fa Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 14fe0462-854c-11ea-933f-12813bfff9fa; Thu, 23 Apr 2020 10:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587637241; x=1619173241; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=HiisovRaNwUVzKLO6bCQTn0qmgMmDEJUOogYX7aiDJQ=; b=Iw/V6jbKdwyK5l81Rnpm9Nxg/yUawksT4C3FBkFFEqjiST7JlGgmFZ0o +a90y98N/iBC5kA6AwfT4qyTFYWWXEvvMBK9ZvVuWNPujh0XsULSpKt/n PZOn3lS5mOkf+VPduWTWfsRHHbK3xdKYQbVJc+Gfqf0jfbTJTbC1W0zar 0=; IronPort-SDR: zs0Duf4Xub3vFvvZ5PitbdHS78SI57IbNFprip9HCA3wj9U1K0m3dvhPBBKHJFnAhZVAtOGfwo PK+s4w8LYcBw== X-IronPort-AV: E=Sophos;i="5.73,306,1583193600"; d="scan'208";a="39000829" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2c-6f38efd9.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 23 Apr 2020 10:20:40 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2c-6f38efd9.us-west-2.amazon.com (Postfix) with ESMTPS id C6A11A2440; Thu, 23 Apr 2020 10:20:39 +0000 (UTC) Received: from EX13D02EUB004.ant.amazon.com (10.43.166.221) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:07 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D02EUB004.ant.amazon.com (10.43.166.221) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:06 +0000 Received: from dev-dsk-wipawel-1a-0c4e6d58.eu-west-1.amazon.com (10.4.134.33) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Apr 2020 10:20:05 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF v2 v2 3/4] Enabled serial writing for hvm guests Date: Thu, 23 Apr 2020 10:19:54 +0000 Message-ID: <20200423101955.13761-4-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200423101955.13761-1-wipawel@amazon.de> References: <20200423101955.13761-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: julien@xen.org, wipawel@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, wipawel@amazon.de, nmanthey@amazon.de Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Paul Semel setup.c: PV console writing is not working in Xen 4.2 for hvm guests, so we make xtf write to COM1 serial port to get its output Signed-off-by: Paul Semel Signed-off-by: Pawel Wieczorkiewicz --- Changed since v1: * Increase callbacks array arch/x86/setup.c | 14 ++++++++++++++ common/console.c | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/setup.c b/arch/x86/setup.c index 3c84e96..f6fa4df 100644 --- a/arch/x86/setup.c +++ b/arch/x86/setup.c @@ -238,6 +238,13 @@ static void qemu_console_write(const char *buf, size_t len) : "d" (0x12)); } +static void com1_write(const char *buf, size_t len) +{ + asm volatile("rep; outsb" + : "+S" (buf), "+c" (len) + : "d" (0x3f8)); +} + static void xen_console_write(const char *buf, size_t len) { hypercall_console_write(buf, len); @@ -246,7 +253,14 @@ static void xen_console_write(const char *buf, size_t len) void arch_setup(void) { if ( IS_DEFINED(CONFIG_HVM) && !pvh_start_info ) + { register_console_callback(qemu_console_write); + } + + if ( IS_DEFINED(CONFIG_HVM) ) + { + register_console_callback(com1_write); + } register_console_callback(xen_console_write); diff --git a/common/console.c b/common/console.c index 0724fc9..00dbbca 100644 --- a/common/console.c +++ b/common/console.c @@ -13,8 +13,9 @@ * - Xen hypervisor console * - PV console * - Qemu debug console + * - COM1 serial console */ -static cons_output_cb output_fns[3]; +static cons_output_cb output_fns[4]; static unsigned int nr_cons_cb; /* Guest PV console details. */ From patchwork Thu Apr 23 10:19:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11505429 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 80033913 for ; Thu, 23 Apr 2020 10:22:14 +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 5CB1820704 for ; Thu, 23 Apr 2020 10:22:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="jahZ6TB8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CB1820704 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.de Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jRYyN-0000Kc-Fw; Thu, 23 Apr 2020 10:20:47 +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.92) (envelope-from ) id 1jRYyM-0000Jo-9R for xen-devel@lists.xen.org; Thu, 23 Apr 2020 10:20:46 +0000 X-Inumbo-ID: 165d3ce2-854c-11ea-933f-12813bfff9fa Received: from smtp-fw-9101.amazon.com (unknown [207.171.184.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 165d3ce2-854c-11ea-933f-12813bfff9fa; Thu, 23 Apr 2020 10:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587637243; x=1619173243; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=CjFqQ+keD3M1wnKEBrWhKs4cY4eZTedQKArYB4JSIjI=; b=jahZ6TB8nHqnN8S6uIs8JGd/aYoz8wo2mwnSYi5FmZIxkNxMygSuYdUv 4vS+DBY074lUvZmmV80tSZwFzIQX2L6K608yD6mcW/C+Z+AmMRu7+d035 OVs+PF+1l5PtUJ065yDtr40SZI3D04mwDGr0n7xPN0ZOAzXc13T6PIsg8 I=; IronPort-SDR: /jbhi4Q56Gsl6ZEf5UWIXHnH0gc7bFQXGSzWLpPBXKEuTjzOlH1g7u/iYEjqd2B076yb/8p1qv NHYEjCIi1AbQ== X-IronPort-AV: E=Sophos;i="5.73,306,1583193600"; d="scan'208";a="30669955" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 23 Apr 2020 10:20:42 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com (Postfix) with ESMTPS id EF32BC693C; Thu, 23 Apr 2020 10:20:41 +0000 (UTC) Received: from EX13D02EUB002.ant.amazon.com (10.43.166.170) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:09 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D02EUB002.ant.amazon.com (10.43.166.170) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Apr 2020 10:20:08 +0000 Received: from dev-dsk-wipawel-1a-0c4e6d58.eu-west-1.amazon.com (10.4.134.33) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Apr 2020 10:20:07 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF v2 v2 4/4] setup: Detect and display Xen version on test startup Date: Thu, 23 Apr 2020 10:19:55 +0000 Message-ID: <20200423101955.13761-5-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200423101955.13761-1-wipawel@amazon.de> References: <20200423101955.13761-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: julien@xen.org, wipawel@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, wipawel@amazon.de, nmanthey@amazon.de Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In arch_setup() detect Xen version by issuing xen_version hypercall and optionally pass the version to main_xtf(). Signed-off-by: Pawel Wieczorkiewicz --- Changed since v1: * Do not limit setup_pv_console() to HVM only. It does not crash. It merely panics because the callbacks array wasn't increased. arch/x86/setup.c | 8 +++++++- common/setup.c | 6 +++++- include/xtf/framework.h | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/x86/setup.c b/arch/x86/setup.c index f6fa4df..15ca3bb 100644 --- a/arch/x86/setup.c +++ b/arch/x86/setup.c @@ -250,8 +250,10 @@ static void xen_console_write(const char *buf, size_t len) hypercall_console_write(buf, len); } -void arch_setup(void) +void arch_setup(int *version) { + int xen_version; + if ( IS_DEFINED(CONFIG_HVM) && !pvh_start_info ) { register_console_callback(qemu_console_write); @@ -272,6 +274,10 @@ void arch_setup(void) init_hypercalls(); + xen_version = hypercall_xen_version(XENVER_version, NULL); + if ( version ) + *version = xen_version; + if ( !is_initdomain() ) { setup_pv_console(); diff --git a/common/setup.c b/common/setup.c index 932fc09..1d3da15 100644 --- a/common/setup.c +++ b/common/setup.c @@ -19,9 +19,13 @@ */ void __noreturn xtf_main(void) { - arch_setup(); + int xen_version; + + arch_setup(&xen_version); printk("--- Xen Test Framework ---\n"); + printk("Found Xen: %d.%d\n", XEN_MAJOR(xen_version), + XEN_MINOR(xen_version)); printk("Environment: %s\n", environment_description); printk("%s\n", test_title); diff --git a/include/xtf/framework.h b/include/xtf/framework.h index a71bf39..6664733 100644 --- a/include/xtf/framework.h +++ b/include/xtf/framework.h @@ -2,7 +2,7 @@ #define XTF_FRAMEWORK_H /* To be implemented by each arch */ -void arch_setup(void); +void arch_setup(int *); void test_setup(void); /* Single line summary of execution environment. */