From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115106; cv=none; d=zohomail.com; s=zohoarc; b=AeBX6A5hqiY0pAkgqfylsShfPsp0jqgx5Qx6f25v1E0ChnTLzeGeegTVZSCI3CTFs+JqsT7/2P8WrTbcV+cdu6T8byimRAXiZySDbH3aNjJInhC2DWTJe3ucUwxLdJntoDsFdHTttNz65eHIXKZJmw5uhUc2DmRSEkB2cX3VsmY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115106; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2Kvrs0MRyk3zg1noEppT5qXQE+UoORHXbeZe1RMBFgk=; b=NUhfGqN3FYX8VRcxAwMey1YaM8XbGI2vvLWlSf++7JHeIM+8riP5K105k/Cyk0tR8j9P3mOtKIdj1HC4jm2tBPUtSeRhuUY7eKhGylltr1hMdifFG5FqpL+X0gmGc891CZKwiJc1c+HjsJ4GnUfZoKFgjIsJEOp0KqMLRjmcOkE= ARC-Authentication-Results: i=1; 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 1575115106989330.4591243413579; Sat, 30 Nov 2019 03:58:26 -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 1ib1Nk-0004j5-Br; Sat, 30 Nov 2019 11:57:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1Nj-0004j0-J8 for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:57:47 +0000 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9d6a9eec-1368-11ea-9db0-bc764e2007e4; Sat, 30 Nov 2019 11:57:43 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id b18so38143851wrj.8 for ; Sat, 30 Nov 2019 03:57:43 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:41 -0800 (PST) X-Inumbo-ID: 9d6a9eec-1368-11ea-9db0-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=1f/6ovzsUnbptzU+DDt1DpPbxK4REdzWx0FX+36JZiI=; b=tM84jszeXAgJmuS9cI4RAHa5XBSm7iwI4IQHzGxWwdobKzRy92wohrHXZFSOdT3UQ4 /XMfQVgC5AGnaTfwqQ8EEQEriah4KA/Z7VQTs1Ef8wxPNDqLNCLCnovqoGtCkobTALr3 fAuC02pLIvPHSzdfvZ7aQEmIRicLO3whK6h/0VMjCevQF935Ve2FoJDEm2jSOILO4pFh YfpZTWGgn6XvHjgz+0ECh7wa7dzpMh1inkSEQdHH3PCNJmSbGnCGLeXBg9xRGG5i3XW5 3KK4tetmsEwYj0nQBvw5oQjbf1pkX2aQxjN3Aiu5z5f+SDv7mbfi5g4xiVQfaQsLu0fb bs2g== 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=1f/6ovzsUnbptzU+DDt1DpPbxK4REdzWx0FX+36JZiI=; b=f1QYHdnnV3NjIGLuWHNBS+qA2sy/CDQKhyJdR5wXllGS83DYDTWsoEVSg6agZJae9G bmYHIaWRgSm/BSE5u++Kn2U12vStFCZrY4UIk2uclGmaXe0PTaRubML58fNVbj6/fhI5 zI3fEIuWdvcQ0l27TPbP1wayBBSPqBJ9mFDxn1cd6SUUh16mnovjTzqrFaoGMSmtJ8dM rOPgTbYszKxdIaH5A+CSbdIpY3UV/lZWO3enC9Q0uKJQkXbh3WDM7JV7Vhn15FZS8mWm nCDyVDlZoUaWyqjGrmg5vw3GwJaw71IMVonm52H6xbTwkSW5GVzQl0GyNjxT1Pkdzdz3 GFdQ== X-Gm-Message-State: APjAAAW5utVLxhMjyRTX3X7quP6QK/Rk0CFSfXC7k4/xA9GYhdPmtp7c mXk5o3ztdP5gnpCgUY4xW/uQljIuEb0= X-Google-Smtp-Source: APXvYqyyIeSFipY2L5zCrvjVyGV22e0fJLzKmD2ox0/iof9L1BYxpz68ozcPJ+7h0tr26Y1G/ABuhw== X-Received: by 2002:a05:6000:1286:: with SMTP id f6mr5211146wrx.44.1575115062180; Sat, 30 Nov 2019 03:57:42 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:30 +0000 Message-Id: <20191130115737.15752-2-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 1/8] x86: introduce CONFIG_GUEST and move 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 , 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) Xen is able to run as a guest on Xen. We plan to make it able to run on Hyper-V as well. Introduce CONFIG_GUEST which is set to true if either running on Xen or Hyper-V is desired. Restructure code hierarchy for new code to come. No functional change intended. Signed-off-by: Wei Liu Reviewed-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- xen/arch/x86/Kconfig | 7 +++++-- xen/arch/x86/Makefile | 2 +- xen/arch/x86/guest/Makefile | 5 +---- xen/arch/x86/guest/xen/Makefile | 4 ++++ xen/arch/x86/guest/{ =3D> xen}/hypercall_page.S | 0 xen/arch/x86/guest/{ =3D> xen}/pvh-boot.c | 0 xen/arch/x86/guest/{ =3D> xen}/xen.c | 0 7 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 xen/arch/x86/guest/xen/Makefile rename xen/arch/x86/guest/{ =3D> xen}/hypercall_page.S (100%) rename xen/arch/x86/guest/{ =3D> xen}/pvh-boot.c (100%) rename xen/arch/x86/guest/{ =3D> xen}/xen.c (100%) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 28b3b4692a..18c8f6fd26 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -161,9 +161,12 @@ config XEN_ALIGN_2M =20 endchoice =20 +config GUEST + bool + config XEN_GUEST - def_bool n - prompt "Xen Guest" + bool "Xen Guest" + select GUEST ---help--- Support for Xen detecting when it is running under Xen. =20 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index a0b2f4ab15..7da5a2631e 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -1,7 +1,7 @@ subdir-y +=3D acpi subdir-y +=3D cpu subdir-y +=3D genapic -subdir-$(CONFIG_XEN_GUEST) +=3D guest +subdir-$(CONFIG_GUEST) +=3D guest subdir-$(CONFIG_HVM) +=3D hvm subdir-y +=3D mm subdir-$(CONFIG_XENOPROF) +=3D oprofile diff --git a/xen/arch/x86/guest/Makefile b/xen/arch/x86/guest/Makefile index 26fb4b1007..6806f04947 100644 --- a/xen/arch/x86/guest/Makefile +++ b/xen/arch/x86/guest/Makefile @@ -1,4 +1 @@ -obj-y +=3D hypercall_page.o -obj-y +=3D xen.o - -obj-bin-$(CONFIG_PVH_GUEST) +=3D pvh-boot.init.o +subdir-$(CONFIG_XEN_GUEST) +=3D xen diff --git a/xen/arch/x86/guest/xen/Makefile b/xen/arch/x86/guest/xen/Makef= ile new file mode 100644 index 0000000000..26fb4b1007 --- /dev/null +++ b/xen/arch/x86/guest/xen/Makefile @@ -0,0 +1,4 @@ +obj-y +=3D hypercall_page.o +obj-y +=3D xen.o + +obj-bin-$(CONFIG_PVH_GUEST) +=3D pvh-boot.init.o diff --git a/xen/arch/x86/guest/hypercall_page.S b/xen/arch/x86/guest/xen/h= ypercall_page.S similarity index 100% rename from xen/arch/x86/guest/hypercall_page.S rename to xen/arch/x86/guest/xen/hypercall_page.S diff --git a/xen/arch/x86/guest/pvh-boot.c b/xen/arch/x86/guest/xen/pvh-boo= t.c similarity index 100% rename from xen/arch/x86/guest/pvh-boot.c rename to xen/arch/x86/guest/xen/pvh-boot.c diff --git a/xen/arch/x86/guest/xen.c b/xen/arch/x86/guest/xen/xen.c similarity index 100% rename from xen/arch/x86/guest/xen.c rename to xen/arch/x86/guest/xen/xen.c --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115101; cv=none; d=zohomail.com; s=zohoarc; b=TqedC3+bpML8rKBqZLkbuYZ7/Le3FJuJlLHq6EZqWVmM0AtuBxF7E5zHurSEAcMB8ujxNf+fIUECWD8PCae0GlGWUC82tZ57Fv0hOgb1Soc66W/0WE4YawVnk+RvjfllteihiAHXuTSoy/TrSqWkVoQNVwm+xrzHIr2v6of3Mko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115101; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uFP1Yk21hp662wdL5u4SIdzKdfWFlfzvIkYWq51M+Rc=; b=EsUEgHxhW7tPFHbEKk46/4YKR/LyTH6N5dFV8bSvh0iwafOmaRucvefZLsYXwLE3rQmSnPE/c/rGvCMFJQ7Ww1eHuiDL44dGyL2HPkZsJLmazv02tg0puq+t8Vtp/h/gKLd1S7D6yXe7niMjQ499uJpr9549Jud3dclC0+2D90E= ARC-Authentication-Results: i=1; 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 1575115101882518.0505312106121; Sat, 30 Nov 2019 03:58:21 -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 1ib1Np-0004ka-L3; Sat, 30 Nov 2019 11:57:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1No-0004kG-JF for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:57:52 +0000 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9de3358c-1368-11ea-9db0-bc764e2007e4; Sat, 30 Nov 2019 11:57:43 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id p9so1544972wmc.2 for ; Sat, 30 Nov 2019 03:57:43 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:42 -0800 (PST) X-Inumbo-ID: 9de3358c-1368-11ea-9db0-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=AVP+NJX1jO0Cy8PowYlfCy2l9JmfmeIKdgyamebmLNw=; b=aIHUb7L85/oXBMkQ+lLSCXcxfodoGzT2RuANQaynGHWyccJALKZX571qu/u0dmsiKN 61mIsu+u9TPyb/E5KVXkjeGNRZuC9djcoM22rmEWpecQWzDllW3RLjmUxwc+jdbZNpks OxAFLLzpu/e6VYa3vG+NcV+2gJBK3ByBVH1y8B1MynShwkUYBJxzzVNTIon0LLb4bdto JQSteo/HtBL7UOYWDhC+pjOF2k78K/fzj+g7mm1of+5/lRxqLEqB6F3Xcooo1sVTzNNr txczZqOoxWfJbD3GzCyx6MCOBINJmraTtnuqOyqZZ4ZL/1/XVfMxOqkjbTBVXFqDT+cU c4OQ== 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=AVP+NJX1jO0Cy8PowYlfCy2l9JmfmeIKdgyamebmLNw=; b=ShGhJOMcCSzzcSRPN6+d+IkUMI6GVFTLUZpLYz5IWFhbgGD3Omk5XQjL2c4hbZXS6V +2/TyHdgl13M90XZ9wm1Qboh8mv4syJgwgKeEeQ0yB8jImDgH+6nNxq3syuZX4cpkvrQ Q3Hbmb6Nx2G+eEgjbnA6Zcv+bhJbiKD8HtIEGNLEwPmX7aBOUYA5FOQeicqLFYH0baQ7 V3d85TIrt8qkTmVs1cn6kKTi4cv8jG1vgomFIYS6ZcVFHj5s0kj1Mhok81NiylKv/vze lO+5LGymh98tB1JM2HD66qdF3ppuExggDug2zBcnEI46I6QkvF7dWvl5Mlig4chZmtOf PK+g== X-Gm-Message-State: APjAAAUzZ/dc0D9fMgUlm184b6IEE62La8u11dFkOrUwqRPx9xNxqKBx /txk78qoRslwsrmMNLOBBCjehkPbIQU= X-Google-Smtp-Source: APXvYqyf6U71XGXoxA1M/K+FKlnKccclTPKrpyFVOXUEPvmIVUE63dglQzqSJ9B6INTgv/PEE/7f0Q== X-Received: by 2002:a1c:4e03:: with SMTP id g3mr5509640wmh.22.1575115063033; Sat, 30 Nov 2019 03:57:43 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:31 +0000 Message-Id: <20191130115737.15752-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 2/8] x86: add missing headers in hypercall.h 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=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) Include asm_defns.h because ASM_CALL_CONSTRAINT is defined there. Include xen/lib.h because we need ASSERT_UNREACHABLE. No functional change. Signed-off-by: Wei Liu Reviewed-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- xen/include/asm-x86/guest/hypercall.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/include/asm-x86/guest/hypercall.h b/xen/include/asm-x86/gu= est/hypercall.h index d548816b30..d0d2f5022d 100644 --- a/xen/include/asm-x86/guest/hypercall.h +++ b/xen/include/asm-x86/guest/hypercall.h @@ -23,6 +23,8 @@ =20 #include =20 +#include + #include #include #include @@ -180,6 +182,8 @@ static inline long xen_hypercall_set_evtchn_upcall_vect= or( =20 #else /* CONFIG_XEN_GUEST */ =20 +#include + #include =20 static inline void xen_hypercall_console_write( --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115106; cv=none; d=zohomail.com; s=zohoarc; b=ghhUbRmY7coJc1O2Bi6RUDahLDyhGummB3Ws68MKTOGvLi57uG6IsGncmoUPzzUr5WrKLNVB60Y7NxkU4rM/JzlVe9M184AgcyIRh//27hXX8JxBmUKircEqprfMIm1BaD1NP9QXKeOWZ+9doMBuYj/1RtBGwj+y1L4Bk8BfUhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115106; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dnf/w5D/h/G8R9tO4TiV3vtmc+LxCRiejuf7+Y1KuIA=; b=YaWoGfolcuMn+geLj+Yg0NRwnxpvV0HmgAOfCdhHH155d8dotDS/ogme9M5SACFDN+c4Eo/ezmkTB/JB5kOfAsXA9zU0S7oUdJ9rH7cj8CtvXPMoKHgQQmIX456gh1PiOz0BJBquWYWweJ9WKHN522lEO22Xruh4p/H4hqmqBzg= ARC-Authentication-Results: i=1; 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 1575115106334930.2575872181103; Sat, 30 Nov 2019 03:58:26 -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 1ib1Nu-0004mR-TS; Sat, 30 Nov 2019 11:57:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1Nt-0004m2-Jd for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:57:57 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9e753e0a-1368-11ea-a55d-bc764e2007e4; Sat, 30 Nov 2019 11:57:44 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id l17so16602693wmh.0 for ; Sat, 30 Nov 2019 03:57:44 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:43 -0800 (PST) X-Inumbo-ID: 9e753e0a-1368-11ea-a55d-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=Lp9dPk3GM26kCtmFBzgGz5LRW9FjTOSuocsi0vK/bvk=; b=RYNxlWUUz22gfLgAPlY295110vUhVh5tiLrKKD6izCBlP4UoZ77TSR2APUYTmN2bnG LQcLFW37JkxETf69TGvr+8o/h94zigGD2rETLaUd6ab0nqdVRXUfnP0RLebdBknosCLN 2i7aoXGWsJ03HCo53oVTReTjPeB5gD/bXhXAY/g3Bfuho3XJh1eIoAPy1Zn8ASYJx3P2 qavoxKLeZgYYmpxN0pNHk8PmmfHWRi4i7XxxFuRhoVm6wLLxvkRZ+0VCNUBrytsmQe3E Ba/eMYr6HT5PjCMge6Vb+F8g//+vjKoFrGYOY0gMU1mbhw+rvs0QA+iJKK1lTrkqZkMd Rs7g== 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=Lp9dPk3GM26kCtmFBzgGz5LRW9FjTOSuocsi0vK/bvk=; b=EJm8v7QUHX4XOpLfy3kkeOfl825wdXInvV6SwiJKV0NYBBnnXhDLKHVVbAEGReEOVm TcXBuIeAckWclSXHXRJD13tF6LGvU+005dBBa024HaHwtUXknehQ58UR9DiebdOfvjg2 KRVJO4+SmAXBsX6VySFYIs4nt+O+1qegu6Z9U1OT2BJDYwqOqGNknn1uIxp/P9fRdIDb miRKymO8Ybg8FEkSlWoLsYP78Uye7KIvp2DaALLwThKOcUg8uc30Rpuzt+VFQwXIcFki fbl6zfXrpf0ArDSiOpZVFhlW4od2SkCWzFqzmC57CnWRSnI4xhZvKKu8Yg+HmWYMGmxn eHcg== X-Gm-Message-State: APjAAAUx6BwgPKOu773nMYv38OiCg636Z2Y/LN30bY3NX+sN6rN/pgzL d5GLq1VRFNU7uEQgOz06Rv4fnFO6J3s= X-Google-Smtp-Source: APXvYqzhg7KT3JYZK7faMWVDwdoxUSEAOV85+oooagilgpLgmT9/f8yYGaKAYnXwHSGGY0fEJWBWSw== X-Received: by 2002:a1c:f210:: with SMTP id s16mr19526949wmc.76.1575115063958; Sat, 30 Nov 2019 03:57:43 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:32 +0000 Message-Id: <20191130115737.15752-4-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 3/8] x86: drop hypervisor_cpuid_base 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=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) The only user is Xen specific code in PV shim. We can therefore export the variable directly. Move __read_mostly to its standard place while at it. Signed-off-by: Wei Liu Reviewed-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- xen/arch/x86/guest/xen/xen.c | 7 +------ xen/arch/x86/pv/shim.c | 2 +- xen/include/asm-x86/guest/xen.h | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index a329e7c886..1e37086518 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -37,7 +37,7 @@ =20 bool __read_mostly xen_guest; =20 -static __read_mostly uint32_t xen_cpuid_base; +uint32_t __read_mostly xen_cpuid_base; extern char hypercall_page[]; static struct rangeset *mem; =20 @@ -297,11 +297,6 @@ int hypervisor_free_unused_page(mfn_t mfn) return rangeset_remove_range(mem, mfn_x(mfn), mfn_x(mfn)); } =20 -uint32_t hypervisor_cpuid_base(void) -{ - return xen_cpuid_base; -} - static void ap_resume(void *unused) { map_vcpuinfo(); diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c index 35bf3945ac..351da970ef 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -995,7 +995,7 @@ domid_t get_initial_domain_id(void) if ( !pv_shim ) return 0; =20 - cpuid(hypervisor_cpuid_base() + 4, &eax, &ebx, &ecx, &edx); + cpuid(xen_cpuid_base + 4, &eax, &ebx, &ecx, &edx); =20 return (eax & XEN_HVM_CPUID_DOMID_PRESENT) ? ecx : 1; } diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xe= n.h index 7e04e4a7ab..b015ed1883 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -30,13 +30,13 @@ =20 extern bool xen_guest; extern bool pv_console; +extern uint32_t xen_cpuid_base; =20 void probe_hypervisor(void); void hypervisor_setup(void); void hypervisor_ap_setup(void); int hypervisor_alloc_unused_page(mfn_t *mfn); int hypervisor_free_unused_page(mfn_t mfn); -uint32_t hypervisor_cpuid_base(void); void hypervisor_resume(void); =20 DECLARE_PER_CPU(unsigned int, vcpu_id); --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115110; cv=none; d=zohomail.com; s=zohoarc; b=C4QXmMr96uQBZJ8sRBFv+QojbS/Plk4hZ+m0gdiRTw5WylVDycFYyJyCkYoQ4mMpKuOzYnu6PNKjJ9yX9iLQkv9jK0EQSMyksSsub6avzHeLqNBIWt9k2y+dVLrWsUAaPz6CelHtNmaF9audYEU7JVbrO33aVKV8blswc7FmEjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115110; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=omfyPLSXI2/0WcM/JkfT1NraNDROyvEpPkGkykFLQe0=; b=eO7aZG1wAoTmH5Tcsbuvn0oyAmhsjrtwNGQrfmEM93u4NzejosXDSQppO8CaSPF1W9Kma+BGRYoJ33EdhBpdLBsf4+fWdLglGHDXDQxkGxQm/3oGO/2pMuUi1T7CqdT6eiHkXgequ0rTTanarqE0ehquPVT+4YQeP6DkaEbd9wQ= ARC-Authentication-Results: i=1; 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 157511511086183.20458881732088; Sat, 30 Nov 2019 03:58:30 -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 1ib1Nz-0004pJ-AR; Sat, 30 Nov 2019 11:58:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1Ny-0004p0-KG for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:58:02 +0000 Received: from mail-wr1-x443.google.com (unknown [2a00:1450:4864:20::443]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9f10bdf8-1368-11ea-b155-bc764e2007e4; Sat, 30 Nov 2019 11:57:45 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id j42so12278295wrj.12 for ; Sat, 30 Nov 2019 03:57:45 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:44 -0800 (PST) X-Inumbo-ID: 9f10bdf8-1368-11ea-b155-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=P1aIvZ8fTBz3xENcDC1X1bofcpCEFX/45dhlRoFAdhU=; b=LsMaQvDge7dI9UkFINm/bUnDbeSJXtJH9VqQMtrETjo+I8B4dg91BTpSa5b/fcwv1w 3m5wQaQsgtzIdWhMr+fI1tKlKM6p78bHpau+2ZHnlhI9i3V5lh81HFOVc8xNB9J9TCYB U/IwkVFoj/0zL+t/MlXXVVHZ69EBWXj+CeChVl4uPK7xUbSW2AUkET7vcVQOdB14dd1t 6BcC6DRHsIAMZ+XqpwzOssQYbZGwLKH4nCGf1d+RQT0TRUnQ6MsZlruhRdV+x+5419NA hDHBCRhW8SmvxcNibQhrkhXtNrOHu4Jd1lqkoAYEdnwZdFp6QyceF7/FQQ1DuKmVqPVB AGiA== 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=P1aIvZ8fTBz3xENcDC1X1bofcpCEFX/45dhlRoFAdhU=; b=sVXEAHGVtUnm1QxEXTH96NsnBXHT4D0d9c1zcRjvDLtI0K20OXSv1otWFZlRQVYr1u nGC+ChFRm50Zj0Tk8Gl+M7rm1uU/WqO+Ss4LsalSvmlJzUuNWi2VgJ0+j0+h8GIv9vdW 4HEQwZ1Y1WCmPfAdifkzOLL1JNlmr0qXov7TGJtyfwZ2vY2KomlMxYiF5zNr2iasKhHK rm3+nTUvmsqFwZcbauwpC/eoVwd+/ZhTzd7+jZFJm7Gl+4FpmASY8LZ5oGbyc+I1HXJ0 IAPQWJbUDNLVzF6gG178ukG8j5RxTEVI6ymyIUSXKEr3Wz0Y/Wkwuwzo/OikQh8QWnTe DVOw== X-Gm-Message-State: APjAAAUhKGt689QenRmoQCF3yKfVJi+/itwU6Bq7JrLEC9WUgw1Zuv8x AZWTGIdbZbd43uVRzeldZoXCPMP+ci0= X-Google-Smtp-Source: APXvYqwJEl4pRyWaaonV+bUsFXMXE3Jz98ibJ6okhcKk5LIlN9sQ8AjXKfHzKGGp1Fl7wTgD894DuQ== X-Received: by 2002:adf:e78a:: with SMTP id n10mr39504343wrm.62.1575115064930; Sat, 30 Nov 2019 03:57:44 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:33 +0000 Message-Id: <20191130115737.15752-5-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 4/8] x86: introduce hypervisor framework 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=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 will soon implement Hyper-V support for Xen. Add a framework for that. This requires moving some of the hypervisor_* functions from xen.h to hypervisor.h. Signed-off-by: Wei Liu Acked-by: Jan Beulich --- Changes in v5: 1. Make hypervisor_probe return const char *. Changes in v4: 1. Add ASSERT_UNREACHABLE to stubs. 2. Move __read_mostly. 3. Return hops directly. 4. Drop Paul's review tag. --- xen/arch/x86/guest/Makefile | 2 + xen/arch/x86/guest/hypervisor.c | 45 +++++++++++++++++++ xen/include/asm-x86/guest.h | 1 + xen/include/asm-x86/guest/hypervisor.h | 62 ++++++++++++++++++++++++++ xen/include/asm-x86/guest/xen.h | 12 ----- 5 files changed, 110 insertions(+), 12 deletions(-) create mode 100644 xen/arch/x86/guest/hypervisor.c create mode 100644 xen/include/asm-x86/guest/hypervisor.h diff --git a/xen/arch/x86/guest/Makefile b/xen/arch/x86/guest/Makefile index 6806f04947..f63d64bbee 100644 --- a/xen/arch/x86/guest/Makefile +++ b/xen/arch/x86/guest/Makefile @@ -1 +1,3 @@ +obj-y +=3D hypervisor.o + subdir-$(CONFIG_XEN_GUEST) +=3D xen diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.c new file mode 100644 index 0000000000..c35c610d01 --- /dev/null +++ b/xen/arch/x86/guest/hypervisor.c @@ -0,0 +1,45 @@ +/*************************************************************************= ***** + * arch/x86/guest/hypervisor.c + * + * Support for detecting and running under a hypervisor. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . + * + * Copyright (c) 2019 Microsoft. + */ +#include +#include + +#include +#include + +static const struct hypervisor_ops __read_mostly *ops; + +const char *__init hypervisor_probe(void) +{ + if ( ops ) + return ops->name; + + return NULL; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/asm-x86/guest.h b/xen/include/asm-x86/guest.h index a38c6b5b3f..8e167165ae 100644 --- a/xen/include/asm-x86/guest.h +++ b/xen/include/asm-x86/guest.h @@ -20,6 +20,7 @@ #define __X86_GUEST_H__ =20 #include +#include #include #include #include diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/g= uest/hypervisor.h new file mode 100644 index 0000000000..392f4b90ae --- /dev/null +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -0,0 +1,62 @@ +/*************************************************************************= ***** + * asm-x86/guest/hypervisor.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms and conditions of the GNU General Public + * License, version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; If not, see . + * + * Copyright (c) 2019 Microsoft. + */ + +#ifndef __X86_HYPERVISOR_H__ +#define __X86_HYPERVISOR_H__ + +struct hypervisor_ops { + /* Name of the hypervisor */ + const char *name; + /* Main setup routine */ + void (*setup)(void); + /* AP setup */ + void (*ap_setup)(void); + /* Resume from suspension */ + void (*resume)(void); +}; + +#ifdef CONFIG_GUEST + +const char *hypervisor_probe(void); +void hypervisor_setup(void); +void hypervisor_ap_setup(void); +void hypervisor_resume(void); + +#else + +#include +#include + +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 void hypervisor_resume(void) { ASSERT_UNREACHABLE(); } + +#endif /* CONFIG_GUEST */ + +#endif /* __X86_HYPERVISOR_H__ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xe= n.h index b015ed1883..3145f75361 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -33,11 +33,8 @@ extern bool pv_console; extern uint32_t xen_cpuid_base; =20 void probe_hypervisor(void); -void hypervisor_setup(void); -void hypervisor_ap_setup(void); int hypervisor_alloc_unused_page(mfn_t *mfn); int hypervisor_free_unused_page(mfn_t mfn); -void hypervisor_resume(void); =20 DECLARE_PER_CPU(unsigned int, vcpu_id); DECLARE_PER_CPU(struct vcpu_info *, vcpu_info); @@ -49,15 +46,6 @@ DECLARE_PER_CPU(struct vcpu_info *, vcpu_info); =20 static inline void probe_hypervisor(void) {} =20 -static inline void hypervisor_setup(void) -{ - ASSERT_UNREACHABLE(); -} -static inline void hypervisor_ap_setup(void) -{ - ASSERT_UNREACHABLE(); -} - #endif /* CONFIG_XEN_GUEST */ #endif /* __X86_GUEST_XEN_H__ */ =20 --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115115; cv=none; d=zohomail.com; s=zohoarc; b=bDvsCilNIvG+bAVbVwFfGT0meVc+j2g/obvfEG6bGntgOcQmOzDlMq+fSUyHP2PK9l9rbkghfvcroqJk00PDa64bwRXQVWHGpU3G7cIUlPNdu4qbIaMKTBVVSIcM2Z8INqjm/GTrDooMqk4l7FyGDBkNRCLnclXCfvU02XAewd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115115; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rnQLHKQ9I/M6pqcw/eLW55H30a3pt+g0T0VsDWsa8ME=; b=b8iCNOJnpcF7PxTdzWLEXZARtl9B6dTYUcO5SZ9pq9jRCjp02lY5U8xoK7lPi+3SJN7//bEKJxouV1j5XeSK9eFM+oebm8nTwYFRZV1KEVa7ZVu0KVg9FtfoqQMdm0v1Iqn0TgTHDkvPu2NU4IQ+kmKVMOvqq159HIDnXJZ4t40= ARC-Authentication-Results: i=1; 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 157511511515899.29805151988023; Sat, 30 Nov 2019 03:58:35 -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 1ib1O4-0004s3-KY; Sat, 30 Nov 2019 11:58:08 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1O3-0004rU-L6 for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:58:07 +0000 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9f9f7372-1368-11ea-9db0-bc764e2007e4; Sat, 30 Nov 2019 11:57:46 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id j42so12278316wrj.12 for ; Sat, 30 Nov 2019 03:57:46 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:45 -0800 (PST) X-Inumbo-ID: 9f9f7372-1368-11ea-9db0-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=aF2MOBbI22XVZVTeoITRt1VPD08a0otFAVUzMFsLzLw=; b=EhscjL2OLRAUEsuFjy4BwU6j3iZDmJU4YtLQCTDrquzlUMcun0QEPXMlNh2XCr3fbW 0W64blpl/0ANBCAVOQSUTLAy5OvRzA470Dtkx4Ukm9piySJztNerm9g5vqUaFLLQFftn jANKun1A9JAb+gFg6wUNg7tG5Gzz4T6Ldh/x1tSuBZvfLV1F8D1cmUkinpQRZ8CSxAO/ GMwHgtQJ1/fQERkzKB80EtuHGFY3CWzGLeS6dNjlFfSXQDK2eqhv1BL+uuDABMwV9orV qj+m3ItFXODJuJc8RHjGkGxkppKU2LVfKyDPpp2Ync3XTqDzo6ebFnwtKZsEUC0x5n9U u5sA== 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=aF2MOBbI22XVZVTeoITRt1VPD08a0otFAVUzMFsLzLw=; b=a5w+/6LbcOTuwJbsfo+fH6tyKYsB73oGJ5VrfoHPzt+Fui8hhq26Ca8Uu4nvVVlol2 sfGUKwHud4wxDozTvtcKqlasx4wSMbl1O0+FgPb2bKbHk0GaJKdMUfGXhCM/EoduYFA2 hz1Geh8ylrmRBl9nMI57/YWupQtLlvP7cpr10WMrzOiGr0ScMB3JGarGJouSiYMTPWD/ pc8ExSDfpwGVTF8bglEocQJY8RsxVdOb18kQ01ewaZsDH8snfmpurwc/J+528mYGrOcN IJu0mfEyyjDFPFmlpKWEynp7u0WlIiEtyaCHVmGN3DfGbeWw/dOOgxERnl7xLY7x3GH/ GiXA== X-Gm-Message-State: APjAAAXl5ty27agawNN6DTkFf00JMNl3hoGrQfHeCYn3Z49KBudETSC/ dGakQqbex5xHgzKCA1ufu5oLh4+JM+g= X-Google-Smtp-Source: APXvYqz8VMnDwshl771gOfNO0EHtBNEMv7fqxpNtF8QTMEb2oQ2b0lnVLXvLf+eGTZQcD2ZzfUAhJA== X-Received: by 2002:a5d:6089:: with SMTP id w9mr13591842wrt.228.1575115065819; Sat, 30 Nov 2019 03:57:45 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:34 +0000 Message-Id: <20191130115737.15752-6-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 5/8] x86: rename hypervisor_{alloc, free}_unused_page 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) They are used in Xen code only. No functional change. Signed-off-by: Wei Liu Reviewed-by: Paul Durrant Acked-by: Jan Beulich --- xen/arch/x86/guest/xen/xen.c | 6 +++--- xen/arch/x86/pv/shim.c | 4 ++-- xen/include/asm-x86/guest/xen.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 1e37086518..0f5b5267c5 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -93,7 +93,7 @@ static void map_shared_info(void) unsigned int i; unsigned long rc; =20 - if ( hypervisor_alloc_unused_page(&mfn) ) + if ( xg_alloc_unused_page(&mfn) ) panic("unable to reserve shared info memory page\n"); =20 xatp.gpfn =3D mfn_x(mfn); @@ -280,7 +280,7 @@ void hypervisor_ap_setup(void) init_evtchn(); } =20 -int hypervisor_alloc_unused_page(mfn_t *mfn) +int xg_alloc_unused_page(mfn_t *mfn) { unsigned long m; int rc; @@ -292,7 +292,7 @@ int hypervisor_alloc_unused_page(mfn_t *mfn) return rc; } =20 -int hypervisor_free_unused_page(mfn_t mfn) +int xg_free_unused_page(mfn_t mfn) { return rangeset_remove_range(mem, mfn_x(mfn), mfn_x(mfn)); } diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c index 351da970ef..7a898fdbe5 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -742,7 +742,7 @@ static long pv_shim_grant_table_op(unsigned int cmd, }; mfn_t mfn; =20 - rc =3D hypervisor_alloc_unused_page(&mfn); + rc =3D xg_alloc_unused_page(&mfn); if ( rc ) { gprintk(XENLOG_ERR, @@ -754,7 +754,7 @@ static long pv_shim_grant_table_op(unsigned int cmd, rc =3D xen_hypercall_memory_op(XENMEM_add_to_physmap, &xat= p); if ( rc ) { - hypervisor_free_unused_page(mfn); + xg_free_unused_page(mfn); break; } =20 diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xe= n.h index 3145f75361..01dc3ee6f6 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -33,8 +33,8 @@ extern bool pv_console; extern uint32_t xen_cpuid_base; =20 void probe_hypervisor(void); -int hypervisor_alloc_unused_page(mfn_t *mfn); -int hypervisor_free_unused_page(mfn_t mfn); +int xg_alloc_unused_page(mfn_t *mfn); +int xg_free_unused_page(mfn_t mfn); =20 DECLARE_PER_CPU(unsigned int, vcpu_id); DECLARE_PER_CPU(struct vcpu_info *, vcpu_info); --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115122; cv=none; d=zohomail.com; s=zohoarc; b=TNzgTQPlIlDlUNyM2/tO2/2opkzyEwgk2fKTa/RCccAjAxWbTPGhDaDnV9pH9w9JF9h6pIET4mJzLZzMlVu91N6m3kIcranVMut37E1+/ZvwgO46bDLS3PiSY1+GXEEizNr78B14P/jfZn3h71po1x5QsEdhhh2UoJuheI91qGM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115122; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ADcBy7wMm8Pi3m2qUrBjpZd8OiEHVQDFOvnQY3AdF4s=; b=nDzMs9iKGrsYHx0TPGQYtep1iiecu2rZcbKEpqtKAoAP+pOlib8fFAPUV8nC5WPgWUOeCTXJN2DrGTIBaKfgLhQcCu2+21+4B5/Wtbe2dkyP2EksnSaAgAvKFteU/0/FDCSOSEV1Hq8ChhQktSxRCVpPuEbwdUAI4Rm6IwoIAsA= ARC-Authentication-Results: i=1; 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 1575115122496522.4741284927919; Sat, 30 Nov 2019 03:58:42 -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 1ib1O9-0004v8-UM; Sat, 30 Nov 2019 11:58:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1O8-0004uQ-Kh for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:58:12 +0000 Received: from mail-wr1-x442.google.com (unknown [2a00:1450:4864:20::442]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a02b3010-1368-11ea-a55d-bc764e2007e4; Sat, 30 Nov 2019 11:57:47 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id c14so13532190wrn.7 for ; Sat, 30 Nov 2019 03:57:47 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:46 -0800 (PST) X-Inumbo-ID: a02b3010-1368-11ea-a55d-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=hAlY2mNPHIbwQq8gmJ9oB1h1pr+UFRMqeVy8IETeg28=; b=YPbuyCZvZnlI09kHn8Lw23Wii9VkaVhL1vxtP6HwQIxQb0TdpclkJFdNjeE/qkJPxh 1L4f5loM6BjTcEgkE4O4u0mPItM3o2BZgOBRi3TO4j1J49Vh3HsyViO05Sxdh9m+6qCv +TVjsyckaJ/sxYsOBbrt1CTN4rNXwOBVn50svIyJJI0JaPufppg1UqfdNzZL+yRcXriO F8UsLcNZSqf1vqcI0wQPFn+1wi2c02Fs5fw9MAmymcZb2Hd3FfQxER2VV+pmP+gUhFp0 wUkQHb/2+a23Hp07Wp/tljrcyuAwbg0QA9qYbxEyVOxhgWo993oixzYGPr7Ll8KuUsuo Oe0Q== 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=hAlY2mNPHIbwQq8gmJ9oB1h1pr+UFRMqeVy8IETeg28=; b=KtrhDl/Lj0i9xAzh6udN7fHeIZs7CmIOBIQS3MiZNOA88xATEp0QPaRRIDpvvX7CBV TbFmiGH2JE/+2Iq3/6Oj5mxRqdfdZmODYPpDEtBLIoKoxX9QJRMcoj3eIm9c3OOOgqaG g0bHLBHiRYFkRkoGJoJ9yhHPs7WHDHFAl4ffKtz07VAcenbrA+NVYTUCElMsKmZPj3JJ XgmN2BYzbXrMp7iHFZNrIohTOl5EH0arhnq7hKJnzC87hQyfBcs8Z6xKzohIQT1kKP0Q qZB+/74dsWMCTyx2KZYtvwzm7+chgFvplYtkvMfJdcis/zIzlOLoDtUkNI085hGvWiB7 bPXw== X-Gm-Message-State: APjAAAUeyAJU7wRLMUeNDUgpxsA6gy/MJDG3E+3qRP96GzHFjpLQyivn 5V6/JLy1ROXZTIh4SeDlRosvA+RBOUs= X-Google-Smtp-Source: APXvYqycs0h31dIHSKhfIZX/ghtUZItEZeYZVZMfs/23yh/x17ubMGmEiMZXC4p9qof5fXXgCl5Q6A== X-Received: by 2002:a5d:548e:: with SMTP id h14mr3081916wrv.380.1575115066753; Sat, 30 Nov 2019 03:57:46 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:35 +0000 Message-Id: <20191130115737.15752-7-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 6/8] x86: switch xen guest implementation to use hypervisor framework 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=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) Signed-off-by: Wei Liu Acked-by: Jan Beulich --- Changes in v5: 1. xen_probe -> xg_probe 2. Drop xen_ prefix for private functions --- xen/arch/x86/guest/hypervisor.c | 27 +++++++++++++++++- xen/arch/x86/guest/xen/pvh-boot.c | 2 +- xen/arch/x86/guest/xen/xen.c | 47 ++++++++++++++++++------------- xen/arch/x86/setup.c | 2 +- xen/include/asm-x86/guest/xen.h | 5 ++-- 5 files changed, 59 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.c index c35c610d01..6cd86d0c02 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -22,18 +22,43 @@ #include =20 #include -#include +#include =20 static const struct hypervisor_ops __read_mostly *ops; =20 const char *__init hypervisor_probe(void) { + if ( !cpu_has_hypervisor ) + return NULL; + + if ( ops ) + return ops->name; + + ops =3D xg_probe(); if ( ops ) return ops->name; =20 return NULL; } =20 +void __init hypervisor_setup(void) +{ + if ( ops && ops->setup ) + ops->setup(); +} + +void hypervisor_ap_setup(void) +{ + if ( ops && ops->ap_setup ) + ops->ap_setup(); +} + +void hypervisor_resume(void) +{ + if ( ops && ops->resume ) + ops->resume(); +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/guest/xen/pvh-boot.c b/xen/arch/x86/guest/xen/pvh= -boot.c index ca8e156f7d..498625eae0 100644 --- a/xen/arch/x86/guest/xen/pvh-boot.c +++ b/xen/arch/x86/guest/xen/pvh-boot.c @@ -103,7 +103,7 @@ void __init pvh_init(multiboot_info_t **mbi, module_t *= *mod) { convert_pvh_info(mbi, mod); =20 - probe_hypervisor(); + hypervisor_probe(); ASSERT(xen_guest); =20 get_memory_map(); diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 0f5b5267c5..10daa043e4 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -67,22 +67,6 @@ static void __init find_xen_leaves(void) } } =20 -void __init probe_hypervisor(void) -{ - if ( xen_guest || !cpu_has_hypervisor ) - return; - - find_xen_leaves(); - - if ( !xen_cpuid_base ) - return; - - /* Fill the hypercall page. */ - wrmsrl(cpuid_ebx(xen_cpuid_base + 2), __pa(hypercall_page)); - - xen_guest =3D true; -} - static void map_shared_info(void) { mfn_t mfn; @@ -245,7 +229,7 @@ static void init_evtchn(void) } } =20 -void __init hypervisor_setup(void) +static void __init setup(void) { init_memmap(); =20 @@ -273,7 +257,7 @@ void __init hypervisor_setup(void) init_evtchn(); } =20 -void hypervisor_ap_setup(void) +static void ap_setup(void) { set_vcpu_id(); map_vcpuinfo(); @@ -303,7 +287,7 @@ static void ap_resume(void *unused) init_evtchn(); } =20 -void hypervisor_resume(void) +static void resume(void) { /* Reset shared info page. */ map_shared_info(); @@ -326,6 +310,31 @@ void hypervisor_resume(void) pv_console_init(); } =20 +static const struct hypervisor_ops xg_ops =3D { + .name =3D "Xen", + .setup =3D setup, + .ap_setup =3D ap_setup, + .resume =3D resume, +}; + +const struct hypervisor_ops *__init xg_probe(void) +{ + if ( xen_guest ) + return &xg_ops; + + find_xen_leaves(); + + if ( !xen_cpuid_base ) + return NULL; + + /* Fill the hypercall page. */ + wrmsrl(cpuid_ebx(xen_cpuid_base + 2), __pa(hypercall_page)); + + xen_guest =3D true; + + return &xg_ops; +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 7d27f36053..a6b354c29f 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -763,7 +763,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) * allocing any xenheap structures wanted in lower memory. */ kexec_early_calculations(); =20 - probe_hypervisor(); + hypervisor_probe(); =20 parse_video_info(); =20 diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xe= n.h index 01dc3ee6f6..2042a9a0c2 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -23,6 +23,7 @@ =20 #include #include +#include =20 #define XEN_shared_info ((struct shared_info *)fix_to_virt(FIX_XEN_SHARED_= INFO)) =20 @@ -32,7 +33,7 @@ extern bool xen_guest; extern bool pv_console; extern uint32_t xen_cpuid_base; =20 -void probe_hypervisor(void); +const struct hypervisor_ops *xg_probe(void); int xg_alloc_unused_page(mfn_t *mfn); int xg_free_unused_page(mfn_t mfn); =20 @@ -44,7 +45,7 @@ DECLARE_PER_CPU(struct vcpu_info *, vcpu_info); #define xen_guest 0 #define pv_console 0 =20 -static inline void probe_hypervisor(void) {} +static inline const struct hypervisor_ops *xg_probe(void) { return NULL; } =20 #endif /* CONFIG_XEN_GUEST */ #endif /* __X86_GUEST_XEN_H__ */ --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115132; cv=none; d=zohomail.com; s=zohoarc; b=mbd0yQE5iufClwVcJ/uYgScfR91rLwJVEjiibsV4Ctv027Jl4V0+SPMZNHNO+uf9UzcQqn2pL9mB4X5hTcPo1aSCbtAi9LMnZlIujv1QM6PMuMlONLKpPMN48QG/uL7wzEQ2phB3/WXvq9BZ6OoOWyGHzKXVN0Q5e6ayLdPqhZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115132; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KTsxnfCff14UookZ2dbpPpxB18aRyQJhsIdWn8dhJ2k=; b=GN1XvNSgqlX8GhFhC0U73jZKjIUdYV1/4pUhEachlv9/LBBxyPiqcLflFLCNWsNbUay+mVRdgZ+goeYNcNabKdDw6UHAFMZH28/7V+l1CNdtM/+HffTnL53uBeJA+Aq/eNzrdcv993ncl6V/2biVfACEeErgvxfwlcR4PVIjW2s= ARC-Authentication-Results: i=1; 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 1575115132886286.0028263889784; Sat, 30 Nov 2019 03:58:52 -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 1ib1OE-0004xn-9h; Sat, 30 Nov 2019 11:58:18 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1OD-0004xP-Li for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:58:17 +0000 Received: from mail-wr1-x441.google.com (unknown [2a00:1450:4864:20::441]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a0a926be-1368-11ea-a55d-bc764e2007e4; Sat, 30 Nov 2019 11:57:48 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id z7so34679617wrl.13 for ; Sat, 30 Nov 2019 03:57:48 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:47 -0800 (PST) X-Inumbo-ID: a0a926be-1368-11ea-a55d-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=cP76/cS0Q1i/wf27JixlotPAM1oHWVpKqPMlb1E5RNc=; b=qgqFzb61/MwHekLL2zc4ueue6TPByWS9JAf32t5kfixkfOCbNjsUG6K2ZUg5QgUyi8 J8clL0cUPRVN79qyNn6E4FHyv4AsMUF8OjZKy20pIa8VxCm1N8CbBB+3HkCnUiD3ZcyL 3j2+QJ9OoWTvp70kraX2lHGKJRyHt2BroXucX3iTpGM9UBF1m1pW/7HdUX82LqUU079X uiRJ8e8ldoYOM/9hiGFLY+m5g7DiKZ/qFOqgXRojKkEqyPmfD4/TF441dqyooqzRkeTA PLHKByNy/S3fXVCNDd7or/vmx6TxpmSa7sddOn80y/XwgOkHodd3SjKALhGmwwD6bPE8 5LGQ== 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=cP76/cS0Q1i/wf27JixlotPAM1oHWVpKqPMlb1E5RNc=; b=kcQuN2nM2Om7N0L8vj7c5KdnliA6BztuK0pdfu9YDL7G7RPQs8NqScamBoQherMuQI Wv75Pikonp/5PmNFA7MCiBSgtTrYw/7HCLWgPaYuY0M1gfbtm4BspP/oDwVl/DSsuzzO 4xAGeRgX54fgLb8p12swAEHBGPekiMTRo/sJPlymR9fVVGNXYP1uaW4LufUc1kZDToAY Jx89s+4fcNdN0k4yXFeAYZ1evxrLsXMEleumtnH1EJUhHGDdOlY9faz+EOkFsh+IDzJz DGpp31uUCpIaGzbhoxPgpi7PYjpEfdWAACHKYXU7vkZ7DSx/yuFwDVeGORo+M9Qg/a7B K3Vg== X-Gm-Message-State: APjAAAW9C2zAxqBLh3uPBd3OVv7BVg6GJqWARqUnCQXnmWshWVitx31C qUKj594fKYhiq4ZwBDngJ/1DxlztiQk= X-Google-Smtp-Source: APXvYqznFFz48yz0+q63EbYkN35ihorBYWGIKgtFa1LRaQaW0nxkC8VjXUyhRoF4DSXGXcfah5pbvA== X-Received: by 2002:a5d:4b08:: with SMTP id v8mr56413524wrq.338.1575115067710; Sat, 30 Nov 2019 03:57:47 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:36 +0000 Message-Id: <20191130115737.15752-8-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 7/8] x86: be more verbose when running on a hypervisor 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=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) Also replace reference to xen_guest. Signed-off-by: Wei Liu Acked-by: Jan Beulich --- Changes in v5: 1. Cache and use hypervisor name instead --- xen/arch/x86/setup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index a6b354c29f..fc049eaac8 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -700,6 +700,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) .max_grant_frames =3D -1, .max_maptrack_frames =3D -1, }; + const char *hypervisor_name; =20 /* Critical region without IDT or TSS. Any fault is deadly! */ =20 @@ -763,7 +764,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) * allocing any xenheap structures wanted in lower memory. */ kexec_early_calculations(); =20 - hypervisor_probe(); + hypervisor_name =3D hypervisor_probe(); =20 parse_video_info(); =20 @@ -788,6 +789,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) printk("Command line: %s\n", cmdline); =20 printk("Xen image load base address: %#lx\n", xen_phys_start); + if ( hypervisor_name ) + printk("Running on %s\n", hypervisor_name); =20 #ifdef CONFIG_VIDEO printk("Video information:\n"); @@ -1569,7 +1572,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) max_cpus =3D nr_cpu_ids; } =20 - if ( xen_guest ) + if ( hypervisor_name ) hypervisor_setup(); =20 /* Low mappings were only needed for some BIOS table parsing. */ --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 16:41:26 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1575115131; cv=none; d=zohomail.com; s=zohoarc; b=U0qosOTfLf5wzUu4gO+wyB+0sopKJf02CUr0MBwLRqKFABeOj49mMVhPWyl9L1u5m8g0bJQUGkjKoOFMVy9d9i7mvGDIvfSRLoOUjz4J3ZZ0EWPprOiLs+IKYEjiGXqYXDbsB77xiDtkW3O0jRbkGTpJrPsEVUsW0KvjaCma6VQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575115131; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eAmC1PJK+qFmkHVNf23ap3zoyw/LwWhEa8xoZqQWEfo=; b=HKjxVMxRCfoU/k34tLMvVhURd/TOMfdwGwNR32SNaH/nUVIlOaaRc1HEFaF8Imrrf2/GT+ZxiS/CkWIJV3nY7NbeO26L9sj3a60AT3Z8s0AaUzesr5I1KPJ1p3adZ8vVbqxZIc+8h90qVKBvhyBaTS3G1RPG2ZKdPmZB2eOH7+8= ARC-Authentication-Results: i=1; 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 157511513158720.782033021920142; Sat, 30 Nov 2019 03:58:51 -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 1ib1OJ-000527-NT; Sat, 30 Nov 2019 11:58:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ib1OI-00051O-LW for xen-devel@lists.xenproject.org; Sat, 30 Nov 2019 11:58:22 +0000 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a149a7c4-1368-11ea-a55d-bc764e2007e4; Sat, 30 Nov 2019 11:57:49 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id t14so167089wmi.5 for ; Sat, 30 Nov 2019 03:57:49 -0800 (PST) Received: from debian.mshome.net (122.163.200.146.dyn.plus.net. [146.200.163.122]) by smtp.gmail.com with ESMTPSA id z11sm2227769wrt.82.2019.11.30.03.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 03:57:48 -0800 (PST) X-Inumbo-ID: a149a7c4-1368-11ea-a55d-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=zO5WWvofCaNtb+2iRPgQhDe+6eaidUu+sZbVOEdcssc=; b=ODKR0+BNmiPZgEqo7USKmQh5uehoxv03b1nHXJPXxBVkttgyYbHmwqolLj93GMCIgL 2NgDlbWnndb5Ehwbx6CW/MJPgb/BLdcAqRKzY5Ww9NC9plraIyP7vBR0ToyYETSNBGOo Wf9sJw7UdCYErvimYoTgBLzdlxjzc/TZg0NNgBnvY7og5hqwkYhrnk51A+wtnFvrOFdA fvNXuTueXjXxstVpNDz8u6yczE5x5w0BQByjqg6syE1B6yrt2ZNgbbR8aY9nRtuMgyVD VZ1m+6DppSbQiZg4k4RII74SN+lmZnKnPHATUNHLhAEPHhp3zvHJK+EKIakUXm2ndMJv 6jUA== 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=zO5WWvofCaNtb+2iRPgQhDe+6eaidUu+sZbVOEdcssc=; b=G2ivv7C9lFRgvMfZf+HDL8/Ekm5nbAzNvIciTrTTyJZeEsV8wB+9UX8A6i7QJUPiug Kx2XTrysU8zSZidB6yK3Km9JEJu35litlJh60FjC/XPgZmrVecnU1B9Fr3TMAVkPEqCg /h4nXbIvnflLZl4kr+iu6LlxR6pAZMCs3/Vhd50SQWnz7Hne9j9ziuY1P4YjSJBIxTti nIIm64koFU2Fav+fQbRMNK5oDttsCt4kT+UEmFyo5AklOcEvyZIwpNdRNHoJN3zX9muj RKgov3BozLkhZgN3Ycso06dhZ9fx/36pG4OBb8oCTOYqQPkP1G+SmaURtL8IwuvVnb2e V1EQ== X-Gm-Message-State: APjAAAUroQ4bLXPmIeFG1vc3b4Ch1acLgCY3J8XsYiSAWw6rHDCIQJ3F HAIO/q2ii68dsYZAusUGoRzozOn+384= X-Google-Smtp-Source: APXvYqycnsB24gZj4V1Nb6OAewI3Wgjl5XU9kBaXl9EbAdASbR/2MX6MHotcZY3Pul4e2cvt01gKrA== X-Received: by 2002:a1c:486:: with SMTP id 128mr15863668wme.163.1575115068582; Sat, 30 Nov 2019 03:57:48 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sat, 30 Nov 2019 11:57:37 +0000 Message-Id: <20191130115737.15752-9-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130115737.15752-1-liuwe@microsoft.com> References: <20191130115737.15752-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 8/8] x86: introduce CONFIG_HYPERV and detection 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 , 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) We use the same code structure as we did for Xen. As starters, detect Hyper-V in probe routine. More complex functionalities will be added later. Signed-off-by: Wei Liu Reviewed-by: Paul Durrant Acked-by: Jan Beulich --- xen/arch/x86/Kconfig | 8 +++++ xen/arch/x86/guest/Makefile | 1 + xen/arch/x86/guest/hyperv/Makefile | 1 + xen/arch/x86/guest/hyperv/hyperv.c | 54 ++++++++++++++++++++++++++++++ xen/arch/x86/guest/hypervisor.c | 8 +++++ xen/include/asm-x86/guest.h | 1 + xen/include/asm-x86/guest/hyperv.h | 43 ++++++++++++++++++++++++ 7 files changed, 116 insertions(+) create mode 100644 xen/arch/x86/guest/hyperv/Makefile create mode 100644 xen/arch/x86/guest/hyperv/hyperv.c create mode 100644 xen/include/asm-x86/guest/hyperv.h diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 18c8f6fd26..0a02b6ee3f 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -164,6 +164,14 @@ endchoice config GUEST bool =20 +config HYPERV_GUEST + bool "Hyper-V Guest" + select GUEST + ---help--- + Support for Xen detecting when it is running under Hyper-V. + + If unsure, say N. + config XEN_GUEST bool "Xen Guest" select GUEST diff --git a/xen/arch/x86/guest/Makefile b/xen/arch/x86/guest/Makefile index f63d64bbee..f164196772 100644 --- a/xen/arch/x86/guest/Makefile +++ b/xen/arch/x86/guest/Makefile @@ -1,3 +1,4 @@ obj-y +=3D hypervisor.o =20 +subdir-$(CONFIG_HYPERV_GUEST) +=3D hyperv subdir-$(CONFIG_XEN_GUEST) +=3D xen diff --git a/xen/arch/x86/guest/hyperv/Makefile b/xen/arch/x86/guest/hyperv= /Makefile new file mode 100644 index 0000000000..68170109a9 --- /dev/null +++ b/xen/arch/x86/guest/hyperv/Makefile @@ -0,0 +1 @@ +obj-y +=3D hyperv.o diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv= /hyperv.c new file mode 100644 index 0000000000..916e08ff89 --- /dev/null +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -0,0 +1,54 @@ +/*************************************************************************= ***** + * arch/x86/guest/hyperv/hyperv.c + * + * Support for detecting and running under Hyper-V. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . + * + * Copyright (c) 2019 Microsoft. + */ +#include + +#include + +static const struct hypervisor_ops hyperv_ops =3D { + .name =3D "Hyper-V", +}; + +const struct hypervisor_ops * __init hyperv_probe(void) +{ + uint32_t eax, ebx, ecx, edx; + + cpuid(0x40000000, &eax, &ebx, &ecx, &edx); + if ( !((ebx =3D=3D 0x7263694d) && /* "Micr" */ + (ecx =3D=3D 0x666f736f) && /* "osof" */ + (edx =3D=3D 0x76482074)) ) /* "t Hv" */ + return NULL; + + cpuid(0x40000001, &eax, &ebx, &ecx, &edx); + if ( eax !=3D 0x31237648 ) /* Hv#1 */ + return NULL; + + return &hyperv_ops; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.c index 6cd86d0c02..65c25115e0 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -38,6 +38,14 @@ const char *__init hypervisor_probe(void) if ( ops ) return ops->name; =20 + /* + * Detection of Hyper-V must come after Xen to avoid false positive due + * to viridian support + */ + ops =3D hyperv_probe(); + if ( ops ) + return ops->name; + return NULL; } =20 diff --git a/xen/include/asm-x86/guest.h b/xen/include/asm-x86/guest.h index 8e167165ae..94448606d4 100644 --- a/xen/include/asm-x86/guest.h +++ b/xen/include/asm-x86/guest.h @@ -20,6 +20,7 @@ #define __X86_GUEST_H__ =20 #include +#include #include #include #include diff --git a/xen/include/asm-x86/guest/hyperv.h b/xen/include/asm-x86/guest= /hyperv.h new file mode 100644 index 0000000000..3f88b94c77 --- /dev/null +++ b/xen/include/asm-x86/guest/hyperv.h @@ -0,0 +1,43 @@ +/*************************************************************************= ***** + * asm-x86/guest/hyperv.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms and conditions of the GNU General Public + * License, version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; If not, see . + * + * Copyright (c) 2019 Microsoft. + */ + +#ifndef __X86_GUEST_HYPERV_H__ +#define __X86_GUEST_HYPERV_H__ + +#ifdef CONFIG_HYPERV_GUEST + +#include + +const struct hypervisor_ops *hyperv_probe(void); + +#else + +static inline const struct hypervisor_ops *hyperv_probe(void) { return NUL= L; } + +#endif /* CONFIG_HYPERV_GUEST */ +#endif /* __X86_GUEST_HYPERV_H__ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel