From patchwork Thu Aug 11 21:40:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 12941756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F302C19F2A for ; Thu, 11 Aug 2022 21:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=W2YEVjRGLUIIKV+K4++sa4PjNHH5eaNJzOAU1ccs1ak=; b=yfmKiPQomc3ATp UQkBbepzIZankb1jlSm0tAnaZ6eYe5LUtxrqpmeDZ0IZ0xuf7bOwhD7gPRx7C/LSYtTaTGKTr/cFz bl+0fBqWcxakhO+fbfU92zKt31lAsIBaC6D6Wvf7di/5RJkgOkvi2VCZbt1uFiuAp5sSqPKAP5RGC 7KVlJOHPrG2OmaVtXixngjsJSVYlmbB6kxYwYoV6UlAPZ5znVYbKMoQwDoIGZpBCeAhonN4QAlVe8 BykK6LM98EA6+NkBxEybFYmg7Hr4ztvS7KQxb9sISq3wD8utnVNbiRaT1DGNH6IQQoiHO3rgE1hWG LCLHMnVbaaWjfwBs/ZCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oMG0y-005lru-El; Thu, 11 Aug 2022 21:46:52 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oMG0u-005ln8-Op for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 21:46:50 +0000 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BLQ7X4021003; Thu, 11 Aug 2022 21:46:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=GAGx2hjwCLWMRtKs8YIzaqurDKy+QdsiiskrHs79Ghk=; b=LOldT827pJNx1iovOlc+f15/9HR/4brF9ZTM+UHvHHnugwmGeQPjtLEkjJdTUxszVaxp MErHQB78DQiWTj/vzeYKj5ZbnMrG0/rD+l1zcjLdrVG0sdfwj+NaUwnsAwovimeb7U6h 3Sv425+Gl8iqYN60I0ZsCGwQC43xm2C08uV755nBLrQxDT41THIddlpb4J+w8A6kFDvd 6Fw6XPtQfVev6YhmVYqxEUDn7yMbqpkEQ4k0OI1B/rgYByOXMbroNg+2CWQZVPaUAvqk mEDqASKNzGtenQy8MZbkD3kvlwYwcc0b+BzwuhD/hWjyWpALMMXVSfRAazN5KFmxv2B5 HA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3hw7gw0agh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Aug 2022 21:46:42 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 27BLffii021849 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Aug 2022 21:41:41 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 11 Aug 2022 14:41:40 -0700 From: Elliot Berman To: Bjorn Andersson CC: Elliot Berman , Murali Nalajala , Trilok Soni , "Srivatsa Vaddagiri" , Carl van Schaik , Andy Gross , Dmitry Baryshkov , , "Mark Rutland" , Lorenzo Pieralisi , Sudeep Holla , "Marc Zyngier" , Rob Herring , "Krzysztof Kozlowski" , Jonathan Corbet , Will Deacon , Catalin Marinas , , , Subject: [PATCH v3 00/12] Drivers for gunyah hypervisor Date: Thu, 11 Aug 2022 14:40:55 -0700 Message-ID: <20220811214107.1074343-1-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: j9xArffg2AxKUWJfUG4tA5fNjandNmDK X-Proofpoint-ORIG-GUID: j9xArffg2AxKUWJfUG4tA5fNjandNmDK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_13,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 phishscore=0 mlxlogscore=456 clxscore=1015 suspectscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 bulkscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110065 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220811_144648_842213_1DAD82B4 X-CRM114-Status: GOOD ( 21.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Gunyah is a Type-1 hypervisor independent of any high-level OS kernel, and runs in a higher CPU privilege level. It does not depend on any lower-privileged OS kernel/code for its core functionality. This increases its security and can support a much smaller trusted computing base than a Type-2 hypervisor. Gunyah is an open source hypervisor. The source repo is available at https://github.com/quic/gunyah-hypervisor. The diagram below shows the architecture. :: VM A VM B +-----+ +-----+ | +-----+ +-----+ +-----+ | | | | | | | | | | | EL0 | APP | | APP | | | APP | | APP | | APP | | | | | | | | | | | | +-----+ +-----+ | +-----+ +-----+ +-----+ ---------------------|------------------------- +--------------+ | +----------------------+ | | | | | EL1 | Linux Kernel | | |Linux kernel/Other OS | ... | | | | | +--------------+ | +----------------------+ --------hvc/smc------|------hvc/smc------------ +----------------------------------------+ | | EL2 | Gunyah Hypervisor | | | +----------------------------------------+ Gunyah provides these following features. - Threads and Scheduling: The scheduler schedules virtual CPUs (VCPUs) on physical CPUs and enables time-sharing of the CPUs. - Memory Management: Gunyah tracks memory ownership and use of all memory under its control. Memory partitioning between VMs is a fundamental security feature. - Interrupt Virtualization: All interrupts are handled in the hypervisor and routed to the assigned VM. - Inter-VM Communication: There are several different mechanisms provided for communicating between VMs. - Device Virtualization: Para-virtualization of devices is supported using inter-VM communication. Low level system features and devices such as interrupt controllers are supported with emulation where required. This series adds the basic framework for detecting that Linux is running under Gunyah as a virtual machine, communication with the Gunyah Resource Manager, and a tty driver to demonstrate end-to-end use case of communicating with RM. Presently, the TTY driver is only capable of behaving as a loopback device: data sent to ttyGH0 shows up in ttyGH1 and vice versa. More Gunyah consoles can be exposed as Linux learns about other VMs running in Gunyah. In a future series, I'll introduce a Gunyah VM loader which can load and run VMs. This loader will follow the design philosophy of the /dev/kvm. Changes in v3: - /Maintained/Supported/ in MAINTAINERS - Tidied up documentation throughout based on questions/feedback received - Moved hypercalls into arch/arm64/gunyah/; following hyper-v's implementation - Drop opaque typedefs - Move sysfs nodes under /sys/hypervisor/gunyah/ - Moved Gunyah console driver to drivers/tty/ - Reworked gunyah_device design to drop the Gunyah bus. Changes in v2: https://lore.kernel.org/all/20220801211240.597859-1-quic_eberman@quicinc.com/ - DT bindings clean up - Switch hypercalls to follow SMCCC v1: https://lore.kernel.org/all/20220223233729.1571114-1-quic_eberman@quicinc.com/ Elliot Berman (12): arm64: smccc: Include alternative-macros.h docs: gunyah: Introduce Gunyah Hypervisor dt-bindings: Add binding for gunyah hypervisor gunyah: Common types and error codes for Gunyah hypercalls virt: gunyah: Add hypercalls to identify Gunyah virt: gunyah: Add sysfs nodes gunyah: msgq: Add Gunyah message queues gunyah: sysfs: Add node to describe supported features gunyah: rsc_mgr: Add resource manager RPC core gunyah: rsc_mgr: Add RPC for console services gunyah: rsc_mgr: Add auxiliary devices for console tty: gunyah: Add tty console driver for RM Console Serivces .../ABI/testing/sysfs-hypervisor-gunyah | 38 ++ .../bindings/firmware/gunyah-hypervisor.yaml | 87 +++ Documentation/virt/gunyah/index.rst | 102 +++ Documentation/virt/gunyah/message-queue.rst | 52 ++ Documentation/virt/index.rst | 1 + MAINTAINERS | 14 + arch/arm64/Kbuild | 1 + arch/arm64/gunyah/Makefile | 2 + arch/arm64/gunyah/hypercall.c | 104 +++ drivers/tty/Kconfig | 9 + drivers/tty/Makefile | 1 + drivers/tty/gunyah_tty.c | 410 ++++++++++++ drivers/virt/Kconfig | 2 + drivers/virt/Makefile | 1 + drivers/virt/gunyah/Kconfig | 13 + drivers/virt/gunyah/Makefile | 3 + drivers/virt/gunyah/msgq.c | 192 ++++++ drivers/virt/gunyah/rsc_mgr.c | 630 ++++++++++++++++++ drivers/virt/gunyah/rsc_mgr.h | 56 ++ drivers/virt/gunyah/rsc_mgr_rpc.c | 151 +++++ drivers/virt/gunyah/sysfs.c | 102 +++ include/asm-generic/gunyah.h | 115 ++++ include/linux/arm-smccc.h | 1 + include/linux/gunyah.h | 71 ++ include/linux/gunyah_rsc_mgr.h | 42 ++ 25 files changed, 2200 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-hypervisor-gunyah create mode 100644 Documentation/devicetree/bindings/firmware/gunyah-hypervisor.yaml create mode 100644 Documentation/virt/gunyah/index.rst create mode 100644 Documentation/virt/gunyah/message-queue.rst create mode 100644 arch/arm64/gunyah/Makefile create mode 100644 arch/arm64/gunyah/hypercall.c create mode 100644 drivers/tty/gunyah_tty.c create mode 100644 drivers/virt/gunyah/Kconfig create mode 100644 drivers/virt/gunyah/Makefile create mode 100644 drivers/virt/gunyah/msgq.c create mode 100644 drivers/virt/gunyah/rsc_mgr.c create mode 100644 drivers/virt/gunyah/rsc_mgr.h create mode 100644 drivers/virt/gunyah/rsc_mgr_rpc.c create mode 100644 drivers/virt/gunyah/sysfs.c create mode 100644 include/asm-generic/gunyah.h create mode 100644 include/linux/gunyah.h create mode 100644 include/linux/gunyah_rsc_mgr.h base-commit: 3d7cb6b04c3f3115719235cc6866b10326de34cd