aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-11-13 15:16:44 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-12-17 19:32:27 +0100
commitfe174132478b4e7b0086f2305a511fd94c9aca8b (patch)
tree624f890cff5b4cd7e9f905b80105b908ee004c7e /accel
parent12ceaef6ae0b4d0eec4712aaf54ad3b8434c1afb (diff)
tcg: add "-accel tcg,tb-size" and deprecate "-tb-size"
-tb-size fits nicely in the new framework for accelerator-specific options. It is a very niche option, so insta-deprecate it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/tcg-all.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 7829f0227c..1dc384c8d2 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -34,11 +34,13 @@
#include "include/qapi/error.h"
#include "include/qemu/error-report.h"
#include "include/hw/boards.h"
+#include "qapi/qapi-builtin-visit.h"
typedef struct TCGState {
AccelState parent_obj;
bool mttcg_enabled;
+ unsigned long tb_size;
} TCGState;
#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
@@ -46,8 +48,6 @@ typedef struct TCGState {
#define TCG_STATE(obj) \
OBJECT_CHECK(TCGState, (obj), TYPE_TCG_ACCEL)
-unsigned long tcg_tb_size;
-
/* mask must never be zero, except for A20 change call */
static void tcg_handle_interrupt(CPUState *cpu, int mask)
{
@@ -126,7 +126,7 @@ static int tcg_init(MachineState *ms)
{
TCGState *s = TCG_STATE(current_machine->accelerator);
- tcg_exec_init(tcg_tb_size * 1024 * 1024);
+ tcg_exec_init(s->tb_size * 1024 * 1024);
cpu_interrupt_handler = tcg_handle_interrupt;
mttcg_enabled = s->mttcg_enabled;
return 0;
@@ -167,6 +167,33 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp)
}
}
+static void tcg_get_tb_size(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ TCGState *s = TCG_STATE(obj);
+ uint32_t value = s->tb_size;
+
+ visit_type_uint32(v, name, &value, errp);
+}
+
+static void tcg_set_tb_size(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ TCGState *s = TCG_STATE(obj);
+ Error *error = NULL;
+ uint32_t value;
+
+ visit_type_uint32(v, name, &value, &error);
+ if (error) {
+ error_propagate(errp, error);
+ return;
+ }
+
+ s->tb_size = value;
+}
+
static void tcg_accel_class_init(ObjectClass *oc, void *data)
{
AccelClass *ac = ACCEL_CLASS(oc);
@@ -178,6 +205,13 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)
tcg_get_thread,
tcg_set_thread,
NULL);
+
+ object_class_property_add(oc, "tb-size", "int",
+ tcg_get_tb_size, tcg_set_tb_size,
+ NULL, NULL, &error_abort);
+ object_class_property_set_description(oc, "tb-size",
+ "TCG translation block cache size", &error_abort);
+
}
static const TypeInfo tcg_accel_type = {