mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
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>
This commit is contained in:
parent
12ceaef6ae
commit
fe17413247
5 changed files with 53 additions and 11 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue