Received: by 10.223.185.116 with SMTP id b49csp6506901wrg; Wed, 28 Feb 2018 10:32:15 -0800 (PST) X-Google-Smtp-Source: AH8x226OZyZiGriRZDPwvR94CcbdSJ6m6Ab/zs1O4oNgLpuMB79IHwe+yE0Kl/m9d5+6q9BZp7X1 X-Received: by 10.99.174.5 with SMTP id q5mr14974707pgf.170.1519842735698; Wed, 28 Feb 2018 10:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519842735; cv=none; d=google.com; s=arc-20160816; b=NdnC32T2GQI6ckZREWXhoGGm1Nqjze6Bz/XR1fqGsOI2UN07Ugx86pTKceda6zOY0M pI4K/ZaKvsdwAP3dbdVaeL9N39FJdXSuEaSY8Ngps1mIYj+8Ap8NjudI+utLKVmN/dVx 7Ey3QhF95njFviUaouuvVsb5lvQp8jKcBtof3nswjF/Uy05hicE3aPlWvrQGh9VNmWCF f1ubLHsIa8cI1aym3emXJ1eEQkmdc8nIPuE1d9IdvJ4FCYfz8fY4Wyh7sTaF2f5Hi63a EX6XviX19mgcwz9TRr+4lLFcCqrRigrTvvO4vodq3xrcBk17aEKkV/kb3rLpXQsifxu0 kpOA== 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=7moUHX3J4/0L6dZCoDIUvLelICVhrrepZgKgsg62xQM=; b=cOQj4OjBVNZ6QuCtdons0AUFKH6xz4yuzSsVxHrRxlsLc+FOWBIEASMJBRfowj4/R1 ixjZZJu6R9pgxBWYBA2yy8T4yCmf3kkxbTlu6PbLinIo528O2B6N8aiC1JOSzomXFL1y mq4r11vYau12yrigUCt1eT1cJiNMVZ0YaXisGe9NXHI0AQPCIrxDhAuUawlcJ/Eo1HB7 9eEeephB2q52geWYobTq45nKXxzKFUK9mm9Is0r3a7RHDH73K3gN6K7MDoU3lpP64uN+ NRO5QofRCQPdar24YwS4kf1F0mIYMM1Ys+t3+32KhHjCn7loe3rF8cW6llTCcmzL+Mad xZ9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=RisWyX2n; 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 a16si1326088pgw.58.2018.02.28.10.32.00; Wed, 28 Feb 2018 10:32:15 -0800 (PST) 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=RisWyX2n; 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 S933036AbeB1Saz (ORCPT + 99 others); Wed, 28 Feb 2018 13:30:55 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:56548 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932374AbeB1S33 (ORCPT ); Wed, 28 Feb 2018 13:29:29 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1SIQjXT030924; Wed, 28 Feb 2018 18:28:44 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=7moUHX3J4/0L6dZCoDIUvLelICVhrrepZgKgsg62xQM=; b=RisWyX2niryRIefecfHdsKWnyftQjJnbPa9z3SlJjxiHr0aPbtSgOojrIr6Bj1NCCz3K YFKrZrjpxNv7Q9xLFHoy2B2zAGT9wT1QLOMucB/h7fMkAyke8QBxqxSBGXNeZtcI5QXo xeZJCZfu6UQ/TeIJn4SfVCYZYqV6HeTX4S0t6agjBaYTb3CWMzS1MYYfrMWU0MkDU1vg i+GH1dV3b2SZ7aiY0N3YPONSYebRmaU9VTSHK6sI5p685qm245SCLXNNk+mhv+hc7BkC VvAp7v1qOr9L4Y9h4jO+X7IYnlkY6IjjmMxGyNJPyARrRyChaMhGIFJDcnmzFKYTzGgM 0g== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2gdygbrvux-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Feb 2018 18:28:44 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1SIShSv030457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Feb 2018 18:28:43 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1SISfTx020645; Wed, 28 Feb 2018 18:28:41 GMT Received: from marawils-linux.us.oracle.com (/10.141.197.9) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Feb 2018 10:28:40 -0800 From: Maran Wilson To: pbonzini@redhat.com, jgross@suse.com, boris.ostrovsky@oracle.com, roger.pau@citrix.com, andrew.cooper3@citrix.com, hch@infradead.org, JBeulich@suse.com, x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, rkrcmar@redhat.com, jpoimboe@redhat.com, bp@suse.de, kirill.shutemov@linux.intel.com, thomas.lendacky@amd.com, luto@kernel.org, maran.wilson@oracle.com, dave.hansen@linux.intel.com, davem@davemloft.net, gregkh@linuxfoundation.org, mchehab@kernel.org, linus.walleij@linaro.org, rdunlap@infradead.org Subject: [RFC PATCH v4 0/7] KVM: x86: Allow Qemu/KVM to use PVH entry point Date: Wed, 28 Feb 2018 10:27:56 -0800 Message-Id: <1519842483-8887-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=8818 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 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-1802280224 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for the delay between this version and the last -- it was mostly due to holidays and everyone being focused on security bug mitigation issues. Here are the links to the previous email threads in case it is helpful: V3: https://lkml.org/lkml/2017/12/12/1230 V2: https://lkml.org/lkml/2017/12/7/1624 V1: https://lkml.org/lkml/2017/11/28/1280 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 code 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 | 3 + arch/x86/Kconfig | 8 ++ arch/x86/kernel/head_64.S | 4 +- arch/x86/pvh-head.S | 161 +++++++++++++++++++++++ arch/x86/pvh.c | 130 ++++++++++++++++++ arch/x86/xen/Kconfig | 3 +- arch/x86/xen/Makefile | 1 - arch/x86/xen/enlighten_pvh.c | 87 +++--------- arch/x86/xen/xen-pvh.S | 161 ----------------------- include/xen/interface/hvm/start_info.h | 50 ++++++- 11 files changed, 374 insertions(+), 235 deletions(-)