u-boot/drivers/xen
AKASHI Takahiro 654580eee1 xen: pvblock: fix the maximum io size in one operation
The current implementation may cause BUG_ON() in blkfront_aio()
	BUG_ON(n > BLKIF_MAX_SEGMENTS_PER_REQUEST);

In pvblock_iop(), a read/write operation will be split into smaller
chunks of data so that the size in one access (aio_nbytes) is limited
to, at the maximum,
	BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE

But this works only if when the *buffer* passed in to pvblock_io()
is page-aligned. If not, the given data region may stand across
(BLKIF_MAX_SEGMENTS_PER_REQUEST + 1) pages. See the logic in
blkfront_aio():
	start = (uintptr_t)aiocbp->aio_buf & PAGE_MASK;
	end = ((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes +
	       PAGE_SIZE - 1) & PAGE_MASK;
Then this will lead to BUG_ON() above.

This can be fixed by decreasing the maximum size of aio_nbytes.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: commit 3a739cc6c9 ("xen: pvblock: Implement front-back protocol and do IO")
2023-11-29 09:32:15 -05:00
..
events.c Correct SPL uses of XEN_SERIAL 2023-02-10 07:41:41 -05:00
gnttab.c WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
hypervisor.c xen: Limit execution to EL1 only 2023-04-25 15:31:28 -04:00
Kconfig xen: Fix Kconfig dependencies 2023-04-25 15:31:28 -04:00
Makefile xen: pvblock: Add initial support for para-virtualized block driver 2020-08-14 15:18:30 -04:00
pvblock.c xen: pvblock: fix the maximum io size in one operation 2023-11-29 09:32:15 -05:00
xenbus.c xen: Port Xen bus driver from mini-os 2020-08-14 15:18:30 -04:00