Huawei ExaGear: x86_64 apps on Arm64

Note: This post is only kept up for historical reasons. The current ExaGear EULA doesn’t allow using ExaGear outside of Huawei Kunpeng processors.

ExaGear is a dynamic binary translation layer to run x86_32 and x86_64 applications on Arm 64-bit Linux systems.

You can download it here. On an RPM-based distribution, just unpack the archive and install.

A CentOS 7 rootfs is shipped, you might want to install vte-profile afterwards.

Hardware requirements

A 64-bit Arm CPU with floating point and SIMD extensions. If it can run a conventional Linux distribution, it’ll be able to run this.

Kernel requirements

You’ll have to install the p64k variant for systems with a 64KB page size set up (which ships with the x86_64 -> arm64 translator only, not the x86_32 to arm64 one). Some applications might not work on such a system.

You’ll also need a kernel with 48-bit VA space, 39-bit of VA space kernel configurations are not compatible with ExaGear.

Memory model

ExaGear does not follow TSO completely by default, using heuristics instead. This can be configured through /etc/exagear-x86_64.conf.

SMO_MODE=fbase is the default, with SMO_SEVERITY=smart. For full compliance, you can run those commands:

sudo sed -i -e '/EXAGEAR_SMO_MODE="/s/fbase"/all"/' /etc/exagear-x86_32.conf
sudo sed -i -e '/EXAGEAR_SMO_MODE="/s/fbase"/all"/' /etc/exagear-x86_64.conf

On Tegra K1 64-bit and Tegra Xavier, you’ll want to set SMO_MODE=none, as their CPU implements sequential consistency as the memory model. This setting provides a free performance boost with no downsides on that hardware.

Performance

For running your Docker containers or whatever on an Apple Silicon Mac too, this is a much faster solution than qemu-user.

Some performance numbers on Tegra Xavier: https://browser.geekbench.com/v5/cpu/compare/4206324?baseline=4206183. (Geekbench arm64 Android compared to x86_64 Linux Geekbench results on the same hardware)

Because ExaGear doesn’t implement the AES instructions, the scores for those is an outlier. Apart from that case, the results are pretty good.

2 comments

  1. Thank you very much for writing this interesting article. It is good to know that Huawei continued to enhance the emulator and added 64 Bit support after Eltechs stopped working on ExaGear, although it would have been great for Huawei to at least mention Eltechs somewhere in their documentation.
    The benchmarks also seem to be promising, I guess that some more complex x86 games could also run with this on more powerful ARM platforms like the Jetson Xavier (if some kind of GPU forwarding is possible).

    I have also been trying to get ExaGear to work on my Jetson Xavier NX but until now I didn’t succeed in doing so. ExaGear segfaults on the Xavier and I think that it is related to the kernel shipping with the VA space set to 39 bits. I tried to recompile the kernel with 48 bits of VA space but I can’t get it to compile successfully as soon as I add the flag to the tegra_defconfig file.
    Could you please make a tutorial on how to perform this kernel modification or briefly explain how you got it to work on your AGX Xavier?

    1. Hello,

      Yep it’s related to VA space being 39 bits.

      Use the kernel trees from OE4T, I’ll probably do a blog post on that later,
      as it’s needed for running arm64 Windows VMs on that hardware anyway.

Leave a comment

Your email address will not be published. Required fields are marked *