Received: by 10.213.65.68 with SMTP id h4csp1147620imn; Wed, 4 Apr 2018 13:30:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/osIaZcVs2sqWhSXPSIQ1moK0wPZ/wfassxVHsrAjR0WZHdV/DpmgtfUI758iEnEpWXlQ8 X-Received: by 10.99.176.71 with SMTP id z7mr12602910pgo.74.1522873803194; Wed, 04 Apr 2018 13:30:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522873803; cv=none; d=google.com; s=arc-20160816; b=k22TmU4NXr8ABJiNPy22BxjNvV+zCBwDghmi4A7vTuM8AdnSKasHfsnvorPalfdWVo /g0TTFEVFBXyTwNlnKVcvxbpOE6RSnlWCU1MlqPB0geotgalA3alVODivdjkf27VpsDr Wp1hAUKy0CHQZ2zj4+5533kQjpINWzZLOguIFAo1kcda95MttldtjwWt/3x+lFt/N8pL 8tvGMRVd3qjDNjBOWeC0Yf05nLh6RL8SP18JZYH905mzgLp7LL36J9M7TvBGxfV0vS5i aMpJOg91hiPqWjqV36RaaRI0OdoFzMy9DNFd57Fdcv2ExUM77PuU/AVC3Ypd/J1AVmUh y0rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=aeexrc4oQbt/TrkJmtuXCmWpVYF+ujL8rHd3v/teudU=; b=Vndw5yZvFocKAKHrvXR2fPTqpWh/0b8KbqPTiGkMMv4h3Px8RGiwmZVuU1BdMmv3WD 3COLR2eyBJxGZWasHuI29Z0pO1Wn0BT5h8QJZvnUNnueUOE1xvXnaoBAM+YV55D9w9Q+ xHtAQAa39ETOz6M7QBhVsgeFDze+8YyRn5JC6HLlvSgS8OqNI1Uvr8hmLfzXqSpfJ29d 5N23QRK/8CR19Ma8agqkylpSfOO6GLZ+SOptq3ZuUGT0S0Yz1WJIdmJEZeuE+n/Rw2o1 twOWB7oHhCrgxONuRDs4w76XjBxIHgW1RmgE9tmaD0OlcrI76y1rv8XPTrDjT/mYrV27 aXWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=eOdNL3sU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u137si4249351pgb.651.2018.04.04.13.29.48; Wed, 04 Apr 2018 13:30:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=eOdNL3sU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbeDDU2n (ORCPT + 99 others); Wed, 4 Apr 2018 16:28:43 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:57168 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654AbeDDU2l (ORCPT ); Wed, 4 Apr 2018 16:28:41 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w34KGgrG172505; Wed, 4 Apr 2018 20:27:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=aeexrc4oQbt/TrkJmtuXCmWpVYF+ujL8rHd3v/teudU=; b=eOdNL3sU2V1KKjBJu3k6Exwrym0eDggOyf9yyj5ySQjlpnxouoGewYF+Nuw16Fj311wp fru7aUdrTDKA6KXNWxpCCyX1nPTwBQjNzmvYgyi4GWv1LbrKcN1/z42tvXyOnPkgD8o9 pi3i3UgmW7y16q2VPtmVR+M8jf/Jlk0YGMqOHGFrxSUYb0H45fsv8eNMB4UKta4u2D/0 OVNGucOXc6wR1fUYvzfouKQaoHDJ7lV3aVoe6+9IJN4obwbYaA9o/NEhZpbz0tT1n5Dh AddyZqWirvFgA+7xnY3ciM/sKld0nWyXGI9kNLU7weyY9VjYl0XBf753d6nYOGHoTeAB uQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2h55krr18w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Apr 2018 20:27:50 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w34KRnR4001931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Apr 2018 20:27:50 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w34KRlhw028179; Wed, 4 Apr 2018 20:27:47 GMT Received: from marawils-linux.us.oracle.com (/10.141.197.9) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 04 Apr 2018 13:27:47 -0700 From: Maran Wilson To: x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, jgross@suse.com Cc: boris.ostrovsky@oracle.com, bp@suse.de, dave.hansen@linux.intel.com, davem@davemloft.net, gregkh@linuxfoundation.org, hpa@zytor.com, jpoimboe@redhat.com, kirill.shutemov@linux.intel.com, linus.walleij@linaro.org, luto@kernel.org, mchehab@kernel.org, mingo@redhat.com, rdunlap@infradead.org, tglx@linutronix.de, thomas.lendacky@amd.com, hch@infradead.org, roger.pau@citrix.com, rkrcmar@redhat.com, maran.wilson@oracle.com Subject: [PATCH v6 0/7] KVM: x86: Allow Qemu/KVM to use PVH entry point Date: Wed, 4 Apr 2018 13:27:39 -0700 Message-Id: <1522873659-17572-1-git-send-email-maran.wilson@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8853 signatures=668697 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=7 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804040198 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For certain applications it is desirable to rapidly boot a KVM virtual machine. In cases where legacy hardware and software support within the guest is not needed, Qemu should be able to boot directly into the uncompressed Linux kernel binary without the need to run firmware. There already exists an ABI to allow this for Xen PVH guests and the ABI is supported by Linux and FreeBSD: https://xenbits.xen.org/docs/unstable/misc/pvh.html This patch series would enable Qemu to use that same entry point for booting KVM guests. Changes from v5: * The interface changes to the x86/HVM start info layout have now been accepted into the Xen tree. * Rebase and merge upstream PVH file changes. * (Patch 6) Synced up to the final version of the header file that was acked and pulled into the Xen tree. * (Patch 1) Fixed typo and removed redundant "def_bool n" line. Changes from v4: Note: I've withheld Juergen's earlier "Reviewed-by" tags from patches 1 and 7 since there were minor changes (mostly just addition of CONFIG_KVM_GUEST_PVH as requested) that came afterwards. * Changed subject prefix from RFC to PATCH * Added CONFIG_KVM_GUEST_PVH as suggested * Relocated the PVH common files to arch/x86/platform/pvh/{enlighten.c,head.S} * Realized I also needed to move the objtool override for those files * Updated a few code comments per reviewer feedback * Sent out a patch of the hvm_start_info struct changes against the Xen tree since that is the canonical copy of the header. Discussions on that thread have resulted in some (non-functional) updates to start_info.h (patch 6/7) and those changes are reflected here as well in order to keep the files in sync. The header file has since been ack'ed for the Xen tree by Jan Beulich. Changes from v3: * Implemented Juergen's suggestion for refactoring and moving the PVH code so that CONFIG_XEN is no longer required for booting KVM guests via the PVH entry point. Functionally, nothing has changed from V3 really, but the patches look completely different now because of all the code movement and refactoring. Some of these patches can be combined, but I've left them very small in some cases to make the refactoring and code movement easier to review. My approach for refactoring has been to create a PVH entry layer that still has understanding and knowledge about Xen vs non-Xen guest types so that it can make run time decisions to handle either case, as opposed to going all the way and re-writing it to be a completely hypervisor agnostic and architecturally pure layer that is separate from guest type details. The latter seemed a bit overkill in this situation. And I've handled the complexity of having to support Qemu/KVM boot of kernels compiled with or without CONFIG_XEN via a pair of xen specific __weak routines that can be overridden in kernels that support Xen guests. Importantly, the __weak routines are for xen specific code only (not generic "guest type" specific code) so there is no clashing between xen version of the strong routine and, say, a KVM version of the same routine. But I'm sure there are many ways to skin this cat, so I'm open to alternate suggestions if there is a compelling reason for not using __weak in this situation. Changes from v2: * All structures (including memory map table entries) are padded and aligned to an 8 byte boundary. * Removed the "packed" attributes and made changes to comments as suggested by Jan. Changes from v1: * Adopted Paolo's suggestion for defining a v2 PVH ABI that includes the e820 map instead of using the second module entry to pass the table. * Cleaned things up a bit to reduce the number of xen vs non-xen special cases. Maran Wilson (7): xen/pvh: Split CONFIG_XEN_PVH into CONFIG_PVH and CONFIG_XEN_PVH xen/pvh: Move PVH entry code out of Xen specific tree xen/pvh: Create a new file for Xen specific PVH code xen/pvh: Move Xen specific PVH VM initialization out of common file xen/pvh: Move Xen code for getting mem map via hcall out of common file xen/pvh: Add memory map pointer to hvm_start_info struct KVM: x86: Allow Qemu/KVM to use PVH entry point MAINTAINERS | 1 + arch/x86/Kbuild | 2 + arch/x86/Kconfig | 14 +++ arch/x86/kernel/head_64.S | 2 +- arch/x86/platform/pvh/Makefile | 5 + arch/x86/platform/pvh/enlighten.c | 138 ++++++++++++++++++++++++ arch/x86/{xen/xen-pvh.S => platform/pvh/head.S} | 0 arch/x86/xen/Kconfig | 3 +- arch/x86/xen/Makefile | 2 - arch/x86/xen/enlighten_pvh.c | 94 +++------------- include/xen/interface/hvm/start_info.h | 63 ++++++++++- 11 files changed, 242 insertions(+), 82 deletions(-) create mode 100644 arch/x86/platform/pvh/Makefile create mode 100644 arch/x86/platform/pvh/enlighten.c rename arch/x86/{xen/xen-pvh.S => platform/pvh/head.S} (100%) -- 2.16.1