All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Grzegorz Uriasz <gorbak25@gmail.com>
Cc: "Wei Liu" <wl@xen.org>, "Paul Durrant" <paul@xen.org>,
	jakub@bartmin.ski, "Andrew Cooper" <andrew.cooper3@citrix.com>,
	marmarek@invisiblethingslab.com, j.nowak26@student.uw.edu.pl,
	xen-devel@lists.xenproject.org, contact@puzio.waw.pl,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v3 1/1] x86/acpi: Use FADT flags to determine the PMTMR width
Date: Mon, 22 Jun 2020 10:49:04 +0200	[thread overview]
Message-ID: <5993e716-d71d-cbc0-a186-5325e2bdeba4@suse.com> (raw)
In-Reply-To: <de0e33d2be0924e66a220678a7683098df70c2b5.1592603468.git.gorbak25@gmail.com>

On 20.06.2020 00:00, Grzegorz Uriasz wrote:
> @@ -490,8 +497,12 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
>   	 */
>  	if (!pmtmr_ioport) {
>  		pmtmr_ioport = fadt->pm_timer_block;
> -		pmtmr_width = fadt->pm_timer_length == 4 ? 24 : 0;
> +		pmtmr_width = fadt->pm_timer_length == 4 ? 32 : 0;
>  	}
> +	if (pmtmr_width < 32 && fadt->flags & ACPI_FADT_32BIT_TIMER)
> +        printk(KERN_WARNING PREFIX "PM-Timer is too short\n");

Indentation is screwed up here.

> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -457,16 +457,13 @@ static u64 read_pmtimer_count(void)
>  static s64 __init init_pmtimer(struct platform_timesource *pts)
>  {
>      u64 start;
> -    u32 count, target, mask = 0xffffff;
> +    u32 count, target, mask;
>  
> -    if ( !pmtmr_ioport || !pmtmr_width )
> +    if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
>          return 0;
>  
> -    if ( pmtmr_width == 32 )
> -    {
> -        pts->counter_bits = 32;
> -        mask = 0xffffffff;
> -    }
> +    pts->counter_bits = pmtmr_width;
> +    mask = (1ull << pmtmr_width) - 1;

"mask" being of "u32" type, the use of 1ull is certainly a little odd
here, and one of the reasons why I think this extra "cleanup" would
better go in a separate patch.

Seeing that besides cosmetic aspects the patch looks okay now, I'd be
willing to leave the bigger adjustment mostly as is, albeit I'd
prefer the 1ull to go away, by instead switching to e.g.

    mask = 0xffffffff >> (32 - pmtmr_width);

With the adjustments (which I'd be happy to make while committing,
provided you agree)
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Also Cc-ing Paul for a possible release ack (considering this is a
backporting candidate).

Jan


  reply	other threads:[~2020-06-22  8:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 22:00 [PATCH v3 0/1] Fix broken suspend on some machines Grzegorz Uriasz
2020-06-19 22:00 ` [PATCH v3 1/1] x86/acpi: Use FADT flags to determine the PMTMR width Grzegorz Uriasz
2020-06-22  8:49   ` Jan Beulich [this message]
2020-06-24 15:31     ` Ping: " Jan Beulich
2020-06-25  6:55       ` Paul Durrant
2020-06-22  8:54   ` Roger Pau Monné
2020-06-22  8:58     ` Roger Pau Monné
2020-06-22 10:13     ` Jan Beulich

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=5993e716-d71d-cbc0-a186-5325e2bdeba4@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=contact@puzio.waw.pl \
    --cc=gorbak25@gmail.com \
    --cc=j.nowak26@student.uw.edu.pl \
    --cc=jakub@bartmin.ski \
    --cc=marmarek@invisiblethingslab.com \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.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.