From patchwork Wed Feb 8 14:00:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 5129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3473731wrn; Wed, 8 Feb 2023 06:06:27 -0800 (PST) X-Google-Smtp-Source: AK7set8f3NUJkFnbjJ//LNqd7HltNvsjj3hOknQXtyqlVoMI2Wolo73ikBYf6y7/3fGjEg+i7irO X-Received: by 2002:a17:906:283:b0:878:4bda:2011 with SMTP id 3-20020a170906028300b008784bda2011mr6754684ejf.4.1675865187709; Wed, 08 Feb 2023 06:06:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675865187; cv=none; d=google.com; s=arc-20160816; b=eHemID5+IPXJOvFBDEmdpRfVgLKQpZnX5KdVKKHsLzSeTAvMkHOeW2zRjgqGQRsa6b lRZz7H5YdXxJKR9ZkALseXotI608pokcGK/zC7BWi8NjEP4XRUzcgIcBUETD/+kpO0UW Z+yzLMzk1b1wBJDYugyi/enYk/WKvDgNXhZB2N0+0GCPh5OwHA2ezGBOys8iKa3/npQV 9xPXVWiWIwHTmqvn3AkZBL+2r+xrVZzRZme6eBm36VkHz5Rscj4HDfDJlDdwTd883Nxg qs470ykR02PFU8JBbgwH6ua8GxUTQw4wGLbH1N15qQHFKdAVbG7xjOWfAzi/QISoRhON 1wjw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=9VUihSXhHG3crO6gxfgrAAyIGkZYu2m/25/NZApjVEg=; b=SNZpoXrWoRHACLB5UaF2rnX4ZCdVDhf9boJWilqjazP7G0PghIypBU6SJFX8/ibG4n O8fXBt9ZZzmOFFSzso2Gtyu/Sx/QOE2X1pexhgN+eeOUeE75XDfhDf8ZbOBSrVDZCTsN oi4K6H6W3Jw1JoQRVvZIo3+YiN9AYFLECKRB+AEzzIqUtX4+CrCScCIQglliUgq0dUPb YGu3GLD2VldSYJvapPR5qs8Hgo6tVwLei8LMqyngzCEDOH0bhstHZnvL1DqlCukZshXK 1QlmxOvc1j55TanqWDyEO7Q83YReCV9RW8FH7Nov/Qvx1oErCp6Q/hMd26i4whKlPPCj NkRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a4Hf7Tob; 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 l22-20020a170907915600b0088e0c76c466si784182ejs.356.2023.02.08.06.05.56; Wed, 08 Feb 2023 06:06:27 -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=a4Hf7Tob; 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 S231277AbjBHOCY (ORCPT + 99 others); Wed, 8 Feb 2023 09:02:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230445AbjBHOCV (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.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D262B1A978 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; bh=9VUihSXhHG3crO6gxfgrAAyIGkZYu2m/25/NZApjVEg=; b=a4Hf7Tobnh+9mXajS5D7kUlNcZp2bRPDd2H6HS0rKIgPezDjFDR2R8M3BLgcjrt3Zchk0q QFLOoc/KFAjJwxpW/g/qdAdS5CzfrinxxXH0G4BmgTk21Y2d4zqS36nX6i4R1mLlNZJewl Ta1FfBf4tNMiqQc4GE4Z5LIbejDYWFg= 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-386-6ereSqNlMcuDiFWXGxqYbA-1; Wed, 08 Feb 2023 09:01:32 -0500 X-MC-Unique: 6ereSqNlMcuDiFWXGxqYbA-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 A889B1C0897B; Wed, 8 Feb 2023 14:01:19 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C2B4140EBF4; Wed, 8 Feb 2023 14:01:07 +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 0/6] KVM: Standardize on "int" return types instead of "long" Date: Wed, 8 Feb 2023 15:00:59 +0100 Message-Id: <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?1757272014685505884?= X-GMAIL-MSGID: =?utf-8?q?1757272014685505884?= 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 related functions that are not part of a "struct file_operations" still use "long", though, which can cause confusion or even subtle problems (see the x86 and the arm64 patches). Thus let's standardize on using "int" for return values in these functions to avoid such problems in the future. v2: - Remove KVM_GET_NR_MMU_PAGES ioctl instead of trying to work-around the problem (the ioctl is not used in any userspace app anyway) - Add check for INT_MAX to the arm64 patch - Added Reviewed-bys from v1 Thomas Huth (6): KVM: PPC: Standardize on "int" return types in the powerpc KVM code KVM: s390: Use "int" as return type for kvm_s390_get/set_skeys() KVM: x86: Remove the KVM_GET_NR_MMU_PAGES ioctl KVM: arm64: Limit length in kvm_vm_ioctl_mte_copy_tags() to INT_MAX KVM: Standardize on "int" return types instead of "long" in kvm_main.c KVM: Change return type of kvm_arch_vm_ioctl() to "int" Documentation/virt/kvm/api.rst | 3 ++- arch/arm64/include/asm/kvm_host.h | 4 ++-- arch/arm64/kvm/arm.c | 3 +-- arch/arm64/kvm/guest.c | 8 ++++++-- arch/mips/kvm/mips.c | 4 ++-- 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 ++-- arch/powerpc/kvm/powerpc.c | 5 ++--- arch/riscv/kvm/vm.c | 3 +-- arch/s390/kvm/kvm-s390.c | 7 +++---- arch/x86/kvm/x86.c | 11 +---------- include/linux/kvm_host.h | 3 +-- include/uapi/linux/kvm.h | 2 +- tools/include/uapi/linux/kvm.h | 2 +- virt/kvm/kvm_main.c | 4 ++-- 18 files changed, 46 insertions(+), 55 deletions(-)