Commit 511ad531 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

s390/hwcaps: shorten HWCAP defines



Remove s390 part of all HWCAP defines, just to make them shorter and
easier to handle. The namespace is anyway per architecture.
This is similar to what arm64 has.

Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 7e8403ec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#define MAX_ELF_HWCAP_FEATURES	(8 * sizeof(elf_hwcap))
#define MAX_CPU_FEATURES	MAX_ELF_HWCAP_FEATURES

#define cpu_feature(feat)	ilog2(HWCAP_S390_ ## feat)
#define cpu_feature(feat)	ilog2(HWCAP_ ## feat)

int cpu_have_feature(unsigned int nr);

+22 −22
Original line number Diff line number Diff line
@@ -92,28 +92,28 @@
#define R_390_NUM	61

/* Bits present in AT_HWCAP. */
#define HWCAP_S390_ESAN3	1
#define HWCAP_S390_ZARCH	2
#define HWCAP_S390_STFLE	4
#define HWCAP_S390_MSA		8
#define HWCAP_S390_LDISP	16
#define HWCAP_S390_EIMM		32
#define HWCAP_S390_DFP		64
#define HWCAP_S390_HPAGE	128
#define HWCAP_S390_ETF3EH	256
#define HWCAP_S390_HIGH_GPRS	512
#define HWCAP_S390_TE		1024
#define HWCAP_S390_VXRS		2048
#define HWCAP_S390_VXRS_BCD	4096
#define HWCAP_S390_VXRS_EXT	8192
#define HWCAP_S390_GS		16384
#define HWCAP_S390_VXRS_EXT2	32768
#define HWCAP_S390_VXRS_PDE	65536
#define HWCAP_S390_SORT		131072
#define HWCAP_S390_DFLT		262144
#define HWCAP_S390_VXRS_PDE2	524288
#define HWCAP_S390_NNPA		1048576
#define HWCAP_S390_PCI_MIO	2097152
#define HWCAP_ESAN3	1
#define HWCAP_ZARCH	2
#define HWCAP_STFLE	4
#define HWCAP_MSA	8
#define HWCAP_LDISP	16
#define HWCAP_EIMM	32
#define HWCAP_DFP	64
#define HWCAP_HPAGE	128
#define HWCAP_ETF3EH	256
#define HWCAP_HIGH_GPRS	512
#define HWCAP_TE	1024
#define HWCAP_VXRS	2048
#define HWCAP_VXRS_BCD	4096
#define HWCAP_VXRS_EXT	8192
#define HWCAP_GS	16384
#define HWCAP_VXRS_EXT2	32768
#define HWCAP_VXRS_PDE	65536
#define HWCAP_SORT	131072
#define HWCAP_DFLT	262144
#define HWCAP_VXRS_PDE2	524288
#define HWCAP_NNPA	1048576
#define HWCAP_PCI_MIO	2097152

/* Internal bits, not exposed via elf */
#define HWCAP_INT_SIE		1UL
+26 −26
Original line number Diff line number Diff line
@@ -888,17 +888,17 @@ static int __init setup_hwcaps(void)
	 *   Bit 22: extended-translation facility 3 is installed
	 *   Bit 30: extended-translation facility 3 enhancement facility
	 * These get translated to:
	 *   HWCAP_S390_ESAN3 bit 0, HWCAP_S390_ZARCH bit 1,
	 *   HWCAP_S390_STFLE bit 2, HWCAP_S390_MSA bit 3,
	 *   HWCAP_S390_LDISP bit 4, HWCAP_S390_EIMM bit 5 and
	 *   HWCAP_S390_ETF3EH bit 8 (22 && 30).
	 *   HWCAP_ESAN3 bit 0, HWCAP_ZARCH bit 1,
	 *   HWCAP_STFLE bit 2, HWCAP_MSA bit 3,
	 *   HWCAP_LDISP bit 4, HWCAP_EIMM bit 5 and
	 *   HWCAP_ETF3EH bit 8 (22 && 30).
	 */
	for (i = 0; i < 6; i++)
		if (test_facility(stfl_bits[i]))
			elf_hwcap |= 1UL << i;

	if (test_facility(22) && test_facility(30))
		elf_hwcap |= HWCAP_S390_ETF3EH;
		elf_hwcap |= HWCAP_ETF3EH;

	/*
	 * Check for additional facilities with store-facility-list-extended.
@@ -911,61 +911,61 @@ static int __init setup_hwcaps(void)
	 *   Bit 42: decimal floating point facility is installed
	 *   Bit 44: perform floating point operation facility is installed
	 * translated to:
	 *   HWCAP_S390_DFP bit 6 (42 && 44).
	 *   HWCAP_DFP bit 6 (42 && 44).
	 */
	if ((elf_hwcap & (1UL << 2)) && test_facility(42) && test_facility(44))
		elf_hwcap |= HWCAP_S390_DFP;
		elf_hwcap |= HWCAP_DFP;

	/*
	 * Huge page support HWCAP_S390_HPAGE is bit 7.
	 * Huge page support HWCAP_HPAGE is bit 7.
	 */
	if (MACHINE_HAS_EDAT1)
		elf_hwcap |= HWCAP_S390_HPAGE;
		elf_hwcap |= HWCAP_HPAGE;

	/*
	 * 64-bit register support for 31-bit processes
	 * HWCAP_S390_HIGH_GPRS is bit 9.
	 * HWCAP_HIGH_GPRS is bit 9.
	 */
	elf_hwcap |= HWCAP_S390_HIGH_GPRS;
	elf_hwcap |= HWCAP_HIGH_GPRS;

	/*
	 * Transactional execution support HWCAP_S390_TE is bit 10.
	 * Transactional execution support HWCAP_TE is bit 10.
	 */
	if (MACHINE_HAS_TE)
		elf_hwcap |= HWCAP_S390_TE;
		elf_hwcap |= HWCAP_TE;

	/*
	 * Vector extension HWCAP_S390_VXRS is bit 11. The Vector extension
	 * Vector extension HWCAP_VXRS is bit 11. The Vector extension
	 * can be disabled with the "novx" parameter. Use MACHINE_HAS_VX
	 * instead of facility bit 129.
	 */
	if (MACHINE_HAS_VX) {
		elf_hwcap |= HWCAP_S390_VXRS;
		elf_hwcap |= HWCAP_VXRS;
		if (test_facility(134))
			elf_hwcap |= HWCAP_S390_VXRS_BCD;
			elf_hwcap |= HWCAP_VXRS_BCD;
		if (test_facility(135))
			elf_hwcap |= HWCAP_S390_VXRS_EXT;
			elf_hwcap |= HWCAP_VXRS_EXT;
		if (test_facility(148))
			elf_hwcap |= HWCAP_S390_VXRS_EXT2;
			elf_hwcap |= HWCAP_VXRS_EXT2;
		if (test_facility(152))
			elf_hwcap |= HWCAP_S390_VXRS_PDE;
			elf_hwcap |= HWCAP_VXRS_PDE;
		if (test_facility(192))
			elf_hwcap |= HWCAP_S390_VXRS_PDE2;
			elf_hwcap |= HWCAP_VXRS_PDE2;
	}
	if (test_facility(150))
		elf_hwcap |= HWCAP_S390_SORT;
		elf_hwcap |= HWCAP_SORT;
	if (test_facility(151))
		elf_hwcap |= HWCAP_S390_DFLT;
		elf_hwcap |= HWCAP_DFLT;
	if (test_facility(165))
		elf_hwcap |= HWCAP_S390_NNPA;
		elf_hwcap |= HWCAP_NNPA;

	/*
	 * Guarded storage support HWCAP_S390_GS is bit 12.
	 * Guarded storage support HWCAP_GS is bit 12.
	 */
	if (MACHINE_HAS_GS)
		elf_hwcap |= HWCAP_S390_GS;
		elf_hwcap |= HWCAP_GS;
	if (MACHINE_HAS_PCI_MIO)
		elf_hwcap |= HWCAP_S390_PCI_MIO;
		elf_hwcap |= HWCAP_PCI_MIO;

	get_cpu_id(&cpu_id);
	add_device_randomness(&cpu_id, sizeof(cpu_id));