vfio/igd: fix calculation of graphics stolen memory

When copying the calculation of the stolen memory size for Intels integrated
graphics device of gen 9 and later from the Linux kernel [1], we missed
subtracting 0xf0 from the graphics mode select value for values above 0xf0.
This leads to QEMU reporting a very large size of the graphics stolen memory
area. That's just a waste of memory. Additionally the guest firmware might be
unable to allocate such a large buffer.

[1] 7c626ce4ba/arch/x86/kernel/early-quirks.c (L455-L460)

Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Fixes: 8719224166 ("vfio/igd: correctly calculate stolen memory size for gen 9 and later")
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
[ clg: Changed commit subject ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Corvin Köhne 2024-11-08 13:49:04 +01:00 committed by Cédric Le Goater
parent aff0c39c5b
commit 66650fd0cc
1 changed files with 1 additions and 1 deletions

View File

@ -501,7 +501,7 @@ static int igd_get_stolen_mb(int gen, uint32_t gmch)
if (gms < 0xf0)
return gms * 32;
else
return gms * 4 + 4;
return (gms - 0xf0) * 4 + 4;
}
}