Skip to contentSkip to conversation

Expand available hwcap bits with AT_HWCAP2 in auxv

RFC Ryan Arnold 1 participant 1 message Nov 16, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

We're out of bits in the AT_HWCAP entry for PowerPC. Per the following discussion on libc-alpha, I'd like to propose the expansion of the auxv to make additional space available for further system feature flags.

http://www.sourceware.org/ml/libc-alpha/2012-10/msg00438.html

There are a few ways to do this (as pointed out by Ben Herrenschmidt). glibc would prefer to parse an AT_HWCAP2 entry from the auxv and compose those bits into the high 32-bits of the existing glibc uint64_t hwcap field.

Currently, the high 32-bits of this field are only available in 64-bit userspace, and only for platforms where the kernel designates the auxv hwcap as unsigned long int (example: s390). Platforms like PowerPC, arm, and x86 maintain parity between 64-bit and 32-bit userspace and thus only allow 32-bits for capabilities.

I propose that the kernel shift capabilities designated in the high 32-bits into an AT_HWCAP2 auxv entry. In userspace, glibc will compose that into the available high 32-bits of glibc's hwcap field making the rest of it available to all platforms.

The beauty of this approach is that if either the Kernel or glibc lack the AT_HWCAP2 improvement the high 32-bits of glibc's hwcap field will remain empty, i.e., feature not available.

With this in mind, I need to reserve an identifier in include/linux/auxvec.h for AT_HWCAP2. I was thinking:

#define AT_HWCAP 26

GLIBC will have parity with this identifier in elf/elf.h.

I think Ben H. had planned to work on the kernel side of this and I have a GLIBC patch in process.

Comments?

Ryan S. Arnold
IBM Linux Technology Center
glibc PowerPC maintainer