Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp37862rdb; Thu, 31 Aug 2023 02:11:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+vH4LLcOYQF5KV3B+45xy+XlLpZFApORDDXPWm8tzjvRa/DauIqsG1s/QtbxIdvYiNK3w X-Received: by 2002:a05:6402:149a:b0:523:4996:a4f9 with SMTP id e26-20020a056402149a00b005234996a4f9mr3800892edv.34.1693473079137; Thu, 31 Aug 2023 02:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693473079; cv=none; d=google.com; s=arc-20160816; b=wejVgUFjs571qoQ3//hQGgyDuxSR4zKjtGZHFmlJFD5O/PDMIMh499xiHA+CGsLPv5 SjB8NJHD4QqDoTDy/KkwxNr6VytwUCh688BbT373erktjpBN9yC3j9OE427eF3Cqw24H mQVcfL4T2ir1BoqKxVJ/+fk3WaAePeobNaQ02GA5ELz1SYzjSVmM8Pt4oXzdaZSopzCS ZNVI1YJhJqgnhqdq1pAk1m/euEXLqjJIf57Gfqaq4uSwRPCa6f2+56QaAIl7JsCXgm4Q 6BJAsZsZrXqya+LgtPbkYmKEp7sgMGbFuKBiLIQY1vvTf5LLO5Sg9wx+4Nq05Lfl814x vdeA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sXBGuknOzdUBJgZ/wOkIuo0/3VJ7kUs6zXQBwS4qZoQ=; fh=ejoaVAUUbBXsA/6jM/beuI9xCYtV2osdR9SpI7hjY84=; b=ukXz+885NSTbNAsMKoN/TSZ47EXE8dfxrzDTmX8NmRgA8t8irg7CtsrKLGYuSQZXW0 8YQw9sN9pya3Ud/ZEf9hXxUEaRZouClQYiJty9C+KCuCEX1Rpi1nb66dAWIXzUsmawmc xQkJdFaCHbQK/NjpV05nYu06Ft0wOyspFSnlzhUKRvZLHCYQvFWnOc8UvcG+LdKAFqb1 V/x5Pbps7tqbt7Y6986V2uNl6e5i2tIuh+6iUHxOF5PuiGZHHRTlmDgeDKFhjRvkZr2f Au8jZqc+Odi7G8cnL8mUW8+QRLrANsAd2dTtTZpftZtdm45ibXRqpbe8E4N+MiilRNGn EiGw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020aa7d892000000b0052a1d9ed739si727905edq.692.2023.08.31.02.10.48; Thu, 31 Aug 2023 02:11:19 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243321AbjHaIbG (ORCPT + 99 others); Thu, 31 Aug 2023 04:31:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245672AbjHaIan (ORCPT ); Thu, 31 Aug 2023 04:30:43 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B7431CF2; Thu, 31 Aug 2023 01:30:35 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxBfGmT_BkPl4dAA--.60183S3; Thu, 31 Aug 2023 16:30:30 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Ax3c6gT_BkOPVnAA--.55892S12; Thu, 31 Aug 2023 16:30:29 +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 v20 10/30] LoongArch: KVM: Implement vcpu ENABLE_CAP ioctl interface Date: Thu, 31 Aug 2023 16:30:00 +0800 Message-Id: <20230831083020.2187109-11-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230831083020.2187109-1-zhaotianrui@loongson.cn> References: <20230831083020.2187109-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Ax3c6gT_BkOPVnAA--.55892S12 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, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 Implement LoongArch vcpu KVM_ENABLE_CAP ioctl interface. Reviewed-by: Bibo Mao Signed-off-by: Tianrui Zhao --- arch/loongarch/kvm/vcpu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index f17422a942..be0c17a433 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -187,6 +187,16 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) return 0; } +static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, + struct kvm_enable_cap *cap) +{ + /* + * FPU is enable by default, do not support any other caps, + * and later we will support such as LSX cap. + */ + return -EINVAL; +} + long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { @@ -210,6 +220,15 @@ long kvm_arch_vcpu_ioctl(struct file *filp, r = _kvm_get_reg(vcpu, ®); break; } + case KVM_ENABLE_CAP: { + struct kvm_enable_cap cap; + + r = -EFAULT; + if (copy_from_user(&cap, argp, sizeof(cap))) + break; + r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); + break; + } default: r = -ENOIOCTLCMD; break; -- 2.27.0