From nobody Mon Feb 9 09:33:13 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580493020897447.16993898622184; Fri, 31 Jan 2020 09:50:20 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixaQH-0005qy-HT; Fri, 31 Jan 2020 17:49:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixaQG-0005qs-J9 for xen-devel@lists.xenproject.org; Fri, 31 Jan 2020 17:49:40 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0ca14fc6-4452-11ea-8396-bc764e2007e4; Fri, 31 Jan 2020 17:49:38 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id g1so8887480wmh.4 for ; Fri, 31 Jan 2020 09:49:38 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id 133sm4364352wmd.5.2020.01.31.09.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 09:49:34 -0800 (PST) X-Inumbo-ID: 0ca14fc6-4452-11ea-8396-bc764e2007e4 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=Egz3txqQqthBIsSjMFQvj77WUNoiga8Y7f7moMDL01Y=; b=k7BWOimru4Z0jLixjjuChh/KfxXDiHXFwlyGTZCdeeMM/cY7aO3HuZKJDWxehvy/6f mT6JY2/f3/RHYrE26+lssizf58LUauU1CJwXjV7KhCLKsQCCfp62jwgiHAebM5buGeK7 jdLsosIg0fuKO8vJrViGYT+7Y0OK5XnWuNlpSnD4LWZ7C+VNM3/+rpqeAIu/anfdYHwy /jE0tzIeCBzHz1baudJdnyqvaYtOMBjpfo/ijVwYJA6oR1YyLLqh5MzhJj2bcv4s3Vjs O5W5krRLBgue/SwwLAkOe/DVHOPRzXn7XdN6MfoRo1yiSSE2kP4V+r0tS+pr7Aexi4UU A5yg== 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=Egz3txqQqthBIsSjMFQvj77WUNoiga8Y7f7moMDL01Y=; b=YU3Bg/ksqmISiZAm5Z5dC13Xca60lf4vNqoIOmWhSi+7ZBEt6evbrrCbYx0dGdwAdD tysid0eo8+jpGXqv4b6LaiWDvEJcF1RQa5BjNpek/twlla6lPwwK3AdE01tXdWridQNo dMMmuTp8NIUNuXmHVmt+zRDy5/RWhN7KK9kNu5YNImaGbb3qyBq6nxqqcVVFrUFXW3CX AprhKSkDmOG0Ze4TfqYeOe4PyNgnnQ/Yq/DrLl4xQWGcIew8LFjLxWNbb9T/umBrDXcb xSlnmlB8FaZKy1hiESHFpVu7Hdj3DoCPTZ8SY/VAyLYxVhi9PmLp2ovB4UBFUIxaUfu/ R2AQ== X-Gm-Message-State: APjAAAWMAUE1u30edrJ7WEsDyDE33Xx8nant7cSmKfl5+32esNwbYPEw /rmwPj3o/+zAtfG7vKgv98HeRtHyRmE= X-Google-Smtp-Source: APXvYqxRfBxG1yOxDUs3O2IOTU1WaablLfIjYKWavDKt/1y04+C0B3L4gvoN/as1Yh6/4ZwutiJyWg== X-Received: by 2002:a1c:1b42:: with SMTP id b63mr13481018wmb.16.1580492974801; Fri, 31 Jan 2020 09:49:34 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 31 Jan 2020 17:49:20 +0000 Message-Id: <20200131174930.31045-2-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200131174930.31045-1-liuwe@microsoft.com> References: <20200131174930.31045-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v6 01/11] 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=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We want to be able to handle AP setup error in the upper layer. Signed-off-by: Wei Liu --- v6: 1. Change map_vcpuinfo as well 2. Make code shorter --- xen/arch/x86/guest/hypervisor.c | 6 ++++-- xen/arch/x86/guest/xen/xen.c | 24 +++++++++++++++--------- xen/include/asm-x86/guest/hypervisor.h | 6 +++--- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.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(); } =20 -void hypervisor_ap_setup(void) +int hypervisor_ap_setup(void) { if ( ops && ops->ap_setup ) - ops->ap_setup(); + return ops->ap_setup(); + + return 0; } =20 void hypervisor_resume(void) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 6dbc5f953f..d50f86bae7 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -113,16 +113,16 @@ static int map_vcpuinfo(void) info.mfn =3D virt_to_mfn(&vcpu_info[vcpu]); info.offset =3D (unsigned long)&vcpu_info[vcpu] & ~PAGE_MASK; rc =3D xen_hypercall_vcpu_op(VCPUOP_register_vcpu_info, vcpu, &info); - if ( rc ) - { - BUG_ON(vcpu >=3D XEN_LEGACY_MAX_VCPUS); - this_cpu(vcpu_info) =3D &XEN_shared_info->vcpu_info[vcpu]; - } - else + if ( !rc ) { this_cpu(vcpu_info) =3D &vcpu_info[vcpu]; set_bit(vcpu, vcpu_info_mapped); } + else if ( vcpu < XEN_LEGACY_MAX_VCPUS ) + { + rc =3D 0; + this_cpu(vcpu_info) =3D &XEN_shared_info->vcpu_info[vcpu]; + } =20 return rc; } @@ -257,11 +257,17 @@ static void __init setup(void) init_evtchn(); } =20 -static void ap_setup(void) +static int ap_setup(void) { + int rc; + set_vcpu_id(); - map_vcpuinfo(); - init_evtchn(); + rc =3D map_vcpuinfo(); + + if ( !rc ) + init_evtchn(); + + return rc; } =20 int xg_alloc_unused_page(mfn_t *mfn) diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/g= uest/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 { =20 const char *hypervisor_probe(void); void hypervisor_setup(void); -void hypervisor_ap_setup(void); +int hypervisor_ap_setup(void); void hypervisor_resume(void); =20 #else @@ -44,7 +44,7 @@ void hypervisor_resume(void); =20 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(); } =20 #endif /* CONFIG_GUEST */ --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel