[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.02.1205242352460.3231@ionos>
Date: Fri, 25 May 2012 00:06:48 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Jan Beulich <JBeulich@...e.com>
cc: mingo@...e.hu, hpa@...or.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: clear HPET configuration registers on startup
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists