sev.c (7318234c8d7c0f209f993ee46a7ea148efdb28b9) | sev.c (88dca4ca5a93d2c09e5bbc6a62fbfc3af83c4fca) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * AMD SVM-SEV support 6 * 7 * Copyright 2010 Red Hat, Inc. and/or its affiliates. 8 */ --- 322 unchanged lines hidden (view full) --- 331 if (locked > lock_limit && !capable(CAP_IPC_LOCK)) { 332 pr_err("SEV: %lu locked pages exceed the lock limit of %lu.\n", locked, lock_limit); 333 return NULL; 334 } 335 336 /* Avoid using vmalloc for smaller buffers. */ 337 size = npages * sizeof(struct page *); 338 if (size > PAGE_SIZE) | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * AMD SVM-SEV support 6 * 7 * Copyright 2010 Red Hat, Inc. and/or its affiliates. 8 */ --- 322 unchanged lines hidden (view full) --- 331 if (locked > lock_limit && !capable(CAP_IPC_LOCK)) { 332 pr_err("SEV: %lu locked pages exceed the lock limit of %lu.\n", locked, lock_limit); 333 return NULL; 334 } 335 336 /* Avoid using vmalloc for smaller buffers. */ 337 size = npages * sizeof(struct page *); 338 if (size > PAGE_SIZE) |
339 pages = __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_ZERO, 340 PAGE_KERNEL); | 339 pages = __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_ZERO); |
341 else 342 pages = kmalloc(size, GFP_KERNEL_ACCOUNT); 343 344 if (!pages) 345 return NULL; 346 347 /* Pin the user virtual address. */ 348 npinned = get_user_pages_fast(uaddr, npages, write ? FOLL_WRITE : 0, pages); --- 843 unchanged lines hidden --- | 340 else 341 pages = kmalloc(size, GFP_KERNEL_ACCOUNT); 342 343 if (!pages) 344 return NULL; 345 346 /* Pin the user virtual address. */ 347 npinned = get_user_pages_fast(uaddr, npages, write ? FOLL_WRITE : 0, pages); --- 843 unchanged lines hidden --- |