[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/15] accel: Introduce the current_accel() method
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 12/15] accel: Introduce the current_accel() method |
Date: |
Thu, 9 Jan 2020 16:21:30 +0100 |
We want to remove the global current_machine. The accel/
code access few times current_machine->accelerator. Introduce
the current_accel() method first, it will then be easier to
replace 'current_machine' by MACHINE(qdev_get_machine()).
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
include/sysemu/accel.h | 2 ++
accel/accel.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h
index d4c1429711..47e5788530 100644
--- a/include/sysemu/accel.h
+++ b/include/sysemu/accel.h
@@ -70,4 +70,6 @@ int accel_init_machine(AccelState *accel, MachineState *ms);
/* Called just before os_setup_post (ie just before drop OS privs) */
void accel_setup_post(MachineState *ms);
+AccelState *current_accel(void);
+
#endif
diff --git a/accel/accel.c b/accel/accel.c
index 1c5c3a6abb..cb555e3b06 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -63,6 +63,11 @@ int accel_init_machine(AccelState *accel, MachineState *ms)
return ret;
}
+AccelState *current_accel(void)
+{
+ return current_machine->accelerator;
+}
+
void accel_setup_post(MachineState *ms)
{
AccelState *accel = ms->accelerator;
--
2.21.1
- [PATCH 08/15] target/arm/monitor: Replace current_machine by qdev_get_machine(), (continued)
- [PATCH 11/15] exec: Replace current_machine by qdev_get_machine(), Philippe Mathieu-Daudé, 2020/01/09
- [PATCH 12/15] accel: Introduce the current_accel() method,
Philippe Mathieu-Daudé <=
- [PATCH 13/15] accel: Replace current_machine->accelerator by current_accel() method, Philippe Mathieu-Daudé, 2020/01/09
- [PATCH 14/15] accel/accel: Replace current_machine by qdev_get_machine(), Philippe Mathieu-Daudé, 2020/01/09
- [PATCH 15/15] vl: Make current_machine a local variable, Philippe Mathieu-Daudé, 2020/01/09
- Re: [PATCH 00/15] Replace current_machine by qdev_get_machine(), Markus Armbruster, 2020/01/21