[PATCH] KVM: arm64: cancel the return value check of kvm_arm_init_sve()

Peng Wu posted 1 patch 3 years, 11 months ago
arch/arm64/kvm/arm.c   | 4 +---
arch/arm64/kvm/reset.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
[PATCH] KVM: arm64: cancel the return value check of kvm_arm_init_sve()
Posted by Peng Wu 3 years, 11 months ago
Currently, kvm_arm_init_sve() has only a unique return value,
so change the return value type of kvm_arm_init_sve() to void.

Meanwhile, there's no need to check the return value of
kvm_arm_init_sve() in kvm_arch_init().

Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 arch/arm64/kvm/arm.c   | 4 +---
 arch/arm64/kvm/reset.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 400bb0fe2745..5ec90991c68e 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -2206,9 +2206,7 @@ int kvm_arch_init(void *opaque)
 	if (err)
 		return err;
 
-	err = kvm_arm_init_sve();
-	if (err)
-		return err;
+	kvm_arm_init_sve();
 
 	err = kvm_arm_vmid_alloc_init();
 	if (err) {
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index 6c70c6f61c70..abae7b24eb8b 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -43,7 +43,7 @@ static u32 kvm_ipa_limit;
 
 unsigned int kvm_sve_max_vl;
 
-int kvm_arm_init_sve(void)
+void kvm_arm_init_sve(void)
 {
 	if (system_supports_sve()) {
 		kvm_sve_max_vl = sve_max_virtualisable_vl();
@@ -65,8 +65,6 @@ int kvm_arm_init_sve(void)
 			pr_warn("KVM: SVE vector length for guests limited to %u bytes\n",
 				kvm_sve_max_vl);
 	}
-
-	return 0;
 }
 
 static int kvm_vcpu_enable_sve(struct kvm_vcpu *vcpu)
-- 
2.17.1
Re: [PATCH] KVM: arm64: cancel the return value check of kvm_arm_init_sve()
Posted by kernel test robot 3 years, 11 months ago
Hi Peng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on kvmarm/next]
[also build test ERROR on v5.18-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Peng-Wu/KVM-arm64-cancel-the-return-value-check-of-kvm_arm_init_sve/20220520-165501
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20220521/202205211307.MWDiBNQS-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/4f7983bee8e912289335be279fb1f0a0abd6b31b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Peng-Wu/KVM-arm64-cancel-the-return-value-check-of-kvm_arm_init_sve/20220520-165501
        git checkout 4f7983bee8e912289335be279fb1f0a0abd6b31b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> arch/arm64/kvm/reset.c:46:6: error: conflicting types for 'kvm_arm_init_sve'; have 'void(void)'
      46 | void kvm_arm_init_sve(void)
         |      ^~~~~~~~~~~~~~~~
   In file included from include/linux/kvm_host.h:45,
                    from arch/arm64/kvm/reset.c:13:
   arch/arm64/include/asm/kvm_host.h:70:5: note: previous declaration of 'kvm_arm_init_sve' with type 'int(void)'
      70 | int kvm_arm_init_sve(void);
         |     ^~~~~~~~~~~~~~~~


vim +46 arch/arm64/kvm/reset.c

    45	
  > 46	void kvm_arm_init_sve(void)
    47	{
    48		if (system_supports_sve()) {
    49			kvm_sve_max_vl = sve_max_virtualisable_vl();
    50	
    51			/*
    52			 * The get_sve_reg()/set_sve_reg() ioctl interface will need
    53			 * to be extended with multiple register slice support in
    54			 * order to support vector lengths greater than
    55			 * VL_ARCH_MAX:
    56			 */
    57			if (WARN_ON(kvm_sve_max_vl > VL_ARCH_MAX))
    58				kvm_sve_max_vl = VL_ARCH_MAX;
    59	
    60			/*
    61			 * Don't even try to make use of vector lengths that
    62			 * aren't available on all CPUs, for now:
    63			 */
    64			if (kvm_sve_max_vl < sve_max_vl())
    65				pr_warn("KVM: SVE vector length for guests limited to %u bytes\n",
    66					kvm_sve_max_vl);
    67		}
    68	}
    69	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp