linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs
@ 2014-08-27 21:40 David E. Box
  2014-08-27 21:40 ` [PATCH 1/2] x86: iosf: Add Kconfig prompt for IOSF_MBI selection David E. Box
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: David E. Box @ 2014-08-27 21:40 UTC (permalink / raw)
  To: tglx, mingo, hpa; +Cc: x86, linux-kernel, alan

Fixes a flaw with the iosf driver buidling as 'default m' on all x86 systems.
Adds debugfs support.

David E. Box (2):
  x86: iosf: Add Kconfig prompt for IOSF_MBI selection
  x86: iosf: Add debugfs support

 arch/x86/Kconfig           | 14 +++++++--
 arch/x86/kernel/iosf_mbi.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 2 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/2] x86: iosf: Add Kconfig prompt for IOSF_MBI selection
  2014-08-27 21:40 [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs David E. Box
@ 2014-08-27 21:40 ` David E. Box
  2014-09-02 21:07   ` [tip:x86/platform] x86/iosf: " tip-bot for David E. Box
  2014-08-27 21:40 ` [PATCH 2/2] x86: iosf: Add debugfs support David E. Box
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: David E. Box @ 2014-08-27 21:40 UTC (permalink / raw)
  To: tglx, mingo, hpa; +Cc: x86, linux-kernel, alan

Fixes an error in having the iosf build as 'default m'. On X86 SoC's the iosf
sideband is the only way to access information for some registers, as opposed to
through MSR's on other Intel architectures. While selecting IOSF_MBI is
preferred, it does mean carrying extra code on non-SoC architectures. This
exports the selection to the user, allowing those driver writers to compile out
iosf code if it's not being built.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/Kconfig | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d24887b..e07e2a5 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2400,9 +2400,19 @@ config X86_DMA_REMAP
 	depends on STA2X11
 
 config IOSF_MBI
-	tristate
-	default m
+	tristate "Intel System On Chip IOSF Sideband support"
 	depends on PCI
+	---help---
+	  Enables sideband access to mailbox registers on SoC's. The sideband is
+	  available on the following platforms. This list is not meant to be
+	  exclusive.
+	   - BayTrail
+	   - Cherryview
+	   - Braswell
+	   - Quark
+
+	  You should say Y if you are running a kernel on one of these
+	  platforms.
 
 source "net/Kconfig"
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/2] x86: iosf: Add debugfs support
  2014-08-27 21:40 [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs David E. Box
  2014-08-27 21:40 ` [PATCH 1/2] x86: iosf: Add Kconfig prompt for IOSF_MBI selection David E. Box
@ 2014-08-27 21:40 ` David E. Box
  2014-08-27 22:20   ` H. Peter Anvin
  2014-09-02 21:07   ` [tip:x86/platform] x86/iosf: " tip-bot for David E. Box
  2014-09-17  3:26 ` [PATCH 0/3] x86: iosf: Additions to iosf patch set David E. Box
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: David E. Box @ 2014-08-27 21:40 UTC (permalink / raw)
  To: tglx, mingo, hpa; +Cc: x86, linux-kernel, alan

Allows access to the iosf sideband through debugfs.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/kernel/iosf_mbi.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index d30acdc..bf848ca 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -22,6 +22,8 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/pci.h>
+#include <linux/debugfs.h>
+#include <linux/capability.h>
 
 #include <asm/iosf_mbi.h>
 
@@ -187,6 +189,75 @@ bool iosf_mbi_available(void)
 }
 EXPORT_SYMBOL(iosf_mbi_available);
 
+/********************** debugfs begin ****************************/
+static u32	dbg_mdr;
+static u32	dbg_mcr;
+static u32	dbg_mcrx;
+
+static int mcr_get(void *data, u64 *val)
+{
+	*val = *(u32 *)data;
+	return 0;
+}
+
+static int mcr_set(void *data, u64 val)
+{
+	u8 command = ((u32)val & 0xFF000000) >> 24,
+	   port	   = ((u32)val & 0x00FF0000) >> 16,
+	   offset  = ((u32)val & 0x0000FF00) >> 8;
+	int err;
+
+	*(u32 *)data = val;
+
+	if (!capable(CAP_SYS_RAWIO))
+		return -EACCES;
+
+	if (command & 1u)
+		err = iosf_mbi_write(port,
+			       command,
+			       dbg_mcrx | offset,
+			       dbg_mdr);
+	else
+		err = iosf_mbi_read(port,
+			      command,
+			      dbg_mcrx | offset,
+			      &dbg_mdr);
+
+	return err;
+}
+DEFINE_SIMPLE_ATTRIBUTE(iosf_mcr_fops, mcr_get, mcr_set , "%llx\n");
+
+static struct dentry *iosf_dbg;
+static void iosf_sideband_debug_init(void)
+{
+	struct dentry *d;
+
+	iosf_dbg = debugfs_create_dir("iosf_sb", NULL);
+	if (IS_ERR_OR_NULL(iosf_dbg))
+		return;
+
+	/* mdr */
+	d = debugfs_create_x32("mdr", 0660, iosf_dbg, &dbg_mdr);
+	if (IS_ERR_OR_NULL(d))
+		goto cleanup;
+
+	/* mcrx */
+	debugfs_create_x32("mcrx", 0660, iosf_dbg, &dbg_mcrx);
+	if (IS_ERR_OR_NULL(d))
+		goto cleanup;
+
+	/* mcr - initiates mailbox tranaction */
+	debugfs_create_file("mcr", 0660, iosf_dbg, &dbg_mcr, &iosf_mcr_fops);
+	if (IS_ERR_OR_NULL(d))
+		goto cleanup;
+
+	return;
+
+cleanup:
+	debugfs_remove_recursive(d);
+}
+/********************** debugfs end ****************************/
+
 static int iosf_mbi_probe(struct pci_dev *pdev,
 			  const struct pci_device_id *unused)
 {
@@ -217,11 +288,14 @@ static struct pci_driver iosf_mbi_pci_driver = {
 
 static int __init iosf_mbi_init(void)
 {
+	iosf_sideband_debug_init();
 	return pci_register_driver(&iosf_mbi_pci_driver);
 }
 
 static void __exit iosf_mbi_exit(void)
 {
+	debugfs_remove_recursive(iosf_dbg);
+
 	pci_unregister_driver(&iosf_mbi_pci_driver);
 	if (mbi_pdev) {
 		pci_dev_put(mbi_pdev);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/2] x86: iosf: Add debugfs support
  2014-08-27 21:40 ` [PATCH 2/2] x86: iosf: Add debugfs support David E. Box
@ 2014-08-27 22:20   ` H. Peter Anvin
  2014-09-02 21:07   ` [tip:x86/platform] x86/iosf: " tip-bot for David E. Box
  1 sibling, 0 replies; 19+ messages in thread
From: H. Peter Anvin @ 2014-08-27 22:20 UTC (permalink / raw)
  To: David E. Box, tglx, mingo; +Cc: x86, linux-kernel, alan

On 08/27/2014 02:40 PM, David E. Box wrote:
> Allows access to the iosf sideband through debugfs.

This would break if compiled without CONFIG_DEBUGFS support, which is
often a requirement for security reasons.

Please conditionalize this code, and if practical move it to a separate
.c file.

Most drivers also have separate config options to enable their specific
debugfs options.

	-hpa


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [tip:x86/platform] x86/iosf: Add Kconfig prompt for IOSF_MBI selection
  2014-08-27 21:40 ` [PATCH 1/2] x86: iosf: Add Kconfig prompt for IOSF_MBI selection David E. Box
@ 2014-09-02 21:07   ` tip-bot for David E. Box
  0 siblings, 0 replies; 19+ messages in thread
From: tip-bot for David E. Box @ 2014-09-02 21:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, david.e.box, tglx, hpa

Commit-ID:  aa8e4f22ab7773352ba3895597189b8097f2c307
Gitweb:     http://git.kernel.org/tip/aa8e4f22ab7773352ba3895597189b8097f2c307
Author:     David E. Box <david.e.box@linux.intel.com>
AuthorDate: Wed, 27 Aug 2014 14:40:39 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 27 Aug 2014 14:48:33 -0700

x86/iosf: Add Kconfig prompt for IOSF_MBI selection

Fixes an error in having the iosf build as 'default m'. On X86 SoC's the iosf
sideband is the only way to access information for some registers, as opposed to
through MSR's on other Intel architectures. While selecting IOSF_MBI is
preferred, it does mean carrying extra code on non-SoC architectures. This
exports the selection to the user, allowing those driver writers to compile out
iosf code if it's not being built.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1409175640-32426-2-git-send-email-david.e.box@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/Kconfig | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5d0bf1a..a99988f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2433,9 +2433,19 @@ config X86_DMA_REMAP
 	depends on STA2X11
 
 config IOSF_MBI
-	tristate
-	default m
+	tristate "Intel System On Chip IOSF Sideband support"
 	depends on PCI
+	---help---
+	  Enables sideband access to mailbox registers on SoC's. The sideband is
+	  available on the following platforms. This list is not meant to be
+	  exclusive.
+	   - BayTrail
+	   - Cherryview
+	   - Braswell
+	   - Quark
+
+	  You should say Y if you are running a kernel on one of these
+	  platforms.
 
 config PMC_ATOM
 	def_bool y

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [tip:x86/platform] x86/iosf: Add debugfs support
  2014-08-27 21:40 ` [PATCH 2/2] x86: iosf: Add debugfs support David E. Box
  2014-08-27 22:20   ` H. Peter Anvin
@ 2014-09-02 21:07   ` tip-bot for David E. Box
  1 sibling, 0 replies; 19+ messages in thread
From: tip-bot for David E. Box @ 2014-09-02 21:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, david.e.box, tglx, hpa

Commit-ID:  8dc12f933c9d732c5bbfb233daf27377893b109c
Gitweb:     http://git.kernel.org/tip/8dc12f933c9d732c5bbfb233daf27377893b109c
Author:     David E. Box <david.e.box@linux.intel.com>
AuthorDate: Wed, 27 Aug 2014 14:40:40 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 27 Aug 2014 14:48:36 -0700

x86/iosf: Add debugfs support

Allows access to the iosf sideband through debugfs.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1409175640-32426-3-git-send-email-david.e.box@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/iosf_mbi.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index 9030e83..0a2faa3 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -22,6 +22,8 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/pci.h>
+#include <linux/debugfs.h>
+#include <linux/capability.h>
 
 #include <asm/iosf_mbi.h>
 
@@ -187,6 +189,75 @@ bool iosf_mbi_available(void)
 }
 EXPORT_SYMBOL(iosf_mbi_available);
 
+/********************** debugfs begin ****************************/
+static u32	dbg_mdr;
+static u32	dbg_mcr;
+static u32	dbg_mcrx;
+
+static int mcr_get(void *data, u64 *val)
+{
+	*val = *(u32 *)data;
+	return 0;
+}
+
+static int mcr_set(void *data, u64 val)
+{
+	u8 command = ((u32)val & 0xFF000000) >> 24,
+	   port	   = ((u32)val & 0x00FF0000) >> 16,
+	   offset  = ((u32)val & 0x0000FF00) >> 8;
+	int err;
+
+	*(u32 *)data = val;
+
+	if (!capable(CAP_SYS_RAWIO))
+		return -EACCES;
+
+	if (command & 1u)
+		err = iosf_mbi_write(port,
+			       command,
+			       dbg_mcrx | offset,
+			       dbg_mdr);
+	else
+		err = iosf_mbi_read(port,
+			      command,
+			      dbg_mcrx | offset,
+			      &dbg_mdr);
+
+	return err;
+}
+DEFINE_SIMPLE_ATTRIBUTE(iosf_mcr_fops, mcr_get, mcr_set , "%llx\n");
+
+static struct dentry *iosf_dbg;
+static void iosf_sideband_debug_init(void)
+{
+	struct dentry *d;
+
+	iosf_dbg = debugfs_create_dir("iosf_sb", NULL);
+	if (IS_ERR_OR_NULL(iosf_dbg))
+		return;
+
+	/* mdr */
+	d = debugfs_create_x32("mdr", 0660, iosf_dbg, &dbg_mdr);
+	if (IS_ERR_OR_NULL(d))
+		goto cleanup;
+
+	/* mcrx */
+	debugfs_create_x32("mcrx", 0660, iosf_dbg, &dbg_mcrx);
+	if (IS_ERR_OR_NULL(d))
+		goto cleanup;
+
+	/* mcr - initiates mailbox tranaction */
+	debugfs_create_file("mcr", 0660, iosf_dbg, &dbg_mcr, &iosf_mcr_fops);
+	if (IS_ERR_OR_NULL(d))
+		goto cleanup;
+
+	return;
+
+cleanup:
+	debugfs_remove_recursive(d);
+}
+/********************** debugfs end ****************************/
+
 static int iosf_mbi_probe(struct pci_dev *pdev,
 			  const struct pci_device_id *unused)
 {
@@ -217,11 +288,14 @@ static struct pci_driver iosf_mbi_pci_driver = {
 
 static int __init iosf_mbi_init(void)
 {
+	iosf_sideband_debug_init();
 	return pci_register_driver(&iosf_mbi_pci_driver);
 }
 
 static void __exit iosf_mbi_exit(void)
 {
+	debugfs_remove_recursive(iosf_dbg);
+
 	pci_unregister_driver(&iosf_mbi_pci_driver);
 	if (mbi_pdev) {
 		pci_dev_put(mbi_pdev);

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 0/3] x86: iosf: Additions to iosf patch set
  2014-08-27 21:40 [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs David E. Box
  2014-08-27 21:40 ` [PATCH 1/2] x86: iosf: Add Kconfig prompt for IOSF_MBI selection David E. Box
  2014-08-27 21:40 ` [PATCH 2/2] x86: iosf: Add debugfs support David E. Box
@ 2014-09-17  3:26 ` David E. Box
  2014-09-18  5:13   ` [PATCH V2 " David E. Box
                     ` (3 more replies)
  2014-09-17  3:26 ` [PATCH 1/3] x86: iosf: Add Braswell PCI ID David E. Box
                   ` (2 subsequent siblings)
  5 siblings, 4 replies; 19+ messages in thread
From: David E. Box @ 2014-09-17  3:26 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

These changes apply on top of the patches currently in Peter Anvin's tip tree.

David E. Box (3):
  x86: iosf: Add Braswell PCI ID
  x86: iosf: Move Kconfig to proper submenu
  x86: iosf: Make debugfs addition a separate config option

 arch/x86/Kconfig           | 35 ++++++++++++++++++++---------------
 arch/x86/kernel/iosf_mbi.c | 10 ++++++++--
 2 files changed, 28 insertions(+), 17 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/3] x86: iosf: Add Braswell PCI ID
  2014-08-27 21:40 [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs David E. Box
                   ` (2 preceding siblings ...)
  2014-09-17  3:26 ` [PATCH 0/3] x86: iosf: Additions to iosf patch set David E. Box
@ 2014-09-17  3:26 ` David E. Box
  2014-09-17  3:26 ` [PATCH 2/3] x86: iosf: Move Kconfig to proper submenu David E. Box
  2014-09-17  3:26 ` [PATCH 3/3] x86: iosf: Make debugfs addition a separate config option David E. Box
  5 siblings, 0 replies; 19+ messages in thread
From: David E. Box @ 2014-09-17  3:26 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

Add Braswell PCI ID to list of supported ID's for iosf driver.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/kernel/iosf_mbi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index 0a2faa3..e01f741 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -28,6 +28,7 @@
 #include <asm/iosf_mbi.h>
 
 #define PCI_DEVICE_ID_BAYTRAIL		0x0F00
+#define PCI_DEVICE_ID_BRASWELL		0x2280
 #define PCI_DEVICE_ID_QUARK_X1000	0x0958
 
 static DEFINE_SPINLOCK(iosf_mbi_lock);
@@ -275,6 +276,7 @@ static int iosf_mbi_probe(struct pci_dev *pdev,
 
 static const struct pci_device_id iosf_mbi_pci_ids[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BRASWELL) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) },
 	{ 0, },
 };
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/3] x86: iosf: Move Kconfig to proper submenu
  2014-08-27 21:40 [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs David E. Box
                   ` (3 preceding siblings ...)
  2014-09-17  3:26 ` [PATCH 1/3] x86: iosf: Add Braswell PCI ID David E. Box
@ 2014-09-17  3:26 ` David E. Box
  2014-09-17 12:31   ` Ingo Molnar
  2014-09-17  3:26 ` [PATCH 3/3] x86: iosf: Make debugfs addition a separate config option David E. Box
  5 siblings, 1 reply; 19+ messages in thread
From: David E. Box @ 2014-09-17  3:26 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

Moves Kconfig option to "Processor type and features" menu from main
configuration menu.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/Kconfig | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index bcbb57d..2db4b1d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -480,6 +480,20 @@ config X86_INTEL_LPSS
 	  things like clock tree (common clock framework) and pincontrol
 	  which are needed by the LPSS peripheral drivers.
 
+config IOSF_MBI
+	tristate "Intel System On Chip IOSF Sideband support"
+	depends on PCI
+	---help---
+	  Enables sideband access to mailbox registers on SoC's. The sideband is
+	  available on the following platforms. This list is not meant to be
+	  exclusive.
+	   - BayTrail
+	   - Braswell
+	   - Quark
+
+	  You should say Y if you are running a kernel on one of these
+	  platforms.
+
 config X86_RDC321X
 	bool "RDC R-321x SoC"
 	depends on X86_32
@@ -2443,21 +2457,6 @@ config X86_DMA_REMAP
 	bool
 	depends on STA2X11
 
-config IOSF_MBI
-	tristate "Intel System On Chip IOSF Sideband support"
-	depends on PCI
-	---help---
-	  Enables sideband access to mailbox registers on SoC's. The sideband is
-	  available on the following platforms. This list is not meant to be
-	  exclusive.
-	   - BayTrail
-	   - Cherryview
-	   - Braswell
-	   - Quark
-
-	  You should say Y if you are running a kernel on one of these
-	  platforms.
-
 config PMC_ATOM
 	def_bool y
         depends on PCI
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/3] x86: iosf: Make debugfs addition a separate config option
  2014-08-27 21:40 [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs David E. Box
                   ` (4 preceding siblings ...)
  2014-09-17  3:26 ` [PATCH 2/3] x86: iosf: Move Kconfig to proper submenu David E. Box
@ 2014-09-17  3:26 ` David E. Box
  2014-09-17 12:26   ` Ingo Molnar
  5 siblings, 1 reply; 19+ messages in thread
From: David E. Box @ 2014-09-17  3:26 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/Kconfig           | 6 ++++++
 arch/x86/kernel/iosf_mbi.c | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 2db4b1d..3afcac3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -494,6 +494,12 @@ config IOSF_MBI
 	  You should say Y if you are running a kernel on one of these
 	  platforms.
 
+config IOSF_MBI_DEBUG
+	bool "Enable debugfs access to IOSF"
+	depends on IOSF_MBI && DEBUG_FS
+	---help---
+	  Select this option to enable iosf sideband debugging through debugfs.
+
 config X86_RDC321X
 	bool "RDC R-321x SoC"
 	depends on X86_32
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index e01f741..f884ddc 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -190,7 +190,7 @@ bool iosf_mbi_available(void)
 }
 EXPORT_SYMBOL(iosf_mbi_available);
 
-/********************** debugfs begin ****************************/
+#if (IS_ENABLED(CONFIG_IOSF_MBI_DEBUG))
 static u32	dbg_mdr;
 static u32	dbg_mcr;
 static u32	dbg_mcrx;
@@ -257,7 +257,7 @@ static void iosf_sideband_debug_init(void)
 cleanup:
 	debugfs_remove_recursive(d);
 }
-/********************** debugfs end ****************************/
+#endif /* CONFIG_IOSF_MBI_DEBUG */
 
 static int iosf_mbi_probe(struct pci_dev *pdev,
 			  const struct pci_device_id *unused)
@@ -290,13 +290,17 @@ static struct pci_driver iosf_mbi_pci_driver = {
 
 static int __init iosf_mbi_init(void)
 {
+#if IS_ENABLED(CONFIG_IOSF_MBI_DEBUG)
 	iosf_sideband_debug_init();
+#endif
 	return pci_register_driver(&iosf_mbi_pci_driver);
 }
 
 static void __exit iosf_mbi_exit(void)
 {
+#if IS_ENABLED(CONFIG_IOSF_MBI_DEBUG)
 	debugfs_remove_recursive(iosf_dbg);
+#endif
 
 	pci_unregister_driver(&iosf_mbi_pci_driver);
 	if (mbi_pdev) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/3] x86: iosf: Make debugfs addition a separate config option
  2014-09-17  3:26 ` [PATCH 3/3] x86: iosf: Make debugfs addition a separate config option David E. Box
@ 2014-09-17 12:26   ` Ingo Molnar
  0 siblings, 0 replies; 19+ messages in thread
From: Ingo Molnar @ 2014-09-17 12:26 UTC (permalink / raw)
  To: David E. Box; +Cc: hpa, tglx, mingo, x86, linux-kernel


* David E. Box <david.e.box@linux.intel.com> wrote:

> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
>  arch/x86/Kconfig           | 6 ++++++
>  arch/x86/kernel/iosf_mbi.c | 8 ++++++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 2db4b1d..3afcac3 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -494,6 +494,12 @@ config IOSF_MBI
>  	  You should say Y if you are running a kernel on one of these
>  	  platforms.
>  
> +config IOSF_MBI_DEBUG
> +	bool "Enable debugfs access to IOSF"
> +	depends on IOSF_MBI && DEBUG_FS
> +	---help---
> +	  Select this option to enable iosf sideband debugging through debugfs.

Please also mention where the debug info is.

> -/********************** debugfs begin ****************************/
> +#if (IS_ENABLED(CONFIG_IOSF_MBI_DEBUG))
>  static u32	dbg_mdr;
>  static u32	dbg_mcr;
>  static u32	dbg_mcrx;
> @@ -257,7 +257,7 @@ static void iosf_sideband_debug_init(void)
>  cleanup:
>  	debugfs_remove_recursive(d);
>  }
> -/********************** debugfs end ****************************/
> +#endif /* CONFIG_IOSF_MBI_DEBUG */
>  
>  static int iosf_mbi_probe(struct pci_dev *pdev,
>  			  const struct pci_device_id *unused)
> @@ -290,13 +290,17 @@ static struct pci_driver iosf_mbi_pci_driver = {
>  
>  static int __init iosf_mbi_init(void)
>  {
> +#if IS_ENABLED(CONFIG_IOSF_MBI_DEBUG)
>  	iosf_sideband_debug_init();
> +#endif
>  	return pci_register_driver(&iosf_mbi_pci_driver);
>  }
>  
>  static void __exit iosf_mbi_exit(void)
>  {
> +#if IS_ENABLED(CONFIG_IOSF_MBI_DEBUG)
>  	debugfs_remove_recursive(iosf_dbg);
> +#endif

The last two #ifdefs are pretty ugly, please make dummy !DEBUG 
versions of those methods, so that the regular code is not 
uglified with debugging details.

Also, because COFIG_IOSF_MBI_DEBUG is a bool, using:

	#ifdef CONFIG_IOSF_MBI_DEBUG

should be enough in general.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] x86: iosf: Move Kconfig to proper submenu
  2014-09-17  3:26 ` [PATCH 2/3] x86: iosf: Move Kconfig to proper submenu David E. Box
@ 2014-09-17 12:31   ` Ingo Molnar
  0 siblings, 0 replies; 19+ messages in thread
From: Ingo Molnar @ 2014-09-17 12:31 UTC (permalink / raw)
  To: David E. Box; +Cc: hpa, tglx, mingo, x86, linux-kernel


* David E. Box <david.e.box@linux.intel.com> wrote:

> Moves Kconfig option to "Processor type and features" menu from main
> configuration menu.
> 
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
>  arch/x86/Kconfig | 29 ++++++++++++++---------------
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index bcbb57d..2db4b1d 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -480,6 +480,20 @@ config X86_INTEL_LPSS
>  	  things like clock tree (common clock framework) and pincontrol
>  	  which are needed by the LPSS peripheral drivers.
>  
> +config IOSF_MBI
> +	tristate "Intel System On Chip IOSF Sideband support"
> +	depends on PCI
> +	---help---
> +	  Enables sideband access to mailbox registers on SoC's. The sideband is
> +	  available on the following platforms. This list is not meant to be
> +	  exclusive.
> +	   - BayTrail
> +	   - Braswell
> +	   - Quark
> +
> +	  You should say Y if you are running a kernel on one of these
> +	  platforms.

What this help text does not tell us is why such sideband access 
is useful, why the user should enable it.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH V2 0/3] x86: iosf: Additions to iosf patch set
  2014-09-17  3:26 ` [PATCH 0/3] x86: iosf: Additions to iosf patch set David E. Box
@ 2014-09-18  5:13   ` David E. Box
  2014-09-18  5:13   ` [PATCH V2 1/3] x86: iosf: Add Braswell PCI ID David E. Box
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 19+ messages in thread
From: David E. Box @ 2014-09-18  5:13 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

These changes apply on top of the patches currently in Peter Anvin's tip tree.

V2:	More descriptive Kconfig prompt for IOSF_MBI and IOSF_MBI_DEBUG
	Cleaned up ifdef use on IOSF_MBI_DEBUG with DUMMY functions

David E. Box (3):
  x86: iosf: Add Braswell PCI ID
  x86: iosf: Add better description of IOSF driver in config
  x86: iosf: Add debugfs config option for iosf

 arch/x86/Kconfig           | 45 ++++++++++++++++++++++++++++++---------------
 arch/x86/kernel/iosf_mbi.c | 25 +++++++++++++++++++++----
 2 files changed, 51 insertions(+), 19 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH V2 1/3] x86: iosf: Add Braswell PCI ID
  2014-09-17  3:26 ` [PATCH 0/3] x86: iosf: Additions to iosf patch set David E. Box
  2014-09-18  5:13   ` [PATCH V2 " David E. Box
@ 2014-09-18  5:13   ` David E. Box
  2014-09-19 11:49     ` [tip:x86/platform] x86/platform/intel/iosf: " tip-bot for David E. Box
  2014-09-18  5:13   ` [PATCH V2 2/3] x86: iosf: Add better description of IOSF driver in config David E. Box
  2014-09-18  5:13   ` [PATCH V2 3/3] x86: iosf: Add debugfs config option for iosf David E. Box
  3 siblings, 1 reply; 19+ messages in thread
From: David E. Box @ 2014-09-18  5:13 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

Add Braswell PCI ID to list of supported ID's for iosf driver.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/kernel/iosf_mbi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index 0a2faa3..e01f741 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -28,6 +28,7 @@
 #include <asm/iosf_mbi.h>
 
 #define PCI_DEVICE_ID_BAYTRAIL		0x0F00
+#define PCI_DEVICE_ID_BRASWELL		0x2280
 #define PCI_DEVICE_ID_QUARK_X1000	0x0958
 
 static DEFINE_SPINLOCK(iosf_mbi_lock);
@@ -275,6 +276,7 @@ static int iosf_mbi_probe(struct pci_dev *pdev,
 
 static const struct pci_device_id iosf_mbi_pci_ids[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BRASWELL) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) },
 	{ 0, },
 };
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH V2 2/3] x86: iosf: Add better description of IOSF driver in config
  2014-09-17  3:26 ` [PATCH 0/3] x86: iosf: Additions to iosf patch set David E. Box
  2014-09-18  5:13   ` [PATCH V2 " David E. Box
  2014-09-18  5:13   ` [PATCH V2 1/3] x86: iosf: Add Braswell PCI ID David E. Box
@ 2014-09-18  5:13   ` David E. Box
  2014-09-19 11:49     ` [tip:x86/platform] x86/platform/intel/iosf: " tip-bot for David E. Box
  2014-09-18  5:13   ` [PATCH V2 3/3] x86: iosf: Add debugfs config option for iosf David E. Box
  3 siblings, 1 reply; 19+ messages in thread
From: David E. Box @ 2014-09-18  5:13 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

Adds better description of IOSF driver to determinine when it should be enabled.
Also moves the Kconfig option to "Processor type and features" menu from main
configuration menu.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/Kconfig | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index bcbb57d..b075873 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -480,6 +480,23 @@ config X86_INTEL_LPSS
 	  things like clock tree (common clock framework) and pincontrol
 	  which are needed by the LPSS peripheral drivers.
 
+config IOSF_MBI
+	tristate "Intel SoC IOSF Sideband support for SoC platforms"
+	depends on PCI
+	---help---
+	  This option enables sideband register access support for Intel SoC
+	  platforms. On these platforms the IOSF sideband is used in lieu of
+	  MSR's for some register accesses, mostly but not limited to thermal
+	  and power. Drivers may query the availability of this device to
+	  determine if they need the sideband in order to work on these
+	  platforms. The sideband is available on the following SoC products.
+	  This list is not meant to be exclusive.
+	   - BayTrail
+	   - Braswell
+	   - Quark
+
+	  You should say Y if you are running a kernel on one of these SoC's.
+
 config X86_RDC321X
 	bool "RDC R-321x SoC"
 	depends on X86_32
@@ -2443,21 +2460,6 @@ config X86_DMA_REMAP
 	bool
 	depends on STA2X11
 
-config IOSF_MBI
-	tristate "Intel System On Chip IOSF Sideband support"
-	depends on PCI
-	---help---
-	  Enables sideband access to mailbox registers on SoC's. The sideband is
-	  available on the following platforms. This list is not meant to be
-	  exclusive.
-	   - BayTrail
-	   - Cherryview
-	   - Braswell
-	   - Quark
-
-	  You should say Y if you are running a kernel on one of these
-	  platforms.
-
 config PMC_ATOM
 	def_bool y
         depends on PCI
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH V2 3/3] x86: iosf: Add debugfs config option for iosf
  2014-09-17  3:26 ` [PATCH 0/3] x86: iosf: Additions to iosf patch set David E. Box
                     ` (2 preceding siblings ...)
  2014-09-18  5:13   ` [PATCH V2 2/3] x86: iosf: Add better description of IOSF driver in config David E. Box
@ 2014-09-18  5:13   ` David E. Box
  2014-09-19 11:49     ` [tip:x86/platform] x86/platform/intel/iosf: Add debugfs config option for IOSF tip-bot for David E. Box
  3 siblings, 1 reply; 19+ messages in thread
From: David E. Box @ 2014-09-18  5:13 UTC (permalink / raw)
  To: hpa, tglx, mingo; +Cc: x86, linux-kernel

Makes the iosf sideband available through debugfs. Allows developers to
experiment with using the sideband to provide debug and analytical tools for
units on the SoC.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 arch/x86/Kconfig           | 13 +++++++++++++
 arch/x86/kernel/iosf_mbi.c | 23 +++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b075873..39489d6 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -497,6 +497,19 @@ config IOSF_MBI
 
 	  You should say Y if you are running a kernel on one of these SoC's.
 
+config IOSF_MBI_DEBUG
+	bool "Enable IOSF sideband access through debugfs"
+	depends on IOSF_MBI && DEBUG_FS
+	---help---
+	  Select this option to expose the IOSF sideband access registers (MCR,
+	  MDR, MCRX) through debugfs to write and read register information from
+	  different units on the SoC. This is most useful for obtaining device
+	  state information for debug and analysis. As this is a general access
+	  mechanism, users of this option would have specific knowledge of the
+	  device they want to access.
+
+	  If you don't require the option or are in doubt, say N.
+
 config X86_RDC321X
 	bool "RDC R-321x SoC"
 	depends on X86_32
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index e01f741..82f8d02 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -190,7 +190,7 @@ bool iosf_mbi_available(void)
 }
 EXPORT_SYMBOL(iosf_mbi_available);
 
-/********************** debugfs begin ****************************/
+#ifdef CONFIG_IOSF_MBI_DEBUG
 static u32	dbg_mdr;
 static u32	dbg_mcr;
 static u32	dbg_mcrx;
@@ -229,6 +229,7 @@ static int mcr_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(iosf_mcr_fops, mcr_get, mcr_set , "%llx\n");
 
 static struct dentry *iosf_dbg;
+
 static void iosf_sideband_debug_init(void)
 {
 	struct dentry *d;
@@ -257,7 +258,20 @@ static void iosf_sideband_debug_init(void)
 cleanup:
 	debugfs_remove_recursive(d);
 }
-/********************** debugfs end ****************************/
+
+static void iosf_debugfs_init(void)
+{
+	iosf_sideband_debug_init();
+}
+
+static void iosf_debugfs_remove(void)
+{
+	debugfs_remove_recursive(iosf_dbg);
+}
+#else
+static inline void iosf_debugfs_init(void) { }
+static inline void iosf_debugfs_remove(void) { }
+#endif /* CONFIG_IOSF_MBI_DEBUG */
 
 static int iosf_mbi_probe(struct pci_dev *pdev,
 			  const struct pci_device_id *unused)
@@ -290,13 +304,14 @@ static struct pci_driver iosf_mbi_pci_driver = {
 
 static int __init iosf_mbi_init(void)
 {
-	iosf_sideband_debug_init();
+	iosf_debugfs_init();
+
 	return pci_register_driver(&iosf_mbi_pci_driver);
 }
 
 static void __exit iosf_mbi_exit(void)
 {
-	debugfs_remove_recursive(iosf_dbg);
+	iosf_debugfs_remove();
 
 	pci_unregister_driver(&iosf_mbi_pci_driver);
 	if (mbi_pdev) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [tip:x86/platform] x86/platform/intel/iosf: Add Braswell PCI ID
  2014-09-18  5:13   ` [PATCH V2 1/3] x86: iosf: Add Braswell PCI ID David E. Box
@ 2014-09-19 11:49     ` tip-bot for David E. Box
  0 siblings, 0 replies; 19+ messages in thread
From: tip-bot for David E. Box @ 2014-09-19 11:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, david.e.box, tglx

Commit-ID:  849f5d894383d25c49132437aa289c9a9c98d5df
Gitweb:     http://git.kernel.org/tip/849f5d894383d25c49132437aa289c9a9c98d5df
Author:     David E. Box <david.e.box@linux.intel.com>
AuthorDate: Wed, 17 Sep 2014 22:13:49 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 19 Sep 2014 13:08:42 +0200

x86/platform/intel/iosf: Add Braswell PCI ID

Add Braswell PCI ID to list of supported ID's for the IOSF driver.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1411017231-20807-2-git-send-email-david.e.box@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/iosf_mbi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index 0a2faa3..e01f741 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -28,6 +28,7 @@
 #include <asm/iosf_mbi.h>
 
 #define PCI_DEVICE_ID_BAYTRAIL		0x0F00
+#define PCI_DEVICE_ID_BRASWELL		0x2280
 #define PCI_DEVICE_ID_QUARK_X1000	0x0958
 
 static DEFINE_SPINLOCK(iosf_mbi_lock);
@@ -275,6 +276,7 @@ static int iosf_mbi_probe(struct pci_dev *pdev,
 
 static const struct pci_device_id iosf_mbi_pci_ids[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BRASWELL) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) },
 	{ 0, },
 };

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [tip:x86/platform] x86/platform/intel/iosf: Add better description of IOSF driver in config
  2014-09-18  5:13   ` [PATCH V2 2/3] x86: iosf: Add better description of IOSF driver in config David E. Box
@ 2014-09-19 11:49     ` tip-bot for David E. Box
  0 siblings, 0 replies; 19+ messages in thread
From: tip-bot for David E. Box @ 2014-09-19 11:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, david.e.box, tglx

Commit-ID:  ced3ce760b8df08e8bafba44f6b40407df2d0402
Gitweb:     http://git.kernel.org/tip/ced3ce760b8df08e8bafba44f6b40407df2d0402
Author:     David E. Box <david.e.box@linux.intel.com>
AuthorDate: Wed, 17 Sep 2014 22:13:50 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 19 Sep 2014 13:08:42 +0200

x86/platform/intel/iosf: Add better description of IOSF driver in config

Adds better description of IOSF driver to determine when it
should be enabled. Also moves the Kconfig option to "Processor
type and features" menu from main configuration menu.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1411017231-20807-3-git-send-email-david.e.box@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/Kconfig | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a99988f..d6334f4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -479,6 +479,23 @@ config X86_INTEL_LPSS
 	  things like clock tree (common clock framework) and pincontrol
 	  which are needed by the LPSS peripheral drivers.
 
+config IOSF_MBI
+	tristate "Intel SoC IOSF Sideband support for SoC platforms"
+	depends on PCI
+	---help---
+	  This option enables sideband register access support for Intel SoC
+	  platforms. On these platforms the IOSF sideband is used in lieu of
+	  MSR's for some register accesses, mostly but not limited to thermal
+	  and power. Drivers may query the availability of this device to
+	  determine if they need the sideband in order to work on these
+	  platforms. The sideband is available on the following SoC products.
+	  This list is not meant to be exclusive.
+	   - BayTrail
+	   - Braswell
+	   - Quark
+
+	  You should say Y if you are running a kernel on one of these SoC's.
+
 config X86_RDC321X
 	bool "RDC R-321x SoC"
 	depends on X86_32
@@ -2432,21 +2449,6 @@ config X86_DMA_REMAP
 	bool
 	depends on STA2X11
 
-config IOSF_MBI
-	tristate "Intel System On Chip IOSF Sideband support"
-	depends on PCI
-	---help---
-	  Enables sideband access to mailbox registers on SoC's. The sideband is
-	  available on the following platforms. This list is not meant to be
-	  exclusive.
-	   - BayTrail
-	   - Cherryview
-	   - Braswell
-	   - Quark
-
-	  You should say Y if you are running a kernel on one of these
-	  platforms.
-
 config PMC_ATOM
 	def_bool y
         depends on PCI

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [tip:x86/platform] x86/platform/intel/iosf: Add debugfs config option for IOSF
  2014-09-18  5:13   ` [PATCH V2 3/3] x86: iosf: Add debugfs config option for iosf David E. Box
@ 2014-09-19 11:49     ` tip-bot for David E. Box
  0 siblings, 0 replies; 19+ messages in thread
From: tip-bot for David E. Box @ 2014-09-19 11:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, david.e.box, tglx

Commit-ID:  ed2226bd4d4a53bcc3b2ea0b1b28e955ebc15da7
Gitweb:     http://git.kernel.org/tip/ed2226bd4d4a53bcc3b2ea0b1b28e955ebc15da7
Author:     David E. Box <david.e.box@linux.intel.com>
AuthorDate: Wed, 17 Sep 2014 22:13:51 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 19 Sep 2014 13:08:43 +0200

x86/platform/intel/iosf: Add debugfs config option for IOSF

Makes the IOSF sideband available through debugfs. Allows
developers to experiment with using the sideband to provide
debug and analytical tools for units on the SoC.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1411017231-20807-4-git-send-email-david.e.box@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/Kconfig           | 13 +++++++++++++
 arch/x86/kernel/iosf_mbi.c | 23 +++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d6334f4..6354964 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -496,6 +496,19 @@ config IOSF_MBI
 
 	  You should say Y if you are running a kernel on one of these SoC's.
 
+config IOSF_MBI_DEBUG
+	bool "Enable IOSF sideband access through debugfs"
+	depends on IOSF_MBI && DEBUG_FS
+	---help---
+	  Select this option to expose the IOSF sideband access registers (MCR,
+	  MDR, MCRX) through debugfs to write and read register information from
+	  different units on the SoC. This is most useful for obtaining device
+	  state information for debug and analysis. As this is a general access
+	  mechanism, users of this option would have specific knowledge of the
+	  device they want to access.
+
+	  If you don't require the option or are in doubt, say N.
+
 config X86_RDC321X
 	bool "RDC R-321x SoC"
 	depends on X86_32
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index e01f741..82f8d02 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -190,7 +190,7 @@ bool iosf_mbi_available(void)
 }
 EXPORT_SYMBOL(iosf_mbi_available);
 
-/********************** debugfs begin ****************************/
+#ifdef CONFIG_IOSF_MBI_DEBUG
 static u32	dbg_mdr;
 static u32	dbg_mcr;
 static u32	dbg_mcrx;
@@ -229,6 +229,7 @@ static int mcr_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(iosf_mcr_fops, mcr_get, mcr_set , "%llx\n");
 
 static struct dentry *iosf_dbg;
+
 static void iosf_sideband_debug_init(void)
 {
 	struct dentry *d;
@@ -257,7 +258,20 @@ static void iosf_sideband_debug_init(void)
 cleanup:
 	debugfs_remove_recursive(d);
 }
-/********************** debugfs end ****************************/
+
+static void iosf_debugfs_init(void)
+{
+	iosf_sideband_debug_init();
+}
+
+static void iosf_debugfs_remove(void)
+{
+	debugfs_remove_recursive(iosf_dbg);
+}
+#else
+static inline void iosf_debugfs_init(void) { }
+static inline void iosf_debugfs_remove(void) { }
+#endif /* CONFIG_IOSF_MBI_DEBUG */
 
 static int iosf_mbi_probe(struct pci_dev *pdev,
 			  const struct pci_device_id *unused)
@@ -290,13 +304,14 @@ static struct pci_driver iosf_mbi_pci_driver = {
 
 static int __init iosf_mbi_init(void)
 {
-	iosf_sideband_debug_init();
+	iosf_debugfs_init();
+
 	return pci_register_driver(&iosf_mbi_pci_driver);
 }
 
 static void __exit iosf_mbi_exit(void)
 {
-	debugfs_remove_recursive(iosf_dbg);
+	iosf_debugfs_remove();
 
 	pci_unregister_driver(&iosf_mbi_pci_driver);
 	if (mbi_pdev) {

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-09-19 11:50 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-27 21:40 [PATCH 0/2] x86: iosf: change Kconfig selection and add debugfs David E. Box
2014-08-27 21:40 ` [PATCH 1/2] x86: iosf: Add Kconfig prompt for IOSF_MBI selection David E. Box
2014-09-02 21:07   ` [tip:x86/platform] x86/iosf: " tip-bot for David E. Box
2014-08-27 21:40 ` [PATCH 2/2] x86: iosf: Add debugfs support David E. Box
2014-08-27 22:20   ` H. Peter Anvin
2014-09-02 21:07   ` [tip:x86/platform] x86/iosf: " tip-bot for David E. Box
2014-09-17  3:26 ` [PATCH 0/3] x86: iosf: Additions to iosf patch set David E. Box
2014-09-18  5:13   ` [PATCH V2 " David E. Box
2014-09-18  5:13   ` [PATCH V2 1/3] x86: iosf: Add Braswell PCI ID David E. Box
2014-09-19 11:49     ` [tip:x86/platform] x86/platform/intel/iosf: " tip-bot for David E. Box
2014-09-18  5:13   ` [PATCH V2 2/3] x86: iosf: Add better description of IOSF driver in config David E. Box
2014-09-19 11:49     ` [tip:x86/platform] x86/platform/intel/iosf: " tip-bot for David E. Box
2014-09-18  5:13   ` [PATCH V2 3/3] x86: iosf: Add debugfs config option for iosf David E. Box
2014-09-19 11:49     ` [tip:x86/platform] x86/platform/intel/iosf: Add debugfs config option for IOSF tip-bot for David E. Box
2014-09-17  3:26 ` [PATCH 1/3] x86: iosf: Add Braswell PCI ID David E. Box
2014-09-17  3:26 ` [PATCH 2/3] x86: iosf: Move Kconfig to proper submenu David E. Box
2014-09-17 12:31   ` Ingo Molnar
2014-09-17  3:26 ` [PATCH 3/3] x86: iosf: Make debugfs addition a separate config option David E. Box
2014-09-17 12:26   ` Ingo Molnar

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).