From nobody Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673519; cv=none; d=zoho.com; s=zohoarc; b=hEkHYL84BRvXqa29/F0dV0/i5YE8BJobd6NTg0MP6FuwuPems1viWWwdDY1B3ti9Midag6vFZGBPK7zaupPdeoap/VTonHw/ODPq+Ya5dKzU9EUykZz7x8o2bm6JICvfglruB/Xr8ArjLEO6WdUZjtQwbx6+OPq3pIMGQ4n4sxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673519; 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=vuWJBhA5siFFY8ZDzb9EThM89dUk4o3Gy9+lMoa/vGQ=; b=iWqWl8oC2fSePX1HrgQCLqi7VcBCGJ3cImchGRu+S2UKQ7Jcer5wsdw7Ugkq0Ns1aPw6M7vQfE6EekIQVs8GXYQ6TGf5yhQ2KS5/nnKF23pOPVBcm9Bentxzy4EEGUnHzA8ePnH0dSTX56TIu2YC5P/nJ+hL1xICXVq7oRtvKbs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673519021276.6627149222544; Mon, 21 Oct 2019 08:58:39 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa3l-00089G-Pw; Mon, 21 Oct 2019 15:57:29 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa3k-000897-RI for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:57:28 +0000 Received: from mail-wr1-x441.google.com (unknown [2a00:1450:4864:20::441]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 78843960-f41b-11e9-beca-bc764e2007e4; Mon, 21 Oct 2019 15:57:23 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id p4so14608084wrm.8 for ; Mon, 21 Oct 2019 08:57:23 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:22 -0700 (PDT) X-Inumbo-ID: 78843960-f41b-11e9-beca-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=2IQZ0I9t3yp3C2z2Yat7e79RK0J/6Y0pVIEi33A2QSI=; b=VruVKoyoi46WAAHCyYpv0dGzGVF1ZckzzUzsj95IsyeRj1/XGMx307+lSI+hc/7CAU 2CikH0B8lc4LImyaGBxZOdMX/fVfaQQ7VHhrEisWdl1M9AhiCISV1atFai6pVaekYFA2 FGXSTKUVKfwMivjWeD+rbtSaDCm2uj4pSWppIH1ak5dbgORbwAKMFJH3yFSrbcFtDs60 zaliS1LEq4d0BiYhu/txo+b3EeP3ewK6JiB4PJnfaUPO/Le+gsihMUFTozn5dBY67m79 bAFgUWnM3uPZH3V42u4lV/0welJ3E5bwMrfl0Fq7aolaHbOstJGseorIEjT9fKiW21Fb Y5Zg== 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=2IQZ0I9t3yp3C2z2Yat7e79RK0J/6Y0pVIEi33A2QSI=; b=Bzqk7IFqqVIE5vDvgF6tdnzdMY8wer8wEh09crvqgkYF0u9C0zFhxX7ocEKSjnPACx 3y1mMlYnVUDL7kQcELc9khnVfo86YuisXgaiKdMDeadekalKMqfvOxKC1bYjpgXfi2// QhCyK8QvF8/efWqAshxE3WKRzvmBTXqrvlCFW2fWHr8x0UCK2dSJQl+q2AcFYbbai4WL ZuZ8GugJPAkypp5Q4y7bH6zIY/GbsVbkz6WLveFmg31LZQcFXYqq3D3b3b68HrZOwR6g FndcIZvhXOIz0akqoV8oBXgpJMTXvpQt6a+Dl7TYVZRlA1u/8k20aUM5jmnXjm+lnuPy Gp2A== X-Gm-Message-State: APjAAAWUu9G6Q94bI5YuBYz5HxYkAACtWLLaNr0P3UF2bFv0uvet8g7a 1mDUix3YcTWQJa1NW52LVPmtx18K7p8= X-Google-Smtp-Source: APXvYqz/QpnhkeeMScCEg9ZNdUkKmo902bBYBew0ECK1PuASsgxTU2ay2Q+X5j/q5P7jRm1MdJlThg== X-Received: by 2002:adf:f44e:: with SMTP id f14mr10351123wrp.56.1571673442946; Mon, 21 Oct 2019 08:57:22 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:10 +0100 Message-Id: <20191021155718.28653-2-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 1/9] 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 | 4 ++++ 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, 10 insertions(+), 5 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..867de857e8 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -161,8 +161,12 @@ config XEN_ALIGN_2M =20 endchoice =20 +config GUEST + bool + config XEN_GUEST def_bool n + select GUEST prompt "Xen Guest" ---help--- Support for Xen detecting when it is running under Xen. diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 2443fd2cc5..99a12d0090 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 Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673520; cv=none; d=zoho.com; s=zohoarc; b=ORk1pm3iT/L9obGAcmklm8XHs9HwUZLJPLTqoSlX3DnVHKdKmRAXWY1Vs0OW1UAMHeNF9ff50+04Nn3k46s49R+qzTDS938NDcTRIaYdWouHkWD8Zs2cRp/lOzZznurG9/CJqu0bdl3OKQPaBofQK5pATJ3XipIgsdP+2DWqA80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673520; 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=K69IWhv/ZfQGO0J0sM6o/F6Ms8lDjO61QdY7nVhqwt4=; b=h4RryRkEsNaJWnkD31pxMz2ADzrUZAi2nB4kAPjSjoYMTuRmWAODCIX3UxEW0BmCooQl9Jsg3IIj2QNzKWfjpcnZiRZT18JXY2uw+L9KixTAwbLS8pgwl3w1Bn2IlkClrqp5eOToud9i0ocr0gLzgHbvH0a5c7cNo/samv+0E5k= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673520711570.1899796762024; Mon, 21 Oct 2019 08:58:40 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa3r-0008AV-3s; Mon, 21 Oct 2019 15:57:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa3p-0008AE-RV for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:57:33 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 78e19b6e-f41b-11e9-beca-bc764e2007e4; Mon, 21 Oct 2019 15:57:24 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id q70so6756329wme.1 for ; Mon, 21 Oct 2019 08:57:24 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:23 -0700 (PDT) X-Inumbo-ID: 78e19b6e-f41b-11e9-beca-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=tia3kYMdHxFsxkVNqNvRacsDlGGCJoGWY2kOgcv/rhY=; b=RgUlxrsaouBV1/zOw/oU8WQUPmKTkkz0GSxhjtDrHHKigzUYK/vXkcczo1zgiCYZiq ftKdrABaJSdoEib7Oyw+yeKxS9GBKQLYwJfgTCgEAqJQBH2kIEibUbfWMnpH5c1V0QFc 1YzP7A3K0vTPnCBMVjKjyxsV+GAl4MFcIzTzBSYdXy3Kn6VFuRqH4wgbdpZYGsFEsCiw vdQDXne40Tb5pFeA83OK1DLEPG5VuqR9BUbfBFRONClLep4Bb53UdZLewISt5kPxvJN0 cN79uBTqrTCezFbMWBtT1y690ZkRno/n6JRWTPjtVHMGEGk5xcCgCh7XB/LlvbkKSKMS 6WtA== 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=tia3kYMdHxFsxkVNqNvRacsDlGGCJoGWY2kOgcv/rhY=; b=sPpL1y3Rf4nWsZOogu6qryFjPbc22LFvZQGGgi6YTm6Bg/sdZaIl8nfsf3FoTlSW4d JjJrlkS+KhCjfyInUwVLKII3HrwELWnoMOC/Sks0klt9Xp8Ki2Pk1hBztAQDH7NFazy5 B6vXC2n0am7r3fOhp8UuDNuasY8M4kRGk2K85v36OllmTxSlYDhGZmf3VGMnCKfVvQIT ys98NMBDOIb0szm955gA/xvmG68mqW7CTccfyMQoBQ6y/In5l4gLmNeQ/+7G61VmoKWv kdsI1s8S+zw4qFZdjM+pFm9gt4qIiOztjpUm9RTCkOBWlF3Q9X1umURSbVTFM90mG1BG rCLg== X-Gm-Message-State: APjAAAXB97kKDH5IkJqPtwnO4jyN0B7cN4F325Sa8MKVhOdrr33a8Or6 NXJ3I2Gw2rzwLRl+oJSwYgvoFYFCoq0= X-Google-Smtp-Source: APXvYqzlOafkrkZa7u8z2vDCCyGrxTdYBi4FGl9yCddG0R2z+lZdDw6knnKCDA6wfwvWiLgbkngz4w== X-Received: by 2002:a1c:6885:: with SMTP id d127mr14663510wmc.64.1571673443676; Mon, 21 Oct 2019 08:57:23 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:11 +0100 Message-Id: <20191021155718.28653-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 2/9] x86: include asm_defns.h directly 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) ASM_CALL_CONSTRAINT is defined there. 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/include/asm-x86/guest/hypercall.h b/xen/include/asm-x86/gu= est/hypercall.h index d548816b30..c9deca6ffc 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 --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673516; cv=none; d=zoho.com; s=zohoarc; b=EDmCcbsXKtSdXmP6xx+qg7VAXZXeQ6Fk6eZ2zcJunrEyAj3K0UJM+nxnTamplkkt1Oroh8IfFZx9r6dIFKBUxFtimXbQUOibiWxr6aIsKBLmmtkhEuFwEGH3A/UBltFNKvb64jqBVL0/V+u51cDR/7KFfb9wr27CcQ5Tj+JiYZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673516; 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=oto4+gHbWxJY5/xCup7cF97/c8o68mO1HO/9cTC+dqc=; b=oIJ0RF7MMawD2Ofxhb8bb8IMNmGsJGWSzWfJN/fqIqM1XGBkpIi6+clAi/PQQ/AiNzZAudk+w4jGC1AkbxvG7E0IpY0zrggSLREgi2U28QsZEMsjJ49ernVItxTSb3QirkB6qWyNkcqKhd79rmniUrxsIRV+5SZMBRc4afeRJHk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673516217353.90843036940134; Mon, 21 Oct 2019 08:58:36 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa3w-0008C4-Dz; Mon, 21 Oct 2019 15:57:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa3u-0008Bp-S9 for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:57:38 +0000 Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 796c0786-f41b-11e9-a531-bc764e2007e4; Mon, 21 Oct 2019 15:57:25 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id g24so4755669wmh.5 for ; Mon, 21 Oct 2019 08:57:25 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:24 -0700 (PDT) X-Inumbo-ID: 796c0786-f41b-11e9-a531-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=LzVJRQ/OrflFRie8Ab9jbbnlLHJRH6wdZOJqJE01vJw=; b=cOCott3IlMS4VPQuhS1A9bXCgJ36PqouveqzFIX/xALcgYgN2ITLVknLZ6IskZ3A1O yiBDInlLLyUoJ//cZ3Y17Rv6Y/dsgUJBYGGcG5+jH0OsklmFsXHsHJra/aZJmEPuH/Yt 7KsBkyJrorniwucdYZ6jaEX6f8w3ZY/nzKMUERXaYSFK3lbSKNJDvDcdXC6dAlDjNhXL sED7oYncDzZ/kqqkmZRf7Nt536krxYzr25iNpQw7YOVVqgSt0JM0ulMHsxzch2l9sVpQ 7s7EONkXTZ//Az7AVvirNb0bLL52Ntg4Z2X0EcYKrPjYCChBfxvdvlLLAxV+ZumB2oR0 c7Zg== 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=LzVJRQ/OrflFRie8Ab9jbbnlLHJRH6wdZOJqJE01vJw=; b=a9dVQjvjQKSvQ+YBbEHD7+PKvLeHynlm3BI5360MqvC3/HssDpqG6/RYZYVq4lhHib OZrXl00KEKlQtKb3YYvkMbxpoE3VpWR1zDddw94VFm5NBKtWTjSlnWOW7QB63ZlOWZYJ 8eZlpemBXRjDefBwBdUThIAuoGS0C8Y9uLZKmmYtyjr6TzFXJxe218FGNERaGq6y3drp mH3aj2ZLU8/yCfo33YZUI7y3hN4WnpmDJ5qud5MZCIAtH0UY6vmkSGNC4w//ZiawPSDB qPVUPT/y2815HIH0EVxFaWuDz2tx0D5wuV7PeXlIGWPSskbMbmHwXqSvgBO+w9gyFaa3 eNRQ== X-Gm-Message-State: APjAAAUAdDWRHGTeYTcCvLE89lq8SLztkDyRdVzc3lzjrEO+OJcxaU9/ YdCMPAQ52x24nC6USq7Vh9pFdoMu7EU= X-Google-Smtp-Source: APXvYqzz/Kta5VBd7jInxuR3R8kaAQZgp7VU60sA8hcqypb8SutSv4zTfLJHuzmPKcpvp74dnssEqA== X-Received: by 2002:a7b:cb54:: with SMTP id v20mr18859985wmj.119.1571673444539; Mon, 21 Oct 2019 08:57:24 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:12 +0100 Message-Id: <20191021155718.28653-4-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 3/9] 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. 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 7b7a5badab..78fc603996 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; +__read_mostly uint32_t xen_cpuid_base; extern char hypercall_page[]; static struct rangeset *mem; =20 @@ -301,11 +301,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 5edbcd9ac5..5441e89de2 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -990,7 +990,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 Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673523; cv=none; d=zoho.com; s=zohoarc; b=XsMsQ6MnELUfTp8VO1W0hQAtlmd7d41E8Hk1ye/xylpl4R7t9aJytoe89g//YxvS30zPc0/jtunDYRR80RAyleCErihyKwoQfA9RlCpWPoLEi6XcRTD5hfoFGu0f3ACkaatFCZmaNtAmg6DdtvmEOyIdCh6n3r7BKxS2ZZkc6nQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673523; 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=uPjgPqdMilD6WF+iRf1RCiuoC3t12cyNAj/75aI465U=; b=jm6Y60Q52hGFVGhZrgmUOVpjmv/SUa81C96KGnDB+Sq5eeq91akScLdf/diupXKDaxuw3OoGgbYorG19iskZYEXraxF3m8LSp0eC93Amt/9Ns1LJk+zZqDG2HyElAeiToLlYiZPex1SsyQk+8rGFmbekjT+N8rtuD6HKeVWpDOc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 157167352383298.06595251613817; Mon, 21 Oct 2019 08:58:43 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa41-0008EX-Sy; Mon, 21 Oct 2019 15:57:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa3z-0008Dt-SO for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:57:43 +0000 Received: from mail-wr1-x443.google.com (unknown [2a00:1450:4864:20::443]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 79d23934-f41b-11e9-bbab-bc764e2007e4; Mon, 21 Oct 2019 15:57:26 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id v9so3356474wrq.5 for ; Mon, 21 Oct 2019 08:57:26 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:24 -0700 (PDT) X-Inumbo-ID: 79d23934-f41b-11e9-bbab-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=N4kqMtXKr2VI6xhju+2HY7aOkc8zfZUqqp0CH2GZ8kc=; b=el+It4BiEwx+dhiQlehX+3tMT8XfCZVwMtJvjBchGJzOm4dGe57t7lpbF3YzixAzL8 gGadBC/BZOiH8wP2UizfpkDMzMCjL40fwkObRQCE3zdyaalTDwUmQzeQXKxk6QKkTiPZ S+73WKEtn7S0TJewHf6Ge/uLHGcTPxLIwQ8zf65UrbOdrihZy6Mzj4CDO6Rt0vT0SrBD hdTWoyp0vgloXY7XKQRhyp7fM4TBy8E5Hhompnr+xsuThTIk9ZvB5czQNCzE7q8H+WHO BAp0e/+y7ISgxxM7ZlICw0NGOT3hsmbyEquzHEIGEAc6042KL4XSgllPLtY7iL/yOWo+ DD9g== 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=N4kqMtXKr2VI6xhju+2HY7aOkc8zfZUqqp0CH2GZ8kc=; b=r9DSfa8a5L9NPb5hnmJpqhFUZVZCOWscnooFBq8XHBz7viOheR9WmK/yXTM7cMZtO2 kXfm/i232wAxgcYPSkAZL5WX5/P1jfemBUrCdV06hS9lWCwz1iZDsOAmxOjzECtiZiOA PjZk2ZuHHjCfAIT9JmJUEP0qqutv3cMorps1vP1vqkwgGnQsJW0SFMbf2VMYUsOFNH66 eXcONVCekGJnzdi936Q9Imk2bomZIgxffAqyzf/rPMvNwHpynbw3lKwJs4bgiKHHrF00 7LXSh58HyLjLuoLcvJeFx2cuCQ9ryEq17psAragOoE+KEOCDB8Hp/wONFOA6L5flKl7v D7gw== X-Gm-Message-State: APjAAAUQDQwgM6uBSI0u+Ap0RKQPhuDxrC5Kmse6EOKtezZRh+FdpmXc annqH6436HdlREsyYqETW87yPiamm8U= X-Google-Smtp-Source: APXvYqzwrIPVWBtBGwvNDvcP+QiFfxITf+dHZITn8MCV8YvrsbPHAGKXjlux5EHhW5YqOJTKhLjTLA== X-Received: by 2002:a5d:6447:: with SMTP id d7mr12892447wrw.247.1571673445284; Mon, 21 Oct 2019 08:57:25 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:13 +0100 Message-Id: <20191021155718.28653-5-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 4/9] x86: include xen/lib.h in guest/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) We need ASSERT_UNREACHABLE. Signed-off-by: Wei Liu Reviewed-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- xen/include/asm-x86/guest/hypercall.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/include/asm-x86/guest/hypercall.h b/xen/include/asm-x86/gu= est/hypercall.h index c9deca6ffc..d0d2f5022d 100644 --- a/xen/include/asm-x86/guest/hypercall.h +++ b/xen/include/asm-x86/guest/hypercall.h @@ -182,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 Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673527; cv=none; d=zoho.com; s=zohoarc; b=GiDEO2jpzfc1i018csCdFG7Mw8/6L4qwrHQ8TI6l6gN9twdtDJQXPwlHOT+BouX9VjgwE9+/OE5I9HAAFWKyEW3nyiiSmmvM/QwSGrjyqdGJFEXqf5sa7ezL7rhDtg7CZp6uauAiSNRkDSruvL8Fp4zgAkApzw7INl6WUg0AePU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673527; 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=QPUV9uldfIQLGALa8fgk+yAQrIIPfQF0ySat2eeBVaA=; b=SG0Di1dShCtEB5ov9cf0hjmI0Ii6JRR2vLN80IiLnWIh/JUq4vthweADO4ImsfIzacJ6sI2y/qgBKLDxdKaFaGyGpEsth9DrJV65nmHgYiduvgBLS5ehaqeo+XXsv5Sab8aj+2jtbUKalwEL1kvM5fAPWPpsQR7YAnIsGbQh4l8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673527693386.3521339879218; Mon, 21 Oct 2019 08:58:47 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa46-0008GB-71; Mon, 21 Oct 2019 15:57: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 1iMa44-0008Fq-Sv for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:57:48 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7a616f1e-f41b-11e9-bbab-bc764e2007e4; Mon, 21 Oct 2019 15:57:27 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id c22so4239747wmd.1 for ; Mon, 21 Oct 2019 08:57:27 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:25 -0700 (PDT) X-Inumbo-ID: 7a616f1e-f41b-11e9-bbab-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=jBrEUmLmtAmRmL0ZQe75O+VGK/lIBJ2eQ4PSZ4jPdH0=; b=EWw8ev4XbD5uXEbn9iAQyd79L3Ub3XQoA5XpmnAjHIi+p9yTY1qcYqgdbn4GuCwPKM Rlj59AsjeQkjg00V1xO4ftnx3kHRwVK7VzxVt2Z8n3RwgEwTa8Nwhw61i6Zr3N9wY8Te pZRJb5uvfKGtLhHMiEKM5RZd+dUZXSo6s3fuecIGR4zH3YDy7SP6QqHTs2cHDYfxN7dY S1fSMXGeHmmBBmDjE91bIX+R99nbh8xkDdmp2bkb3WPqw0SVNhDsQjvsCHEh0dHMduJ7 H0TrKGkcdRJ4yv+mYOzN3YN2nG234Y0RSM09557Xnkg7VZrZJULvTmLetIWIxAor1pjv aGNw== 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=jBrEUmLmtAmRmL0ZQe75O+VGK/lIBJ2eQ4PSZ4jPdH0=; b=M3IWEdkZQysJcPBKWUOKSgAvMUnJ68NyYIKLdfm2ap0D6poYWD0jHKzfZZgMg16Dx5 fM6nPFyKrGRd8QXZRZkigGGR+dTm3LzhI/MFTqnYb4T2FN4I6DuaFp9OXwo725zbXBuo eTCm5AaoVlZaoTcHbCGkJTPYBHkuQ5HJ172WZ+KDkWRWCJqiuZlQAUS4MtEpTU/0cG3e /NYF6Sx4PVSJQLI6WuKn2d8SOkYSgrX8JRmfccQVGp/AT1GUt/yqtynMALmYTpmjUfQq HD+z8J5SBU29WCkFwo7w2gNp3D6KVvy+QbB+Kt3kX0RWXXBal0LtcSUFtcrrLZUWusEa EWIA== X-Gm-Message-State: APjAAAWsUdrXRXqYLNIBgoST8qCD6RpyMBGEFzQvimWb+FggVRbiuunu fLgbJaAAqY5WHbjTMq9XBPGESGedAgI= X-Google-Smtp-Source: APXvYqyO/sJRzgkxKMuVKoWxsxZIEOo3Odlp+bUvQrXRafR6MoUmi6fT+irY1y0FjDTvsdfQs7drpw== X-Received: by 2002:a1c:38c3:: with SMTP id f186mr4252455wma.58.1571673445980; Mon, 21 Oct 2019 08:57:25 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:14 +0100 Message-Id: <20191021155718.28653-6-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 5/9] 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 Reviewed-by: Paul Durrant --- 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 | 61 ++++++++++++++++++++++++++ xen/include/asm-x86/guest/xen.h | 12 ----- 5 files changed, 109 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..89b9ae4de0 --- /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 + +static struct hypervisor_ops *hops __read_mostly; + +bool hypervisor_probe(void) +{ + if ( hops ) + return true; + + return false; +} + +/* + * 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..38344e2e89 --- /dev/null +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -0,0 +1,61 @@ +/*************************************************************************= ***** + * 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__ + +#ifdef CONFIG_GUEST + +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); +}; + +bool hypervisor_probe(void); +void hypervisor_setup(void); +void hypervisor_ap_setup(void); +void hypervisor_resume(void); + +#else + +#include + +static inline bool hypervisor_probe(void) { return false; } +static inline void hypervisor_setup(void) {} +static inline void hypervisor_ap_setup(void) {} +static inline void hypervisor_resume(void) {} + +#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 Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673533; cv=none; d=zoho.com; s=zohoarc; b=m8ld1wYG2zgqYpNkWAqMC7+1vGM6AwLcQXLLZaVYKF9B2K6NCjh6IDUdMXPd4xr/dVTMtXHh+cjp2menZeq2/kOKeBZeYTK6VI90ovkun4FTEO1yiQyYlNoyjiII/qezbTP6NfPD9r1qfOGiOVEt01astLIEPNw3dbUGkXvftfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673533; 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=j26PSc7a0NRaBvCAzsXmSpehFkP8d68FDPeC6cQH6g0=; b=lOm+BfedAMI7hFAKzohz0dfpz4nZhOGRqZDxdKniAd2ztvST43/yWjbEMKIbLDNFFBYnO+L3Ie8aKupI4dsu/PGkQuysvgx4PTp7FHdlUuQTsc5ycztd/NeyViUjTOQcn7sNOTeq5mWXTnuAV0uiWRUyViQ1IRijDT9bkxORRoY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673533904919.9067175555674; Mon, 21 Oct 2019 08:58:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa4B-0008IS-HW; Mon, 21 Oct 2019 15:57:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa49-0008Hl-SJ for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:57:53 +0000 Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7b1566c2-f41b-11e9-beca-bc764e2007e4; Mon, 21 Oct 2019 15:57:28 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id c22so4239809wmd.1 for ; Mon, 21 Oct 2019 08:57:28 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:26 -0700 (PDT) X-Inumbo-ID: 7b1566c2-f41b-11e9-beca-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=ExfOi0N6VUGqchtp2Vv94a4Sc6kPF7iWTxBmQdbZTUY=; b=MDrHd9/w6r2SS5bNBvH4wPUa25y5FsK6mLR8DbHPxvWHD+2naAhHzESjYDv1pIsGo/ geOo0flBHGontoIoY1lHkZRXiLdDAntbGI9XRkcb1Q8PQhIE/uAl4nTHzlGSAd0+Eb2Z YQ3RIqMeJvXiArZVWfSVmTYMrfCNfLw9y2gfwQoxuCUjOv/Ed62jnZip/r+SB1PxRwFC rg5bYShShrXt/NS/ds7wPnZmU47Sm84Jy0BdBf5NSD7wptgFzDfJ+kprnX9hokCJLbY6 mOKvOqs389qxDGFg1jkkd4usU64HUgQqchEzNcLevI8G636jgoyn6FWb1U5XkqP/stTJ X0cQ== 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=ExfOi0N6VUGqchtp2Vv94a4Sc6kPF7iWTxBmQdbZTUY=; b=F5rN1vbyQ7+dd4rKnVFoKeuy6RiJs9d9JBNYwnnXGyCe1w2/ETykPqn8iIQVxkD8vH fOEZHTNBtsvYtVB+IPiQ9bkSQ74ETAUbv4X9XGTLWDmx9gadqwdWIh3Sp6unahNYFhNg k4YnRPH0j3mGS1ExdDKTl7FWcc/JLEwecLR+L8890NZcOPdPNcsRyRQ55Eh+bfqyr1vv 570cNpVOHRscA+vHf7vfGOq2M1f9XUFHu1zvJFucVp2e70C5+qMxLscV7tg1TI1+FUdu Hgfg1vnfH6vlLifoVlqJroB5wna9F8734T/6nt+zouaa+GUcB5UkL3On4fxFDto9pQjE DnSw== X-Gm-Message-State: APjAAAXBxR1l0ixi8u43T6QWrIUrB3CcF5Qhpa+OIpRQytPCneZzXEic qd4mq/A2I6sHAdkMFrekddXhNxj5HQU= X-Google-Smtp-Source: APXvYqxwIHsOQ9QEmy2XrZYBQQSBlbkiyNYA8Sza8Uiz/Qc+g6OpkO99Vrybf2mgWPoMjr5yFxH0aQ== X-Received: by 2002:a7b:c5c9:: with SMTP id n9mr21037600wmk.28.1571673447173; Mon, 21 Oct 2019 08:57:27 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:15 +0100 Message-Id: <20191021155718.28653-7-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 6/9] 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 , 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: Roger Pau Monn=C3=A9 --- 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 78fc603996..9895025d02 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -97,7 +97,7 @@ static void map_shared_info(void) unsigned int i; unsigned long rc; =20 - if ( hypervisor_alloc_unused_page(&mfn) ) + if ( xen_alloc_unused_page(&mfn) ) panic("unable to reserve shared info memory page\n"); =20 xatp.gpfn =3D mfn_x(mfn); @@ -284,7 +284,7 @@ void hypervisor_ap_setup(void) init_evtchn(); } =20 -int hypervisor_alloc_unused_page(mfn_t *mfn) +int xen_alloc_unused_page(mfn_t *mfn) { unsigned long m; int rc; @@ -296,7 +296,7 @@ int hypervisor_alloc_unused_page(mfn_t *mfn) return rc; } =20 -int hypervisor_free_unused_page(mfn_t mfn) +int xen_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 5441e89de2..41b4665649 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -739,7 +739,7 @@ static long pv_shim_grant_table_op(unsigned int cmd, }; mfn_t mfn; =20 - rc =3D hypervisor_alloc_unused_page(&mfn); + rc =3D xen_alloc_unused_page(&mfn); if ( rc ) { gprintk(XENLOG_ERR, @@ -751,7 +751,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); + xen_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..8221fc1325 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 xen_alloc_unused_page(mfn_t *mfn); +int xen_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 Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673537; cv=none; d=zoho.com; s=zohoarc; b=ZMG82D5yWhVTGVNLmQXgylfFgWFulnGt0RB9jN+WgJmSV4lB0tVLLsDIN86BoUr46xHqw0frB+So8IlhLfeKOIueYhHY9navknWQ2rNAos1XX6EckKHin/Ri59uxP1//Wt9xxcJpriz64vFEDPcgW0caewzeFLJbc3aqQ085EQ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673537; 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=aae7Z/b5sjTnBH+jl8Tib5WwOlBmsKYXP/0hzB0kcgw=; b=B14glskPdyiZsXAcRlA0KVrCiRrFzxWG7fYOJFLtf753GNO4FTypCE16NIvBpU/KPBTl1iRDmWuScNGdVCZjqOjzvcrr31AZmtwlpQyCiP0vtMOPdoWwMSRLu8KnKgTcsTBds0gQY1PGfQkLklkcDxD5FbiSAtQ1HHH+/0MqG+U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673537627409.6920206172931; Mon, 21 Oct 2019 08:58:57 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa4G-0008M6-Rw; Mon, 21 Oct 2019 15:58:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa4E-0008Kx-Sc for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:57:58 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7b970542-f41b-11e9-bbab-bc764e2007e4; Mon, 21 Oct 2019 15:57:29 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id f22so13350541wmc.2 for ; Mon, 21 Oct 2019 08:57:29 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:27 -0700 (PDT) X-Inumbo-ID: 7b970542-f41b-11e9-bbab-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=uz0cS8L1R521fTEVFm/na4uChFFZ0A6x5sP6HVSJ75Y=; b=RpYQA9UTZA3W/Fwz6T+Ti1SufM8dwZLv3CQz4+1q0tT0Je3aWk4yrmQyAKYOqw5rpz e1cbfcVBK4BP7ADh/HbgIRaF16e15L6o4tM1z11xF2Lhx0Pif73lZA1KbLRSanOifRSG T8PJSn4erosWoMqoQCXtt6ph1fxCvm8WXr3bQk01cXquEtuwu0v3VIvb7J249RiPxAw0 H/6/jPE/hgrdHBJLPGOGr9l9We5HdrKYbdyntQuRsUtka42gvlAMfTuEPB5/NR4D8Cjc wl8uUGCJK1gpgOoY2vxYkS1tNOtxyKsLlF/gmofBjPH2U8Rb7CGDURCdKkZ9/ziIeCRh OS1Q== 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=uz0cS8L1R521fTEVFm/na4uChFFZ0A6x5sP6HVSJ75Y=; b=atxhQHj84L4nrLKLhvovjqovyaUV6Xhc+lqoEXIJzutcgaqs4M4vciYCpdVvdSKhD3 O2DCpyGCjGOf6P32Lf6CWIKM7+JTF9GyCMPEesTBfS0yUZi+CE09Ml4GQq+GNReIEwx2 55gFjBxEyqDHL3McclubNk83EeN5F8ww+OE9E6Ydp9rZHaVgQ2P19n07pxYBI270j54t uv0AweW2oHF/l5VCWvvsN3biMrjckvsn7ZX/EcjNA8mBPeO8vXgwPVl8zvpyND8bwHSs S2k/JCIho/7xz8n2xa/9znv0nzzm41kBq1YsT7za+9pn18aFIJy5q8AuTRLkKk7zcPY+ JOLA== X-Gm-Message-State: APjAAAWSFhEU2wGmiyJZZqje10sfJm5WSgPj5r4nffitv5ifIbFP9NjU JdEtwRcIprNKFacBtCCEpx6GVGBO+FU= X-Google-Smtp-Source: APXvYqxl/DJi3lmFlYPpP/hatAwpG7yl3D+pn563UVteuV6a/m3MEG3ZuxYSWnxyh0y0HFEqN4Kjiw== X-Received: by 2002:a1c:a78b:: with SMTP id q133mr7388392wme.115.1571673448058; Mon, 21 Oct 2019 08:57:28 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:16 +0100 Message-Id: <20191021155718.28653-8-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 7/9] x86: switch xen 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) Take the chance to change probe_hypervisor to hypervisor_probe. Signed-off-by: Wei Liu Acked-by: Jan Beulich Reviewed-by: Paul Durrant --- V3: 1. Address Roger's comments 2. Change xen_hypervisor_ops to xen_ops --- xen/arch/x86/guest/hypervisor.c | 32 ++++++++++++++++++++++++++++++- xen/arch/x86/guest/xen/pvh-boot.c | 2 +- xen/arch/x86/guest/xen/xen.c | 26 +++++++++++++------------ xen/arch/x86/setup.c | 2 +- xen/include/asm-x86/guest/xen.h | 6 ++++-- 5 files changed, 51 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.c index 89b9ae4de0..33bf1a769d 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -22,7 +22,7 @@ #include =20 #include -#include +#include =20 static struct hypervisor_ops *hops __read_mostly; =20 @@ -31,9 +31,39 @@ bool hypervisor_probe(void) if ( hops ) return true; =20 + /* Too early to use cpu_has_hypervisor */ + if ( !(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) ) + return false; + +#ifdef CONFIG_XEN_GUEST + if ( xen_probe() ) + { + hops =3D &xen_ops; + return true; + } +#endif + return false; } =20 +void hypervisor_setup(void) +{ + if ( hops && hops->setup ) + hops->setup(); +} + +void hypervisor_ap_setup(void) +{ + if ( hops && hops->ap_setup ) + hops->ap_setup(); +} + +void hypervisor_resume(void) +{ + if ( hops && hops->resume ) + hops->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 9895025d02..655435c1f7 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -67,24 +67,19 @@ static void __init find_xen_leaves(void) } } =20 -void __init probe_hypervisor(void) +bool __init xen_probe(void) { - if ( xen_guest ) - return; - - /* Too early to use cpu_has_hypervisor */ - if ( !(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) ) - return; - find_xen_leaves(); =20 if ( !xen_cpuid_base ) - return; + return false; =20 /* Fill the hypercall page. */ wrmsrl(cpuid_ebx(xen_cpuid_base + 2), __pa(hypercall_page)); =20 xen_guest =3D true; + + return true; } =20 static void map_shared_info(void) @@ -249,7 +244,7 @@ static void init_evtchn(void) } } =20 -void __init hypervisor_setup(void) +static void __init xen_setup(void) { init_memmap(); =20 @@ -277,7 +272,7 @@ void __init hypervisor_setup(void) init_evtchn(); } =20 -void hypervisor_ap_setup(void) +static void xen_ap_setup(void) { set_vcpu_id(); map_vcpuinfo(); @@ -307,7 +302,7 @@ static void ap_resume(void *unused) init_evtchn(); } =20 -void hypervisor_resume(void) +static void xen_resume(void) { /* Reset shared info page. */ map_shared_info(); @@ -330,6 +325,13 @@ void hypervisor_resume(void) pv_console_init(); } =20 +struct hypervisor_ops xen_ops =3D { + .name =3D "Xen", + .setup =3D xen_setup, + .ap_setup =3D xen_ap_setup, + .resume =3D xen_resume, +}; + /* * Local variables: * mode: C diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index dec60d0301..0ee11b15a6 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 8221fc1325..c3c6bea24f 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 @@ -31,8 +32,9 @@ extern bool xen_guest; extern bool pv_console; extern uint32_t xen_cpuid_base; +extern struct hypervisor_ops xen_ops; =20 -void probe_hypervisor(void); +bool xen_probe(void); int xen_alloc_unused_page(mfn_t *mfn); int xen_free_unused_page(mfn_t mfn); =20 @@ -44,7 +46,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 bool xen_probe(void) { return false; } =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 Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673541; cv=none; d=zoho.com; s=zohoarc; b=kBbT0huoMNdMq03ULz6GO7yhJGTQmZ+NfkWJrCMTasObgXy2lDyEWHduHGPINf/tY/jIm8bugAPExwipZ8RvhB/k/w964VLskm+j69XhFokmwsO8Dtwy+kdDC1QYbPJGtlhtbiBV9p0lGizMKYdlnE7DyuMf/Rv9psjq2xXEpXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673541; 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=W2dXIgM0aXa9Cm7Q6LpbIxGWKbDDrNHH09vrJHrF3P0=; b=fY8Or6KeJLRX5q9tjn++3vgQoj6ASu3TktgQpOX2dEVy3KOLv3kMpeojHRqbH2nxX+hQuh6IgAnmvz9i7U/xB5oeuaxgBKfiL61fySwCkF3boTgNv7X6MZYpc25Qoqxyxrq9E59x9X0DCpgMZM8GClO0kXp3GM4ckpbWh2X1rCQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673541954797.0075333717003; Mon, 21 Oct 2019 08:59:01 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa4L-0008Oj-5x; Mon, 21 Oct 2019 15:58:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa4J-0008O2-Sr for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:58:03 +0000 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7c1217e6-f41b-11e9-beca-bc764e2007e4; Mon, 21 Oct 2019 15:57:29 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id q70so6756663wme.1 for ; Mon, 21 Oct 2019 08:57:29 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:28 -0700 (PDT) X-Inumbo-ID: 7c1217e6-f41b-11e9-beca-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=f6in2kwAF9sUzg2Mb4eb4h7EVvG820SHOVnsWYNNk9o=; b=MUKAOFhlOV0lipkA3Qj18xiI6jhWf6fmWwWPwtnJAQzlhbmMRVzmaR0NXuyaM3yipW HOsi01QexFr6Q83AJHRNVrlChT1Fkk93sxOhWiXsmIL0f2ZKitcm/73nC0K+NLF7+k+p XNxgHpVNeerACM3motyD2xj5Ms89+puPCEb2bdG6WgiGKIzc5rFhdWxBa3PN+kEilxYA WzsXBSzxopWNanWlRO2dko8eQQTxn9xuGvBCMKwGk+5bsz+u6zQg0uZ+HTo6KuMzjuzm ktJtP/45Vu4dlEIb3prsn0fYjtMlgX+2cvUvn71CAnSls/Qm/rvTx2TZg0+qttjsc3T/ X6zA== 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=f6in2kwAF9sUzg2Mb4eb4h7EVvG820SHOVnsWYNNk9o=; b=JLlFyr3Dz2RFt6k38GPzWRohTurEEMUZ1l1msd8nblRlcKUL3/PJlL5q+TZvcOcYvD lGsm+agTAYdpJOmW5GWwf8mK7ND09dbnQipM58iLZdV7Yv0tfc7R091QQ9D3Rqssx8ZS H0VlUVWbi8Q4rp3d7ejytwlrz4QRL0O5eSvxhs1PpJ6GSQP8cER8iqePNmhhTna3JiWF N5GziDXe/xaz1ymzb1rFveiz2PHblHv4Sx1xPiEDYPsC3wDx1ASnPFhzAaRAzwumpD8T 9ugjtnyWvk2W3qIJvuroVl8QTNa9ieYF2+ENnni7mqxNX3Slsrc1d9w8s/6VMf/uEVjL 4Jxg== X-Gm-Message-State: APjAAAVkvrQYG+Sfrj7CHEhElg4Xab4+Nhst3KM/jr3A/WNRmG1GLivz Vr3FNhYo1eWdSqdcEfVi7S5QtbkWzHA= X-Google-Smtp-Source: APXvYqxHE3iK/0W6DtLJyb6xZXf4NNJOheJkAeLWWTme7Y7mktHsl4XmDpU67XhLM0PcvmGGFT/xtQ== X-Received: by 2002:a7b:c444:: with SMTP id l4mr19445804wmi.21.1571673448928; Mon, 21 Oct 2019 08:57:28 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:17 +0100 Message-Id: <20191021155718.28653-9-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 8/9] 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) Signed-off-by: Wei Liu Reviewed-by: Paul Durrant --- V3: Address Roger's comment, add ASSERTs --- xen/arch/x86/guest/hypervisor.c | 6 ++++++ xen/arch/x86/setup.c | 6 +++++- xen/include/asm-x86/guest/hypervisor.h | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.c index 33bf1a769d..a666ad9526 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -46,6 +46,12 @@ bool hypervisor_probe(void) return false; } =20 +const char *hypervisor_name(void) +{ + ASSERT(hops); + return hops->name; +} + void hypervisor_setup(void) { if ( hops && hops->setup ) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 0ee11b15a6..cf5a7b8e1e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -689,6 +689,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) int i, j, e820_warn =3D 0, bytes =3D 0; bool acpi_boot_table_init_done =3D false, relocated =3D false; int ret; + bool running_on_hypervisor; struct ns16550_defaults ns16550 =3D { .data_bits =3D 8, .parity =3D 'n', @@ -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(); + running_on_hypervisor =3D hypervisor_probe(); =20 parse_video_info(); =20 @@ -789,6 +790,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) =20 printk("Xen image load base address: %#lx\n", xen_phys_start); =20 + if ( running_on_hypervisor ) + printk("Running on %s\n", hypervisor_name()); + #ifdef CONFIG_VIDEO printk("Video information:\n"); =20 diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/g= uest/hypervisor.h index 38344e2e89..b583722f5d 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -36,15 +36,18 @@ bool hypervisor_probe(void); void hypervisor_setup(void); void hypervisor_ap_setup(void); void hypervisor_resume(void); +const char *hypervisor_name(void); =20 #else =20 +#include #include =20 static inline bool hypervisor_probe(void) { return false; } static inline void hypervisor_setup(void) {} static inline void hypervisor_ap_setup(void) {} static inline void hypervisor_resume(void) {} +static inline char *hypervisor_name(void) { ASSERT_UNREACHABLE(); return N= ULL; } =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 From nobody Mon May 6 06:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1571673551; cv=none; d=zoho.com; s=zohoarc; b=KATHmHPppdRWbllsJe6H/Rf9t5N+cn5ZFQ9n3BbLzcCS8LKCrMa+e4+IcLF4EFhqAGI+PmC0KHnzkyJLR0g1qUbncVg2mpvzelXs27alZjXCYju+xOlPNA9aIp8XrHM7CfI73O3fk481npi3hUO551pErM+r8yp6wBeYnz2HU34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571673551; 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=eGkbqjJdvdC9bfn01ye7qu2L0nib1S8Ix9Ke+Aaiqxc=; b=V+rVYr1Hz0KK1DU0lgo1pm4HdBy+qPG77nGQjwMgynma7JBE7wOJ8XrXIR2BRgjfUUQCfgP8o+OCV9ffEUSSxd3t09IjxIYCcu/rqR+4rh/KPcZ73EV2RgpxguroxyZusHBxNOPz5t8hgEHtVcA6sNLFDEIj/dtZ1OpeiBi+1ek= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1571673551745484.99818824451086; Mon, 21 Oct 2019 08:59:11 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa4P-0008Sb-MP; Mon, 21 Oct 2019 15:58:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMa4O-0008S0-TW for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 15:58:08 +0000 Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7c946b7e-f41b-11e9-beca-bc764e2007e4; Mon, 21 Oct 2019 15:57:30 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id q13so3884654wmj.0 for ; Mon, 21 Oct 2019 08:57:30 -0700 (PDT) Received: from debian.mshome.net (54.163.200.146.dyn.plus.net. [146.200.163.54]) by smtp.gmail.com with ESMTPSA id x12sm5667410wru.93.2019.10.21.08.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 08:57:29 -0700 (PDT) X-Inumbo-ID: 7c946b7e-f41b-11e9-beca-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=+9p0XoTnmWEXGbOkz/xPFNftw6o4q7PdA5mk2bpDbeo=; b=D99cQRcqnw8U2NSMpL3xgc3ED+ucuVjXTA8M/tyYbXW5S3WPrjhy3jUsnFiuFXowl8 Po0nnRoydLrfHnUEz3RXBz1vWj6CQjzmruUcxgYxggBWHCJl2bMGoLWXksIhSv0QH2KU MMOitG4ozrCQsN5226ODtMVHYJXTJH0REF39wfqE5J4bN3iJDzW31XUrrlJLZtwIwlq6 aBI24yWUE7QcITfFt3pLTTiElpuUR7Lrxks1ihOqeQXuIkqh8dTF1gmaukasx0eyU6VL 4A26xIcBne6MKGGA7LiiW6QBdLyXYza7CMhUDTHFLwDlTdX/zedH0xEn0A5gtxBCA6yE Rqiw== 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=+9p0XoTnmWEXGbOkz/xPFNftw6o4q7PdA5mk2bpDbeo=; b=pmjBprflwXZTCV4EA2MKxuWtHriZXURSN99Vm7UPKW5wJxaFqjpfwRdUuQ7w20JjVe 1E/ykO7SBDlz65uQcwY6aX3AxDwRbvcftDzLk49sRccROHcPFTgSgHj2QbKV9nq/A9Rg 7XBE9WD4emgFrsXedhNjQrfH5PfoCN3MqsQsXOXtDYKpMz2PBWs1YrAZuJlyfwrnlJxE gnUSFxXydju/6a6rcP5UBn7DcQCOvd0/jPE5Grr+jk2LMKdfZpWG6tsUu5AhvfwEuG4W VKDo43eVXc1K/E0aT+x49X5LtGva6ZblU2CnpzUbKNXDv2zsYitP1lMh6JOpkSxsUG1w hSVA== X-Gm-Message-State: APjAAAV+oVoNAzF6nAyHwFN+flJ0Hs2YqlGoEnhuuZbQA0Z1oziNqfKt d2owfI3MOvEkgt5zqED499g2v6F/x9A= X-Google-Smtp-Source: APXvYqxhbk/dKoNrV6v0Hv+TOIEoYaVGGEN1wftjCpczrGkIH8vWwuv/76XWVwiggV4bRtf1rnig/w== X-Received: by 2002:a05:600c:253:: with SMTP id 19mr18525827wmj.158.1571673449699; Mon, 21 Oct 2019 08:57:29 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 21 Oct 2019 16:57:18 +0100 Message-Id: <20191021155718.28653-10-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191021155718.28653-1-liuwe@microsoft.com> References: <20191021155718.28653-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next v3 9/9] 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 , 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 --- V3: 1. Remove some unused code 2. Rename structure 3. Also detect HV#1 signature --- xen/arch/x86/Kconfig | 9 +++++ 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 | 45 +++++++++++++++++++++++++ 7 files changed, 119 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 867de857e8..56513c771c 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -164,6 +164,15 @@ endchoice config GUEST bool =20 +config HYPERV_GUEST + def_bool n + select GUEST + prompt "Hyper-V Guest" + ---help--- + Support for Xen detecting when it is running under Hyper-V. + + If unsure, say N. + config XEN_GUEST def_bool n 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..7ab4b127f3 --- /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 + +bool __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 false; + + cpuid(0x40000001, &eax, &ebx, &ecx, &edx); + if ( eax !=3D 0x31237648 ) /* Hv#1 */ + return false; + + return true; +} + +struct hypervisor_ops hyperv_ops =3D { + .name =3D "Hyper-V", +}; + +/* + * 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 a666ad9526..17392d1ffa 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -43,6 +43,14 @@ bool hypervisor_probe(void) } #endif =20 +#ifdef CONFIG_HYPERV_GUEST + if ( hyperv_probe() ) + { + hops =3D &hyperv_ops; + return true; + } +#endif + return false; } =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..4b9cc5a836 --- /dev/null +++ b/xen/include/asm-x86/guest/hyperv.h @@ -0,0 +1,45 @@ +/*************************************************************************= ***** + * 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 + +extern struct hypervisor_ops hyperv_ops; + +bool hyperv_probe(void); + +#else + +static inline bool hyperv_probe(void) { return false; } + +#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