All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kubascik <jeff.kubascik@dornerworks.com>
To: Julien Grall <julien@xen.org>, <xen-devel@lists.xenproject.org>
Cc: Stewart Hildebrand <Stewart.Hildebrand@dornerworks.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [Xen-devel] [PATCH v3 2/2] xen/arm: sign extend writes to TimerValue
Date: Tue, 21 Jan 2020 09:43:45 -0500	[thread overview]
Message-ID: <57d150ea-4716-e155-b969-5d3256e5c4c7@dornerworks.com> (raw)
In-Reply-To: <de5f1e38-19b8-a274-371a-4d0cdbfef869@xen.org>

On 1/18/2020 6:49 AM, Julien Grall wrote:
> On 17/01/2020 21:29, Jeff Kubascik wrote:
>> On 12/18/2019 9:24 AM, Julien Grall wrote:
>>> Hi Jeff,
>>>
>>> On 11/12/2019 21:13, Jeff Kubascik wrote:
>>>> Per the ARMv8 Reference Manual (ARM DDI 0487E.a), section D11.2.4
>>>> specifies that the values in the TimerValue view of the timers are
>>>> signed in standard two's complement form. When writing to the TimerValue
>>>
>>> Do you mean CompareValue register instead of TimerValue register?
>>
>> I'm fairly certain TimerValue register is correct. When the guest writes to the
>> TimerValue register, the equation below is used to convert it to a CompareValue
>> equivalent.
> 
> I find the sentence quite confusing to read. It is not the write that
> needs to be signed extend, but the value used to compute CompareValue.
> So how about the following commit message:
> 
> "
> xen/arm: Sign extend TimerValue when computing the CompareValue
> 
> Xen will only store the CompareValue as it can be derived from the
> TimerValue (ARM DDI 0487E.a section D11.2.4):
> 
>   CompareValue = (Counter[63:0] + SignExtend(TimerValue))[63:0]
> 
> While the TimerValue is a 32-bit signed value, our implementation
> assumed it is a 32-bit unsigned value.
> "

I agree with this version, it is clearer and and simpler.

>>
>>>> register, it should be signed extended as described by the equation
>>>>
>>>>      CompareValue = (Counter[63:0] + SignExtend(TimerValue))[63:0]
>>> This explains the signed part, but it does not explain why the 32-bit
>>> case. So I would mention that TimerValue is a 32-bit signed integer.
>>>
>>> Maybe saying "are 32-bit signed in standard ..."
>>
>> I pulled this equation directly from the ARMv8 Reference Manual - the manual
>> goes into detail about the sign extension. This is referenced earlier in the
>> commit message.
> 
> While I agree the commit message explain in details the sign extension,
> there is nothing in your commit message about the size of TimerValue
> (i.e 32-bit). If you say it is a 32-bit signed value, then it is much
> clearer to understand the cast you added below.
> 
> But please see above for a suggested commit message.

I'll send out an updated patch set with the new commit message.

> Cheers,
> 
> --
> Julien Grall
> 

Sincerely,
Jeff Kubascik

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-01-21 14:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 21:13 [Xen-devel] [PATCH v3 0/2] xen/arm: physical timer improvements Jeff Kubascik
2019-12-11 21:13 ` [Xen-devel] [PATCH v3 1/2] xen/arm: remove physical timer offset Jeff Kubascik
2019-12-18 14:20   ` Julien Grall
2020-01-17 21:24     ` Jeff Kubascik
2020-01-23 12:28       ` Julien Grall
2019-12-11 21:13 ` [Xen-devel] [PATCH v3 2/2] xen/arm: sign extend writes to TimerValue Jeff Kubascik
2019-12-18 14:24   ` Julien Grall
2020-01-17 21:29     ` Jeff Kubascik
2020-01-18 11:49       ` Julien Grall
2020-01-21 14:43         ` Jeff Kubascik [this message]
2020-01-16 21:25 ` [Xen-devel] [PATCH v3 0/2] xen/arm: physical timer improvements Julien Grall
2020-01-16 21:52   ` Jeff Kubascik

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=57d150ea-4716-e155-b969-5d3256e5c4c7@dornerworks.com \
    --to=jeff.kubascik@dornerworks.com \
    --cc=Stewart.Hildebrand@dornerworks.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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.