From patchwork Wed Nov 15 09:19:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 16596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2423310vqg; Wed, 15 Nov 2023 01:32:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLIuiMEFf2vKurC/oftLduTprfh6IVILEJca4VAJ25j3zMHYPGElVozl5iShuvU8z+vw+t X-Received: by 2002:a05:6a20:da8b:b0:187:6dab:578 with SMTP id iy11-20020a056a20da8b00b001876dab0578mr1012544pzb.40.1700040749420; Wed, 15 Nov 2023 01:32:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700040749; cv=none; d=google.com; s=arc-20160816; b=q5hmF/9/dcyrt5EfiZ2V69haMwDThAPXCrZW+yVWxjw9HtY/+Jjms9RbiNsKJ/h42d ehnEfGrXGsZlEFjTVZN+Q3kJmdT1Ulnp+vslvbqVdplAu5P8+LW1iBpz8cYJD69Uf4Dy F4y+p071X+/gtqPWueH4M/4NNUk+0e+crh3brPqYn9zHPphxOgH8B/jEmNCh6nJP4ZXl h+RJIigA7zdykix+WQhzrAgI37Xaj3zSvWAcIbRgMMgLyjPNGKVqVcyYz+QVOv1qC5u9 /yh8pCQSsW/JijXOtdbEAj++vK4oTiAuSbwRnWsOKO9Hk1051LibsNuSzyzxmoprMyd+ PsiA== 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=372wV1xeghaSh8M0pW9PwF7/eazjZbpyu+oVfYgiYcA=; fh=ejoaVAUUbBXsA/6jM/beuI9xCYtV2osdR9SpI7hjY84=; b=rvkuoTMEpE/yFtTQRzr2WlQFNTp/lm0iiVFuEM9RTsx7Rq5aMXLd9+tXoYSsG22G21 xsvfx+CSxxWAD7Vz4bJiqpe826PkMy++kYm6gRERl3jAtMfrjMCw4B6h0RaXEM/Hi/vE KWPLy5NewFvK3RCTE8Q7xgO8+ilm+hEB0qH+xnLf3mBr7MeGCxVS8txkqu9Wo/DQIwey HGqFc1q2FEeZ9vIG2BmHF82HlRLVPolFieOaQkq4HrnwsTpF+zGT+5q1q18s6Dmrqki2 Saal1o69WgjcaJHG2UXJyReLIF/VDcldCpbZqrM3sj0dApUhBsPSxkgyXoq4orv1vCcs J8hg== 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:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id lr16-20020a17090b4b9000b00263c23a5693si9971507pjb.13.2023.11.15.01.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 01:32:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 81B6C81389B8; Wed, 15 Nov 2023 01:32:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234791AbjKOJc0 (ORCPT + 28 others); Wed, 15 Nov 2023 04:32:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234680AbjKOJcZ (ORCPT ); Wed, 15 Nov 2023 04:32:25 -0500 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 958ECFC; Wed, 15 Nov 2023 01:32:21 -0800 (PST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8CxbesjkFRlWjw6AA--.46619S3; Wed, 15 Nov 2023 17:32:19 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx7twhkFRlq99CAA--.16093S2; Wed, 15 Nov 2023 17:32:17 +0800 (CST) From: Tianrui Zhao To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Huacai Chen , WANG Xuerui , Greg Kroah-Hartman , loongarch@lists.linux.dev, Jens Axboe , Mark Brown , Alex Deucher , Oliver Upton , maobibo@loongson.cn, Xi Ruoyao , zhaotianrui@loongson.cn Subject: [PATCH v1 0/2] LoongArch: KVM: Add LSX,LASX support Date: Wed, 15 Nov 2023 17:19:19 +0800 Message-Id: <20231115091921.85516-1-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx7twhkFRlq99CAA--.16093S2 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 01:32:28 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782621928564890906 X-GMAIL-MSGID: 1782621928564890906 This patch series add LSX,LASX support for LoongArch KVM. LSX: LoongArch 128-bits vector instruction LASX:LoongArch 256-bits vector instruction There will be LSX,LASX exception in KVM when guest use the LSX,LASX instructions. KVM will enable LSX,LASX and restore the vector registers for guest then return to guest to continue running. Changes for v1: (1) Add LSX support for LoongArch KVM. (2) Add LASX support for LoongArch KVM. Tianrui Zhao (1): LoongArch: KVM: Add lsx support zhaotianrui (1): LoongArch: KVM: Add lasx support arch/loongarch/include/asm/kvm_host.h | 12 ++++ arch/loongarch/include/asm/kvm_vcpu.h | 22 +++++++ arch/loongarch/kernel/fpu.S | 1 + arch/loongarch/kvm/exit.c | 36 +++++++++++ arch/loongarch/kvm/switch.S | 38 ++++++++++++ arch/loongarch/kvm/trace.h | 6 +- arch/loongarch/kvm/vcpu.c | 88 ++++++++++++++++++++++++++- 7 files changed, 199 insertions(+), 4 deletions(-)