From patchwork Mon Sep 23 10:09:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11156565 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 7684717D4 for ; Mon, 23 Sep 2019 10:11:46 +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 5229920865 for ; Mon, 23 Sep 2019 10:11:46 +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="PGil4XhY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5229920865 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 1iCLII-0007Wb-5T; Mon, 23 Sep 2019 10:10:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLIG-0007Tw-8z for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:10:08 +0000 X-Inumbo-ID: 4264c094-ddea-11e9-b299-bc764e2007e4 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4264c094-ddea-11e9-b299-bc764e2007e4; Mon, 23 Sep 2019 10:09:42 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id m18so8619705wmc.1 for ; Mon, 23 Sep 2019 03:09:42 -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=J0gWUg2h7tpdgfhePN1rbGU9ftmJv074Q5+IRkBqTX8=; b=PGil4XhYR6v62HYFcwiaSCYPWEF6MEg6hCwXjZuKaP4Aj7i5WKq/QH3zUtclD5scVt sESn8KrxnsfFTdchYW5vLvkzkaxVL2FBxZUCLfStN1jAW8LSDfo9R5oY0tylhwGpILiL U7oIqNWN5XQkozkg8kEeqQwxPBgx3doqx0t5pPjkwR2DSkT+PbPjZ3BxnrH0JcietLgQ GANPJpCPusX5YsA4qIJ2sEZxMLar/UUmLClL8J9c01F5z7xTpwULjPKK9mNX6A5KuDYW j0uCizKYM7w8YoURYr3pTyJzBJZMbT75DM0DcLa3lQBzOWYO53ehnwVfccMUKOB1GxR4 YaCg== 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=J0gWUg2h7tpdgfhePN1rbGU9ftmJv074Q5+IRkBqTX8=; b=Z1zcjDSvz9rd7HYrEg7ceVLffOPXiVZAg/cJmiFB4xMljCMlYlDxMynrhylZAp6/BE uXMQh90FI2Sk2/6VLW/ZjaORxaFmDTEeGVqEGz+WJHH75QMLFhNsGZiW3gfmjqtEFp7m qs2FAqpabsrGc0dUObh1PPs5juHV1zVD9UIiWe3jOiS/rBgnCSGdZ+06QI6PsYFMwf3X tbBte0v+3/rDXGepBugQtbuTBsgOYVnyJKyA44nFyLEn+WTl3fgXqtCHenGLXKtIZRfd SCaP+aZ7PDZixT5M5/X+wun6aIb558y5OrlxZb9ZHI5rU1cwc4ErQOrQLu0qxjeGFf/F UKCA== X-Gm-Message-State: APjAAAW8hTGuzeY6dshjwhOKtLzkyfFWxkwiT8uyXwE/pt2m5CB4iQkh p1jfs+01w+YfOhEOwAEl0nd0Tz9k X-Google-Smtp-Source: APXvYqx7BqyC5ozDISUKqL4kgTWqLV6+d4HNGBkzXibQ1XS4BtpTE5Yi//FfuOXbkSgclyjdgBGuFA== X-Received: by 2002:a7b:c757:: with SMTP id w23mr12824379wmk.31.1569233381352; Mon, 23 Sep 2019 03:09:41 -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 s10sm18241662wmf.48.2019.09.23.03.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:40 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:29 +0100 Message-Id: <20190923100931.29670-7-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 6/8] x86: make probe_xen return boolean value 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" We need indication whether it has succeeded or not. Signed-off-by: Wei Liu --- xen/arch/x86/guest/hypervisor.c | 5 ++++- xen/arch/x86/guest/xen/xen.c | 7 ++++--- xen/include/asm-x86/guest/xen.h | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c index b0a724bf13..fb572b0402 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -34,7 +34,10 @@ void __init probe_hypervisor(void) if ( !(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) ) return; - probe_xen(); + if ( probe_xen() ) + return; + + /* Hyper-V probing to follow. */ } static void __init init_memmap(void) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index a730e6ad1b..8390b045f0 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -66,20 +66,21 @@ static void __init find_xen_leaves(void) } } -void __init probe_xen(void) +bool __init probe_xen(void) { if ( xen_guest ) - return; + return true; find_xen_leaves(); if ( !xen_cpuid_base ) - return; + return false; /* Fill the hypercall page. */ wrmsrl(cpuid_ebx(xen_cpuid_base + 2), __pa(hypercall_page)); xen_guest = true; + return true; } static void map_shared_info(void) diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xen.h index d031f1f70d..7eda3d4956 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -32,7 +32,7 @@ extern bool xen_guest; extern bool pv_console; extern uint32_t xen_cpuid_base; -void probe_xen(void); +bool probe_xen(void); void xen_setup(void); void xen_ap_setup(void); void xen_resume(void); @@ -45,7 +45,7 @@ DECLARE_PER_CPU(struct vcpu_info *, vcpu_info); #define xen_guest 0 #define pv_console 0 -static inline void probe_xen(void) {} +static inline bool probe_xen(void) { return false; } #endif /* CONFIG_XEN_GUEST */ #endif /* __X86_GUEST_XEN_H__ */