Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1082476rwb; Wed, 28 Sep 2022 12:59:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52YrqQWQoAxg2LtQ9dq8n+FRmqVQpt2/61oyTE1gjmv1b7aHO/zWcKjL04fM4+0iWORxTy X-Received: by 2002:a17:906:8a7b:b0:781:8016:2de1 with SMTP id hy27-20020a1709068a7b00b0078180162de1mr3324018ejc.54.1664395173439; Wed, 28 Sep 2022 12:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664395173; cv=none; d=google.com; s=arc-20160816; b=vnsdY+Ul8YSTkDIiZIhLmpKJhnc1B7YAqOXk28Tdkm/V/jgZ2CLHuLdhjt2kvJHZOi p/SCuk00DW9qmxF7CM4YDAY1itobNxT1P2YbP9DMvCPnflhOSClJghCPwEqx7nwZ30xU 3PgboYZNo9hv01YVAsQ5x7yTO4SjB7jv6SOsrFyoMzPoBlImgQjrjbk10m2LBBOZzQs2 BKZKirlb/pbu1+CgcLL20dEHPkkYUZbsC7pP2g2edZJXa6kHEk6qPuehb5cJFoQnmU0w 306IYBTXWJurSj9nXy2OfoAu5mXWfsMNKb7l2S/+c6/COz83kkUvB8UvgCa6UMnWCCfN AzZw== 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:dkim-signature; bh=8vhQudGFrRY39UIXF4N4Di20jWVDAMeknnK0/ufe2aE=; b=C476YDGmQ8s1dMhLZZD2RxzcFyd9c3ELkotT2o2XzgcVLsY/2u29Z1xgGWZpM2Peai jbd+ZUrUljtstCI76DrrFlcS0S2gwrSf4d/828FKuPtFDLsyOEraPJZvbgpCQCfHGQw1 0LyiEQDRzwz8A3W4gq/ViQtoY5ewqCReX53Cmg+QmAmM3qkhPw+mCxdG0+2T3/MUEpuH htyMahhS6EUwYUEph8KL6ncdH+Mi7ctQ9QEkbGGLsQeLrIQcir31yY+fkEoddmAha2vF GnR8bHqssF8WvGapZkdRB0YSJf9yfq/sDrVdj1I5r0NviGyZCz5EHdIhDKqcCKXAQYyz nagA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GL89XTur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a0564020f0400b00457fc1bcf12si1952297eda.183.2022.09.28.12.59.07; Wed, 28 Sep 2022 12:59:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GL89XTur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234367AbiI1T5K (ORCPT + 99 others); Wed, 28 Sep 2022 15:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbiI1T5H (ORCPT ); Wed, 28 Sep 2022 15:57:07 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45F4152E7F; Wed, 28 Sep 2022 12:57:06 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28SDIBx1021363; Wed, 28 Sep 2022 19:56:47 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=8vhQudGFrRY39UIXF4N4Di20jWVDAMeknnK0/ufe2aE=; b=GL89XTurDoKpVTAZiSTXHb/Fp5FrEXy37MIfpOFHCnY45f00GraSWZuDuAmZKnhkryjW 4KzO5drJVtfc+pWUm3t5x+hESNvpluKsUgjAzYdRemV2FsDcrh+/HiyHQjBiIP/oujnA km1u7gzumjlBEiU8b8zHLir4xWD407PDHXXrQQFzbA3SC7GFsdOBfyl9Nd+zY/d+uXCj k7MR1F/kHU8fUJOOrCRV4pl4eQz18ltWAwjg3MiMF+8aoBFXZdyuoLoT4Didt7IUoxD9 8lgHDF/BQJOMaojSpHWcHaz2aq1s7VyRtm1bn838nHy5IqZc684IucgHFVDwEgrbHv1q Rg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3jvep6ts03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Sep 2022 19:56:46 +0000 Received: from nasanex01b.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 28SJujwC005785 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Sep 2022 19:56:45 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.29; Wed, 28 Sep 2022 12:56:44 -0700 From: Elliot Berman To: Bjorn Andersson CC: Elliot Berman , Murali Nalajala , Trilok Soni , "Srivatsa Vaddagiri" , Carl van Schaik , Andy Gross , Dmitry Baryshkov , Jassi Brar , , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , "Will Deacon" , Catalin Marinas , "Arnd Bergmann" , Greg Kroah-Hartman , , , , Subject: [PATCH v4 00/14] Drivers for gunyah hypervisor Date: Wed, 28 Sep 2022 12:56:19 -0700 Message-ID: <20220928195633.2348848-1-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: pCoIrs2lBDND3z0MlXTWiV2PcZ_Ea1Wg X-Proofpoint-ORIG-GUID: pCoIrs2lBDND3z0MlXTWiV2PcZ_Ea1Wg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-28_09,2022-09-28_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=341 mlxscore=0 spamscore=0 clxscore=1011 impostorscore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209280119 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 v4: - Tidied up documentation throughout based on questions/feedback received - Switched message queue implementation to use mailboxes - Renamed "gunyah_device" as "gunyah_resource" Changes in v3: https://lore.kernel.org/all/20220811214107.1074343-1-quic_eberman@quicinc.com/ - /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 (14): docs: gunyah: Introduce Gunyah Hypervisor dt-bindings: Add binding for gunyah hypervisor gunyah: Common types and error codes for Gunyah hypercalls arm64: smccc: Include alternative-macros.h virt: gunyah: Add hypercalls to identify Gunyah virt: gunyah: Add sysfs nodes mailbox: Allow direct registration to a channel virt: gunyah: msgq: Add hypercalls to send and receive messages mailbox: Add Gunyah message queue mailbox 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 Services .../ABI/testing/sysfs-hypervisor-gunyah | 30 + .../bindings/firmware/gunyah-hypervisor.yaml | 87 +++ Documentation/virt/gunyah/index.rst | 114 ++++ Documentation/virt/gunyah/message-queue.rst | 52 ++ Documentation/virt/index.rst | 1 + MAINTAINERS | 15 + arch/arm64/Kbuild | 1 + arch/arm64/gunyah/Makefile | 2 + arch/arm64/gunyah/hypercall.c | 104 +++ drivers/mailbox/Kconfig | 10 + drivers/mailbox/Makefile | 2 + drivers/mailbox/gunyah-msgq.c | 232 +++++++ drivers/mailbox/mailbox.c | 96 ++- drivers/tty/Kconfig | 8 + drivers/tty/Makefile | 1 + drivers/tty/gunyah_tty.c | 409 ++++++++++++ drivers/virt/Kconfig | 2 + drivers/virt/Makefile | 1 + drivers/virt/gunyah/Kconfig | 30 + drivers/virt/gunyah/Makefile | 5 + drivers/virt/gunyah/rsc_mgr.c | 629 ++++++++++++++++++ drivers/virt/gunyah/rsc_mgr.h | 56 ++ drivers/virt/gunyah/rsc_mgr_rpc.c | 151 +++++ drivers/virt/gunyah/sysfs.c | 86 +++ include/asm-generic/gunyah.h | 115 ++++ include/linux/arm-smccc.h | 1 + include/linux/gunyah.h | 67 ++ include/linux/gunyah_rsc_mgr.h | 42 ++ include/linux/mailbox_client.h | 1 + 29 files changed, 2322 insertions(+), 28 deletions(-) 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/mailbox/gunyah-msgq.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/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: f76349cf41451c5c42a99f18a9163377e4b364ff -- 2.25.1