From: Oliver Upton <oupton@google.com>
To: Ricardo Koller <ricarkol@google.com>
Cc: kvm@vger.kernel.org, maz@kernel.org, pbonzini@redhat.com,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 1/3] KVM: arm64: selftests: add timer_get_tval() lib function
Date: Wed, 2 Mar 2022 19:55:26 +0000 [thread overview]
Message-ID: <Yh/LrphX9no9FRzR@google.com> (raw)
In-Reply-To: <20220302172144.2734258-2-ricarkol@google.com>
On Wed, Mar 02, 2022 at 09:21:42AM -0800, Ricardo Koller wrote:
> Add timer_get_tval() into the arch timer library functions in
> selftests/kvm. Bonus: change the set_tval function to get an int32_t
> (tval is signed).
>
> Reviewed-by: Reiji Watanabe <reijiw@google.com>
> Signed-off-by: Ricardo Koller <ricarkol@google.com>
Reviewed-by: Oliver Upton <oupton@google.com>
> ---
> .../selftests/kvm/include/aarch64/arch_timer.h | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/include/aarch64/arch_timer.h b/tools/testing/selftests/kvm/include/aarch64/arch_timer.h
> index cb7c03de3a21..93f35a4fc1aa 100644
> --- a/tools/testing/selftests/kvm/include/aarch64/arch_timer.h
> +++ b/tools/testing/selftests/kvm/include/aarch64/arch_timer.h
> @@ -79,7 +79,7 @@ static inline uint64_t timer_get_cval(enum arch_timer timer)
> return 0;
> }
>
> -static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
> +static inline void timer_set_tval(enum arch_timer timer, int32_t tval)
> {
> switch (timer) {
> case VIRTUAL:
> @@ -95,6 +95,22 @@ static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
> isb();
> }
>
> +static inline int32_t timer_get_tval(enum arch_timer timer)
> +{
> + isb();
> + switch (timer) {
> + case VIRTUAL:
> + return (int32_t)read_sysreg(cntv_tval_el0);
> + case PHYSICAL:
> + return (int32_t)read_sysreg(cntp_tval_el0);
> + default:
> + GUEST_ASSERT_1(0, timer);
> + }
> +
> + /* We should not reach here */
> + return 0;
> +}
> +
> static inline void timer_set_ctl(enum arch_timer timer, uint32_t ctl)
> {
> switch (timer) {
> --
> 2.35.1.574.g5d30c73bfb-goog
>
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
WARNING: multiple messages have this Message-ID (diff)
From: Oliver Upton <oupton@google.com>
To: Ricardo Koller <ricarkol@google.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
drjones@redhat.com, pbonzini@redhat.com, maz@kernel.org,
alexandru.elisei@arm.com, eric.auger@redhat.com,
reijiw@google.com, rananta@google.com
Subject: Re: [PATCH 1/3] KVM: arm64: selftests: add timer_get_tval() lib function
Date: Wed, 2 Mar 2022 19:55:26 +0000 [thread overview]
Message-ID: <Yh/LrphX9no9FRzR@google.com> (raw)
In-Reply-To: <20220302172144.2734258-2-ricarkol@google.com>
On Wed, Mar 02, 2022 at 09:21:42AM -0800, Ricardo Koller wrote:
> Add timer_get_tval() into the arch timer library functions in
> selftests/kvm. Bonus: change the set_tval function to get an int32_t
> (tval is signed).
>
> Reviewed-by: Reiji Watanabe <reijiw@google.com>
> Signed-off-by: Ricardo Koller <ricarkol@google.com>
Reviewed-by: Oliver Upton <oupton@google.com>
> ---
> .../selftests/kvm/include/aarch64/arch_timer.h | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/include/aarch64/arch_timer.h b/tools/testing/selftests/kvm/include/aarch64/arch_timer.h
> index cb7c03de3a21..93f35a4fc1aa 100644
> --- a/tools/testing/selftests/kvm/include/aarch64/arch_timer.h
> +++ b/tools/testing/selftests/kvm/include/aarch64/arch_timer.h
> @@ -79,7 +79,7 @@ static inline uint64_t timer_get_cval(enum arch_timer timer)
> return 0;
> }
>
> -static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
> +static inline void timer_set_tval(enum arch_timer timer, int32_t tval)
> {
> switch (timer) {
> case VIRTUAL:
> @@ -95,6 +95,22 @@ static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
> isb();
> }
>
> +static inline int32_t timer_get_tval(enum arch_timer timer)
> +{
> + isb();
> + switch (timer) {
> + case VIRTUAL:
> + return (int32_t)read_sysreg(cntv_tval_el0);
> + case PHYSICAL:
> + return (int32_t)read_sysreg(cntp_tval_el0);
> + default:
> + GUEST_ASSERT_1(0, timer);
> + }
> +
> + /* We should not reach here */
> + return 0;
> +}
> +
> static inline void timer_set_ctl(enum arch_timer timer, uint32_t ctl)
> {
> switch (timer) {
> --
> 2.35.1.574.g5d30c73bfb-goog
>
next prev parent reply other threads:[~2022-03-02 19:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 17:21 [PATCH 0/3] KVM: arm64: selftests: Add edge cases tests for the arch timer Ricardo Koller
2022-03-02 17:21 ` Ricardo Koller
2022-03-02 17:21 ` [PATCH 1/3] KVM: arm64: selftests: add timer_get_tval() lib function Ricardo Koller
2022-03-02 17:21 ` Ricardo Koller
2022-03-02 19:55 ` Oliver Upton [this message]
2022-03-02 19:55 ` Oliver Upton
2022-03-02 17:21 ` [PATCH 2/3] KVM: arm64: selftests: add arch_timer_edge_cases Ricardo Koller
2022-03-02 17:21 ` Ricardo Koller
2022-03-02 20:45 ` Oliver Upton
2022-03-02 20:45 ` Oliver Upton
2022-03-02 21:25 ` Ricardo Koller
2022-03-02 21:25 ` Ricardo Koller
2022-03-04 7:52 ` Marc Zyngier
2022-03-04 7:52 ` Marc Zyngier
2022-03-04 19:01 ` Ricardo Koller
2022-03-04 19:01 ` Ricardo Koller
2022-03-02 17:21 ` [PATCH 3/3] KVM: arm64: selftests: add edge cases tests into arch_timer_edge_cases Ricardo Koller
2022-03-02 17:21 ` Ricardo Koller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yh/LrphX9no9FRzR@google.com \
--to=oupton@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=ricarkol@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.