hw/igd: fix calculation of graphics stolen memory
PATCH 1/1 hw/igd: fix calculation of graphics stolen memory
From: Corvin Köhne <[email protected]>
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.
--- hw/vfio/igd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/igd.c +1 -1
@@ -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 ; } }
Signature · 1 line
2.47.0
Quoted 9 lines · Corvin Köhne
From: Corvin Köhne <[email protected]>
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
0xf0from the graphics mode select value for values above0xf0. 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.
Quoted 7 lines
Fixes 8719224166832ff8230d7dd8599f42bd60e2eb96Signed-off-by Corvin Köhne <[email protected]>--- hw/vfio/igd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 3 lines · On Fri, 8 Nov 2024 13:49:04 +0100 Corvin Köhne <[email protected]> wrote:
From: Corvin Köhne <[email protected]>
When copying the calculation of the stolen memory size for Intels integrated
* Intel's
Quoted 9 lines
graphics device of gen 9 and later from the Linux kernel [1], we missed subtracting
0xf0from the graphics mode select value for values above0xf0. 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.Fixes 8719224166832ff8230d7dd8599f42bd60e2eb96
Quoted 10 lines
Signed-off-by Corvin Köhne <[email protected]>--- hw/vfio/igd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/vfio/igd.c +0
-0
hw/vfio/igd.c static int igd_get_stolen_mb(int gen, uint32_t gmch) · line 504
Quoted 8 lines
hw/vfio/igd.c +1
-1@@ -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 ; } }
Cédric Le Goater
AppliedQuoted 9 lines · Corvin Köhne
From: Corvin Köhne <[email protected]>
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
0xf0from the graphics mode select value for values above0xf0. 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.
Quoted 4 lines
Fixes 8719224166832ff8230d7dd8599f42bd60e2eb96Signed-off-by Corvin Köhne <[email protected]>
I changed the subject to "vfio/igd: ...."
Applied to vfio-next.
Thanks,
C.