From patchwork Fri Feb 3 09:42:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 52441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp746213wrn; Fri, 3 Feb 2023 02:01:18 -0800 (PST) X-Google-Smtp-Source: AK7set9q7SCbKJC7WzTWmQwX1zTYUvK+Aro7CdtaO+apZR75NhSVC7FcL1s4jcv+NsbZ6sl60Bca X-Received: by 2002:a17:907:362:b0:88d:697d:a3d2 with SMTP id rs2-20020a170907036200b0088d697da3d2mr9677979ejb.54.1675418478673; Fri, 03 Feb 2023 02:01:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418478; cv=none; d=google.com; s=arc-20160816; b=CYKhflpgJ4tzkiCJEjbnBqnXVT3s/vq8ohJZR86v87yDlHSl/laKUvHJBkIQhBd10+ sPIl8L+7r8PqMKJP5YrX+l73lAeXhML/xsXiOOT00aY5sXpnRiuI/IAdyrHHU95VnH+P An5hl7FYD9ZySSxCg9TMZXDtDyNUhxrq7eZKybtu5RQHAf2Y1P0YQPn9dClJfwJM/dwv 7zHHpAKqNn4djsRf3TGWW0s7nFXtrpwOeJfn/DNyBzZZvXQ30fihGleH/xZJui3BQ949 KZLaFu1XREVMn+ndLSXosbMfxIGa5K8b57j/o1Yno+Mem2marNHb0DtvHaORcouuJuyA 2TrA== 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=0tat/P4eme/FfKBr8BKd4Pw6gbzGDfLHjFvlJNYgEaNtM8g6vLRI2InUKzoxcjTnw/ zMgUBZd6TzA17FHFdhiKB1eIrI385X/0XhyEKEpymtGtt4VTRcwUCBxsfkp/NstaaXdX puRpqEUR2VkT4Uj6JkZmfIFm5twA0MLoEHsUla6FrsIPuGtXID6xDTcukmDwovEdy0qK SNsR7bQ5+oqFkt15kL5z6ihKZncLEpw6+RpK4hGpru7HcGuzOIZLdTh0t5+sKbzGWkX6 Y6o4W6rDi/Mn4uZw0MnuxGDxL2uVfCVoNhfRom4YY3HYvtVfLTW1x+yljLEN5bdfRX7u y/ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CTtUQEQw; 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-20020a17090668ce00b008432fa22567si2760297ejr.649.2023.02.03.02.00.53; Fri, 03 Feb 2023 02:01:18 -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=CTtUQEQw; 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 S232894AbjBCJpY (ORCPT + 99 others); Fri, 3 Feb 2023 04:45:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232335AbjBCJpW (ORCPT ); Fri, 3 Feb 2023 04:45:22 -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 9EEE39AFCF for ; Fri, 3 Feb 2023 01:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675417447; 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=CTtUQEQww0u+PShsySYCy4VfkwtdhlXxsjT+7lj2MDxOHTwZbLhPmuyjmirZni7ZWgqcv/ vCtsuky/2D/cgk+kCREdUMYp0A9MQzGXxMVsNJBcHXfyYOogtO51OWp/kz5udtRZfI3Fzz 8C/ct8R7WPJejdtMn7lmKxZuCFSVHpc= 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-513-UD1PGtHHOTCTHRED0JEgqA-1; Fri, 03 Feb 2023 04:42:44 -0500 X-MC-Unique: UD1PGtHHOTCTHRED0JEgqA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6FA2929AB3F9; Fri, 3 Feb 2023 09:42:43 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id B902140168BF; Fri, 3 Feb 2023 09:42:40 +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 , Claudio Imbrenda , David Hildenbrand , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/7] KVM: Standardize on "int" return types instead of "long" in kvm_main.c Date: Fri, 3 Feb 2023 10:42:24 +0100 Message-Id: <20230203094230.266952-2-thuth@redhat.com> In-Reply-To: <20230203094230.266952-1-thuth@redhat.com> References: <20230203094230.266952-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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?1756803606696468466?= X-GMAIL-MSGID: =?utf-8?q?1756803606696468466?= 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 Fri Feb 3 09:42:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 52435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp742662wrn; Fri, 3 Feb 2023 01:57:49 -0800 (PST) X-Google-Smtp-Source: AK7set99BTAZ7sQJ8AEZlpFnG//C4pV7miupM60cwk/Y2gyAQ14Cax1Q8o/3WfUaqsJOtibW7uJo X-Received: by 2002:a17:906:184a:b0:878:74a9:1869 with SMTP id w10-20020a170906184a00b0087874a91869mr11199061eje.3.1675418269178; Fri, 03 Feb 2023 01:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418269; cv=none; d=google.com; s=arc-20160816; b=JhC+wK6xXLvD7NOzUpd0eiYx+z4DovhjrqL7NX0NOHwhHpdwtQFpnzFqNMubm4YVLG Rr+Ymtp73jsSkP33xOjxJ97bzFKAD0Kzgg91zCS1k6s/+ZjDGqwZf55ju+W86m8t+elB aULR135I0R7rgknNbDjPTYct1oabgo8SOVCarSYY6iiFwC+Fs5k2TmiBgyocKTCts4/k crDdfVN0oej/D1QpFdeESpIHX2iJFMB9Ampggi56Np+goSTGQJgS1R8WzQFDHXKIQgmb vx8YGuF4LUsnR5LV8ZXnVLrwfEtuvhHmCMBB8rbQOucPBxyZMfzA3eD16CmtkgVYVqE4 LsiA== 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=DqDRH/0lCXChL6lF9FhJdEI9fG4ptLvUYJEw5ZtLX0Q=; b=LTtssdBSDEz1DO6U4dpk04Na70DAG+wDgWTe3hz9ubOtJbxs5jigLS5rfACgj4gqhg /Qju7VnMOS/6/S72ZnJHIwrBhLoYDrTaFALWYgakxafikyIhJbohqxZ7j66bKp9ZorcD 1uKAQY9fNqSdHx3+CQNwqDOSmiOa/YwJJLR/kledyXnrKqm0ljavWJmHCkeiWQSdm2WP VmIgKY0UlZvrY4ImwR9yg0EJynU/PP1b0TLUuo/JFa5WjeL4RWTvHtUX2uq137FGfsw3 SI8sijG5htF3HOdAOGKCLXZfTcFUvYzdonKJilFjQjz6AVQ3K6amX4tQr57Fi7+qYnGn T3Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HDBCNwbp; 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 fe16-20020a1709072a5000b00882042f9fb1si2673248ejc.724.2023.02.03.01.57.25; Fri, 03 Feb 2023 01:57:49 -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=HDBCNwbp; 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 S232552AbjBCJnh (ORCPT + 99 others); Fri, 3 Feb 2023 04:43:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbjBCJnf (ORCPT ); Fri, 3 Feb 2023 04:43:35 -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 A478D25BA8 for ; Fri, 3 Feb 2023 01:42:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675417369; 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=DqDRH/0lCXChL6lF9FhJdEI9fG4ptLvUYJEw5ZtLX0Q=; b=HDBCNwbptapTFtQU/27UDq2xSkAOtVAKsaNEgxmqhpuAVhrkrVkneC7XyMmg4XypuRNi/n XunmEwQ8PYzrJhN5PoJy5WPLCOvx+nfoTWW+zTsIlhJ8hXQWW6iJvATSW83wB2FW1xPrRu s8653pVPC26BNZNZ+2u2YDFfe76ssc0= 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-286-55hyVc76NsCFjAV8PUgtUw-1; Fri, 03 Feb 2023 04:42:47 -0500 X-MC-Unique: 55hyVc76NsCFjAV8PUgtUw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D6DB85CBED; Fri, 3 Feb 2023 09:42:46 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id B417340C1423; Fri, 3 Feb 2023 09:42:43 +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 , Claudio Imbrenda , David Hildenbrand , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/7] KVM: x86: Improve return type handling in kvm_vm_ioctl_get_nr_mmu_pages() Date: Fri, 3 Feb 2023 10:42:25 +0100 Message-Id: <20230203094230.266952-3-thuth@redhat.com> In-Reply-To: <20230203094230.266952-1-thuth@redhat.com> References: <20230203094230.266952-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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?1756803386718875910?= X-GMAIL-MSGID: =?utf-8?q?1756803386718875910?= kvm_vm_ioctl_get_nr_mmu_pages() tries to return a "unsigned long" value, but its caller only stores ther return value in an "int" - which is also what all the other kvm_vm_ioctl_*() functions are returning. So returning values that do not fit into a 32-bit integer anymore does not work here. It's better to adjust the return type, add a sanity check and return an error instead if the value is too big. Signed-off-by: Thomas Huth --- arch/x86/kvm/x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index da4bbd043a7b..caa2541833dd 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6007,8 +6007,11 @@ 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) +static int kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm) { + if (kvm->arch.n_max_mmu_pages > INT_MAX) + return -EOVERFLOW; + return kvm->arch.n_max_mmu_pages; } From patchwork Fri Feb 3 09:42:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 52436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp743515wrn; Fri, 3 Feb 2023 01:58:40 -0800 (PST) X-Google-Smtp-Source: AK7set9pOVqbDVYn5m4wnM5sF1zB7N0YQuIJcyhwCxc4K1m8iZgAdDQTbzTG4BTpP19bIRhkGyj7 X-Received: by 2002:a17:906:e2c2:b0:888:1613:49d4 with SMTP id gr2-20020a170906e2c200b00888161349d4mr9980258ejb.0.1675418320075; Fri, 03 Feb 2023 01:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418320; cv=none; d=google.com; s=arc-20160816; b=cVCp25sP8UanaXcXvsgbk4VFu2h+gLJssqX0wvBZ68PRezW2USP6aUd4lZDZnyLOao 9Uj3rkJAJ03jVqxtwSE+ca/7IY0qWHho5tkp3f7qYDcEH8XdbxhdgbOU7KO2ZuOM4PHJ L52RI6UF5e3k40fxfeiTqsDYR//5KPSp102CNY0LzxPrtoxIRQ+V3bh+MVyBhTdSv+1T 7+OE72+hI5rnb5JY124ILBU9+fAQicqOQq3q7xSTWjCsgNMZO2Rfpj81kKEcPejGn5e2 Q94Ls8OfQsBeazH5bINHd0p+Wnj71uYwHF1ZV4sx4HUZOuao7KCsPpNRk0koDisyWkFc 0f1g== 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=s4HoMBB9b+GYCrS+oYQ3jjJ7MAxGR9J+rSDLb84UwlM=; b=WE+1h5oOZisXLien32LZaOk18M9M0PchiZYpLVjTUtdZ9FqgDmJS0P9BczYnLh8LOQ QG31RKLr+zqTIxUgdYJ9mpP77jCK7ddfJ9lR9vvmBXh5pB7PsTjmS87ZQ977K8d+PcbV XKvgwhZwBONohnro3EBd+11g2FN4oJLDi7AktT7SxoT7i+wUPgOfe9yZS2ooogiySXQL fGc2ip95JkmX8fzw3d0kbQCZqYrEmeA8ZDcSWCMZ15B4rvagFgY+KqJVL3CR/JVP4x9t 7OrthQu23/Imgx9JcVFbvAYfTh3xWbKvAx/XOKnMd2H+MRe2UA3katGVaKQsVO+BZsvY nftg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=alnP43QJ; 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 gg36-20020a17090689a400b0087e94414bffsi2409841ejc.762.2023.02.03.01.58.16; Fri, 03 Feb 2023 01:58:40 -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=alnP43QJ; 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 S232956AbjBCJnr (ORCPT + 99 others); Fri, 3 Feb 2023 04:43:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbjBCJnn (ORCPT ); Fri, 3 Feb 2023 04:43:43 -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 63AAD14EA6 for ; Fri, 3 Feb 2023 01:42:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675417372; 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=s4HoMBB9b+GYCrS+oYQ3jjJ7MAxGR9J+rSDLb84UwlM=; b=alnP43QJIuUwAKz4Qe+RUo6S7aUofTyXkSBWpNw3baPMxvXj6Ib7NlFZVWB2K8c+tgahTm paNIA9YCHYyEOAw+GVd3oy6LaXI5RRYvpjcCULYGXbOOl2lV20LJKWXk+edRjOUbNQogcz G6qHQ0nuwt73vtYg75fPN25wBAnk4G4= 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-113-Ceqhc3xGNYGk_k8HJWjvcw-1; Fri, 03 Feb 2023 04:42:50 -0500 X-MC-Unique: Ceqhc3xGNYGk_k8HJWjvcw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5880857A93; Fri, 3 Feb 2023 09:42:49 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD9D9410B1AD; Fri, 3 Feb 2023 09:42:46 +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 , Claudio Imbrenda , David Hildenbrand , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/7] KVM: Move KVM_GET_NR_MMU_PAGES into the deprecation section Date: Fri, 3 Feb 2023 10:42:26 +0100 Message-Id: <20230203094230.266952-4-thuth@redhat.com> In-Reply-To: <20230203094230.266952-1-thuth@redhat.com> References: <20230203094230.266952-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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?1756803440309355905?= X-GMAIL-MSGID: =?utf-8?q?1756803440309355905?= 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. This ioctl likely has also never really been used by userspace applications (at least not by QEMU and kvmtool which I checked), so it's better to move it to the deprecation section in kvm.h to make it clear for developers that this also should not be used in new code in the future anymore. Signed-off-by: Thomas Huth --- include/uapi/linux/kvm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 55155e262646..f55965a4cec7 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -83,6 +83,8 @@ struct kvm_debug_guest { #define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) +#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) + /* *** End of deprecated interfaces *** */ @@ -1442,7 +1444,6 @@ 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_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ struct kvm_userspace_memory_region) #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) From patchwork Fri Feb 3 09:42:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 52438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp744162wrn; Fri, 3 Feb 2023 01:59:28 -0800 (PST) X-Google-Smtp-Source: AK7set9TNRkfOiTOtwgZEPe2fxdskUXjtnCcfwQE/5I+fw6AfxxyfHZPur/POltaCGRu5YQe9LKH X-Received: by 2002:a05:6402:c1c:b0:4a1:cf6b:f328 with SMTP id co28-20020a0564020c1c00b004a1cf6bf328mr9361261edb.19.1675418367882; Fri, 03 Feb 2023 01:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418367; cv=none; d=google.com; s=arc-20160816; b=gq+qGIqClW5koDR56KQdNMPnxNQbMcBO25JQGJWR5Qp7hKraXSBP1tHAze6rO9Wdy1 YtTpl8N/GSv/fqCntm0Deujt6uqpfmndx/04MlJWKPhx66L3LzHQmRWfPEewt/6Bep/w rnWnv1k/CXFlqtzq8dWwcvUOXkbkj9iqxkIbJjDHtySeUWGQS7KfatYVbYtMx8iFH+Xm 5ZJ2bJAnA8zgdWLdkK5+apK5pjm7EuqEkh0AaSIs7Y7aeEBqKbVLixHGo9eQ57ENMaYt SIWsptsHewKaHIhSwQCCUu934QmF5umeRSK6Ogwf7g/X6hvqkgX2GiCvYqmuBCMn4/GK Hhfw== 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=CKX+TQVSfx0uTwzs+LV12S6Pyj/bD36DBKXgcbIOz9o=; b=MsVfVy+lqzQGshbciFjoUldx4on+2yQ4MTIumJKZyI0JwN6rx1VZ2kfySvqCoe5zVW dUHoV/Jl7K6LyR45xU5lV62lY9YCsyRL89TIuuDXUpRQQK5r6h0YGYJf7RAgbOITUOjI aaPQnd5hs1/BaoeD8nk0t4ywAGTTH9s4cO7AZMq2FNjSybwxBULqc9VWYB3Fg0iCB18h NJEUEp0BAlP5wx+XZfP5lTmNnR4FTPzEFEl5aFPoFyV45MOFSrZrVJrmx+nOMQObMRhb t9VdKLK99Vbt+p52Cy6WSTMERQjqlr6J5EzsiZbjkoapgqX8KCr/oQSqL1hkgW+FGO+a smRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KeJGnoNk; 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 e14-20020aa7d7ce000000b004a26577c1e3si2096417eds.526.2023.02.03.01.59.03; Fri, 03 Feb 2023 01:59: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=KeJGnoNk; 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 S233061AbjBCJoD (ORCPT + 99 others); Fri, 3 Feb 2023 04:44:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232869AbjBCJnt (ORCPT ); Fri, 3 Feb 2023 04:43:49 -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 8051911F for ; Fri, 3 Feb 2023 01:42:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675417377; 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=CKX+TQVSfx0uTwzs+LV12S6Pyj/bD36DBKXgcbIOz9o=; b=KeJGnoNk+hnEDF9jHK9GtZjVrfRoo1VFR5buY7Axdp02yh37yCafjAi22H6C6lqog1sOcI FFETCPAYh8RgKMXV7+DYv/gMb2hxHf/z87fGuJaFEkdj/PRzu97O1zFkIzc8VPgJwdY4oX H0HmvDr3UYNohkCUPE52QTstE6mfC4E= 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-223-mPGuNb5yOM-GP8W1xzDSxA-1; Fri, 03 Feb 2023 04:42:53 -0500 X-MC-Unique: mPGuNb5yOM-GP8W1xzDSxA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6E453806101; Fri, 3 Feb 2023 09:42:52 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06BF040168BD; Fri, 3 Feb 2023 09:42:49 +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 , Claudio Imbrenda , David Hildenbrand , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 4/7] KVM: PPC: Standardize on "int" return types in the powerpc KVM code Date: Fri, 3 Feb 2023 10:42:27 +0100 Message-Id: <20230203094230.266952-5-thuth@redhat.com> In-Reply-To: <20230203094230.266952-1-thuth@redhat.com> References: <20230203094230.266952-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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?1756803490274311484?= X-GMAIL-MSGID: =?utf-8?q?1756803490274311484?= 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. Signed-off-by: Thomas Huth Reviewed-by: Nicholas Piggin --- 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 Fri Feb 3 09:42:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 52437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp743820wrn; Fri, 3 Feb 2023 01:58:59 -0800 (PST) X-Google-Smtp-Source: AK7set//53kO7hWXyh0kY3zmTl4MgSCzQjr/44dk9gq2dq1Sm6Y11+7pT1KrL/8CMVtB+gR9xcPs X-Received: by 2002:a05:6402:911:b0:499:bf28:d9c6 with SMTP id g17-20020a056402091100b00499bf28d9c6mr9133367edz.5.1675418338971; Fri, 03 Feb 2023 01:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418338; cv=none; d=google.com; s=arc-20160816; b=uETEC/80yH8wsY2gZ2brnyw4P6l2gAeZKJ/WZ0BlwhO+LNC506STW3JqQsbq+TLVRl ZGc7PwdbgoJ5oLBppjrfL2jZZ2GjmPb7eCRFFzj86TPaaW36o3ikWBmRtv/egTBShvas 4cpiLlrKxKCfxicXLrLCWJBAmjMa6vNYnLgLRLdkI50waLwD4Nho4cB9qCcwN90aNI62 Y5jvVFj6qetDOZt86iBe2yRv1N1nei9WbeRnGJeNUD8A2Dx9Kx7N2O7X3eO8c7n96RNF 6vFn2FyS7mTEDfRaBqVhQyJjvoHhcQNjqLIo8FPpxSulV8/aNXjOKxTcmRvStl3UhEQU EuJA== 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=tHFJYodS+GlZliPPBpSywnTgXG8QiYZdzMEcCQFBMZk=; b=bByuLtIIua1xjihvGZoXlHEFXDBeoNprIP+qNuSsFwViIljePOR0YQc09RewGOXDTu 4ER3gjp7FgJxeyjrfWdlW1zjczTFbvtKpcE6PxPhhlpv8/Bj/P6XqowkC5JrJlld8eC0 TsPvv3yC25yHXdjpah0V7qzEHwmJI/2mHO210EXlWyPTX7PTx1T8IOoUeiFGRwUQ91zT OiN6of/gvA1fPjDj0OMO0qrPdczfvSzQMxxP55YHpxbflb8YzL1I3S6Q4XtZUSormpcu wnCOmM0ZeLuV7PATWdBukKY8nUbZDS8DJ3CrMZfEA0D6LGNVG9GAbTYNT8SkSY8xLX0c /jOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TVeQLwuN; 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 g13-20020a056402180d00b004a21d031559si1975263edy.476.2023.02.03.01.58.35; Fri, 03 Feb 2023 01:58:58 -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=TVeQLwuN; 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 S233019AbjBCJn6 (ORCPT + 99 others); Fri, 3 Feb 2023 04:43:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232895AbjBCJns (ORCPT ); Fri, 3 Feb 2023 04:43:48 -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 9C2545FCB for ; Fri, 3 Feb 2023 01:43:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675417379; 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=tHFJYodS+GlZliPPBpSywnTgXG8QiYZdzMEcCQFBMZk=; b=TVeQLwuNHIN3bIhtm+Qtp+WGfLlc/QRbK0VtNmVC23M9VlmI0F40Jwf48ACVKao9jR9Wt4 UGCQWFDuH66LL8Q8d9hDqjxCTSoVmMll8qu2kSIvhjnpmyybGGKG/M/LxNny7CbLcUsoOJ Pc+SqaZi7L9x4Tkpr1dSPUFvweHKQMQ= 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-477-JjRiMZkKNgqIaOgbneMQ2A-1; Fri, 03 Feb 2023 04:42:56 -0500 X-MC-Unique: JjRiMZkKNgqIaOgbneMQ2A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3DB029AB3F7; Fri, 3 Feb 2023 09:42:55 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9C46408573E; Fri, 3 Feb 2023 09:42:52 +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 , Claudio Imbrenda , David Hildenbrand , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 5/7] KVM: s390: Use "int" as return type for kvm_s390_get/set_skeys() Date: Fri, 3 Feb 2023 10:42:28 +0100 Message-Id: <20230203094230.266952-6-thuth@redhat.com> In-Reply-To: <20230203094230.266952-1-thuth@redhat.com> References: <20230203094230.266952-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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?1756803460285091214?= X-GMAIL-MSGID: =?utf-8?q?1756803460285091214?= These two functions only return normal integers, so it does not make sense to declare the return type as "long" here. Signed-off-by: Thomas Huth Reviewed-by: Claudio Imbrenda --- 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 Fri Feb 3 09:42:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 52439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp744332wrn; Fri, 3 Feb 2023 01:59:36 -0800 (PST) X-Google-Smtp-Source: AK7set89fGcjCMIin5JvwRsL4LJ6T3fSV9pxobAwz5azAuHHVCj0Q/flvXiwUmjf/wyTBJskaw89 X-Received: by 2002:aa7:c552:0:b0:4a0:8bcc:3cbc with SMTP id s18-20020aa7c552000000b004a08bcc3cbcmr8987877edr.25.1675418376518; Fri, 03 Feb 2023 01:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418376; cv=none; d=google.com; s=arc-20160816; b=BGCTtlGoBeP2bIgaO48DKu96dJxBKkgQOxfU/tjgRE7EZ6NeYh6QoZRF4hHyU6G+U9 omxEySEfvT1Yss+GW6mm+Q/ovShwTR2IFrtnY28e9MQJat2exU4AzLOKBVZ53B3dj6Y7 /fX/z/oJcV8UctnlcZZKjXffF4pw1gL97pcEsVedJtgM+r8oSSz3zg1TeiSBK18LL3BH +kY5Mdbnn8N09gk07bkBMPQoVtJEX/95VWYW8JxWLXJoy+yhKFzP2WpKlQxXY10FNzrf ktVTp/ICfb0qK+MqFcgH1YLcwYt+J3qM+8/Tw1WtrUi5n6LwbwxC8U234rPTrDyhj+/c eyog== 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=/sw5RAfO/TETjhBCbaE2sbk1k6OIXCummMa6Dx6bagw=; b=Cmm8w+oIsDWgMf3yaikBGgR7PJdxRaYqBZlta8AaT42o9T3bfgjEFWr0KfdeTPKpVl 5ETjY/uBhKR+UGQzkuWVdRV6aymIx0qcLweFwextBKRP+BsdML2yE4i6DWkfskwprWWP sLDX5UwnzkjRbp+8jRukDPMoR1/Q5BaYBYk120/Cp0tH6qA+4f7RPtnUK3tFzttSk5wc NmBesDtbOejly9m8GNZI2elUH/eduFNbegubzDFsWZiCiJh8S3YAhgdR6K/CBQHDa5Uj mTqsXzBVtE63wCQi9aksQZxd6MZHyTqeTmsjeJrhkc7z3b6Xsq58cPmXBXbWTGBM2WOF UwwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hu2K2q0x; 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 fg13-20020a056402548d00b004a258718d9csi2182766edb.294.2023.02.03.01.59.11; Fri, 03 Feb 2023 01:59:36 -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=hu2K2q0x; 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 S233083AbjBCJoG (ORCPT + 99 others); Fri, 3 Feb 2023 04:44:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232866AbjBCJnu (ORCPT ); Fri, 3 Feb 2023 04:43:50 -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 B1AA1125B5 for ; Fri, 3 Feb 2023 01:43:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675417382; 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=/sw5RAfO/TETjhBCbaE2sbk1k6OIXCummMa6Dx6bagw=; b=hu2K2q0xzDLsv87fF5KCw626Wa5zKLJvL9KQcoslN6E6Y3lyXNF70fvqn8TEZ7SCAcbf95 eTCLOnfkL7Z51dI16uP06K3RgbgXHbMe6AEF4BPfL8LBfJq1yDCe9W9/NgRgcGkOx4TxdU hPF96KWj/qxhMYrU0crcU+3Qe3Pe+7E= 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-108-0lzC7SKGN0GZYvjAe5j_5Q-1; Fri, 03 Feb 2023 04:42:59 -0500 X-MC-Unique: 0lzC7SKGN0GZYvjAe5j_5Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 99CE71C05B0C; Fri, 3 Feb 2023 09:42:58 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0461740ED76D; Fri, 3 Feb 2023 09:42:55 +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 , Claudio Imbrenda , David Hildenbrand , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 6/7] KVM: arm64: Change return type of kvm_vm_ioctl_mte_copy_tags() to "int" Date: Fri, 3 Feb 2023 10:42:29 +0100 Message-Id: <20230203094230.266952-7-thuth@redhat.com> In-Reply-To: <20230203094230.266952-1-thuth@redhat.com> References: <20230203094230.266952-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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?1756803499449305402?= X-GMAIL-MSGID: =?utf-8?q?1756803499449305402?= This function only returns normal integer values, so there is no need to declare its return value as "long". Signed-off-by: Thomas Huth --- arch/arm64/include/asm/kvm_host.h | 4 ++-- arch/arm64/kvm/guest.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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..80e530549c34 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; From patchwork Fri Feb 3 09:42:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 52440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp745668wrn; Fri, 3 Feb 2023 02:00:49 -0800 (PST) X-Google-Smtp-Source: AK7set8StpVuPDABl+PAZrloB9GYcv1etsPObnAEyRRH7yk5b1Av37ixA1mCPPANfYGEp/hVdyFA X-Received: by 2002:aa7:da01:0:b0:499:c294:77af with SMTP id r1-20020aa7da01000000b00499c29477afmr9790490eds.12.1675418448872; Fri, 03 Feb 2023 02:00:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418448; cv=none; d=google.com; s=arc-20160816; b=ehYuEGu2uILKrYeJgOPCXouPvqnBhFuGKDGf0ymmHTughiDV+68VfRXCvEvolsgqk0 H8Rnqhtg2z9Pf2sbaPK1KZExvgyw+kEo5B5GrWKUtgHShVgddkKJ6Y7LGs5fYi/Yd3iD WxFkYpyVbKK8QF+PoQ1JZaU32NtN1RdYuTcg/2MU9blDf+5QSH0b/B0zSjAYhrTlOEFK rdBOg/He0U/oGQ252Ip6DGt1to2pTKex/opQGD6a7Y4Vj9I6UdQgDPnHAFTsvdgwlydS xvNziytGa+TloYVpErMLM/8+sFDMlQ9o0jbz75Co6nQqOf1j8sOybeMoiNn64yQGzCH9 B9vQ== 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=8JdKarrXqihAE4TdBrVs4mhITdD+RzszOBRVozg9cDY=; b=yITljsgRmeFwGo1Hc60VeM0IF4yL73eXBeQkpZrMqgvfLKHvC8hhwkL841ZpOs74SD 2yGdg19FOViSOjOcCYM0ULC7WiZnOPCyEQRPRUI8U0SExOZLMAmBC8S2X8SLpqeQ9CAC r3anLREmPOSzgsGCMETIrWFrabfQqy9jFE3C2eXjyW34q8MEYySTJ23xi5kZcd4my8d7 RPSadj+0vXgLOgCrZhyKIhPyKE1WJXfzhWVy+FqHQoPhzMZGSHvZ/gOnXVJXDhajH9AL +KZBqzktW8uKMvy90J3JQeB97NwakurpF+n/GgsTL5CDO9U2aoMhNk5NHhGtKfYnt5zV 1GwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M2h01co9; 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 fi22-20020a056402551600b0049ee8ae359dsi2277553edb.119.2023.02.03.02.00.24; Fri, 03 Feb 2023 02:00:48 -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=M2h01co9; 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 S232970AbjBCJoP (ORCPT + 99 others); Fri, 3 Feb 2023 04:44:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232335AbjBCJnx (ORCPT ); Fri, 3 Feb 2023 04:43:53 -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 0FBD01449A for ; Fri, 3 Feb 2023 01:43:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675417384; 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=8JdKarrXqihAE4TdBrVs4mhITdD+RzszOBRVozg9cDY=; b=M2h01co9kihbcQBWFKLs7DXGechtZy6siCgP6s03vxarmFjGsNZgUhEtJVwvMtAYrgbQjq wuQM5cw1cv8kQMXoFWgFqPHZ1M5lsnuwoNWdzdTZErEc8mXSoqrdeGLaz/8Ww/hgamC/Ew B1r49G1U6Uj8+JTF6/kL9iqv3Worz2k= 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-626-_xIqrw8WOy64q5Vf3PcZrQ-1; Fri, 03 Feb 2023 04:43:02 -0500 X-MC-Unique: _xIqrw8WOy64q5Vf3PcZrQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E91633C0D18D; Fri, 3 Feb 2023 09:43:01 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB53C410B1AD; Fri, 3 Feb 2023 09:42:58 +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 , Claudio Imbrenda , David Hildenbrand , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 7/7] KVM: Change return type of kvm_arch_vm_ioctl() to "int" Date: Fri, 3 Feb 2023 10:42:30 +0100 Message-Id: <20230203094230.266952-8-thuth@redhat.com> In-Reply-To: <20230203094230.266952-1-thuth@redhat.com> References: <20230203094230.266952-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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?1756803575404368821?= X-GMAIL-MSGID: =?utf-8?q?1756803575404368821?= 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: Claudio Imbrenda --- 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 caa2541833dd..c03363efc774 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6653,8 +6653,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);