vfio/igd: canonicalize memory size calculations
authorTomita Moeko <tomitamoeko@gmail.com>
Fri, 6 Dec 2024 12:27:42 +0000 (20:27 +0800)
committerCédric Le Goater <clg@redhat.com>
Thu, 26 Dec 2024 06:23:37 +0000 (07:23 +0100)
commit1e1eac5f3dcd9836088d59ced0ba23337f49eb04
treecfcd002c51a57f7026a3f3a1c098509351f7f990
parent0bb758e97acec8c7bbd1c3d4d61ca20a050ae9b0
vfio/igd: canonicalize memory size calculations

Add helper functions igd_gtt_memory_size() and igd_stolen_size() for
calculating GTT stolen memory and Data stolen memory size in bytes,
and use macros to replace the hardware-related magic numbers for
better readability.

Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Link: https://lore.kernel.org/r/20241206122749.9893-5-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/vfio/igd.c