Lines Matching +full:fault +full:- +full:inject

1 // SPDX-License-Identifier: GPL-2.0
28 bool fault; in sgx_get_encls_gva() local
30 /* Skip vmcs.GUEST_DS retrieval for 64-bit mode to avoid VMREADs. */ in sgx_get_encls_gva()
38 fault = true; in sgx_get_encls_gva()
41 fault = is_noncanonical_address(*gva, vcpu); in sgx_get_encls_gva()
44 fault = (s.unusable) || in sgx_get_encls_gva()
48 (((u64)*gva + size - 1) > s.limit + 1)); in sgx_get_encls_gva()
50 if (fault) in sgx_get_encls_gva()
52 return fault ? -EINVAL : 0; in sgx_get_encls_gva()
68 return -EFAULT; in sgx_read_hva()
86 return -EFAULT; in sgx_gva_to_gpa()
97 return -EFAULT; in sgx_gpa_to_hva()
110 * A non-EPCM #PF indicates a bad userspace HVA. This *should* check in sgx_inject_fault()
120 * If the guest thinks it's running on SGX2 hardware, inject an SGX in sgx_inject_fault()
121 * #PF if the fault matches an EPCM fault signature (#GP on SGX1, in sgx_inject_fault()
146 struct sgx_secs *contents = (struct sgx_secs *)pageinfo->contents; in __handle_encls_ecreate()
160 miscselect = contents->miscselect; in __handle_encls_ecreate()
161 attributes = contents->attributes; in __handle_encls_ecreate()
162 xfrm = contents->xfrm; in __handle_encls_ecreate()
163 size = contents->size; in __handle_encls_ecreate()
166 if (!vcpu->kvm->arch.sgx_provisioning_allowed && in __handle_encls_ecreate()
168 if (sgx_12_1->eax & SGX_ATTR_PROVISIONKEY) in __handle_encls_ecreate()
180 if ((u32)miscselect & ~sgx_12_0->ebx || in __handle_encls_ecreate()
181 (u32)attributes & ~sgx_12_1->eax || in __handle_encls_ecreate()
182 (u32)(attributes >> 32) & ~sgx_12_1->ebx || in __handle_encls_ecreate()
183 (u32)xfrm & ~sgx_12_1->ecx || in __handle_encls_ecreate()
184 (u32)(xfrm >> 32) & ~sgx_12_1->edx || in __handle_encls_ecreate()
185 xfrm & ~(vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE) || in __handle_encls_ecreate()
192 max_size_log2 = (attributes & SGX_ATTR_MODE64BIT) ? sgx_12_0->edx >> 8 : in __handle_encls_ecreate()
193 sgx_12_0->edx; in __handle_encls_ecreate()
202 * 2) -EFAULT: ECREATE was run but faulted, and trapnr was set to the in __handle_encls_ecreate()
204 * 3) -EINVAL: access_ok() on @secs_hva failed. This should never in __handle_encls_ecreate()
211 if (ret == -EFAULT) in __handle_encls_ecreate()
254 * Resume the guest on failure to inject a #PF. in handle_encls_ecreate()
279 return -ENOMEM; in handle_encls_ecreate()
312 * Resume the guest on failure to inject a #PF. in handle_encls_einit()
332 vmx->msr_ia32_sgxlepubkeyhash, &trapnr); in handle_encls_einit()
334 if (ret == -EFAULT) in handle_encls_einit()
338 * sgx_virt_einit() returns -EINVAL when access_ok() fails on @sig_hva, in handle_encls_einit()
378 return (to_vmx(vcpu)->msr_ia32_feature_control & bits) == bits; in sgx_enabled_in_guest_bios()
397 vcpu->run->exit_reason = KVM_EXIT_UNKNOWN; in handle_encls()
398 vcpu->run->hw.hardware_exit_reason = EXIT_REASON_ENCLS; in handle_encls()
412 * MSRs exist but are read-only (locked and not writable). in setup_default_sgx_lepubkeyhash()
432 memcpy(vmx->msr_ia32_sgxlepubkeyhash, sgx_pubkey_hash, in vcpu_setup_sgx_lepubkeyhash()
438 * restrictions if the guest's allowed-1 settings diverge from hardware.
445 if (!vcpu->kvm->arch.sgx_provisioning_allowed) in sgx_intercept_encls_ecreate()
453 if (guest_cpuid->ebx != ebx || guest_cpuid->edx != edx) in sgx_intercept_encls_ecreate()
461 if (guest_cpuid->eax != eax || guest_cpuid->ebx != ebx || in sgx_intercept_encls_ecreate()
462 guest_cpuid->ecx != ecx || guest_cpuid->edx != edx) in sgx_intercept_encls_ecreate()
474 * host, trap all ENCLS leafs and inject #UD/#GP as needed to emulate in vmx_write_encls_bitmap()
477 u64 bitmap = -1ull; in vmx_write_encls_bitmap()
498 * The MSRs are not loaded/saved on VM-Enter/VM-Exit as writing in vmx_write_encls_bitmap()
507 bitmap |= vmcs12->encls_exiting_bitmap; in vmx_write_encls_bitmap()