Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1683100rwo; Wed, 2 Aug 2023 19:50:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlHsagILnQjrWeDMpaMAT7TwVu1Aai/Z6wrYrd9MCCocRHVbGyRIxqw86CClZ7/wTWtb9CJR X-Received: by 2002:a2e:2e09:0:b0:2b9:eb8b:eeb1 with SMTP id u9-20020a2e2e09000000b002b9eb8beeb1mr5773301lju.37.1691031043358; Wed, 02 Aug 2023 19:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691031043; cv=none; d=google.com; s=arc-20160816; b=r+SYA3v00pzC0cZCphpenNsO1Rd2r9jUeK2M65/npuFLqlgVz7W2rUjDyD9zJTfowc UQmvKK/YeJzjhazb2pOnWpSBSEean2KWtRosOllSkwVoIEkag1NIMlW0wSWfnGc7Dpv1 /eK+UYoQR8WrZlSxpH5gwzvZ6JoWvgAlT/tkpgn3Taug5LpSWO8a62To4thGP5dMoXRY WWWgGayOqfDTKLj14rjl2hGCQgEyv46Kxf1JeTVVcbvGE9F5Urdb+bOT0OibvEWJec0h hSDgAp3ToPwDkzo3DZ09rOCI2MSNQYN6k4/+FTeCSR1063wOyRCfAn7KIrIDfFWmyH/q XE/Q== 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=jnzItaTaLG3+5jlpgsdmIpr0Uoh/rhmQJod7H0b6sl0=; fh=vBXozhnPXwSB3DJhjnKWz3f6luaN/KxHDpM6/QeZg4o=; b=0OoZ1HWasEdx5g2f3sXs9QgQwGvmFp+8LWXqK8tJ6GsBSbgFDEp+60446hhfwsaX4B GaAUtLMOpz2/PZ2eCOCbD7/2qVrStMRyjfl6LKhDKBegba5QO9wEE0ECPsDPFj3keWcR Qt94tjW5eezmCWXx/ZGMDrEjSzBas462FxZB2X8c6ARNMIKNOcbXSdEvzZbgWW6qaJYI 0DEspAA+QTLpkmj+DPNzivoDSvMngSSKsiuATHyGU7sVG5jwS6lytH29AgK/Os33flcm c1VuGcVjDkkCq1iWswUFFu39GGq40+ACuNeDe2BKlhd63Dece1XyBKzldq0fJ9spcupW m2Uw== 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 s11-20020a170906a18b00b009930e13a56fsi10893645ejy.346.2023.08.02.19.50.19; Wed, 02 Aug 2023 19:50:43 -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 S232302AbjHCCXS (ORCPT + 99 others); Wed, 2 Aug 2023 22:23:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232868AbjHCCWa (ORCPT ); Wed, 2 Aug 2023 22:22:30 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CBF8D30F8; Wed, 2 Aug 2023 19:21:59 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8BxnutDD8tkEGkPAA--.33683S3; Thu, 03 Aug 2023 10:21:55 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cx_c4yD8tk8oNGAA--.51268S12; Thu, 03 Aug 2023 10:21:53 +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 v18 10/30] LoongArch: KVM: Implement vcpu ENABLE_CAP ioctl interface Date: Thu, 3 Aug 2023 10:21:18 +0800 Message-Id: <20230803022138.2736430-11-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230803022138.2736430-1-zhaotianrui@loongson.cn> References: <20230803022138.2736430-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Cx_c4yD8tk8oNGAA--.51268S12 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 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 5a6d0735afa1..a61f6000a07d 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -186,6 +186,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) { @@ -209,6 +219,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.39.1