Oliver Upton
4641c7ea88
KVM: arm64: selftests: Cope with lack of GICv3 in set_id_regs
...
Broonie reports that the set_id_regs test is failing as of commit
5cb57a1aff ("KVM: arm64: Zero ID_AA64PFR0_EL1.GIC when no GICv3 is
presented to the guest"). The test does not anticipate the 'late' ID
register fixup where KVM clobbers the GIC field in absence of GICv3.
While the field technically has FTR_LOWER_SAFE behavior, fix the issue
by setting it to an exact value of 0, matching the effect of the 'late'
fixup.
Reported-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
Link: https://lore.kernel.org/r/20240829004622.3058639-1-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org >
2024-08-29 08:34:03 +01:00
Oliver Upton
b0539664cb
KVM: selftests: Assert that MPIDR_EL1 is unchanged across vCPU reset
...
commit 606af8293c ("KVM: selftests: arm64: Test vCPU-scoped feature ID
registers") intended to test that MPIDR_EL1 is unchanged across vCPU
reset but failed at actually doing so.
Add the missing assertion.
Link: https://lore.kernel.org/r/20240621225045.2472090-1-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
2024-06-22 17:22:14 +00:00
Sebastian Ott
11a31be88f
KVM: selftests: arm64: Test writes to CTR_EL0
...
Test that CTR_EL0 is modifiable from userspace, that changes are
visible to guests, and that they are preserved across a vCPU reset.
Signed-off-by: Sebastian Ott <sebott@redhat.com >
Reviewed-by: Eric Auger <eric.auger@redhat.com >
Link: https://lore.kernel.org/r/20240619174036.483943-11-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
2024-06-20 17:16:45 +00:00
Oliver Upton
606af8293c
KVM: selftests: arm64: Test vCPU-scoped feature ID registers
...
Test that CLIDR_EL1 and MPIDR_EL1 are modifiable from userspace and that
the values are preserved across a vCPU reset like the other feature ID
registers.
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
Link: https://lore.kernel.org/r/20240502233529.1958459-8-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org >
2024-05-09 18:42:03 +01:00
Oliver Upton
07eabd8a52
KVM: selftests: arm64: Test that feature ID regs survive a reset
...
One of the expectations with feature ID registers is that their values
survive a vCPU reset. Start testing that.
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
Link: https://lore.kernel.org/r/20240502233529.1958459-7-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org >
2024-05-09 18:41:56 +01:00
Oliver Upton
46247a317f
KVM: selftests: arm64: Store expected register value in set_id_regs
...
Rather than comparing against what is returned by the ioctl, store
expected values for the feature ID registers in a table and compare with
that instead.
This will prove useful for subsequent tests involving vCPU reset.
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
Link: https://lore.kernel.org/r/20240502233529.1958459-6-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org >
2024-05-09 18:41:50 +01:00
Oliver Upton
41ee9b33e9
KVM: selftests: arm64: Rename helper in set_id_regs to imply VM scope
...
Prepare for a later change that'll cram in per-vCPU feature ID test
cases by renaming the current test case.
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
Link: https://lore.kernel.org/r/20240502233529.1958459-5-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org >
2024-05-09 18:41:30 +01:00
Jing Zhang
1cd2b08f7c
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: 54a9ea7352 ("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 >
2024-01-24 20:52:12 +00:00
Jing Zhang
54a9ea7352
KVM: arm64: selftests: Test for setting ID register from usersapce
...
Add tests to verify setting ID registers from userspace is handled
correctly by KVM. Also add a test case to use ioctl
KVM_ARM_GET_REG_WRITABLE_MASKS to get writable masks.
Signed-off-by: Jing Zhang <jingzhangos@google.com >
Acked-by: Marc Zyngier <maz@kernel.org >
Link: https://lore.kernel.org/r/20231011195740.3349631-6-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev >
2023-10-18 23:37:33 +00:00