Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4283744rdb; Thu, 14 Sep 2023 18:50:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeD3kjYtC8XZuKe2ilgA3hZQeyH7bb70rn6ST5wf8e23gheBfe1f/TQ4rfBXwg8LztfwVT X-Received: by 2002:a05:6358:2907:b0:134:cd32:3565 with SMTP id y7-20020a056358290700b00134cd323565mr434288rwb.31.1694742652734; Thu, 14 Sep 2023 18:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694742652; cv=none; d=google.com; s=arc-20160816; b=G8uZ2kQlfRWPYkVc8cp8zDzFUjzHwSghjWSqKHUyVg0VcDBGMgnoFVToU3y5I9wZ4v zYFH+B5wmQtu9acSygmB/rAh5nyhuQ/2v9ZFjDpOEy6rFRiS0oUbgSK9beyxcEzsnwse 1BzYZDtyMCE4hq2V91xViyNVOdyA0clebMSl4FxiAGTSPnl+zm4/kKUQ26Ir+Lza71Lz MlFu13r0R/4tz3mWzselI6JEzhY0BBtPRTtyN7AIgInW+pDaNx7BkH9E0vXxvNKek5B6 8zQ5Q8dyX5MHjydKvwptYSCf9GneZM2GYBNLWIfXmMr3F+v23iYC+UhflIuec7mszgGI J/mA== 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=uQePiRVBRy3R9zvscKDZDfIbc32iT1IdnCcvqT4LsCA=; fh=ejoaVAUUbBXsA/6jM/beuI9xCYtV2osdR9SpI7hjY84=; b=Wmx1CcuS6FEt8KIRmy7MJcofeqWHJuAzVcB6E8Mrf4Gd+jlpa15r9QQ2C86GyXcMQ7 JMmvojcAXZM2ub3uNHT29DfDTqBHdaSgBppGnSxgOsJYckMVnpYk5klrz7+JzWPWXL5y NtA7ZBrjiUpQCoxL59v/r9FU/nEj6UJX47wrlZvMCZCcb00UgXpAly+Sr+pBP71Qj8uz osd7TK9yQTNcBc4FAKF+GXuk/0nNIuP78qVe4G2h4FtZMotzvyhIaSJocR6LSqoB14XG pJFIQs8cS62+CQxF/6lGvdcgCqQ8HGdS/+7MA0OJZmB6OyLXP0oOLePCHt9qyfJYQkTA il8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bz34-20020a056a02062200b00565f7f1eacdsi2662066pgb.80.2023.09.14.18.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 18:50:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id B7F8582A5F1F; Thu, 14 Sep 2023 18:50:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbjIOBuR (ORCPT + 99 others); Thu, 14 Sep 2023 21:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbjIOBuG (ORCPT ); Thu, 14 Sep 2023 21:50:06 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 471B6270E; Thu, 14 Sep 2023 18:50:01 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8BxNuhFuANly_4nAA--.23298S3; Fri, 15 Sep 2023 09:49:57 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axndw9uANl+ioGAA--.11927S12; Fri, 15 Sep 2023 09:49:57 +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 v21 10/29] LoongArch: KVM: Implement vcpu ENABLE_CAP ioctl interface Date: Fri, 15 Sep 2023 09:49:30 +0800 Message-Id: <20230915014949.1222777-11-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230915014949.1222777-1-zhaotianrui@loongson.cn> References: <20230915014949.1222777-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Axndw9uANl+ioGAA--.11927S12 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== 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 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 18:50:29 -0700 (PDT) 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 lipwig.vger.email 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 1cc53f56d0..6b1b2a058b 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -215,6 +215,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) { @@ -249,6 +259,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