Lines Matching +full:fail +full:- +full:safe

1 // SPDX-License-Identifier: GPL-2.0
53 return -1; in uv_init()
71 goto fail; in setup_uv()
76 goto fail; in setup_uv()
82 fail: in setup_uv()
100 return -EINVAL; in uv_pin_shared()
123 * page. Let us emulate the newer variant (no-op). in uv_destroy_page()
127 return -EINVAL; in uv_destroy_page()
143 clear_bit(PG_arch_1, &page->flags); in uv_destroy_owned_page()
163 return -EINVAL; in uv_convert_from_secure()
178 clear_bit(PG_arch_1, &page->flags); in uv_convert_owned_from_secure()
198 if (folio->private) in expected_folio_refs()
209 return -EAGAIN; in make_folio_secure()
212 return -EBUSY; in make_folio_secure()
213 set_bit(PG_arch_1, &folio->flags); in make_folio_secure()
215 * If the UVC does not succeed or fail immediately, we don't want to in make_folio_secure()
220 * -EAGAIN and we let the callers deal with it. in make_folio_secure()
225 * Return -ENXIO if the folio was not mapped, -EINVAL for other errors. in make_folio_secure()
226 * If busy or partially completed, return -EAGAIN. in make_folio_secure()
231 return -EAGAIN; in make_folio_secure()
232 return uvcb->rc == 0x10a ? -ENXIO : -EINVAL; in make_folio_secure()
236 * should_export_before_import - Determine whether an export is needed
237 * before an import-like operation
241 * Returns whether an export is needed before every import-like operation.
263 if (uvcb->cmd == UVC_CMD_UNPIN_PAGE_SHARED) in should_export_before_import()
265 return atomic_read(&mm->context.protected_count) > 1; in should_export_before_import()
285 rc = -EFAULT; in gmap_make_secure()
286 mmap_read_lock(gmap->mm); in gmap_make_secure()
291 vma = vma_lookup(gmap->mm, uaddr); in gmap_make_secure()
296 * In case userspace does it anyway this will result in an -EFAULT for in gmap_make_secure()
304 rc = -ENXIO; in gmap_make_secure()
305 ptep = get_locked_pte(gmap->mm, uaddr, &ptelock); in gmap_make_secure()
310 rc = -EINVAL; in gmap_make_secure()
313 rc = -EAGAIN; in gmap_make_secure()
315 if (should_export_before_import(uvcb, gmap->mm)) in gmap_make_secure()
325 if (rc == -EAGAIN) in gmap_make_secure()
331 mmap_read_unlock(gmap->mm); in gmap_make_secure()
333 if (rc == -EAGAIN) { in gmap_make_secure()
336 * completion, this is just a useless check, but it is safe. in gmap_make_secure()
340 } else if (rc == -EBUSY) { in gmap_make_secure()
343 * still does not match our expected safe value, try with a in gmap_make_secure()
350 return -EAGAIN; in gmap_make_secure()
354 * expected safe value. The main culprits are usually in gmap_make_secure()
357 * reach the expected safe value. in gmap_make_secure()
363 } else if (rc == -ENXIO) { in gmap_make_secure()
365 return -EFAULT; in gmap_make_secure()
366 return -EAGAIN; in gmap_make_secure()
377 .guest_handle = gmap->guest_handle, in gmap_convert_to_secure()
386 * gmap_destroy_page - Destroy a guest page.
391 * fails, an attempt is made to export the page. If both attempts fail, an
401 rc = -EFAULT; in gmap_destroy_page()
402 mmap_read_lock(gmap->mm); in gmap_destroy_page()
407 vma = vma_lookup(gmap->mm, uaddr); in gmap_destroy_page()
425 * re-enter secure mode and import it, while the second CPU was in gmap_destroy_page()
435 mmap_read_unlock(gmap->mm); in gmap_destroy_page()
444 * no-op if the page is already exported.
461 * As secure pages are never huge, all 3 variants can co-exists. in arch_make_page_accessible()
463 if (!test_bit(PG_arch_1, &page->flags)) in arch_make_page_accessible()
468 clear_bit(PG_arch_1, &page->flags); in arch_make_page_accessible()
474 clear_bit(PG_arch_1, &page->flags); in arch_make_page_accessible()
697 int rc = -ENOMEM; in uv_info_init()
704 return -ENOMEM; in uv_info_init()
712 rc = -ENOMEM; in uv_info_init()
716 rc = sysfs_create_group(&uv_query_kset->kobj, &uv_query_attr_group); in uv_info_init()