KVM: arm64: selftests: Handle feature fields with nonzero minimum value correctly
authorJing Zhang <jingzhangos@google.com>
Mon, 15 Jan 2024 22:02:09 +0000 (14:02 -0800)
committerOliver Upton <oliver.upton@linux.dev>
Wed, 24 Jan 2024 20:52:12 +0000 (20:52 +0000)
commit1cd2b08f7cc4a57cc1b04f62b6349970d13456c3
tree40a19163a608149cab5f1605e7a166212e4b8eca
parent6613476e225e090cc9aad49be7fa504e290dd33d
KVM: arm64: selftests: Handle feature fields with nonzero minimum value correctly

There are some feature fields with nonzero minimum valid value. Make
sure get_safe_value() won't return invalid field values for them.
Also fix a bug that wrongly uses the feature bits type as the feature
bits sign causing all fields as signed in the get_safe_value() and
get_invalid_value().

Fixes: 54a9ea73527d ("KVM: arm64: selftests: Test for setting ID register from usersapce")
Reported-by: Zenghui Yu <yuzenghui@huawei.com>
Reported-by: Itaru Kitayama <itaru.kitayama@linux.dev>
Tested-by: Itaru Kitayama <itaru.kitayama@fujitsu.com>
Signed-off-by: Jing Zhang <jingzhangos@google.com>
Link: https://lore.kernel.org/r/20240115220210.3966064-2-jingzhangos@google.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
tools/testing/selftests/kvm/aarch64/set_id_regs.c