[RFC,v4,2/6] target-arm: move gicv3_class_name from machine to kvm_arm.h
diff mbox

Message ID 1467798364-9049-3-git-send-email-eric.auger@redhat.com
State New
Headers show

Commit Message

Auger Eric July 6, 2016, 9:46 a.m. UTC
Machine.c contains code related to migration. Let's move
gicv3_class_name to kvm_arm.h instead.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>

---

v4: creation
---
 target-arm/kvm_arm.h | 16 +++++++++++++++-
 target-arm/machine.c | 16 ----------------
 2 files changed, 15 insertions(+), 17 deletions(-)

Comments

Auger Eric July 10, 2016, 8:17 p.m. UTC | #1
Hi
On 06/07/2016 11:46, Eric Auger wrote:
> Machine.c contains code related to migration. Let's move
> gicv3_class_name to kvm_arm.h instead.
> 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> 
> ---
> 
> v4: creation
> ---
>  target-arm/kvm_arm.h | 16 +++++++++++++++-
>  target-arm/machine.c | 16 ----------------
>  2 files changed, 15 insertions(+), 17 deletions(-)
> 
> diff --git a/target-arm/kvm_arm.h b/target-arm/kvm_arm.h
> index 544e404..4fb6d15 100644
> --- a/target-arm/kvm_arm.h
> +++ b/target-arm/kvm_arm.h
> @@ -223,7 +223,21 @@ static inline const char *gic_class_name(void)
>   *
>   * Returns: class name to use
>   */
> -const char *gicv3_class_name(void);
> +static inline const char *gicv3_class_name(void)
> +{
> +    if (kvm_irqchip_in_kernel()) {
> +#ifdef TARGET_AARCH64
> +        return "kvm-arm-gicv3";
> +#else
> +        error_report("KVM GICv3 acceleration is not supported on this "
> +                     "platform");
this fails to compile without adding
#include "qemu/error-report.h"

I will correct this on the next version.

Sorry for the oversight.

Best Regards

Eric
> +#endif
> +    } else {
> +        return "arm-gicv3";
> +    }
> +
> +    exit(1);
> +}
>  
>  /**
>   * kvm_arm_handle_debug:
> diff --git a/target-arm/machine.c b/target-arm/machine.c
> index 2dbeb82..d90943b 100644
> --- a/target-arm/machine.c
> +++ b/target-arm/machine.c
> @@ -331,19 +331,3 @@ const VMStateDescription vmstate_arm_cpu = {
>          NULL
>      }
>  };
> -
> -const char *gicv3_class_name(void)
> -{
> -    if (kvm_irqchip_in_kernel()) {
> -#ifdef TARGET_AARCH64
> -        return "kvm-arm-gicv3";
> -#else
> -        error_report("KVM GICv3 acceleration is not supported on this "
> -                     "platform");
> -#endif
> -    } else {
> -        return "arm-gicv3";
> -    }
> -
> -    exit(1);
> -}
>

Patch
diff mbox

diff --git a/target-arm/kvm_arm.h b/target-arm/kvm_arm.h
index 544e404..4fb6d15 100644
--- a/target-arm/kvm_arm.h
+++ b/target-arm/kvm_arm.h
@@ -223,7 +223,21 @@  static inline const char *gic_class_name(void)
  *
  * Returns: class name to use
  */
-const char *gicv3_class_name(void);
+static inline const char *gicv3_class_name(void)
+{
+    if (kvm_irqchip_in_kernel()) {
+#ifdef TARGET_AARCH64
+        return "kvm-arm-gicv3";
+#else
+        error_report("KVM GICv3 acceleration is not supported on this "
+                     "platform");
+#endif
+    } else {
+        return "arm-gicv3";
+    }
+
+    exit(1);
+}
 
 /**
  * kvm_arm_handle_debug:
diff --git a/target-arm/machine.c b/target-arm/machine.c
index 2dbeb82..d90943b 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -331,19 +331,3 @@  const VMStateDescription vmstate_arm_cpu = {
         NULL
     }
 };
-
-const char *gicv3_class_name(void)
-{
-    if (kvm_irqchip_in_kernel()) {
-#ifdef TARGET_AARCH64
-        return "kvm-arm-gicv3";
-#else
-        error_report("KVM GICv3 acceleration is not supported on this "
-                     "platform");
-#endif
-    } else {
-        return "arm-gicv3";
-    }
-
-    exit(1);
-}