Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3864823pxk; Tue, 22 Sep 2020 04:50:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYGOakDmVk5YAAgx5dVVSjj7iJNew6/m3kI8Adrb64L3XXPwnfDYqJBcx4UZvODnmjFj9/ X-Received: by 2002:a17:906:1b58:: with SMTP id p24mr4716565ejg.77.1600775438287; Tue, 22 Sep 2020 04:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600775438; cv=none; d=google.com; s=arc-20160816; b=lX68fMpQGu5EsAUqzj0VUwvTfqf9c7cndAR/sQeZYNkASgHfy0urQxbw8L6pE/eW6U dN4iviIHsQZzbXQ3BACCei2t0BEDSjvv2+tH245vn/2pi+72U+krz5ABJEpzioalskBh 13i+jsVK3HpFUOuzAKhglc+k+qIZnySMtFsCIHD/Vji9w+7iEitH/zby0Wph8BxHxlob oI+7OCI9jte+LKLFT1p1CTKRK9+wjWgkuJ5r9vElhInoFui0THdK0qCArx2TCnUbJ2aI Btd7QCLEFItfrRMcRN0pTJQHYvf3HaKiFGslGeR0g+LT2I7QAfQjotICv3KOmb+uR2u/ i0gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=Q2vRY9eCP55j8S3Ykjl/xatluYtEooNblUunmEGJgoU=; b=OqLww6asdZbbEv6cJh32p5u5m+m2OFPgMXzmPXrTTcFPLVoastkRPjA0QkAzTpKWAi SERZdfL8e7PFitmYX+nfV6o3Ky37i7qiX3AB4jSc14V5ZMz6SFxXfafaKIkWOtBX7dJR IGqnSAQsClheuq4ytBRb5ycp+fWL97G/uoffIaiaJyiLC4XHW+9Inx4/9jOY4d82QCBE gtCGfcRiwYadFwJ0LYXHJ55byotuVy5T9HfzCrUAj43eln++g0deZTsLEHnx6m6u/w+m UC5kaHJ7//anx+P5qWX+6Cq6BgxOLpSIaf9fnWmNORmLoSmPtbXvz0BOA0PyyGpZQxs0 jaAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qq22si10227624ejb.281.2020.09.22.04.50.14; Tue, 22 Sep 2020 04:50:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726906AbgIVLsc (ORCPT + 99 others); Tue, 22 Sep 2020 07:48:32 -0400 Received: from mga06.intel.com ([134.134.136.31]:59809 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726645AbgIVLnn (ORCPT ); Tue, 22 Sep 2020 07:43:43 -0400 IronPort-SDR: nvo4gbECrW6KHJLrSfHYAfQ2wllyiKB/6prsIOJoHwC3fNrFireXqp6SLlPrY5wBD2vtNvXP1O QJtV4MS5ON6A== X-IronPort-AV: E=McAfee;i="6000,8403,9751"; a="222176855" X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="222176855" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 04:43:28 -0700 IronPort-SDR: eIP0bj9an+SeCJ/SOEAyFKCXJP+ukzPqzUgECcHvkJgo1xY2NZf1ea18WvZ4sTqDG65mp1HL2Z fkdnvjk8n0Mw== X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="485922067" Received: from shsi6026.sh.intel.com (HELO localhost) ([10.239.147.135]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 04:43:24 -0700 From: shuo.a.liu@intel.com To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Greg Kroah-Hartman , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Sean Christopherson , Yu Wang , Reinette Chatre , Shuo Liu Subject: [PATCH v4 00/17] HSM driver for ACRN hypervisor Date: Tue, 22 Sep 2020 19:42:54 +0800 Message-Id: <20200922114311.38804-1-shuo.a.liu@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shuo Liu ACRN is a Type 1 reference hypervisor stack, running directly on the bare-metal hardware, and is suitable for a variety of IoT and embedded device solutions. ACRN implements a hybrid VMM architecture, using a privileged Service VM. The Service VM manages the system resources (CPU, memory, etc.) and I/O devices of User VMs. Multiple User VMs are supported, with each of them running Linux, Android OS or Windows. Both Service VM and User VMs are guest VM. Below figure shows the architecture. Service VM User VM +----------------------------+ | +------------------+ | +--------------+ | | | | | |ACRN userspace| | | | | | +--------------+ | | | | |-----------------ioctl------| | | | ... |kernel space +----------+ | | | | | | HSM | | | | Drivers | | +----------+ | | | | +--------------------|-------+ | +------------------+ +---------------------hypercall----------------------------------------+ | ACRN Hypervisor | +----------------------------------------------------------------------+ | Hardware | +----------------------------------------------------------------------+ There is only one Service VM which could run Linux as OS. In a typical case, the Service VM will be auto started when ACRN Hypervisor is booted. Then the ACRN userspace (an application running in Service VM) could be used to start/stop User VMs by communicating with ACRN Hypervisor Service Module (HSM). ACRN Hypervisor Service Module (HSM) is a middle layer that allows the ACRN userspace and Service VM OS kernel to communicate with ACRN Hypervisor and manage different User VMs. This middle layer provides the following functionalities, - Issues hypercalls to the hypervisor to manage User VMs: * VM/vCPU management * Memory management * Device passthrough * Interrupts injection - I/O requests handling from User VMs. - Exports ioctl through HSM char device. - Exports function calls for other kernel modules ACRN is focused on embedded system. So it doesn't support some features. E.g., - ACRN doesn't support VM migration. - ACRN doesn't support vCPU migration. This patch set adds the HSM to the Linux kernel. The basic ARCN support was merged to upstream already. https://lore.kernel.org/lkml/1559108037-18813-3-git-send-email-yakui.zhao@intel.com/ ChangeLog: v4: - Used acrn_dev.this_device directly for dev_*() (Reinette) - Removed the odd usage of {get|put}_device() on &acrn_dev->this_device (Greg) - Removed unused log code. (Greg) - Corrected the return error values. (Greg) - Mentioned that HSM relies hypervisor for sanity check in acrn_dev_ioctl() comments (Greg) v3: - Used {get|put}_device() helpers on &acrn_dev->this_device - Moved unused code from front patches to later ones. - Removed self-defined pr_fmt() and dev_fmt() - Provided comments for acrn_vm_list_lock. v2: - Removed API version related code. (Dave) - Replaced pr_*() by dev_*(). (Greg) - Used -ENOTTY as the error code of unsupported ioctl. (Greg) Shuo Liu (16): docs: acrn: Introduce ACRN x86/acrn: Introduce acrn_{setup, remove}_intr_handler() x86/acrn: Introduce hypercall interfaces virt: acrn: Introduce ACRN HSM basic driver virt: acrn: Introduce VM management interfaces virt: acrn: Introduce an ioctl to set vCPU registers state virt: acrn: Introduce EPT mapping management virt: acrn: Introduce I/O request management virt: acrn: Introduce PCI configuration space PIO accesses combiner virt: acrn: Introduce interfaces for PCI device passthrough virt: acrn: Introduce interrupt injection interfaces virt: acrn: Introduce interfaces to query C-states and P-states allowed by hypervisor virt: acrn: Introduce I/O ranges operation interfaces virt: acrn: Introduce ioeventfd virt: acrn: Introduce irqfd virt: acrn: Introduce an interface for Service VM to control vCPU Yin Fengwei (1): x86/acrn: Introduce an API to check if a VM is privileged .../userspace-api/ioctl/ioctl-number.rst | 1 + Documentation/virt/acrn/index.rst | 11 + Documentation/virt/acrn/introduction.rst | 40 ++ Documentation/virt/acrn/io-request.rst | 97 +++ Documentation/virt/index.rst | 1 + MAINTAINERS | 9 + arch/x86/include/asm/acrn.h | 74 ++ arch/x86/kernel/cpu/acrn.c | 35 +- drivers/virt/Kconfig | 2 + drivers/virt/Makefile | 1 + drivers/virt/acrn/Kconfig | 15 + drivers/virt/acrn/Makefile | 3 + drivers/virt/acrn/acrn_drv.h | 229 +++++++ drivers/virt/acrn/hsm.c | 437 ++++++++++++ drivers/virt/acrn/hypercall.h | 254 +++++++ drivers/virt/acrn/ioeventfd.c | 273 ++++++++ drivers/virt/acrn/ioreq.c | 645 ++++++++++++++++++ drivers/virt/acrn/irqfd.c | 235 +++++++ drivers/virt/acrn/mm.c | 305 +++++++++ drivers/virt/acrn/vm.c | 126 ++++ include/uapi/linux/acrn.h | 486 +++++++++++++ 21 files changed, 3278 insertions(+), 1 deletion(-) create mode 100644 Documentation/virt/acrn/index.rst create mode 100644 Documentation/virt/acrn/introduction.rst create mode 100644 Documentation/virt/acrn/io-request.rst create mode 100644 arch/x86/include/asm/acrn.h create mode 100644 drivers/virt/acrn/Kconfig create mode 100644 drivers/virt/acrn/Makefile create mode 100644 drivers/virt/acrn/acrn_drv.h create mode 100644 drivers/virt/acrn/hsm.c create mode 100644 drivers/virt/acrn/hypercall.h create mode 100644 drivers/virt/acrn/ioeventfd.c create mode 100644 drivers/virt/acrn/ioreq.c create mode 100644 drivers/virt/acrn/irqfd.c create mode 100644 drivers/virt/acrn/mm.c create mode 100644 drivers/virt/acrn/vm.c create mode 100644 include/uapi/linux/acrn.h base-commit: 18445bf405cb331117bc98427b1ba6f12418ad17 -- 2.28.0