[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 08/10] accel: Introduce the current_accel() wrapper
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 08/10] accel: Introduce the current_accel() wrapper |
Date: |
Tue, 21 Jan 2020 12:03:47 +0100 |
The accel/ code only access the MachineState::accel field.
As we simply want to access the accelerator, not the machine,
add a current_accel() wrapper.
Suggested-by: Paolo Bonzini <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
v2: Reworded description using 'wrapper'
---
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 v2 03/10] hw/ppc/spapr_rtas: Remove local variable, (continued)
- [PATCH v2 03/10] hw/ppc/spapr_rtas: Remove local variable, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 04/10] target/arm/kvm: Use CPUState::kvm_state in kvm_arm_pmu_supported(), Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 05/10] target/s390x: Remove duplicated ifdef macro, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 06/10] qom/object: Display more helpful message when a parent is missing, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 07/10] qdev: Abort if the root machine container is missing, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 08/10] accel: Introduce the current_accel() wrapper,
Philippe Mathieu-Daudé <=
- [PATCH v2 09/10] accel: Replace current_machine->accelerator by current_accel() wrapper, Philippe Mathieu-Daudé, 2020/01/21
- [PATCH v2 10/10] accel/tcg: Sanitize include path, Philippe Mathieu-Daudé, 2020/01/21
- Re: [PATCH v2 00/10] Cleanups around the 'current_machine' global variable, Markus Armbruster, 2020/01/21
- Re: [PATCH v2 00/10] Cleanups around the 'current_machine' global variable, Paolo Bonzini, 2020/01/21