[Qemu-devel] [PATCH v3 0/6] arm: support -cpu max (and gic-version=max)

Peter Maydell posted 6 patches 6 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180308130626.12393-1-peter.maydell@linaro.org
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppcbe passed
Test ppcle passed
Test s390x passed
target/arm/cpu-qom.h |  2 ++
target/arm/cpu.h     |  5 +++
target/arm/kvm_arm.h | 35 +++++++++++++------
hw/arm/virt.c        | 30 ++++++++++------
target/arm/cpu.c     | 97 +++++++++++++++++++++++++++++++++++++++++++---------
target/arm/cpu64.c   | 66 ++++++++++++++++++++++-------------
target/arm/kvm.c     | 53 ++++++++++------------------
target/arm/kvm32.c   |  8 ++---
target/arm/kvm64.c   |  8 ++---
9 files changed, 200 insertions(+), 104 deletions(-)
[Qemu-devel] [PATCH v3 0/6] arm: support -cpu max (and gic-version=max)
Posted by Peter Maydell 6 years ago
This patchset adds support for '-cpu max' to Arm, along the lines
of the existing support we have for x86 targets:

 * under KVM, -cpu max is the same as -cpu host
 * under TCG, -cpu max means "emulate with as many features as
   possible"

-cpu max is supported for both usermode and system emulation,
again following the x86 line.

NB that cross-QEMU-version migration is not supported for -cpu max:
in future the definition of "maximum set of features" will change
as we add more emulation features.

The patchset also adds support to the virt board for the "max"
option to -machine gic-version, requesting "best available
interrupt controller", with the same semantics as -cpu max.

Together these should assist users like libguestfs that just want
to be able to run code without having to figure out what the
right command line arguments for this particular host system are.

The patches make 'any' a synonym for 'max', using the approach
of putting a compat hack into arm_cpu_class_by_name() that
Igor suggested. For the moment, we don't enable any of the
CPU feature bits in 'max' that aren't in the a15/a57 if we're
doing system emulation mode. This is a combination of:
 * some of those bits are currently only implemented sufficiently
   for user-only mode, not for system emulation
 * we would also need to update ID register bits to advertise the
   extra features
We should certainly do that, but I'd like to get basic -cpu max
support into 2.12, and the softfreeze deadline is rapidly approaching,
so I've opted to postpone that to post 2.12. If people have the time
to review this series this week I'd really appreciate it.

Changes since v1:
 * the "check CPU realize succeeded in virt board" patch is in master
 * the "target/arm: Make 'any' CPU just an alias for 'max'" is new,
   and unifies 'any' with 'max' as suggested in review of v1
 * the other patches are essentially unchanged

Changes since v2:
 * fixed the silly error in patch 4 that made user-only mode always
   use "max" rather than only if the user asked for "any"...

thanks
-- PMM


Peter Maydell (6):
  target/arm: Query host CPU features on-demand at instance init
  target/arm: Move definition of 'host' cpu type into cpu.c
  target/arm: Add "-cpu max" support
  target/arm: Make 'any' CPU just an alias for 'max'
  hw/arm/virt: Add "max" to the list of CPU types "virt" supports
  hw/arm/virt: Support -machine gic-version=max

 target/arm/cpu-qom.h |  2 ++
 target/arm/cpu.h     |  5 +++
 target/arm/kvm_arm.h | 35 +++++++++++++------
 hw/arm/virt.c        | 30 ++++++++++------
 target/arm/cpu.c     | 97 +++++++++++++++++++++++++++++++++++++++++++---------
 target/arm/cpu64.c   | 66 ++++++++++++++++++++++-------------
 target/arm/kvm.c     | 53 ++++++++++------------------
 target/arm/kvm32.c   |  8 ++---
 target/arm/kvm64.c   |  8 ++---
 9 files changed, 200 insertions(+), 104 deletions(-)

-- 
2.16.2


Re: [Qemu-devel] [PATCH v3 0/6] arm: support -cpu max (and gic-version=max)
Posted by Alex Bennée 6 years ago
Peter Maydell <peter.maydell@linaro.org> writes:

> This patchset adds support for '-cpu max' to Arm, along the lines
> of the existing support we have for x86 targets:
>
>  * under KVM, -cpu max is the same as -cpu host
>  * under TCG, -cpu max means "emulate with as many features as
>    possible"
<snip>

It all looks good to me. The only minor problem I ran into was setting
-M virt,gic-version=max silently hangs with the stock QEMU_EFI.fd on my
version of Ubuntu. It would be nice if there was better feedback we
could give to the user in this case.

It works with the latest snapshot from:

  http://snapshots.linaro.org/reference-platform/enterprise/firmware/15/release/qemu-aarch64/

Anyway this series can have:

Tested-by: Alex Bennée <alex.bennee@linaro.org>

--
Alex Bennée

Re: [Qemu-devel] [PATCH v3 0/6] arm: support -cpu max (and gic-version=max)
Posted by Peter Maydell 6 years ago
On 9 March 2018 at 13:52, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
>> This patchset adds support for '-cpu max' to Arm, along the lines
>> of the existing support we have for x86 targets:
>>
>>  * under KVM, -cpu max is the same as -cpu host
>>  * under TCG, -cpu max means "emulate with as many features as
>>    possible"
> <snip>
>
> It all looks good to me. The only minor problem I ran into was setting
> -M virt,gic-version=max silently hangs with the stock QEMU_EFI.fd on my
> version of Ubuntu. It would be nice if there was better feedback we
> could give to the user in this case.

Presumably that also fails if you ask for gic-version=3 ?

> It works with the latest snapshot from:
>
>   http://snapshots.linaro.org/reference-platform/enterprise/firmware/15/release/qemu-aarch64/

Sounds like "earlier firmware versions didn't have gicv3 support,
later ones do" ?

thanks
-- PMM

Re: [Qemu-devel] [PATCH v3 0/6] arm: support -cpu max (and gic-version=max)
Posted by Alex Bennée 6 years ago
Peter Maydell <peter.maydell@linaro.org> writes:

> On 9 March 2018 at 13:52, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> Peter Maydell <peter.maydell@linaro.org> writes:
>>
>>> This patchset adds support for '-cpu max' to Arm, along the lines
>>> of the existing support we have for x86 targets:
>>>
>>>  * under KVM, -cpu max is the same as -cpu host
>>>  * under TCG, -cpu max means "emulate with as many features as
>>>    possible"
>> <snip>
>>
>> It all looks good to me. The only minor problem I ran into was setting
>> -M virt,gic-version=max silently hangs with the stock QEMU_EFI.fd on my
>> version of Ubuntu. It would be nice if there was better feedback we
>> could give to the user in this case.
>
> Presumably that also fails if you ask for gic-version=3 ?

Yes.

>
>> It works with the latest snapshot from:
>>
>>   http://snapshots.linaro.org/reference-platform/enterprise/firmware/15/release/qemu-aarch64/
>
> Sounds like "earlier firmware versions didn't have gicv3 support,
> later ones do" ?

According to the dpkg changelog it should have:

  Adds GICv3 support.  Closes: #810495

However it seems like it wasn't complete support.

--
Alex Bennée