Comment 0 for bug 1943902

Revision history for this message
Khaled El Mously (kmously) wrote :

See https://canonical.lightning.force.com/lightning/r/Case/5004K000009WBzrQAG/view for more info

[Impact]
Using nvme hardware that uses swiotlb in confidential VMs can encounter hardware read/write errors.

[Fix]

The following upstream patches address this:

3d2d861eb03e nvme-pci: set min_align_mask
1f221a0d0dbf swiotlb: respect min_align_mask
16fc3cef33a0 swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single
26a7e094783d swiotlb: refactor swiotlb_tbl_map_single
ca10d0f8e530 swiotlb: clean up swiotlb_tbl_unmap_single
c32a77fd1878 swiotlb: factor out a nr_slots helper
c7fbeca757fe swiotlb: factor out an io_tlb_offset helper
b5d7ccb7aac3 swiotlb: add a IO_TLB_SIZE define

[Test]

Using a confidential VM, with 'swiotlb=force' set on the kernel command line, and an additional swiotlb nvme device attached:

$ sudo mkfs.xfs -f /dev/nvme2n1
meta-data=/dev/nvme2n1 isize=512 agcount=4, agsize=131072 blks
         = sectsz=512 attr=2, projid32bit=1
         = crc=1 finobt=1, sparse=0, rmapbt=0, refl
ink=0
data = bsize=4096 blocks=524288, imaxpct=25
         = sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
         = sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
mkfs.xfs: pwrite failed: Input/output error

Note the input/output error

The error no longer happens with the fixes applied.

[Regression Potential]