From patchwork Fri Sep 28 13:39:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 10619951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 781713CF1 for ; Fri, 28 Sep 2018 13:40:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67ED72B2D1 for ; Fri, 28 Sep 2018 13:40:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C11D2B39C; Fri, 28 Sep 2018 13:40:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F9792B355 for ; Fri, 28 Sep 2018 13:40:05 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=NWc3ebnZ8QRYUB/Eidbs/uyEOwI+M5+Jq0hPZ8KGUm4=; b=n1k sLMd53eiHHE8quW3TdxiDd90s1NahljytR6Pdr5UyjXP4JwZvekBnZI2vRjoa41RgwEvNO8zIinfi 6u6SZUGcpcanMaqxMgieFA3FwXbCOr2fGuLDkOlD+MLkk8loV4PPyIiS/84r1L8vaC2HxrAVYM+D0 EmKT6YvMikhLNTzyuppCLwCG+iogADDLOMQ1LxOhyZtYz3qUYcZ8W+WyIrbI0AEgZWpe+AbKyk7zM sXISe7m2iZM7bFE7IlNIYWriBi5hIbE59HjWbSEEHQdkbR1f3wVQEvmbNiMBJh+T0c3Fxa4RZEUPc qlG3JFZ9OvOQJzqgyKnDz5n5FTet7Yg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5szx-0006Mw-8v; Fri, 28 Sep 2018 13:40:01 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5szi-0006Js-JX for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2018 13:39:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B3F0ED1; Fri, 28 Sep 2018 06:39:34 -0700 (PDT) Received: from e103592.Emea.Arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B32793F5B7; Fri, 28 Sep 2018 06:39:32 -0700 (PDT) From: Dave Martin To: kvmarm@lists.cs.columbia.edu Subject: [RFC PATCH v2 00/23] KVM: arm64: Initial support for SVE guests Date: Fri, 28 Sep 2018 14:39:04 +0100 Message-Id: <1538141967-15375-1-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180928_063946_756517_3B2C0C63 X-CRM114-Status: GOOD ( 17.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Okamoto Takayuki , Christoffer Dall , Ard Biesheuvel , Marc Zyngier , Catalin Marinas , Will Deacon , =?utf-8?q?Alex_Benn=C3=A9e?= , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This series implements basic support for allowing KVM guests to use the Arm Scalable Vector Extension (SVE). The patches are based on v4.19-rc5. The patches are also available on a branch for reviewer convenience. [1] This is a significant overhaul of the previous preliminary series [2], with the major changes outlined below, and additional minor updates in response to review feedback (see the individual patches for those). In the interest of getting this series out for review, This series is **completely untested**. Reviewers should focus on the proposed API (but any other comments are of course welcome!) Major changes: * Reworked on top of the new KVM FPSIMD context switching model. * Migrated away from use of feature bits in KVM_ARM_PREFERRED_TARGET / KVM_VCPU_INIT to detect and enable SVE support. Availability is now reported via KVM_CAP_ARM_SVE, and SVE support is enabled and configured per-vcpu with a new ioctl KVM_ARM_SVE_CONFIG. * KVM_ARM_SVE_CONFIG also adds the ability to detect and configure the set of SVE vector lengths provided to the guest. * The ioctl register access model has been simplified. The new SVE interface must now be used to access the content of the FPSIMD V-registers, on SVE-enabled vcpus. The kernel no longer tries to emulate the KVM_REG_ARM_CORE view for these registers in this case. (For non-SVE-enabled vcpus, the KVM_REG_ARM_CORE interface works as normal.) * Draft documentation for the SVE extensions has been added to KVM's api.txt. Known issues: * KVM_GET_REG_LIST enumerates the FPSIMD V-registers for SVE-enabled vcpus. It shouldn't, because attempts to access these will now fail! * kvmtool/qemu updates are needed to enable creation of SVE-enabled guests (to be discussed separately). * Due to heavy rework, the series is currently a bit of a mess: the patches are not presented in a very coherent order, and one or two patches may even now be redundant or irrelevant. If you spot any obvious inconsistencies, please shout! [1] http://linux-arm.org/git?p=linux-dm.git;a=shortlog;h=refs/heads/sve-kvm/rfcv2 git://linux-arm.org/linux-dm.git sve-kvm/rfcv2 [2] [RFC PATCH 00/16] KVM: arm64: Initial support for SVE guests http://lists.infradead.org/pipermail/linux-arm-kernel/2018-June/585467.html Dave Martin (23): arm64: fpsimd: Always set TIF_FOREIGN_FPSTATE on task state flush KVM: arm64: Delete orphaned declaration for __fpsimd_enabled() KVM: arm64: Refactor kvm_arm_num_regs() for easier maintenance KVM: arm64: Add missing #include of to kvm_host.h KVM: arm: Add arch vcpu uninit hook arm64/sve: Check SVE virtualisability arm64/sve: Enable SVE state tracking for non-task contexts KVM: arm64: Add a vcpu flag to control SVE visibility for the guest KVM: arm64: Propagate vcpu into read_id_reg() KVM: arm64: Extend reset_unknown() to handle mixed RES0/UNKNOWN registers KVM: arm64: Support runtime sysreg filtering for KVM_GET_REG_LIST KVM: arm64/sve: System register context switch and access support KVM: arm64/sve: Context switch the SVE registers KVM: Allow 2048-bit register access via ioctl interface KVM: arm64/sve: Add SVE support to register access ioctl interface KVM: arm64: Enumerate SVE register indices for KVM_GET_REG_LIST arm64/sve: In-kernel vector length availability query interface KVM: arm64: Add arch vcpu ioctl hook KVM: arm64/sve: Report and enable SVE API extensions for userspace KVM: arm64: Add arch vm ioctl hook KVM: arm64/sve: allow KVM_ARM_SVE_CONFIG_QUERY on vm fd KVM: Documentation: Document arm64 core registers in detail KVM: arm64/sve: Document KVM API extensions for SVE Documentation/virtual/kvm/api.txt | 160 ++++++++++++++++ arch/arm/include/asm/kvm_host.h | 16 +- arch/arm64/include/asm/fpsimd.h | 33 +++- arch/arm64/include/asm/kvm_host.h | 25 ++- arch/arm64/include/asm/kvm_hyp.h | 1 - arch/arm64/include/asm/sysreg.h | 3 + arch/arm64/include/uapi/asm/kvm.h | 24 +++ arch/arm64/kernel/cpufeature.c | 2 +- arch/arm64/kernel/fpsimd.c | 163 +++++++++++----- arch/arm64/kernel/signal.c | 5 - arch/arm64/kvm/fpsimd.c | 16 +- arch/arm64/kvm/guest.c | 391 ++++++++++++++++++++++++++++++++++++-- arch/arm64/kvm/hyp/switch.c | 69 +++++-- arch/arm64/kvm/reset.c | 50 +++++ arch/arm64/kvm/sys_regs.c | 144 ++++++++++++-- arch/arm64/kvm/sys_regs.h | 8 +- include/uapi/linux/kvm.h | 5 + virt/kvm/arm/arm.c | 9 +- 18 files changed, 1016 insertions(+), 108 deletions(-)