Hi Fuad,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 1da38549dd64c7f5dd22427f12dfa8db3d8a722b]

url:    
https://github.com/0day-ci/linux/commits/Fuad-Tabba/KVM-arm64-Fixed-features-for-protected-VMs/20211009-000118
base:   1da38549dd64c7f5dd22427f12dfa8db3d8a722b
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.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/0day-ci/linux/commit/59df1c9264ed417b7662e7520143c3d7b9ecad25
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Fuad-Tabba/KVM-arm64-Fixed-features-for-protected-VMs/20211009-000118
        git checkout 59df1c9264ed417b7662e7520143c3d7b9ecad25
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross 
ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:28:6: warning: no previous prototype for 
>> 'inject_undef64' [-Wmissing-prototypes]
      28 | void inject_undef64(struct kvm_vcpu *vcpu)
         |      ^~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:81:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64pfr0' [-Wmissing-prototypes]
      81 | u64 get_pvm_id_aa64pfr0(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:102:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64pfr1' [-Wmissing-prototypes]
     102 | u64 get_pvm_id_aa64pfr1(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:113:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64zfr0' [-Wmissing-prototypes]
     113 | u64 get_pvm_id_aa64zfr0(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:123:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64dfr0' [-Wmissing-prototypes]
     123 | u64 get_pvm_id_aa64dfr0(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:133:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64dfr1' [-Wmissing-prototypes]
     133 | u64 get_pvm_id_aa64dfr1(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:143:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64afr0' [-Wmissing-prototypes]
     143 | u64 get_pvm_id_aa64afr0(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:153:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64afr1' [-Wmissing-prototypes]
     153 | u64 get_pvm_id_aa64afr1(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:163:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64isar0' [-Wmissing-prototypes]
     163 | u64 get_pvm_id_aa64isar0(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:168:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64isar1' [-Wmissing-prototypes]
     168 | u64 get_pvm_id_aa64isar1(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:181:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64mmfr0' [-Wmissing-prototypes]
     181 | u64 get_pvm_id_aa64mmfr0(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:191:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64mmfr1' [-Wmissing-prototypes]
     191 | u64 get_pvm_id_aa64mmfr1(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:196:5: warning: no previous prototype for 
>> 'get_pvm_id_aa64mmfr2' [-Wmissing-prototypes]
     196 | u64 get_pvm_id_aa64mmfr2(const struct kvm_vcpu *vcpu)
         |     ^~~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:448:5: warning: no previous prototype for 
>> 'kvm_check_pvm_sysreg_table' [-Wmissing-prototypes]
     448 | int kvm_check_pvm_sysreg_table(void)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/sys_regs.c:466:6: warning: no previous prototype for 
>> 'kvm_handle_pvm_sysreg' [-Wmissing-prototypes]
     466 | bool kvm_handle_pvm_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code)
         |      ^~~~~~~~~~~~~~~~~~~~~


vim +/inject_undef64 +28 arch/arm64/kvm/hyp/nvhe/sys_regs.c

    23  
    24  /*
    25   * Inject an unknown/undefined exception to an AArch64 guest while most 
of its
    26   * sysregs are live.
    27   */
  > 28  void inject_undef64(struct kvm_vcpu *vcpu)
    29  {
    30          u32 esr = (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT);
    31  
    32          *vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR);
    33          *vcpu_cpsr(vcpu) = read_sysreg_el2(SYS_SPSR);
    34  
    35          vcpu->arch.flags |= (KVM_ARM64_EXCEPT_AA64_EL1 |
    36                               KVM_ARM64_EXCEPT_AA64_ELx_SYNC |
    37                               KVM_ARM64_PENDING_EXCEPTION);
    38  
    39          __kvm_adjust_pc(vcpu);
    40  
    41          write_sysreg_el1(esr, SYS_ESR);
    42          write_sysreg_el1(read_sysreg_el2(SYS_ELR), SYS_ELR);
    43          write_sysreg_el2(*vcpu_pc(vcpu), SYS_ELR);
    44          write_sysreg_el2(*vcpu_cpsr(vcpu), SYS_SPSR);
    45  }
    46  
    47  /*
    48   * Returns the restricted features values of the feature register based 
on the
    49   * limitations in restrict_fields.
    50   * A feature id field value of 0b0000 does not impose any restrictions.
    51   * Note: Use only for unsigned feature field values.
    52   */
    53  static u64 get_restricted_features_unsigned(u64 sys_reg_val,
    54                                              u64 restrict_fields)
    55  {
    56          u64 value = 0UL;
    57          u64 mask = GENMASK_ULL(ARM64_FEATURE_FIELD_BITS - 1, 0);
    58  
    59          /*
    60           * According to the Arm Architecture Reference Manual, feature 
fields
    61           * use increasing values to indicate increases in functionality.
    62           * Iterate over the restricted feature fields and calculate the 
minimum
    63           * unsigned value between the one supported by the system, and 
what the
    64           * value is being restricted to.
    65           */
    66          while (sys_reg_val && restrict_fields) {
    67                  value |= min(sys_reg_val & mask, restrict_fields & 
mask);
    68                  sys_reg_val &= ~mask;
    69                  restrict_fields &= ~mask;
    70                  mask <<= ARM64_FEATURE_FIELD_BITS;
    71          }
    72  
    73          return value;
    74  }
    75  
    76  /*
    77   * Functions that return the value of feature id registers for 
protected VMs
    78   * based on allowed features, system features, and KVM support.
    79   */
    80  
  > 81  u64 get_pvm_id_aa64pfr0(const struct kvm_vcpu *vcpu)
    82  {
    83          const struct kvm *kvm = (const struct kvm 
*)kern_hyp_va(vcpu->kvm);
    84          u64 set_mask = 0;
    85          u64 allow_mask = PVM_ID_AA64PFR0_ALLOW;
    86  
    87          if (!vcpu_has_sve(vcpu))
    88                  allow_mask &= ~ARM64_FEATURE_MASK(ID_AA64PFR0_SVE);
    89  
    90          set_mask |= 
get_restricted_features_unsigned(id_aa64pfr0_el1_sys_val,
    91                  PVM_ID_AA64PFR0_RESTRICT_UNSIGNED);
    92  
    93          /* Spectre and Meltdown mitigation in KVM */
    94          set_mask |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_CSV2),
    95                                 (u64)kvm->arch.pfr0_csv2);
    96          set_mask |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_CSV3),
    97                                 (u64)kvm->arch.pfr0_csv3);
    98  
    99          return (id_aa64pfr0_el1_sys_val & allow_mask) | set_mask;
   100  }
   101  
 > 102  u64 get_pvm_id_aa64pfr1(const struct kvm_vcpu *vcpu)
   103  {
   104          const struct kvm *kvm = (const struct kvm 
*)kern_hyp_va(vcpu->kvm);
   105          u64 allow_mask = PVM_ID_AA64PFR1_ALLOW;
   106  
   107          if (!kvm_has_mte(kvm))
   108                  allow_mask &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_MTE);
   109  
   110          return id_aa64pfr1_el1_sys_val & allow_mask;
   111  }
   112  
 > 113  u64 get_pvm_id_aa64zfr0(const struct kvm_vcpu *vcpu)
   114  {
   115          /*
   116           * No support for Scalable Vectors, therefore, hyp has no 
sanitized
   117           * copy of the feature id register.
   118           */
   119          BUILD_BUG_ON(PVM_ID_AA64ZFR0_ALLOW != 0ULL);
   120          return 0;
   121  }
   122  
 > 123  u64 get_pvm_id_aa64dfr0(const struct kvm_vcpu *vcpu)
   124  {
   125          /*
   126           * No support for debug, including breakpoints, and watchpoints,
   127           * therefore, pKVM has no sanitized copy of the feature id 
register.
   128           */
   129          BUILD_BUG_ON(PVM_ID_AA64DFR0_ALLOW != 0ULL);
   130          return 0;
   131  }
   132  
 > 133  u64 get_pvm_id_aa64dfr1(const struct kvm_vcpu *vcpu)
   134  {
   135          /*
   136           * No support for debug, therefore, hyp has no sanitized copy 
of the
   137           * feature id register.
   138           */
   139          BUILD_BUG_ON(PVM_ID_AA64DFR1_ALLOW != 0ULL);
   140          return 0;
   141  }
   142  
 > 143  u64 get_pvm_id_aa64afr0(const struct kvm_vcpu *vcpu)
   144  {
   145          /*
   146           * No support for implementation defined features, therefore, 
hyp has no
   147           * sanitized copy of the feature id register.
   148           */
   149          BUILD_BUG_ON(PVM_ID_AA64AFR0_ALLOW != 0ULL);
   150          return 0;
   151  }
   152  
 > 153  u64 get_pvm_id_aa64afr1(const struct kvm_vcpu *vcpu)
   154  {
   155          /*
   156           * No support for implementation defined features, therefore, 
hyp has no
   157           * sanitized copy of the feature id register.
   158           */
   159          BUILD_BUG_ON(PVM_ID_AA64AFR1_ALLOW != 0ULL);
   160          return 0;
   161  }
   162  
 > 163  u64 get_pvm_id_aa64isar0(const struct kvm_vcpu *vcpu)
   164  {
   165          return id_aa64isar0_el1_sys_val & PVM_ID_AA64ISAR0_ALLOW;
   166  }
   167  
 > 168  u64 get_pvm_id_aa64isar1(const struct kvm_vcpu *vcpu)
   169  {
   170          u64 allow_mask = PVM_ID_AA64ISAR1_ALLOW;
   171  
   172          if (!vcpu_has_ptrauth(vcpu))
   173                  allow_mask &= ~(ARM64_FEATURE_MASK(ID_AA64ISAR1_APA) |
   174                                  ARM64_FEATURE_MASK(ID_AA64ISAR1_API) |
   175                                  ARM64_FEATURE_MASK(ID_AA64ISAR1_GPA) |
   176                                  ARM64_FEATURE_MASK(ID_AA64ISAR1_GPI));
   177  
   178          return id_aa64isar1_el1_sys_val & allow_mask;
   179  }
   180  
 > 181  u64 get_pvm_id_aa64mmfr0(const struct kvm_vcpu *vcpu)
   182  {
   183          u64 set_mask;
   184  
   185          set_mask = 
get_restricted_features_unsigned(id_aa64mmfr0_el1_sys_val,
   186                  PVM_ID_AA64MMFR0_RESTRICT_UNSIGNED);
   187  
   188          return (id_aa64mmfr0_el1_sys_val & PVM_ID_AA64MMFR0_ALLOW) | 
set_mask;
   189  }
   190  
 > 191  u64 get_pvm_id_aa64mmfr1(const struct kvm_vcpu *vcpu)
   192  {
   193          return id_aa64mmfr1_el1_sys_val & PVM_ID_AA64MMFR1_ALLOW;
   194  }
   195  
 > 196  u64 get_pvm_id_aa64mmfr2(const struct kvm_vcpu *vcpu)
   197  {
   198          return id_aa64mmfr2_el1_sys_val & PVM_ID_AA64MMFR2_ALLOW;
   199  }
   200  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to