stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, sparclinux@vger.kernel.org,
	Bob Picco <bob.picco@oracle.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 3.14 088/100] sparc64: T5 PMU
Date: Tue, 28 Oct 2014 11:36:13 +0800	[thread overview]
Message-ID: <20141028033504.509824325@linuxfoundation.org> (raw)
In-Reply-To: <20141028033500.670583608@linuxfoundation.org>

3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: bob picco <bpicco@meloft.net>

The T5 (niagara5) has different PCR related HV fast trap values and a new
HV API Group. This patch utilizes these and shares when possible with niagara4.

We use the same sparc_pmu niagara4_pmu. Should there be new effort to
obtain the MCU perf statistics then this would have to be changed.

Cc: sparclinux@vger.kernel.org
Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/sparc/include/asm/hypervisor.h |   11 ++++++++
 arch/sparc/kernel/hvapi.c           |    1 
 arch/sparc/kernel/hvcalls.S         |   16 ++++++++++++
 arch/sparc/kernel/pcr.c             |   47 ++++++++++++++++++++++++++++++++----
 arch/sparc/kernel/perf_event.c      |    3 +-
 5 files changed, 73 insertions(+), 5 deletions(-)

--- a/arch/sparc/include/asm/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
@@ -2944,6 +2944,16 @@ extern unsigned long sun4v_vt_set_perfre
 					  unsigned long reg_val);
 #endif
 
+#define	HV_FAST_T5_GET_PERFREG		0x1a8
+#define	HV_FAST_T5_SET_PERFREG		0x1a9
+
+#ifndef	__ASSEMBLY__
+unsigned long sun4v_t5_get_perfreg(unsigned long reg_num,
+				   unsigned long *reg_val);
+unsigned long sun4v_t5_set_perfreg(unsigned long reg_num,
+				   unsigned long reg_val);
+#endif
+
 /* Function numbers for HV_CORE_TRAP.  */
 #define HV_CORE_SET_VER			0x00
 #define HV_CORE_PUTCHAR			0x01
@@ -2975,6 +2985,7 @@ extern unsigned long sun4v_vt_set_perfre
 #define HV_GRP_VF_CPU			0x0205
 #define HV_GRP_KT_CPU			0x0209
 #define HV_GRP_VT_CPU			0x020c
+#define HV_GRP_T5_CPU			0x0211
 #define HV_GRP_DIAG			0x0300
 
 #ifndef __ASSEMBLY__
--- a/arch/sparc/kernel/hvapi.c
+++ b/arch/sparc/kernel/hvapi.c
@@ -46,6 +46,7 @@ static struct api_info api_table[] = {
 	{ .group = HV_GRP_VF_CPU,				},
 	{ .group = HV_GRP_KT_CPU,				},
 	{ .group = HV_GRP_VT_CPU,				},
+	{ .group = HV_GRP_T5_CPU,				},
 	{ .group = HV_GRP_DIAG,		.flags = FLAG_PRE_API	},
 };
 
--- a/arch/sparc/kernel/hvcalls.S
+++ b/arch/sparc/kernel/hvcalls.S
@@ -821,3 +821,19 @@ ENTRY(sun4v_vt_set_perfreg)
 	retl
 	 nop
 ENDPROC(sun4v_vt_set_perfreg)
+
+ENTRY(sun4v_t5_get_perfreg)
+	mov	%o1, %o4
+	mov	HV_FAST_T5_GET_PERFREG, %o5
+	ta	HV_FAST_TRAP
+	stx	%o1, [%o4]
+	retl
+	 nop
+ENDPROC(sun4v_t5_get_perfreg)
+
+ENTRY(sun4v_t5_set_perfreg)
+	mov	HV_FAST_T5_SET_PERFREG, %o5
+	ta	HV_FAST_TRAP
+	retl
+	 nop
+ENDPROC(sun4v_t5_set_perfreg)
--- a/arch/sparc/kernel/pcr.c
+++ b/arch/sparc/kernel/pcr.c
@@ -191,12 +191,41 @@ static const struct pcr_ops n4_pcr_ops =
 	.pcr_nmi_disable	= PCR_N4_PICNPT,
 };
 
+static u64 n5_pcr_read(unsigned long reg_num)
+{
+	unsigned long val;
+
+	(void) sun4v_t5_get_perfreg(reg_num, &val);
+
+	return val;
+}
+
+static void n5_pcr_write(unsigned long reg_num, u64 val)
+{
+	(void) sun4v_t5_set_perfreg(reg_num, val);
+}
+
+static const struct pcr_ops n5_pcr_ops = {
+	.read_pcr		= n5_pcr_read,
+	.write_pcr		= n5_pcr_write,
+	.read_pic		= n4_pic_read,
+	.write_pic		= n4_pic_write,
+	.nmi_picl_value		= n4_picl_value,
+	.pcr_nmi_enable		= (PCR_N4_PICNPT | PCR_N4_STRACE |
+				   PCR_N4_UTRACE | PCR_N4_TOE |
+				   (26 << PCR_N4_SL_SHIFT)),
+	.pcr_nmi_disable	= PCR_N4_PICNPT,
+};
+
+
 static unsigned long perf_hsvc_group;
 static unsigned long perf_hsvc_major;
 static unsigned long perf_hsvc_minor;
 
 static int __init register_perf_hsvc(void)
 {
+	unsigned long hverror;
+
 	if (tlb_type == hypervisor) {
 		switch (sun4v_chip_type) {
 		case SUN4V_CHIP_NIAGARA1:
@@ -215,6 +244,10 @@ static int __init register_perf_hsvc(voi
 			perf_hsvc_group = HV_GRP_VT_CPU;
 			break;
 
+		case SUN4V_CHIP_NIAGARA5:
+			perf_hsvc_group = HV_GRP_T5_CPU;
+			break;
+
 		default:
 			return -ENODEV;
 		}
@@ -222,10 +255,12 @@ static int __init register_perf_hsvc(voi
 
 		perf_hsvc_major = 1;
 		perf_hsvc_minor = 0;
-		if (sun4v_hvapi_register(perf_hsvc_group,
-					 perf_hsvc_major,
-					 &perf_hsvc_minor)) {
-			printk("perfmon: Could not register hvapi.\n");
+		hverror = sun4v_hvapi_register(perf_hsvc_group,
+					       perf_hsvc_major,
+					       &perf_hsvc_minor);
+		if (hverror) {
+			pr_err("perfmon: Could not register hvapi(0x%lx).\n",
+			       hverror);
 			return -ENODEV;
 		}
 	}
@@ -254,6 +289,10 @@ static int __init setup_sun4v_pcr_ops(vo
 		pcr_ops = &n4_pcr_ops;
 		break;
 
+	case SUN4V_CHIP_NIAGARA5:
+		pcr_ops = &n5_pcr_ops;
+		break;
+
 	default:
 		ret = -ENODEV;
 		break;
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1662,7 +1662,8 @@ static bool __init supported_pmu(void)
 		sparc_pmu = &niagara2_pmu;
 		return true;
 	}
-	if (!strcmp(sparc_pmu_type, "niagara4")) {
+	if (!strcmp(sparc_pmu_type, "niagara4") ||
+	    !strcmp(sparc_pmu_type, "niagara5")) {
 		sparc_pmu = &niagara4_pmu;
 		return true;
 	}



  parent reply	other threads:[~2014-10-28  3:36 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28  3:34 [PATCH 3.14 000/100] 3.14.23-stable review Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 001/100] btrfs: wake up transaction thread from SYNC_FS ioctl Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 002/100] Btrfs: add missing compression property remove in btrfs_ioctl_setflags Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 004/100] Btrfs: try not to ENOSPC on log replay Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 005/100] Btrfs: cleanup error handling in build_backref_tree Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 006/100] Btrfs: fix build_backref_tree issue with multiple shared blocks Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 007/100] Btrfs: fix race in WAIT_SYNC ioctl Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 008/100] fs: Add a missing permission check to do_umount Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 009/100] usb: pch_udc: usb gadget device support for Intel Quark X1000 Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 010/100] pci_ids: Add support for Intel Quark ILB Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 011/100] Btrfs: send, fix data corruption due to incorrect hole detection Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 012/100] kvm: x86: fix stale mmio cache bug Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 013/100] kvm: fix potentially corrupt mmio cache Greg Kroah-Hartman
2014-10-28  3:34 ` [PATCH 3.14 014/100] KVM: s390: unintended fallthrough for external call Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 015/100] kvm: dont take vcpu mutex for obviously invalid vcpu ioctls Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 016/100] x86/intel/quark: Switch off CR4.PGE so TLB flush uses CR3 instead Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 017/100] spi: dw-mid: respect 8 bit mode Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 018/100] spi: dw-mid: check that DMA was inited before exit Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 019/100] regmap: debugfs: fix possbile NULL pointer dereference Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 020/100] regmap: fix NULL pointer dereference in _regmap_write/read Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 021/100] regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 022/100] be2iscsi: check ip buffer before copying Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 023/100] mptfusion: enable no_write_same for vmware scsi disks Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 024/100] qla2xxx: Use correct offset to req-q-out for reserve calculation Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 025/100] qla2xxx: Fix shost use-after-free on device removal Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 026/100] dmaengine: fix xor sources continuation Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 027/100] firmware_class: make sure fw requests contain a name Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 028/100] Drivers: hv: vmbus: Cleanup vmbus_post_msg() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 029/100] Drivers: hv: vmbus: Cleanup vmbus_teardown_gpadl() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 030/100] Drivers: hv: vmbus: Cleanup vmbus_close_internal() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 031/100] Drivers: hv: vmbus: Cleanup vmbus_establish_gpadl() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 032/100] Drivers: hv: vmbus: Fix a bug in vmbus_open() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 033/100] mei: bus: fix possible boundaries violation Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 034/100] m68k: Disable/restore interrupts in hwreg_present()/hwreg_write() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 035/100] Fixing lease renewal Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 036/100] Documentation: lzo: document part of the encoding Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 037/100] Revert "lzo: properly check for overruns" Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 038/100] lzo: check for length overrun in variable length encoding Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 039/100] tty: omap-serial: fix division by zero Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 040/100] NFSv4: Fix lock recovery when CREATE_SESSION/SETCLIENTID_CONFIRM fails Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 041/100] NFSv4: fix open/lock state recovery error handling Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 042/100] NFSv4.1: Fix an NFSv4.1 state renewal regression Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 043/100] iwlwifi: Add missing PCI IDs for the 7260 series Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 044/100] PCI: mvebu: Fix uninitialized variable in mvebu_get_tgt_attr() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 045/100] PCI: Increase IBM ipr SAS Crocodile BARs to at least system page size Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 046/100] PCI: Generate uppercase hex for modalias interface class Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 047/100] rt2800: correct BBP1_TX_POWER_CTRL mask Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 048/100] Bluetooth: Fix HCI H5 corrupted ack value Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 049/100] Bluetooth: Fix incorrect LE CoC PDU length restriction based on HCI MTU Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 050/100] Bluetooth: Fix issue with USB suspend in btusb driver Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 051/100] mm: clear __GFP_FS when PF_MEMALLOC_NOIO is set Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 053/100] kernel: add support for gcc 5 Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 054/100] futex: Ensure get_futex_key_refs() always implies a barrier Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 055/100] powerpc/iommu/ddw: Fix endianness Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 056/100] ima: provide flag to identify new empty files Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 057/100] spi: dw-mid: terminate ongoing transfers at exit Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 058/100] arm64: compat: fix compat types affecting struct compat_elf_prpsinfo Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 059/100] ALSA: pcm: use the same dma mmap codepath both for arm and arm64 Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 060/100] ALSA: emu10k1: Fix deadlock in synth voice lookup Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 061/100] ALSA: ALC283 codec - Avoid pop noise on headphones during suspend/resume Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 062/100] ALSA: usb-audio: Add support for Steinberg UR22 USB interface Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 063/100] ALSA: hda - hdmi: Fix missing ELD change event on plug/unplug Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 064/100] ARM: at91/dt: Fix typo regarding can0_clk Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 065/100] ARM: at91: fix at91sam9263ek DT mmc pinmuxing settings Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 066/100] ARM: at91/PMC: dont forget to write PMC_PCDR register to disable clocks Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 067/100] ARM: mvebu: Netgear RN104: Use Hardware BCH ECC Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 068/100] ARM: mvebu: Netgear RN2120: " Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 069/100] ARM: mvebu: Netgear RN102: " Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 070/100] ecryptfs: avoid to access NULL pointer when write metadata in xattr Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 071/100] xfs: ensure WB_SYNC_ALL writeback handles partial pages correctly Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 072/100] sparc64: Do not disable interrupts in nmi_cpu_busy() Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 073/100] sparc64: Fix pcr_ops initialization and usage bugs Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.14 074/100] sparc32: dma_alloc_coherent must honour gfp flags Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 075/100] sparc64: sun4v TLB error power off events Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 076/100] sparc64: Fix corrupted thread fault code Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 077/100] sparc64: find_node adjustment Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 078/100] sparc64: Move request_irq() from ldc_bind() to ldc_alloc() Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 079/100] sparc: Let memset return the address argument Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 080/100] sparc64: Fix reversed start/end in flush_tlb_kernel_range() Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 081/100] sparc64: Fix lockdep warnings on reboot on Ultra-5 Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 082/100] sparc64: Fix FPU register corruption with AES crypto offload Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 083/100] sparc64: Do not define thread fpregs save area as zero-length array Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 084/100] sparc64: Fix hibernation code refrence to PAGE_OFFSET Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 085/100] sparc64: correctly recognise M6 and M7 cpu type Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 086/100] sparc64: support M6 and M7 for building CPU distribution map Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 087/100] sparc64: cpu hardware caps support for sparc M6 and M7 Greg Kroah-Hartman
2014-10-28  3:36 ` Greg Kroah-Hartman [this message]
2014-10-28  3:36 ` [PATCH 3.14 089/100] sparc64: Switch to 4-level page tables Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 090/100] sparc64: Define VA hole at run time, rather than at compile time Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 091/100] sparc64: Adjust KTSB assembler to support larger physical addresses Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 092/100] sparc64: Fix physical memory management regressions with large max_phys_bits Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 093/100] sparc64: Use kernel page tables for vmemmap Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 094/100] sparc64: Increase MAX_PHYS_ADDRESS_BITS to 53 Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 095/100] sparc64: Adjust vmalloc region size based upon available virtual address bits Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 096/100] sparc64: sparse irq Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 097/100] sparc64: Kill unnecessary tables and increase MAX_BANKS Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 098/100] sparc64: Increase size of boot string to 1024 bytes Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 099/100] sparc64: Fix register corruption in top-most kernel stack frame during boot Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.14 100/100] sparc64: Implement __get_user_pages_fast() Greg Kroah-Hartman
2014-10-28 15:13 ` [PATCH 3.14 000/100] 3.14.23-stable review Guenter Roeck
2014-10-28 16:15 ` Shuah Khan

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=20141028033504.509824325@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bob.picco@oracle.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).