From: kernel test robot <lkp@intel.com>
To: Fuad Tabba <tabba@google.com>, kvmarm@lists.cs.columbia.edu
Cc: kbuild-all@lists.01.org, maz@kernel.org, pbonzini@redhat.com,
will@kernel.org
Subject: Re: [PATCH v7 07/11] KVM: arm64: Add handlers for protected VM System Registers
Date: Sun, 10 Oct 2021 08:43:41 +0800 [thread overview]
Message-ID: <202110100815.3OAl08g4-lkp@intel.com> (raw)
In-Reply-To: <20211008155832.1415010-8-tabba@google.com>
[-- Attachment #1: Type: text/plain, Size: 10876 bytes --]
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 <lkp@intel.com>
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/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55808 bytes --]
[-- Attachment #3: Type: text/plain, Size: 151 bytes --]
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2021-10-10 0:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 15:58 [PATCH v7 00/11] KVM: arm64: Fixed features for protected VMs Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 01/11] KVM: arm64: Move __get_fault_info() and co into their own include file Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 02/11] KVM: arm64: Don't include switch.h into nvhe/kvm-main.c Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 03/11] KVM: arm64: Move early handlers to per-EC handlers Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 04/11] KVM: arm64: Pass struct kvm " Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 05/11] KVM: arm64: Add missing field descriptor for MDCR_EL2 Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 06/11] KVM: arm64: Simplify masking out MTE in feature id reg Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 07/11] KVM: arm64: Add handlers for protected VM System Registers Fuad Tabba
2021-10-10 0:43 ` kernel test robot [this message]
2021-10-08 15:58 ` [PATCH v7 08/11] KVM: arm64: Initialize trap registers for protected VMs Fuad Tabba
2021-10-10 1:52 ` kernel test robot
2021-10-08 15:58 ` [PATCH v7 09/11] KVM: arm64: Move sanitized copies of CPU features Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 10/11] KVM: arm64: Trap access to pVM restricted features Fuad Tabba
2021-10-08 15:58 ` [PATCH v7 11/11] KVM: arm64: Handle protected guests at 32 bits Fuad Tabba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202110100815.3OAl08g4-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=tabba@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox