x86: iosf_mbi: Provide dummy functions if CONFIG_IOSF_MBI not set
PATCH 1/1 x86: iosf_mbi: Provide dummy functions if CONFIG_IOSF_MBI not set
From: "David E. Box" <[email protected]>
Add iosf_mbi_available function for loadable modules.
Add dummy functions to prevent symbol lookup errors on loadable modules. Clarify that the write opcode is to be used for iosf_mbi_modify(). Changes Kconfig for IOSF_MBI to default built-in.
--- arch/x86/Kconfig | 2 +- arch/x86/include/asm/iosf_mbi.h | 39 +++++++++++++++++++++++++++++++++++---- arch/x86/kernel/iosf_mbi.c | 6 ++++++ 3 files changed, 42 insertions(+), 5 deletions(-)
arch/x86/Kconfig +1 -1
@@ -2385,7 +2385,7 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + def_bool y depends on PCI ---help--- To be selected by modules requiring access to the Intel OnChip System
arch/x86/include/asm/iosf_mbi.h +35 -4
@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8
@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +extern bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed
@@ -60,7 +64,7 @@* Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr); +extern int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr);/** * iosf_mbi_write() - MailBox unmasked write command
@@ -72,19 +76,46 @@ int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr);* Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr); +extern int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr);/** * iosf_mbi_modify() - MailBox masked write command * @port: port indicating subunit being accessed -* @opcode: port specific read or write opcode +* @opcode: port specific write opcode * @offset: register address offset * @mdr: register data being modified * @mask: mask indicating bits in mdr to be modified * +* Use write opcode for this function. * Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +extern int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); + +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +return 0 ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +return 0 ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +return 0 ; +} +#endif /* CONFIG_IOSF_MBI */ #endif /* IOSF_MBI_SYMS_H */
arch/x86/kernel/iosf_mbi.c +6 -0
@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Signature · 1 line
1.7.10.4
PATCH RESEND 1/1 x86: iosf_mbi: Provide dummy functions if CONFIG_IOSF_MBI not set
From: "David E. Box" <[email protected]>
Add iosf_mbi_available function for loadable modules.
Add dummy functions to prevent symbol lookup errors on loadable modules. Clarify that the write opcode is to be used for iosf_mbi_modify(). Changes Kconfig for IOSF_MBI to default built-in.
--- arch/x86/Kconfig | 2 +- arch/x86/include/asm/iosf_mbi.h | 39 +++++++++++++++++++++++++++++++++++---- arch/x86/kernel/iosf_mbi.c | 6 ++++++ 3 files changed, 42 insertions(+), 5 deletions(-)
arch/x86/Kconfig +1 -1
@@ -2385,7 +2385,7 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + def_bool y depends on PCI ---help--- To be selected by modules requiring access to the Intel OnChip System
arch/x86/include/asm/iosf_mbi.h +35 -4
@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8
@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +extern bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed
@@ -60,7 +64,7 @@* Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr); +extern int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr);/** * iosf_mbi_write() - MailBox unmasked write command
@@ -72,19 +76,46 @@ int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr);* Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr); +extern int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr);/** * iosf_mbi_modify() - MailBox masked write command * @port: port indicating subunit being accessed -* @opcode: port specific read or write opcode +* @opcode: port specific write opcode * @offset: register address offset * @mdr: register data being modified * @mask: mask indicating bits in mdr to be modified * +* Use write opcode for this function. * Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +extern int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); + +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +return 0 ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +return 0 ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +return 0 ; +} +#endif /* CONFIG_IOSF_MBI */ #endif /* IOSF_MBI_SYMS_H */
arch/x86/kernel/iosf_mbi.c +6 -0
@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Signature · 1 line
1.7.10.4
Quoted 6 lines · On Sat, 22 Feb 2014 17:02:32 -0800 "David E. Box"…
From: "David E. Box" <[email protected]>
Add
iosf_mbi_availablefunction for loadable modules.
Add dummy functions to prevent symbol lookup errors on loadable modules. Clarify that the write opcode is to be used foriosf_mbi_modify(). ChangesKconfigforIOSF_MBIto default built-in.
Other than _available I would have expected all the others to resolve to returning an error or doing a WARN() in the not compiled in case.
If someone is dumb enough to miss the checks we want the kernel to spew forth copious announcements of the fact, not silently do nothing.
Alan
H. Peter Anvin
reviewerQuoted 4 lines · One Thousand Gnomes
Other than
_availableI would have expected all the others to resolve to returning an error or doing aWARN()in the not compiled in case.
WARN() or BUG()?
-hpa
Quoted 7 lines · On Mon, 24 Feb 2014 05:21:43 -0800 "H. Peter Anvin" <[email protected]> wrote:
Quoted 4 lines · One Thousand Gnomes
Other than
_availableI would have expected all the others to resolve to returning an error or doing aWARN()in the not compiled in case.
WARN()orBUG()?
WARN I think. The usage cases I am aware of don't end up in catastrophic failure if you get this wrong, but would be annoying to debug if missed.
Alan
v2 cover x86: IOSF: Add loadable module support
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
This patch series adds missing functionalty that mostly affected loadable modules.
The first patch adds dummy functions to allow drivers not completely dependant on the IOSF MBI driver to compile on systems that don't have it.
The second ensures the availabilty of the MBI driver in the kernel, limiting the possibility of requiring a rebuild when new modules needing the MBI are added.
Changes from V1:
- Force default y for non-EXPERT to allow easier custom configuration as suggested by hpa <[email protected]>
- Add WARN() to dummy functions, other than iosf_mbi_available(), to signal incorrect use as suggested by Alan <[email protected]> Also return EPERM in these functions
- Splits single patch into two patch series
David E. Box (2):
x86: IOSF: add dummy functions for loadable modules
x86: IOSF: Change IOSF_MBI Kconfig to default y
arch/x86/Kconfig | 5 +++-- arch/x86/include/asm/iosf_mbi.h | 39 ++++++++++++++++++++++++++++++++++++--- arch/x86/kernel/iosf_mbi.c | 6 ++++++ 3 files changed, 45 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v2 1/2 x86: IOSF: add dummy functions for loadable modules
From: "David E. Box" <[email protected]>
Some loadable modules only need IOSF access on the platforms where it exists. Provide dummy functions to allow these modules to compile and load on the platforms where it doesn't exist.
--- arch/x86/include/asm/iosf_mbi.h | 39 ++++++++++++++++++++++++++++++++++++--- arch/x86/kernel/iosf_mbi.c | 6 ++++++ 2 files changed, 42 insertions(+), 3 deletions(-)
arch/x86/include/asm/iosf_mbi.h +36 -3
@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8
@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +extern bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed
@@ -60,7 +64,7 @@* Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr); +extern int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr);/** * iosf_mbi_write() - MailBox unmasked write command
@@ -72,7 +76,7 @@ int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr);* Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr); +extern int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr);/** * iosf_mbi_modify() - MailBox masked write command
@@ -85,6 +89,35 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);* Locking is handled by spinlock - cannot sleep. * Return: Nonzero on error */ -int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +extern int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); + +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +WARN (); +return -EPERM ; +} +#endif /* CONFIG_IOSF_MBI */ #endif /* IOSF_MBI_SYMS_H */
arch/x86/kernel/iosf_mbi.c +6 -0
@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Signature · 1 line
1.7.10.4
PATCH v2 2/2 x86: IOSF: Change IOSF_MBI Kconfig to default y
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
The IOSF Mailbox interface is an access mechanism used by multiple drivers to communicate with key configuration registers on new Intel SOC platforms. The interface is ubiquitous enough that we need to ensure the availability of the driver in non-EXPERT x86 kernels.
--- arch/x86/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/Kconfig +3 -2
@@ -2385,11 +2385,12 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + bool "IOSF MBI support" if EXPERT + default y depends on PCI ---help--- To be selected by modules requiring access to the Intel OnChip System - Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms + Fabric (IOSF) Sideband MailBox Interface (MBI). For IOSF platforms enumerable by PCI. source "net/Kconfig"
Signature · 1 line
1.7.10.4
tip-bot for David E. Box
merge bot[tip:x86/platform] x86, iosf: Change IOSF_MBI Kconfig to default y
x86, iosf: Change IOSF_MBI Kconfig to default y
Commit-ID: 0fd9bdfa3b7698e30d2fbc4a029ded0f3428cf10 Gitweb: http://git.kernel.org/tip/0fd9bdfa3b7698e30d2fbc4a029ded0f3428cf10 Author: David E. Box <[email protected]> AuthorDate: Mon, 24 Feb 2014 18:47:22 -0800 Committer: H. Peter Anvin <[email protected]> CommitDate: Fri, 28 Feb 2014 19:56:13 -0800
x86, iosf: Change IOSF_MBI Kconfig to default y
The IOSF Mailbox interface is an access mechanism used by multiple drivers to communicate with key configuration registers on new Intel SOC platforms. The interface is ubiquitous enough that we need to ensure the availability of the driver in non-EXPERT x86 kernels.
[ hpa: I think it makes sense to build these in unless EXPERT is set,
in which case it should be optional. Ideally the IOSF driver should be possible to build as a module on which other modules can depend, but that can be done on top of this work. ]
--- arch/x86/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/Kconfig +3 -2
@@ -2413,11 +2413,12 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + bool "IOSF MBI support" if EXPERT + default y depends on PCI ---help--- To be selected by modules requiring access to the Intel OnChip System - Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms + Fabric (IOSF) Sideband MailBox Interface (MBI). For IOSF platforms enumerable by PCI. source "net/Kconfig"
v3 cover x86: IOSF: Add loadable module support
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
This patch series adds missing functionalty that mostly affected loadable modules.
The first patch adds dummy functions to allow drivers not completely dependant on the IOSF MBI driver to compile on systems that don't have it.
The second ensures the availabilty of the MBI driver in the kernel, limiting the possibility of requiring a rebuild when new modules needing the MBI are added.
Changes from V2:
- Remove non linux style externs from iosf_mbi.h
Changes from V1:
- Force default y for non-EXPERT to allow easier custom configuration as suggested by hpa <[email protected]>
- Add WARN() to dummy functions, other than iosf_mbi_available(), to signal incorrect use as suggested by Alan <[email protected]> Also return EPERM in these functions
- Splits single patch into two patch series
David E. Box (2):
x86: IOSF: add dummy functions for loadable modules
x86: IOSF: Change IOSF_MBI Kconfig to default y
arch/x86/Kconfig | 5 +++-- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 3 files changed, 42 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v3 1/2 x86: IOSF: add dummy functions for loadable modules
From: "David E. Box" <[email protected]>
Some loadable modules only need IOSF access on the platforms where it exists. Provide dummy functions to allow these modules to compile and load on the platforms where it doesn't exist.
--- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 2 files changed, 39 insertions(+)
arch/x86/include/asm/iosf_mbi.h +33 -0
@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8
@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed
@@ -87,4 +91,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);*/ int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +WARN (); +return -EPERM ; +} +#endif /* CONFIG_IOSF_MBI */ +#endif /* IOSF_MBI_SYMS_H */
arch/x86/kernel/iosf_mbi.c +6 -0
@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Signature · 1 line
1.7.10.4
PATCH v3 2/2 x86: IOSF: Change IOSF_MBI Kconfig to default y
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
The IOSF Mailbox interface is an access mechanism used by multiple drivers to communicate with key configuration registers on new Intel SOC platforms. The interface is ubiquitous enough that we need to ensure the availability of the driver in non-EXPERT configured x86 kernels.
--- arch/x86/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/Kconfig +3 -2
@@ -2385,11 +2385,12 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + bool "IOSF MBI support" if EXPERT + default y depends on PCI ---help--- To be selected by modules requiring access to the Intel OnChip System - Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms + Fabric (IOSF) Sideband MailBox Interface (MBI). For IOSF platforms enumerable by PCI. source "net/Kconfig"
Signature · 1 line
1.7.10.4
H. Peter Anvin
reviewerRe: [PATCH V3 2/2] x86: IOSF: Change IOSF_MBI Kconfig to default y
Quoted 8 lines · David E. Box
From: "David E. Box" <[email protected]>
The IOSF Mailbox interface is an access mechanism used by multiple drivers to communicate with key configuration registers on new Intel SOC platforms. The interface is ubiquitous enough that we need to ensure the availability of the driver in non-EXPERT configured x86 kernels.
Signed-off-by David E. Box <[email protected]>
Hi David,
Could you please update the patch description to explain to people who may not be familiar why the IOSF driver can't be a module?
-hpa
PATCH RESEND v3 2/2 x86: IOSF: Change IOSF_MBI Kconfig to default y
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
The IOSF Mailbox interface is an access mechanism used by drivers to communicate with the configuration registers of devices connected on the fabric of Intel SOC platforms. The interface is ubiquitous enough that we need to ensure the availability of the driver in non-EXPERT configured x86 kernels. Make the module built-in so drivers can access device registers that need configuration during early boot.
--- arch/x86/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/Kconfig +3 -2
@@ -2385,11 +2385,12 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + bool "IOSF MBI support" if EXPERT + default y depends on PCI ---help--- To be selected by modules requiring access to the Intel OnChip System - Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms + Fabric (IOSF) Sideband MailBox Interface (MBI). For IOSF platforms enumerable by PCI. source "net/Kconfig"
Signature · 1 line
1.7.10.4
v4 cover x86: IOSF: Add loadable module support
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
This patch series adds missing functionalty that mostly affected loadable modules.
The first patch adds dummy functions to allow drivers not completely dependant on the IOSF MBI driver to compile on systems that don't have it.
The second makes MBI driver built in.
Changes from V3:
- Code is agreed to be small enough to not warrant forcing for non-EXPERT only
Changes from V2:
- Remove non linux style externs from iosf_mbi.h
Changes from V1:
- Force default y for non-EXPERT to allow easier custom configuration as suggested by hpa <[email protected]>
- Add WARN() to dummy functions, other than iosf_mbi_available(), to signal incorrect use as suggested by Alan <[email protected]> Also return EPERM in these functions
- Splits single patch into two patch series
David E. Box (2):
x86: IOSF: add dummy functions for loadable modules
x86: IOSF: Change IOSF_MBI Kconfig to default y
arch/x86/Kconfig | 6 +----- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 3 files changed, 40 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v4 1/2 x86: IOSF: add dummy functions for loadable modules
From: "David E. Box" <[email protected]>
Some loadable modules only need IOSF access on the platforms where it exists. Provide dummy functions to allow these modules to compile and load on the platforms where it doesn't exist.
--- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 2 files changed, 39 insertions(+)
arch/x86/include/asm/iosf_mbi.h +33 -0
@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8
@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed
@@ -87,4 +91,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);*/ int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +WARN (); +return -EPERM ; +} +#endif /* CONFIG_IOSF_MBI */ +#endif /* IOSF_MBI_SYMS_H */
arch/x86/kernel/iosf_mbi.c +6 -0
@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Signature · 1 line
1.7.10.4
PATCH v4 2/2 x86: IOSF: Change IOSF_MBI Kconfig to default y
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
Make the IOSF Mailbox driver built in as it's a very small piece of code that provides core functionality needed for new Intel SOC platforms to access the device registers on the SOC.
--- arch/x86/Kconfig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/x86/Kconfig +1 -5
@@ -2385,12 +2385,8 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + def_bool y depends on PCI - ---help--- - To be selected by modules requiring access to the Intel OnChip System - Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms - enumerable by PCI. source "net/Kconfig"
Signature · 1 line
1.7.10.4
H. Peter Anvin
reviewerRe: [PATCH V4 0/2] x86: IOSF: Add loadable module support
In reply to David E. BoxQuoted 6 lines · David E. Box
Changes from V3:
- Code is agreed to be small enough to not warrant forcing for non-EXPERT only
Did I miss part of the discussion? How small is "small"?
-hpa
v5 cover x86: IOSF: Add loadable module support
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
This patch series adds missing functionalty that mostly affected loadable modules.
The first patch adds dummy functions to allow drivers not completely dependant on the IOSF MBI driver to compile on systems that don't have it.
The second makes MBI driver built in.
Changes from V4:
- Put back Kconfig prompt for IOSF_MBI.
Changes from V3:
- Code is agreed to be small enough to not warrant forcing for non-EXPERT only
Changes from V2:
- Remove non linux style externs from iosf_mbi.h
Changes from V1:
- Force default y for non-EXPERT to allow easier custom configuration as suggested by hpa <[email protected]>
- Add WARN() to dummy functions, other than iosf_mbi_available(), to signal incorrect use as suggested by Alan <[email protected]> Also return EPERM in these functions
- Splits single patch into two patch series
David E. Box (2):
x86: IOSF: add dummy functions for loadable modules
x86: IOSF: Change IOSF_MBI Kconfig to default y
arch/x86/Kconfig | 7 ++----- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 3 files changed, 41 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v5 1/2 x86: IOSF: add dummy functions for loadable modules
From: "David E. Box" <[email protected]>
Some loadable modules only need IOSF access on the platforms where it exists. Provide dummy functions to allow these modules to compile and load on the platforms where it doesn't exist.
--- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 2 files changed, 39 insertions(+)
arch/x86/include/asm/iosf_mbi.h +33 -0
@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8
@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed
@@ -87,4 +91,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);*/ int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +WARN (); +return -EPERM ; +} +#endif /* CONFIG_IOSF_MBI */ +#endif /* IOSF_MBI_SYMS_H */
arch/x86/kernel/iosf_mbi.c +6 -0
@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Signature · 1 line
1.7.10.4
tip-bot for David E. Box
merge bot[tip:x86/platform] x86, iosf: Add dummy functions for loadable modules
x86, iosf: Add dummy functions for loadable modules
Commit-ID: 60af5c61f26fffb5f53ce74641606fe2c9a4d903 Gitweb: http://git.kernel.org/tip/60af5c61f26fffb5f53ce74641606fe2c9a4d903 Author: David E. Box <[email protected]> AuthorDate: Fri, 28 Feb 2014 18:40:51 -0800 Committer: H. Peter Anvin <[email protected]> CommitDate: Fri, 28 Feb 2014 19:55:00 -0800
x86, iosf: Add dummy functions for loadable modules
Some loadable modules only need IOSF access on the platforms where it exists. Provide dummy functions to allow these modules to compile and load on the platforms where it doesn't exist.
--- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 2 files changed, 39 insertions(+)
arch/x86/include/asm/iosf_mbi.h +33 -0
@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8
@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed
@@ -87,4 +91,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);*/ int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +WARN (); +return -EPERM ; +} +#endif /* CONFIG_IOSF_MBI */ +#endif /* IOSF_MBI_SYMS_H */
arch/x86/kernel/iosf_mbi.c +6 -0
@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Re: [PATCH V5 1/2] x86: IOSF: add dummy functions for loadable modules
In reply to David E. BoxQuoted 5 lines · David E. Box
From: "David E. Box" <[email protected]>
Some loadable modules only need IOSF access on the platforms where it exists. Provide dummy functions to allow these modules to compile and load on the platforms where it doesn't exist.
This is not the right way, I think.
We can either default built-in this IOSF component, so that the interface is always here, Or we can register the interfaces to the global hooks, so that the consumers are able to check the hook to see if it's available and make the calls if it is.
In the long turn, this could be a bus driver and framework needed.
Thanks,
-Aubrey
Quoted 81 lines
Signed-off-by David E. Box <[email protected]>--- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 2 files changed, 39 insertions(+)arch/x86/include/asm/iosf_mbi.h +33
-0@@ -5,6 +5,8 @@#ifndef IOSF_MBI_SYMS_H #define IOSF_MBI_SYMS_H +#ifdef CONFIG_IOSF_MBI +#define MBI_MCR_OFFSET 0xD0#define MBI_MDR_OFFSET 0xD4#define MBI_MCRX_OFFSET 0xD8@@ -50,6 +52,8 @@#define BT_MBI_PCIE_READ 0x00#define BT_MBI_PCIE_WRITE 0x01 +bool iosf_mbi_available (void ); +/** * iosf_mbi_read() - MailBox Interface read command * @port: port indicating subunit being accessed @@ -87,4 +91,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);*/ int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask); +#else /* CONFIG_IOSF_MBI is not enabled */ +static inline +bool iosf_mbi_available (void ) +{ +return false; +} + +static inline +int iosf_mbi_read (u8 port,u8 opcode,u32 offset,u32 *mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_write (u8 port,u8 opcode,u32 offset,u32 mdr) +{ +WARN (); +return -EPERM ; +} + +static inline +int iosf_mbi_modify (u8 port,u8 opcode,u32 offset,u32 mdr,u32 mask) +{ +WARN (); +return -EPERM ; +} +#endif /* CONFIG_IOSF_MBI */ +#endif /* IOSF_MBI_SYMS_H */ arch/x86/kernel/iosf_mbi.c +6
-0@@ -177,6 +177,12 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask) }EXPORT_SYMBOL (iosf_mbi_modify); +bool iosf_mbi_available (void ) +{ +return mbi_pdev; +} +EXPORT_SYMBOL (iosf_mbi_available); +static int iosf_mbi_probe (struct pci_dev *pdev,const struct pci_device_id *unused) {
Re: [PATCH V5 1/2] x86: IOSF: add dummy functions for loadable modules
Quoted 8 lines · Aubrey
Quoted 5 lines · David E. Box
From: "David E. Box" <[email protected]>
Some loadable modules only need IOSF access on the platforms where it exists. Provide dummy functions to allow these modules to compile and load on the platforms where it doesn't exist.
This is not the right way, I think.
Disagree. There are various drivers that can use the IOSF interface but do not need it, and need to also build and run on platforms without it.
The current code IMHO is correct. We want to make sure it builds without IOSF, but that any attempt to use IOSF in such a runtime errors - that's what this code does.
Alan
PATCH v5 2/2 x86: IOSF: Change IOSF_MBI Kconfig to default y
In reply to David E. BoxFrom: "David E. Box" <[email protected]>
Make the IOSF Mailbox driver built in as it provides core functionality needed for new Intel SOC platforms to access the device registers on the SOC.
--- arch/x86/Kconfig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/Kconfig +2 -5
@@ -2385,12 +2385,9 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + bool "Intel IOSF Mailbox Driver support" + default y depends on PCI - ---help--- - To be selected by modules requiring access to the Intel OnChip System - Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms - enumerable by PCI. source "net/Kconfig"
Signature · 1 line
1.7.10.4
Re: [PATCH V5 2/2] x86: IOSF: Change IOSF_MBI Kconfig to default y
Quoted 15 lines · David E. Box
From: "David E. Box" <[email protected]>
Make the IOSF Mailbox driver built in as it provides core functionality needed for new Intel SOC platforms to access the device registers on the SOC.
Signed-off-by David E. Box <[email protected]>--- arch/x86/Kconfig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)arch/x86/Kconfig +0
-0
arch/x86/Kconfig config X86_DMA_REMAP · line 2388
Quoted 5 lines
arch/x86/Kconfig +1
-1@@ -2385,12 +2385,9 @@ config X86_DMA_REMAP depends on STA2X11 config IOSF_MBI - bool + bool "Intel IOSF Mailbox Driver support"
One concern here is, IOSF is not architectural for all of X86, can we change this as "Intel Atom IOSF Mailbox Driver support"? Or if you can confirm we'll use IOSF in the future onchip product, can we change this as "Intel SOC IOSF Mailbox Driver support"?
Better to rename the file name as well.
Thanks,
-Aubrey
Quoted 10 lines
arch/x86/Kconfig +1
-4+ default y depends on PCI - ---help--- - To be selected by modules requiring access to the Intel OnChip System - Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms - enumerable by PCI. source "net/Kconfig"
Re: [PATCH V5 2/2] x86: IOSF: Change IOSF_MBI Kconfig to default y
Quoted 18 lines · Aubrey
Quoted 17 lines · David E. Box
From: "David E. Box" <[email protected]>
Make the IOSF Mailbox driver built in as it provides core functionality needed for new Intel SOC platforms to access the device registers on the SOC.
Signed-off-by David E. Box <[email protected]>--- arch/x86/Kconfig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)arch/x86/Kconfig +0
-0@@ -2385,12 +2385,9 @@ config X86_DMA_REMAP depends on STA2X11
Quoted 9 lines
arch/x86/Kconfig config X86_DMA_REMAP · line 2388
Quoted 3 lines
arch/x86/Kconfig +1
-1config IOSF_MBI - bool + bool "Intel IOSF Mailbox Driver support"One concern here is, IOSF is not architectural for all of X86, can we change this as "Intel Atom IOSF Mailbox Driver support"? Or if you can confirm we'll use IOSF in the future onchip product, can we change this as "Intel SOC IOSF Mailbox Driver support"?
Ok. The latter would be more appropriate.
david box
Re: [PATCH V5 0/2] x86: IOSF: Add loadable module support
In reply to David E. BoxHi David,
I'm probably too late to catch this thread. Just one question, what's the relationship between
arch/x86/kernel/iosf_mbi.c
and
drivers/platform/x86/intel_baytrail.c
Thanks,
-Aubrey
Quoted 41 lines · David E. Box
From: "David E. Box" <[email protected]>
This patch series adds missing functionalty that mostly affected loadable modules.
The first patch adds dummy functions to allow drivers not completely dependant on the IOSF MBI driver to compile on systems that don't have it.
The second makes MBI driver built in.
Changes from V4:
- Put back
Kconfigprompt forIOSF_MBI.Changes from V3:
- Code is agreed to be small enough to not warrant forcing for non-EXPERT only
Changes from V2:
- Remove non linux style externs from
iosf_mbi.hChanges from V1:
- Force default y for non-EXPERT to allow easier custom configuration as suggested by hpa <[email protected]>
- AddWARN()to dummy functions, other thaniosf_mbi_available(), to signal incorrect use as suggested by Alan <[email protected]> Also return EPERM in these functions
- Splits single patch into two patch seriesDavid E. Box (2):
x86: IOSF: add dummy functions for loadable modules
x86: IOSF: ChangeIOSF_MBIKconfigto default yarch/x86/Kconfig | 7 ++----- arch/x86/include/asm/iosf_mbi.h | 33 +++++++++++++++++++++++++++++++++ arch/x86/kernel/iosf_mbi.c | 6 ++++++ 3 files changed, 41 insertions(+), 5 deletions(-)
Re: [PATCH V5 0/2] x86: IOSF: Add loadable module support
Quoted 8 lines · Aubrey
Hi David,
I'm probably too late to catch this thread. Just one question, what's the relationship between
arch/x86/kernel/iosf_mbi.cand
drivers/platform/x86/intel_baytrail.c
iosf_mbi.c is the version that went upstream, no longer specific to baytrail.
david box
Re: [PATCH V5 0/2] x86: IOSF: Add loadable module support
Quoted 10 lines · David E. Box
Quoted 8 lines · Aubrey
Hi David,
I'm probably too late to catch this thread. Just one question, what's the relationship between
arch/x86/kernel/iosf_mbi.cand
drivers/platform/x86/intel_baytrail.c
iosf_mbi.cis the version that went upstream, no longer specific to baytrail.
Then should we remove the latter?
Thanks,
-Aubrey
Quoted 4 lines
david box
Re: [PATCH V5 0/2] x86: IOSF: Add loadable module support
Quoted 10 lines · Aubrey
Quoted 9 lines · David E. Box
Quoted 8 lines · Aubrey
Hi David,
I'm probably too late to catch this thread. Just one question, what's the relationship between
arch/x86/kernel/iosf_mbi.cand
drivers/platform/x86/intel_baytrail.c
Quoted 4 lines
Quoted 1 line
iosf_mbi.cis the version that went upstream, no longer specific to baytrail.Then should we remove the latter?
Absolutely. I wasn't aware until now that this version went upstream. I didn't see a tip for it. I'll send a patch to revert it.
david box