diff mbox series

[v2,06/13] acpi: move acpi_align_size to acpi-common.h

Message ID 20200505134305.22666-7-kraxel@redhat.com
State New
Headers show
Series None | expand

Commit Message

Gerd Hoffmann May 5, 2020, 1:42 p.m. UTC
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/acpi-common.h | 19 +++++++++++++++++++
 hw/i386/acpi-build.c  | 18 ------------------
 2 files changed, 19 insertions(+), 18 deletions(-)

Comments

Philippe Mathieu-Daudé May 5, 2020, 1:53 p.m. UTC | #1
Hi Gerd,

On 5/5/20 3:42 PM, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   hw/i386/acpi-common.h | 19 +++++++++++++++++++
>   hw/i386/acpi-build.c  | 18 ------------------
>   2 files changed, 19 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
> index 5788a13da9ca..f837bb17163b 100644
> --- a/hw/i386/acpi-common.h
> +++ b/hw/i386/acpi-common.h
> @@ -3,12 +3,31 @@
>   
>   #include "include/hw/acpi/acpi-defs.h"
>   #include "include/hw/acpi/acpi_dev_interface.h"
> +#include "include/hw/acpi/aml-build.h"
>   #include "include/hw/acpi/bios-linker-loader.h"
>   #include "include/hw/i386/x86.h"
>   
> +/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
> + * -M pc-i440fx-2.0.  Even if the actual amount of AML generated grows
> + * a little bit, there should be plenty of free space since the DSDT
> + * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1.
> + */
> +#define ACPI_BUILD_LEGACY_CPU_AML_SIZE    97
> +#define ACPI_BUILD_ALIGN_SIZE             0x1000
> +
> +#define ACPI_BUILD_TABLE_SIZE             0x20000
> +
>   /* Default IOAPIC ID */
>   #define ACPI_BUILD_IOAPIC_ID 0x0
>   
> +static inline void acpi_align_size(GArray *blob, unsigned align)
> +{
> +    /* Align size to multiple of given size. This reduces the chance
> +     * we need to change size in the future (breaking cross version migration).
> +     */
> +    g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
> +}
> +
>   void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
>                        X86MachineState *x86ms, AcpiDeviceIf *adev,
>                        bool has_pci);
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index d1f14394734e..dc3b62468439 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -72,16 +72,6 @@
>   #include "hw/acpi/ipmi.h"
>   #include "hw/acpi/hmat.h"
>   
> -/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
> - * -M pc-i440fx-2.0.  Even if the actual amount of AML generated grows
> - * a little bit, there should be plenty of free space since the DSDT
> - * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1.
> - */
> -#define ACPI_BUILD_LEGACY_CPU_AML_SIZE    97

Can we keep the ACPI_BUILD_LEGACY_CPU_AML_SIZE definition in this file?
The rest of the patch is OK.

> -#define ACPI_BUILD_ALIGN_SIZE             0x1000
> -
> -#define ACPI_BUILD_TABLE_SIZE             0x20000
> -
>   /* #define DEBUG_ACPI_BUILD */
>   #ifdef DEBUG_ACPI_BUILD
>   #define ACPI_BUILD_DPRINTF(fmt, ...)        \
> @@ -267,14 +257,6 @@ static void acpi_get_pci_holes(Range *hole, Range *hole64)
>                                                  NULL));
>   }
>   
> -static void acpi_align_size(GArray *blob, unsigned align)
> -{
> -    /* Align size to multiple of given size. This reduces the chance
> -     * we need to change size in the future (breaking cross version migration).
> -     */
> -    g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
> -}
> -
>   static void build_append_pcihp_notify_entry(Aml *method, int slot)
>   {
>       Aml *if_ctx;
>
Igor Mammedov May 5, 2020, 2:30 p.m. UTC | #2
On Tue,  5 May 2020 15:42:58 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

patch probably isn't needed, see my comment on 9/13

> ---
>  hw/i386/acpi-common.h | 19 +++++++++++++++++++
>  hw/i386/acpi-build.c  | 18 ------------------
>  2 files changed, 19 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
> index 5788a13da9ca..f837bb17163b 100644
> --- a/hw/i386/acpi-common.h
> +++ b/hw/i386/acpi-common.h
> @@ -3,12 +3,31 @@
>  
>  #include "include/hw/acpi/acpi-defs.h"
>  #include "include/hw/acpi/acpi_dev_interface.h"
> +#include "include/hw/acpi/aml-build.h"
>  #include "include/hw/acpi/bios-linker-loader.h"
>  #include "include/hw/i386/x86.h"
>  
> +/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
> + * -M pc-i440fx-2.0.  Even if the actual amount of AML generated grows
> + * a little bit, there should be plenty of free space since the DSDT
> + * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1.
> + */
> +#define ACPI_BUILD_LEGACY_CPU_AML_SIZE    97
> +#define ACPI_BUILD_ALIGN_SIZE             0x1000
> +
> +#define ACPI_BUILD_TABLE_SIZE             0x20000
> +
>  /* Default IOAPIC ID */
>  #define ACPI_BUILD_IOAPIC_ID 0x0
>  
> +static inline void acpi_align_size(GArray *blob, unsigned align)
> +{
> +    /* Align size to multiple of given size. This reduces the chance
> +     * we need to change size in the future (breaking cross version migration).
> +     */
> +    g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
> +}
> +
>  void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
>                       X86MachineState *x86ms, AcpiDeviceIf *adev,
>                       bool has_pci);
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index d1f14394734e..dc3b62468439 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -72,16 +72,6 @@
>  #include "hw/acpi/ipmi.h"
>  #include "hw/acpi/hmat.h"
>  
> -/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
> - * -M pc-i440fx-2.0.  Even if the actual amount of AML generated grows
> - * a little bit, there should be plenty of free space since the DSDT
> - * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1.
> - */
> -#define ACPI_BUILD_LEGACY_CPU_AML_SIZE    97
> -#define ACPI_BUILD_ALIGN_SIZE             0x1000
> -
> -#define ACPI_BUILD_TABLE_SIZE             0x20000
> -
>  /* #define DEBUG_ACPI_BUILD */
>  #ifdef DEBUG_ACPI_BUILD
>  #define ACPI_BUILD_DPRINTF(fmt, ...)        \
> @@ -267,14 +257,6 @@ static void acpi_get_pci_holes(Range *hole, Range *hole64)
>                                                 NULL));
>  }
>  
> -static void acpi_align_size(GArray *blob, unsigned align)
> -{
> -    /* Align size to multiple of given size. This reduces the chance
> -     * we need to change size in the future (breaking cross version migration).
> -     */
> -    g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
> -}
> -
>  static void build_append_pcihp_notify_entry(Aml *method, int slot)
>  {
>      Aml *if_ctx;
diff mbox series

Patch

diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
index 5788a13da9ca..f837bb17163b 100644
--- a/hw/i386/acpi-common.h
+++ b/hw/i386/acpi-common.h
@@ -3,12 +3,31 @@ 
 
 #include "include/hw/acpi/acpi-defs.h"
 #include "include/hw/acpi/acpi_dev_interface.h"
+#include "include/hw/acpi/aml-build.h"
 #include "include/hw/acpi/bios-linker-loader.h"
 #include "include/hw/i386/x86.h"
 
+/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
+ * -M pc-i440fx-2.0.  Even if the actual amount of AML generated grows
+ * a little bit, there should be plenty of free space since the DSDT
+ * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1.
+ */
+#define ACPI_BUILD_LEGACY_CPU_AML_SIZE    97
+#define ACPI_BUILD_ALIGN_SIZE             0x1000
+
+#define ACPI_BUILD_TABLE_SIZE             0x20000
+
 /* Default IOAPIC ID */
 #define ACPI_BUILD_IOAPIC_ID 0x0
 
+static inline void acpi_align_size(GArray *blob, unsigned align)
+{
+    /* Align size to multiple of given size. This reduces the chance
+     * we need to change size in the future (breaking cross version migration).
+     */
+    g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
+}
+
 void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
                      X86MachineState *x86ms, AcpiDeviceIf *adev,
                      bool has_pci);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index d1f14394734e..dc3b62468439 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -72,16 +72,6 @@ 
 #include "hw/acpi/ipmi.h"
 #include "hw/acpi/hmat.h"
 
-/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
- * -M pc-i440fx-2.0.  Even if the actual amount of AML generated grows
- * a little bit, there should be plenty of free space since the DSDT
- * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1.
- */
-#define ACPI_BUILD_LEGACY_CPU_AML_SIZE    97
-#define ACPI_BUILD_ALIGN_SIZE             0x1000
-
-#define ACPI_BUILD_TABLE_SIZE             0x20000
-
 /* #define DEBUG_ACPI_BUILD */
 #ifdef DEBUG_ACPI_BUILD
 #define ACPI_BUILD_DPRINTF(fmt, ...)        \
@@ -267,14 +257,6 @@  static void acpi_get_pci_holes(Range *hole, Range *hole64)
                                                NULL));
 }
 
-static void acpi_align_size(GArray *blob, unsigned align)
-{
-    /* Align size to multiple of given size. This reduces the chance
-     * we need to change size in the future (breaking cross version migration).
-     */
-    g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
-}
-
 static void build_append_pcihp_notify_entry(Aml *method, int slot)
 {
     Aml *if_ctx;