From patchwork Mon Sep 30 15:00:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11166851 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 4C26B13B1 for ; Mon, 30 Sep 2019 15:02:54 +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 2778320679 for ; Mon, 30 Sep 2019 15:02:54 +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="RnaBNo+g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2778320679 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 1iExB5-0006Kh-Rj; Mon, 30 Sep 2019 15:01:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iExB4-0006Jo-AF for xen-devel@lists.xenproject.org; Mon, 30 Sep 2019 15:01:30 +0000 X-Inumbo-ID: 1a8a1548-e393-11e9-8628-bc764e2007e4 Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343]) by localhost (Halon) with ESMTPS id 1a8a1548-e393-11e9-8628-bc764e2007e4; Mon, 30 Sep 2019 15:00:56 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id m18so13137365wmc.1 for ; Mon, 30 Sep 2019 08:00:56 -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=iyiOgqrZxFUGRGfUCjGuZn7FzXfpH61oMe3dzY2NCCg=; b=RnaBNo+g88s5ScTLq1f9UR5Pwr2m+NZAzF0m/CeCOp5JXdWutjRcUNGDSpcQoV3exO oC7JA8k8SrwAZKA82J4F/rNfg3Wc9wH4gqjEogFYo2rNaceLdmEoDPCGxkFxr67J0VMo uiNirK7/qH2MvLPciOw3gapnceYwuboXyI/370E219yjOv40rKt0ZajHbN343MWxdJPn JQIlvGnozFayU6EwL+B3vgBe9TJLkPfxpldx2/dOG7ufKfHb6DrxxvjJWcDOc28pFRRr /KsB/Nh9rBCB7LBf9L9W6UezZXUJopya1DKUbAimmFmgvNpme5m9W/RJRtJIBu2HCf13 z0Vw== 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=iyiOgqrZxFUGRGfUCjGuZn7FzXfpH61oMe3dzY2NCCg=; b=CMAFEPfUif1+hbWBLEB62KGE5oOW/H3kJAWWt+KhygMqePYlRk38MC9n9Wabgbv3Gl FA0JzxSAcIToK+HzmCt4QlZ28YkujtJb+0VZhJYbQghL3plMRyYWatQtf7/Pwcg6P4Hc pLGZZLaYSalMjwdOaboFXkgubDTTncvdfpkRllnITMnQYySWXHBPQUI2oSY6Dc/gh2MP nIGr5kOz+mUTc9r+E/tkKa9Vfd62lQX+dbazxWXBJNAznJYHv7O0dukiVerQcJ4oZpzZ 0uwUKk6WEYNm8FNSHScDwUMsEdmQiW7OVS4Yo7zPYA0F0hcawk2VjAJ4UJUJJ/ce9LD1 Rp0g== X-Gm-Message-State: APjAAAXJfbbFLPZ6gcgQWcI5lsp1WWBjNKfHBdHE+BNMxU790cf4oXev LDfDIh2feHlImzziYsXRPTwW3Y5GQUE= X-Google-Smtp-Source: APXvYqwOBR+rM15fjyUePABCbF2i3PLVBkhYoBDStz+QB1AflVfmXILzGTjTV/v2KZF7/+s1yh4QSA== X-Received: by 2002:a1c:c506:: with SMTP id v6mr16406444wmf.160.1569855655190; Mon, 30 Sep 2019 08:00:55 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id f143sm32870852wme.40.2019.09.30.08.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 08:00:54 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 30 Sep 2019 16:00:42 +0100 Message-Id: <20190930150044.5734-9-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190930150044.5734-1-liuwe@microsoft.com> References: <20190930150044.5734-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v2 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 --- xen/arch/x86/guest/hypervisor.c | 5 +++++ xen/arch/x86/setup.c | 6 +++++- xen/include/asm-x86/guest/hypervisor.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c index 30453b6a7a..8161b26c5a 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -43,6 +43,11 @@ bool hypervisor_probe(void) return !!hops; } +const char *hypervisor_name(void) +{ + 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..a7d75bf9cf 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -36,6 +36,7 @@ bool hypervisor_probe(void); void hypervisor_setup(void); void hypervisor_ap_setup(void); void hypervisor_resume(void); +const char *hypervisor_name(void); #else @@ -45,6 +46,7 @@ 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) { return NULL; } #endif /* CONFIG_GUEST */