heap.ovh

embedded adventures

Running Gentoo on HP t520, part 1

HP t520 is a thin client released by HP in 2014. It can be had on the secondary market for under 50 EUR. Originally running Windows 8.1 embedded, I decided to install Gentoo on it. In part 1, we will take a look at the hardware and its support in the Linux kernel, part 2 will be about choices involved in setting up Gentoo on a fairly underpowered system.

Hardware

The device includes:

  • GX-212JC AMD APU
  • SODIMM DDR3 slot (runs at PC3-10600)
  • mini PCI-E slot for a WLAN module
  • M.2 slot wired for SATA
  • Realtek ALC221 audio
  • Realtek gigabit ethernet (RTL8111G or derivative)
  • 2x DisplayPort, 1x VGA, 2x USB 3.0, 4x USB 2.0, audio line in and out
  • UEFI BIOS by AMI

APU

GX-212JC is in fact the same SoC as used in AMD 'Mullins' E1 Micro APU originally designed by AMD as a short lived foray into x86 tablet solutions. The APU combines two Puma cores with a GCN 2.0-based integrated GPU.

Of note, the CPU cores (based on Jaguar architecture) support AVX and AES extensions. Full CPU flags include:

:::
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush 
                  mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc 
                  rep_good acc_power nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq 
                  monitor ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm 
                  cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs 
                  skinit wdt topoext perfctr_nb bpext ptsc perfctr_llc cpb hw_pstate ssbd ibpb 
                  vmmcall bmi1 xsaveopt arat npt lbrv svm_lock nrip_save tsc_scale flushbyasid 
                  decodeassists pausefilter pfthreshold overflow_recov

As the device is passively cooled, to keep within the thermal limits the CPU cores run at relatively slow 1.4GHz at load and stay at 800MHz when idle under the control of the cpufreq driver. There is a driver called amd_freq_sensitivity (enabled with CONFIG_X86_AMD_FREQ_SENSITIVITY) which is supposed to help the cpufreq governor decide if a workload is memory or cpu-bound but the driver would not load on my system ('No device found').

The AMD processors are vulnerable to some variants of Spectre. I wanted to update the microcode by embedding it in CONFIG_EXTRA_FIRMWARE as described in the gentoo wiki but it would not work. Since I was not interested in using initrd I simply opted to update the BIOS which patched microcode to version 0x7030106.

Interestingly, the CPU embeds a Cortex A5 ARM processor as a 'hardware security platform' device. Some of its crypto acceleration capabilities are exposed with ccp-crypto kernel module including rsa, sha1, sha224, sha256 and aes. AES is of little interest, as the aes-ni extension of the main processor is much faster, but the rest is worth checking out (although I don't know how to benchmark RSA on kernel side).

SHA-256 generic vs AVX vs CCP

Unfortunately, real benefits can be only seen for relatively large blocks, as is often the case with crypto accelerators.

The aes-ni accelerated code performs much better:

AES-GCM CCP vs AES-NI

There are also some sensor drivers available. SENSORS_K10TEMP enables a temperature sensor and SENSORS_FAM15H_POWER enables a processor power sensor. Both can be then accessed with lm-sensors.

:::
fam15h_power-pci-00c4
Adapter: PCI adapter
power1:        1.23 W  (interval =   0.01 s, crit =   5.99 W)

k10temp-pci-00c3
Adapter: PCI adapter
temp1:        +53.0°C  (high = +70.0°C)
                       (crit = +105.0°C, hyst = +104.0°C)

Passive cooling is adequate with the device reaching about 75C in extended load.

The GPU consists of 128 shading processors clocked at a low 300MHz. It is supported by two kernel drivers: the fairly mature radeon driver and the continuously developed amdgpu. I will be using the latter. To build the kernel driver the following options are necessary:

:::
CONFIG_DRM_AMDGPU=y
CONFIG_DRM_AMDGPU_CIK=y
CONFIG_DRM_AMD_DC=y
CONFIG_DRM_AMD_DC_DCN1_0=y
CONFIG_EXTRA_FIRMWARE="amdgpu/mullins_ce.bin amdgpu/mullins_me.bin amdgpu/mullins_mec.bin amdgpu/mullins_pfp.bin amdgpu/mullins_rlc.bin amdgpu/mullins_sdma1.bin amdgpu/mullins_sdma.bin amdgpu/mullins_uvd.bin amdgpu/mullins_vce.bin"

The amdgpu driver supports both vaapi and vdpau video decode accelerators which will be handy in part 2. It also exposes a thermal sensor which seems to be consistent with k10temp readings.

Network

I don't intend to use wireless so that entire branch of kernel options is disabled. For the gigabit ethernet to work only those are necessary:

:::
CONFIG_ETHERNET=y
CONFIG_NET_VENDOR_REALTEK=y
CONFIG_R8169=y

Not much more to it.

:::
mii-tool -v enp1s0
enp1s0: negotiated 1000baseT-FD flow-control, link ok

Audio

The ALC221 audio chip is supported by snd_hda_codec_realtek and snd_hda_intel drivers enabled with CONFIG_SND_HDA_CODEC_REALTEK=y and CONFIG_SND_HDA_INTEL=y

BIOS

UEFI BIOS by American Megatrends is installed. To talk to it and use it as a bootloader I enabled some EFI-related options in the kernel config (more in part 2)

:::
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_EFI_VARS=y
CONFIG_EFI_PARTITION=y

Final thoughts

HP t520 is well supported under current Linux (4.19 as of writing this post). Full kernel config and dmesg output is also available.