Add two more assertions to catch busdma problems. Each segment provided

by busdma to the blkfront driver must be an integer number of sectors,
and must be aligned in memory on a "sector" boundary.

Having these assertions yesterday would have made finding the bug fixed
in r293698 somewhat easier.
This commit is contained in:
Colin Percival 2016-01-11 21:02:30 +00:00
parent c0ada0377a
commit cbb261aec7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=293700

View file

@ -170,6 +170,11 @@ xbd_mksegarray(bus_dma_segment_t *segs, int nsegs,
int ref;
while (sg < last_block_sg) {
KASSERT(segs->ds_addr % (1 << XBD_SECTOR_SHFT) == 0,
("XEN disk driver I/O must be sector aligned"));
KASSERT(segs->ds_len % (1 << XBD_SECTOR_SHFT) == 0,
("XEN disk driver I/Os must be a multiple of "
"the sector length"));
buffer_ma = segs->ds_addr;
fsect = (buffer_ma & PAGE_MASK) >> XBD_SECTOR_SHFT;
lsect = fsect + (segs->ds_len >> XBD_SECTOR_SHFT) - 1;