Received: by 10.213.65.68 with SMTP id h4csp357932imn; Fri, 23 Mar 2018 06:14:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELtzmkoD36QXlLisLFN3+gSip+aFw+oeru3OgF/1ci6J7OXV672MtQ+9T1gwIFIP3bIJp1M9 X-Received: by 10.99.110.6 with SMTP id j6mr20450072pgc.29.1521810857926; Fri, 23 Mar 2018 06:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521810857; cv=none; d=google.com; s=arc-20160816; b=pbzHRFlXjuUaHCrQITWlB9qYr65v46/w7KrlivCQ7ic172x1JV4geZgJjIh9aY8oky mYhAN6tdDMys8+/aqib6U9kF4IGvOcwijJhi+ARuQYlFR6KrGSxNq3Dabno+97pwFEYp eZ8eEkA2NQWxovmQmeY+10q05D03gnjkCOcBLFQq5LuIKp8FBaQrlF+YkpbwuTRvx9h/ qL3Z2uT8WeqK9JJkhRXQrn6BtA/2ItxYDHMtCKncC6KpanIb34MPU8fXB46KjwShdCs/ hul45/nXUAXdU7w+lLZ7VwWOdF+RFixIfqt+HttWGPCV+Ulgoanco89JuaRsI8o4tQ6x Xf4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=r0u/JkntafsVD1N/qC9EE1pTDUY/K/K3TTw/7rglEqc=; b=J41J4DMDntA+jm1c69iz5YlRbru9iVgylxi1eqCX02IJsic1xhlRbE5gjEOF47RRwv EtkoIyFn6J+XDtuRrJdEPKa8I8fT3DR/nr+2MWKomQtsABcd8puXyZZ0lzOI9cE/0roa aunK71tRoa0Y+iKAbHgklAtACYsyRX8PvLDrj4BcYLJiVU4rpLQ0PRVQLE3oOOPBZucr GpNNzvzzRCCsDZBeaSTnRRRT7e/puTCv7injji5u/7a5LCqZyfUSTfTQhnrzlbptFP/y NYsBWii6wwUSOM2eNsnV0EhSys1QzaFI0lzV2Qtgq1hV3cm4Qwy1pvUr79Ae5o9e1QNq zG7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16-v6si8886377plj.220.2018.03.23.06.14.02; Fri, 23 Mar 2018 06:14:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752562AbeCWNMt (ORCPT + 99 others); Fri, 23 Mar 2018 09:12:49 -0400 Received: from mga05.intel.com ([192.55.52.43]:57827 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752331AbeCWNMr (ORCPT ); Fri, 23 Mar 2018 09:12:47 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Mar 2018 06:12:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,350,1517904000"; d="scan'208";a="37536727" Received: from otc-brkl-02.jf.intel.com ([10.54.39.28]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2018 06:12:46 -0700 From: Kan Liang To: peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: eranian@google.com, osk@google.com, mark@voidzero.net, ak@linux.intel.com Subject: [RESEND PATCH 2/2] perf/x86/intel/uncore: Fix SBOX support for Broadwell CPUs Date: Fri, 23 Mar 2018 09:11:30 -0400 Message-Id: <1521810690-2576-2-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1521810690-2576-1-git-send-email-kan.liang@linux.intel.com> References: <1521810690-2576-1-git-send-email-kan.liang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oskar Senft This fixes SBOX support for Broadwell CPUs by checking the Power Control Unit CAPID4 register to determine the number of available SBOXes on the particular CPU before trying to enable them. Signed-off-by: Oskar Senft Tested-by: Mark van Dijk Reviewed-by: Kan Liang --- arch/x86/events/intel/uncore_snbep.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 47c6910..715eb14 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3060,6 +3060,8 @@ static struct event_constraint bdx_uncore_pcu_constraints[] = { void bdx_uncore_cpu_init(void) { + int pkg = topology_phys_to_logical_pkg(0); + if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; uncore_msr_uncores = bdx_msr_uncores; @@ -3067,7 +3069,15 @@ void bdx_uncore_cpu_init(void) /* BDX-DE doesn't have SBOX */ if (boot_cpu_data.x86_model == 86) uncore_msr_uncores[BDX_MSR_UNCORE_SBOX] = NULL; - + /* Detect systems with no SBOXes */ + else if (uncore_extra_pci_dev[pkg].dev[HSWEP_PCI_PCU_3]) { + u32 capid4; + pci_read_config_dword( + uncore_extra_pci_dev[pkg].dev[HSWEP_PCI_PCU_3], + 0x94, &capid4); + if (((capid4 >> 6) & 0x3) == 0) + bdx_msr_uncores[BDX_MSR_UNCORE_SBOX] = NULL; + } hswep_uncore_pcu.constraints = bdx_uncore_pcu_constraints; } @@ -3285,6 +3295,11 @@ static const struct pci_device_id bdx_uncore_pci_ids[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46), .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2), }, + { /* PCU.3 (for Capability registers) */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fc0), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + HSWEP_PCI_PCU_3), + }, { /* end: all zeroes */ } }; -- 2.4.11