From patchwork Thu Feb 16 16:00:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kristina Martsenko X-Patchwork-Id: 5516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp381244wrn; Thu, 16 Feb 2023 08:02:51 -0800 (PST) X-Google-Smtp-Source: AK7set8kE1u48h4b3DKRa+ZPNd1dRreczhOzDFkOdNuFnXrwIW+0y8SAUFcsCKaBz9CMI3SD2DIw X-Received: by 2002:a05:6402:885:b0:4aa:a248:a153 with SMTP id e5-20020a056402088500b004aaa248a153mr6115020edy.3.1676563371222; Thu, 16 Feb 2023 08:02:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676563371; cv=none; d=google.com; s=arc-20160816; b=TaVvJe4BBDj2VZg0h8gSZX7KvSVvIS64Z0zFYFiruIWb8LGlm5vNTy9vyABCgZSQJa XSLPzHF2mVo+qO0nPe3RL7bF2y5uOzzSoz+DsZVfvM3hYGC+PuHlMgKRl8i5sfDXVYS3 9UgRdK0VoBy1WhCbnnIiy3Bwh5wDLh6Rvo3MiCxxWnTMEN6eGe/pru2MIgvkaxIO/suQ Ag+pb/6i6aGEjJXa5l3kgxP2ZTAYcMgQcipSCl7FSfyy8IBCzy43EKbJvfRZaDYJsYeG V8y6pQ/aYhwVOFl0Rs76hkY1Ol2GhXo/xXJF/HWCpkPztkvXASkIlLH3OAhWwL1B4UVB ZdQw== 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; bh=kGB9wgYC8k3QDdlt6GbY/96ygpehDvz3BFk+zq2qwEY=; b=CtAtRflo8OsY7PXfvzMuDRqNbe+ZqG0nwG6jhr2riBdkppXHbG969RSJeXIs0yb674 pscq7Yos6YZKxR8mFE2/d46UsmKW4mgjPQMAemfczT2MZea7m3FOAjnlmzkUhAB5WWh1 iliJZucISLxRR/+LHFZn6RAR8uqijX21JjhqA6QDdd5GABESf/cCpCWBA/F3CzUdt4wO /CevszdQ9wgQyk+Pk8VxF0avMTmdkMGZr+lbL8l+r7Mn37zPE2+30HKCTUAdd+vuJsuj wbR8pz0eotzHmzAmqKhpBAex7xaVLNy6OVdxqi6WdRUMS+0pmXr3WGRu9GDss2RtlEPX kWtg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19-20020aa7c1d3000000b004aadaa706ecsi2731218edp.169.2023.02.16.08.02.27; Thu, 16 Feb 2023 08:02:51 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbjBPQB3 (ORCPT + 99 others); Thu, 16 Feb 2023 11:01:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjBPQB1 (ORCPT ); Thu, 16 Feb 2023 11:01:27 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AAEB74BE82 for ; Thu, 16 Feb 2023 08:01:25 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2B8D51042; Thu, 16 Feb 2023 08:02:08 -0800 (PST) Received: from e126864.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8EF293F881; Thu, 16 Feb 2023 08:01:22 -0800 (PST) From: Kristina Martsenko To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Mark Rutland , Mark Brown , Luis Machado , Vladimir Murzin , linux-kernel@vger.kernel.org Subject: [PATCH 00/10] arm64: support Armv8.8 memcpy instructions in userspace Date: Thu, 16 Feb 2023 16:00:02 +0000 Message-Id: <20230216160012.272345-1-kristina.martsenko@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758004113584268105?= X-GMAIL-MSGID: =?utf-8?q?1758004113584268105?= The Armv8.8 extension adds new instructions to perform memcpy(), memset() and memmove() operations in hardware (FEAT_MOPS). The aim is to avoid having many different performance-optimal memcpy implementations in software (tailored to CPU model and copy size) and the overhead of selecting between them. The new instructions are intended to be at least as fast as any alternative instruction sequence. This series adds support for using the new instructions in userspace. The most noteworthy part is some exception handling for when there are different memcpy implementations in the same system. In addition, the first patches in the series set up basic handling for the new HCRX_EL2 register (added in Armv8.7), which is needed to disable MOPS in KVM guests for now. Support for using memcpy instructions in KVM guests will follow in a future series, as well as kselftests and more debug support. Kristina Martsenko (10): KVM: arm64: initialize HCRX_EL2 arm64: cpufeature: detect FEAT_HCX KVM: arm64: switch HCRX_EL2 between host and guest arm64: mops: document boot requirements for MOPS arm64: mops: don't disable host MOPS instructions from EL2 KVM: arm64: hide MOPS from guests arm64: mops: handle MOPS exceptions arm64: mops: handle single stepping after MOPS exception arm64: mops: detect and enable FEAT_MOPS arm64: mops: allow disabling MOPS from the kernel command line .../admin-guide/kernel-parameters.txt | 3 ++ Documentation/arm64/booting.rst | 8 +++ Documentation/arm64/cpu-feature-registers.rst | 2 + Documentation/arm64/elf_hwcaps.rst | 3 ++ arch/arm64/include/asm/el2_setup.h | 8 --- arch/arm64/include/asm/esr.h | 11 +++- arch/arm64/include/asm/exception.h | 1 + arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/asm/kvm_arm.h | 4 ++ arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel/cpufeature.c | 31 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kernel/entry-common.c | 11 ++++ arch/arm64/kernel/head.S | 7 +++ arch/arm64/kernel/idreg-override.c | 2 + arch/arm64/kernel/traps.c | 51 +++++++++++++++++++ arch/arm64/kvm/hyp/include/hyp/switch.h | 6 +++ arch/arm64/kvm/hyp/nvhe/hyp-init.S | 6 +++ arch/arm64/kvm/sys_regs.c | 1 + arch/arm64/tools/cpucaps | 2 + 20 files changed, 151 insertions(+), 9 deletions(-)