* [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
@ 2015-09-23 14:18 Andrew Jones
2015-09-23 14:50 ` Wei Huang
2015-09-23 15:43 ` Peter Maydell
0 siblings, 2 replies; 8+ messages in thread
From: Andrew Jones @ 2015-09-23 14:18 UTC (permalink / raw)
To: qemu-devel; +Cc: wei, peter.maydell
ARM/AArch64 KVM guests don't have any way to identify
themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
could discuss all sorts of reasons why guests shouldn't need to
know that, but then there's always some case where it'd be
nice... Anyway, now that we have SMBIOS tables in ARM guests,
it's easy for the guest to know that it's a QEMU instance. This
patch takes that one step further, also identifying KVM, when
appropriate. Again, we could debate why generally nothing
should care whether it's of type QEMU or QEMU/KVM, but again,
sometimes it's nice to know...
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/arm/virt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 6bf0d6d591d6c..607d448354a8c 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -855,12 +855,17 @@ static void virt_build_smbios(VirtGuestInfo *guest_info)
FWCfgState *fw_cfg = guest_info->fw_cfg;
uint8_t *smbios_tables, *smbios_anchor;
size_t smbios_tables_len, smbios_anchor_len;
+ const char *product = "QEMU Virtual Machine";
if (!fw_cfg) {
return;
}
- smbios_set_defaults("QEMU", "QEMU Virtual Machine",
+ if (kvm_enabled()) {
+ product = "KVM Virtual Machine";
+ }
+
+ smbios_set_defaults("QEMU", product,
"1.0", false, true, SMBIOS_ENTRY_POINT_30);
smbios_get_tables(NULL, 0, &smbios_tables, &smbios_tables_len,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
2015-09-23 14:18 [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm Andrew Jones
@ 2015-09-23 14:50 ` Wei Huang
2015-09-23 15:43 ` Peter Maydell
1 sibling, 0 replies; 8+ messages in thread
From: Wei Huang @ 2015-09-23 14:50 UTC (permalink / raw)
To: Andrew Jones, qemu-devel; +Cc: peter.maydell
On 9/23/15 09:18, Andrew Jones wrote:
> ARM/AArch64 KVM guests don't have any way to identify
> themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
> could discuss all sorts of reasons why guests shouldn't need to
> know that, but then there's always some case where it'd be
One example is for the subscription manager to check the license type...
> nice... Anyway, now that we have SMBIOS tables in ARM guests,
> it's easy for the guest to know that it's a QEMU instance. This
> patch takes that one step further, also identifying KVM, when
> appropriate. Again, we could debate why generally nothing
> should care whether it's of type QEMU or QEMU/KVM, but again,
> sometimes it's nice to know...
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> hw/arm/virt.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 6bf0d6d591d6c..607d448354a8c 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -855,12 +855,17 @@ static void virt_build_smbios(VirtGuestInfo *guest_info)
> FWCfgState *fw_cfg = guest_info->fw_cfg;
> uint8_t *smbios_tables, *smbios_anchor;
> size_t smbios_tables_len, smbios_anchor_len;
> + const char *product = "QEMU Virtual Machine";
>
> if (!fw_cfg) {
> return;
> }
>
> - smbios_set_defaults("QEMU", "QEMU Virtual Machine",
> + if (kvm_enabled()) {
> + product = "KVM Virtual Machine";
> + }
> +
> + smbios_set_defaults("QEMU", product,
> "1.0", false, true, SMBIOS_ENTRY_POINT_30);
>
> smbios_get_tables(NULL, 0, &smbios_tables, &smbios_tables_len,
>
Reviewed-by: Wei Huang <wei@redhat.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
2015-09-23 14:18 [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm Andrew Jones
2015-09-23 14:50 ` Wei Huang
@ 2015-09-23 15:43 ` Peter Maydell
2015-09-23 16:09 ` Peter Maydell
2015-09-24 10:13 ` Andrew Jones
1 sibling, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2015-09-23 15:43 UTC (permalink / raw)
To: Andrew Jones; +Cc: Wei Huang, QEMU Developers
On 23 September 2015 at 07:18, Andrew Jones <drjones@redhat.com> wrote:
> ARM/AArch64 KVM guests don't have any way to identify
> themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
> could discuss all sorts of reasons why guests shouldn't need to
> know that, but then there's always some case where it'd be
> nice... Anyway, now that we have SMBIOS tables in ARM guests,
> it's easy for the guest to know that it's a QEMU instance. This
> patch takes that one step further, also identifying KVM, when
> appropriate. Again, we could debate why generally nothing
> should care whether it's of type QEMU or QEMU/KVM, but again,
> sometimes it's nice to know...
This doesn't seem great to me, because it's ACPI/SMBIOS
specific. A mechanism that worked whether the guest was
booted via APCI or DT would seem preferable to me...
thanks
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
2015-09-23 15:43 ` Peter Maydell
@ 2015-09-23 16:09 ` Peter Maydell
2015-09-24 10:17 ` Andrew Jones
2015-09-24 10:13 ` Andrew Jones
1 sibling, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2015-09-23 16:09 UTC (permalink / raw)
To: Andrew Jones; +Cc: Wei Huang, QEMU Developers
On 23 September 2015 at 08:43, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 23 September 2015 at 07:18, Andrew Jones <drjones@redhat.com> wrote:
>> ARM/AArch64 KVM guests don't have any way to identify
>> themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
>> could discuss all sorts of reasons why guests shouldn't need to
>> know that, but then there's always some case where it'd be
>> nice... Anyway, now that we have SMBIOS tables in ARM guests,
>> it's easy for the guest to know that it's a QEMU instance. This
>> patch takes that one step further, also identifying KVM, when
>> appropriate. Again, we could debate why generally nothing
>> should care whether it's of type QEMU or QEMU/KVM, but again,
>> sometimes it's nice to know...
>
> This doesn't seem great to me, because it's ACPI/SMBIOS
> specific. A mechanism that worked whether the guest was
> booted via APCI or DT would seem preferable to me...
...and, on a more careful reread, I don't like the way the
behaviour is changing for "this is KVM" rather than "and it's
KVM" being an additional piece of information.
thanks
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
2015-09-23 15:43 ` Peter Maydell
2015-09-23 16:09 ` Peter Maydell
@ 2015-09-24 10:13 ` Andrew Jones
2015-09-28 15:31 ` Andrew Jones
1 sibling, 1 reply; 8+ messages in thread
From: Andrew Jones @ 2015-09-24 10:13 UTC (permalink / raw)
To: Peter Maydell; +Cc: Wei Huang, QEMU Developers
On Wed, Sep 23, 2015 at 08:43:39AM -0700, Peter Maydell wrote:
> On 23 September 2015 at 07:18, Andrew Jones <drjones@redhat.com> wrote:
> > ARM/AArch64 KVM guests don't have any way to identify
> > themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
> > could discuss all sorts of reasons why guests shouldn't need to
> > know that, but then there's always some case where it'd be
> > nice... Anyway, now that we have SMBIOS tables in ARM guests,
> > it's easy for the guest to know that it's a QEMU instance. This
> > patch takes that one step further, also identifying KVM, when
> > appropriate. Again, we could debate why generally nothing
> > should care whether it's of type QEMU or QEMU/KVM, but again,
> > sometimes it's nice to know...
>
> This doesn't seem great to me, because it's ACPI/SMBIOS
> specific. A mechanism that worked whether the guest was
> booted via APCI or DT would seem preferable to me...
SMBIOS is populated on both ACPI and devicetree boots. We already
have detection in virt-what and systemd-detect-virt for DT boots,
although it only detects QEMU (it can't determine if KVM is used).
That detection is DT-specific, and much more of a heuristic, it
checks for the presence of the fw-cfg node in the DT. Actually, I'd
like to patch those virt detection tools to try SMBIOS first (which,
with this patch, could also give KVM info), and then fall back to
trying the current DT-only, QEMU-only detection, before giving up.
Thanks,
drew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
2015-09-23 16:09 ` Peter Maydell
@ 2015-09-24 10:17 ` Andrew Jones
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Jones @ 2015-09-24 10:17 UTC (permalink / raw)
To: Peter Maydell; +Cc: Wei Huang, QEMU Developers
On Wed, Sep 23, 2015 at 09:09:11AM -0700, Peter Maydell wrote:
> On 23 September 2015 at 08:43, Peter Maydell <peter.maydell@linaro.org> wrote:
> > On 23 September 2015 at 07:18, Andrew Jones <drjones@redhat.com> wrote:
> >> ARM/AArch64 KVM guests don't have any way to identify
> >> themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
> >> could discuss all sorts of reasons why guests shouldn't need to
> >> know that, but then there's always some case where it'd be
> >> nice... Anyway, now that we have SMBIOS tables in ARM guests,
> >> it's easy for the guest to know that it's a QEMU instance. This
> >> patch takes that one step further, also identifying KVM, when
> >> appropriate. Again, we could debate why generally nothing
> >> should care whether it's of type QEMU or QEMU/KVM, but again,
> >> sometimes it's nice to know...
> >
> > This doesn't seem great to me, because it's ACPI/SMBIOS
> > specific. A mechanism that worked whether the guest was
> > booted via APCI or DT would seem preferable to me...
>
> ...and, on a more careful reread, I don't like the way the
> behaviour is changing for "this is KVM" rather than "and it's
> KVM" being an additional piece of information.
It is "and it's KVM". We leave the SMBIOS Manufacturer as "QEMU",
so QEMU is still there, and even in the "primary" field. We only
change the Product Name to be KVM only, although that could
certainly be "QEMU/KVM Virtual Machine", if preferred.
Thanks,
drew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
2015-09-24 10:13 ` Andrew Jones
@ 2015-09-28 15:31 ` Andrew Jones
2015-10-08 18:42 ` Peter Maydell
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Jones @ 2015-09-28 15:31 UTC (permalink / raw)
To: Peter Maydell; +Cc: Wei Huang, QEMU Developers
On Thu, Sep 24, 2015 at 12:13:08PM +0200, Andrew Jones wrote:
> On Wed, Sep 23, 2015 at 08:43:39AM -0700, Peter Maydell wrote:
> > On 23 September 2015 at 07:18, Andrew Jones <drjones@redhat.com> wrote:
> > > ARM/AArch64 KVM guests don't have any way to identify
> > > themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
> > > could discuss all sorts of reasons why guests shouldn't need to
> > > know that, but then there's always some case where it'd be
> > > nice... Anyway, now that we have SMBIOS tables in ARM guests,
> > > it's easy for the guest to know that it's a QEMU instance. This
> > > patch takes that one step further, also identifying KVM, when
> > > appropriate. Again, we could debate why generally nothing
> > > should care whether it's of type QEMU or QEMU/KVM, but again,
> > > sometimes it's nice to know...
> >
> > This doesn't seem great to me, because it's ACPI/SMBIOS
> > specific. A mechanism that worked whether the guest was
> > booted via APCI or DT would seem preferable to me...
>
> SMBIOS is populated on both ACPI and devicetree boots. We already
> have detection in virt-what and systemd-detect-virt for DT boots,
> although it only detects QEMU (it can't determine if KVM is used).
> That detection is DT-specific, and much more of a heuristic, it
> checks for the presence of the fw-cfg node in the DT. Actually, I'd
> like to patch those virt detection tools to try SMBIOS first (which,
> with this patch, could also give KVM info), and then fall back to
> trying the current DT-only, QEMU-only detection, before giving up.
>
Hi Peter,
Anymore thoughts on this?
Thanks,
drew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm
2015-09-28 15:31 ` Andrew Jones
@ 2015-10-08 18:42 ` Peter Maydell
0 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2015-10-08 18:42 UTC (permalink / raw)
To: Andrew Jones; +Cc: Wei Huang, QEMU Developers
On 28 September 2015 at 16:31, Andrew Jones <drjones@redhat.com> wrote:
> On Thu, Sep 24, 2015 at 12:13:08PM +0200, Andrew Jones wrote:
>> On Wed, Sep 23, 2015 at 08:43:39AM -0700, Peter Maydell wrote:
>> > On 23 September 2015 at 07:18, Andrew Jones <drjones@redhat.com> wrote:
>> > > ARM/AArch64 KVM guests don't have any way to identify
>> > > themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
>> > > could discuss all sorts of reasons why guests shouldn't need to
>> > > know that, but then there's always some case where it'd be
>> > > nice... Anyway, now that we have SMBIOS tables in ARM guests,
>> > > it's easy for the guest to know that it's a QEMU instance. This
>> > > patch takes that one step further, also identifying KVM, when
>> > > appropriate. Again, we could debate why generally nothing
>> > > should care whether it's of type QEMU or QEMU/KVM, but again,
>> > > sometimes it's nice to know...
>> >
>> > This doesn't seem great to me, because it's ACPI/SMBIOS
>> > specific. A mechanism that worked whether the guest was
>> > booted via APCI or DT would seem preferable to me...
>>
>> SMBIOS is populated on both ACPI and devicetree boots. We already
>> have detection in virt-what and systemd-detect-virt for DT boots,
>> although it only detects QEMU (it can't determine if KVM is used).
>> That detection is DT-specific, and much more of a heuristic, it
>> checks for the presence of the fw-cfg node in the DT. Actually, I'd
>> like to patch those virt detection tools to try SMBIOS first (which,
>> with this patch, could also give KVM info), and then fall back to
>> trying the current DT-only, QEMU-only detection, before giving up.
>>
>
> Hi Peter,
>
> Anymore thoughts on this?
Well, OK I guess, but this all seems worryingly ad-hoc...
Applied to target-arm.next.
thanks
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-10-08 18:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-23 14:18 [Qemu-devel] [PATCH] hw/arm/virt: smbios: inform guest of kvm Andrew Jones
2015-09-23 14:50 ` Wei Huang
2015-09-23 15:43 ` Peter Maydell
2015-09-23 16:09 ` Peter Maydell
2015-09-24 10:17 ` Andrew Jones
2015-09-24 10:13 ` Andrew Jones
2015-09-28 15:31 ` Andrew Jones
2015-10-08 18:42 ` Peter Maydell
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).