From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC230C47253 for ; Thu, 30 Apr 2020 14:48:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C57CD2070B for ; Thu, 30 Apr 2020 14:48:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="G5oxdiVz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726737AbgD3Osp (ORCPT ); Thu, 30 Apr 2020 10:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726130AbgD3Oso (ORCPT ); Thu, 30 Apr 2020 10:48:44 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A213C035494 for ; Thu, 30 Apr 2020 07:48:44 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id h4so2185839wmb.4 for ; Thu, 30 Apr 2020 07:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SNF6UHAWqMkyYuIU0QRud/LtidR5txVpCjgq6hRS/rs=; b=G5oxdiVzQ6WQl8M6UOHfwP4pdHBU+qv5OHGvlNbCBI0z9EBiG+qssCu1yXAnrFN8gv lfko0Ni7uJjsvIxBetErtcwMm+mV2hclOUvBYr+lHY8ApffvotwdYZ9dxALl9nv92YtG ROYpq0EMuXYqoMaD8whW/Fjg8RSl+BhJYFo1rMpfzXKwF1hZRGTBo0M+YcbGHkp6zzbT G1k70B02KruRIlOfpfIyHn1hA+13411yMCiF3hwc3ZYt+xhsDWBoy8vjYIfZ/Y6/KMcN AzA0R3zvornaAnFTrqqiD/YsU76Cz4LdR6w7VuvVnoVzWhYndo+J2qimTWachzUtMCKQ 5PtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SNF6UHAWqMkyYuIU0QRud/LtidR5txVpCjgq6hRS/rs=; b=NWA2YUev0hEo4drXlgzh4HVNNG2X72bJt7UumuiI7/qZ1FXHML/Bl4HoFaGgLve3NO iyaTiHTmlikPKbl4dJRolLk1DnletI+Zc8HQicXepK9TjKTK4+Z5DHkeEGTGh8Rf1VU8 mNFzp+VhOxSwy+rbKeA6/yAtZCpIY9ltkW4p0Gcd6379mMBxeH0uZmb46zq0Fmpj7i/n VJSLgr8Zbz6AqF/4vehriVvNrDHz6ih1oP6hg5qwAl2pdRiXjzENRHgTgqioqdvbbtRc 4159hcmXmoOqwP7R1YXKyPKEaiPigbWJx5FtmutWEFprP7qbzrMwACM8bBajkMcYs2fC hgQw== X-Gm-Message-State: AGi0PuYdrzlEuwI1AGi2rw1rot3WPOMEOcnqOc27STRpB7pdTt0VjMyf NpR0c7HsNgbKsBsLuoNamcb70A== X-Google-Smtp-Source: APiQypKNM79/w8ZSyytfmzDWXe1CAhLCYA5tA2YOUJb4Z3naBNIFJxsLCPvYaCkYw96MVWpA4gCx5w== X-Received: by 2002:a05:600c:21ca:: with SMTP id x10mr3222316wmj.113.1588258122596; Thu, 30 Apr 2020 07:48:42 -0700 (PDT) Received: from localhost ([2a01:4b00:8523:2d03:d4b6:9828:8bd2:ce6f]) by smtp.gmail.com with ESMTPSA id s8sm4287714wru.38.2020.04.30.07.48.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2020 07:48:41 -0700 (PDT) From: David Brazdil To: Catalin Marinas , James Morse , Julien Thierry , Marc Zyngier , Suzuki K Poulose , Will Deacon Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, David Brazdil Subject: [PATCH 00/15] Split off nVHE hyp code Date: Thu, 30 Apr 2020 15:48:16 +0100 Message-Id: <20200430144831.59194-1-dbrazdil@google.com> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Refactor files in arch/arm64/kvm/hyp to compile all code which runs in EL2 under nVHE into separate object files from the rest of KVM. This is done in preparation for being able to unmap .hyp.text from EL1 but has other benefits, notably: * safe use of KASAN/UBSAN/GCOV instrumentation on VHE code, * cleaner HVC API, * no need for __hyp_text annotations. nVHE-specific code is moved to hyp/nvhe and compiled with custom build rules similar to those used by EFI stub. Shared source files are compiled under both VHE and nVHE build rules. Where a source file contained both VHE and nVHE code, it is split into a shared header file and two C source files. This is done one file per commit to make review easier. All nVHE symbols are prefixed with "__hyp_text_" to avoid collisions with VHE variants (also inspired by EFI stub). Since this prefixes unresolved symbols too, image-vars.h contains a list of kernel symbol aliases where nVHE code still refers to kernel proper. This list will be further reduced in the future. No functional changes are intended but code was simplified whenever the refactoring made it possible. Tested by running kvm-unit-tests on QEMU 5.0 with VHE/nVHE and GIC v2/v3. This is based off Fuad Tabba's patch series "KVM: arm64: Tidy up arch Kconfig and Makefiles". Available in branch 'topic/el2-obj' of git repo: https://android-kvm.googlesource.com/linux -David David Brazdil (13): arm64: kvm: Fix symbol dependency in __hyp_call_panic_nvhe arm64: kvm: Add build rules for separate nVHE object files arm64: kvm: Build hyp-entry.S separately for VHE/nVHE arm64: kvm: Move __smccc_workaround_1_smc to .rodata arm64: kvm: Split hyp/tlb.c to VHE/nVHE arm64: kvm: Split hyp/switch.c to VHE/nVHE arm64: kvm: Split hyp/debug-sr.c to VHE/nVHE arm64: kvm: Split hyp/sysreg-sr.c to VHE/nVHE arm64: kvm: Split hyp/timer-sr.c to VHE/nVHE arm64: kvm: Compile remaining hyp/ files for both VHE/nVHE arm64: kvm: Add comments around __hyp_text_ symbol aliases arm64: kvm: Remove __hyp_text macro, use build rules instead arm64: kvm: Lift instrumentation restrictions on VHE Quentin Perret (2): arm64: kvm: Unify users of HVC instruction arm64: kvm: Formalize host-hyp hypcall ABI arch/arm64/include/asm/kvm_asm.h | 26 +- arch/arm64/include/asm/kvm_emulate.h | 2 +- arch/arm64/include/asm/kvm_host.h | 32 +- arch/arm64/include/asm/kvm_host_hypercalls.h | 62 ++ arch/arm64/include/asm/kvm_hyp.h | 15 +- arch/arm64/include/asm/kvm_mmu.h | 13 +- arch/arm64/include/asm/mmu.h | 7 - arch/arm64/include/asm/virt.h | 33 +- arch/arm64/kernel/cpu_errata.c | 2 +- arch/arm64/kernel/hyp-stub.S | 34 - arch/arm64/kernel/image-vars.h | 44 ++ arch/arm64/kvm/arm.c | 6 +- arch/arm64/kvm/hyp.S | 13 +- arch/arm64/kvm/hyp/Makefile | 12 +- arch/arm64/kvm/hyp/aarch32.c | 6 +- arch/arm64/kvm/hyp/debug-sr.c | 214 +----- arch/arm64/kvm/hyp/debug-sr.h | 165 +++++ arch/arm64/kvm/hyp/entry.S | 1 - arch/arm64/kvm/hyp/fpsimd.S | 1 - arch/arm64/kvm/hyp/hyp-entry.S | 62 +- arch/arm64/kvm/hyp/nvhe/Makefile | 42 ++ arch/arm64/kvm/hyp/nvhe/debug-sr.c | 77 +++ arch/arm64/kvm/hyp/nvhe/host_hypercall.c | 22 + arch/arm64/kvm/hyp/nvhe/switch.c | 271 ++++++++ arch/arm64/kvm/hyp/nvhe/sysreg-sr.c | 56 ++ arch/arm64/kvm/hyp/nvhe/timer-sr.c | 43 ++ arch/arm64/kvm/hyp/nvhe/tlb.c | 67 ++ arch/arm64/kvm/hyp/switch.c | 688 +------------------ arch/arm64/kvm/hyp/switch.h | 438 ++++++++++++ arch/arm64/kvm/hyp/sysreg-sr.c | 227 +----- arch/arm64/kvm/hyp/sysreg-sr.h | 211 ++++++ arch/arm64/kvm/hyp/timer-sr.c | 38 +- arch/arm64/kvm/hyp/tlb.c | 168 +---- arch/arm64/kvm/hyp/tlb.h | 126 ++++ arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 4 +- arch/arm64/kvm/hyp/vgic-v3-sr.c | 130 ++-- arch/arm64/kvm/va_layout.c | 2 +- scripts/kallsyms.c | 1 + 38 files changed, 1887 insertions(+), 1474 deletions(-) create mode 100644 arch/arm64/include/asm/kvm_host_hypercalls.h create mode 100644 arch/arm64/kvm/hyp/debug-sr.h create mode 100644 arch/arm64/kvm/hyp/nvhe/Makefile create mode 100644 arch/arm64/kvm/hyp/nvhe/debug-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/host_hypercall.c create mode 100644 arch/arm64/kvm/hyp/nvhe/switch.c create mode 100644 arch/arm64/kvm/hyp/nvhe/sysreg-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/timer-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/tlb.c create mode 100644 arch/arm64/kvm/hyp/switch.h create mode 100644 arch/arm64/kvm/hyp/sysreg-sr.h create mode 100644 arch/arm64/kvm/hyp/tlb.h -- 2.26.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0E7EC47253 for ; Thu, 30 Apr 2020 14:48:48 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 3A2832074A for ; Thu, 30 Apr 2020 14:48:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="G5oxdiVz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A2832074A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9803F4B4D8; Thu, 30 Apr 2020 10:48:47 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bz7dh-wMPOuL; Thu, 30 Apr 2020 10:48:46 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 576AF4B43E; Thu, 30 Apr 2020 10:48:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 990AB4B3A2 for ; Thu, 30 Apr 2020 10:48:45 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jAD+mvI7OI4k for ; Thu, 30 Apr 2020 10:48:44 -0400 (EDT) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 3763C4B394 for ; Thu, 30 Apr 2020 10:48:44 -0400 (EDT) Received: by mail-wm1-f66.google.com with SMTP id v4so7643532wme.1 for ; Thu, 30 Apr 2020 07:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SNF6UHAWqMkyYuIU0QRud/LtidR5txVpCjgq6hRS/rs=; b=G5oxdiVzQ6WQl8M6UOHfwP4pdHBU+qv5OHGvlNbCBI0z9EBiG+qssCu1yXAnrFN8gv lfko0Ni7uJjsvIxBetErtcwMm+mV2hclOUvBYr+lHY8ApffvotwdYZ9dxALl9nv92YtG ROYpq0EMuXYqoMaD8whW/Fjg8RSl+BhJYFo1rMpfzXKwF1hZRGTBo0M+YcbGHkp6zzbT G1k70B02KruRIlOfpfIyHn1hA+13411yMCiF3hwc3ZYt+xhsDWBoy8vjYIfZ/Y6/KMcN AzA0R3zvornaAnFTrqqiD/YsU76Cz4LdR6w7VuvVnoVzWhYndo+J2qimTWachzUtMCKQ 5PtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SNF6UHAWqMkyYuIU0QRud/LtidR5txVpCjgq6hRS/rs=; b=p8cJQD4YgzLseDhWmXUuLpBfTFWt12hoxBSMhCBMO4uFoRKAP3hskQqMp4fTlTUvGj faeJqQgWwT8pDvtp3aDrc+FVKuCff7mVi/niPAA3TGy8MXpzX1pFcRiLcV69QzJ9du8U A8KAz0pDsnKCnRl/8Ucege6hu1UZMMWVwC+jaSfy5D2MPuMQ6JzcCa3mmjarGpo5GaRk MIuKoeVCK6HBKGBkMVwhQiyz5a8uillSrxN3mNH1eFFzJEj9ZK7WRw254MrMeSQTSDGZ ryOWtQ7XhGuCVuLTLid9WZY+fNy29LXKQPrCQMf2r1w0skx85pXcOILS/oq5Rf+yNuG7 XKJQ== X-Gm-Message-State: AGi0Pua+o7rHwOkMyX5IEdG/dkQBox8m3yICuLMA2L/oCscLSGAOEPcu gSHlgdohDfCa2a0XZ+WI0Bx/ww== X-Google-Smtp-Source: APiQypKNM79/w8ZSyytfmzDWXe1CAhLCYA5tA2YOUJb4Z3naBNIFJxsLCPvYaCkYw96MVWpA4gCx5w== X-Received: by 2002:a05:600c:21ca:: with SMTP id x10mr3222316wmj.113.1588258122596; Thu, 30 Apr 2020 07:48:42 -0700 (PDT) Received: from localhost ([2a01:4b00:8523:2d03:d4b6:9828:8bd2:ce6f]) by smtp.gmail.com with ESMTPSA id s8sm4287714wru.38.2020.04.30.07.48.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2020 07:48:41 -0700 (PDT) From: David Brazdil To: Catalin Marinas , James Morse , Julien Thierry , Marc Zyngier , Suzuki K Poulose , Will Deacon Subject: [PATCH 00/15] Split off nVHE hyp code Date: Thu, 30 Apr 2020 15:48:16 +0100 Message-Id: <20200430144831.59194-1-dbrazdil@google.com> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Refactor files in arch/arm64/kvm/hyp to compile all code which runs in EL2 under nVHE into separate object files from the rest of KVM. This is done in preparation for being able to unmap .hyp.text from EL1 but has other benefits, notably: * safe use of KASAN/UBSAN/GCOV instrumentation on VHE code, * cleaner HVC API, * no need for __hyp_text annotations. nVHE-specific code is moved to hyp/nvhe and compiled with custom build rules similar to those used by EFI stub. Shared source files are compiled under both VHE and nVHE build rules. Where a source file contained both VHE and nVHE code, it is split into a shared header file and two C source files. This is done one file per commit to make review easier. All nVHE symbols are prefixed with "__hyp_text_" to avoid collisions with VHE variants (also inspired by EFI stub). Since this prefixes unresolved symbols too, image-vars.h contains a list of kernel symbol aliases where nVHE code still refers to kernel proper. This list will be further reduced in the future. No functional changes are intended but code was simplified whenever the refactoring made it possible. Tested by running kvm-unit-tests on QEMU 5.0 with VHE/nVHE and GIC v2/v3. This is based off Fuad Tabba's patch series "KVM: arm64: Tidy up arch Kconfig and Makefiles". Available in branch 'topic/el2-obj' of git repo: https://android-kvm.googlesource.com/linux -David David Brazdil (13): arm64: kvm: Fix symbol dependency in __hyp_call_panic_nvhe arm64: kvm: Add build rules for separate nVHE object files arm64: kvm: Build hyp-entry.S separately for VHE/nVHE arm64: kvm: Move __smccc_workaround_1_smc to .rodata arm64: kvm: Split hyp/tlb.c to VHE/nVHE arm64: kvm: Split hyp/switch.c to VHE/nVHE arm64: kvm: Split hyp/debug-sr.c to VHE/nVHE arm64: kvm: Split hyp/sysreg-sr.c to VHE/nVHE arm64: kvm: Split hyp/timer-sr.c to VHE/nVHE arm64: kvm: Compile remaining hyp/ files for both VHE/nVHE arm64: kvm: Add comments around __hyp_text_ symbol aliases arm64: kvm: Remove __hyp_text macro, use build rules instead arm64: kvm: Lift instrumentation restrictions on VHE Quentin Perret (2): arm64: kvm: Unify users of HVC instruction arm64: kvm: Formalize host-hyp hypcall ABI arch/arm64/include/asm/kvm_asm.h | 26 +- arch/arm64/include/asm/kvm_emulate.h | 2 +- arch/arm64/include/asm/kvm_host.h | 32 +- arch/arm64/include/asm/kvm_host_hypercalls.h | 62 ++ arch/arm64/include/asm/kvm_hyp.h | 15 +- arch/arm64/include/asm/kvm_mmu.h | 13 +- arch/arm64/include/asm/mmu.h | 7 - arch/arm64/include/asm/virt.h | 33 +- arch/arm64/kernel/cpu_errata.c | 2 +- arch/arm64/kernel/hyp-stub.S | 34 - arch/arm64/kernel/image-vars.h | 44 ++ arch/arm64/kvm/arm.c | 6 +- arch/arm64/kvm/hyp.S | 13 +- arch/arm64/kvm/hyp/Makefile | 12 +- arch/arm64/kvm/hyp/aarch32.c | 6 +- arch/arm64/kvm/hyp/debug-sr.c | 214 +----- arch/arm64/kvm/hyp/debug-sr.h | 165 +++++ arch/arm64/kvm/hyp/entry.S | 1 - arch/arm64/kvm/hyp/fpsimd.S | 1 - arch/arm64/kvm/hyp/hyp-entry.S | 62 +- arch/arm64/kvm/hyp/nvhe/Makefile | 42 ++ arch/arm64/kvm/hyp/nvhe/debug-sr.c | 77 +++ arch/arm64/kvm/hyp/nvhe/host_hypercall.c | 22 + arch/arm64/kvm/hyp/nvhe/switch.c | 271 ++++++++ arch/arm64/kvm/hyp/nvhe/sysreg-sr.c | 56 ++ arch/arm64/kvm/hyp/nvhe/timer-sr.c | 43 ++ arch/arm64/kvm/hyp/nvhe/tlb.c | 67 ++ arch/arm64/kvm/hyp/switch.c | 688 +------------------ arch/arm64/kvm/hyp/switch.h | 438 ++++++++++++ arch/arm64/kvm/hyp/sysreg-sr.c | 227 +----- arch/arm64/kvm/hyp/sysreg-sr.h | 211 ++++++ arch/arm64/kvm/hyp/timer-sr.c | 38 +- arch/arm64/kvm/hyp/tlb.c | 168 +---- arch/arm64/kvm/hyp/tlb.h | 126 ++++ arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 4 +- arch/arm64/kvm/hyp/vgic-v3-sr.c | 130 ++-- arch/arm64/kvm/va_layout.c | 2 +- scripts/kallsyms.c | 1 + 38 files changed, 1887 insertions(+), 1474 deletions(-) create mode 100644 arch/arm64/include/asm/kvm_host_hypercalls.h create mode 100644 arch/arm64/kvm/hyp/debug-sr.h create mode 100644 arch/arm64/kvm/hyp/nvhe/Makefile create mode 100644 arch/arm64/kvm/hyp/nvhe/debug-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/host_hypercall.c create mode 100644 arch/arm64/kvm/hyp/nvhe/switch.c create mode 100644 arch/arm64/kvm/hyp/nvhe/sysreg-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/timer-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/tlb.c create mode 100644 arch/arm64/kvm/hyp/switch.h create mode 100644 arch/arm64/kvm/hyp/sysreg-sr.h create mode 100644 arch/arm64/kvm/hyp/tlb.h -- 2.26.1 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4335C47247 for ; Thu, 30 Apr 2020 14:50:36 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A1C9F2074A for ; Thu, 30 Apr 2020 14:50:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MDULtpQ1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="G5oxdiVz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1C9F2074A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=8U747mWoFfRmUuUPVGHD5sij8Cfmgkqtqo4ofUkVOQU=; b=MDULtpQ1+Vyy7r 2uMn25U1L7JjjOjinEstY/oQcc1LjHwZBkk6q9Zf5DJv1bO6W/EemaLt0jB9MF75d/JQ7zToH8AfK v7BYQWBJKgUY0jj3CtSYYAWcY9JbuNEbL23BP0pQMbDv+E5jndnuyxOUz5f4CGWOwCE/wnHhKy9Sy vnrAL/WfIs1jTd1WuVwrgHlrnfGPpQJNRuoX4PpAQwHIx5/Sqcuo2gq5qXrwDu0AE1F+cjVOI1St7 /J9hwjv+C8MMeNfA5P/uETtJ9/svgx8igWYe490azq9wVrWgjLAu4RqVM6YGkjjvYpJV/M2wrX2zA 1AOCd0thJL/povrmfAog==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUAWI-0007GX-RU; Thu, 30 Apr 2020 14:50:34 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUAUY-0003gj-Sx for linux-arm-kernel@lists.infradead.org; Thu, 30 Apr 2020 14:48:56 +0000 Received: by mail-wm1-x343.google.com with SMTP id e26so2183013wmk.5 for ; Thu, 30 Apr 2020 07:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SNF6UHAWqMkyYuIU0QRud/LtidR5txVpCjgq6hRS/rs=; b=G5oxdiVzQ6WQl8M6UOHfwP4pdHBU+qv5OHGvlNbCBI0z9EBiG+qssCu1yXAnrFN8gv lfko0Ni7uJjsvIxBetErtcwMm+mV2hclOUvBYr+lHY8ApffvotwdYZ9dxALl9nv92YtG ROYpq0EMuXYqoMaD8whW/Fjg8RSl+BhJYFo1rMpfzXKwF1hZRGTBo0M+YcbGHkp6zzbT G1k70B02KruRIlOfpfIyHn1hA+13411yMCiF3hwc3ZYt+xhsDWBoy8vjYIfZ/Y6/KMcN AzA0R3zvornaAnFTrqqiD/YsU76Cz4LdR6w7VuvVnoVzWhYndo+J2qimTWachzUtMCKQ 5PtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SNF6UHAWqMkyYuIU0QRud/LtidR5txVpCjgq6hRS/rs=; b=rGcslupVjaDZDz8XupaNn10ukTCH0+ZvKdaSezUA8D4W5dvFHCU47wd8wlKhWyM5al irryi6G4Ji1ax2n9UfEmleQRfYmsFEOHbiAhNVRM3NSSCw+TAAG4ZWNAv+aicUtgZ3Lv NPFshoMXnqyzDS1gXpzFickmXlneH0oXppaBDcRBAeDF1/0V90WQ3rzl6ANKbZJfxzDv TsXj33AbSEdqyioFl0j0qlRl6W8hOGZagbaW7kCwL6t+0vZlnqv7uIBoITuxm/5AplHc ArVX/TmfSPZPSRfadCW9HZgRpksPMpp7uxPBHueaYc/JXh2gx43jPP8zakdo3mudZYgj FRNA== X-Gm-Message-State: AGi0PuYWrfQWw81/uFcUVBoK1z3fLpi+8QC1w00GhKTC2DWHATfUjN6/ b80ok76hRSGSDrMpi8hqe2GnpQ== X-Google-Smtp-Source: APiQypKNM79/w8ZSyytfmzDWXe1CAhLCYA5tA2YOUJb4Z3naBNIFJxsLCPvYaCkYw96MVWpA4gCx5w== X-Received: by 2002:a05:600c:21ca:: with SMTP id x10mr3222316wmj.113.1588258122596; Thu, 30 Apr 2020 07:48:42 -0700 (PDT) Received: from localhost ([2a01:4b00:8523:2d03:d4b6:9828:8bd2:ce6f]) by smtp.gmail.com with ESMTPSA id s8sm4287714wru.38.2020.04.30.07.48.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2020 07:48:41 -0700 (PDT) From: David Brazdil To: Catalin Marinas , James Morse , Julien Thierry , Marc Zyngier , Suzuki K Poulose , Will Deacon Subject: [PATCH 00/15] Split off nVHE hyp code Date: Thu, 30 Apr 2020 15:48:16 +0100 Message-Id: <20200430144831.59194-1-dbrazdil@google.com> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200430_074846_987583_1E7C16D2 X-CRM114-Status: GOOD ( 16.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Brazdil , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor files in arch/arm64/kvm/hyp to compile all code which runs in EL2 under nVHE into separate object files from the rest of KVM. This is done in preparation for being able to unmap .hyp.text from EL1 but has other benefits, notably: * safe use of KASAN/UBSAN/GCOV instrumentation on VHE code, * cleaner HVC API, * no need for __hyp_text annotations. nVHE-specific code is moved to hyp/nvhe and compiled with custom build rules similar to those used by EFI stub. Shared source files are compiled under both VHE and nVHE build rules. Where a source file contained both VHE and nVHE code, it is split into a shared header file and two C source files. This is done one file per commit to make review easier. All nVHE symbols are prefixed with "__hyp_text_" to avoid collisions with VHE variants (also inspired by EFI stub). Since this prefixes unresolved symbols too, image-vars.h contains a list of kernel symbol aliases where nVHE code still refers to kernel proper. This list will be further reduced in the future. No functional changes are intended but code was simplified whenever the refactoring made it possible. Tested by running kvm-unit-tests on QEMU 5.0 with VHE/nVHE and GIC v2/v3. This is based off Fuad Tabba's patch series "KVM: arm64: Tidy up arch Kconfig and Makefiles". Available in branch 'topic/el2-obj' of git repo: https://android-kvm.googlesource.com/linux -David David Brazdil (13): arm64: kvm: Fix symbol dependency in __hyp_call_panic_nvhe arm64: kvm: Add build rules for separate nVHE object files arm64: kvm: Build hyp-entry.S separately for VHE/nVHE arm64: kvm: Move __smccc_workaround_1_smc to .rodata arm64: kvm: Split hyp/tlb.c to VHE/nVHE arm64: kvm: Split hyp/switch.c to VHE/nVHE arm64: kvm: Split hyp/debug-sr.c to VHE/nVHE arm64: kvm: Split hyp/sysreg-sr.c to VHE/nVHE arm64: kvm: Split hyp/timer-sr.c to VHE/nVHE arm64: kvm: Compile remaining hyp/ files for both VHE/nVHE arm64: kvm: Add comments around __hyp_text_ symbol aliases arm64: kvm: Remove __hyp_text macro, use build rules instead arm64: kvm: Lift instrumentation restrictions on VHE Quentin Perret (2): arm64: kvm: Unify users of HVC instruction arm64: kvm: Formalize host-hyp hypcall ABI arch/arm64/include/asm/kvm_asm.h | 26 +- arch/arm64/include/asm/kvm_emulate.h | 2 +- arch/arm64/include/asm/kvm_host.h | 32 +- arch/arm64/include/asm/kvm_host_hypercalls.h | 62 ++ arch/arm64/include/asm/kvm_hyp.h | 15 +- arch/arm64/include/asm/kvm_mmu.h | 13 +- arch/arm64/include/asm/mmu.h | 7 - arch/arm64/include/asm/virt.h | 33 +- arch/arm64/kernel/cpu_errata.c | 2 +- arch/arm64/kernel/hyp-stub.S | 34 - arch/arm64/kernel/image-vars.h | 44 ++ arch/arm64/kvm/arm.c | 6 +- arch/arm64/kvm/hyp.S | 13 +- arch/arm64/kvm/hyp/Makefile | 12 +- arch/arm64/kvm/hyp/aarch32.c | 6 +- arch/arm64/kvm/hyp/debug-sr.c | 214 +----- arch/arm64/kvm/hyp/debug-sr.h | 165 +++++ arch/arm64/kvm/hyp/entry.S | 1 - arch/arm64/kvm/hyp/fpsimd.S | 1 - arch/arm64/kvm/hyp/hyp-entry.S | 62 +- arch/arm64/kvm/hyp/nvhe/Makefile | 42 ++ arch/arm64/kvm/hyp/nvhe/debug-sr.c | 77 +++ arch/arm64/kvm/hyp/nvhe/host_hypercall.c | 22 + arch/arm64/kvm/hyp/nvhe/switch.c | 271 ++++++++ arch/arm64/kvm/hyp/nvhe/sysreg-sr.c | 56 ++ arch/arm64/kvm/hyp/nvhe/timer-sr.c | 43 ++ arch/arm64/kvm/hyp/nvhe/tlb.c | 67 ++ arch/arm64/kvm/hyp/switch.c | 688 +------------------ arch/arm64/kvm/hyp/switch.h | 438 ++++++++++++ arch/arm64/kvm/hyp/sysreg-sr.c | 227 +----- arch/arm64/kvm/hyp/sysreg-sr.h | 211 ++++++ arch/arm64/kvm/hyp/timer-sr.c | 38 +- arch/arm64/kvm/hyp/tlb.c | 168 +---- arch/arm64/kvm/hyp/tlb.h | 126 ++++ arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 4 +- arch/arm64/kvm/hyp/vgic-v3-sr.c | 130 ++-- arch/arm64/kvm/va_layout.c | 2 +- scripts/kallsyms.c | 1 + 38 files changed, 1887 insertions(+), 1474 deletions(-) create mode 100644 arch/arm64/include/asm/kvm_host_hypercalls.h create mode 100644 arch/arm64/kvm/hyp/debug-sr.h create mode 100644 arch/arm64/kvm/hyp/nvhe/Makefile create mode 100644 arch/arm64/kvm/hyp/nvhe/debug-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/host_hypercall.c create mode 100644 arch/arm64/kvm/hyp/nvhe/switch.c create mode 100644 arch/arm64/kvm/hyp/nvhe/sysreg-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/timer-sr.c create mode 100644 arch/arm64/kvm/hyp/nvhe/tlb.c create mode 100644 arch/arm64/kvm/hyp/switch.h create mode 100644 arch/arm64/kvm/hyp/sysreg-sr.h create mode 100644 arch/arm64/kvm/hyp/tlb.h -- 2.26.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel