All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Alex Williamson <alex.williamson@hp.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/2] qemu: Allow SMBIOS entries to be loaded and provided to the VM BIOS
Date: Mon, 06 Apr 2009 14:50:02 -0500	[thread overview]
Message-ID: <49DA5CEA.7040209@us.ibm.com> (raw)
In-Reply-To: <1237835465.15558.4.camel@lappy>

Alex Williamson wrote:
> Create a new -smbios options that takes binary SMBIOS entries
> to provide to the VM BIOS.  The binary can be easily generated
> using something like:
>
> dmidecode -t 1 -u | grep $'^\t\t[^"]' | xargs -n1 | \
> 	perl -lne 'printf "%c", hex($_)' > smbios_type_1.bin
>
> For some inventory tools, this makes the VM report the system
> information for the host.  One entry per binary file, multiple
> files can be chained together as:
>
>   -smbios file1,file2,...
>
> or specified independently:
>
>   -smbios file1 -smbios file2
>
> Signed-off-by: Alex Williamson <alex.williamson@hp.com>
>   

Hi Alex,

I know we have to support blobs because of OEM specific smbios entries, 
but there are a number of common ones that it would probably be good to 
specify in a less user-unfriendly way.  What do you think?

Anyway, comments below.

> diff --git a/hw/acpi.c b/hw/acpi.c
> index 52f50a0..0bd93bf 100644
> --- a/hw/acpi.c
> +++ b/hw/acpi.c
> @@ -915,3 +915,69 @@ out:
>      }
>      return -1;
>  }
> +
> +char *smbios_entries;
> +size_t smbios_entries_len;
>   

I think an accessor would be better than making these variables global.

> +int smbios_entry_add(const char *t)
> +{
>   

acpi.c is hardware emulation, I'd rather see the command line parsing 
done somewhere else (like vl.c).

> +    struct stat s;
> +    char file[1024], *p, *f, *n;
> +    int fd, r;
> +    size_t len, off;
> +
> +    f = (char *)t;
> +    do {
> +        n = strchr(f, ',');
> +        if (n) {
> +            strncpy(file, f, (n - f));
> +            file[n - f] = '\0';
> +            f = n + 1;
> +        } else {
> +            strcpy(file, f);
> +            f += strlen(file);
> +        }
>   

I'm happy to just require multiple -smbios options.  I dislike 
overloading with ','s even though we do it a lot in QEMU.

> +        fd = open(file, O_RDONLY);
> +        if (fd < 0)
> +            return -1;
> +
> +        if (fstat(fd, &s) < 0) {
> +            close(fd);
> +            return -1;
> +        }
>   

May want to look at load_image/get_image_size.


-- 
Regards,

Anthony Liguori


WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <aliguori@us.ibm.com>
To: Alex Williamson <alex.williamson@hp.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>
Subject: [Qemu-devel] Re: [PATCH 1/2] qemu: Allow SMBIOS entries to be loaded and provided to the VM BIOS
Date: Mon, 06 Apr 2009 14:50:02 -0500	[thread overview]
Message-ID: <49DA5CEA.7040209@us.ibm.com> (raw)
In-Reply-To: <1237835465.15558.4.camel@lappy>

Alex Williamson wrote:
> Create a new -smbios options that takes binary SMBIOS entries
> to provide to the VM BIOS.  The binary can be easily generated
> using something like:
>
> dmidecode -t 1 -u | grep $'^\t\t[^"]' | xargs -n1 | \
> 	perl -lne 'printf "%c", hex($_)' > smbios_type_1.bin
>
> For some inventory tools, this makes the VM report the system
> information for the host.  One entry per binary file, multiple
> files can be chained together as:
>
>   -smbios file1,file2,...
>
> or specified independently:
>
>   -smbios file1 -smbios file2
>
> Signed-off-by: Alex Williamson <alex.williamson@hp.com>
>   

Hi Alex,

I know we have to support blobs because of OEM specific smbios entries, 
but there are a number of common ones that it would probably be good to 
specify in a less user-unfriendly way.  What do you think?

Anyway, comments below.

> diff --git a/hw/acpi.c b/hw/acpi.c
> index 52f50a0..0bd93bf 100644
> --- a/hw/acpi.c
> +++ b/hw/acpi.c
> @@ -915,3 +915,69 @@ out:
>      }
>      return -1;
>  }
> +
> +char *smbios_entries;
> +size_t smbios_entries_len;
>   

I think an accessor would be better than making these variables global.

> +int smbios_entry_add(const char *t)
> +{
>   

acpi.c is hardware emulation, I'd rather see the command line parsing 
done somewhere else (like vl.c).

> +    struct stat s;
> +    char file[1024], *p, *f, *n;
> +    int fd, r;
> +    size_t len, off;
> +
> +    f = (char *)t;
> +    do {
> +        n = strchr(f, ',');
> +        if (n) {
> +            strncpy(file, f, (n - f));
> +            file[n - f] = '\0';
> +            f = n + 1;
> +        } else {
> +            strcpy(file, f);
> +            f += strlen(file);
> +        }
>   

I'm happy to just require multiple -smbios options.  I dislike 
overloading with ','s even though we do it a lot in QEMU.

> +        fd = open(file, O_RDONLY);
> +        if (fd < 0)
> +            return -1;
> +
> +        if (fstat(fd, &s) < 0) {
> +            close(fd);
> +            return -1;
> +        }
>   

May want to look at load_image/get_image_size.


-- 
Regards,

Anthony Liguori

  reply	other threads:[~2009-04-06 19:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 19:05 [PATCH 0/2] qemu: SMBIOS passing support Alex Williamson
2009-03-23 19:05 ` [Qemu-devel] " Alex Williamson
2009-03-23 19:11 ` [PATCH 1/2] qemu: Allow SMBIOS entries to be loaded and provided to the VM BIOS Alex Williamson
2009-03-23 19:11   ` [Qemu-devel] " Alex Williamson
2009-04-06 19:50   ` Anthony Liguori [this message]
2009-04-06 19:50     ` [Qemu-devel] " Anthony Liguori
2009-04-06 22:34     ` Alex Williamson
2009-04-06 22:34       ` [Qemu-devel] " Alex Williamson
2009-04-06 22:42       ` Anthony Liguori
2009-04-06 22:42         ` [Qemu-devel] " Anthony Liguori
2009-04-07 19:34         ` Alex Williamson
2009-04-07 19:34           ` [Qemu-devel] Re: [kvm] " Alex Williamson
2009-04-07 19:49           ` Anthony Liguori
2009-04-07 19:49             ` [Qemu-devel] Re: [kvm] " Anthony Liguori
2009-03-23 19:11 ` [PATCH 2/2] qemu:bios: Read external SMBIOS entries from the VM Alex Williamson
2009-03-23 19:11   ` [Qemu-devel] " Alex Williamson
2009-04-06 19:52   ` Anthony Liguori
2009-04-06 19:52     ` [Qemu-devel] " Anthony Liguori
2009-03-30 13:59 ` [PATCH 0/2] qemu: SMBIOS passing support Alex Williamson
2009-03-30 13:59   ` [Qemu-devel] " Alex Williamson
2009-03-30 14:05   ` Gleb Natapov
2009-03-30 14:05     ` [Qemu-devel] " Gleb Natapov
2009-03-30 14:38   ` Daniel P. Berrange
2009-03-30 14:38     ` [Qemu-devel] " Daniel P. Berrange
2009-03-30 14:59     ` Avi Kivity
2009-03-30 14:59       ` [Qemu-devel] " Avi Kivity
2009-03-30 15:40       ` Alex Williamson
2009-03-30 15:40         ` [Qemu-devel] " Alex Williamson

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=49DA5CEA.7040209@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=alex.williamson@hp.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.