aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
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 7829f02..1dc384c 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 = {