summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorYonghee Han <onstudy@samsung.com>2016-07-27 16:40:17 +0900
committerYonghee Han <onstudy@samsung.com>2016-07-27 00:53:56 -0700
commit3158f4a51894e46ecb593bffbfd12824e1d6534a (patch)
tree2bef7f0238e687c5de65f48b5995ee124a95d157 /backends
parenta3b133b0ea0696e42fd876b9a803e28bc6ef5299 (diff)
downloadqemu-3158f4a51894e46ecb593bffbfd12824e1d6534a.tar.gz
qemu-3158f4a51894e46ecb593bffbfd12824e1d6534a.tar.bz2
qemu-3158f4a51894e46ecb593bffbfd12824e1d6534a.zip
Imported Upstream version 2.4.1upstream/2.4.1
Change-Id: I0b584f569cb0e0f4eac13cdb79e110c2dbc34bfc
Diffstat (limited to 'backends')
-rw-r--r--backends/hostmem-file.c2
-rw-r--r--backends/hostmem.c31
-rw-r--r--backends/rng-egd.c11
-rw-r--r--backends/rng-random.c6
-rw-r--r--backends/rng.c2
-rw-r--r--backends/tpm.c27
6 files changed, 38 insertions, 41 deletions
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index 51799943f..4b5536101 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -43,7 +43,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
return;
}
if (!fb->mem_path) {
- error_setg(errp, "mem_path property not set");
+ error_setg(errp, "mem-path property not set");
return;
}
#ifndef CONFIG_LINUX
diff --git a/backends/hostmem.c b/backends/hostmem.c
index b7b6cf8f4..41ba2af52 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -10,10 +10,10 @@
* See the COPYING file in the top-level directory.
*/
#include "sysemu/hostmem.h"
+#include "hw/boards.h"
#include "qapi/visitor.h"
#include "qapi-types.h"
#include "qapi-visit.h"
-#include "qapi/qmp/qerror.h"
#include "qemu/config-file.h"
#include "qom/object_interfaces.h"
@@ -113,24 +113,17 @@ host_memory_backend_set_host_nodes(Object *obj, Visitor *v, void *opaque,
#endif
}
-static void
-host_memory_backend_get_policy(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static int
+host_memory_backend_get_policy(Object *obj, Error **errp G_GNUC_UNUSED)
{
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
- int policy = backend->policy;
-
- visit_type_enum(v, &policy, HostMemPolicy_lookup, NULL, name, errp);
+ return backend->policy;
}
static void
-host_memory_backend_set_policy(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+host_memory_backend_set_policy(Object *obj, int policy, Error **errp)
{
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
- int policy;
-
- visit_type_enum(v, &policy, HostMemPolicy_lookup, NULL, name, errp);
backend->policy = policy;
#ifndef CONFIG_NUMA
@@ -230,11 +223,10 @@ static void host_memory_backend_set_prealloc(Object *obj, bool value,
static void host_memory_backend_init(Object *obj)
{
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
+ MachineState *machine = MACHINE(qdev_get_machine());
- backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),
- "mem-merge", true);
- backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),
- "dump-guest-core", true);
+ backend->merge = machine_mem_merge(machine);
+ backend->dump = machine_dump_guest_core(machine);
backend->prealloc = mem_prealloc;
object_property_add_bool(obj, "merge",
@@ -252,9 +244,10 @@ static void host_memory_backend_init(Object *obj)
object_property_add(obj, "host-nodes", "int",
host_memory_backend_get_host_nodes,
host_memory_backend_set_host_nodes, NULL, NULL, NULL);
- object_property_add(obj, "policy", "str",
- host_memory_backend_get_policy,
- host_memory_backend_set_policy, NULL, NULL, NULL);
+ object_property_add_enum(obj, "policy", "HostMemPolicy",
+ HostMemPolicy_lookup,
+ host_memory_backend_get_policy,
+ host_memory_backend_set_policy, NULL);
}
MemoryRegion *
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index 2962795a8..6c1340963 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -140,19 +140,20 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
RngEgd *s = RNG_EGD(b);
if (s->chr_name == NULL) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE,
- "chardev", "a valid character device");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "chardev", "a valid character device");
return;
}
s->chr = qemu_chr_find(s->chr_name);
if (s->chr == NULL) {
- error_set(errp, QERR_DEVICE_NOT_FOUND, s->chr_name);
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", s->chr_name);
return;
}
if (qemu_chr_fe_claim(s->chr) != 0) {
- error_set(errp, QERR_DEVICE_IN_USE, s->chr_name);
+ error_setg(errp, QERR_DEVICE_IN_USE, s->chr_name);
return;
}
@@ -167,7 +168,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
RngEgd *s = RNG_EGD(b);
if (b->opened) {
- error_set(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, QERR_PERMISSION_DENIED);
} else {
g_free(s->chr_name);
s->chr_name = g_strdup(value);
diff --git a/backends/rng-random.c b/backends/rng-random.c
index 4f85a8ea4..4e51f4609 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -74,8 +74,8 @@ static void rng_random_opened(RngBackend *b, Error **errp)
RndRandom *s = RNG_RANDOM(b);
if (s->filename == NULL) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE,
- "filename", "a valid filename");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "filename", "a valid filename");
} else {
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK);
if (s->fd == -1) {
@@ -98,7 +98,7 @@ static void rng_random_set_filename(Object *obj, const char *filename,
RndRandom *s = RNG_RANDOM(obj);
if (b->opened) {
- error_set(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, QERR_PERMISSION_DENIED);
return;
}
diff --git a/backends/rng.c b/backends/rng.c
index 0f2fc11dd..5065fdc15 100644
--- a/backends/rng.c
+++ b/backends/rng.c
@@ -57,7 +57,7 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
}
if (!value && s->opened) {
- error_set(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, QERR_PERMISSION_DENIED);
return;
}
diff --git a/backends/tpm.c b/backends/tpm.c
index 4efe36736..a512693b1 100644
--- a/backends/tpm.c
+++ b/backends/tpm.c
@@ -96,6 +96,20 @@ bool tpm_backend_get_tpm_established_flag(TPMBackend *s)
return k->ops->get_tpm_established_flag(s);
}
+int tpm_backend_reset_tpm_established_flag(TPMBackend *s, uint8_t locty)
+{
+ TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
+
+ return k->ops->reset_tpm_established_flag(s, locty);
+}
+
+TPMVersion tpm_backend_get_tpm_version(TPMBackend *s)
+{
+ TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
+
+ return k->ops->get_tpm_version(s);
+}
+
static bool tpm_backend_prop_get_opened(Object *obj, Error **errp)
{
TPMBackend *s = TPM_BACKEND(obj);
@@ -119,7 +133,7 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp)
}
if (!value && s->opened) {
- error_set(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, QERR_PERMISSION_DENIED);
return;
}
@@ -165,17 +179,6 @@ void tpm_backend_thread_end(TPMBackendThread *tbt)
}
}
-void tpm_backend_thread_tpm_reset(TPMBackendThread *tbt,
- GFunc func, gpointer user_data)
-{
- if (!tbt->pool) {
- tpm_backend_thread_create(tbt, func, user_data);
- } else {
- g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_TPM_RESET,
- NULL);
- }
-}
-
static const TypeInfo tpm_backend_info = {
.name = TYPE_TPM_BACKEND,
.parent = TYPE_OBJECT,