thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-hw-acpi-Add-ospm_status-hook-implementation-for-acpi.patch

bf143f
From edead46187b1e55ad5e238332780aef19f1bc214 Mon Sep 17 00:00:00 2001
bf143f
From: Jon Maloy <jmaloy@redhat.com>
bf143f
Date: Wed, 9 Nov 2022 18:41:18 -0500
bf143f
Subject: [PATCH 1/2] hw/acpi: Add ospm_status hook implementation for acpi-ged
bf143f
bf143f
RH-Author: Jon Maloy <jmaloy@redhat.com>
bf143f
RH-MergeRequest: 228: qemu-kvm: backport some aarch64 fixes
bf143f
RH-Bugzilla: 2132609
bf143f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
bf143f
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
bf143f
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
bf143f
RH-Acked-by: Gavin Shan <gshan@redhat.com>
bf143f
RH-Commit: [1/2] 99730b1a27666ca745dc28d90751c938d43f1682 (jmaloy/qemu-kvm)
bf143f
bf143f
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2132609
bf143f
Upstream: Merged
bf143f
bf143f
commit d4424bebceaa8ffbc23060ce45e52a9bb817e3c9
bf143f
Author: Keqian Zhu <zhukeqian1@huawei.com>
bf143f
Date:   Tue Aug 16 17:49:57 2022 +0800
bf143f
bf143f
    hw/acpi: Add ospm_status hook implementation for acpi-ged
bf143f
bf143f
    Setup an ARM virtual machine of machine virt and execute qmp "query-acpi-ospm-status"
bf143f
    causes segmentation fault with following dumpstack:
bf143f
     #1  0x0000aaaaab64235c in qmp_query_acpi_ospm_status (errp=errp@entry=0xfffffffff030) at ../monitor/qmp-cmds.c:312
bf143f
     #2  0x0000aaaaabfc4e20 in qmp_marshal_query_acpi_ospm_status (args=<optimized out>, ret=0xffffea4ffe90, errp=0xffffea4ffe88) at qapi/qapi-commands-acpi.c:63
bf143f
     #3  0x0000aaaaabff8ba0 in do_qmp_dispatch_bh (opaque=0xffffea4ffe98) at ../qapi/qmp-dispatch.c:128
bf143f
     #4  0x0000aaaaac02e594 in aio_bh_call (bh=0xffffe0004d80) at ../util/async.c:150
bf143f
     #5  aio_bh_poll (ctx=ctx@entry=0xaaaaad0f6040) at ../util/async.c:178
bf143f
     #6  0x0000aaaaac00bd40 in aio_dispatch (ctx=ctx@entry=0xaaaaad0f6040) at ../util/aio-posix.c:421
bf143f
     #7  0x0000aaaaac02e010 in aio_ctx_dispatch (source=0xaaaaad0f6040, callback=<optimized out>, user_data=<optimized out>) at ../util/async.c:320
bf143f
     #8  0x0000fffff76f6884 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
bf143f
     #9  0x0000aaaaac0452d4 in glib_pollfds_poll () at ../util/main-loop.c:297
bf143f
     #10 os_host_main_loop_wait (timeout=0) at ../util/main-loop.c:320
bf143f
     #11 main_loop_wait (nonblocking=nonblocking@entry=0) at ../util/main-loop.c:596
bf143f
     #12 0x0000aaaaab5c9e50 in qemu_main_loop () at ../softmmu/runstate.c:734
bf143f
     #13 0x0000aaaaab185370 in qemu_main (argc=argc@entry=47, argv=argv@entry=0xfffffffff518, envp=envp@entry=0x0) at ../softmmu/main.c:38
bf143f
     #14 0x0000aaaaab16f99c in main (argc=47, argv=0xfffffffff518) at ../softmmu/main.c:47
bf143f
bf143f
    Fixes: ebb62075021a ("hw/acpi: Add ACPI Generic Event Device Support")
bf143f
    Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
bf143f
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
bf143f
    Message-id: 20220816094957.31700-1-zhukeqian1@huawei.com
bf143f
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
bf143f
bf143f
(cherry picked from commit d4424bebceaa8ffbc23060ce45e52a9bb817e3c9)
bf143f
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
bf143f
---
bf143f
 hw/acpi/generic_event_device.c | 8 ++++++++
bf143f
 1 file changed, 8 insertions(+)
bf143f
bf143f
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
bf143f
index e28457a7d1..a3d31631fe 100644
bf143f
--- a/hw/acpi/generic_event_device.c
bf143f
+++ b/hw/acpi/generic_event_device.c
bf143f
@@ -267,6 +267,13 @@ static void acpi_ged_unplug_cb(HotplugHandler *hotplug_dev,
bf143f
     }
bf143f
 }
bf143f
 
bf143f
+static void acpi_ged_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
bf143f
+{
bf143f
+    AcpiGedState *s = ACPI_GED(adev);
bf143f
+
bf143f
+    acpi_memory_ospm_status(&s->memhp_state, list);
bf143f
+}
bf143f
+
bf143f
 static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
bf143f
 {
bf143f
     AcpiGedState *s = ACPI_GED(adev);
bf143f
@@ -409,6 +416,7 @@ static void acpi_ged_class_init(ObjectClass *class, void *data)
bf143f
     hc->unplug_request = acpi_ged_unplug_request_cb;
bf143f
     hc->unplug = acpi_ged_unplug_cb;
bf143f
 
bf143f
+    adevc->ospm_status = acpi_ged_ospm_status;
bf143f
     adevc->send_event = acpi_ged_send_event;
bf143f
 }
bf143f
 
bf143f
-- 
bf143f
2.37.3
bf143f