diff mbox series

[5/9] KVM: arm64: selftests: Have debug_version() use cpuid_get_ufield() helper

Message ID 20220825050846.3418868-6-reijiw@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: arm64: selftests: Test linked {break,watch}points | expand

Commit Message

Reiji Watanabe Aug. 25, 2022, 5:08 a.m. UTC
Change debug_version() to use cpuid_get_ufield() to extract DebugVer
field from the AA64DFR0_EL1 register value.

Signed-off-by: Reiji Watanabe <reijiw@google.com>
---
 tools/testing/selftests/kvm/aarch64/debug-exceptions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Oliver Upton Aug. 25, 2022, 5:29 p.m. UTC | #1
On Wed, Aug 24, 2022 at 10:08:42PM -0700, Reiji Watanabe wrote:
> Change debug_version() to use cpuid_get_ufield() to extract DebugVer
> field from the AA64DFR0_EL1 register value.

Either squash this into the patch that adds the field accessors or
reorder it to immediately follow said patch.

aarch64_get_supported_page_sizes() is also due for a cleanup, as it
accesses the TGRANx fields of ID_AA64MMFR0_EL1.

--
Thanks,
Oliver
Reiji Watanabe Aug. 26, 2022, 12:59 a.m. UTC | #2
On Thu, Aug 25, 2022 at 10:29 AM Oliver Upton <oliver.upton@linux.dev> wrote:
>
> On Wed, Aug 24, 2022 at 10:08:42PM -0700, Reiji Watanabe wrote:
> > Change debug_version() to use cpuid_get_ufield() to extract DebugVer
> > field from the AA64DFR0_EL1 register value.
>
> Either squash this into the patch that adds the field accessors or
> reorder it to immediately follow said patch.
>
> aarch64_get_supported_page_sizes() is also due for a cleanup, as it
> accesses the TGRANx fields of ID_AA64MMFR0_EL1.

Sure, I will fix them.

Thank you,
Reiji
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
index 713c7240b680..17b17359ac41 100644
--- a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
+++ b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
@@ -320,7 +320,7 @@  static int debug_version(struct kvm_vcpu *vcpu)
 	uint64_t id_aa64dfr0;
 
 	vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1), &id_aa64dfr0);
-	return id_aa64dfr0 & 0xf;
+	return cpuid_get_ufield(id_aa64dfr0, ID_AA64DFR0_DEBUGVER_SHIFT);
 }
 
 int main(int argc, char *argv[])