Skip to content

Commit

Permalink
swiotlb-xen: ensure to issue well-formed XENMEM_exchange requests
Browse files Browse the repository at this point in the history
[ Upstream commit 9074c79 ]

While the hypervisor hasn't been enforcing this, we would still better
avoid issuing requests with GFNs not aligned to the requested order.
Instead of altering the value also in the call to panic(), drop it
there for being static and hence easy to determine without being part
of the panic message.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Link: https://lore.kernel.org/r/7b3998e3-1233-4e5a-89ec-d740e77eb166@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
jbeulich authored and gregkh committed Oct 9, 2021
1 parent 3ad674a commit 2e4a769
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/xen/swiotlb-xen.c
Expand Up @@ -232,10 +232,11 @@ void __init xen_swiotlb_init_early(void)
/*
* Get IO TLB memory from any location.
*/
start = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE);
start = memblock_alloc(PAGE_ALIGN(bytes),
IO_TLB_SEGSIZE << IO_TLB_SHIFT);
if (!start)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, PAGE_ALIGN(bytes), PAGE_SIZE);
panic("%s: Failed to allocate %lu bytes\n",
__func__, PAGE_ALIGN(bytes));

/*
* And replace that memory with pages under 4GB.
Expand Down

0 comments on commit 2e4a769

Please sign in to comment.