From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934442AbdLRU2f (ORCPT ); Mon, 18 Dec 2017 15:28:35 -0500 Received: from merlin.infradead.org ([205.233.59.134]:44276 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758056AbdLRU2b (ORCPT ); Mon, 18 Dec 2017 15:28:31 -0500 Date: Mon, 18 Dec 2017 21:28:22 +0100 From: Peter Zijlstra To: Zhang Rui Cc: Thomas Gleixner , LKML , linux-x86 , Len Brown , "Chen, Yu C" Subject: Re: Regression: unable to boot after commit bd9240a18edf ("x86/apic: Add TSC_DEADLINE quirk due to errata") - Surface Pro 4 SKL Message-ID: <20171218202822.juwyxsd7millme7o@hirez.programming.kicks-ass.net> References: <1511834933.2498.14.camel@intel.com> <20171128081440.mi3nrhxgori75cbs@hirez.programming.kicks-ass.net> <1511857335.2498.22.camel@intel.com> <1511866741.2441.5.camel@intel.com> <20171128123607.fmgpq76brf6bdkk4@hirez.programming.kicks-ass.net> <1511966690.2750.9.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1511966690.2750.9.camel@intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, can you see if this makes you Surface boot? I tested it on my IVB by making has_legacy_pic() return unconditional true. [ 0.024000] tsc: Unable to calibrate against PIT [ 0.025000] tsc: using HPET reference calibration [ 0.026000] tsc: Detected 2792.451 MHz processor --- diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h index c8376b40e882..e2cfc4b52ee4 100644 --- a/arch/x86/include/asm/i8259.h +++ b/arch/x86/include/asm/i8259.h @@ -69,6 +69,11 @@ struct legacy_pic { extern struct legacy_pic *legacy_pic; extern struct legacy_pic null_legacy_pic; +static inline bool has_legacy_pic(void) +{ + return legacy_pic == &null_legacy_pic; +} + static inline int nr_legacy_irqs(void) { return legacy_pic->nr_legacy_irqs; diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 8ea117f8142e..2afc623b2280 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -25,6 +25,7 @@ #include #include #include +#include unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ EXPORT_SYMBOL(cpu_khz); @@ -363,6 +364,15 @@ static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin) unsigned long tscmin, tscmax; int pitcnt; + if (!has_legacy_pic()) { + udelay(10 * USEC_PER_MSEC); + udelay(10 * USEC_PER_MSEC); + udelay(10 * USEC_PER_MSEC); + udelay(10 * USEC_PER_MSEC); + udelay(10 * USEC_PER_MSEC); + return ULONG_MAX; + } + /* Set the Gate high, disable speaker */ outb((inb(0x61) & ~0x02) | 0x01, 0x61); @@ -487,6 +497,9 @@ static unsigned long quick_pit_calibrate(void) u64 tsc, delta; unsigned long d1, d2; + if (!has_legacy_pic()) + return 0; + /* Set the Gate high, disable speaker */ outb((inb(0x61) & ~0x02) | 0x01, 0x61);