From patchwork Mon Oct 21 15:57:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11202585 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 29DDF13BD for ; Mon, 21 Oct 2019 15:59: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 059FD20B7C for ; Mon, 21 Oct 2019 15:59:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MUKAOFhl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 059FD20B7C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org 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 1iMa4L-0008Oj-5x; Mon, 21 Oct 2019 15:58: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 1iMa4J-0008O2-Sr for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:58:03 +0000 X-Inumbo-ID: 7c1217e6-f41b-11e9-beca-bc764e2007e4 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7c1217e6-f41b-11e9-beca-bc764e2007e4; Mon, 21 Oct 2019 15:57:29 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id q70so6756663wme.1 for ; Mon, 21 Oct 2019 08:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f6in2kwAF9sUzg2Mb4eb4h7EVvG820SHOVnsWYNNk9o=; b=MUKAOFhlOV0lipkA3Qj18xiI6jhWf6fmWwWPwtnJAQzlhbmMRVzmaR0NXuyaM3yipW HOsi01QexFr6Q83AJHRNVrlChT1Fkk93sxOhWiXsmIL0f2ZKitcm/73nC0K+NLF7+k+p XNxgHpVNeerACM3motyD2xj5Ms89+puPCEb2bdG6WgiGKIzc5rFhdWxBa3PN+kEilxYA WzsXBSzxopWNanWlRO2dko8eQQTxn9xuGvBCMKwGk+5bsz+u6zQg0uZ+HTo6KuMzjuzm ktJtP/45Vu4dlEIb3prsn0fYjtMlgX+2cvUvn71CAnSls/Qm/rvTx2TZg0+qttjsc3T/ X6zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=f6in2kwAF9sUzg2Mb4eb4h7EVvG820SHOVnsWYNNk9o=; b=JLlFyr3Dz2RFt6k38GPzWRohTurEEMUZ1l1msd8nblRlcKUL3/PJlL5q+TZvcOcYvD lGsm+agTAYdpJOmW5GWwf8mK7ND09dbnQipM58iLZdV7Yv0tfc7R091QQ9D3Rqssx8ZS H0VlUVWbi8Q4rp3d7ejytwlrz4QRL0O5eSvxhs1PpJ6GSQP8cER8iqePNmhhTna3JiWF N5GziDXe/xaz1ymzb1rFveiz2PHblHv4Sx1xPiEDYPsC3wDx1ASnPFhzAaRAzwumpD8T 9ugjtnyWvk2W3qIJvuroVl8QTNa9ieYF2+ENnni7mqxNX3Slsrc1d9w8s/6VMf/uEVjL 4Jxg== X-Gm-Message-State: APjAAAVkvrQYG+Sfrj7CHEhElg4Xab4+Nhst3KM/jr3A/WNRmG1GLivz Vr3FNhYo1eWdSqdcEfVi7S5QtbkWzHA= X-Google-Smtp-Source: APXvYqxHE3iK/0W6DtLJyb6xZXf4NNJOheJkAeLWWTme7Y7mktHsl4XmDpU67XhLM0PcvmGGFT/xtQ== X-Received: by 2002:a7b:c444:: with SMTP id l4mr19445804wmi.21.1571673448928; Mon, 21 Oct 2019 08:57:28 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:28 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:17 +0100 Message-Id: <20191021155718.28653-9-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 8/9] x86: be more verbose when running on a hypervisor 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: Wei Liu , Wei Liu , Andrew Cooper , Michael Kelley , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Signed-off-by: Wei Liu Reviewed-by: Paul Durrant --- V3: Address Roger's comment, add ASSERTs --- xen/arch/x86/guest/hypervisor.c | 6 ++++++ xen/arch/x86/setup.c | 6 +++++- xen/include/asm-x86/guest/hypervisor.h | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c index 33bf1a769d..a666ad9526 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -46,6 +46,12 @@ bool hypervisor_probe(void) return false; } +const char *hypervisor_name(void) +{ + ASSERT(hops); + return hops->name; +} + void hypervisor_setup(void) { if ( hops && hops->setup ) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 0ee11b15a6..cf5a7b8e1e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -689,6 +689,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) int i, j, e820_warn = 0, bytes = 0; bool acpi_boot_table_init_done = false, relocated = false; int ret; + bool running_on_hypervisor; struct ns16550_defaults ns16550 = { .data_bits = 8, .parity = 'n', @@ -763,7 +764,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) * allocing any xenheap structures wanted in lower memory. */ kexec_early_calculations(); - hypervisor_probe(); + running_on_hypervisor = hypervisor_probe(); parse_video_info(); @@ -789,6 +790,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) printk("Xen image load base address: %#lx\n", xen_phys_start); + if ( running_on_hypervisor ) + printk("Running on %s\n", hypervisor_name()); + #ifdef CONFIG_VIDEO printk("Video information:\n"); diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/guest/hypervisor.h index 38344e2e89..b583722f5d 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -36,15 +36,18 @@ bool hypervisor_probe(void); void hypervisor_setup(void); void hypervisor_ap_setup(void); void hypervisor_resume(void); +const char *hypervisor_name(void); #else +#include #include static inline bool hypervisor_probe(void) { return false; } static inline void hypervisor_setup(void) {} static inline void hypervisor_ap_setup(void) {} static inline void hypervisor_resume(void) {} +static inline char *hypervisor_name(void) { ASSERT_UNREACHABLE(); return NULL; } #endif /* CONFIG_GUEST */