From patchwork Wed Feb 8 14:01:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 54437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3473569wrn; Wed, 8 Feb 2023 06:06:13 -0800 (PST) X-Google-Smtp-Source: AK7set/G34QHpF3cGwNNCg60I6ASObPKJRB1FrV57ueMrcOXUOI5Jti2JsDYamdyNq9xuFxniWEG X-Received: by 2002:a17:906:2216:b0:8ad:52df:86de with SMTP id s22-20020a170906221600b008ad52df86demr2345619ejs.7.1675865173730; Wed, 08 Feb 2023 06:06:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865173; cv=none; d=google.com; s=arc-20160816; b=iGV7H5kKa3uBWzB15QSqt+oYCB3UHOpZ04RLwuYvwlZWLKeayLMFnE/kl2YogGJhOh gAvyeDPylKnpdDbsb4/wnnjKzkQPJSJr3Zu88P0gg/Hb2gA7E/wL6HbcDKa8x+do09LY vNYjTXj2XAK7x3KhWE+GHUPc0YbQWQN+L5oz2AsE5772lETuUeVZNBWmm1jH1TcCFRkj NTbLJaQ6rmBb+/JLVGhF6cQpE1qdZsDgd0keaQ0EWJTlYBTAIE7f4ZDfyFz+UmGPg6Do JMTwmZB0fxGsBFCiWIGCSQzo0Uyrlo0dzDWTtaRwRLu71Hve6BcXZPyMRsUI+J/Q83uE /61w== 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 :dkim-signature; bh=xaX8AFU4eXpjF5vFLIr2G/vAGGTB312aKfxgXhyjr+Q=; b=gFItvutidNOiulVcO2q8AnjpJwKcEJkWm9iIG/hkrbkBpGzG/9s53HV237lZ9Ktdaj N34BA+Pn9p/mVkaNU94kL7EO94M+laptKOtGdyk03cmqmOt7PGAvxbnEk4U7xzzMDnFz GZsWKiYCkf3ndwVmsJvsQjDMWpTAoZ/4tRQlHFeoH2qcsbXCrwPz7mkm+FuQc/VNPKOk SVX+YiM3KVYXRswmF9r7BE7FDfbnhMdSgBmIPKJ1jCTZAf53a52HyXRvjV+QiTqqWMa6 UlMkVBadhsyALZELaKmjFz3WcTjOpXoFfsWkGwlYGDCTZJBaOn3OIIox206fciM1jV7I CEHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fO8bdoKL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 29-20020a170906009d00b0088767839e39si28105558ejc.72.2023.02.08.06.05.49; Wed, 08 Feb 2023 06:06: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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fO8bdoKL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230482AbjBHOCW (ORCPT + 99 others); Wed, 8 Feb 2023 09:02:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbjBHOCU (ORCPT ); Wed, 8 Feb 2023 09:02:20 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA7726B4 for ; Wed, 8 Feb 2023 06:01:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675864891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xaX8AFU4eXpjF5vFLIr2G/vAGGTB312aKfxgXhyjr+Q=; b=fO8bdoKLTyX+xQxx0Y+iXhXvrixZZT4FYlppxtn8iEcgRMF2z5Md3Vliy1ZZzuo6I/7Xba AM9vjoLfrsPFlFGj+EB9ESjC4pXhuVX3nhEeCnwjGPen3UtVDcXqFWJdZ6WQP1L+R2F92N I6/xfS9KtKHG5WinmdiW/UF4BOjrfWU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-626-ewBUSS54Nx6yfoiILEwowg-1; Wed, 08 Feb 2023 09:01:28 -0500 X-MC-Unique: ewBUSS54Nx6yfoiILEwowg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF29F824018; Wed, 8 Feb 2023 14:01:23 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 146481415113; Wed, 8 Feb 2023 14:01:19 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christian Borntraeger , Janosch Frank , David Hildenbrand , Gavin Shan , Steven Price , Cornelia Huck Subject: [PATCH v2 1/6] KVM: PPC: Standardize on "int" return types in the powerpc KVM code Date: Wed, 8 Feb 2023 15:01:00 +0100 Message-Id: <20230208140105.655814-2-thuth@redhat.com> In-Reply-To: <20230208140105.655814-1-thuth@redhat.com> References: <20230208140105.655814-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1757272000613707135?= X-GMAIL-MSGID: =?utf-8?q?1757272000613707135?= Most functions that are related to kvm_arch_vm_ioctl() already use "int" as return type to pass error values back to the caller. Some outlier functions use "long" instead for no good reason (they do not really require long values here). Let's standardize on "int" here to avoid casting the values back and forth between the two types. Reviewed-by: Nicholas Piggin Signed-off-by: Thomas Huth --- arch/powerpc/include/asm/kvm_ppc.h | 14 +++++++------- arch/powerpc/kvm/book3s_64_mmu_hv.c | 14 +++++++------- arch/powerpc/kvm/book3s_64_vio.c | 4 ++-- arch/powerpc/kvm/book3s_hv.c | 6 +++--- arch/powerpc/kvm/book3s_pr.c | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index eae9619b6190..41ab4ebdc1ee 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -157,7 +157,7 @@ extern void kvmppc_map_magic(struct kvm_vcpu *vcpu); extern int kvmppc_allocate_hpt(struct kvm_hpt_info *info, u32 order); extern void kvmppc_set_hpt(struct kvm *kvm, struct kvm_hpt_info *info); -extern long kvmppc_alloc_reset_hpt(struct kvm *kvm, int order); +extern int kvmppc_alloc_reset_hpt(struct kvm *kvm, int order); extern void kvmppc_free_hpt(struct kvm_hpt_info *info); extern void kvmppc_rmap_reset(struct kvm *kvm); extern void kvmppc_map_vrma(struct kvm_vcpu *vcpu, @@ -171,7 +171,7 @@ extern int kvmppc_switch_mmu_to_hpt(struct kvm *kvm); extern int kvmppc_switch_mmu_to_radix(struct kvm *kvm); extern void kvmppc_setup_partition_table(struct kvm *kvm); -extern long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, +extern int kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, struct kvm_create_spapr_tce_64 *args); #define kvmppc_ioba_validate(stt, ioba, npages) \ (iommu_tce_check_ioba((stt)->page_shift, (stt)->offset, \ @@ -212,10 +212,10 @@ extern void kvmppc_bookehv_exit(void); extern int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu); extern int kvm_vm_ioctl_get_htab_fd(struct kvm *kvm, struct kvm_get_htab_fd *); -extern long kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm, - struct kvm_ppc_resize_hpt *rhpt); -extern long kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm, +extern int kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm, struct kvm_ppc_resize_hpt *rhpt); +extern int kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm, + struct kvm_ppc_resize_hpt *rhpt); int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq); @@ -287,8 +287,8 @@ struct kvmppc_ops { int (*emulate_mtspr)(struct kvm_vcpu *vcpu, int sprn, ulong spr_val); int (*emulate_mfspr)(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val); void (*fast_vcpu_kick)(struct kvm_vcpu *vcpu); - long (*arch_vm_ioctl)(struct file *filp, unsigned int ioctl, - unsigned long arg); + int (*arch_vm_ioctl)(struct file *filp, unsigned int ioctl, + unsigned long arg); int (*hcall_implemented)(unsigned long hcall); int (*irq_bypass_add_producer)(struct irq_bypass_consumer *, struct irq_bypass_producer *); diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 7006bcbc2e37..1f4896de58ca 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c @@ -124,9 +124,9 @@ void kvmppc_set_hpt(struct kvm *kvm, struct kvm_hpt_info *info) info->virt, (long)info->order, kvm->arch.lpid); } -long kvmppc_alloc_reset_hpt(struct kvm *kvm, int order) +int kvmppc_alloc_reset_hpt(struct kvm *kvm, int order) { - long err = -EBUSY; + int err = -EBUSY; struct kvm_hpt_info info; mutex_lock(&kvm->arch.mmu_setup_lock); @@ -1468,8 +1468,8 @@ static void resize_hpt_prepare_work(struct work_struct *work) mutex_unlock(&kvm->arch.mmu_setup_lock); } -long kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm, - struct kvm_ppc_resize_hpt *rhpt) +int kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm, + struct kvm_ppc_resize_hpt *rhpt) { unsigned long flags = rhpt->flags; unsigned long shift = rhpt->shift; @@ -1534,13 +1534,13 @@ static void resize_hpt_boot_vcpu(void *opaque) /* Nothing to do, just force a KVM exit */ } -long kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm, - struct kvm_ppc_resize_hpt *rhpt) +int kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm, + struct kvm_ppc_resize_hpt *rhpt) { unsigned long flags = rhpt->flags; unsigned long shift = rhpt->shift; struct kvm_resize_hpt *resize; - long ret; + int ret; if (flags != 0 || kvm_is_radix(kvm)) return -EINVAL; diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 95e738ef9062..93b695b289e9 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/kvm/book3s_64_vio.c @@ -288,8 +288,8 @@ static const struct file_operations kvm_spapr_tce_fops = { .release = kvm_spapr_tce_release, }; -long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, - struct kvm_create_spapr_tce_64 *args) +int kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, + struct kvm_create_spapr_tce_64 *args) { struct kvmppc_spapr_tce_table *stt = NULL; struct kvmppc_spapr_tce_table *siter; diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 6ba68dd6190b..cd139a1edc67 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -5779,12 +5779,12 @@ static void kvmppc_irq_bypass_del_producer_hv(struct irq_bypass_consumer *cons, } #endif -static long kvm_arch_vm_ioctl_hv(struct file *filp, - unsigned int ioctl, unsigned long arg) +static int kvm_arch_vm_ioctl_hv(struct file *filp, + unsigned int ioctl, unsigned long arg) { struct kvm *kvm __maybe_unused = filp->private_data; void __user *argp = (void __user *)arg; - long r; + int r; switch (ioctl) { diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 9fc4dd8f66eb..5908b514bfb6 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -2042,8 +2042,8 @@ static int kvmppc_core_check_processor_compat_pr(void) return 0; } -static long kvm_arch_vm_ioctl_pr(struct file *filp, - unsigned int ioctl, unsigned long arg) +static int kvm_arch_vm_ioctl_pr(struct file *filp, + unsigned int ioctl, unsigned long arg) { return -ENOTTY; } From patchwork Wed Feb 8 14:01:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 54439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3474802wrn; Wed, 8 Feb 2023 06:08:01 -0800 (PST) X-Google-Smtp-Source: AK7set9UilRW65UWSW2UteIjqKiFJ7vTyc/a8A9KKxgxCVDP9hUjukf2aJF1s5maESH/PqcUP4eT X-Received: by 2002:a17:903:182:b0:198:a5d9:f2fd with SMTP id z2-20020a170903018200b00198a5d9f2fdmr7933939plg.6.1675865281021; Wed, 08 Feb 2023 06:08:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865281; cv=none; d=google.com; s=arc-20160816; b=Ke/ePNnVRNMVd3hkQG3syeYS5prya+FyE2xaPqj/zqRJpruExL/65DdmuWodwTJCt7 4FMfKtFiNv4/YdluKBFMR0AyInJEMAYeCvjCK44Q7YIeLP7XDS3nZSvNbhv5OrzWpKeu tmQcltyGhXC0M5UWKo5Rvr83voJDb6SQQP+nMMecgvQ5OU816uG32u0RSHlxCSOzdH1q YDoWjkASg40QMXbcQpEBRCDwX6XuCRLbac01xK6f0MwIhbsPO0SCxC2+UzAZA45ZC2mh SvuLT41izUb3PKe685aBtoOVkBmTCsv97cgiMz1FBYjoauu2Sxh4hh8QtNGtG1F5A/TJ S6ww== 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 :dkim-signature; bh=4X4nxs/AN1rQvZNEYHxdhff0S/jWHe5xhYhoJC/1QMM=; b=fPZP7SixR8ORyivqkvmDTuZQEESUeHzxrDZg8/0Whyhf4Zx6foCp7LXWpBEuGWPtlx nljnCZvwqF/+NXfGxZpMiuACmxUXipiUR0K9BM0kwEOYj7hvqC0r3wEjbW6fvX2yR+1M WM9xxgAnxNdOSOmXhN/MhD83IZZYwkTxiFLMWJsbZ+n6r24Hiu7Z4rh6jzPIW7eFAzdG +PFITojlSNn08pbiamfq9NM6ouE/Y3socE3QgphQvX1UHXVdh+efoZPIMJDT6PQApkmk GI0mCd2ANmfjWSj+IibXwAQHSX/G+DheK3YYWUgeHRwsKH22zgMrm+LQ4+xf47J4ZYyY Dlxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hCUN2Uko; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170903234900b001968a5d4107si19939158plh.398.2023.02.08.06.07.43; Wed, 08 Feb 2023 06:08:01 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hCUN2Uko; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231328AbjBHOC2 (ORCPT + 99 others); Wed, 8 Feb 2023 09:02:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230462AbjBHOCV (ORCPT ); Wed, 8 Feb 2023 09:02:21 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8F3CDD1 for ; Wed, 8 Feb 2023 06:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675864893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4X4nxs/AN1rQvZNEYHxdhff0S/jWHe5xhYhoJC/1QMM=; b=hCUN2UkoLVPZn0mrYopk5vX+UyFzmMQp7r/Enqn1knnVtqxdjiID0QkprulfFYrZkB/HlJ BN1gq7lpUm0atyc194gvIZQzEVK24QbaxmX4SK3XzwWAFL2b4qIFKmxc4As+550sJ7zi5x IW+DEQNGvTfG3tFh23dN9ZxOy5MvktE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-231-0le-469XNuOSE0B5UwIJIw-1; Wed, 08 Feb 2023 09:01:30 -0500 X-MC-Unique: 0le-469XNuOSE0B5UwIJIw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5C6C6823E1B; Wed, 8 Feb 2023 14:01:27 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 464F31415113; Wed, 8 Feb 2023 14:01:24 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christian Borntraeger , Janosch Frank , David Hildenbrand , Gavin Shan , Steven Price , Cornelia Huck Subject: [PATCH v2 2/6] KVM: s390: Use "int" as return type for kvm_s390_get/set_skeys() Date: Wed, 8 Feb 2023 15:01:01 +0100 Message-Id: <20230208140105.655814-3-thuth@redhat.com> In-Reply-To: <20230208140105.655814-1-thuth@redhat.com> References: <20230208140105.655814-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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?1757272112649845966?= X-GMAIL-MSGID: =?utf-8?q?1757272112649845966?= These two functions only return normal integers, so it does not make sense to declare the return type as "long" here. Reviewed-by: Claudio Imbrenda Signed-off-by: Thomas Huth --- arch/s390/kvm/kvm-s390.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index e4890e04b210..8ad1972b8a73 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -1992,7 +1992,7 @@ static int kvm_s390_vm_has_attr(struct kvm *kvm, struct kvm_device_attr *attr) return ret; } -static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) +static int kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) { uint8_t *keys; uint64_t hva; @@ -2040,7 +2040,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) return r; } -static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) +static int kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) { uint8_t *keys; uint64_t hva; From patchwork Wed Feb 8 14:01:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 54441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3475438wrn; Wed, 8 Feb 2023 06:09:00 -0800 (PST) X-Google-Smtp-Source: AK7set+BP0bVp2N6Ljx0G6nl30FrOQSvIA2m3lHIcu3DVGaVxzLvCp4ZA+6IeSPK9mpqEOpIcJac X-Received: by 2002:a17:906:5185:b0:8ae:ea08:3842 with SMTP id y5-20020a170906518500b008aeea083842mr1201456ejk.7.1675865340667; Wed, 08 Feb 2023 06:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865340; cv=none; d=google.com; s=arc-20160816; b=PQjQucP8wdrwEyknJ7r825PL0hAMoOcA7IFSvSCtxcdYyQDai3olm6AMIGMskIKPzQ iGZHrLYxxLZ85Imfs6cRsEGjGY9ASlClGV5Y/7FsgVI6FSgKp5vTcGH2SWJndH4IS1vu 4deabPVBP6YH4bto15PEyeyypoLYIuYulb4i5CU2DFEy8SfIQaqy3GN/NRK7Wow+X23g juYkNz3X+yvPx4Xxa0tNxj/tbJxr/MALyKluLX1O5gkMZyIFGosM/qHLPU+gQgmQ2ilx /INzlpKZIZ4EjU6YuRRzzr5XhE23cqCuJap9DBPNjFU5oBPfOxSTwxkP4K+otbUiFMtW ImIA== 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 :dkim-signature; bh=LLoh5TBX9JIZXNzcUIXGAY+PkQJYUmsvSDRrT4/hutQ=; b=0+jqrSMZB2FmuAmV4NybyVFeXF/hE3zuwTgL/rCNDyvMXk93YpyMUvhrtVfgHYOOIN E25/xszSNs9fB9RDRdhkmUso3VaoLzZYx0sgj9wn6aUD0hnfF40eI8mPnDk3mA2x/gQT GP8z5s+LP5QtPzBmBNgI05v51Djatf838KSXj3nOjsV9seGKEkdvk63Dt4WgNpNT3AM9 PgBcP7m3GMiAHVN5+xqHXSarqViWAjSniCTL3QSLVqys0B5v/zNnYtohLGuuPpbYypE7 iVoRMg6UZirhEHCobIcH3+sD+thf29mrhnKz9VxaCxYAGglATdMRMiLm0heLj3p8gpfX 99Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NxHCjo0/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eq23-20020a170907291700b008976e610574si14118793ejc.114.2023.02.08.06.08.34; Wed, 08 Feb 2023 06:09:00 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NxHCjo0/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231202AbjBHODD (ORCPT + 99 others); Wed, 8 Feb 2023 09:03:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbjBHODB (ORCPT ); Wed, 8 Feb 2023 09:03:01 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB6630E80 for ; Wed, 8 Feb 2023 06:01:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675864898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LLoh5TBX9JIZXNzcUIXGAY+PkQJYUmsvSDRrT4/hutQ=; b=NxHCjo0/8389IM6XPTMRPbCuMUgjdvVjHSbnS1B2ZFrpzq7DcaF2ZRZHiBhYDj1GjByLBe 7/lDLJ8XmW5HS4d0Jt6I1weJyUAETb4CH68MLDJZmPva6PCl8RKkZqZeqFV79Ccjeqdsxi I3xt3VXtWmjdvc2kjYzXZTMa6OphZjU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-MhELPkxDNaajK6CI6PJt4A-1; Wed, 08 Feb 2023 09:01:34 -0500 X-MC-Unique: MhELPkxDNaajK6CI6PJt4A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B55318057A6; Wed, 8 Feb 2023 14:01:30 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F86C1415113; Wed, 8 Feb 2023 14:01:27 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christian Borntraeger , Janosch Frank , David Hildenbrand , Gavin Shan , Steven Price , Cornelia Huck Subject: [PATCH v2 3/6] KVM: x86: Remove the KVM_GET_NR_MMU_PAGES ioctl Date: Wed, 8 Feb 2023 15:01:02 +0100 Message-Id: <20230208140105.655814-4-thuth@redhat.com> In-Reply-To: <20230208140105.655814-1-thuth@redhat.com> References: <20230208140105.655814-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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?1757272175346046453?= X-GMAIL-MSGID: =?utf-8?q?1757272175346046453?= The KVM_GET_NR_MMU_PAGES ioctl is quite questionable on 64-bit hosts since it fails to return the full 64 bits of the value that can be set with the corresponding KVM_SET_NR_MMU_PAGES call. Its "long" return value is truncated into an "int" in the kvm_arch_vm_ioctl() function. Since this ioctl also never has been used by userspace applications (QEMU, Google's internal VMM, kvmtool and CrosVM have been checked), it's likely the best if we remove this badly designed ioctl before anybody really tries to use it. Signed-off-by: Thomas Huth Reviewed-by: Sean Christopherson --- arch/x86/kvm/x86.c | 8 -------- include/uapi/linux/kvm.h | 2 +- tools/include/uapi/linux/kvm.h | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index da4bbd043a7b..2d210ab47e21 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6007,11 +6007,6 @@ static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm, return 0; } -static unsigned long kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm) -{ - return kvm->arch.n_max_mmu_pages; -} - static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip) { struct kvm_pic *pic = kvm->arch.vpic; @@ -6689,9 +6684,6 @@ long kvm_arch_vm_ioctl(struct file *filp, case KVM_SET_NR_MMU_PAGES: r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg); break; - case KVM_GET_NR_MMU_PAGES: - r = kvm_vm_ioctl_get_nr_mmu_pages(kvm); - break; case KVM_CREATE_IRQCHIP: { mutex_lock(&kvm->lock); diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 55155e262646..59dc7e5d4974 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1442,7 +1442,7 @@ struct kvm_vfio_spapr_tce { #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) -#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) +#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) /* deprecated */ #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ struct kvm_userspace_memory_region) #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h index 55155e262646..59dc7e5d4974 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h @@ -1442,7 +1442,7 @@ struct kvm_vfio_spapr_tce { #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) -#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) +#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) /* deprecated */ #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ struct kvm_userspace_memory_region) #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) From patchwork Wed Feb 8 14:01:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 54438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3473920wrn; Wed, 8 Feb 2023 06:06:44 -0800 (PST) X-Google-Smtp-Source: AK7set/1Cw7DsSKjkaEQrUp2dIipT52GKHhU1S98OqU2v69PPJI1cxbHhl5I+rkwgTMJHUcbpJwc X-Received: by 2002:a17:906:1da:b0:8ae:e5e2:2418 with SMTP id 26-20020a17090601da00b008aee5e22418mr1449670ejj.6.1675865204245; Wed, 08 Feb 2023 06:06:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865204; cv=none; d=google.com; s=arc-20160816; b=J2r/iHwuAQvd61f0X59D5mdCdgoHxd94kQH74sdTT4MmkXws+RxQVY+S1VuqOLM2gP 3E/k/H5vn+r4DZCMjzTOrLDI8i65gEgO0GJhW2L/F4aJ3X5ubsQGDTzDn/kB7y5acSpt By5ZoCaEG5yjzxZ+F+oYWXXr5niCQMCZCCdwb2cL2BNGOPc6474eoULhExiqqVsjVvU1 mCwNPfRrXdIVOI+HRt3u3b+m9+Rb8n28UDhDrO5yPBSpGdYFdrX4X6eIR8g2p8k9HBvT PM038d46D7oz4ittF0GwhaKYggUlFkhrAVUjoXdv0MU4GNNHhM3WzuOsFQno483OACjy PE5Q== 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 :dkim-signature; bh=Xhdyz5Hmwdmj1kqpk54W2jx2hLYYhCxWxV7IaOPuFFU=; b=y4Cq2tmtM1aclQR3zYNuSICP41mh2AcM/8DuKKLMppV7ax1ZUpaOQTO83cjdzYioFl Z0AnMCK1C8ST00zKeOE6sPWHn3II2nG3cFjpKd1r7duacK6DAy3cZSzMbCZUDOge8ds6 4Y2STaA4XxVJjBRuFf+GXg/I7LuQr6dp+EXU2+9VXrpu6sJcp5c7MpYswcPYQuoC+eWy rg11bcYihizfXzCNGseQNi7/9tD1pHVQAUjLHsZcIusMjJgVP8ULKh2X3mOj4mZXdFWx vnvQYRf8mniRqnAonWJWUZjhQpkIIJDv2VhN61Ioyjk6/X6I/PQxA+MqWOHs+tkOHNWe iBzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DQ2LY7vC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a17090668ce00b007c18d5fe293si22255326ejr.651.2023.02.08.06.06.12; Wed, 08 Feb 2023 06:06:44 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DQ2LY7vC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231146AbjBHODB (ORCPT + 99 others); Wed, 8 Feb 2023 09:03:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbjBHOC7 (ORCPT ); Wed, 8 Feb 2023 09:02:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8042D3A868 for ; Wed, 8 Feb 2023 06:01:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675864898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xhdyz5Hmwdmj1kqpk54W2jx2hLYYhCxWxV7IaOPuFFU=; b=DQ2LY7vCzvFOV6jWmhElnp7wWQ130CMGjgubBjUBU1H7Vwd/BUGtY3qm43Q4YDeZdOMmdA 08+CY2kgE25a5tf4He/fB0z0d+vfsEMceqSKq14tOMGTxonQSpHEeRC7YjqT2x5xrt3b+r Jjb0xLZAaias+LNF4aYjwyaRIRj0EpY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-456-HxcK6KbQMha2osLbIj2ioA-1; Wed, 08 Feb 2023 09:01:36 -0500 X-MC-Unique: HxcK6KbQMha2osLbIj2ioA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 48E253C10687; Wed, 8 Feb 2023 14:01:34 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0863B1415113; Wed, 8 Feb 2023 14:01:30 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christian Borntraeger , Janosch Frank , David Hildenbrand , Gavin Shan , Steven Price , Cornelia Huck Subject: [PATCH v2 4/6] KVM: arm64: Limit length in kvm_vm_ioctl_mte_copy_tags() to INT_MAX Date: Wed, 8 Feb 2023 15:01:03 +0100 Message-Id: <20230208140105.655814-5-thuth@redhat.com> In-Reply-To: <20230208140105.655814-1-thuth@redhat.com> References: <20230208140105.655814-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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?1757272032584039989?= X-GMAIL-MSGID: =?utf-8?q?1757272032584039989?= In case of success, this function returns the amount of handled bytes. However, this does not work for large values: The function is called from kvm_arch_vm_ioctl() (which still returns a long), which in turn is called from kvm_vm_ioctl() in virt/kvm/kvm_main.c. And that function stores the return value in an "int r" variable. So the upper 32-bits of the "long" return value are lost there. KVM ioctl functions should only return "int" values, so let's limit the amount of bytes that can be requested here to INT_MAX to avoid the problem with the truncated return value. We can then also change the return type of the function to "int" to make it clearer that it is not possible to return a "long" here. Fixes: f0376edb1ddc ("KVM: arm64: Add ioctl to fetch/store tags in a guest") Signed-off-by: Thomas Huth Reviewed-by: Steven Price Reviewed-by: Cornelia Huck Reviewed-by: Gavin Shan --- Documentation/virt/kvm/api.rst | 3 ++- arch/arm64/include/asm/kvm_host.h | 4 ++-- arch/arm64/kvm/guest.c | 8 ++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 0a67cb738013..f184427931fa 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -5553,7 +5553,8 @@ with the KVM_XEN_VCPU_GET_ATTR ioctl. }; Copies Memory Tagging Extension (MTE) tags to/from guest tag memory. The -``guest_ipa`` and ``length`` fields must be ``PAGE_SIZE`` aligned. The ``addr`` +``guest_ipa`` and ``length`` fields must be ``PAGE_SIZE`` aligned. +``length`` must not be bigger than 2^31 - PAGE_SIZE bytes. The ``addr`` field must point to a buffer which the tags will be copied to or from. ``flags`` specifies the direction of copy, either ``KVM_ARM_TAGS_TO_GUEST`` or diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 35a159d131b5..b1a16343767f 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -963,8 +963,8 @@ int kvm_arm_vcpu_arch_get_attr(struct kvm_vcpu *vcpu, int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); -long kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm, - struct kvm_arm_copy_mte_tags *copy_tags); +int kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm, + struct kvm_arm_copy_mte_tags *copy_tags); /* Guest/host FPSIMD coordination helpers */ int kvm_arch_vcpu_run_map_fp(struct kvm_vcpu *vcpu); diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index cf4c495a4321..cadef953046f 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -1013,8 +1013,8 @@ int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu, return ret; } -long kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm, - struct kvm_arm_copy_mte_tags *copy_tags) +int kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm, + struct kvm_arm_copy_mte_tags *copy_tags) { gpa_t guest_ipa = copy_tags->guest_ipa; size_t length = copy_tags->length; @@ -1035,6 +1035,10 @@ long kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm, if (length & ~PAGE_MASK || guest_ipa & ~PAGE_MASK) return -EINVAL; + /* Lengths above INT_MAX cannot be represented in the return value */ + if (length > INT_MAX) + return -EINVAL; + gfn = gpa_to_gfn(guest_ipa); mutex_lock(&kvm->slots_lock); From patchwork Wed Feb 8 14:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 54442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3475593wrn; Wed, 8 Feb 2023 06:09:16 -0800 (PST) X-Google-Smtp-Source: AK7set9oLmN0GwmUML4fOTDXsOojpIweRT4Rgilt1L7gyez0kM3WMZ0L+VK8vU99uhD+g/5Zh62P X-Received: by 2002:a05:6a20:7f94:b0:b8:b9e7:6d4 with SMTP id d20-20020a056a207f9400b000b8b9e706d4mr10230784pzj.0.1675865356347; Wed, 08 Feb 2023 06:09:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865356; cv=none; d=google.com; s=arc-20160816; b=Zne8mq+MNm/ntQ+DX2CA2FgS/XcFlv/Q4l5PVJVmuVhfVDvN/QDeUxz/RKkKZ6H9So pxvWnNKSXfGxha73WmaUM5EK0+z5BnNTfiZkVdhDcVuSJAaCw23aINvaWESA6p/XnYJ6 SmsTzxTR1NlbRhLDbXpWsxdMU+CX5vlAQ3LsiRrsVMPjFuXuLDHyljfKaesK/xbCc6F9 re36cQ3Ain3RtBzqiY9ThaJtq6WFlOSbuW0Qti6taXh0qPR9akgv39sLw3TnyCFhfZ3D oMWaBzUZsJzj+Hsr7R1bo+8m9FaGlj557/qK5h8qsIWc3Nrw8CxzXeYiUUjiERZMDwlV VN+g== 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 :dkim-signature; bh=B/oxBv4GyMlmg4LCOb2+pqMxLhVHvEGbOFN4G7DG1xk=; b=0n4rvWycjdH+WAWPkS8ph/2nRgHIlk3DjKikGkx3SQ5WIitKoyDQu70JBRkj48wpAS 9MLbTG61ipAFLzHdAkv/kX0u90842OGpJjeMaoJHNvDhD5Vs6Cc0SJgeZN2Mx8rCv4W5 yoS5xNWx8NfetS11n/Ftpww5t52oJ7oPPUrpzfJ3tgdwH1HCg5MCsHdOLHEWNgQKJFUt J5mWpbVZvTX9J5cWq1nQTgTJdJrgmeh6XI3WD1ZQ9fmstLlRpvleLBQeQIaEgFZLBVnC i07FNpQgELQVD8fb6fGRsZ5CVNvj3GW/Ok9zExdoxAkyAH3iGVkBu+B9QqEkbgREDcNT 8WtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DBSYPXxa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a633e0d000000b004fb14c87db5si5917887pga.228.2023.02.08.06.09.02; Wed, 08 Feb 2023 06:09:16 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DBSYPXxa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230498AbjBHODP (ORCPT + 99 others); Wed, 8 Feb 2023 09:03:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231395AbjBHODG (ORCPT ); Wed, 8 Feb 2023 09:03:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B23E741092 for ; Wed, 8 Feb 2023 06:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675864901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B/oxBv4GyMlmg4LCOb2+pqMxLhVHvEGbOFN4G7DG1xk=; b=DBSYPXxaOpceWBdCD02s8sjLYG7xOAqnVPy/VB1WFkyUfEZg/jQ3jabpIfiGt51gxlTujf WPmU6elDPeCw/wB2PUyRj1Q5sGdY/NxBwr+6qOBM0ZDzEidAquuYSS4m0mkIykdyfsAEgS em15pOISGZVNdrC2tmS34AsFnBl6fUU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-175-lS0izmB0OKqVYfkJTapWdw-1; Wed, 08 Feb 2023 09:01:39 -0500 X-MC-Unique: lS0izmB0OKqVYfkJTapWdw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 627871C08976; Wed, 8 Feb 2023 14:01:38 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 976E8140EBF4; Wed, 8 Feb 2023 14:01:34 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christian Borntraeger , Janosch Frank , David Hildenbrand , Gavin Shan , Steven Price , Cornelia Huck Subject: [PATCH v2 5/6] KVM: Standardize on "int" return types instead of "long" in kvm_main.c Date: Wed, 8 Feb 2023 15:01:04 +0100 Message-Id: <20230208140105.655814-6-thuth@redhat.com> In-Reply-To: <20230208140105.655814-1-thuth@redhat.com> References: <20230208140105.655814-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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?1757272192192435063?= X-GMAIL-MSGID: =?utf-8?q?1757272192192435063?= KVM functions use "long" return values for functions that are wired up to "struct file_operations", but otherwise use "int" return values for functions that can return 0/-errno in order to avoid unintentional divergences between 32-bit and 64-bit kernels. Some code still uses "long" in unnecessary spots, though, which can cause a little bit of confusion and unnecessary size casts. Let's change these spots to use "int" types, too. Signed-off-by: Thomas Huth --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 9c60384b5ae0..cd46467252a9 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4475,7 +4475,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm, return 0; } -static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) +static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) { switch (arg) { case KVM_CAP_USER_MEMORY: @@ -5053,7 +5053,7 @@ static int kvm_dev_ioctl_create_vm(unsigned long type) static long kvm_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { - long r = -EINVAL; + int r = -EINVAL; switch (ioctl) { case KVM_GET_API_VERSION: From patchwork Wed Feb 8 14:01:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 54440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3474853wrn; Wed, 8 Feb 2023 06:08:07 -0800 (PST) X-Google-Smtp-Source: AK7set+oBdF7+O/zSfDZIs9c2Ys1NVvoctWQWdBY4MXTP3YH+uzLStxhgHJ1iJw11nNJVp4aSsbQ X-Received: by 2002:a05:6a20:7f94:b0:b8:b9e7:6d4 with SMTP id d20-20020a056a207f9400b000b8b9e706d4mr10225776pzj.0.1675865286785; Wed, 08 Feb 2023 06:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865286; cv=none; d=google.com; s=arc-20160816; b=WIDlE0ltCVvds50eWYZrBkguHPmU3tReEL5fz/4LGbHEDjOnArzE/lG2cHISjMvQB5 +1IRWrve90uGDaOSk8BnNHb3YMHvhfJVyKTCvvnueI3Bela5f7VHrO5LXLp/4Dmswy7e WHHT5saOonxsymUDAawYccPuWiAmOim9G9S1F4TfKUtexPupftuRC9s8tWN0Zh9YPkbA cF9OeOPKmPYcvL0NhWCdthlfSZs+ssCmeMojvSfBAvAih0ilhiL/RSJBCIEOSNz6d140 MQo6BSkBmYBmNHLZ8+NK+USi8zjVUv3pTWpFRvvWAU/BZwesdwrmaQgXHGdAVR7Ccewg 447Q== 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 :dkim-signature; bh=6/nsobX2ruZfUuZDf5t48MOb356vKr1L1ibFdLfAXYU=; b=OnHfGdIec8PWL0WXBFDaMjwcwGI/tesIqCx86SsvGAE4OetO6+MMQZnhzBuM4HTjM4 e8AHO6HbW9WHPWu+0txlgQ5Os2cjVPdVybqKGAXbvaov5ZWg5hUdSfm1JUxNlkxbaDu5 at1mtmTrdA5BEeAez1aTH7LRsy83bI+6uiA7akEu4AzhyEm+PLLpX+GuN8Pljx6avKj6 hxl6oKUHByjvT0f13vW05ap64CzpXlDss75blw35xaiM/syfOzh6obCAPk7llkShJwCR rmof008elpOlN99j836du18/L8rDNIiCKOl7x3pPo6scBepDIHf5PravvC9t0/cnZ3BN wLPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RnAqGrjz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i187-20020a639dc4000000b004f1437ceb14si17354270pgd.287.2023.02.08.06.07.49; Wed, 08 Feb 2023 06:08:06 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RnAqGrjz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231402AbjBHODM (ORCPT + 99 others); Wed, 8 Feb 2023 09:03:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231392AbjBHODG (ORCPT ); Wed, 8 Feb 2023 09:03:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066C53C3E for ; Wed, 8 Feb 2023 06:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675864908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6/nsobX2ruZfUuZDf5t48MOb356vKr1L1ibFdLfAXYU=; b=RnAqGrjz0rgy0RAL5sDEB48qhdLkudV6vUB7v6Ft5sUm+1u0otZfThWrrK6df/v7aAZ3oa dJkoPZY1/h0VZ0mObYmMdoeakG8P46E7yhcxsGH/98KuguI6t1lxvZXc3akHV7hBnyknsv 6/5avGGvl+3Pjwo/nQ2wa+p/tpMODKI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-PFqbRkqyPz6WJTX1JMymZg-1; Wed, 08 Feb 2023 09:01:44 -0500 X-MC-Unique: PFqbRkqyPz6WJTX1JMymZg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2281E885622; Wed, 8 Feb 2023 14:01:42 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6398140EBF4; Wed, 8 Feb 2023 14:01:38 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christian Borntraeger , Janosch Frank , David Hildenbrand , Gavin Shan , Steven Price , Cornelia Huck Subject: [PATCH v2 6/6] KVM: Change return type of kvm_arch_vm_ioctl() to "int" Date: Wed, 8 Feb 2023 15:01:05 +0100 Message-Id: <20230208140105.655814-7-thuth@redhat.com> In-Reply-To: <20230208140105.655814-1-thuth@redhat.com> References: <20230208140105.655814-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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?1757272119316546726?= X-GMAIL-MSGID: =?utf-8?q?1757272119316546726?= All kvm_arch_vm_ioctl() implementations now only deal with "int" types as return values, so we can change the return type of these functions to use "int" instead of "long". Signed-off-by: Thomas Huth Acked-by: Anup Patel --- arch/arm64/kvm/arm.c | 3 +-- arch/mips/kvm/mips.c | 4 ++-- arch/powerpc/kvm/powerpc.c | 5 ++--- arch/riscv/kvm/vm.c | 3 +-- arch/s390/kvm/kvm-s390.c | 3 +-- arch/x86/kvm/x86.c | 3 +-- include/linux/kvm_host.h | 3 +-- 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 9c5573bc4614..e791ad6137b8 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1449,8 +1449,7 @@ static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm, } } -long kvm_arch_vm_ioctl(struct file *filp, - unsigned int ioctl, unsigned long arg) +int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm *kvm = filp->private_data; void __user *argp = (void __user *)arg; diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index a25e0b73ee70..84cadaa2c2d3 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -1003,9 +1003,9 @@ void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm, kvm_flush_remote_tlbs(kvm); } -long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) +int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { - long r; + int r; switch (ioctl) { default: diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 04494a4fb37a..6f6ba55c224f 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -2386,12 +2386,11 @@ static int kvmppc_get_cpu_char(struct kvm_ppc_cpu_char *cp) } #endif -long kvm_arch_vm_ioctl(struct file *filp, - unsigned int ioctl, unsigned long arg) +int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm *kvm __maybe_unused = filp->private_data; void __user *argp = (void __user *)arg; - long r; + int r; switch (ioctl) { case KVM_PPC_GET_PVINFO: { diff --git a/arch/riscv/kvm/vm.c b/arch/riscv/kvm/vm.c index 65a964d7e70d..c13130ab459a 100644 --- a/arch/riscv/kvm/vm.c +++ b/arch/riscv/kvm/vm.c @@ -87,8 +87,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) return r; } -long kvm_arch_vm_ioctl(struct file *filp, - unsigned int ioctl, unsigned long arg) +int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { return -EINVAL; } diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 8ad1972b8a73..86ca49814983 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -2850,8 +2850,7 @@ static int kvm_s390_vm_mem_op(struct kvm *kvm, struct kvm_s390_mem_op *mop) return r; } -long kvm_arch_vm_ioctl(struct file *filp, - unsigned int ioctl, unsigned long arg) +int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm *kvm = filp->private_data; void __user *argp = (void __user *)arg; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2d210ab47e21..52a8c993cd55 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6645,8 +6645,7 @@ static int kvm_vm_ioctl_set_clock(struct kvm *kvm, void __user *argp) return 0; } -long kvm_arch_vm_ioctl(struct file *filp, - unsigned int ioctl, unsigned long arg) +int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm *kvm = filp->private_data; void __user *argp = (void __user *)arg; diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 4f26b244f6d0..ed2f1f02976b 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1398,8 +1398,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level, bool line_status); int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap); -long kvm_arch_vm_ioctl(struct file *filp, - unsigned int ioctl, unsigned long arg); +int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg); long kvm_arch_vm_compat_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg);