util_arch: Fix max HSA size for Z16 machine

The machine types are not strictly increasing anymore since Z16, therefore,
we cannot use numerical comparison to find out the correct HSA size
of a machine.

Fixes: 2515832469 ("util_arch: Add IBM z16 as known machine")
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Alexander Egorenkov
2022-09-20 07:21:12 +02:00
committed by Jan Höppner
parent f961a2bf90
commit 7d855acd07

View File

@@ -107,13 +107,12 @@ const char *util_arch_machine_type_to_str(int type)
*/
unsigned long util_arch_hsa_maxsize(void)
{
unsigned long size = HSA_SIZE_32M;
int type;
type = util_arch_machine_type();
if (type != UTIL_ARCH_MACHINE_TYPE_UNKNOWN &&
type >= UTIL_ARCH_MACHINE_TYPE_Z15)
size = HSA_SIZE_512M;
return size;
switch (util_arch_machine_type()) {
case UTIL_ARCH_MACHINE_TYPE_Z15:
case UTIL_ARCH_MACHINE_TYPE_Z15_T02:
case UTIL_ARCH_MACHINE_TYPE_Z16:
return HSA_SIZE_512M;
default:
return HSA_SIZE_32M;
}
}