Lines Matching refs:state

29 void test_nested_state(struct kvm_vcpu *vcpu, struct kvm_nested_state *state)
31 vcpu_nested_state_set(vcpu, state);
35 struct kvm_nested_state *state,
40 rv = __vcpu_nested_state_set(vcpu, state);
48 struct kvm_nested_state *state)
50 test_nested_state_expect_errno(vcpu, state, EINVAL);
54 struct kvm_nested_state *state)
56 test_nested_state_expect_errno(vcpu, state, EFAULT);
59 void set_revision_id_for_vmcs12(struct kvm_nested_state *state,
63 memcpy(&state->data, &vmcs12_revision, sizeof(u32));
66 void set_default_state(struct kvm_nested_state *state)
68 memset(state, 0, sizeof(*state));
69 state->flags = KVM_STATE_NESTED_RUN_PENDING |
71 state->format = 0;
72 state->size = sizeof(*state);
75 void set_default_vmx_state(struct kvm_nested_state *state, int size)
77 memset(state, 0, size);
79 state->flags = KVM_STATE_NESTED_EVMCS;
80 state->format = 0;
81 state->size = size;
82 state->hdr.vmx.vmxon_pa = 0x1000;
83 state->hdr.vmx.vmcs12_pa = 0x2000;
84 state->hdr.vmx.smm.flags = 0;
85 set_revision_id_for_vmcs12(state, VMCS12_REVISION);
92 struct kvm_nested_state *state =
96 set_default_vmx_state(state, state_sz);
97 state->format = 1;
98 test_nested_state_expect_einval(vcpu, state);
104 set_default_vmx_state(state, state_sz);
105 test_nested_state_expect_einval(vcpu, state);
112 set_default_vmx_state(state, state_sz);
113 state->hdr.vmx.vmxon_pa = -1ull;
114 test_nested_state_expect_einval(vcpu, state);
116 state->hdr.vmx.vmcs12_pa = -1ull;
117 state->flags = KVM_STATE_NESTED_EVMCS;
118 test_nested_state_expect_einval(vcpu, state);
120 state->flags = 0;
121 test_nested_state(vcpu, state);
128 * setting the nested state. When the eVMCS flag is not set, the
131 set_default_vmx_state(state, state_sz);
132 state->flags = 0;
133 state->hdr.vmx.vmxon_pa = -1ull;
134 state->hdr.vmx.vmcs12_pa = -1ull;
135 test_nested_state(vcpu, state);
142 state->flags = KVM_STATE_NESTED_EVMCS;
143 test_nested_state_expect_einval(vcpu, state);
145 test_nested_state(vcpu, state);
149 state->hdr.vmx.smm.flags = 1;
150 test_nested_state_expect_einval(vcpu, state);
153 set_default_vmx_state(state, state_sz);
154 state->hdr.vmx.flags = ~0;
155 test_nested_state_expect_einval(vcpu, state);
158 set_default_vmx_state(state, state_sz);
159 state->hdr.vmx.vmxon_pa = -1ull;
160 state->flags = 0;
161 test_nested_state_expect_einval(vcpu, state);
164 set_default_vmx_state(state, state_sz);
165 state->hdr.vmx.vmxon_pa = 1;
166 test_nested_state_expect_einval(vcpu, state);
172 set_default_vmx_state(state, state_sz);
173 state->flags = KVM_STATE_NESTED_GUEST_MODE |
175 state->hdr.vmx.smm.flags = KVM_STATE_NESTED_SMM_GUEST_MODE;
176 test_nested_state_expect_einval(vcpu, state);
183 set_default_vmx_state(state, state_sz);
184 state->hdr.vmx.smm.flags = ~(KVM_STATE_NESTED_SMM_GUEST_MODE |
186 test_nested_state_expect_einval(vcpu, state);
189 set_default_vmx_state(state, state_sz);
190 state->flags = 0;
191 state->hdr.vmx.smm.flags = KVM_STATE_NESTED_SMM_GUEST_MODE;
192 test_nested_state_expect_einval(vcpu, state);
198 set_default_vmx_state(state, state_sz);
199 state->size = sizeof(*state);
200 state->flags = 0;
201 test_nested_state_expect_einval(vcpu, state);
203 set_default_vmx_state(state, state_sz);
204 state->size = sizeof(*state);
205 state->flags = 0;
206 state->hdr.vmx.vmcs12_pa = -1;
207 test_nested_state(vcpu, state);
213 set_default_vmx_state(state, state_sz);
214 state->flags = 0;
215 test_nested_state(vcpu, state);
218 set_default_vmx_state(state, state_sz);
219 state->size = sizeof(*state);
220 state->flags = 0;
221 state->hdr.vmx.vmcs12_pa = -1;
222 state->hdr.vmx.flags = ~0;
223 test_nested_state_expect_einval(vcpu, state);
226 set_default_vmx_state(state, state_sz);
227 state->hdr.vmx.vmxon_pa = 0;
228 state->hdr.vmx.vmcs12_pa = 0;
229 test_nested_state_expect_einval(vcpu, state);
232 * Test that if we leave nesting the state reflects that when we get
235 set_default_vmx_state(state, state_sz);
236 state->hdr.vmx.vmxon_pa = -1ull;
237 state->hdr.vmx.vmcs12_pa = -1ull;
238 state->flags = 0;
239 test_nested_state(vcpu, state);
240 vcpu_nested_state_get(vcpu, state);
241 TEST_ASSERT(state->size >= sizeof(*state) && state->size <= state_sz,
243 sizeof(*state), state_sz, state->size);
244 TEST_ASSERT(state->hdr.vmx.vmxon_pa == -1ull, "vmxon_pa must be -1ull.");
245 TEST_ASSERT(state->hdr.vmx.vmcs12_pa == -1ull, "vmcs_pa must be -1ull.");
247 free(state);
253 struct kvm_nested_state state;
277 set_default_state(&state);
278 state.size = 0;
279 test_nested_state_expect_einval(vcpu, &state);
288 set_default_state(&state);
289 state.flags = 0xf;
290 test_nested_state_expect_einval(vcpu, &state);
296 set_default_state(&state);
297 state.flags = KVM_STATE_NESTED_RUN_PENDING;
298 test_nested_state_expect_einval(vcpu, &state);