Message ID | 20230228070057.3687180-11-zhaotianrui@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2857496wrd; Mon, 27 Feb 2023 23:02:13 -0800 (PST) X-Google-Smtp-Source: AK7set89MwZJoZz7FreRYw8CJJ9G1krXTLSHzGM4lbhHvP9eGblS2UKPQvsKHWKuJrwezSUyRymT X-Received: by 2002:a17:90b:4a0d:b0:233:457f:e71c with SMTP id kk13-20020a17090b4a0d00b00233457fe71cmr2040423pjb.38.1677567733303; Mon, 27 Feb 2023 23:02:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677567733; cv=none; d=google.com; s=arc-20160816; b=W9mDtgvel3mcToYONI/pjil6yPQDqDr/dW8PExslJuWnRgKUgw9AwZaJr53ef7fMyX Z7QUARfpHr6SOuvhEv3Drri0AzVT1K07DB9ayQQJcSAPOPGyTmXycf02d4x8OieZ0xbS bx2/uDwx2uiczMATWt1i/0E2nanXG9h6UioaLWzr8Cz4VJ+Vg5PB9hfzyQCm+yMK0g90 Yv7UVqhfPQGLcgFk2d9qaFnCBtryDdJlhKrT53Kg147ut+uqT8ascrUBrACIf40NhJE/ VROfoL9tBepYD9GEiYqLxuYvh9B3NeLBHq5pfR57WfZKCmG7OU3xUsDJEn/pvNR2fmhT Xw3Q== 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=VWHDqbbn6/KjBqqAhoDmscbLMO4eq59W+s9FbjTOA5M=; b=etFBtOCI/GwOdkHuWKkK/ygS1NGLCxQgwf3PRMewdCFvMiJPSwJ/bHkH1CSSSuB3Dm WrtwaasLkduVk5/hGznLb+u/hs0s1aqIbBu2RHYObEk95/mmiiP8U4q3tTFUzh1b48lX Efa8JxZ6q6XfTSvjDqX5lEWwI1u8BgtrGhtW+GueAQDLH8MivXJJL10mCEvLQZE63L6b RbbKT3qTO5+qcDBUcLUsmbg7QQonu84iIqJkAVEo3bGWPr+MUWs5xQfbeVZc9PlhIQI8 C3oAFsAeCYXj3riPF3eoHNND3BRJajNq/ct3vjoFnocL2zhhvBxFqEArdwSip+WfhY1s kNqw== 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 kb8-20020a17090ae7c800b0022c320a4d27si14254625pjb.189.2023.02.27.23.01.57; Mon, 27 Feb 2023 23:02:13 -0800 (PST) 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 S230345AbjB1HBd (ORCPT <rfc822;brysonjbanks@gmail.com> + 99 others); Tue, 28 Feb 2023 02:01:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbjB1HBE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Feb 2023 02:01:04 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 46A701DB8B; Mon, 27 Feb 2023 23:01:02 -0800 (PST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxJYytpv1jgmAGAA--.6448S3; Tue, 28 Feb 2023 15:01:01 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bxc+Wppv1jPG9AAA--.15462S12; Tue, 28 Feb 2023 15:01:00 +0800 (CST) From: Tianrui Zhao <zhaotianrui@loongson.cn> To: Paolo Bonzini <pbonzini@redhat.com> Cc: Huacai Chen <chenhuacai@kernel.org>, WANG Xuerui <kernel@xen0n.name>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jens Axboe <axboe@kernel.dk>, Mark Brown <broonie@kernel.org>, Alex Deucher <alexander.deucher@amd.com>, Oliver Upton <oliver.upton@linux.dev>, maobibo@loongson.cn, Xi Ruoyao <xry111@xry111.site> Subject: [PATCH v3 10/29] LoongArch: KVM: Implement vcpu ENABLE_CAP ioctl interface Date: Tue, 28 Feb 2023 15:00:37 +0800 Message-Id: <20230228070057.3687180-11-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230228070057.3687180-1-zhaotianrui@loongson.cn> References: <20230228070057.3687180-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Bxc+Wppv1jPG9AAA--.15462S12 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Zw4fJr4xJrWUJF1rAr1kKrg_yoW8JFy3pF srC3s0qr4rJ3yxWwnxtws5Wr1aqrWkKr4xZF9Fq3y5AF42kry5GF4FkrWDAFW5tw4rGF1S qw1rt3Wj9Fs8ZwUanT9S1TB71UUUUjDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bx8Fc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wA2ocxC64kIII0Yj41l84x0c7CEw4 AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF 7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aV CY1x0267AKxVW8Jr0_Cr1UM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487 Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VCjz48v1s IEY20_WwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_ JF0_Jw1l42xK82IYc2Ij64vIr41l42xK82IY6x8ErcxFaVAv8VWrMxC20s026xCaFVCjc4 AY6r1j6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCj r7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6x IIjxv20xvE14v26w1j6s0DMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWxJVW8Jr1lIxAIcVC2z280aV CY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0zR9iSdUUUUU= X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759057263527432749?= X-GMAIL-MSGID: =?utf-8?q?1759057263527432749?= |
Series |
Add KVM LoongArch support
|
|
Commit Message
zhaotianrui
Feb. 28, 2023, 7 a.m. UTC
Implement loongarch vcpu KVM_ENABLE_CAP ioctl interface.
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
---
arch/loongarch/kvm/vcpu.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index dce89ace2750..06d5c79e73ba 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -356,6 +356,23 @@ 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) +{ + int r = 0; + + if (!kvm_vm_ioctl_check_extension(vcpu->kvm, cap->cap)) + return -EINVAL; + if (cap->flags) + return -EINVAL; + if (cap->args[0]) + return -EINVAL; + if (cap->cap) + return -EINVAL; + + return r; +} + long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { @@ -379,6 +396,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;