From patchwork Fri Sep 15 12:48:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kristina Martsenko X-Patchwork-Id: 14048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1036837vqi; Fri, 15 Sep 2023 06:14:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+uzBLAN4cF2SdDbT4bTb0qvConzijjKtTNR6CfKQlhuYGgptCaVOPcwJ2RgMEy8ezxIiJ X-Received: by 2002:a17:90a:db92:b0:274:98c4:b6e8 with SMTP id h18-20020a17090adb9200b0027498c4b6e8mr1433251pjv.5.1694783669256; Fri, 15 Sep 2023 06:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694783669; cv=none; d=google.com; s=arc-20160816; b=bTK7xv73bIAHM8XjLNoUOl4rw86bglha5eKXxRPzxDCQM0S52y1O3XfqgIJtPBVBiw T2FG+dtrnCCbmSTtwaE9CE7pd5aADxLLFXIQDuVXPve5MSD6eVW3QAL//hlY2kW/tL3K Bm6rdrIQgb+I+w8FVd+5V3KiXTGrkQBTVCpmg/tBR7XnmNEqjtktcV0iaxqscwf2wRjf HVw7ZW2ayCc/DpjklO4Uh41lvYNvuvnxlumB8dTpuHw+0vCHBF/db+J26MxkP+pnF5rX 10CvmBVtB3wCz2jiZuduv6XQbhuj7wgqbmN9vTM4m+CHDAW6qQd3+LAwFBICvLRknUXF WBgQ== 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=uLxnpkNLCyV+SvUIpYfNDBOWfUtZjwRncjrK4WsRc9o=; fh=2vqTlNPINEt8u2O5VUjjdtxE8OgDGwETaTVTh/NI6As=; b=KQdx3pplaRhXfJuhTDE3QRQFnLsi6EC51Md12heR+gCQ2X2/Emqq+/aHHO9N9VAgdt j++5crbrtcrqUBRXxHrQI0B8FYKgs0vdo61jDEJX0lzAuWnsmTty6NkkEo2EUvYijLJ5 0a2HSL0eApnJwaM/W7ZHsx9ukU1TyxpG1xgVcTTrMMfxi635VPqbwJB54fQmJ6ZqLs6l wVbXuadLa1QWe9pp5tEskJhYRupWH+nUdJrxw13iyOE0WIPv3EvYyPi5v+maBM6VOSJ8 Heq1pbsOI+FEXr2MSij3sYFgalUEWyQELX9erE6iZmaAKaswFqU2nrSr3cUZxTBdpgpo BcTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id nm6-20020a17090b19c600b00274a5edad0csi575008pjb.139.2023.09.15.06.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 06:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D9C01834A9B2; Fri, 15 Sep 2023 05:49:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235023AbjIOMtu (ORCPT + 32 others); Fri, 15 Sep 2023 08:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235074AbjIOMts (ORCPT ); Fri, 15 Sep 2023 08:49:48 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 501661713 for ; Fri, 15 Sep 2023 05:49:43 -0700 (PDT) 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 BC3501FB; Fri, 15 Sep 2023 05:50:19 -0700 (PDT) Received: from e126864.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 B99A93F5A1; Fri, 15 Sep 2023 05:49:39 -0700 (PDT) From: Kristina Martsenko To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Vladimir Murzin , Colton Lewis , linux-kernel@vger.kernel.org Subject: [PATCH 0/3] KVM: arm64: Support for Arm v8.8 memcpy instructions in KVM guests Date: Fri, 15 Sep 2023 13:48:37 +0100 Message-Id: <20230915124840.474888-1-kristina.martsenko@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 15 Sep 2023 05:49:54 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777109480495140692 X-GMAIL-MSGID: 1777109480495140692 Hi, This series adds support for using the new Arm memory copy instructions in KVM guests. A previous series [1] added support for using the instructions in userspace applications. Similarly to that series, the main thing to note here is the handling for when a memcpy is stopped and continued on a different type of CPU. See patch #2 for details. As background, 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. The series has been tested on the Arm FVP. Thanks, Kristina [1] https://lore.kernel.org/all/20230509142235.3284028-1-kristina.martsenko@arm.com/ Kristina Martsenko (3): KVM: arm64: Configure HCRX_EL2 dynamically KVM: arm64: Add handler for MOPS exceptions KVM: arm64: Expose MOPS instructions to guests arch/arm64/include/asm/kvm_emulate.h | 10 ++++ arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/traps.h | 54 ++++++++++++++++++- arch/arm64/kernel/traps.c | 48 +---------------- arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/include/hyp/switch.h | 19 ++++++- .../arm64/kvm/hyp/include/nvhe/fixed_config.h | 3 +- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 1 + arch/arm64/kvm/hyp/nvhe/pkvm.c | 1 + arch/arm64/kvm/hyp/nvhe/switch.c | 2 + arch/arm64/kvm/hyp/vhe/switch.c | 1 + arch/arm64/kvm/sys_regs.c | 1 - 12 files changed, 90 insertions(+), 52 deletions(-) base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d