Message ID | 20241108124904.93201-1-corvin.koehne@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hw/igd: fix calculation of graphics stolen memory | expand |
On 8/11/24 12:49, Corvin Köhne wrote: > From: Corvin Köhne <c.koehne@beckhoff.com> > > 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] https://github.com/torvalds/linux/blob/7c626ce4bae1ac14f60076d00eafe71af30450ba/arch/x86/kernel/early-quirks.c#L455-L460 > > Fixes: 8719224166832ff8230d7dd8599f42bd60e2eb96 > Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com> > --- > hw/vfio/igd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index a95d441f68..732f9c37a6 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -498,7 +498,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; } }