mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jan Beulich <JBeulich@suse.com>
Cc: mingo@elte.hu, hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: clear HPET configuration registers on startup
Date: Fri, 25 May 2012 00:06:48 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1205242352460.3231@ionos> (raw)
In-Reply-To: <4F79D0BB020000780007C02D@nat28.tlf.novell.com>

On Mon, 2 Apr 2012, Jan Beulich wrote:

Sorry for ignoring this for so long.

> +	cfg = hpet_readl(HPET_CFG);
> +	hpet_boot_cfg = kmalloc((last + 2) * sizeof(*hpet_boot_cfg),
> +				GFP_KERNEL);
> +	if (hpet_boot_cfg)
> +		*hpet_boot_cfg = cfg;
> +	else
> +		pr_warn("HPET initial state will not be saved\n");
> +	cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY);
> +	hpet_writel(cfg, HPET_Tn_CFG(i));

This wants to be  

> +	hpet_writel(cfg, HPET_CFG);

Right ?

You would have noticed if that code would have run on an AMD SB700
based machine and i would have been != 0 :)

> +	if (cfg)
> +		pr_warn("HPET: Unrecognized bits %#x set in global cfg\n",
> +			cfg);
> +
> +	for (i = 0; i <= last; ++i) {
> +		cfg = hpet_readl(HPET_Tn_CFG(i));
> +		if (hpet_boot_cfg)
> +			hpet_boot_cfg[i + 1] = cfg;
> +		cfg &= ~(HPET_TN_ENABLE | HPET_TN_LEVEL | HPET_TN_FSB);
> +		hpet_writel(cfg, HPET_Tn_CFG(i));
> +		cfg &= ~(HPET_TN_PERIODIC | HPET_TN_PERIODIC_CAP
> +			 | HPET_TN_64BIT_CAP | HPET_TN_32BIT | HPET_TN_ROUTE
> +			 | HPET_TN_FSB | HPET_TN_FSB_CAP);
> +		if (cfg)
> +			pr_warn("HPET: Unrecognized bits %#x set in cfg#%u\n",
> +				cfg, i);
> +	}
> +	hpet_print_config();
> +
>  	if (hpet_clocksource_register())
>  		goto out_nohpet;
>  
> @@ -923,14 +952,28 @@ fs_initcall(hpet_late_init);
>  void hpet_disable(void)
>  {
>  	if (is_hpet_capable() && hpet_virt_address) {
> -		unsigned int cfg = hpet_readl(HPET_CFG);
> +		unsigned int cfg = hpet_readl(HPET_CFG), id, last;
>  
> -		if (hpet_legacy_int_enabled) {
> +		if (hpet_boot_cfg)
> +			cfg = *hpet_boot_cfg;

That restores the setting which you recorded at init time. Why do you
want to do that? There is no point to restore to an eventually borked
state. If we shut down the thing, then we better leave it in a
consistent state rather than something dubious, really.

Thanks,

	tglx

  parent reply	other threads:[~2012-05-24 22:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 14:15 Jan Beulich
2012-05-08  4:22 ` [tip:timers/core] x86: Clear " tip-bot for Jan Beulich
2012-05-24 22:06 ` Thomas Gleixner [this message]
2012-05-25 10:21   ` [PATCH] x86: clear " Jan Beulich
2012-05-25 10:33     ` Thomas Gleixner

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=alpine.LFD.2.02.1205242352460.3231@ionos \
    --to=tglx@linutronix.de \
    --cc=JBeulich@suse.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®