[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/11] hw/board: Only allow TCG accelerator by default
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 10/11] hw/board: Only allow TCG accelerator by default |
Date: |
Fri, 19 Feb 2021 18:38:46 +0100 |
By default machines can only use the TCG and QTest accelerators.
If a machine can use another accelerator, it has to explicitly
list it in its MachineClass valid_accelerators[].
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
include/hw/boards.h | 4 ++--
hw/core/machine.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 4d08bc12093..b93d290b348 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -146,8 +146,8 @@ typedef struct {
* @valid_accelerators:
* If this machine supports a specific set of virtualization accelerators,
* this contains a NULL-terminated list of the accelerators that can be
- * used. If this field is not set, any accelerator is valid. The QTest
- * accelerator is always valid.
+ * used. If this field is not set, a default list containing only the TCG
+ * accelerator is used. The QTest accelerator is always valid.
* @kvm_type:
* Return the type of KVM corresponding to the kvm-type string option or
* computed based on other criteria such as the host kernel capabilities
diff --git a/hw/core/machine.c b/hw/core/machine.c
index c42d8e382b1..ca7c9ee2a0c 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -520,11 +520,11 @@ static void machine_set_nvdimm_persistence(Object *obj,
const char *value,
bool machine_class_valid_for_accelerator(MachineClass *mc, const char
*acc_name)
{
- const char *const *name = mc->valid_accelerators;
+ static const char *const default_accels[] = {
+ "tcg", NULL
+ };
+ const char *const *name = mc->valid_accelerators ? : default_accels;
- if (!name) {
- return true;
- }
if (strcmp(acc_name, "qtest") == 0) {
return true;
}
--
2.26.2
- [PATCH v2 07/11] hw/s390x: Explicit the s390-ccw-virtio machines support TCG and KVM, (continued)
- [PATCH v2 07/11] hw/s390x: Explicit the s390-ccw-virtio machines support TCG and KVM, Philippe Mathieu-Daudé, 2021/02/19
- [RFC PATCH v2 08/11] hw/i386: Explicit x86 machines support all current accelerators, Philippe Mathieu-Daudé, 2021/02/19
- [PATCH v2 04/11] hw/arm: Restrit KVM to the virt & versal machines, Philippe Mathieu-Daudé, 2021/02/19
- [RFC PATCH v2 06/11] hw/ppc: Restrict KVM to various PPC machines, Philippe Mathieu-Daudé, 2021/02/19
- [PATCH v2 09/11] hw/xenpv: Restrict Xen Para-virtualized machine to Xen accelerator, Philippe Mathieu-Daudé, 2021/02/19
- [PATCH v2 10/11] hw/board: Only allow TCG accelerator by default,
Philippe Mathieu-Daudé <=
- [PATCH v2 11/11] softmmu/vl: Exit gracefully when accelerator is not supported, Philippe Mathieu-Daudé, 2021/02/19