Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2066748rwb; Thu, 27 Jul 2023 01:13:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlFIqOWjRhH81yB96s3gb35Rt9vGFSrckEtSH2rSSQo9H3paUUFrvnomuV0x+waJHuGRmFtS X-Received: by 2002:a17:907:7636:b0:99b:6c47:1148 with SMTP id jy22-20020a170907763600b0099b6c471148mr1380673ejc.3.1690445584603; Thu, 27 Jul 2023 01:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690445584; cv=none; d=google.com; s=arc-20160816; b=US5TLMcarIRBTZ0T7WJIY06d/YfjNaTsjiznWD0eCB0OXx0naHC3U5wHJG13Lbek1R ccgitJtHqVNyQm5vzs32qgQWvOANoJc+R26/vF8rgIlvndkfRIHlNiN3OwaFUv4A2wIG PlxClszeQxqdgL+DpMNGOo586QcvbUIyTO/0JC4iOu3ajljSvGAr7d7nOHmY2vsfPeSj YclAlM+NXEGhAeSYAx9SVyRcFBvgYpQrvsjkBmYr19o4D1uJTOjZJp5GFLBz+fiQtVc3 OrLQ7S6AO7x1Prgo/nkU4KMZyTZ6F82i+RWpSQ7RqoGre8aLNtRYrIhqTp6nLxNETZez W78g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=Y4n8t1Ul6raki3wGqp4WxQ/P4t3Z1OnlzIRPpQbFpSQ=; fh=dCuhN2WtZzy0rUQ+AeVVI4jzQHHl1RvTejWe4+0kZAs=; b=xLQo2w/CgMvWQCO79rgdFhau1YodCmFAC5ahYCYlcUyrHQfIUIZgjX0s3Sj3M0k0FO lJQoOlgKrYZdWwWo5mNHCCiJCIsLuCeXvmlJHHR23Utf2HitiwQMDmxWMRmG9/BQRx3e sGvO41OHPJGD3Sd33qL0gkga7r4gmOmiCufWEIHT+zud2LCIHhVvJGrTMoGYfyDiurOk VrEQKtq2K7Yao5E0d5nwUGcXxUAzC/OjUJbTzprMK1yR098XeNgCheGCMMgug5FP/FYQ EiRMRUH2Elhi+tct7AbfTqG8rrngIgYt3vOZk0/2cmoyfsgPk7MS/jTCTtoLqNPK+GeZ YAGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=eLZJIWRj; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y25-20020a170906915900b0099bc9dfa042si573023ejw.470.2023.07.27.01.12.40; Thu, 27 Jul 2023 01:13:04 -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=@mediatek.com header.s=dk header.b=eLZJIWRj; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233004AbjG0IEI (ORCPT + 99 others); Thu, 27 Jul 2023 04:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233703AbjG0ICs (ORCPT ); Thu, 27 Jul 2023 04:02:48 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34F6926B8; Thu, 27 Jul 2023 01:00:20 -0700 (PDT) X-UUID: 9e43e6fe2c5311eeb20a276fd37b9834-20230727 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=Y4n8t1Ul6raki3wGqp4WxQ/P4t3Z1OnlzIRPpQbFpSQ=; b=eLZJIWRjkxv53fJA0YWfuhoQ4U4unYgc2eI3ZegFQLRw+7TqBG9LKaotUBivGyOI7ZtKHTFxnVTEUUo2huTJV304IRVDZ/ECDRlHdlyE5lXiAwZw5pz0vwPN2ZnKCCC7LrXTKfhqg1SQWGYNEWYn8j8uPbeqQHi/h8/XeOTnPEU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.29,REQID:98f2062b-5c9d-4999-b6ed-dc9d46aff4b2,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.29,REQID:98f2062b-5c9d-4999-b6ed-dc9d46aff4b2,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:e7562a7,CLOUDID:21a862d2-cd77-4e67-bbfd-aa4eaace762f,B ulkID:230727160015EF3YPKQL,BulkQuantity:1,Recheck:0,SF:48|38|29|28|17|19,T C:nil,Content:0,EDM:-3,IP:nil,URL:1,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_ULS,TF_CID_SPAM_SNR, TF_CID_SPAM_SDM,TF_CID_SPAM_ASC X-UUID: 9e43e6fe2c5311eeb20a276fd37b9834-20230727 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1657441654; Thu, 27 Jul 2023 16:00:14 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 27 Jul 2023 16:00:13 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 27 Jul 2023 16:00:13 +0800 From: Yi-De Wu To: Yingshiuan Pan , Ze-Yu Wang , Yi-De Wu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Catalin Marinas , Will Deacon , Arnd Bergmann , "Matthias Brugger" , AngeloGioacchino Del Regno CC: , , , , , , "David Bradil" , Trilok Soni , "Ivan Tseng" , Jade Shih , "My Chuang" , Shawn Hsiao , PeiLun Suei , Liju Chen , Willix Yeh Subject: [PATCH v5 00/12] GenieZone hypervisor drivers Date: Thu, 27 Jul 2023 15:59:53 +0800 Message-ID: <20230727080005.14474-1-yi-de.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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 This series is based on linux-next, tag: next-20230726. GenieZone hypervisor(gzvm) is a type-1 hypervisor that supports various virtual machine types and provides security features such as TEE-like scenarios and secure boot. It can create guest VMs for security use cases and has virtualization capabilities for both platform and interrupt. Although the hypervisor can be booted independently, it requires the assistance of GenieZone hypervisor kernel driver(gzvm-ko) to leverage the ability of Linux kernel for vCPU scheduling, memory management, inter-VM communication and virtio backend support. Changes in v5: - Add dt solution back for device initialization - Add GZVM_EXIT_GZ reason for gzvm_vcpu_run() - Add patch for guest page fault handler - Add patch for supporitng pin/unpin memory - Remove unused enum members, namely GZVM_FUNC_GET_REGS and GZVM_FUNC_SET_REGS - Use dev_debug() for debugging when platform device is available, and use pr_debug() otherwise - Response to reviewers and fix bugs accordingly Changes in v4: https://lore.kernel.org/lkml/20230609085214.31071-1-yi-de.wu@mediatek.com/ - Add macro to set VM as protected without triggering pvmfw in AVF. - Add support to pass dtb config to hypervisor. - Add support for virtual timer. - Add UAPI to pass memory region metadata to hypervisor. - Define our own macros for ARM's interrupt number - Elaborate more on GenieZone hyperivsor in documentation - Fix coding style. - Implement our own module for coverting ipa to pa - Modify the way of initializing device from dt to a more discoverable way - Move refactoring changes into indepedent patches. Changes in v3: https://lore.kernel.org/all/20230512080405.12043-1-yi-de.wu@mediatek.com/ - Refactor: separate arch/arm64/geniezone/gzvm_arch.c into vm.c/vcpu.c/vgic.c - Remove redundant functions - Fix reviewer's comments Changes in v2: https://lore.kernel.org/all/20230428103622.18291-1-yi-de.wu@mediatek.com/ - Refactor: move to drivers/virt/geniezone - Refactor: decouple arch-dependent and arch-independent - Check pending signal before entering guest context - Fix reviewer's comments Initial Commit in v1: https://lore.kernel.org/all/20230413090735.4182-1-yi-de.wu@mediatek.com/ Yi-De Wu (12): docs: geniezone: Introduce GenieZone hypervisor dt-bindings: hypervisor: Add MediaTek GenieZone hypervisor virt: geniezone: Add GenieZone hypervisor support virt: geniezone: Add vcpu support virt: geniezone: Add irqchip support for virtual interrupt injection virt: geniezone: Add irqfd support virt: geniezone: Add ioeventfd support virt: geniezone: Add memory region support virt: geniezone: Add dtb config support virt: geniezone: Add virtual timer support virt: geniezone: Add guest page fault handler virt: geniezone: Add memory pin/unpin support .../hypervisor/mediatek,geniezone-hyp.yaml | 31 + Documentation/virt/geniezone/introduction.rst | 86 +++ Documentation/virt/index.rst | 1 + MAINTAINERS | 13 + arch/arm64/Kbuild | 1 + arch/arm64/geniezone/Makefile | 9 + arch/arm64/geniezone/driver.c | 26 + arch/arm64/geniezone/gzvm_arch_common.h | 130 ++++ arch/arm64/geniezone/vcpu.c | 155 +++++ arch/arm64/geniezone/vgic.c | 124 ++++ arch/arm64/geniezone/vm.c | 251 ++++++++ arch/arm64/include/uapi/asm/gzvm_arch.h | 58 ++ drivers/virt/Kconfig | 2 + drivers/virt/geniezone/Kconfig | 16 + drivers/virt/geniezone/Makefile | 12 + drivers/virt/geniezone/gzvm_common.h | 12 + drivers/virt/geniezone/gzvm_exception.c | 34 ++ drivers/virt/geniezone/gzvm_hvc.c | 34 ++ drivers/virt/geniezone/gzvm_ioeventfd.c | 273 +++++++++ drivers/virt/geniezone/gzvm_irqfd.c | 566 ++++++++++++++++++ drivers/virt/geniezone/gzvm_main.c | 154 +++++ drivers/virt/geniezone/gzvm_mmu.c | 210 +++++++ drivers/virt/geniezone/gzvm_vcpu.c | 280 +++++++++ drivers/virt/geniezone/gzvm_vm.c | 488 +++++++++++++++ include/linux/gzvm_drv.h | 185 ++++++ include/uapi/asm-generic/Kbuild | 1 + include/uapi/asm-generic/gzvm_arch.h | 13 + include/uapi/linux/gzvm.h | 362 +++++++++++ 28 files changed, 3527 insertions(+) create mode 100644 Documentation/devicetree/bindings/hypervisor/mediatek,geniezone-hyp.yaml create mode 100644 Documentation/virt/geniezone/introduction.rst create mode 100644 arch/arm64/geniezone/Makefile create mode 100644 arch/arm64/geniezone/driver.c create mode 100644 arch/arm64/geniezone/gzvm_arch_common.h create mode 100644 arch/arm64/geniezone/vcpu.c create mode 100644 arch/arm64/geniezone/vgic.c create mode 100644 arch/arm64/geniezone/vm.c create mode 100644 arch/arm64/include/uapi/asm/gzvm_arch.h create mode 100644 drivers/virt/geniezone/Kconfig create mode 100644 drivers/virt/geniezone/Makefile create mode 100644 drivers/virt/geniezone/gzvm_common.h create mode 100644 drivers/virt/geniezone/gzvm_exception.c create mode 100644 drivers/virt/geniezone/gzvm_hvc.c create mode 100644 drivers/virt/geniezone/gzvm_ioeventfd.c create mode 100644 drivers/virt/geniezone/gzvm_irqfd.c create mode 100644 drivers/virt/geniezone/gzvm_main.c create mode 100644 drivers/virt/geniezone/gzvm_mmu.c create mode 100644 drivers/virt/geniezone/gzvm_vcpu.c create mode 100644 drivers/virt/geniezone/gzvm_vm.c create mode 100644 include/linux/gzvm_drv.h create mode 100644 include/uapi/asm-generic/gzvm_arch.h create mode 100644 include/uapi/linux/gzvm.h -- 2.18.0