From patchwork Wed Jan 29 20:20:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11356773 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 1C60014E3 for ; Wed, 29 Jan 2020 20:21:57 +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 ED44520702 for ; Wed, 29 Jan 2020 20:21:56 +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="Be2+uZN/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED44520702 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 1iwtpS-0006VC-Ll; Wed, 29 Jan 2020 20:20:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iwtpQ-0006Ue-Vv for xen-devel@lists.xenproject.org; Wed, 29 Jan 2020 20:20:49 +0000 X-Inumbo-ID: d1575e5c-42d4-11ea-b211-bc764e2007e4 Received: from mail-wr1-x441.google.com (unknown [2a00:1450:4864:20::441]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d1575e5c-42d4-11ea-b211-bc764e2007e4; Wed, 29 Jan 2020 20:20:40 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id y11so1042967wrt.6 for ; Wed, 29 Jan 2020 12:20:40 -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=9adkovXBXcrsU2wrP2JH6R+/kChgLQsRH9C97w7ZMwg=; b=Be2+uZN/IU3vEeyirsev19HR7abf6wkSb8D0/01Cx5Zw6CEZ5K/p+6P4NNk4vYq1Po 4GFkfFS8U7ZVJVDvVO+7Uiu0Bdipm7sSlPz2vQYSkyxCPCB2aagp0jZyd0e43Td9kkvM R1ly2U2e7BD/mtUxax0XY8zB8c0kNIgK45foJfaRcuOEyZuMvcjUPsVtQgN0xYrqTy8g 5K3FYhNYZYk3NOcYDk/rd/xkjVI14lsUZAS2/tQ4ZcJrCTfRNKVMf5r6GvPwEG6tQVhJ ooou8jBv7RG5xgFkbAVLd/mepxE3w43RjqmjelX9dE1WcnrldrIPSYk2Oi60YEq2OPoh 3kJA== 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=9adkovXBXcrsU2wrP2JH6R+/kChgLQsRH9C97w7ZMwg=; b=NEbG1rSNlhoKePzYLMBWpB8MpBf0/YO6JOXK8co3o8M/MvYuw8UKY12AQTTDWPh7yW ve3CcjoY9o2OjVUt7EOFPFOSi+eZZZiJswT23fPnx8SmjaCH9wunxynMJaJYW80zDOwr P+0V92ctf8SEKSm6imepRn1L/91Grobp97LZGCqosx3ShhsBXku7SlAsw1I/XJqpmmWA cEy0G+sdM9imCmaCsDGl9B1a7UObnyy6Xk4lms/a49oSXsc2VFu28tZadvCIPYQsvAvz SQvL0bBASRMIWrGqKqz2MzcmNqr85T/o7207cmKEo8FybXwLbNY6/++8nLCQUovubQMm +RpA== X-Gm-Message-State: APjAAAWFZur+ZgfCxjTHFGb/y3XyZ1gYfzGs7dqWu0iR0OzT9jR3gafl tVtK0GH0aZEW/CFE7PstHePJkJplxII= X-Google-Smtp-Source: APXvYqxcplD/sL4f1zqvSxzOgdqa8zb6xw3FwUzA0TaA288GWgQuGTGSBlHh5lMXyHkrAYCROMutAw== X-Received: by 2002:adf:bc87:: with SMTP id g7mr605314wrh.121.1580329239560; Wed, 29 Jan 2020 12:20:39 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id a22sm3564115wmd.20.2020.01.29.12.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 12:20:39 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Wed, 29 Jan 2020 20:20:24 +0000 Message-Id: <20200129202034.15052-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200129202034.15052-1-liuwe@microsoft.com> References: <20200129202034.15052-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 02/12] x86/hypervisor: make hypervisor_ap_setup return an error code 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 , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" We want to be able to handle AP setup error in the upper layer. Signed-off-by: Wei Liu --- xen/arch/x86/guest/hypervisor.c | 6 ++++-- xen/arch/x86/guest/xen/xen.c | 11 +++++++++-- xen/include/asm-x86/guest/hypervisor.h | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c index 4f27b98740..e72c92ffdf 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -52,10 +52,12 @@ void __init hypervisor_setup(void) ops->setup(); } -void hypervisor_ap_setup(void) +int hypervisor_ap_setup(void) { if ( ops && ops->ap_setup ) - ops->ap_setup(); + return ops->ap_setup(); + + return 0; } void hypervisor_resume(void) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 6dbc5f953f..eed8a6edae 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -257,11 +257,18 @@ static void __init setup(void) init_evtchn(); } -static void ap_setup(void) +static int ap_setup(void) { + int rc; + set_vcpu_id(); - map_vcpuinfo(); + rc = map_vcpuinfo(); + if ( rc ) + return rc; + init_evtchn(); + + return 0; } int xg_alloc_unused_page(mfn_t *mfn) diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/guest/hypervisor.h index 392f4b90ae..b503854c5b 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -25,7 +25,7 @@ struct hypervisor_ops { /* Main setup routine */ void (*setup)(void); /* AP setup */ - void (*ap_setup)(void); + int (*ap_setup)(void); /* Resume from suspension */ void (*resume)(void); }; @@ -34,7 +34,7 @@ struct hypervisor_ops { const char *hypervisor_probe(void); void hypervisor_setup(void); -void hypervisor_ap_setup(void); +int hypervisor_ap_setup(void); void hypervisor_resume(void); #else @@ -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 void hypervisor_ap_setup(void) { ASSERT_UNREACHABLE(); } +static inline int hypervisor_ap_setup(void) { ASSERT_UNREACHABLE(); return 0; } static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); } #endif /* CONFIG_GUEST */