From patchwork Fri Jun 9 09:04:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 105453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp810978vqr; Fri, 9 Jun 2023 02:09:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6veU18TrIZUexCBy+0qlm1GxFBmRGiIltegXpDiluX6p7lSZEusDZj81uHo7p7B5evrd8W X-Received: by 2002:a05:6a20:3c9f:b0:10b:f331:d1c0 with SMTP id b31-20020a056a203c9f00b0010bf331d1c0mr895372pzj.30.1686301752317; Fri, 09 Jun 2023 02:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686301752; cv=none; d=google.com; s=arc-20160816; b=cDqOVJ0IXmfWUnmmxcsuFYR1hi8qQ3P7pkQ0B2o780avxjbFTJuDPKwQmIuXEm/dLZ gEnrL02nihIVtcurxmuyyHLsk3uHsqMvt7BKKvecbwqBYHhf6HXZ+/hS6fX4LBI+1fy3 pY+yRSKLh4PasCxaeZ8MgMtH8uuL+GfMrHaui788c5pAZq6G6xz5oZlcnNadpRuHhHCz z6RLU69wkT+nYGW16ajNQJTjSNZ8B1zcjphtqVxVDfP+CyvhrJAQgI2e/urgNHaMx1Mu bQHO/UE/BEQvu6LD5Cz09uZZFoKy4XL08/CJiWL3NxC3Y8Y7HHcLBTlBFdlxV1Qj6Y7C DPiw== 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=GW6mJSlv6AZn/ac/HvSJy7MzIZ2FFfSMULYMSVzHlP0=; b=CzZ+kEC3bShKzHFa2lzgkBf7gHXIn7i8R9v99EqKcVb4aRFpL8VND20cf9gPeUyyEA DTgE2AK8fKYwBfcwCwFqddQBrdMIX0OE2hvVDP9weWOkw7ayg1EeujdNdRjmUgXjXYFT 69Irkl5w3e/XxYIMrc8t525MBx2T9iXChvyKp5QGmwxneC7tRsXnWFUx+sBdMpk3ukCE PeTNcoeQo8hEjbjeDZshQjiWt5y2YaHu3CssQ5RFyJlCsRGKeAH5GEwS5rt+klkLie6y z+nyanacG77kuW4iPaXtDlhHe4Gc4HQRDa28WyKGkgh4/QJjKafnXSWd6xxhQAE+7v4m iSPQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a6566c6000000b0053440fe0817si2260076pgw.611.2023.06.09.02.08.58; Fri, 09 Jun 2023 02:09:12 -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 S241033AbjFIJGp (ORCPT + 99 others); Fri, 9 Jun 2023 05:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241187AbjFIJF7 (ORCPT ); Fri, 9 Jun 2023 05:05:59 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5FFB52685; Fri, 9 Jun 2023 02:05:51 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxSupu64Jk2_sAAA--.2995S3; Fri, 09 Jun 2023 17:05:50 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxluRO64JkSXEKAA--.31854S7; Fri, 09 Jun 2023 17:05:49 +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, tangyouling@loongson.cn Subject: [PATCH v13 10/30] LoongArch: KVM: Implement vcpu ENABLE_CAP ioctl interface Date: Fri, 9 Jun 2023 17:04:58 +0800 Message-Id: <20230609090518.2130926-11-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230609090518.2130926-1-zhaotianrui@loongson.cn> References: <20230609090518.2130926-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxluRO64JkSXEKAA--.31854S7 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768215546164211662?= X-GMAIL-MSGID: =?utf-8?q?1768215546164211662?= Implement LoongArch vcpu KVM_ENABLE_CAP ioctl interface. 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 b0cce413762d..da97b77da8eb 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;