qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Alexander Graf <agraf@suse.de>,
	cyrilbur@gmail.com, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, Cyril Bur <cyril.bur@au1.ibm.com>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH for-2.2] spapr: add host Linux version information to device tree
Date: Mon, 28 Jul 2014 16:47:25 +1000	[thread overview]
Message-ID: <53D5F1FD.8050702@ozlabs.ru> (raw)
In-Reply-To: <53D10703.40505@suse.de>

On 07/24/2014 11:15 PM, Alexander Graf wrote:
> 
> On 18.07.14 06:31, cyrilbur@gmail.com wrote:
>> It may prove useful know which Linux distribution version the host machine
>> is running when an issue in the guest arises but a user cannot access
>> the host.
>>
>> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
>> ---
>>   hw/ppc/spapr.c       |  8 +++++++
>>   target-ppc/kvm.c     | 62
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   target-ppc/kvm_ppc.h |  6 +++++
>>   3 files changed, 76 insertions(+)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 6b48a26..391d47a 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -375,6 +375,14 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
>>       _FDT((fdt_property_string(fdt, "vm,uuid", buf)));
>>       g_free(buf);
>>   +    /*
>> +     * Add info to the guest FDT to tell it what linux the host is
>> +     */
>> +    if (kvmppc_get_linux_host(&buf)) {
>> +        _FDT((fdt_property_string(fdt, "linux,host", buf)));
> 
> Is this even specified in sPAPR?


PAPR does not know about any "linux,xxx" properties.

> 
>> +        g_free(buf);
>> +    }
>> +
>>       _FDT((fdt_property_cell(fdt, "#address-cells", 0x2)));
>>       _FDT((fdt_property_cell(fdt, "#size-cells", 0x2)));
>>   diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
>> index 8c9e79c..95e0970 100644
>> --- a/target-ppc/kvm.c
>> +++ b/target-ppc/kvm.c
>> @@ -1415,6 +1415,68 @@ bool kvmppc_get_host_model(char **value)
>>       return g_file_get_contents("/proc/device-tree/model", value, NULL,
>> NULL);
>>   }
>>   +bool kvmppc_get_linux_host(char **value)
>> +{
>> +    FILE *f;
>> +    int i;
>> +    char line[512];
>> +    const char *names[] = {"NAME", "VERSION", "BUILD_ID"};
>> +    bool names_found[ARRAY_SIZE(names)] = { 0 };
>> +    GString *output = NULL;
>> +    f = fopen("/etc/os-release", "r");
> 
> A few comments:
> 
>   1) Why would anyone care?


Useful debug info when the host is not reachable.


>   2) I'm not sure KVM is the right decision maker on whether we want this
> exposed or not.

Good point, there is no reason not to show this info in TCG.

> After all, the files you read here are available on an x86
> host just as well

Does qemu-x86 has any way to pass information like this to the guest?


>   3) Use glib functions to read files
> 
> 
> Alex
> 
> 


-- 
Alexey

  reply	other threads:[~2014-07-28  6:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18  4:31 [Qemu-devel] [PATCH for-2.2] spapr: add host Linux version information to device tree cyrilbur
2014-07-18 11:59 ` Eric Blake
2014-07-18 12:01   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-07-22 22:35     ` Cyril Bur
2014-07-24 13:15 ` Alexander Graf
2014-07-28  6:47   ` Alexey Kardashevskiy [this message]
2014-07-28  7:50     ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53D5F1FD.8050702@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --cc=cyril.bur@au1.ibm.com \
    --cc=cyrilbur@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).