Skip to contentSkip to conversation

x86: iosf: change Kconfig selection and add debugfs

PATCH In review David E. Box 4 participants 19 messages Aug 27, 2014 – Sep 19, 2014 x86

lore
Share & tools
lore
#0 lore raw

cover x86: iosf: change Kconfig selection and add debugfs

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(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 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.

---
 arch/x86/Kconfig | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
arch/x86/Kconfig +12 -2
index d24887b..e07e2a5 100644
@@ -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"
 
Signature · 1 line
1.9.1
#2 lore raw

[tip:x86/platform] x86/iosf: Add Kconfig prompt for IOSF_MBI selection

x86/iosf: Add Kconfig prompt for IOSF_MBI selection
Commit-ID:  aa8e4f22ab7773352ba3895597189b8097f2c307
Gitweb:     http://git.kernel.org/tip/aa8e4f22ab7773352ba3895597189b8097f2c307
Author:     David E. Box <[email protected]>
AuthorDate: Wed, 27 Aug 2014 14:40:39 -0700
Committer:  H. Peter Anvin <[email protected]>
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.

---
 arch/x86/Kconfig | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
arch/x86/Kconfig +12 -2
index 5d0bf1a..a99988f 100644
@@ -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
#3 lore raw

PATCH 2/2 x86: iosf: Add debugfs support

In reply to David E. Box

Allows access to the iosf sideband through debugfs.

---
 arch/x86/kernel/iosf_mbi.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
arch/x86/kernel/iosf_mbi.c +74 -0
index d30acdc..bf848ca 100644
@@ -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);
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH 2/2] x86: iosf: Add debugfs support

Quoted 1 line · David E. Box

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

#5 lore raw

[tip:x86/platform] x86/iosf: Add debugfs support

In reply to David E. Box
x86/iosf: Add debugfs support
Commit-ID:  8dc12f933c9d732c5bbfb233daf27377893b109c
Gitweb:     http://git.kernel.org/tip/8dc12f933c9d732c5bbfb233daf27377893b109c
Author:     David E. Box <[email protected]>
AuthorDate: Wed, 27 Aug 2014 14:40:40 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Wed, 27 Aug 2014 14:48:36 -0700

x86/iosf: Add debugfs support

Allows access to the iosf sideband through debugfs.

---
 arch/x86/kernel/iosf_mbi.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
arch/x86/kernel/iosf_mbi.c +74 -0
index 9030e83..0a2faa3 100644
@@ -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);
#6 lore raw

cover x86: iosf: Additions to iosf patch set

In reply to David E. Box

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(-)
Signature · 1 line
1.9.1
#7 lore raw

PATCH 1/3 x86: iosf: Add Braswell PCI ID

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

---
 arch/x86/kernel/iosf_mbi.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/iosf_mbi.c +2 -0
index 0a2faa3..e01f741 100644
@@ -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, },
 };
Signature · 1 line
1.9.1
#8 lore raw

PATCH 2/3 x86: iosf: Move Kconfig to proper submenu

In reply to David E. Box

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

---
 arch/x86/Kconfig | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
arch/x86/Kconfig +14 -15
index bcbb57d..2db4b1d 100644
@@ -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
Signature · 1 line
1.9.1
#9 lore raw

Re: [PATCH 2/3] x86: iosf: Move Kconfig to proper submenu

Quoted 19 lines · David E. Box

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

---
 arch/x86/Kconfig | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
arch/x86/Kconfig +3 -0
index bcbb57d..2db4b1d 100644
@@ -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

arch/x86/Kconfig config X86_INTEL_LPSS · line 495

Quoted 10 lines
arch/x86/Kconfig +10 -0
+	---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

#10 lore raw

PATCH 3/3 x86: iosf: Make debugfs addition a separate config option

In reply to David E. Box
---
 arch/x86/Kconfig           | 6 ++++++
 arch/x86/kernel/iosf_mbi.c | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
arch/x86/Kconfig +6 -0
index 2db4b1d..3afcac3 100644
@@ -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
arch/x86/kernel/iosf_mbi.c +6 -2
index e01f741..f884ddc 100644
@@ -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) {
Signature · 1 line
1.9.1
#11 lore raw

Re: [PATCH 3/3] x86: iosf: Make debugfs addition a separate config option

Quoted 11 lines · David E. Box
---
 arch/x86/Kconfig           | 6 ++++++
 arch/x86/kernel/iosf_mbi.c | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
arch/x86/Kconfig +0 -0
index 2db4b1d..3afcac3 100644

arch/x86/Kconfig config IOSF_MBI · line 501

Quoted 8 lines
arch/x86/Kconfig +5 -0
@@ -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.

Quoted 19 lines
arch/x86/Kconfig +3 -2
-/********************** 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)

arch/x86/Kconfig static struct pci_driver iosf_mbi_pci_driver = { · line 303

Quoted 10 lines
arch/x86/Kconfig +3 -0
 	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

#12 lore raw

v2 cover x86: iosf: Additions to iosf patch set

In reply to David E. Box

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(-)
Signature · 1 line
1.9.1
#13 lore raw

PATCH v2 1/3 x86: iosf: Add Braswell PCI ID

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

---
 arch/x86/kernel/iosf_mbi.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/iosf_mbi.c +2 -0
index 0a2faa3..e01f741 100644
@@ -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, },
 };
Signature · 1 line
1.9.1
#14 lore raw

[tip:x86/platform] x86/platform/intel/iosf: Add Braswell PCI ID

x86/platform/intel/iosf: Add Braswell PCI ID
Commit-ID:  849f5d894383d25c49132437aa289c9a9c98d5df
Gitweb:     http://git.kernel.org/tip/849f5d894383d25c49132437aa289c9a9c98d5df
Author:     David E. Box <[email protected]>
AuthorDate: Wed, 17 Sep 2014 22:13:49 -0700
Committer:  Ingo Molnar <[email protected]>
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.

---
 arch/x86/kernel/iosf_mbi.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/iosf_mbi.c +2 -0
index 0a2faa3..e01f741 100644
@@ -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, },
 };
#15 lore raw

PATCH v2 2/3 x86: iosf: Add better description of IOSF driver in config

In reply to David E. Box

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.

---
 arch/x86/Kconfig | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
arch/x86/Kconfig +17 -15
index bcbb57d..b075873 100644
@@ -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
Signature · 1 line
1.9.1
#16 lore raw

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

x86/platform/intel/iosf: Add better description of IOSF driver in config
Commit-ID:  ced3ce760b8df08e8bafba44f6b40407df2d0402
Gitweb:     http://git.kernel.org/tip/ced3ce760b8df08e8bafba44f6b40407df2d0402
Author:     David E. Box <[email protected]>
AuthorDate: Wed, 17 Sep 2014 22:13:50 -0700
Committer:  Ingo Molnar <[email protected]>
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.

---
 arch/x86/Kconfig | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
arch/x86/Kconfig +17 -15
index a99988f..d6334f4 100644
@@ -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
#17 lore raw

PATCH v2 3/3 x86: iosf: Add debugfs config option for iosf

In reply to David E. Box

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.

---
 arch/x86/Kconfig           | 13 +++++++++++++
 arch/x86/kernel/iosf_mbi.c | 23 +++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)
arch/x86/Kconfig +13 -0
index b075873..39489d6 100644
@@ -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
arch/x86/kernel/iosf_mbi.c +19 -4
index e01f741..82f8d02 100644
@@ -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) {
Signature · 1 line
1.9.1
#18 lore raw

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

x86/platform/intel/iosf: Add debugfs config option for IOSF
Commit-ID:  ed2226bd4d4a53bcc3b2ea0b1b28e955ebc15da7
Gitweb:     http://git.kernel.org/tip/ed2226bd4d4a53bcc3b2ea0b1b28e955ebc15da7
Author:     David E. Box <[email protected]>
AuthorDate: Wed, 17 Sep 2014 22:13:51 -0700
Committer:  Ingo Molnar <[email protected]>
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.

---
 arch/x86/Kconfig           | 13 +++++++++++++
 arch/x86/kernel/iosf_mbi.c | 23 +++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)
arch/x86/Kconfig +13 -0
index d6334f4..6354964 100644
@@ -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
arch/x86/kernel/iosf_mbi.c +19 -4
index e01f741..82f8d02 100644
@@ -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) {