diff mbox series

[v2,2/6] spapr: support memory unplug for qtest

Message ID 20190215133005.15955-3-david@redhat.com (mailing list archive)
State New, archived
Headers show
Series tests: Add device unplug tests | expand

Commit Message

David Hildenbrand Feb. 15, 2019, 1:30 p.m. UTC
Fake availability of OV5_HP_EVT, so we can test memory unplug in qtest.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 hw/ppc/spapr_ovec.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Greg Kurz Feb. 15, 2019, 2:30 p.m. UTC | #1
On Fri, 15 Feb 2019 14:30:01 +0100
David Hildenbrand <david@redhat.com> wrote:

> Fake availability of OV5_HP_EVT, so we can test memory unplug in qtest.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/ppc/spapr_ovec.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/hw/ppc/spapr_ovec.c b/hw/ppc/spapr_ovec.c
> index 318bf33de4..12510b236a 100644
> --- a/hw/ppc/spapr_ovec.c
> +++ b/hw/ppc/spapr_ovec.c
> @@ -16,6 +16,7 @@
>  #include "qemu/bitmap.h"
>  #include "exec/address-spaces.h"
>  #include "qemu/error-report.h"
> +#include "sysemu/qtest.h"
>  #include "trace.h"
>  #include <libfdt.h>
>  
> @@ -131,6 +132,11 @@ bool spapr_ovec_test(sPAPROptionVector *ov, long bitnr)
>      g_assert(ov);
>      g_assert(bitnr < OV_MAXBITS);
>  
> +    /* support memory unplug for qtest */
> +    if (qtest_enabled() && bitnr == OV5_HP_EVT) {
> +        return true;
> +    }
> +
>      return test_bit(bitnr, ov->bitmap) ? true : false;
>  }
>
David Gibson Feb. 17, 2019, 11:59 p.m. UTC | #2
On Fri, Feb 15, 2019 at 02:30:01PM +0100, David Hildenbrand wrote:
> Fake availability of OV5_HP_EVT, so we can test memory unplug in qtest.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>

Kinda gross, but I don't see a better way of handling this quickly,
so,

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/ppc/spapr_ovec.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/hw/ppc/spapr_ovec.c b/hw/ppc/spapr_ovec.c
> index 318bf33de4..12510b236a 100644
> --- a/hw/ppc/spapr_ovec.c
> +++ b/hw/ppc/spapr_ovec.c
> @@ -16,6 +16,7 @@
>  #include "qemu/bitmap.h"
>  #include "exec/address-spaces.h"
>  #include "qemu/error-report.h"
> +#include "sysemu/qtest.h"
>  #include "trace.h"
>  #include <libfdt.h>
>  
> @@ -131,6 +132,11 @@ bool spapr_ovec_test(sPAPROptionVector *ov, long bitnr)
>      g_assert(ov);
>      g_assert(bitnr < OV_MAXBITS);
>  
> +    /* support memory unplug for qtest */
> +    if (qtest_enabled() && bitnr == OV5_HP_EVT) {
> +        return true;
> +    }
> +
>      return test_bit(bitnr, ov->bitmap) ? true : false;
>  }
>
diff mbox series

Patch

diff --git a/hw/ppc/spapr_ovec.c b/hw/ppc/spapr_ovec.c
index 318bf33de4..12510b236a 100644
--- a/hw/ppc/spapr_ovec.c
+++ b/hw/ppc/spapr_ovec.c
@@ -16,6 +16,7 @@ 
 #include "qemu/bitmap.h"
 #include "exec/address-spaces.h"
 #include "qemu/error-report.h"
+#include "sysemu/qtest.h"
 #include "trace.h"
 #include <libfdt.h>
 
@@ -131,6 +132,11 @@  bool spapr_ovec_test(sPAPROptionVector *ov, long bitnr)
     g_assert(ov);
     g_assert(bitnr < OV_MAXBITS);
 
+    /* support memory unplug for qtest */
+    if (qtest_enabled() && bitnr == OV5_HP_EVT) {
+        return true;
+    }
+
     return test_bit(bitnr, ov->bitmap) ? true : false;
 }