Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-03 Thread Alexander Graf


> Am 03.02.2017 um 10:27 schrieb Gerd Hoffmann :
> 
>> On Do, 2017-02-02 at 16:44 +0200, Pekka Enberg wrote:
>> Hi,
>> 
>> Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?
> 
> Yes.  The bits are not yet upstream though (Cc'ing alex for status).

Ugh, the patches fell through the cracks. I think we basically all agreed on 
the interfaces, I just need to dig through my inbox and figure out again where 
they got stuck.

I won't get to it before Fosdem, but after I'll make sure it's high on the todo 
list.


Alex





Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-03 Thread Gerd Hoffmann
On Do, 2017-02-02 at 16:44 +0200, Pekka Enberg wrote:
> Hi,
> 
> Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?

Yes.  The bits are not yet upstream though (Cc'ing alex for status).

> I have installed 64-bit Fedora 24 by Gerd Hoffmann on the hardware:
> 
>https://www.kraxel.org/blog/2016/04/fedora-on-raspberry-pi-updates/

Good.  Those kernels have the kernel patches already included.

> and updated to QEMU 2.8.0 from rawhide:

Not good.  You need qemu patches too.

https://www.kraxel.org/cgit/qemu/log/?h=v28/arm-no-irqchip

> I also tried to enable GIC v3 by adding the “-machine gic-version=3” 

/me runs gic-version=2.

cheers,
  Gerd




Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Pekka Enberg

Hi,

On 02/02/2017 19.48, Ard Biesheuvel wrote:

$ git grep -C5 -ni 0x1DE7EC7EDBADC0DE
arch/arm64/kvm/sys_regs.h-105-static inline void reset_unknown(struct
kvm_vcpu *vcpu,
arch/arm64/kvm/sys_regs.h-106-   const struct
sys_reg_desc *r)
arch/arm64/kvm/sys_regs.h-107-{
arch/arm64/kvm/sys_regs.h-108-  BUG_ON(!r->reg);
arch/arm64/kvm/sys_regs.h-109-  BUG_ON(r->reg >= NR_SYS_REGS);
arch/arm64/kvm/sys_regs.h:110:  vcpu_sys_reg(vcpu, r->reg) =
0x1de7ec7edbadc0deULL;
arch/arm64/kvm/sys_regs.h-111-}
arch/arm64/kvm/sys_regs.h-112-

In other words (or rather, in words), KVM is triggering this exception
in the guest deliberately, which I suspect has something to do with
the lack of a GIC? Are you using these patches Peter mentions?


No, I'm not using Peter's patches. It's mainline Fedora 24 and rawhide QEMU.

- Pekka



Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Laszlo Ersek
On 02/02/17 18:48, Ard Biesheuvel wrote:

>>>  ESR 0x0200  FAR 0x1DE7EC7EDBADC0DE
>>>
> 
> 
> $ git grep -C5 -ni 0x1DE7EC7EDBADC0DE
> arch/arm64/kvm/sys_regs.h-105-static inline void reset_unknown(struct
> kvm_vcpu *vcpu,
> arch/arm64/kvm/sys_regs.h-106-   const struct
> sys_reg_desc *r)
> arch/arm64/kvm/sys_regs.h-107-{
> arch/arm64/kvm/sys_regs.h-108-  BUG_ON(!r->reg);
> arch/arm64/kvm/sys_regs.h-109-  BUG_ON(r->reg >= NR_SYS_REGS);
> arch/arm64/kvm/sys_regs.h:110:  vcpu_sys_reg(vcpu, r->reg) =
> 0x1de7ec7edbadc0deULL;
> arch/arm64/kvm/sys_regs.h-111-}
> arch/arm64/kvm/sys_regs.h-112-
> 
> In other words (or rather, in words), KVM is triggering this exception
> in the guest deliberately, which I suspect has something to do with
> the lack of a GIC? Are you using these patches Peter mentions?

"detected bad code". Mind = blown.




Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Ard Biesheuvel
On 2 February 2017 at 15:50, Laszlo Ersek  wrote:
> Adding Ard, just in case...
>
> I have one (half-)comment re: GICv3:
>
> On 02/02/17 15:44, Pekka Enberg wrote:
>> Hi,
>>
>> Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?
>>
>> I have installed 64-bit Fedora 24 by Gerd Hoffmann on the hardware:
>>
>>   https://www.kraxel.org/blog/2016/04/fedora-on-raspberry-pi-updates/
>>
>> and built a VM image using virt-builder:
>>
>>   virt-builder --root-password password:root --arch aarch64 fedora-24
>>
>> I also built the latest UEFI for QEMU from sources:
>>
>>   https://wiki.linaro.org/LEG/UEFIforQEMU
>>
>> and updated to QEMU 2.8.0 from rawhide:
>>
>>   [root@fedora-rpi2 ~]# qemu-system-aarch64 -version
>>   QEMU emulator version 2.8.0(qemu-2.8.0-1.fc26)
>>   Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
>>
>> The VM image should be fine because I’m able to boot to it under CPU
>> emulation:
>>
>> qemu-system-aarch64 \
>>   -nographic \
>>   -M virt \
>>   -cpu cortex-a57 \
>>   -smp 1 \
>>   -m 512 \
>>   -bios QEMU_EFI.fd \
>>   -device virtio-blk-device,drive=image -drive
>> if=none,id=image,file=fedora-24.img \
>>   -netdev bridge,id=hn0,br=virbr0 -device
>> virtio-net-pci,netdev=hn0,romfile= \
>>   -device virtio-rng-pci
>>
[..]
>> I also tried to enable GIC v3 by adding the “-machine gic-version=3”
>> command one option but the UEFI firmware doesn’t like that:
>>
>> Found GIC v3 (re)distributor @ 0x800 (0x80A)
>>
>>
>> Synchronous Exception at 0x5BD5B820
>> PC 0x5BD5B820 (0x5BD58000+0x3820) [ 0] ArmGicDxe.dll
>> PC 0x5BD5BC38 (0x5BD58000+0x3C38) [ 0] ArmGicDxe.dll
>> PC 0x5BD593B0 (0x5BD58000+0x13B0) [ 0] ArmGicDxe.dll
>> PC 0x5BD590A0 (0x5BD58000+0x10A0) [ 0] ArmGicDxe.dll
>> PC 0x5EF1ADF4 (0x5EF14000+0x6DF4) [ 1] DxeCore.dll
>> PC 0x5EF32B0C (0x5EF14000+0x0001EB0C) [ 1] DxeCore.dll
>> PC 0x5EF165E4 (0x5EF14000+0x25E4) [ 1] DxeCore.dll
>> PC 0x5EF15828 (0x5EF14000+0x1828) [ 1] DxeCore.dll
>> PC 0x5EF15024 (0x5EF14000+0x1024) [ 1] DxeCore.dll
>>
>> [ 0]
>> /home/penberg/raspberrypi/uefi/edk2/Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/AARCH64/ArmPkg/Drivers/ArmGic/ArmGicDxe/DEBUG/ArmGicDxe.dll
>>
>> [ 1]
>> /home/penberg/raspberrypi/uefi/edk2/Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/AARCH64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll
>>
>>
>>   X0 0x0036   X1 0x0004   X2 0x0036
>>   X3 0x
>>   X4 0x0001   X5 0x   X6 0x0A01191513061C12
>>   X7 0x121C06131519010A
>>   X8 0x041ECB83   X9 0x0007  X10 0x58B6
>>  X11 0x0004
>>  X12 0x0001  X13 0x0008  X14 0x
>>  X15 0x
>>  X16 0x5EF13DF0  X17 0x  X18 0x
>>  X19 0x4007C268
>>  X20 0x  X21 0x  X22 0x
>>  X23 0x
>>  X24 0x  X25 0x  X26 0x
>>  X27 0x
>>  X28 0x   FP 0x5EF13D20   LR 0x5BD5BC38
>>
>>   V0 0xAFAFAFAFAFAFAFAF AFAFAFAFAFAFAFAF   V1 0x
>> 
>>   V2 0x    V3 0x
>> 
>>   V4 0x    V5 0x
>> 
>>   V6 0x    V7 0x
>> 
>>   V8 0x    V9 0x
>> 
>>  V10 0x   V11 0x
>> 
>>  V12 0x   V13 0x
>> 
>>  V14 0x   V15 0x
>> 
>>  V16 0x   V17 0x
>> 
>>  V18 0x   V19 0x
>> 
>>  V20 0x   V21 0x
>> 
>>  V22 0x   V23 0x
>> 
>>  V24 0x   V25 0x
>> 
>>  V26 0x   V27 0x
>> 
>>  V28 0x   V29 0x
>> 
>>  V30 0x   V31 0x
>> 
>>
>>   SP 0x5EF13D20  ELR 0x5BD5B820  SPSR 0x8205  FPSR
>> 0x
>>  ESR 0x0200  FAR 0x1DE7EC7EDBADC0DE
>>


$ git grep -C5 -ni 0x1DE7EC7EDBADC0DE
arch/arm64/kvm/sys_regs.h-105-static inline void reset_unknown(struct

Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Peter Maydell
On 2 February 2017 at 15:52, Ard Biesheuvel  wrote:
> How is this supposed to work? RPI3 does not have a GIC at all, but a
> proprietary interrupt controller that is not supported by KVM

The idea is that (with the relevant not-yet-in-master patchsets)
you can fall back to "use a userspace interrupt controller model".
The performance will probably not be great.

thanks
-- PMM



Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Ard Biesheuvel
On 2 February 2017 at 15:50, Laszlo Ersek  wrote:
> Adding Ard, just in case...
>
> I have one (half-)comment re: GICv3:
>

How is this supposed to work? RPI3 does not have a GIC at all, but a
proprietary interrupt controller that is not supported by KVM


> On 02/02/17 15:44, Pekka Enberg wrote:
>> Hi,
>>
>> Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?
>>
>> I have installed 64-bit Fedora 24 by Gerd Hoffmann on the hardware:
>>
>>   https://www.kraxel.org/blog/2016/04/fedora-on-raspberry-pi-updates/
>>
>> and built a VM image using virt-builder:
>>
>>   virt-builder --root-password password:root --arch aarch64 fedora-24
>>
>> I also built the latest UEFI for QEMU from sources:
>>
>>   https://wiki.linaro.org/LEG/UEFIforQEMU
>>
>> and updated to QEMU 2.8.0 from rawhide:
>>
>>   [root@fedora-rpi2 ~]# qemu-system-aarch64 -version
>>   QEMU emulator version 2.8.0(qemu-2.8.0-1.fc26)
>>   Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
>>
>> The VM image should be fine because I’m able to boot to it under CPU
>> emulation:
>>
>> qemu-system-aarch64 \
>>   -nographic \
>>   -M virt \
>>   -cpu cortex-a57 \
>>   -smp 1 \
>>   -m 512 \
>>   -bios QEMU_EFI.fd \
>>   -device virtio-blk-device,drive=image -drive
>> if=none,id=image,file=fedora-24.img \
>>   -netdev bridge,id=hn0,br=virbr0 -device
>> virtio-net-pci,netdev=hn0,romfile= \
>>   -device virtio-rng-pci
>>
>> However, when I enable KVM, keyboard stops working (interrupt delivery
>> issue?) and Fedora boot process hangs at random places before reaching
>> login:
>>
>> qemu-system-aarch64 \
>> -nographic \
>> -M virt \
>> -cpu host \
>> -enable-kvm \
>> -smp 1 \
>> -m 512 \
>> -bios QEMU_EFI.fd \
>> -device virtio-blk-device,drive=image -drive
>> if=none,id=image,file=$IMAGE \
>> -netdev bridge,id=hn0,br=virbr0 -device
>> virtio-net-pci,netdev=hn0,romfile= \
>> -device virtio-rng-pci
>>
>> EFI stub: Booting Linux Kernel...
>> ConvertPages: Incompatible memory types
>> EFI stub: Using DTB from configuration table
>> EFI stub: Exiting boot services and installing virtual address map...
>> [0.00] Booting Linux on physical CPU 0x0
>> [0.00] Linux version 4.9.5-100.fc24.aarch64
>> (mockbu...@aarch64-06a.arm.fedoraproject.org) (gcc version 6.3.1
>> 20161221 (Red Hat 6.3.1-1) (GCC) ) #1 SMP Tue Jan 24 21:12:07 UTC 2017
>> [0.00] Boot CPU: AArch64 Processor [410fd034]
>> [0.00] debug: ignoring loglevel setting.
>> [0.00] efi: Getting EFI parameters from FDT:
>> [0.00] efi: EFI v2.60 by EDK II
>> [0.00] efi:  SMBIOS 3.0=0x5871  ACPI 2.0=0x589b
>> MEMATTR=0x59c03218
>> [0.00] cma: Failed to reserve 512 MiB
>> [0.00] NUMA: No NUMA configuration found
>> [0.00] NUMA: Faking a node at [mem
>> 0x-0x5fff]
>> [0.00] NUMA: Adding memblock [0x4000 - 0x585b] on node 0
>> [0.00] NUMA: Adding memblock [0x585c - 0x5861] on node 0
>> [0.00] NUMA: Adding memblock [0x5862 - 0x586f] on node 0
>> [0.00] NUMA: Adding memblock [0x5870 - 0x58b6] on node 0
>> [0.00] NUMA: Adding memblock [0x58b7 - 0x5be3] on node 0
>> [0.00] NUMA: Adding memblock [0x5be4 - 0x5bec] on node 0
>> [0.00] NUMA: Adding memblock [0x5bed - 0x5bed] on node 0
>> [0.00] NUMA: Adding memblock [0x5bee - 0x5bff] on node 0
>> [0.00] NUMA: Adding memblock [0x5c00 - 0x5fff] on node 0
>> [0.00] NUMA: Initmem setup node 0 [mem 0x4000-0x5fff]
>> [0.00] NUMA: NODE_DATA [mem 0x5ff62680-0x5ff6]
>> [0.00] Zone ranges:
>> [0.00]   DMA  [mem 0x4000-0x5fff]
>> [0.00]   Normal   empty
>> [0.00] Movable zone start for each node
>> [0.00] Early memory node ranges
>> [0.00]   node   0: [mem 0x4000-0x585b]
>> [0.00]   node   0: [mem 0x585c-0x5861]
>> [0.00]   node   0: [mem 0x5862-0x586f]
>> [0.00]   node   0: [mem 0x5870-0x58b6]
>> [0.00]   node   0: [mem 0x58b7-0x5be3]
>> [0.00]   node   0: [mem 0x5be4-0x5bec]
>> [0.00]   node   0: [mem 0x5bed-0x5bed]
>> [0.00]   node   0: [mem 0x5bee-0x5bff]
>> [0.00]   node   0: [mem 0x5c00-0x5fff]
>> [0.00] Initmem setup node 0 [mem
>> 0x4000-0x5fff]
>> [0.00] On node 0 totalpages: 8192
>> [0.00]   DMA zone: 8 pages used for memmap
>> [0.00]   DMA zone: 0 pages reserved
>> [0.00]   DMA zone: 8192 pages, LIFO batch:0
>> [

Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Laszlo Ersek
Adding Ard, just in case...

I have one (half-)comment re: GICv3:

On 02/02/17 15:44, Pekka Enberg wrote:
> Hi,
> 
> Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?
> 
> I have installed 64-bit Fedora 24 by Gerd Hoffmann on the hardware:
> 
>   https://www.kraxel.org/blog/2016/04/fedora-on-raspberry-pi-updates/
> 
> and built a VM image using virt-builder:
> 
>   virt-builder --root-password password:root --arch aarch64 fedora-24
> 
> I also built the latest UEFI for QEMU from sources:
> 
>   https://wiki.linaro.org/LEG/UEFIforQEMU
> 
> and updated to QEMU 2.8.0 from rawhide:
> 
>   [root@fedora-rpi2 ~]# qemu-system-aarch64 -version
>   QEMU emulator version 2.8.0(qemu-2.8.0-1.fc26)
>   Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
> 
> The VM image should be fine because I’m able to boot to it under CPU
> emulation:
> 
> qemu-system-aarch64 \
>   -nographic \
>   -M virt \
>   -cpu cortex-a57 \
>   -smp 1 \
>   -m 512 \
>   -bios QEMU_EFI.fd \
>   -device virtio-blk-device,drive=image -drive
> if=none,id=image,file=fedora-24.img \
>   -netdev bridge,id=hn0,br=virbr0 -device
> virtio-net-pci,netdev=hn0,romfile= \
>   -device virtio-rng-pci
> 
> However, when I enable KVM, keyboard stops working (interrupt delivery
> issue?) and Fedora boot process hangs at random places before reaching
> login:
> 
> qemu-system-aarch64 \
> -nographic \
> -M virt \
> -cpu host \
> -enable-kvm \
> -smp 1 \
> -m 512 \
> -bios QEMU_EFI.fd \
> -device virtio-blk-device,drive=image -drive
> if=none,id=image,file=$IMAGE \
> -netdev bridge,id=hn0,br=virbr0 -device
> virtio-net-pci,netdev=hn0,romfile= \
> -device virtio-rng-pci
> 
> EFI stub: Booting Linux Kernel...
> ConvertPages: Incompatible memory types
> EFI stub: Using DTB from configuration table
> EFI stub: Exiting boot services and installing virtual address map...
> [0.00] Booting Linux on physical CPU 0x0
> [0.00] Linux version 4.9.5-100.fc24.aarch64
> (mockbu...@aarch64-06a.arm.fedoraproject.org) (gcc version 6.3.1
> 20161221 (Red Hat 6.3.1-1) (GCC) ) #1 SMP Tue Jan 24 21:12:07 UTC 2017
> [0.00] Boot CPU: AArch64 Processor [410fd034]
> [0.00] debug: ignoring loglevel setting.
> [0.00] efi: Getting EFI parameters from FDT:
> [0.00] efi: EFI v2.60 by EDK II
> [0.00] efi:  SMBIOS 3.0=0x5871  ACPI 2.0=0x589b
> MEMATTR=0x59c03218
> [0.00] cma: Failed to reserve 512 MiB
> [0.00] NUMA: No NUMA configuration found
> [0.00] NUMA: Faking a node at [mem
> 0x-0x5fff]
> [0.00] NUMA: Adding memblock [0x4000 - 0x585b] on node 0
> [0.00] NUMA: Adding memblock [0x585c - 0x5861] on node 0
> [0.00] NUMA: Adding memblock [0x5862 - 0x586f] on node 0
> [0.00] NUMA: Adding memblock [0x5870 - 0x58b6] on node 0
> [0.00] NUMA: Adding memblock [0x58b7 - 0x5be3] on node 0
> [0.00] NUMA: Adding memblock [0x5be4 - 0x5bec] on node 0
> [0.00] NUMA: Adding memblock [0x5bed - 0x5bed] on node 0
> [0.00] NUMA: Adding memblock [0x5bee - 0x5bff] on node 0
> [0.00] NUMA: Adding memblock [0x5c00 - 0x5fff] on node 0
> [0.00] NUMA: Initmem setup node 0 [mem 0x4000-0x5fff]
> [0.00] NUMA: NODE_DATA [mem 0x5ff62680-0x5ff6]
> [0.00] Zone ranges:
> [0.00]   DMA  [mem 0x4000-0x5fff]
> [0.00]   Normal   empty
> [0.00] Movable zone start for each node
> [0.00] Early memory node ranges
> [0.00]   node   0: [mem 0x4000-0x585b]
> [0.00]   node   0: [mem 0x585c-0x5861]
> [0.00]   node   0: [mem 0x5862-0x586f]
> [0.00]   node   0: [mem 0x5870-0x58b6]
> [0.00]   node   0: [mem 0x58b7-0x5be3]
> [0.00]   node   0: [mem 0x5be4-0x5bec]
> [0.00]   node   0: [mem 0x5bed-0x5bed]
> [0.00]   node   0: [mem 0x5bee-0x5bff]
> [0.00]   node   0: [mem 0x5c00-0x5fff]
> [0.00] Initmem setup node 0 [mem
> 0x4000-0x5fff]
> [0.00] On node 0 totalpages: 8192
> [0.00]   DMA zone: 8 pages used for memmap
> [0.00]   DMA zone: 0 pages reserved
> [0.00]   DMA zone: 8192 pages, LIFO batch:0
> [0.00] psci: probing for conduit method from DT.
> [0.00] psci: PSCIv0.2 detected in firmware.
> [0.00] psci: Using standard PSCI v0.2 function IDs
> [0.00] psci: Trusted OS migration not required
> [0.00] percpu: Embedded 3 pages/cpu @80001ff0 s114840
> r8192 

Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Christoffer Dall
On Thu, Feb 2, 2017 at 3:59 PM, Marc Zyngier  wrote:
> [+Christoffer]
>
> Hi Pekka,
>
> On 02/02/17 14:44, Pekka Enberg wrote:
>> Hi,
>>
>> Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?
>>
>> I have installed 64-bit Fedora 24 by Gerd Hoffmann on the hardware:
>>
>>https://www.kraxel.org/blog/2016/04/fedora-on-raspberry-pi-updates/
>>
>> and built a VM image using virt-builder:
>>
>>virt-builder --root-password password:root --arch aarch64 fedora-24
>>
>> I also built the latest UEFI for QEMU from sources:
>>
>>https://wiki.linaro.org/LEG/UEFIforQEMU
>>
>> and updated to QEMU 2.8.0 from rawhide:
>>
>>[root@fedora-rpi2 ~]# qemu-system-aarch64 -version
>>QEMU emulator version 2.8.0(qemu-2.8.0-1.fc26)
>>Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
>>
>> The VM image should be fine because I’m able to boot to it under CPU
>> emulation:
>>
>> qemu-system-aarch64 \
>>-nographic \
>>-M virt \
>>-cpu cortex-a57 \
>>-smp 1 \
>>-m 512 \
>>-bios QEMU_EFI.fd \
>>-device virtio-blk-device,drive=image -drive
>> if=none,id=image,file=fedora-24.img \
>>-netdev bridge,id=hn0,br=virbr0 -device
>> virtio-net-pci,netdev=hn0,romfile= \
>>-device virtio-rng-pci
>>
>> However, when I enable KVM, keyboard stops working (interrupt delivery
>> issue?) and Fedora boot process hangs at random places before reaching
>> login:
>
> [snip]
>
> TL;DR: as it stands now, none of the RPi{2,3} can run KVM out of the
> box, as they lack a virtualization capable interrupt controller. This
> means that timer interrupts cannot be reported to the core, and things
> die a painful death.
>
> The longer story: we have a set of patches somewhere on the list that do
> enable the timer interrupts to be reported to userspace (QEMU), which
> can then inject them into its on GIC emulation and kick the vcpu. So
> far, work on this seems to have stopped (API issues? QEMU patches?)
>
> Christoffer was about to revive the kernel patches, but we need someone
> to pick up the QEMU part, and work with us and the QEMU people so that
> we agree once and for all on the ABI to signal PPIs to userspace.

Interesting timing.  I just revived the patches today, but I reworked
the ABI slightly and rebased the work on top of support for the
physical timer in the guest and ran into two issues: First, turning of
the in-kernel irqchip no longer works, and I also lost track of how
the patches should look, so indeed I need help from a QEMU person to
look at that.  Second, there is some sort of regression on the 32-bit
side using the physical timer patches.

Once I've sorted some of this out, I can send out the patch series.
At least I want to figure out the 32-bit breakage first, and then I
may simply send out the patches with a big fat UNTESTED warning in
hope that someone will work on the qemu side with me.

Thanks,
-Christoffer



Re: [Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Marc Zyngier
[+Christoffer]

Hi Pekka,

On 02/02/17 14:44, Pekka Enberg wrote:
> Hi,
> 
> Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?
> 
> I have installed 64-bit Fedora 24 by Gerd Hoffmann on the hardware:
> 
>https://www.kraxel.org/blog/2016/04/fedora-on-raspberry-pi-updates/
> 
> and built a VM image using virt-builder:
> 
>virt-builder --root-password password:root --arch aarch64 fedora-24
> 
> I also built the latest UEFI for QEMU from sources:
> 
>https://wiki.linaro.org/LEG/UEFIforQEMU
> 
> and updated to QEMU 2.8.0 from rawhide:
> 
>[root@fedora-rpi2 ~]# qemu-system-aarch64 -version
>QEMU emulator version 2.8.0(qemu-2.8.0-1.fc26)
>Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
> 
> The VM image should be fine because I’m able to boot to it under CPU 
> emulation:
> 
> qemu-system-aarch64 \
>-nographic \
>-M virt \
>-cpu cortex-a57 \
>-smp 1 \
>-m 512 \
>-bios QEMU_EFI.fd \
>-device virtio-blk-device,drive=image -drive 
> if=none,id=image,file=fedora-24.img \
>-netdev bridge,id=hn0,br=virbr0 -device 
> virtio-net-pci,netdev=hn0,romfile= \
>-device virtio-rng-pci
> 
> However, when I enable KVM, keyboard stops working (interrupt delivery 
> issue?) and Fedora boot process hangs at random places before reaching 
> login:

[snip]

TL;DR: as it stands now, none of the RPi{2,3} can run KVM out of the
box, as they lack a virtualization capable interrupt controller. This
means that timer interrupts cannot be reported to the core, and things
die a painful death.

The longer story: we have a set of patches somewhere on the list that do
enable the timer interrupts to be reported to userspace (QEMU), which
can then inject them into its on GIC emulation and kick the vcpu. So
far, work on this seems to have stopped (API issues? QEMU patches?)

Christoffer was about to revive the kernel patches, but we need someone
to pick up the QEMU part, and work with us and the QEMU people so that
we agree once and for all on the ABI to signal PPIs to userspace.

Once everyone is happy with the way it looks, we'll merge the patches,
and I take that the QEMU folks will do the same with their side of things.

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...



[Qemu-devel] KVM/QEMU on Raspberry Pi 3

2017-02-02 Thread Pekka Enberg

Hi,

Has anyone been able to successfully run QEMU/KVM under Raspberry Pi 3?

I have installed 64-bit Fedora 24 by Gerd Hoffmann on the hardware:

  https://www.kraxel.org/blog/2016/04/fedora-on-raspberry-pi-updates/

and built a VM image using virt-builder:

  virt-builder --root-password password:root --arch aarch64 fedora-24

I also built the latest UEFI for QEMU from sources:

  https://wiki.linaro.org/LEG/UEFIforQEMU

and updated to QEMU 2.8.0 from rawhide:

  [root@fedora-rpi2 ~]# qemu-system-aarch64 -version
  QEMU emulator version 2.8.0(qemu-2.8.0-1.fc26)
  Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers

The VM image should be fine because I’m able to boot to it under CPU 
emulation:


qemu-system-aarch64 \
  -nographic \
  -M virt \
  -cpu cortex-a57 \
  -smp 1 \
  -m 512 \
  -bios QEMU_EFI.fd \
  -device virtio-blk-device,drive=image -drive 
if=none,id=image,file=fedora-24.img \
  -netdev bridge,id=hn0,br=virbr0 -device 
virtio-net-pci,netdev=hn0,romfile= \

  -device virtio-rng-pci

However, when I enable KVM, keyboard stops working (interrupt delivery 
issue?) and Fedora boot process hangs at random places before reaching 
login:


qemu-system-aarch64 \
-nographic \
-M virt \
-cpu host \
-enable-kvm \
-smp 1 \
-m 512 \
-bios QEMU_EFI.fd \
-device virtio-blk-device,drive=image -drive 
if=none,id=image,file=$IMAGE \
	-netdev bridge,id=hn0,br=virbr0 -device 
virtio-net-pci,netdev=hn0,romfile= \

-device virtio-rng-pci

EFI stub: Booting Linux Kernel...
ConvertPages: Incompatible memory types
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
[0.00] Booting Linux on physical CPU 0x0
[0.00] Linux version 4.9.5-100.fc24.aarch64 
(mockbu...@aarch64-06a.arm.fedoraproject.org) (gcc version 6.3.1 
20161221 (Red Hat 6.3.1-1) (GCC) ) #1 SMP Tue Jan 24 21:12:07 UTC 2017

[0.00] Boot CPU: AArch64 Processor [410fd034]
[0.00] debug: ignoring loglevel setting.
[0.00] efi: Getting EFI parameters from FDT:
[0.00] efi: EFI v2.60 by EDK II
[0.00] efi:  SMBIOS 3.0=0x5871  ACPI 2.0=0x589b 
MEMATTR=0x59c03218

[0.00] cma: Failed to reserve 512 MiB
[0.00] NUMA: No NUMA configuration found
[0.00] NUMA: Faking a node at [mem 
0x-0x5fff]

[0.00] NUMA: Adding memblock [0x4000 - 0x585b] on node 0
[0.00] NUMA: Adding memblock [0x585c - 0x5861] on node 0
[0.00] NUMA: Adding memblock [0x5862 - 0x586f] on node 0
[0.00] NUMA: Adding memblock [0x5870 - 0x58b6] on node 0
[0.00] NUMA: Adding memblock [0x58b7 - 0x5be3] on node 0
[0.00] NUMA: Adding memblock [0x5be4 - 0x5bec] on node 0
[0.00] NUMA: Adding memblock [0x5bed - 0x5bed] on node 0
[0.00] NUMA: Adding memblock [0x5bee - 0x5bff] on node 0
[0.00] NUMA: Adding memblock [0x5c00 - 0x5fff] on node 0
[0.00] NUMA: Initmem setup node 0 [mem 0x4000-0x5fff]
[0.00] NUMA: NODE_DATA [mem 0x5ff62680-0x5ff6]
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x4000-0x5fff]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x4000-0x585b]
[0.00]   node   0: [mem 0x585c-0x5861]
[0.00]   node   0: [mem 0x5862-0x586f]
[0.00]   node   0: [mem 0x5870-0x58b6]
[0.00]   node   0: [mem 0x58b7-0x5be3]
[0.00]   node   0: [mem 0x5be4-0x5bec]
[0.00]   node   0: [mem 0x5bed-0x5bed]
[0.00]   node   0: [mem 0x5bee-0x5bff]
[0.00]   node   0: [mem 0x5c00-0x5fff]
[0.00] Initmem setup node 0 [mem 
0x4000-0x5fff]

[0.00] On node 0 totalpages: 8192
[0.00]   DMA zone: 8 pages used for memmap
[0.00]   DMA zone: 0 pages reserved
[0.00]   DMA zone: 8192 pages, LIFO batch:0
[0.00] psci: probing for conduit method from DT.
[0.00] psci: PSCIv0.2 detected in firmware.
[0.00] psci: Using standard PSCI v0.2 function IDs
[0.00] psci: Trusted OS migration not required
[0.00] percpu: Embedded 3 pages/cpu @80001ff0 s114840 
r8192 d73576 u196608

[0.00] pcpu-alloc: s114840 r8192 d73576 u196608 alloc=3*65536
[0.00] pcpu-alloc: [0] 0
[0.00] Detected VIPT I-cache on CPU0
[0.00] Built 1 zonelists in Node order, mobility grouping off. 
Total pages: 8184

[0.00]