From patchwork Tue Feb 4 15:36:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11364875 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 200E6138D for ; Tue, 4 Feb 2020 15:38:12 +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 EFE8620674 for ; Tue, 4 Feb 2020 15:38:11 +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="UPTvmR3v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EFE8620674 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 1iz0GP-0001KO-S7; Tue, 04 Feb 2020 15:37:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iz0GO-0001Jt-9r for xen-devel@lists.xenproject.org; Tue, 04 Feb 2020 15:37:20 +0000 X-Inumbo-ID: 35ccc6e0-4764-11ea-a933-bc764e2007e4 Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 35ccc6e0-4764-11ea-a933-bc764e2007e4; Tue, 04 Feb 2020 15:37:11 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id p9so3805615wmc.2 for ; Tue, 04 Feb 2020 07:37:11 -0800 (PST) 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=fEg9XwS3HG4yiw/+hl5IAq+iztDUQZOPprrs17H6Elw=; b=UPTvmR3vxuIFBpQs2c6MWJIAT0+TAxB1oAyULf/8+udbXKufr2C23LV7+f/MlHIYGa PBPjQTR2vtK+sV4UkP8A/fpQf7VM79QNI410G3ILCuY7mrtLey0K53BUrRwaKYTTX/Xo p0qNBRSIc6iJOEu2BWXachY3fDKM2ZZpFE5ovH2sirw5buE6grqLDmxnQJOQzojQauJN JCjan7z5bS6TryW58CqoP0m7CdQgaehsI1psYQ7v81VrI48LwQ8/HyK1G1FNp8t2T+YW JIpXNOa1njuobg9t4PM2I5nQyV3KUzWYEPTR8eNLnMmr1oufktqN2cztVY/+Im+mUjDm ybcQ== 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=fEg9XwS3HG4yiw/+hl5IAq+iztDUQZOPprrs17H6Elw=; b=VjDrh7YCaUHI0s6lGVkBE87AqE9js7B8yI6qA50WcVqX+gL7cZ+wY8S6QW0NQ8W6QF ALixm5/K1yRMotvSBQzPNLRQJGz4jS/tura66fYLfdv/gIU8ev9v7kM7uB9WqZxCKSNQ scF/6FqOQ8thx2U38oIcPdTLXPXiv9o8FYOJVRciBXKTMKMEmJRDZcwlZqlJVsMtQTuu X1N/sx7Eo45RLWCevUqV6qF0o45trjXPqSa2O8GGcnVLQzfS8y8x8uZzuap8vtHGBsNV EfV4zBW6Gr0o+fVd1+BqDKX7HqMtXO1J94xsU4wPQK8OjNLRyljC6nDHFX2eJfg7am6X NGyw== X-Gm-Message-State: APjAAAUVKZfBJHCPAyjxaVLqyKezwBsPbLJf81gDZXxnhnSG8GI5U2HC J04AsROknYNbr5rI4TK+MNABSsA4Ksc= X-Google-Smtp-Source: APXvYqw/h2j5v7RW3J0sxA6E1zesuRlFk1KvgnGKjX6iEQNzdQ+jTz96tWnZUpV8486CGqRgrscF1A== X-Received: by 2002:a7b:c8d7:: with SMTP id f23mr6243018wml.173.1580830630796; Tue, 04 Feb 2020 07:37:10 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id p26sm4067143wmc.24.2020.02.04.07.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 07:37:10 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Tue, 4 Feb 2020 15:36:56 +0000 Message-Id: <20200204153704.15934-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200204153704.15934-1-liuwe@microsoft.com> References: <20200204153704.15934-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v7 02/10] x86/smp: don't online cpu if hypervisor_ap_setup fails 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 , Paul Durrant , Michael Kelley , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Push hypervisor_ap_setup down to smp_callin. Take the chance to replace xen_guest with cpu_has_hypervisor. Signed-off-by: Wei Liu Reviewed-by: Roger Pau Monné Reviewed-by: Jan Beulich --- xen/arch/x86/smpboot.c | 10 +++++++--- xen/include/asm-x86/guest/hypervisor.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index c9d1ab4423..93b86a09e9 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -199,6 +199,13 @@ static void smp_callin(void) goto halt; } + if ( cpu_has_hypervisor && (rc = hypervisor_ap_setup()) != 0 ) + { + printk("CPU%d: Failed to initialise hypervisor functions. Not coming online.\n", cpu); + cpu_error = rc; + goto halt; + } + if ( (rc = hvm_cpu_up()) != 0 ) { printk("CPU%d: Failed to initialise HVM. Not coming online.\n", cpu); @@ -371,9 +378,6 @@ void start_secondary(void *unused) tsx_init(); /* Needs microcode. May change HLE/RTM feature bits. */ - if ( xen_guest ) - hypervisor_ap_setup(); - smp_callin(); set_cpu_sibling_map(cpu); diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/guest/hypervisor.h index b503854c5b..64383f0c3d 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -44,7 +44,7 @@ void hypervisor_resume(void); static inline const char *hypervisor_probe(void) { return NULL; } static inline void hypervisor_setup(void) { ASSERT_UNREACHABLE(); } -static inline int hypervisor_ap_setup(void) { ASSERT_UNREACHABLE(); return 0; } +static inline int hypervisor_ap_setup(void) { return 0; } static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); } #endif /* CONFIG_GUEST */