diff options
author | Nikunj A Dadhania | 2014-07-09 12:38:37 +0200 |
---|---|---|
committer | Alexander Graf | 2014-09-08 12:50:47 +0200 |
commit | ef9514431d33e52eb611f799670ca86618c1b7d9 (patch) | |
tree | cd948a7104dcf75cf29f62fa0b8a349b5c9bcb84 /target-ppc/kvm.c | |
parent | hw/ppc/spapr_hcall.c: Fix typo in function names (diff) | |
download | qemu-ef9514431d33e52eb611f799670ca86618c1b7d9.tar.gz qemu-ef9514431d33e52eb611f799670ca86618c1b7d9.tar.xz qemu-ef9514431d33e52eb611f799670ca86618c1b7d9.zip |
spapr: add uuid/host details to device tree
Useful for identifying the guest/host uniquely within the
guest. Adding following properties to the guest root node.
vm,uuid - uuid of the guest
host-model - Host model number
host-serial - Host machine serial number
hypervisor type - Tells its "kvm"
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/kvm.c')
-rw-r--r-- | target-ppc/kvm.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 42718f77ae..8c9e79c3a9 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -1369,7 +1369,7 @@ static int read_cpuinfo(const char *field, char *value, int len) } do { - if(!fgets(line, sizeof(line), f)) { + if (!fgets(line, sizeof(line), f)) { break; } if (!strncmp(line, field, field_len)) { @@ -1404,6 +1404,17 @@ uint32_t kvmppc_get_tbfreq(void) return retval; } +bool kvmppc_get_host_serial(char **value) +{ + return g_file_get_contents("/proc/device-tree/system-id", value, NULL, + NULL); +} + +bool kvmppc_get_host_model(char **value) +{ + return g_file_get_contents("/proc/device-tree/model", value, NULL, NULL); +} + /* Try to find a device tree node for a CPU with clock-frequency property */ static int kvmppc_find_cpu_dt(char *buf, int buf_len) { |