OvmfPkg/IoMmuDxe: Fix 1M and 2M buffer handling

The IoMmu keeps a pool of pre-allocated shared buffers in various sizes
to serve requests. Usage is tracked in a bitmap.

The bitmap masks for the 1M and 2M buffer pools are incorrect, causing
the same buffers getting handed out repeatedly, causing corrupted device
accesses.

The masks needs to be kept in sync with mReservedMemRanges below.
This sets the correct values for:

 - RESERVED_MEM_BITMAP_1M_MASK = (1 << 14) = 0x4000
 - RESERVED_MEM_BITMAP_2M_MASK = (1 << 15) | (1 << 16) = 0x18000

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
This commit is contained in:
Oliver Steffen
2025-10-15 13:17:36 -04:00
committed by mergify[bot]
parent 2522020ee1
commit e27cfda33b
+2 -2
View File
@@ -23,8 +23,8 @@ extern BOOLEAN mReservedSharedMemSupported;
#define RESERVED_MEM_BITMAP_4K_MASK 0xf
#define RESERVED_MEM_BITMAP_32K_MASK 0xff0
#define RESERVED_MEM_BITMAP_128K_MASK 0x3000
#define RESERVED_MEM_BITMAP_1M_MASK 0x40000
#define RESERVED_MEM_BITMAP_2M_MASK 0x180000
#define RESERVED_MEM_BITMAP_1M_MASK 0x4000
#define RESERVED_MEM_BITMAP_2M_MASK 0x18000
#define RESERVED_MEM_BITMAP_MASK 0x1fffff
/**