Skip to content

RPi4: Patch to get KVM working #3035

Open

Description

@jan-kiszka

So far only informative:
As the RPi4 is moving closer to common ARM SoC designs, proper virtualization is finally in reach. I got KVM working, though we currently need a patch for the 32-bit variant, see https://marc.info/?l=kvm&m=156190795627075&w=2. Once that has been reviewed and approved upstream, this kernel can pick it up as well. The patch was tested successfully with the 4.19-rpi branch.

Activity

  1. popcornmix commented on Jul 1, 2019

    @popcornmix
    Collaborator

    Let us know when it merges.
    If upstream patches have been tested and seen to be useful we're usually happy to cherry-pick them.

  2. macromorgan commented on Oct 21, 2019

    @macromorgan
    Contributor

    Is there a way to enable KVM for the default config for 64bit while we wait for the 32bit to get merged, if it does?

  3. jan-kiszka commented on Oct 21, 2019

    @jan-kiszka
    ContributorAuthor

    32-bit KVM is considered dead on ARM by the maintainer, and there are also complications with the patch I sent. So 64-bit is the better way forward.

  4. macromorgan commented on Jan 10, 2020

    @macromorgan
    Contributor

    Just want to raise the issue again, especially since the 64 bit kernel seems to be pretty stable for me on Raspbian. Is there a way we can get KVM enabled in the default configs? Sadly it'll have to be a point of differentiation from the 32 bit builds from what I see above, but it would help me and probably others who like to dabble with KVM on their Raspberry Pis by not having to build their own kernels. Thank you.

  5. macromorgan commented on Jan 21, 2020

    @macromorgan
    Contributor

    Sorry about the dupe, wasn't sure if I was doing the feature request correctly (since this one is tagged for a patch that looks like is no longer maintained and won't/shouldn't be added to the 32 bit kernel).

  6. pelwell commented on Jan 21, 2020

    @pelwell
    Contributor

    I take your point - it's not clear cut either way.

    You could further the cause by telling us (on the other thread) a few reasons why more than a handful of Pi users might want KVM.

  7. pelwell commented on Jan 21, 2020

    @pelwell
    Contributor

    Sorry, post here - this is the other thread.

  8. macromorgan commented on Jan 21, 2020

    @macromorgan
    Contributor

    KVM would allow users to virtualize operating systems more quickly on the Raspberry Pi (4). While this technically would work on the Pi 2 2nd revision, Pi 3, and Pi 4 all with the 64 bit kernel, it is on the Pi 4 where memory constraints are such that it is feasible.

    When running Debian/Raspbian Linux in QEMU on a Pi 4, even with the same architecture (armhf or aarch64), it's far too slow to be usable unless KVM is enabled. With KVM enabled I can easily run Raspbian Desktop within a VM on my Raspberry Pi 4.

    The assumption (on my part) is that by enabling this you will enable others to experiment with KVM more easily, and that by doing this only for the 64 bit kernel (which is the only kernel that supports it anyway as far as I know) it will not have widespread impact on the greater community in the event of any issues.

  9. jan-kiszka commented on Jan 22, 2020

    @jan-kiszka
    ContributorAuthor

    I think we are only a few kernel releases away from proper upstream support for the RPi 4. Then major distro kernels will start to work as well, and distros do not ask why you want KVM. They carry this as default feature for full system virtualization, container isolation, etc.

  10. pelwell commented on Feb 6, 2020

    @pelwell
    Contributor

    #3456 is a first attempt at a KVM configuration for a 64-bit Pi 4 kernel.

  11. pelwell commented on Feb 27, 2020

    @pelwell
    Contributor

    Did anybody get round to trying my patch (#3456) to enable KVM in the Pi 4 64-bit kernel?

  12. 26 remaining items

  13. adminy commented on May 19, 2026

    @adminy

    Even the pi 5 seems to have KVM_DEV_TYPE_ARM_VGIC_V3 not set.

    Having GICv3 disabled on host machine, means that tools like cloud hypervisor project can't be run.

  14. pelwell commented on May 19, 2026

    @pelwell
    Contributor

    Both 2711 and 2712 have GIC-400s, which are V2 GICs. If this cloud hypervisor needs V3 features then it won't run on Pi 4 and Pi 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions