From patchwork Thu Apr 16 09:41:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11492573 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 64C1914DD for ; Thu, 16 Apr 2020 09:42:25 +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 417BE21BE5 for ; Thu, 16 Apr 2020 09:42:25 +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="FdJNGvyi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 417BE21BE5 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.89) (envelope-from ) id 1jP122-0005Tt-Pd; Thu, 16 Apr 2020 09:42:02 +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 1jP121-0005To-3l for xen-devel@lists.xen.org; Thu, 16 Apr 2020 09:42:01 +0000 X-Inumbo-ID: 845095eb-7fc6-11ea-8b6d-12813bfff9fa Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 845095eb-7fc6-11ea-8b6d-12813bfff9fa; Thu, 16 Apr 2020 09:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587030120; x=1618566120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=UEPw6O3BljFwct47izeBxnxQHVPFN3vhQxafqb4+2o0=; b=FdJNGvyiZtCeHWoHX1X013xozj8fgiAkmZWhfXDp5xpL9V3l7hHdBCL7 7iogntAJcNqeQwtuE/Vhx2fviuoZIpxsINYrX0F9fnW4CLOFZjnFXsOR5 HPinekU4dKxJw6Mroi84kcNWnZGZzHQCmcjQwsynVak5xe1Ej7QLd9vcO I=; IronPort-SDR: awgMYQycTtlz5joRHfcsa6TCbyYnbC4FGLuXeI+yN/YVQg4UmtZOk46pq8uR8pMjgVjQmMzR+p r5roaCCx9irw== X-IronPort-AV: E=Sophos;i="5.72,390,1580774400"; d="scan'208";a="37396512" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-69849ee2.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 16 Apr 2020 09:41:58 +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-69849ee2.us-west-2.amazon.com (Postfix) with ESMTPS id F102BA2264; Thu, 16 Apr 2020 09:41:56 +0000 (UTC) Received: from EX13D05EUC003.ant.amazon.com (10.43.164.207) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:41:56 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D05EUC003.ant.amazon.com (10.43.164.207) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:41:55 +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, 16 Apr 2020 09:41:54 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF 1/4] lib: Add XEN_MAJOR() and XEN_MINOR() macros Date: Thu, 16 Apr 2020 09:41:38 +0000 Message-ID: <20200416094141.65120-2-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200416094141.65120-1-wipawel@amazon.de> References: <20200416094141.65120-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: julien@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, Pawel Wieczorkiewicz , 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 16 09:41:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11492577 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 4E89B112C for ; Thu, 16 Apr 2020 09:42:47 +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 2A30721BE5 for ; Thu, 16 Apr 2020 09:42:46 +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="cujHMR7Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A30721BE5 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.89) (envelope-from ) id 1jP127-0005VF-DR; Thu, 16 Apr 2020 09:42:07 +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 1jP126-0005Uw-3n for xen-devel@lists.xen.org; Thu, 16 Apr 2020 09:42:06 +0000 X-Inumbo-ID: 85a1bfb4-7fc6-11ea-8b6d-12813bfff9fa Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 85a1bfb4-7fc6-11ea-8b6d-12813bfff9fa; Thu, 16 Apr 2020 09:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587030122; x=1618566122; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=uIb4xj2tgH7IFsq9Zy2xIFcyIZN50bCT56Bc23fuUE0=; b=cujHMR7Y93oSRRxeSRWg+ByVzMEafY8GKa/lhBs35exzG1c/HQJP6WH1 Z/ffLINbNA/U40Kbcn7vCn1vxBOsJuxjc7QhH0/qomiHL8ahR3OUKR8/C qYvNEzyN5gjPlYcLudJpZtsILwowC9Jde4hF05BxW/keM4DgRGR7Rhsnn Q=; IronPort-SDR: M67prEiEzjjQKWR1atCMO4W6H/f51di5RQ5Hs/4aHqemofZyX4FLhlXDWavxFVIqCyLtZaGssN SYmgjSgA2etQ== X-IronPort-AV: E=Sophos;i="5.72,390,1580774400"; d="scan'208";a="37396515" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 16 Apr 2020 09:42:00 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com (Postfix) with ESMTPS id DF99DA1F58; Thu, 16 Apr 2020 09:41:58 +0000 (UTC) Received: from EX13D05EUB001.ant.amazon.com (10.43.166.87) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:41:58 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D05EUB001.ant.amazon.com (10.43.166.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:41:57 +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, 16 Apr 2020 09:41:55 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF 2/4] lib: always append CR after LF in vsnprintf() Date: Thu, 16 Apr 2020 09:41:39 +0000 Message-ID: <20200416094141.65120-3-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200416094141.65120-1-wipawel@amazon.de> References: <20200416094141.65120-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: julien@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, Pawel Wieczorkiewicz , 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 --- common/libc/vsnprintf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/libc/vsnprintf.c b/common/libc/vsnprintf.c index a49fd30..3202137 100644 --- a/common/libc/vsnprintf.c +++ b/common/libc/vsnprintf.c @@ -285,6 +285,16 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) if ( *fmt != '%' ) { PUT(*fmt); + + /* + * The '\n' character alone on some terminals is not automatically + * converted to LFCR. + * The explicit LFCR sequence guarantees proper line by line + * formatting in the output. + */ + if ( *fmt == '\n' && str < end ) + PUT('\r'); + continue; } From patchwork Thu Apr 16 09:41:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11492575 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 8FB58112C for ; Thu, 16 Apr 2020 09:42:43 +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 6BEED21BE5 for ; Thu, 16 Apr 2020 09:42:43 +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="IVzJqfan" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BEED21BE5 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.89) (envelope-from ) id 1jP125-0005UP-37; Thu, 16 Apr 2020 09:42:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jP124-0005UF-Jb for xen-devel@lists.xen.org; Thu, 16 Apr 2020 09:42:04 +0000 X-Inumbo-ID: 86c7512e-7fc6-11ea-9e09-bc764e2007e4 Received: from smtp-fw-33001.amazon.com (unknown [207.171.190.10]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 86c7512e-7fc6-11ea-9e09-bc764e2007e4; Thu, 16 Apr 2020 09:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587030124; x=1618566124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=79p/4CDiEGJ18qhAhEUHKqQ88FWOgjBQJAWLoAZCclQ=; b=IVzJqfanxImuCiJars7ebN0+vxcrTvuVeyAwRcmheUSg/0PbrF5PcMVC 3w0i3P+HlLHrfKiZVsuwGyo+dBsfvLONl25RVKcHKlJxWW3bOeizM4aL0 93bBzwhDvv+mAcSl9EG1RcgV/WaVrQsUcg91K1W6PaTePQXfMxCzNICCy k=; IronPort-SDR: Fy6DzixMvXQkmTCjVVJW3EyoVB9tCVaYJjwpWq+ZmtQkdWygvOGzzv1WJse+ZIwXC66gZpIcoL hxKteE0w2Fkg== X-IronPort-AV: E=Sophos;i="5.72,390,1580774400"; d="scan'208";a="38805096" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 16 Apr 2020 09:42:02 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com (Postfix) with ESMTPS id F0AF1A1F4D; Thu, 16 Apr 2020 09:42:00 +0000 (UTC) Received: from EX13D05EUB004.ant.amazon.com (10.43.166.115) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:42:00 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D05EUB004.ant.amazon.com (10.43.166.115) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:41:59 +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, 16 Apr 2020 09:41:57 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF 3/4] Enabled serial writing for hvm guests Date: Thu, 16 Apr 2020 09:41:40 +0000 Message-ID: <20200416094141.65120-4-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200416094141.65120-1-wipawel@amazon.de> References: <20200416094141.65120-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Paul Semel , julien@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, Pawel Wieczorkiewicz , 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 --- arch/x86/setup.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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); From patchwork Thu Apr 16 09:41:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11492581 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 598A714DD for ; Thu, 16 Apr 2020 09:43:00 +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 3631621BE5 for ; Thu, 16 Apr 2020 09:43:00 +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="P8rwHFgI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3631621BE5 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.89) (envelope-from ) id 1jP12P-0005bV-1K; Thu, 16 Apr 2020 09:42:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jP12N-0005b4-Nc for xen-devel@lists.xen.org; Thu, 16 Apr 2020 09:42:23 +0000 X-Inumbo-ID: 92e334f0-7fc6-11ea-b4f4-bc764e2007e4 Received: from smtp-fw-6001.amazon.com (unknown [52.95.48.154]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 92e334f0-7fc6-11ea-b4f4-bc764e2007e4; Thu, 16 Apr 2020 09:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1587030143; x=1618566143; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=nBLsA1bQLNUw4cSYjqTUKz4JCf9EJCqVCkOxhJf9Dao=; b=P8rwHFgI9voH3xn9bkvFzTgoq3N7neS5PrOa578RUxO8bwQYjULs5mEB BC6+cc0QCqqKcc0M207mDxY+865owtaJv8thOZC7SJWjg5T6hK3taHTpb Jd04KeLaRGI5bmJlQZkY9kdNeB2iAeA664Pc9DKskoJ8N6PGPgdzHjTEN Y=; IronPort-SDR: 4zeGHXNkwwvCfr19HUt8zMUCSA+sE035/1CEAJo8lWjqG6csKOEBfXySD8LDoRI47c78qCl2XV GJ6xWD94TUFA== X-IronPort-AV: E=Sophos;i="5.72,390,1580774400"; d="scan'208";a="27162069" 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-6001.iad6.amazon.com with ESMTP; 16 Apr 2020 09:42:22 +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 9F2B2A2E2B; Thu, 16 Apr 2020 09:42:21 +0000 (UTC) Received: from EX13D02EUB003.ant.amazon.com (10.43.166.172) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:42:02 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D02EUB003.ant.amazon.com (10.43.166.172) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 16 Apr 2020 09:42:01 +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, 16 Apr 2020 09:41:59 +0000 From: Pawel Wieczorkiewicz To: Subject: [XTF 4/4] setup: Setup PV console for HVM guests on xen >4.2 Date: Thu, 16 Apr 2020 09:41:41 +0000 Message-ID: <20200416094141.65120-5-wipawel@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200416094141.65120-1-wipawel@amazon.de> References: <20200416094141.65120-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Paul Semel , julien@xen.org, paul@xen.org, semelpaul@gmail.com, andrew.cooper3@citrix.com, Pawel Wieczorkiewicz , nmanthey@amazon.de Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Paul Semel Xen 4.2 requires a workaround that does not setup PV console for HVM guests. However, newer Xen versions do not have that limitation and should always have the PV console setup. In arch_setup() detects Xen version by issuing xen_version hypercall and optionally passes the version to main_xtf(). Signed-off-by: Paul Semel Signed-off-by: Pawel Wieczorkiewicz --- arch/x86/setup.c | 20 ++++++++++++++++++-- common/setup.c | 6 +++++- include/xtf/framework.h | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/arch/x86/setup.c b/arch/x86/setup.c index f6fa4df..e3f74e6 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,9 +274,23 @@ void arch_setup(void) init_hypercalls(); - if ( !is_initdomain() ) + xen_version = hypercall_xen_version(XENVER_version, NULL); + if ( version ) + *version = xen_version; + + /* + * The setup_pv_console function registers a writing function + * that makes hvm guests crash on Xen 4.2 + */ + if ( (!IS_DEFINED(CONFIG_HVM) || + (XEN_MAJOR(xen_version) >= 4 && XEN_MINOR(xen_version) > 2)) && + !is_initdomain() ) { setup_pv_console(); + } + + if ( !is_initdomain() ) + { setup_xenbus(); } 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. */