From nobody Tue Feb 10 01:59:24 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 1580830680804836.5640962865224; Tue, 4 Feb 2020 07:38:00 -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 1iz0GZ-0001QH-Ki; Tue, 04 Feb 2020 15:37: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 1iz0GY-0001PP-9y for xen-devel@lists.xenproject.org; Tue, 04 Feb 2020 15:37:30 +0000 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 370f315a-4764-11ea-8396-bc764e2007e4; Tue, 04 Feb 2020 15:37:13 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id z9so11401217wrs.10 for ; Tue, 04 Feb 2020 07:37:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 07:37:12 -0800 (PST) X-Inumbo-ID: 370f315a-4764-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=RamMyxA7eCEhhsUkaM1ZIdMTbkYKaRV5qn3nRLFrXI8=; b=FxUCKDN1EFpDKVMer6ECw/dYqN3wYNYg9Jr9xTXc0mSUuBYp4h8XsTC8sZHF7XYRlI YuFmakjbWU/E8qpYtBDlIOrw0Ms91yGFvFaRIgVt5nV/8lSiKKGP8KNqlAN/lmbmw2h4 fyN+LOIzaVbjb4r9EsSbisl9d0CGkwFtZ21aHdY9YKcwiVqFSRZ6j+qUDgtkULWxc//K WsKXt5eDRZaWbsJZadHYJOt44FJj79KYVSaugWQA+aOAeGPT3WrufCnyhtmRY49uGvIT UNnOCvE+Z3AfRMPxjs78dvIyIOBsUH9hside4tXwoA6bXozlrdpxZqyYIB7Q1X9nvf2W i8Wg== 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=RamMyxA7eCEhhsUkaM1ZIdMTbkYKaRV5qn3nRLFrXI8=; b=I8zVNCZtof5n51dWuy+rWOqe2xnjKzoy22JohfBMXqy/X86S8TKOQXHwWL3DSYZYiu DZuLcMvJHTsXuc1Wfa/CRUupuZz0dY97NGhVKlRO69a0RLdkXZffDjfrQDRTUqbP65Nt pnoTw6hldyDO2+5+Jpejcmu8ZTh01uP9zmFd0KOllVc5YS8YaWflUEHR4LmqqRFmsExv iZ4dfBJ3is8yu+bicDghFpXVZwY/+9TjcbjKOOSxX7BVAoAozsHVZgg1xiQvreCZdQ/T MhCW6HjHPfKtgmj7k1oLdlA48hiGVC59aE0mNx18yK6s7323zQGn8N89WmlsE7rqpD42 p7zg== X-Gm-Message-State: APjAAAUiVDiOFTAGFLKk2L6o+xod8q9wub9HdWtpcDvQkZ8nrro/SPVW tdE4J6HWLxAH1wXp4YZT0jTZkIzHe8o= X-Google-Smtp-Source: APXvYqyXIv8AhYrQsvNztjZlBUrSpG0bafdrwper0ZIxiI8BNjj6TmSQJXehGFA9nc+/XbLpWRo98A== X-Received: by 2002:adf:ea88:: with SMTP id s8mr22563522wrm.293.1580830632917; Tue, 04 Feb 2020 07:37:12 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Tue, 4 Feb 2020 15:36:58 +0000 Message-Id: <20200204153704.15934-5-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 04/10] x86/hypervisor: provide hypervisor_fixup_e820 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=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) And implement the hook for Xen guest. Signed-off-by: Wei Liu Reviewed-by: Jan Beulich --- v7: 1. Drop bogus ASSERT_UNREACHABLE from stub 2. Add Jan's Rb, considering #1 doesn't change the meat of the patch --- xen/arch/x86/e820.c | 4 ++-- xen/arch/x86/guest/hypervisor.c | 6 ++++++ xen/arch/x86/guest/xen/xen.c | 7 +++++++ xen/include/asm-x86/guest/hypervisor.h | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c index b9f589cac3..160f029edd 100644 --- a/xen/arch/x86/e820.c +++ b/xen/arch/x86/e820.c @@ -691,8 +691,8 @@ unsigned long __init init_e820(const char *str, struct = e820map *raw) =20 machine_specific_memory_setup(raw); =20 - if ( pv_shim ) - pv_shim_fixup_e820(&e820); + if ( cpu_has_hypervisor ) + hypervisor_e820_fixup(&e820); =20 printk("%s RAM map:\n", str); print_e820_memory_map(e820.map, e820.nr_map); diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.c index e72c92ffdf..5fd433c8d4 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -66,6 +66,12 @@ void hypervisor_resume(void) ops->resume(); } =20 +void __init hypervisor_e820_fixup(struct e820map *e820) +{ + if ( ops && ops->e820_fixup ) + ops->e820_fixup(e820); +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 1cf09886da..5a7f3cce42 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -322,11 +322,18 @@ static void resume(void) pv_console_init(); } =20 +static void __init e820_fixup(struct e820map *e820) +{ + if ( pv_shim ) + pv_shim_fixup_e820(e820); +} + static const struct hypervisor_ops ops =3D { .name =3D "Xen", .setup =3D setup, .ap_setup =3D ap_setup, .resume =3D resume, + .e820_fixup =3D e820_fixup, }; =20 const struct hypervisor_ops *__init xg_probe(void) diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/g= uest/hypervisor.h index 64383f0c3d..ade10e74ea 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -19,6 +19,8 @@ #ifndef __X86_HYPERVISOR_H__ #define __X86_HYPERVISOR_H__ =20 +#include + struct hypervisor_ops { /* Name of the hypervisor */ const char *name; @@ -28,6 +30,8 @@ struct hypervisor_ops { int (*ap_setup)(void); /* Resume from suspension */ void (*resume)(void); + /* Fix up e820 map */ + void (*e820_fixup)(struct e820map *e820); }; =20 #ifdef CONFIG_GUEST @@ -36,6 +40,7 @@ const char *hypervisor_probe(void); void hypervisor_setup(void); int hypervisor_ap_setup(void); void hypervisor_resume(void); +void hypervisor_e820_fixup(struct e820map *e820); =20 #else =20 @@ -46,6 +51,7 @@ static inline const char *hypervisor_probe(void) { return= NULL; } static inline void hypervisor_setup(void) { ASSERT_UNREACHABLE(); } static inline int hypervisor_ap_setup(void) { return 0; } static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); } +static inline void hypervisor_e820_fixup(struct e820map *e820) {} =20 #endif /* CONFIG_GUEST */ =20 --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel