From patchwork Wed Oct 15 12:53:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel J Blueman X-Patchwork-Id: 5085551 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 78BD09F2BA for ; Wed, 15 Oct 2014 13:16:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A071520136 for ; Wed, 15 Oct 2014 13:16:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B29E20120 for ; Wed, 15 Oct 2014 13:16:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751398AbaJONQT (ORCPT ); Wed, 15 Oct 2014 09:16:19 -0400 Received: from numascale.com ([213.162.240.84]:34845 "EHLO numascale.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbaJONQS (ORCPT ); Wed, 15 Oct 2014 09:16:18 -0400 X-Greylist: delayed 1373 seconds by postgrey-1.27 at vger.kernel.org; Wed, 15 Oct 2014 09:16:18 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=numascale.com; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=asq2EPxzMm0aoka/PfuauINWl+8hFcMGbtVhOq+k4mE=; b=eDO9hckE8SvSua49OGo/CssvjBl9r63V2NHabKziGt5BXAV/9ce/pM2JRwOyCeH52ZkZ+xC2wtwwGSjyuxcs3g/saU+/ad8QUWHXqe5RIxqq3/Gp52vcOWdct5mrq8mHNVrJArGjLiolmLyHu3p/Y7iEl6oV0kaqEn0bKjbVEt8=; Received: from [115.42.131.38] (port=55106 helo=meiko.int.numascale.com) by cpanel21.proisp.no with esmtpsa (UNKNOWN:AES128-SHA256:128) (Exim 4.82) (envelope-from ) id 1XeO4s-000u3u-A6; Wed, 15 Oct 2014 14:53:18 +0200 From: Daniel J Blueman To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Bjorn Helgaas Cc: Daniel J Blueman , x86@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Steffen Persvold Subject: [PATCH 1/3] Numachip: fixes Date: Wed, 15 Oct 2014 20:53:06 +0800 Message-Id: <1413377588-6985-1-git-send-email-daniel@numascale.com> X-Mailer: git-send-email 1.9.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel21.proisp.no X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - numascale.com X-Get-Message-Sender-Via: cpanel21.proisp.no: authenticated_id: daniel@numascale.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix APIC declaration to be consistent with definition; this addresses a compilation failure with the development branch of GCC, see: https://bugzilla.kernel.org/show_bug.cgi?id=78251 Fix 16-bit APIC ID truncation and redundant APIC ICR idle polling for IPI to self (AMD64 APICs are documented in the system developer manuals to queue APIC writes). Finally, add safe function to check if Numachip is detected, to be used elsewhere. Candidate for stable. Signed-off-by: Daniel J Blueman Reviewed-by: Steffen Persvold --- arch/x86/include/asm/numachip/numachip.h | 9 +++++++++ arch/x86/kernel/apic/apic_numachip.c | 12 ++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/numachip/numachip.h b/arch/x86/include/asm/numachip/numachip.h index 1c6f7f6..3e1f4f9 100644 --- a/arch/x86/include/asm/numachip/numachip.h +++ b/arch/x86/include/asm/numachip/numachip.h @@ -16,4 +16,13 @@ extern int __init pci_numachip_init(void); +#ifdef CONFIG_X86_NUMACHIP +extern bool is_numachip_system(void); +#else +static inline bool is_numachip_system(void) +{ + return 0; +} +#endif + #endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */ diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index ae91539..4156470 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -30,9 +30,13 @@ #include #include -static int numachip_system __read_mostly; +static bool numachip_system __read_mostly; +static const struct apic apic_numachip __refconst; -static const struct apic apic_numachip __read_mostly; +bool is_numachip_system(void) +{ + return numachip_system; +} static unsigned int get_apic_id(unsigned long x) { @@ -40,7 +44,7 @@ static unsigned int get_apic_id(unsigned long x) unsigned int id; rdmsrl(MSR_FAM10H_NODE_ID, value); - id = ((x >> 24) & 0xffU) | ((value << 2) & 0x3f00U); + id = ((x >> 24) & 0xffU) | ((value << 2) & 0xff00U); return id; } @@ -145,7 +149,7 @@ static void numachip_send_IPI_all(int vector) static void numachip_send_IPI_self(int vector) { - __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); + apic_write(APIC_SELF_IPI, vector); } static int __init numachip_probe(void)