From nobody Tue Nov 11 07:09:23 2025 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=1569233451; cv=none; d=zoho.com; s=zohoarc; b=GpI/x+38+ALgBRstpYJFXE6CsTH2t2pCNoEzsDORc3vLQB3QKZBPMDB/Dob3nWPSFd57iKm684fdYkmXPi479kPORaR4LXsRbphkur6Xnbx75rXr4mt9BTlPqYrSwRsnEG8xrNbnlpbhNyAGkw37RcDzbqz+yd0CkrVRjWziUY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233451; 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:ARC-Authentication-Results; bh=c3ZNb5VhdiclJ5XeacxHfHIWPEvdIzEBfp7mjBbLIHI=; b=F/c6/nnLvOiNitfEKL7kAz2Z1ABtGjT8f4tk/albDc7SWCNL1mSflz86CNYgJ93qBztmWr2sMIS4kr9ljcM30CsZmPzch+VNu0JMRSNFOJjRMOf8BpfGP+mSGHzHbHDKg21nKNuIoScs7JLoR5AOPtfVkU+kBt2XIbLRYRRDDQA= 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 156923345166798.55780025926538; Mon, 23 Sep 2019 03:10:51 -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 1iCLHs-0006oO-Dx; Mon, 23 Sep 2019 10:09:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLHr-0006oG-9A for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:09:43 +0000 Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4006c716-ddea-11e9-b299-bc764e2007e4; Mon, 23 Sep 2019 10:09:38 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id 3so8597401wmi.3 for ; Mon, 23 Sep 2019 03:09:38 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:36 -0700 (PDT) X-Inumbo-ID: 4006c716-ddea-11e9-b299-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=WfEwbooFHv5S4uohbQtKqFZG0alfSTL0zc81uOqCx5Q=; b=rfOY0YM/GS8B4DZaHL04QXqwE9/Z8EQHCCqC8SIXPOn6TzOvqts5fPPXBjFZeii78B YchAW+yyDMpTIv+oF5XnuIJ0Qn0VPYV37MXY/SyShIQTOJWQEBW3BY7Q81zPnsl2XHiZ kc+8C8sfwN5Ical+rvSFXKCo7+83YA9lHlJvC70Op3lnf2i3uEkcRx2nKM+Hb0C6vETj YCgyTvUCWiqNdXxSSIBKHfqg1DK7GzSHxzIIz+buO4a+4pImvvpsSzmc1yJr/3rTmBKd pA6WC6W1yxNYzjCSKdKvSma1XL8Ud/ygSVssgYxybWZBz0rhTvbbgf7rVWOjvTIxgNCw JDkg== 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=WfEwbooFHv5S4uohbQtKqFZG0alfSTL0zc81uOqCx5Q=; b=Ha4TfcemyaFHqiQU/DLC2AWRcqDGpL/Wc5pMhuACtK83qS/QrAc7+oqYsYIhpVKFIO /GVYu90L/YznILrt1gil0hLA/3uWfdDv7fx8RMA2oQUG/gcff1ZUHfBaWmaYIIbS7Cmi X0YYhaV4bmivfNRXjg81to8FTFE8T/HBt38epF7gx/c5ZMA+3V2ulKOnmYonZUupI71m 27eUzRzh466Zl9PUQcnGBdiqgkkLRL79+zxhyoj6vrcX9U9BgNN5W/IvvBSWLQ72qe0c zRT4G41zJH13paz3cWW2YyE22gMy+yJXN8uhYHhnKjt1pdSWP6xAZKVj5Em6Chd0oYfs L/sA== X-Gm-Message-State: APjAAAXq/7nBFyXJkmIDb6WuV2EAxUAPMJJ3ZPg4umeL9v4TulBGH5oF k7kD6SyzWNRWAy0wxDgvsAc6X9Ii X-Google-Smtp-Source: APXvYqymy6baXzi0Y9kq559ouYA+w9Oj465awni9IyfMroJ2t1VNktR9c4NPWiaqmCi7JJpFOX3i+w== X-Received: by 2002:a05:600c:118a:: with SMTP id i10mr12986650wmf.80.1569233377350; Mon, 23 Sep 2019 03:09:37 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:24 +0100 Message-Id: <20190923100931.29670-2-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 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 --- 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 288dc6c042..584bdc1bb8 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -160,8 +160,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 Tue Nov 11 07:09:23 2025 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=1569233459; cv=none; d=zoho.com; s=zohoarc; b=ChqkW5Es7TxHvSvl+Xf2ubSea54wfQLCpHQ1rtpl5abqFTq47DLtZAautShtl5eudeqR3EerTifxvgmKyKzFWzHeeFYUq/46tI+I5Rqpee3xZol1xpxNi67OQbKZq1LSGGx5QyBdkthhFLN+UfpObL8EHyF7RB0xSkkWwClvJyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233459; 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:ARC-Authentication-Results; bh=yQZch7KL3QIWk/41IEyD7TPifCJ68RCFh0WkcHTHVr8=; b=iUfRPATYzCTt4F4nPFjusPb3EJoTG1wJ1PDLz1tRmwRcmwMAm28jCW7zv7Wk1EyXCWkuVVGadL19avqk502FFjnbU/bBBBtROtbB8Iuf1n0SKKHI7txN6a4GLsWYv8JXR2dvSrpKpYivKFEo5qAES8aeZYqWqnMGL+dkdEpnRRY= 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 1569233459965111.60303209350468; Mon, 23 Sep 2019 03:10:59 -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 1iCLHx-0006pA-N7; Mon, 23 Sep 2019 10:09:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLHw-0006p1-8W for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:09:48 +0000 Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4071e654-ddea-11e9-b76c-bc764e2007e4; Mon, 23 Sep 2019 10:09:39 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id r17so14614132wme.0 for ; Mon, 23 Sep 2019 03:09:38 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:37 -0700 (PDT) X-Inumbo-ID: 4071e654-ddea-11e9-b76c-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=kPofIqwbyjOoJizNjCH8bRsoi60N2OKNI61f/mmLNAk=; b=i/xagpyoe8g+/GqcncCG/OHrj2QLQl7AkCtRxVDSkIbDzLix9stO6YproSkO8EDeK3 LXL8AtwLG1H4O7EyV4qcDwcWhAI4ZiXrWpUapuCkJcPR5Yf7jt6F2zXGV9t4vIm/gHhV 5a32IBxNK1ftgWqXW2/4PbsNyfJJpLb5wBPxxcDm0xFyKIVnj8vBmAeCgn9G2KuIxi1o ZgXokMJJ/FnJV91J9flN7iw9ydNg4LRmBwYRLzql2uNU2tuFroY96XmQMFkDOx0q9dZp HeM3XJuEf7lcMvKxe7VhJyxI5vkcvX6v0DVbCNv3sCm+miktdHh0eDuB69r7LgGkaFso pdDQ== 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=kPofIqwbyjOoJizNjCH8bRsoi60N2OKNI61f/mmLNAk=; b=cSw3E3aCWeMi4d63T1y1pRMiTC68kanWnpmt6ghq1NtHLSMhIWW/jDRDaLcV1mZyAR +c5KJOVT2gKnP7n0g4EO8ELHg1d5qwRYP6sGvAD4lb7dyZmjYVvVZx0M5gtBZQu5F90W wvUYPsoZXab5OPk4YDelMSG/h5eonXpPpVP1J8FuEzVUxau9mQscIIFQvrhNERzicfuC aRL5qOJH/VnsIAm1RLMDHIeGbMVPIh/zBtVdxFSCWZIkh3vXipZhWM3lGUA2qNxBpUpT OpXeCSFH8FBPd6uLqrhmV43M/vBj2ZHUJNEDfQk5FBCQUUsVtU9Og03+fFQfbKibENIZ 0CIQ== X-Gm-Message-State: APjAAAXc6lo5Nbr0p2QVV78yTf2T6/Giw/YW2vxVDQkMr/mPSdbPDotI MvDdvnRaAejqZEQUl70PxVKOmI/w X-Google-Smtp-Source: APXvYqyASZuoeD0QtJNj2pdjbXLZAVpehovFJByeA0LLms/QxzTW7pNQKgCBxKueCw/iExf4ZO1WQw== X-Received: by 2002:a05:600c:1089:: with SMTP id e9mr13525949wmd.176.1569233378102; Mon, 23 Sep 2019 03:09:38 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:25 +0100 Message-Id: <20190923100931.29670-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 2/8] 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 --- 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 Tue Nov 11 07:09:23 2025 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=1569233462; cv=none; d=zoho.com; s=zohoarc; b=ojiT2LtGEh2LY8l/UsfMPSIuG1sTRBLh5lyM7fKcxpl752t3TBpsdkd1Q4hTroWooBcqW3VZ+oSNwWl3dBnmfVbDHdkas7Zk6zjS4Qbl17mGXHcReda5kVCSg82OtBelTEBbb8d0iBzVFeIPDT9R+zv891IcP+T5LCdnrkmLTd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233462; 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:ARC-Authentication-Results; bh=ER6xXvRE8bTJ6XurhXDGBUEPAdG9NfK2YoRjEWWAMt4=; b=ZNOwmXlI/Ca5WB5ebCMOmb3D86IrZFjk0irSK7zhzlnPIKbi+ouZyPmh1ONFeiCekj7uVnhlgg9y/sTCvLcOwNESS1R/oMSc0C1Hb+5t7tBIPc/skdShQozW4/Iq92/6zwoTO7vvcNoHt7edXEQKDQQE+w41Kki4OAn6KfovaCw= 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 1569233462782403.88766167641495; Mon, 23 Sep 2019 03:11:02 -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 1iCLI3-0006rK-5L; Mon, 23 Sep 2019 10:09: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 1iCLI1-0006qr-9f for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:09:53 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 40facc62-ddea-11e9-a337-bc764e2007e4; Mon, 23 Sep 2019 10:09:39 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id y21so8621697wmi.0 for ; Mon, 23 Sep 2019 03:09:39 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:38 -0700 (PDT) X-Inumbo-ID: 40facc62-ddea-11e9-a337-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=qOnvgxTYDq1RQTeNxzoSrcZSvYUJJofuL+Y7imyRsBI=; b=XY2tDeIpfAvkFQx8RaGzo+iVyMmjmvXl9fW/7EsS2TKQEe5+W4FJvsK5uFqCU2Vh4p fnm35QH83HqiHJyc49LzyuBVW66t8HFGUtQzoZfxtcKDrnldKFqrwL9LBXsrLyolCTcx excyCe720WLnb+F8jTQ+cej7gIZtpyGHbjECnV1PpHXlZUOdc2XbRYZ8gzumiHOqTUu1 BsjBGj1u+RHBe4+w2YCmNkjPlJf8aBN8HNtKI5EDyol2DiYqWNjYzOX9P0dSO/Js+2lW Bj1FDc8Hk3Nr953IPKKnMEkKTDZDNpVBDDSGUYeMVSUoSUr6T3HpJeiGQ/csN3vI/jV/ YkVA== 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=qOnvgxTYDq1RQTeNxzoSrcZSvYUJJofuL+Y7imyRsBI=; b=Lt4sX7bZPQfOKu+Ha3fkfaRmbHGOQr/IH+2UqoMh6wwcHEayH7kWdsAGQC51Yo4qQk MlUfJrpBFRl4FHiWNICq4pLRpnRLBXR1W5CtTN5KOXseRmw8ieUmxqqvqDG1kBAh7cJ5 nkT8uiE4FB4pY1RniG8py0WfJIY/vc6E3rm32tpbAUk/x9E4G5MLTaYfRi9uczfA4jP4 kpYfp1OLgCj63FjYHu5v4WiFtwQFDgWS97Pdr8HuRtTFaw+HtboLzXy57JxHkUIb3fWF 5wStrUV3Iihh1w2HaZnGbUvTgSkJRnkfkGRLALGGxDTS7nGcAFtAk0j0VgO6G1pFt5GX nf+Q== X-Gm-Message-State: APjAAAX92WK9iaAE8tGmrcpSx0rhcJuub45/o6zVqPMkioK1ignjZ/cL Evq9NmAS6zrOUSN0xja2ST5SA0kq X-Google-Smtp-Source: APXvYqxP5XgaxhG1fhSiuV5+Hw+0TvnZxKbGApNAIrK1/bqxkw2Qt/sRHIOZBBUqNWAJj7J2CdQHsQ== X-Received: by 2002:a1c:3904:: with SMTP id g4mr13797846wma.116.1569233378852; Mon, 23 Sep 2019 03:09:38 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:26 +0100 Message-Id: <20190923100931.29670-4-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 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. Signed-off-by: Wei Liu Reviewed-by: Roger Pau Monn=C3=A9 --- 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 324ca27f93..1b174c24df 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -992,7 +992,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 Tue Nov 11 07:09:23 2025 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=1569233458; cv=none; d=zoho.com; s=zohoarc; b=JPHEvL/9YpycnqNH1Zm2FoOO57m++k/JTeVShK/wZkLuE5JFKyw3OceWKdpWf0n9qOjduDTSzJZST8feEFpT9VdvnEuks+y2KtLPHi4p4m5K01vd7BmrC4OzT1FcmzCkGUdZrXRkqPU7M9XZD01lbWh4hnjDbToMNaZj7krYpFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233458; 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:ARC-Authentication-Results; bh=SaeFDWmi0SWEuU3XIhJQzXeV319R4DjRPu/3PNV3VxA=; b=VPShP8rGx8ezC7TIOhKYAvz9rfI9wqb1O/W1ynK5JwNzBBbw7h06zOWcPAAKRxDLEFiy5/MAN+0O8DzfTDJwrot7fvLmfsP9JR1iEv+IDdhcL/gugJnHkY7UIojZ93uEHBFB2pJ8W6PO8NTmZNujk7miIcRkXUZt+9ZWair7mKM= 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 1569233458504924.4423188460717; Mon, 23 Sep 2019 03:10:58 -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 1iCLI7-0006sx-Gy; Mon, 23 Sep 2019 10:09:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLI6-0006sY-9i for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:09:58 +0000 Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 417988b8-ddea-11e9-b299-bc764e2007e4; Mon, 23 Sep 2019 10:09:40 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id m18so8619608wmc.1 for ; Mon, 23 Sep 2019 03:09:40 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:39 -0700 (PDT) X-Inumbo-ID: 417988b8-ddea-11e9-b299-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=UqfVM3xb9A0eu4hPr4BRnP3HYQakt7P75+x7Ufcd7qY=; b=Ep23HRbzXiZPbX58oxtkUbGl/KV0RWeBVEi+qndp39CTAXj1lvBfYSMNunVqxv0KEm PCz2by9LNNBZAv//itRcF6UZ/9k0vwOCMO7YyfCj88bQZie186pXZaju6TFx2guW4yak vdX3SXi3jS+w7PWOxVAEilBCMWGRiqYQH29oedGmRgzdgrJOaVscmo8L8I2G53AH5fPz U8OkzV0YmlDfgcAymkaomlA0MWzj3uatTrIqQJaG3TONHdu3N6iqcAZLX4EFCaewDkbA uTWB3Euto6x2oG3W67m/6d2sfYkWv3IjYiM78wxvDDB84t1/WermbPf9D8uGxTT7RI+l 0bgA== 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=UqfVM3xb9A0eu4hPr4BRnP3HYQakt7P75+x7Ufcd7qY=; b=UUicReG+ysM4dhmCNNHNAwOPweDEqzV671mI7X7BJ45JJgNy115rQd4fbhgd5x1JBJ 8rYNb1vKunYvAhbiDKT2FkEywATazlbUB2+b1q7qdVQJiwedt5a6pcJ6yiWAiPccae82 VsRg5lK2yWibcQ/JADrAllkaWhnH24AReu6PetwPDjs7H6JYGo9s5wjg8X4B/iGpSbwk KET0E733D0bH9iSQXALmuTpOWcg1FHuC2+hWvifZNK69J1KTC5hNTclkqx3JXRv0j7Pc nkATKdrH8uzTyHBPg6gUWDpZrBzrvSQRWvEqse4V0sASZxvQeIUr7+hGB1iEu1gXa7k1 RNEg== X-Gm-Message-State: APjAAAWtcs5UJFaL9a8B0csCI34VPIOXy/snbIAchOfWzjPcTkiY7JsB nrMncRpkMywAh7GektfdpxE9CLZJ X-Google-Smtp-Source: APXvYqwPDn7qWlE5iQ2Ta9VT5C8jG0MlQ/uyJZ0v21SIYsfPL6BHHneQyzJFPwI/nvgyOway1JNbgQ== X-Received: by 2002:a05:600c:c2:: with SMTP id u2mr12218904wmm.37.1569233379730; Mon, 23 Sep 2019 03:09:39 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:27 +0100 Message-Id: <20190923100931.29670-5-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 4/8] x86: factor out xen variants for hypervisor setup 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 will add Hyper-V specific implementations in the future. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/guest/xen/xen.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 78fc603996..f93c8fbd1c 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -67,7 +67,7 @@ static void __init find_xen_leaves(void) } } =20 -void __init probe_hypervisor(void) +static void __init probe_xen(void) { if ( xen_guest ) return; @@ -87,6 +87,11 @@ void __init probe_hypervisor(void) xen_guest =3D true; } =20 +void __init probe_hypervisor(void) +{ + probe_xen(); +} + static void map_shared_info(void) { mfn_t mfn; @@ -249,10 +254,8 @@ static void init_evtchn(void) } } =20 -void __init hypervisor_setup(void) +static void __init xen_setup(void) { - init_memmap(); - map_shared_info(); =20 set_vcpu_id(); @@ -277,13 +280,25 @@ void __init hypervisor_setup(void) init_evtchn(); } =20 -void hypervisor_ap_setup(void) +void __init hypervisor_setup(void) +{ + init_memmap(); + + xen_setup(); +} + +static void xen_ap_setup(void) { set_vcpu_id(); map_vcpuinfo(); init_evtchn(); } =20 +void hypervisor_ap_setup(void) +{ + xen_ap_setup(); +} + int hypervisor_alloc_unused_page(mfn_t *mfn) { unsigned long m; @@ -307,7 +322,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 +345,11 @@ void hypervisor_resume(void) pv_console_init(); } =20 +void hypervisor_resume(void) +{ + xen_resume(); +} + /* * Local variables: * mode: C --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Nov 11 07:09:23 2025 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=1569233466; cv=none; d=zoho.com; s=zohoarc; b=DbFmcvnPCmsGfj5GU8RpWAxSAs5xAMter9RAzM1lt5llGsz5cXRYDoTqt06a+FRhWwkVlDK8Flhj3fnqrX+ptDL7IqLF5ki7z/sNyQnwv6AUaam5FNTOxHA3KFJMz5wfRJsMlJjaQ6w6n+jAmA3ycsAz/reZBR8b7AerKE+zVmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233466; 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:ARC-Authentication-Results; bh=dXt0mlbnE+iAdyAajk7HDmpiVcAp7G0SFwwDGQZ+FXM=; b=byQ8+lmfslXUeeOTKTSBw18E33YsCK0Zk93w+6USVLfnK497jp1pJEKrR9S3IjnWwM247a/sp59hh4aHfVPZ2RkReYnl7EukdQZ5KvvplshijAjW5sjl+fbT7ZhbDz4SN2UVtcpPpKtE4+V+II9qlOnQPMLAupvwIj1ZC7HrvLI= 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 1569233466303977.4077797672285; Mon, 23 Sep 2019 03:11:06 -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 1iCLIC-000791-SC; Mon, 23 Sep 2019 10:10:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLIB-00071D-9F for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:10:03 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 42083da6-ddea-11e9-b76c-bc764e2007e4; Mon, 23 Sep 2019 10:09:41 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id a6so9172509wma.5 for ; Mon, 23 Sep 2019 03:09:41 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:40 -0700 (PDT) X-Inumbo-ID: 42083da6-ddea-11e9-b76c-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=faSPq0/FgKeXO1cnxCD0/aZRNuNgVtyb3U2iGwfHW2c=; b=Ix3DCsHFPzP3J3dL6O2hVzBd3LE9Un/nuiFBQcrq1KWyUftPQGzwsbLXnXk/5RAdbp rdEhtMpSeSdluGv1LAnaOzhr7lVx4ipZuODr5bXFRQtXWbfeM7SQBYGMGaN3JOK+AEIE iXD9VlYk0AfyBSGnjo/hUavTwnxilY5NsODhfTA2Dc7H7kJOxXVp0WSczR5p1s6xS4IN RuaV2/Mh44LqeSWJGyStcUtjq392q5QaSCnuvCqfsizgyMP6eoibIEya9lMa/b/w4ezf 3aTPETLb9tcIVqH1TnbP1tRgLcc1l1u5pwPZ9VOvAEr7geJr4uP9fRVcHFSjp9Z7vszq VWaw== 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=faSPq0/FgKeXO1cnxCD0/aZRNuNgVtyb3U2iGwfHW2c=; b=QJnitIT5TtuhCcFrJvzDxVc+F5VdO2ezLw1BfOlrYYckfrU32sa819IYFbtUEdGfrh D4sptlAtMXbFg2EXjTHVpHJiF66UWM3qH9mV5x083XMzRx062nrfPhwNe/6X66tFVMUP EjpE1cXgGoFp7qJn4/R8F1DxcnAHMEnXDG1LkMLu9kZg6v2c7lJnKWTiDFvSecplVGQh HOtiGqF3mX/4Nhmu/WyV4ov+QO+dzR/uUfuWEgdB24Ly1QrJpDzwpBDY/f3W0faHq4vL fiAWQxkIe6ac6SM8/+ZmHk8qlyMBXwUvLioYxD+uzcb5nRdDenKOQQDa/pvbYOiezaIM f8Nw== X-Gm-Message-State: APjAAAVgV0Roa8P7Wpf7IsCg530GI0P++pNEtJ7kv8XzoDblMD4mlSix f+jZNGIBcXmtmS5unSuEZDz6Gl87 X-Google-Smtp-Source: APXvYqwjh0Q6C3SRY+SzsVrgkwn4+OS9/PS6Ifq2LiKwvhdg3lABmd4ip5XFWOoA1xChqGi44NWjWg== X-Received: by 2002:a7b:cd83:: with SMTP id y3mr13582130wmj.165.1569233380548; Mon, 23 Sep 2019 03:09:40 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:28 +0100 Message-Id: <20190923100931.29670-6-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 5/8] x86: factor out hypervisor agnostic 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) The only implementation there is Xen. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/guest/Makefile | 2 + xen/arch/x86/guest/hypervisor.c | 112 +++++++++++++++++++++++++ xen/arch/x86/guest/xen/xen.c | 81 +----------------- xen/include/asm-x86/guest.h | 1 + xen/include/asm-x86/guest/hypervisor.h | 58 +++++++++++++ xen/include/asm-x86/guest/xen.h | 21 ++--- 6 files changed, 182 insertions(+), 93 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..b0a724bf13 --- /dev/null +++ b/xen/arch/x86/guest/hypervisor.c @@ -0,0 +1,112 @@ +/*************************************************************************= ***** + * 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) 2017 Citrix Systems Ltd. + */ + +#include +#include +#include + +#include +#include + +static struct rangeset *mem; + +void __init probe_hypervisor(void) +{ + /* Too early to use cpu_has_hypervisor */ + if ( !(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) ) + return; + + probe_xen(); +} + +static void __init init_memmap(void) +{ + unsigned int i; + + mem =3D rangeset_new(NULL, "host memory map", 0); + if ( !mem ) + panic("failed to allocate PFN usage rangeset\n"); + + /* + * Mark up to the last memory page (or 4GiB) as RAM. This is done beca= use + * Xen doesn't know the position of possible MMIO holes, so at least t= ry to + * avoid the know MMIO hole below 4GiB. Note that this is subject to f= uture + * discussion and improvements. + */ + if ( rangeset_add_range(mem, 0, max_t(unsigned long, max_page - 1, + PFN_DOWN(GB(4) - 1))) ) + panic("unable to add RAM to in-use PFN rangeset\n"); + + for ( i =3D 0; i < e820.nr_map; i++ ) + { + struct e820entry *e =3D &e820.map[i]; + + if ( rangeset_add_range(mem, PFN_DOWN(e->addr), + PFN_UP(e->addr + e->size - 1)) ) + panic("unable to add range [%#lx, %#lx] to in-use PFN rangeset= \n", + PFN_DOWN(e->addr), PFN_UP(e->addr + e->size - 1)); + } +} + +void __init hypervisor_setup(void) +{ + init_memmap(); + + xen_setup(); +} + +void hypervisor_ap_setup(void) +{ + xen_ap_setup(); +} + +int hypervisor_alloc_unused_page(mfn_t *mfn) +{ + unsigned long m; + int rc; + + rc =3D rangeset_claim_range(mem, 1, &m); + if ( !rc ) + *mfn =3D _mfn(m); + + return rc; +} + +int hypervisor_free_unused_page(mfn_t mfn) +{ + return rangeset_remove_range(mem, mfn_x(mfn), mfn_x(mfn)); +} + +void hypervisor_resume(void) +{ + xen_resume(); +} + +/* + * 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/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index f93c8fbd1c..a730e6ad1b 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -39,7 +39,6 @@ bool __read_mostly xen_guest; =20 __read_mostly uint32_t xen_cpuid_base; extern char hypercall_page[]; -static struct rangeset *mem; =20 DEFINE_PER_CPU(unsigned int, vcpu_id); =20 @@ -67,15 +66,11 @@ static void __init find_xen_leaves(void) } } =20 -static void __init probe_xen(void) +void __init probe_xen(void) { if ( xen_guest ) return; =20 - /* 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 ) @@ -87,11 +82,6 @@ static void __init probe_xen(void) xen_guest =3D true; } =20 -void __init probe_hypervisor(void) -{ - probe_xen(); -} - static void map_shared_info(void) { mfn_t mfn; @@ -166,35 +156,6 @@ static void set_vcpu_id(void) this_cpu(vcpu_id) =3D smp_processor_id(); } =20 -static void __init init_memmap(void) -{ - unsigned int i; - - mem =3D rangeset_new(NULL, "host memory map", 0); - if ( !mem ) - panic("failed to allocate PFN usage rangeset\n"); - - /* - * Mark up to the last memory page (or 4GiB) as RAM. This is done beca= use - * Xen doesn't know the position of possible MMIO holes, so at least t= ry to - * avoid the know MMIO hole below 4GiB. Note that this is subject to f= uture - * discussion and improvements. - */ - if ( rangeset_add_range(mem, 0, max_t(unsigned long, max_page - 1, - PFN_DOWN(GB(4) - 1))) ) - panic("unable to add RAM to in-use PFN rangeset\n"); - - for ( i =3D 0; i < e820.nr_map; i++ ) - { - struct e820entry *e =3D &e820.map[i]; - - if ( rangeset_add_range(mem, PFN_DOWN(e->addr), - PFN_UP(e->addr + e->size - 1)) ) - panic("unable to add range [%#lx, %#lx] to in-use PFN rangeset= \n", - PFN_DOWN(e->addr), PFN_UP(e->addr + e->size - 1)); - } -} - static void xen_evtchn_upcall(struct cpu_user_regs *regs) { struct vcpu_info *vcpu_info =3D this_cpu(vcpu_info); @@ -254,7 +215,7 @@ static void init_evtchn(void) } } =20 -static void __init xen_setup(void) +void __init xen_setup(void) { map_shared_info(); =20 @@ -280,49 +241,20 @@ static void __init xen_setup(void) init_evtchn(); } =20 -void __init hypervisor_setup(void) -{ - init_memmap(); - - xen_setup(); -} - -static void xen_ap_setup(void) +void xen_ap_setup(void) { set_vcpu_id(); map_vcpuinfo(); init_evtchn(); } =20 -void hypervisor_ap_setup(void) -{ - xen_ap_setup(); -} - -int hypervisor_alloc_unused_page(mfn_t *mfn) -{ - unsigned long m; - int rc; - - rc =3D rangeset_claim_range(mem, 1, &m); - if ( !rc ) - *mfn =3D _mfn(m); - - return rc; -} - -int hypervisor_free_unused_page(mfn_t mfn) -{ - return rangeset_remove_range(mem, mfn_x(mfn), mfn_x(mfn)); -} - static void ap_resume(void *unused) { map_vcpuinfo(); init_evtchn(); } =20 -static void xen_resume(void) +void xen_resume(void) { /* Reset shared info page. */ map_shared_info(); @@ -345,11 +277,6 @@ static void xen_resume(void) pv_console_init(); } =20 -void hypervisor_resume(void) -{ - xen_resume(); -} - /* * Local variables: * mode: C 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..135ad36f72 --- /dev/null +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -0,0 +1,58 @@ +/*************************************************************************= ***** + * 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 . + */ + +#ifndef __X86_GUEST_HYPERVISOR_H__ +#define __X86_GUEST_HYPERVISOR_H__ + +#ifdef CONFIG_GUEST + +#include + +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); + +#else + +#include + +static inline void probe_hypervisor(void) {} + +static inline void hypervisor_setup(void) +{ + ASSERT_UNREACHABLE(); +} +static inline void hypervisor_ap_setup(void) +{ + ASSERT_UNREACHABLE(); +} + +#endif /* CONFIG_GUEST */ +#endif /* __X86_GUEST_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..d031f1f70d 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -32,12 +32,10 @@ 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); -void hypervisor_resume(void); +void probe_xen(void); +void xen_setup(void); +void xen_ap_setup(void); +void xen_resume(void); =20 DECLARE_PER_CPU(unsigned int, vcpu_id); DECLARE_PER_CPU(struct vcpu_info *, vcpu_info); @@ -47,16 +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 void hypervisor_setup(void) -{ - ASSERT_UNREACHABLE(); -} -static inline void hypervisor_ap_setup(void) -{ - ASSERT_UNREACHABLE(); -} +static inline void probe_xen(void) {} =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 Tue Nov 11 07:09:23 2025 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=1569233467; cv=none; d=zoho.com; s=zohoarc; b=MTNY4b0N0GXLPeJM1bnAQuz9GRKzLCskG422qk2OwoaIzP3CIailQFzzhPOO5xvPr8JwxJqiou1z4ElBghKXtKE8cHvEPk0A9P0BOzMt6yOi2QMfT9HO6JBZPLnE4qHch23fFz8+VnYGmE+u4flnVsKpr2HNKBvKJXwhZCVlkpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233467; 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:ARC-Authentication-Results; bh=ZQwbgDFJ8exzktmcZAA/c7NW4IVAFM9RumfdGN7dguo=; b=BATueRoT1kGrOoHZbWXRYkL8kfaeOePo/8EZGJkNwEfIPtxT0q2cJHUXkVqndIRwAlbOGPIG1cjQlF2FpGR/7ayXLeLjO+ZYFuJsDmSH6M/qE272fznb2RtWGPwyMeczqsrAlTLaEXAV8w7krF3rQbqRrDW6QuHyd59o1nrkUNY= 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 1569233467429506.58314128226687; Mon, 23 Sep 2019 03:11:07 -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 1iCLII-0007Wb-5T; Mon, 23 Sep 2019 10:10:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLIG-0007Tw-8z for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:10:08 +0000 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4264c094-ddea-11e9-b299-bc764e2007e4; Mon, 23 Sep 2019 10:09:42 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id m18so8619705wmc.1 for ; Mon, 23 Sep 2019 03:09:42 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:40 -0700 (PDT) X-Inumbo-ID: 4264c094-ddea-11e9-b299-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=J0gWUg2h7tpdgfhePN1rbGU9ftmJv074Q5+IRkBqTX8=; b=PGil4XhYR6v62HYFcwiaSCYPWEF6MEg6hCwXjZuKaP4Aj7i5WKq/QH3zUtclD5scVt sESn8KrxnsfFTdchYW5vLvkzkaxVL2FBxZUCLfStN1jAW8LSDfo9R5oY0tylhwGpILiL U7oIqNWN5XQkozkg8kEeqQwxPBgx3doqx0t5pPjkwR2DSkT+PbPjZ3BxnrH0JcietLgQ GANPJpCPusX5YsA4qIJ2sEZxMLar/UUmLClL8J9c01F5z7xTpwULjPKK9mNX6A5KuDYW j0uCizKYM7w8YoURYr3pTyJzBJZMbT75DM0DcLa3lQBzOWYO53ehnwVfccMUKOB1GxR4 YaCg== 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=J0gWUg2h7tpdgfhePN1rbGU9ftmJv074Q5+IRkBqTX8=; b=Z1zcjDSvz9rd7HYrEg7ceVLffOPXiVZAg/cJmiFB4xMljCMlYlDxMynrhylZAp6/BE uXMQh90FI2Sk2/6VLW/ZjaORxaFmDTEeGVqEGz+WJHH75QMLFhNsGZiW3gfmjqtEFp7m qs2FAqpabsrGc0dUObh1PPs5juHV1zVD9UIiWe3jOiS/rBgnCSGdZ+06QI6PsYFMwf3X tbBte0v+3/rDXGepBugQtbuTBsgOYVnyJKyA44nFyLEn+WTl3fgXqtCHenGLXKtIZRfd SCaP+aZ7PDZixT5M5/X+wun6aIb558y5OrlxZb9ZHI5rU1cwc4ErQOrQLu0qxjeGFf/F UKCA== X-Gm-Message-State: APjAAAW8hTGuzeY6dshjwhOKtLzkyfFWxkwiT8uyXwE/pt2m5CB4iQkh p1jfs+01w+YfOhEOwAEl0nd0Tz9k X-Google-Smtp-Source: APXvYqx7BqyC5ozDISUKqL4kgTWqLV6+d4HNGBkzXibQ1XS4BtpTE5Yi//FfuOXbkSgclyjdgBGuFA== X-Received: by 2002:a7b:c757:: with SMTP id w23mr12824379wmk.31.1569233381352; Mon, 23 Sep 2019 03:09:41 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:29 +0100 Message-Id: <20190923100931.29670-7-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 6/8] x86: make probe_xen return boolean value 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 indication whether it has succeeded or not. Signed-off-by: Wei Liu --- xen/arch/x86/guest/hypervisor.c | 5 ++++- xen/arch/x86/guest/xen/xen.c | 7 ++++--- xen/include/asm-x86/guest/xen.h | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hyperviso= r.c index b0a724bf13..fb572b0402 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -34,7 +34,10 @@ void __init probe_hypervisor(void) if ( !(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) ) return; =20 - probe_xen(); + if ( probe_xen() ) + return; + + /* Hyper-V probing to follow. */ } =20 static void __init init_memmap(void) diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index a730e6ad1b..8390b045f0 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -66,20 +66,21 @@ static void __init find_xen_leaves(void) } } =20 -void __init probe_xen(void) +bool __init probe_xen(void) { if ( xen_guest ) - return; + return true; =20 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) diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xe= n.h index d031f1f70d..7eda3d4956 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -32,7 +32,7 @@ extern bool xen_guest; extern bool pv_console; extern uint32_t xen_cpuid_base; =20 -void probe_xen(void); +bool probe_xen(void); void xen_setup(void); void xen_ap_setup(void); void xen_resume(void); @@ -45,7 +45,7 @@ DECLARE_PER_CPU(struct vcpu_info *, vcpu_info); #define xen_guest 0 #define pv_console 0 =20 -static inline void probe_xen(void) {} +static inline bool probe_xen(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 Tue Nov 11 07:09:23 2025 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=1569233473; cv=none; d=zoho.com; s=zohoarc; b=Xvj6CEZfupKkGS23PhJls1sV2+jFIed9YaJ0W+qckUt0sMyIgakssYWaLt1bLCN4Rb2MFaP+p2rfa47XRaf3YIt+ziO6yKpM4MUtEmd8H8Mf98L9VeXlouphMr1ywfrJXmGZiMzXKl8y7cbQLcvA070NEF/O+480Md3Lrnr9/Ao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233473; 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:ARC-Authentication-Results; bh=X9On79TS3JWyk3/1f6uQ+RpoOvPLBCOi8NEQOHOkP5g=; b=Ox8+OV6kxnKBWDtvlCdOz/I8AQjMz0OAp2jtcJy8lW7LEVkf3wMTuPew758A31Y/zOdVyQwQo7mawSKF8sC53tzI3E9abFkZZF7co/cdE0/nHvESkFqlgvMkQpxOPxHjJfqiQH30NlT8hIuDPGQJnPFy/kBeYLDRXKDpn740T4k= 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 1569233473557447.5843752476976; Mon, 23 Sep 2019 03:11:13 -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 1iCLIM-0007Zm-Ly; Mon, 23 Sep 2019 10:10:14 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLIL-0007ZH-9y for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:10:13 +0000 Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 42ff5546-ddea-11e9-b76c-bc764e2007e4; Mon, 23 Sep 2019 10:09:43 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id f22so1465785wmc.2 for ; Mon, 23 Sep 2019 03:09:43 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:41 -0700 (PDT) X-Inumbo-ID: 42ff5546-ddea-11e9-b76c-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=A9Koh0GsgVCT4pN4yJPa3MEazXKb1HbGcXbrkIuJu84=; b=CzQiMu1j5ykcWRa7i26QUa658su7ucyXKJ7qqbkXENsYZTyR9G9TG9roMnN39oxSmx pnpUcJh3SF5Fq36vhAP4zXeO2CWPAJ6q0w7A6vy46YaJRp0gXteCF0Vww1xUKzOiearF ogxwHX3SjYUqNfI2uvhywoWK+LdRua/v/B98EmYEsRqF3RA/ut8KIdNQfnRAFN9rQQPC Y1KPQeyPRCLjpeunk4CYqXEERxeGhy+Q4D2gPc7b9E8tGBrqP5guW+Prjxv14QUzRIqp ++NOKbJqAG4YKerw5UVIyPu6wHjUNrCqttd0HB72Z633u3CQ6vptZSRG/0qSXFwat8lK vq5w== 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=A9Koh0GsgVCT4pN4yJPa3MEazXKb1HbGcXbrkIuJu84=; b=LXc8KpaWrjA4uF7VgM0uTPiZkREawmH1iTGrDAxiQORJRKBa1PGSZXdjvqh4jRxqLK 5lyHpU7zi569hkheTqFy+fNBoYWMRINcsE8am/V69ogTGpHFvaEFo6lGu3IaqXeWXY6t L2a2L2UWv34DYe5eBBXfbPrO7zkybJPyvAfPcSfrVR5uE8TahzvtCbqTuKMq3/EFr/6M OoeyeI7KSPelWq3g1ti0XILCeCtYoLOI6bCKnlCabn/CPnlGkKnHX4wNGIxnjoUC5oAY d/Ya+REq9cGEE5ITU5SFTN0M4WeYCf0X6hBcbDOKUX2gNo8L9Vo9CPgb+KXDL8xE9HmA CS9Q== X-Gm-Message-State: APjAAAUm4lrH0BUjWDwm0IaJDKyQQOcDOH7WDyyRULnSzCYllhLLVo0v sLE3991DVJHDYns+TV8PcKfD8O51 X-Google-Smtp-Source: APXvYqwAn9PhG51WV0+u8bBUzZr7Q+/AVjkqcTH2tpe/NlUId/KPRDCUW46hZSu7fGR3T37VIonBPw== X-Received: by 2002:a7b:c40c:: with SMTP id k12mr14268922wmi.151.1569233382211; Mon, 23 Sep 2019 03:09:42 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:30 +0100 Message-Id: <20190923100931.29670-8-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 7/8] x86: introduce CONFIG_HYPERV and hyperv directory 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 code. As starters, detect Hyper-V in probe_hyperv. More complex functionality will be added later. Signed-off-by: Wei Liu --- 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 | 63 ++++++++++++++++++++++++++++++ xen/arch/x86/guest/hypervisor.c | 3 +- xen/include/asm-x86/guest.h | 1 + xen/include/asm-x86/guest/hyperv.h | 48 +++++++++++++++++++++++ 7 files changed, 125 insertions(+), 1 deletion(-) 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 584bdc1bb8..c5a93babfe 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -163,6 +163,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..488e9c14a3 --- /dev/null +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -0,0 +1,63 @@ +/*************************************************************************= ***** + * 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 __read_mostly hyperv_guest; + +bool __init probe_hyperv(void) +{ + uint32_t eax, ebx, ecx, edx; + + if ( hyperv_guest ) + return true; + + cpuid(0x40000000, &eax, &ebx, &ecx, &edx); + if ( (ebx =3D=3D 0x7263694d) && /* "Micr" */ + (ecx =3D=3D 0x666f736f) && /* "osof" */ + (edx =3D=3D 0x76482074) ) /* "t Hv" */ + hyperv_guest =3D true; + + return hyperv_guest; +} + +void __init hyperv_setup(void) +{ +} + +void hyperv_ap_setup(void) +{ +} + +void hyperv_resume(void) +{ +} + +/* + * 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 fb572b0402..17d56cd05e 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -37,7 +37,8 @@ void __init probe_hypervisor(void) if ( probe_xen() ) return; =20 - /* Hyper-V probing to follow. */ + if ( probe_hyperv() ) + return; } =20 static void __init init_memmap(void) 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..30e5135a72 --- /dev/null +++ b/xen/include/asm-x86/guest/hyperv.h @@ -0,0 +1,48 @@ +/*************************************************************************= ***** + * 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 + +extern bool hyperv_guest; + +bool probe_hyperv(void); +void hyperv_setup(void); +void hyperv_ap_setup(void); +void hyperv_resume(void); + +#else + +#define hyperv_guest 0 + +static inline bool probe_hyperv(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 From nobody Tue Nov 11 07:09:23 2025 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=1569233476; cv=none; d=zoho.com; s=zohoarc; b=f4LOdvi0WKzT9BmG540Bb+7dpJu6wwaxjue3/t45/pN0wkxJE/LgGgFLf0EZWKs/aCX28E0o1XvUmAN+OH0cu+ugCiLmLarDncMKgtEqVou7it7m/ok3CHqavz4X/X0S83RPa7MLBe3PgFiyfrZ+DUQ6jj9F2wwHdnL7uuopDlU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569233476; 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:ARC-Authentication-Results; bh=aRsX1F89SV4WIB8WbNDQqFa6BBoQmZ5mf/QQWoGSJzc=; b=POhi45j7VZ3IBvLV1R4PurNe4P2xnufE7C3OoNWsRNMzVsCsC0YDPd/tvG/VBJH7LcobWIk5/zhaI2DYXHotIQH1cCtvrmjyZDOpW3lgxUxj0+9Oogf5q3VTDcxDIT8bO0DMFiPfhPhmBGOCImmWalitzKKFhRm6ej1mnSjaKrk= 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 1569233476794495.0893794019138; Mon, 23 Sep 2019 03:11:16 -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 1iCLIS-0007cE-1I; Mon, 23 Sep 2019 10:10:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCLIQ-0007bP-Ae for xen-devel@lists.xenproject.org; Mon, 23 Sep 2019 10:10:18 +0000 Received: from mail-wr1-x443.google.com (unknown [2a00:1450:4864:20::443]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 43626438-ddea-11e9-a337-bc764e2007e4; Mon, 23 Sep 2019 10:09:43 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id l11so13226060wrx.5 for ; Mon, 23 Sep 2019 03:09:43 -0700 (PDT) Received: from debian.mshome.net (207.148.159.143.dyn.plus.net. [143.159.148.207]) by smtp.gmail.com with ESMTPSA id s10sm18241662wmf.48.2019.09.23.03.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:09:42 -0700 (PDT) X-Inumbo-ID: 43626438-ddea-11e9-a337-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=Yhsc+HWc7UY9B6qKVRW2bcLWA9bzINIqtexNLDZik88=; b=QKRgf39r53CdG9wwxV68nU2s5oulVwOKADpxfCmy1r1qR9gHBpgv5K5xN5opulNiV6 /htwusVkgpUef7gYdY9ObiFwOKlEwaYHFDdRZOv6Mz0pTSBHhBQEHO8DnOLcLPlm+dmg yQ5zkGENiKEV58SsV9zZ99yCwAfK6egxyRFn/HnzUqY90Z0hXPMB6H7uEooZO0ADoJbA nNZ0jeIFDUGoGw4cEFALnNP+mmHnENxE8UnEm+rc5HnX+biA9PDU8zDfIS7U+ZSEnMB2 7yNDETG08daHxYgH9IDeA8mN7UalWpJk4oS9AHG/m2qBc9FkOBcf6PJIMmcHhzmz6G9b qcZg== 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=Yhsc+HWc7UY9B6qKVRW2bcLWA9bzINIqtexNLDZik88=; b=I139a5GBEiaaYcrC9kI3Lam3pHAJopeD25lY7cKBKCrpKjTvGyWm3N8jNDEFuw/XmJ zOhd1tnEcD6t8UQJvgdFYEs/IZoBZhYyeVvxwpgwq5ZUpa4zt/FGAkYNtJNp76dk+CV7 sGtUynpGyq6Pt+WnnzsQ8fdAhm98Bs4aq2FkPFq5gwNMDq79egqTOWBRzogrn/akVcGA 5gr5lT8V6z5W3FcfuxMDSKZaOp7yvn5zRw7V+VskWJQcFLr+RW28NCzQY+JGf3DcMFpl NFG+TmWixS93ZwI7Lim9RPbpYAyILhVLpyRq5s2hxy2eH1nhPBTBGClmVlA/slnCnQ57 G0XQ== X-Gm-Message-State: APjAAAWVzhKxxhEqCSY4fjXb3zmviUrisvvKgdGq9tIiPKF9Z0Opc284 41yERIiGaUikqCVpoZP4IA+TGiBw X-Google-Smtp-Source: APXvYqz4dzc1WRlkX8HPkBrx46odkk5LysJbmR/OKnNJk/kGwJkrNc0dd9t2LH5yd9MNx8UwxU0x2A== X-Received: by 2002:adf:ed05:: with SMTP id a5mr20955854wro.35.1569233383004; Mon, 23 Sep 2019 03:09:43 -0700 (PDT) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Mon, 23 Sep 2019 11:09:31 +0100 Message-Id: <20190923100931.29670-9-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923100931.29670-1-liuwe@microsoft.com> References: <20190923100931.29670-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-next RFC 8/8] x86: be more verbose when running nested 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 --- xen/arch/x86/setup.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index dec60d0301..bbcc5a503d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -789,6 +789,17 @@ void __init noreturn __start_xen(unsigned long mbi_p) =20 printk("Xen image load base address: %#lx\n", xen_phys_start); =20 +#ifdef CONFIG_GUEST +#ifdef CONFIG_XEN_GUEST + if ( xen_guest ) + printk("Running on Xen hypervisor\n"); +#endif +#ifdef CONFIG_HYPERV_GUEST + if ( hyperv_guest ) + printk("Running on Hyper-V\n"); +#endif +#endif + #ifdef CONFIG_VIDEO printk("Video information:\n"); =20 --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel