SPI LPC information kernel module
Subsystems (3)
PATCH 1/1 SPI LPC information kernel module
This kernel module exports configuration attributes for the system SPI chip.
This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM Bios Write Protect (SMM_BWP) fields of the Bios Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.
The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.
A technical note: I check if *ppos == BUFFER_SIZE in the reading function to exit early and avoid an extra access to the HW, for example when using the 'cat' command, which causes two read operations.
--- Documentation/ABI/stable/securityfs-spi-lpc | 23 + MAINTAINERS | 6 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/spi_lpc/Kconfig | 20 + drivers/misc/spi_lpc/Makefile | 8 + drivers/misc/spi_lpc/bios_data_access.c | 559 +++++++++++++++++++ drivers/misc/spi_lpc/bios_data_access.h | 181 +++++++ drivers/misc/spi_lpc/low_level_access.c | 59 ++ drivers/misc/spi_lpc/low_level_access.h | 21 + drivers/misc/spi_lpc/spi_lpc_main.c | 176 ++++++ drivers/misc/spi_lpc/viddid_arch_map.c | 566 ++++++++++++++++++++ drivers/misc/spi_lpc/viddid_arch_map.h | 17 + 13 files changed, 1638 insertions(+) create mode 100644 Documentation/ABI/stable/securityfs-spi-lpc create mode 100644 drivers/misc/spi_lpc/Kconfig create mode 100644 drivers/misc/spi_lpc/Makefile create mode 100644 drivers/misc/spi_lpc/bios_data_access.c create mode 100644 drivers/misc/spi_lpc/bios_data_access.h create mode 100644 drivers/misc/spi_lpc/low_level_access.c create mode 100644 drivers/misc/spi_lpc/low_level_access.h create mode 100644 drivers/misc/spi_lpc/spi_lpc_main.c create mode 100644 drivers/misc/spi_lpc/viddid_arch_map.c create mode 100644 drivers/misc/spi_lpc/viddid_arch_map.h
Documentation/ABI/stable/securityfs-spi-lpc new file +23 -0
@@ -0,0 +1,23 @@ +What: /sys/kernel/security/firmware/bioswe +Date: June 2020 +KernelVersion: 5.8.0 +Contact: [email protected] +Description: If the system firmware set BIOS Write Enable. + 0: writes disabled, 1: writes enabled. +Users: https://github.com/fwupd/fwupd + +What: /sys/kernel/security/firmware/ble +Date: June 2020 +KernelVersion: 5.8.0 +Contact: [email protected] +Description: If the system firmware set Bios Lock Enable. + 0: SMM lock disabled, 1: SMM lock enabled. +Users: https://github.com/fwupd/fwupd + +What: /sys/kernel/security/firmware/smm_bwp +Date: June 2020 +KernelVersion: 5.8.0 +Contact: [email protected] +Description: If the system firmware set SMM Bios Write Protect. + 0: writes disabled unless in SMM, 1: writes enabled. +Users: https://github.com/fwupd/fwupd
MAINTAINERS +6 -0
@@ -16078,6 +16078,12 @@ W: http://www.st.com/spear F: arch/arm/boot/dts/spear* F: arch/arm/mach-spear/ +SPI LPC information kernel MODULE +M: Daniel Gutson <[email protected]> +S: Supported +F: Documentation/ABI/stable/securityfs-spi-lpc +F: drivers/misc/spi_lpc/* + SPI NOR SUBSYSTEM M: Tudor Ambarus <[email protected]> L: [email protected]
drivers/misc/Kconfig +1 -0
@@ -472,4 +472,5 @@ source "drivers/misc/ocxl/Kconfig" source "drivers/misc/cardreader/Kconfig" source "drivers/misc/habanalabs/Kconfig" source "drivers/misc/uacce/Kconfig" +source "drivers/misc/spi_lpc/Kconfig" endmenu
drivers/misc/Makefile +1 -0
@@ -57,3 +57,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_HABANA_AI) += habanalabs/ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o +obj-$(CONFIG_SPI_LPC) += spi_lpc/
drivers/misc/spi_lpc/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# SPI LPC information kernel module +# + +config SPI_LPC + tristate "SPI LPC information" + depends on SECURITYFS && CPU_SUP_INTEL + help + This kernel modules exports the configuration attributes for the + system SPI chip. + Enable this kernel module to read the BIOSWE, BLE, and SMM_BWP fields + of the Bios Control register, by reading these three files: + + /sys/kernel/security/firmware/bioswe + /sys/kernel/security/firmware/ble + /sys/kernel/security/firmware/smm_bwp + + To compile this driver as a module, choose M here: the + module will be called spi_lpc.
drivers/misc/spi_lpc/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for the SPI LPC kernel module +# + +obj-m := spi_lpc.o + +spi_lpc-y := spi_lpc_main.o bios_data_access.o low_level_access.o viddid_arch_map.o
drivers/misc/spi_lpc/bios_data_access.c new file +559 -0
559 lines not on this page · raw message
drivers/misc/spi_lpc/bios_data_access.h new file +181 -0
181 lines not on this page · raw message
drivers/misc/spi_lpc/low_level_access.c new file +59 -0
59 lines not on this page · raw message
drivers/misc/spi_lpc/low_level_access.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* SPI LPC flash platform security driver +* +* Copyright 2020 (c) Daniel Gutson ([email protected]) +*/ + +#ifndef LOW_LEVEL_H +#define LOW_LEVEL_H + +#include <linux/types.h> + +int pci_read_byte (u8 *value,u64 bus,u64 device,u64 function,u64 offset); +int pci_read_word (u16 *value,u64 bus,u64 device,u64 function,u64 offset); +int pci_read_dword (u32 *value,u64 bus,u64 device,u64 function,u64 offset); + +int mmio_read_byte (u64 phys_address,u8 *value); +int mmio_read_word (u64 phys_address,u16 *value); +int mmio_read_dword (u64 phys_address,u32 *value); + +#endif /* LOW_LEVEL_H */
drivers/misc/spi_lpc/spi_lpc_main.c new file +176 -0
176 lines not on this page · raw message
drivers/misc/spi_lpc/viddid_arch_map.c new file +566 -0
566 lines not on this page · raw message
drivers/misc/spi_lpc/viddid_arch_map.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* SPI LPC flash platform security driver +* +* Copyright 2020 (c) Daniel Gutson ([email protected]) +* +*/ + +#ifndef VIDDID_ARCH_MAP_H +#define VIDDID_ARCH_MAP_H + +#include "bios_data_access.h" + +int viddid2pch_arch (u64 vid,u64 did,enum PCH_Arch *arch); +int viddid2cpu_arch (u64 vid,u64 did,enum CPU_Arch *arch); + +#endif /* VIDDID_ARCH_MAP_H */
Signature · 1 line
2.25.1
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi Daniel,
I love your patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on soc/for-next linus/master v5.8-rc3 next-20200629] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Daniel-Gutson/SPI-LPC-information-kernel-module/20200630-070234 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git ba2104c24aba1fa7e19d53f08c985526a6786d8b config: i386-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from drivers/misc/vmw_vmci/vmci_context.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_byte':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:32:1: note: in expansion of macro 'GENERIC_MMIO_READ'
32 | GENERIC_MMIO_READ(u8, byte, readb)
| ^~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_word':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:33:1: note: in expansion of macro 'GENERIC_MMIO_READ'
33 | GENERIC_MMIO_READ(u16, word, readw)
| ^~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_dword':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:34:1: note: in expansion of macro 'GENERIC_MMIO_READ'
34 | GENERIC_MMIO_READ(u32, dword, readl)
| ^~~~~~~~~~~~~~~~~
drivers/misc/ibmasm/event.c:44: warning: Function parameter or member 'sp' not described in 'ibmasm_receive_event'
drivers/misc/ibmasm/event.c:44: warning: Function parameter or member 'data' not described in 'ibmasm_receive_event'
drivers/misc/ibmasm/event.c:44: warning: Function parameter or member 'data_size' not described in 'ibmasm_receive_event'
drivers/misc/ibmasm/event.c:78: warning: Function parameter or member 'sp' not described in 'ibmasm_get_next_event'
drivers/misc/ibmasm/event.c:78: warning: Function parameter or member 'reader' not described in 'ibmasm_get_next_event'
drivers/misc/ibmasm/command.c:106: warning: Function parameter or member 'sp' not described in 'ibmasm_exec_command'
drivers/misc/ibmasm/command.c:106: warning: Function parameter or member 'cmd' not described in 'ibmasm_exec_command'
drivers/misc/ibmasm/command.c:149: warning: Function parameter or member 'cmd' not described in 'ibmasm_wait_for_response'
drivers/misc/ibmasm/command.c:149: warning: Function parameter or member 'timeout' not described in 'ibmasm_wait_for_response'
drivers/misc/ibmasm/command.c:162: warning: Function parameter or member 'sp' not described in 'ibmasm_receive_command_response'
drivers/misc/ibmasm/command.c:162: warning: Function parameter or member 'response' not described in 'ibmasm_receive_command_response'
drivers/misc/ibmasm/command.c:162: warning: Function parameter or member 'size' not described in 'ibmasm_receive_command_response'
In file included from drivers/misc/vmw_vmci/vmci_datagram.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/pti.c:747: warning: Function parameter or member 'port' not described in 'pti_port_activate'
drivers/misc/pti.c:747: warning: Function parameter or member 'tty' not described in 'pti_port_activate'
drivers/misc/pti.c:764: warning: Function parameter or member 'port' not described in 'pti_port_shutdown'
drivers/misc/pti.c:792: warning: Function parameter or member 'pdev' not described in 'pti_pci_probe'
drivers/misc/pti.c:792: warning: Function parameter or member 'ent' not described in 'pti_pci_probe'
drivers/misc/pti.c:901: warning: Cannot understand *
on line 901 - I thought it was a doc line
In file included from drivers/misc/vmw_vmci/vmci_driver.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/ibmasm/r_heartbeat.c:49: warning: Function parameter or member 'sp' not described in 'ibmasm_start_reverse_heartbeat'
drivers/misc/ibmasm/r_heartbeat.c:49: warning: Function parameter or member 'rhb' not described in 'ibmasm_start_reverse_heartbeat'
In file included from drivers/misc/vmw_vmci/vmci_handle_array.h:11,
from drivers/misc/vmw_vmci/vmci_handle_array.c:9:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_event.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/ibmasm/dot_command.c:18: warning: Function parameter or member 'sp' not described in 'ibmasm_receive_message'
drivers/misc/ibmasm/dot_command.c:18: warning: Function parameter or member 'message' not described in 'ibmasm_receive_message'
drivers/misc/ibmasm/dot_command.c:18: warning: Function parameter or member 'message_size' not described in 'ibmasm_receive_message'
drivers/misc/ibmasm/dot_command.c:55: warning: Function parameter or member 'sp' not described in 'ibmasm_send_driver_vpd'
drivers/misc/ibmasm/dot_command.c:111: warning: Function parameter or member 'sp' not described in 'ibmasm_send_os_state'
drivers/misc/ibmasm/dot_command.c:111: warning: Function parameter or member 'os_state' not described in 'ibmasm_send_os_state'
In file included from drivers/misc/vmw_vmci/vmci_resource.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_route.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_host.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/irq.c:24: warning: Function parameter or member 'eq_work' not described in 'hl_eqe_work'
drivers/misc/habanalabs/irq.c:24: warning: Function parameter or member 'hdev' not described in 'hl_eqe_work'
drivers/misc/habanalabs/irq.c:24: warning: Function parameter or member 'eq_entry' not described in 'hl_eqe_work'
drivers/misc/enclosure.c:115: warning: Function parameter or member 'name' not described in 'enclosure_register'
drivers/misc/enclosure.c:115: warning: Function parameter or member 'cb' not described in 'enclosure_register'
drivers/misc/enclosure.c:283: warning: Function parameter or member 'number' not described in 'enclosure_component_alloc'
drivers/misc/enclosure.c:283: warning: Excess function parameter 'num' description in 'enclosure_component_alloc'
drivers/misc/enclosure.c:363: warning: Function parameter or member 'component' not described in 'enclosure_add_device'
drivers/misc/enclosure.c:363: warning: Excess function parameter 'num' description in 'enclosure_add_device'
drivers/misc/enclosure.c:398: warning: Function parameter or member 'dev' not described in 'enclosure_remove_device'
drivers/misc/enclosure.c:398: warning: Excess function parameter 'num' description in 'enclosure_remove_device'
drivers/misc/lattice-ecp3-config.c: In function 'firmware_load':
drivers/misc/lattice-ecp3-config.c:70:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
70 | int ret;
| ^~~
drivers/misc/pch_phub.c:145: warning: Function parameter or member 'chip' not described in 'pch_phub_read_modify_write_reg'
drivers/misc/pch_phub.c:280: warning: Function parameter or member 'chip' not described in 'pch_phub_read_serial_rom'
drivers/misc/pch_phub.c:294: warning: Function parameter or member 'chip' not described in 'pch_phub_write_serial_rom'
drivers/misc/pch_phub.c:332: warning: Function parameter or member 'chip' not described in 'pch_phub_read_serial_rom_val'
drivers/misc/pch_phub.c:348: warning: Function parameter or member 'chip' not described in 'pch_phub_write_serial_rom_val'
drivers/misc/pch_phub.c:448: warning: Function parameter or member 'chip' not described in 'pch_phub_read_gbe_mac_addr'
drivers/misc/pch_phub.c:448: warning: Excess function parameter 'offset_address' description in 'pch_phub_read_gbe_mac_addr'
drivers/misc/pch_phub.c:460: warning: Function parameter or member 'chip' not described in 'pch_phub_write_gbe_mac_addr'
drivers/misc/pch_phub.c:460: warning: Excess function parameter 'offset_address' description in 'pch_phub_write_gbe_mac_addr'
In file included from drivers/misc/vmw_balloon.c:35:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/firmware_if.c:26: warning: Function parameter or member 'fw_name' not described in 'hl_fw_load_fw_to_device'
drivers/misc/habanalabs/firmware_if.c:26: warning: Function parameter or member 'dst' not described in 'hl_fw_load_fw_to_device'
drivers/misc/habanalabs/goya/goya.c: In function 'goya_debugfs_read32':
drivers/misc/habanalabs/goya/goya.c:3945:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
3945 | } else if ((addr >= DRAM_PHYS_BASE) &&
| ^~
drivers/misc/habanalabs/goya/goya.c: In function 'goya_debugfs_write32':
drivers/misc/habanalabs/goya/goya.c:4002:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
4002 | } else if ((addr >= DRAM_PHYS_BASE) &&
| ^~
drivers/misc/habanalabs/goya/goya.c: In function 'goya_debugfs_read64':
--
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_byte':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:32:1: note: in expansion of macro 'GENERIC_MMIO_READ'
32 | GENERIC_MMIO_READ(u8, byte, readb)
| ^~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_word':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:33:1: note: in expansion of macro 'GENERIC_MMIO_READ'
33 | GENERIC_MMIO_READ(u16, word, readw)
| ^~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_dword':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:34:1: note: in expansion of macro 'GENERIC_MMIO_READ'
34 | GENERIC_MMIO_READ(u32, dword, readl)
| ^~~~~~~~~~~~~~~~~--
drivers/misc/ibmasm/command.c:106: warning: Function parameter or member 'sp' not described in 'ibmasm_exec_command' drivers/misc/ibmasm/command.c:106: warning: Function parameter or member 'cmd' not described in 'ibmasm_exec_command' drivers/misc/ibmasm/command.c:149: warning: Function parameter or member 'cmd' not described in 'ibmasm_wait_for_response' drivers/misc/ibmasm/command.c:149: warning: Function parameter or member 'timeout' not described in 'ibmasm_wait_for_response' drivers/misc/ibmasm/command.c:162: warning: Function parameter or member 'sp' not described in 'ibmasm_receive_command_response' drivers/misc/ibmasm/command.c:162: warning: Function parameter or member 'response' not described in 'ibmasm_receive_command_response' drivers/misc/ibmasm/command.c:162: warning: Function parameter or member 'size' not described in 'ibmasm_receive_command_response' drivers/misc/ibmasm/event.c:44: warning: Function parameter or member 'sp' not described in 'ibmasm_receive_event' drivers/misc/ibmasm/event.c:44: warning: Function parameter or member 'data' not described in 'ibmasm_receive_event' drivers/misc/ibmasm/event.c:44: warning: Function parameter or member 'data_size' not described in 'ibmasm_receive_event' drivers/misc/ibmasm/event.c:78: warning: Function parameter or member 'sp' not described in 'ibmasm_get_next_event' drivers/misc/ibmasm/event.c:78: warning: Function parameter or member 'reader' not described in 'ibmasm_get_next_event' drivers/misc/pti.c:747: warning: Function parameter or member 'port' not described in 'pti_port_activate' drivers/misc/pti.c:747: warning: Function parameter or member 'tty' not described in 'pti_port_activate' drivers/misc/pti.c:764: warning: Function parameter or member 'port' not described in 'pti_port_shutdown' drivers/misc/pti.c:792: warning: Function parameter or member 'pdev' not described in 'pti_pci_probe' drivers/misc/pti.c:792: warning: Function parameter or member 'ent' not described in 'pti_pci_probe' drivers/misc/pti.c:901: warning: Cannot understand *
on line 901 - I thought it was a doc line
drivers/misc/enclosure.c:115: warning: Function parameter or member 'name' not described in 'enclosure_register' drivers/misc/enclosure.c:115: warning: Function parameter or member 'cb' not described in 'enclosure_register' drivers/misc/enclosure.c:283: warning: Function parameter or member 'number' not described in 'enclosure_component_alloc' drivers/misc/enclosure.c:283: warning: Excess function parameter 'num' description in 'enclosure_component_alloc' drivers/misc/enclosure.c:363: warning: Function parameter or member 'component' not described in 'enclosure_add_device' drivers/misc/enclosure.c:363: warning: Excess function parameter 'num' description in 'enclosure_add_device' drivers/misc/enclosure.c:398: warning: Function parameter or member 'dev' not described in 'enclosure_remove_device' drivers/misc/enclosure.c:398: warning: Excess function parameter 'num' description in 'enclosure_remove_device' drivers/misc/ibmasm/r_heartbeat.c:49: warning: Function parameter or member 'sp' not described in 'ibmasm_start_reverse_heartbeat' drivers/misc/ibmasm/r_heartbeat.c:49: warning: Function parameter or member 'rhb' not described in 'ibmasm_start_reverse_heartbeat' drivers/misc/ibmasm/dot_command.c:18: warning: Function parameter or member 'sp' not described in 'ibmasm_receive_message' drivers/misc/ibmasm/dot_command.c:18: warning: Function parameter or member 'message' not described in 'ibmasm_receive_message' drivers/misc/ibmasm/dot_command.c:18: warning: Function parameter or member 'message_size' not described in 'ibmasm_receive_message' drivers/misc/ibmasm/dot_command.c:55: warning: Function parameter or member 'sp' not described in 'ibmasm_send_driver_vpd' drivers/misc/ibmasm/dot_command.c:111: warning: Function parameter or member 'sp' not described in 'ibmasm_send_os_state' drivers/misc/ibmasm/dot_command.c:111: warning: Function parameter or member 'os_state' not described in 'ibmasm_send_os_state' In file included from drivers/misc/vmw_balloon.c:35:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/lattice-ecp3-config.c: In function 'firmware_load':
drivers/misc/lattice-ecp3-config.c:70:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
70 | int ret;
| ^~~
In file included from drivers/misc/vmw_vmci/vmci_context.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/pch_phub.c:145: warning: Function parameter or member 'chip' not described in 'pch_phub_read_modify_write_reg'
drivers/misc/pch_phub.c:280: warning: Function parameter or member 'chip' not described in 'pch_phub_read_serial_rom'
drivers/misc/pch_phub.c:294: warning: Function parameter or member 'chip' not described in 'pch_phub_write_serial_rom'
drivers/misc/pch_phub.c:332: warning: Function parameter or member 'chip' not described in 'pch_phub_read_serial_rom_val'
drivers/misc/pch_phub.c:348: warning: Function parameter or member 'chip' not described in 'pch_phub_write_serial_rom_val'
drivers/misc/pch_phub.c:448: warning: Function parameter or member 'chip' not described in 'pch_phub_read_gbe_mac_addr'
drivers/misc/pch_phub.c:448: warning: Excess function parameter 'offset_address' description in 'pch_phub_read_gbe_mac_addr'
drivers/misc/pch_phub.c:460: warning: Function parameter or member 'chip' not described in 'pch_phub_write_gbe_mac_addr'
drivers/misc/pch_phub.c:460: warning: Excess function parameter 'offset_address' description in 'pch_phub_write_gbe_mac_addr'
In file included from drivers/misc/vmw_vmci/vmci_datagram.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/vmw_balloon.c:262: warning: Function parameter or member '5' not described in 'vmballoon_batch_entry'
In file included from drivers/misc/vmw_vmci/vmci_event.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_driver.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_handle_array.h:11,
from drivers/misc/vmw_vmci/vmci_handle_array.c:9:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_host.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_resource.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/vmw_vmci/vmci_route.c:8:
include/linux/vmw_vmci_defs.h:162:33: warning: 'VMCI_ANON_SRC_HANDLE' defined but not used [-Wunused-const-variable=]
162 | static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/mei/mei-trace.h:83,
from drivers/misc/mei/mei-trace.c:11:
include/trace/define_trace.h:95:42: fatal error: ./mei-trace.h: No such file or directory
95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
make[3]: *** [scripts/Makefile.build:281: drivers/misc/mei/mei-trace.o] Error 1
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_byte':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:32:1: note: in expansion of macro 'GENERIC_MMIO_READ'
32 | GENERIC_MMIO_READ(u8, byte, readb)
| ^~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_word':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:33:1: note: in expansion of macro 'GENERIC_MMIO_READ'
33 | GENERIC_MMIO_READ(u16, word, readw)
| ^~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'mmio_read_dword':
>> <command-line>: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>> drivers/misc/spi_lpc/low_level_access.c:8:21: note: in expansion of macro 'KBUILD_MODNAME'
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
| ^~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:419:2: note: in expansion of macro 'dynamic_pr_debug'
419 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:20:3: note: in expansion of macro 'pr_debug'
20 | pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
| ^~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:34:1: note: in expansion of macro 'GENERIC_MMIO_READ'
34 | GENERIC_MMIO_READ(u32, dword, readl)
| ^~~~~~~~~~~~~~~~~ In file included from drivers/misc/habanalabs/goya/goya.c:8:
drivers/misc/habanalabs/goya/goyaP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:280: drivers/misc/habanalabs/goya/goya.o] Error 1
In file included from drivers/misc/habanalabs/goya/goya_security.c:8:
drivers/misc/habanalabs/goya/goyaP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:281: drivers/misc/habanalabs/goya/goya_security.o] Error 1
In file included from drivers/misc/habanalabs/goya/goya_hwmgr.c:8:
drivers/misc/habanalabs/goya/goyaP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:281: drivers/misc/habanalabs/goya/goya_hwmgr.o] Error 1
In file included from drivers/misc/habanalabs/goya/goya_coresight.c:8:
drivers/misc/habanalabs/goya/goyaP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:281: drivers/misc/habanalabs/goya/goya_coresight.o] Error 1
In file included from drivers/misc/habanalabs/gaudi/gaudi.c:8:
drivers/misc/habanalabs/gaudi/gaudiP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:281: drivers/misc/habanalabs/gaudi/gaudi.o] Error 1
make[3]: *** [scripts/Makefile.build:281: drivers/misc/habanalabs/gaudi/gaudi_security.o] Error 1
In file included from drivers/misc/habanalabs/gaudi/gaudi_hwmgr.c:8:
drivers/misc/habanalabs/gaudi/gaudiP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
In file included from drivers/misc/habanalabs/gaudi/gaudi_security.c:8:
drivers/misc/habanalabs/gaudi/gaudiP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:281: drivers/misc/habanalabs/gaudi/gaudi_hwmgr.o] Error 1
In file included from drivers/misc/habanalabs/gaudi/gaudi_coresight.c:8:
drivers/misc/habanalabs/gaudi/gaudiP.h:12:10: fatal error: habanalabs.h: No such file or directory
12 | #include "habanalabs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:281: drivers/misc/habanalabs/gaudi/gaudi_coresight.o] Error 1 drivers/misc/habanalabs/irq.c:24: warning: Function parameter or member 'eq_work' not described in 'hl_eqe_work' drivers/misc/habanalabs/irq.c:24: warning: Function parameter or member 'hdev' not described in 'hl_eqe_work' drivers/misc/habanalabs/irq.c:24: warning: Function parameter or member 'eq_entry' not described in 'hl_eqe_work' make[2]: *** [scripts/Makefile.build:497: drivers/misc/mei] Error 2
make[3]: Target '__build' not remade because of errors.
drivers/misc/habanalabs/pci.c:27: warning: Function parameter or member 'name' not described in 'hl_pci_bars_map' drivers/misc/habanalabs/pci.c:27: warning: Excess function parameter 'bar_name' description in 'hl_pci_bars_map' drivers/misc/habanalabs/pci.c:147: warning: Function parameter or member 'addr' not described in 'hl_pci_iatu_write' drivers/misc/habanalabs/pci.c:147: warning: Function parameter or member 'data' not described in 'hl_pci_iatu_write' drivers/misc/habanalabs/pci.c:324: warning: Excess function parameter 'dma_mask' description in 'hl_pci_set_dma_mask' drivers/misc/habanalabs/firmware_if.c:26: warning: Function parameter or member 'fw_name' not described in 'hl_fw_load_fw_to_device' drivers/misc/habanalabs/firmware_if.c:26: warning: Function parameter or member 'dst' not described in 'hl_fw_load_fw_to_device' make[3]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1756: drivers/misc] Error 2
make[1]: Target '__all' not remade because of errors.
make[2]: *** [scripts/Makefile.build:497: drivers/misc/habanalabs] Error 2
make[2]: Target '__build' not remade because of errors.
..
vim +/KBUILD_MODNAME +8 drivers/misc/spi_lpc/low_level_access.c
> 8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
10 #include <linux/version.h>
11 #include <linux/pci.h>
12 #include "low_level_access.h"
13
14 #define GENERIC_MMIO_READ(Type, Suffix, function) \
15 int mmio_read_##Suffix(u64 phys_address, Type *value) \
16 { \
17 int ret = 0; \
18 void __iomem *mapped_address = \
19 ioremap(phys_address, sizeof(Type)); \
> 20 pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \
21 sizeof(Type)); \
22 if (mapped_address != NULL) { \
23 *value = function(mapped_address); \
24 iounmap(mapped_address); \
25 } else { \
26 pr_err("Failed to MAP IO memory: 0x%llx\n", \
27 phys_address); \
28 ret = -EIO; \
29 } \
30 return ret; \
31 }
> 32 GENERIC_MMIO_READ(u8, byte, readb)
33 GENERIC_MMIO_READ(u16, word, readw)
34 GENERIC_MMIO_READ(u32, dword, readl)
35 #undef GENERIC_MMIO_READ
36 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Greg Kroah-Hartman
maintainerQuoted 8 lines · Daniel Gutson
This kernel module exports configuration attributes for the system SPI chip.
This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM Bios Write Protect (SMM_BWP) fields of the Bios Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.
Quoted 6 lines
The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.
A technical note: I check if *ppos ==
BUFFER_SIZEin the reading function to exit early and avoid an extra access to the HW, for example when using the 'cat' command, which causes two read operations.
Why not use the simple_* functions which should prevent that type of thing?
Quoted 4 lines
Signed-off-by Daniel Gutson <[email protected]>--- Documentation/ABI/stable/securityfs-spi-lpc | 23 +
Why is this going in securityfs at all? Why not just sysfs as it is a CPU attribute, right?
Quoted 30 lines
MAINTAINERS | 6 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/spi_lpc/Kconfig | 20 + drivers/misc/spi_lpc/Makefile | 8 + drivers/misc/spi_lpc/bios_data_access.c | 559 +++++++++++++++++++ drivers/misc/spi_lpc/bios_data_access.h | 181 +++++++ drivers/misc/spi_lpc/low_level_access.c | 59 ++ drivers/misc/spi_lpc/low_level_access.h | 21 + drivers/misc/spi_lpc/spi_lpc_main.c | 176 ++++++ drivers/misc/spi_lpc/viddid_arch_map.c | 566 ++++++++++++++++++++ drivers/misc/spi_lpc/viddid_arch_map.h | 17 + 13 files changed, 1638 insertions(+) create mode 100644 Documentation/ABI/stable/securityfs-spi-lpc create mode 100644 drivers/misc/spi_lpc/Kconfig create mode 100644 drivers/misc/spi_lpc/Makefile create mode 100644 drivers/misc/spi_lpc/bios_data_access.c create mode 100644 drivers/misc/spi_lpc/bios_data_access.h create mode 100644 drivers/misc/spi_lpc/low_level_access.c create mode 100644 drivers/misc/spi_lpc/low_level_access.h create mode 100644 drivers/misc/spi_lpc/spi_lpc_main.c create mode 100644 drivers/misc/spi_lpc/viddid_arch_map.c create mode 100644 drivers/misc/spi_lpc/viddid_arch_map.hDocumentation/ABI/stable/securityfs-spi-lpc new file +0
-0
Documentation/ABI/stable/securityfs-spi-lpc line 6
Quoted 6 lines
Documentation/ABI/stable/securityfs-spi-lpc new file +6
-0@@ -0,0 +1,23 @@ +What: /sys/kernel/security/firmware/bioswe +Date: June 2020 +KernelVersion: 5.8.0 +Contact: [email protected] +Description: If the system firmware set BIOS Write Enable. + 0: writes disabled, 1: writes enabled.
THis is very x86-specific, what about ARM/MIPS/anything else? Perhaps a cpu/arch-specific thing instead?
Again, which makes it seem like securityfs is not the thing for this, as it describes the hardware, not a security model which is what securityfs has been for in the past, right?
thanks,
greg k-h
Quoted 3 lines · Greg Kroah-Hartman
Again, which makes it seem like securityfs is not the thing for this, as it describes the hardware, not a security model which is what securityfs has been for in the past, right?
It describes the hardware platform. From a fwupd perspective I don't mind if the BC attributes are read from securityfs, sysfs or even read from an offset in a file from /proc... I guess sysfs makes sense if securityfs is defined for things like the LSM or lockdown status, although I also thought sysfs was for devices *in* the platform, not the platform itself. I guess exposing the platform registers in sysfs is no more weird than exposing things like the mei device and rfkill.
Richard
Arnd Bergmann
maintainerQuoted 7 lines · Richard Hughes
Quoted 3 lines · Greg Kroah-Hartman
Again, which makes it seem like securityfs is not the thing for this, as it describes the hardware, not a security model which is what securityfs has been for in the past, right?
Quoted 7 lines
It describes the hardware platform. From a fwupd perspective I don't mind if the BC attributes are read from securityfs, sysfs or even read from an offset in a file from /proc... I guess sysfs makes sense if securityfs is defined for things like the LSM or lockdown status, although I also thought sysfs was for devices *in* the platform, not the platform itself. I guess exposing the platform registers in sysfs is no more weird than exposing things like the mei device and rfkill.
Why does fwupd care about the platform then? If these are register values that relate to the flash device and that device is what the firmware update gets written to, shouldn't it just use an interface from that device?
Arnd
Greg Kroah-Hartman
maintainerQuoted 6 lines · Richard Hughes
Quoted 3 lines · Greg Kroah-Hartman
Again, which makes it seem like securityfs is not the thing for this, as it describes the hardware, not a security model which is what securityfs has been for in the past, right?
Quoted 6 lines
It describes the hardware platform. From a fwupd perspective I don't mind if the BC attributes are read from securityfs, sysfs or even read from an offset in a file from /proc... I guess sysfs makes sense if securityfs is defined for things like the LSM or lockdown status, although I also thought sysfs was for devices *in* the platform, not the platform itself.
Have you looked at /sys/devices/system/ in a while? :)
Quoted 2 lines
I guess exposing the platform registers in sysfs
is no more weird than exposing things like the mei device and rfkill.
It is attributes that describe the hardware the system is running on, which is what sysfs is for.
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): CAFmMkTGrnZt7ZaGyYCe-LCHET4yHz9DfanaZwsOS6HCxK40apQ@mail.gmail.com
Arnd Bergmann
maintainerQuoted 8 lines · Daniel Gutson
Quoted 3 lines · Greg Kroah-Hartman
On Mon, Jun 29, 2020 at 07:59:32PM -0300, Daniel Gutson wrote:
Why is this going in securityfs at all? Why not just sysfs as it is a CPU attribute, right?Richard already discussed that, but "it" is not only (one) CPU attribute, are SPI chip settings and attributes coming from the firmware.
Please note that I wanted to submit the minimum patch, but I need to add more attributes.
Why can't the SPI chip settings be attributes of the SPI chip device in sysfs?
Which firmware are you actually talking about here? Do you mean firmware running on a device behind the SPI controller?
Arnd
Greg Kroah-Hartman
maintainerQuoted 19 lines · Daniel Gutson
Quoted 16 lines · Greg Kroah-Hartman
Quoted 14 lines · Daniel Gutson
This kernel module exports configuration attributes for the system SPI chip.
This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM Bios Write Protect (SMM_BWP) fields of the Bios Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.
A technical note: I check if *ppos ==
BUFFER_SIZEin the reading function to exit early and avoid an extra access to the HW, for example when using the 'cat' command, which causes two read operations.
Quoted 8 lines
Quoted 3 lines
Why not use the simple_* functions which should prevent that type of thing?
a hint please? I don't see how to do it with
simple_read_from_buffer, I need to return in the read fop the amount of read bytes, but don't know how to mark EOF. Because of that, 'cat' reads again just for me to tell it there's nothing else to read.
That's fine, the kernel does not tell userspace "EOF", that is up to the libc to determine. If you read the data from the hardware once, and keep it in your buffer, simple_read_from_buffer() will handle all of that logic for you, please let it do that.
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
Signed-off-by Daniel Gutson <[email protected]>--- Documentation/ABI/stable/securityfs-spi-lpc | 23 +Why is this going in securityfs at all? Why not just sysfs as it is a CPU attribute, right?
Richard already discussed that, but "it" is not only (one) CPU attribute, are SPI chip settings and attributes coming from the firmware.
All hardware things, please use sysfs, that is what it is designed for.
Quoted 2 lines
Please note that I wanted to submit the minimum patch, but I need to add more attributes.
A patch series is great to create and send showing all of that.
Quoted 18 lines
Quoted 17 lines
Review
Quoted 1 line
(quoted diff) +0
-0b/Documentation/ABI/stable/securityfs-spi-lpc
Documentation/ABI/stable/securityfs-spi-lpc line 6
Quoted 11 lines
new file mode 100644
index 000000000000..22660a7fd914Documentation/ABI/stable/securityfs-spi-lpc new file +6
-0@@ -0,0 +1,23 @@ +What: /sys/kernel/security/firmware/bioswe +Date: June 2020 +KernelVersion: 5.8.0 +Contact: [email protected] +Description: If the system firmware set BIOS Write Enable. + 0: writes disabled, 1: writes enabled.THis is very x86-specific, what about ARM/MIPS/anything else? Perhaps a cpu/arch-specific thing instead?
Quoted 3 lines
We debated this but didn't find a better match, since cpu/arch-specific seemed too core to put informational drivers.
Do you have a suggestion?
Make it explicitly hardware specific in your userspace location. Otherwise you just defined this for all hardware types, with what you used above, and I do not think you wanted to do that.
Quoted 8 lines
Quoted 4 lines
Again, which makes it seem like securityfs is not the thing for this, as it describes the hardware, not a security model which is what securityfs has been for in the past, right?
I prefer to leave this to the other discussion with Richard. It's fine for me too to use sysfs.
FWIW, the driver provides information related to firmware security.
It provides information on what is going on with the firmware, it's up to userspace to know/determine/care if that means anything with regards to "security" or not :)
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 83 lines · Greg Kroah-Hartman
Quoted 19 lines · Daniel Gutson
Quoted 16 lines · Greg Kroah-Hartman
Quoted 14 lines · Daniel Gutson
This kernel module exports configuration attributes for the system SPI chip.
This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM Bios Write Protect (SMM_BWP) fields of the Bios Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.
A technical note: I check if *ppos ==
BUFFER_SIZEin the reading function to exit early and avoid an extra access to the HW, for example when using the 'cat' command, which causes two read operations.Quoted 8 lines
Quoted 3 lines
Why not use the simple_* functions which should prevent that type of thing?
a hint please? I don't see how to do it with
simple_read_from_buffer, I need to return in the read fop the amount of read bytes, but don't know how to mark EOF. Because of that, 'cat' reads again just for me to tell it there's nothing else to read.That's fine, the kernel does not tell userspace "EOF", that is up to the libc to determine. If you read the data from the hardware once, and keep it in your buffer,
simple_read_from_buffer()will handle all of that logic for you, please let it do that.Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
Signed-off-by Daniel Gutson <[email protected]>--- Documentation/ABI/stable/securityfs-spi-lpc | 23 +Why is this going in securityfs at all? Why not just sysfs as it is a CPU attribute, right?
Richard already discussed that, but "it" is not only (one) CPU attribute, are SPI chip settings and attributes coming from the firmware.
All hardware things, please use sysfs, that is what it is designed for.
Quoted 2 lines
Please note that I wanted to submit the minimum patch, but I need to add more attributes.
A patch series is great to create and send showing all of that.
Quoted 18 lines
Quoted 17 lines
Review
Quoted 1 line
(quoted diff) +0
-0b/Documentation/ABI/stable/securityfs-spi-lpc
Documentation/ABI/stable/securityfs-spi-lpc line 6
Quoted 11 lines
new file mode 100644
index 000000000000..22660a7fd914Documentation/ABI/stable/securityfs-spi-lpc new file +6
-0@@ -0,0 +1,23 @@ +What: /sys/kernel/security/firmware/bioswe +Date: June 2020 +KernelVersion: 5.8.0 +Contact: [email protected] +Description: If the system firmware set BIOS Write Enable. + 0: writes disabled, 1: writes enabled.THis is very x86-specific, what about ARM/MIPS/anything else? Perhaps a cpu/arch-specific thing instead?
Quoted 3 lines
We debated this but didn't find a better match, since cpu/arch-specific seemed too core to put informational drivers.
Do you have a suggestion?Make it explicitly hardware specific in your userspace location. Otherwise you just defined this for all hardware types, with what you used above, and I do not think you wanted to do that.
Quoted 5 lines
Quoted 4 lines
Again, which makes it seem like securityfs is not the thing for this, as it describes the hardware, not a security model which is what securityfs has been for in the past, right?
Quoted 7 lines
Quoted 3 lines
I prefer to leave this to the other discussion with Richard. It's fine for me too to use sysfs.
FWIW, the driver provides information related to firmware security.It provides information on what is going on with the firmware, it's up to userspace to know/determine/care if that means anything with regards to "security" or not :)
Also, you seem to have missed /sys/firmware/ on your system :)
A message that is not in the archive (sent off-list or not yet received): CAFmMkTGy7u8oNSPmBHf9+URzKeNOxy5TJtqF3FCruRkTgJ_wGQ@mail.gmail.com
Greg Kroah-Hartman
maintainerQuoted 42 lines · Daniel Gutson
Quoted 30 lines · Greg Kroah-Hartman
Quoted 10 lines · Daniel Gutson
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Daniel Gutson
This kernel module exports configuration attributes for the system SPI chip.
This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM Bios Write Protect (SMM_BWP) fields of the Bios Control register. The idea is to keep adding more flags, not only from the BC but also from other registers infollowing
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
versions.
The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.
A technical note: I check if *ppos ==
BUFFER_SIZEin the readingfunction
Quoted 1 line
Quoted 1 line
Quoted 1 line
to exit early and avoid an extra access to the HW, for example when
using
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
the 'cat' command, which causes two read operations.
Why not use the simple_* functions which should prevent that type of thing?
a hint please? I don't see how to do it with
simple_read_from_buffer, I need to return in the read fop the amount of read bytes, but don't know how to mark EOF. Because of that, 'cat' reads again just for me to tellQuoted 8 lines
it
Quoted 1 line
there's nothing else to read.
That's fine, the kernel does not tell userspace "EOF", that is up to the libc to determine. If you read the data from the hardware once, and keep it in your buffer,
simple_read_from_buffer()will handle all of that logic for you, please let it do that.
Quoted 3 lines
The only way I see to do this is to dynamically allocate the buffer in the open fop, in order to avoid concurrency issues.
Is this correct?
Or use a lock, depends on what you want to do here.
But sysfs should handle all of this for you, when you switch to it.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
We debated this but didn't find a better match, since cpu/arch-specific seemed too core to put informational drivers.
Do you have a suggestion?Make it explicitly hardware specific in your userspace location.
What do you mean by "your userspace location"?
Where your files show up to userspace. sysfs is a hierarchy, don't put hardware-specific stuff at the "root" of it, otherwise that doesn't make any sense. Look at what is there today for examples of what to do.
good luck!
greg k-h
Arnd Bergmann
maintainerQuoted 9 lines · Daniel Gutson
This kernel module exports configuration attributes for the system SPI chip.
This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM Bios Write Protect (SMM_BWP) fields of the Bios Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.
Quoted 8 lines
The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.
A technical note: I check if *ppos ==
BUFFER_SIZEin the reading function to exit early and avoid an extra access to the HW, for example when using the 'cat' command, which causes two read operations.Signed-off-by Daniel Gutson <[email protected]>
The description should start with a little more background for those that don't already know what this driver is for. What is a "system SPI chip"? Is this an SPI host connected over LPC, or an LPC bus connected over SPI? Is there a particular spec that this follows?
drivers/misc/Makefile obj-$(CONFIG_PVPANIC) += pvpanic.o · line 60
Quoted 9 lines
drivers/misc/Makefile +1
-0@@ -57,3 +57,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_HABANA_AI) += habanalabs/ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o +obj-$(CONFIG_SPI_LPC) += spi_lpc/
Have you tried finding a more suitable subsystem for it? If this is for an LPC bus connected over SPI, it should probably go into drivers/bus, or a new drivers/lpc that could also contain the existing drivers/mfd/lpc_*.c and drivers/bus/hisi_lpc.c.
If this is for an SPI host connected over LPC, it should be in drivers/spi/
Quoted 6 lines
drivers/misc/spi_lpc/Kconfig new file +0
-0
drivers/misc/spi_lpc/Kconfig line 8
Quoted 8 lines
drivers/misc/spi_lpc/Kconfig new file +8
-0@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# SPI LPC information kernel module +# + +config SPI_LPC + tristate "SPI LPC information" + depends on SECURITYFS && CPU_SUP_INTEL
Can you ensure it compiles on all architectures by changing the dependency to (CPU_SUP_INTEL || COMPILE_TEST)
drivers/misc/spi_lpc/Kconfig line 10
Quoted 2 lines
drivers/misc/spi_lpc/Kconfig new file +2
-0+ help + This kernel modules exports the configuration attributes for the
s/modules/module/
drivers/misc/spi_lpc/Kconfig line 17
Quoted 7 lines
drivers/misc/spi_lpc/Kconfig new file +7
-0+ system SPI chip. + Enable this kernel module to read the BIOSWE, BLE, and SMM_BWP fields + of the Bios Control register, by reading these three files: + + /sys/kernel/security/firmware/bioswe + /sys/kernel/security/firmware/ble + /sys/kernel/security/firmware/smm_bwp
I don't understand the usage of securityfs here. Are you adding a new "firmware" LSM? If so, please split out the security module into a separate patch and have it reviewed by the respective maintainers.
drivers/misc/spi_lpc/Kconfig line 19
Quoted 2 lines
drivers/misc/spi_lpc/Kconfig new file +2
-0+static int read_spibar(enum PCH_Arch pch_arch, enum CPU_Arch cpu_arch, + u64 *offset);
Try to avoid forward declarations of static functions by reordering the files.
Quoted 9 lines
drivers/misc/spi_lpc/Kconfig new file +9
-0+int spi_read_sbase(enum PCH_Arch pch_arch __maybe_unused, + enum CPU_Arch cpu_arch, struct spi_sbase *reg) +{ + int ret = 0; + + reg->register_arch.source = RegSource_CPU; + reg->register_arch.cpu_arch = cpu_arch; + + switch (cpu_arch) {
drivers/misc/spi_lpc/Kconfig
Quoted 10 lines
drivers/misc/spi_lpc/Kconfig new file +10
-0+ case cpu_avn: + case cpu_byt: + ret = read_sbase_atom_avn_byt(®->cpu_byt); + break; + default: + ret = -EIO; + } + return ret; +} +EXPORT_SYMBOL_GPL(spi_read_sbase);
This function seems to be Intel Atom specific but has a rather generic name for an exported symbol.
drivers/misc/spi_lpc/Kconfig
Quoted 2 lines
drivers/misc/spi_lpc/Kconfig new file +2
-0+int spi_read_bc(enum PCH_Arch pch_arch, enum CPU_Arch cpu_arch, + struct spi_bc *reg)
Same here and for a couple of other functions later. Better try to use a namespace prefix that is more specific to your driver.
drivers/misc/spi_lpc/Kconfig
Quoted 8 lines
drivers/misc/spi_lpc/Kconfig new file +8
-0+enum CPU_Arch { + cpu_none, + cpu_bdw, + cpu_bdx, + cpu_hsw, + cpu_hsx, + cpu_ivt, + cpu_jkt,
You might want to avoid having a central instance listing all possible CPUs. Instead, structure it so that the common parts know nothing about a specific implementation and each one can be kept in a separate file for easier extension.
drivers/misc/spi_lpc/Kconfig
Quoted 10 lines
drivers/misc/spi_lpc/Kconfig new file +10
-0+enum RegisterSource { RegSource_PCH, RegSource_CPU }; + +struct RegisterArch { + enum RegisterSource source; + + union { + enum PCH_Arch pch_arch; + enum CPU_Arch cpu_arch; + }; +};
Please follow the normal naming of variables and types: use proper namespace prefixes and lowercase letters instead of CameLcAse.
Quoted 15 lines
drivers/misc/spi_lpc/Kconfig new file +15
-0+struct spi_bc { + struct RegisterArch register_arch; + + union { + struct bc_pch_3xx_4xx_5xx pch_3xx; + struct bc_pch_3xx_4xx_5xx pch_4xx; + struct bc_pch_3xx_4xx_5xx pch_495; + struct bc_pch_3xx_4xx_5xx pch_5xx; + struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_snb; + struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_jkt; + struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_ivb; + struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_ivt; + struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_bdw; + struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_bdx; + struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_hsx;
drivers/misc/spi_lpc/Kconfig
Quoted 10 lines
drivers/misc/spi_lpc/Kconfig new file +10
-0+ struct bc_cpu_snb_jkt_ivb_ivt_bdx_hsx cpu_hsw; + struct bc_cpu_skl_kbl_cfl cpu_skl; + struct bc_cpu_skl_kbl_cfl cpu_kbl; + struct bc_cpu_skl_kbl_cfl cpu_cfl; + struct bc_cpu_apl_glk cpu_apl; + struct bc_cpu_apl_glk cpu_glk; + struct bc_cpu_atom_avn cpu_avn; + struct bc_cpu_atom_byt cpu_byt; + }; +};
Here too, try to avoid having a central data structure that knows about all possible hardware.
Quoted 11 lines
drivers/misc/spi_lpc/Kconfig new file +11
-0+#define GENERIC_MMIO_READ(Type, Suffix, function) \ + int mmio_read_##Suffix(u64 phys_address, Type *value) \ + { \ + int ret = 0; \ + void __iomem *mapped_address = \ + ioremap(phys_address, sizeof(Type)); \ + pr_debug("Reading MMIO 0x%llx 0x%lx\n", phys_address, \ + sizeof(Type)); \ + if (mapped_address != NULL) { \ + *value = function(mapped_address); \ + iounmap(mapped_address); \
drivers/misc/spi_lpc/Kconfig
Quoted 10 lines
drivers/misc/spi_lpc/Kconfig new file +10
-0+ } else { \ + pr_err("Failed to MAP IO memory: 0x%llx\n", \ + phys_address); \ + ret = -EIO; \ + } \ + return ret; \ + } +GENERIC_MMIO_READ(u8, byte, readb) +GENERIC_MMIO_READ(u16, word, readw) +GENERIC_MMIO_READ(u32, dword, readl)
This is definitely way too generic to be added in a 'misc' driver. Why would you even want a function that reads a register by physical address?
The driver that owns the MMIO region normally maps it once during its probe() function and then keeps a pointer around
+static int __init mod_init(void)
+{
+ int ret = 0;
+
+ if (get_pch_cpu(&pch_arch, &cpu_arch) != 0) {
+ pr_err("Couldn't detect PCH or CPU\n");
+ return -EIO;
+ }
This looks like there should be a PCI (or SPI or LPC) driver instead of a linux-2.4 style module init that goes scanning the PCI bus.
Quoted 16 lines
drivers/misc/spi_lpc/Kconfig new file +16
-0+int viddid2pch_arch(u64 vid, u64 did, enum PCH_Arch *arch) +{ + switch (vid) { + case 0x8086: /* INTEL */ + switch (did) { + case 0x1c44: + case 0x1c46: + case 0x1c47: + case 0x1c49: + case 0x1c4a: + case 0x1c4b: + case 0x1c4c: + case 0x1c4d: + case 0x1c4e: + case 0x1c4f: + case 0x1c50:
drivers/misc/spi_lpc/Kconfig
Quoted 10 lines
drivers/misc/spi_lpc/Kconfig new file +10
-0+ case 0x1c52: + case 0x1c54: + case 0x1c56: + case 0x1c5c: + *arch = pch_6_c200; + return 0; + case 0x1e47: + case 0x1e48: + case 0x1e49: + case 0x1e44:
Some of these devices seem to be owned by drivers/mfd/lpc_ich.c (despite a comment in there claiming otherwise).
Can you describe the relation between your code and that one? Would it be possible to remove support for the parts that already have a driver and use an mfc driver for those?
Arnd
A message that is not in the archive (sent off-list or not yet received): CAFmMkTHrQ4LZk4+-3kdJ+dc47MXR1Jd76AXbO-ceT2zsfDRFGQ@mail.gmail.com
Arnd Bergmann
maintainerQuoted 11 lines · Daniel Gutson
Quoted 5 lines · Arnd Bergmann
On Tue, Jun 30, 2020 at 12:59 AM Daniel Gutson <[email protected]> wrote:
The description should start with a little more background for those that don't already know what this driver is for. What is a "system SPI chip"? Is this an SPI host connected over LPC, or an LPC bus connected over SPI? Is there a particular spec that this follows?"System SPI chip" refers to the main system firmware, which is accessed through an SPI interface. AFAIK there's no spec for this, though it's a de-facto standard applying to the earliest days of legacy BIOS. This driver provides visibility to the system firmware configuration access.
Oh, so it isn't even the SPI controller, just a flash chip hanging off a random SPI controller, or possibly something else. I suppose it could be any MFD device, or possibly something different.
Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
drivers/misc/spi_lpc/bios_data_access.c new file +14
-0+int spi_read_sbase (enum PCH_Arch pch_arch__maybe_unused , +enum CPU_Arch cpu_arch,struct spi_sbase *reg) +{ +int ret =0 ; + + reg->register_arch.source = RegSource_CPU; + reg->register_arch.cpu_arch = cpu_arch; + +switch (cpu_arch) { +case cpu_avn: +case cpu_byt: + ret =read_sbase_atom_avn_byt (®->cpu_byt); +break ; +default :Quoted 8 lines
drivers/misc/spi_lpc/bios_data_access.c line 62
Quoted 5 lines
drivers/misc/spi_lpc/bios_data_access.c new file +5
-0+ ret = -EIO ; + } +return ret; +} +EXPORT_SYMBOL_GPL (spi_read_sbase);This function seems to be Intel Atom specific but has a rather generic name for an exported symbol.
Quoted 8 lines
It 'currently' is atom specific, but as I mentioned in the mail, the idea was to submit an initial patch with some attributes. The more platforms and fields I need, this switch will get more and more populated. This is about reading the
SBASE register, which in my current state, is only used for Atom. I can submit
a driver with more fields where these switches get more populated, but I thought it would be easier starting with three fields only.Anyways I'll give up on the exports for now until a kernel module shows up needing the reading layer.
The problem is more the namespace: as the driver has almost nothing to do with spi, this is not what the function should be named. The other problem is that the function should not really exist in the first place, as no driver has any business reading the register base of a random other device that already has a driver.
Quoted 23 lines
Quoted 9 lines
drivers/misc/spi_lpc/bios_data_access.h line 41
Quoted 8 lines
drivers/misc/spi_lpc/bios_data_access.h new file +8
-0+enum CPU_Arch { + cpu_none, + cpu_bdw, + cpu_bdx, + cpu_hsw, + cpu_hsx, + cpu_ivt, + cpu_jkt,Quoted 4 lines
You might want to avoid having a central instance listing all possible CPUs. Instead, structure it so that the common parts know nothing about a specific implementation and each one can be kept in a separate file for easier extension.
CPUs differ in register structure, not only extending, but having different fields too. All this information comes from datasheets that don't tell "this is CPU XX with these extensions", so sometimes it is easier to copy what the datasheet says.
I didn't understand what's wrong with having a central enumeration of all available CPUs?This is a way of polymorphism, where I can just do a single
read_[register](struct register* register) and then "browse" inside the register definition by knowing the architecture. Could you please explain your alternative with more detail? The user wants its architecture's definition, and will not
...
Quoted 8 lines
Quoted 2 lines
The driver that owns the MMIO region normally maps it once during its
probe()function and then keeps a pointer aroundThis case is different. Please note that this is not a "device driver", that's why it doesn't own the MMIO region. This driver gathers information from the SPI controller only in the current state (it will be expanded). That's why it maps and then unmaps in the same operation.
To answer all the above points: This needs to be in a driver, and in case of pch, that driver is drivers/mtd/spi-nor/intel-spi.c.
This driver already has access to the registers you need, and the information you pass corresponds to the devices that this driver manages, which in turn is where user space would logically search for it. You can read the registers in the intel_spi_probe() function and then add attributes to the mtd device in sysfs.
I think a good way to handle this in a generic way would be to add members to the mtd_info structure and then have the attributes created by the mtd core code for any device that initializes those struct members, along with the existing 'type', 'size', 'flags', etc attributes.
Arnd
A message that is not in the archive (sent off-list or not yet received): CAFmMkTE3z6OZQ_v3jx-4MzMr8v+4qcF2uLn0ASGydj5oqDnfjg@mail.gmail.com
Arnd Bergmann
maintainerQuoted 11 lines · Daniel Gutson
On Tue, Jun 30, 2020 at 5:58 PM Arnd Bergmann <[email protected]> wrote:
After analyzing the intel-spi driver, I came up to these observations that led me conclude that it is not what I need to use:
* Some SPI Controllers have
0xFFFFas their VID DID bytes in the PCI config space. This causes that the PCI devices enumeration doesn't include them, and thus a PCI device driver won't be probed even despite listing the DID that the datasheet specifies. I effectively confirmed this by doing a PCI device driver and trying the intel-spi in systems with this characteristic. In short, the intel-spi driver doesn't work with these systems.
I don't understand what you mean here. How do *you* find the device if the device-id is 0xffff?
My impression was that the spi-nor host is not a PCI device at all but instead is a function on the mfd device, and probed as a platform_driver with the "intel-spi" name.
Quoted 10 lines
* Additionally, there is a difference of functionality: the intel-spi driver is a MTD, and -despite it effectively contains some of the DIDs my proposed driver supports- it doesn't offer an API to read the BIOS related registers (which is not the function
read_register, since it reads chip registers). In fact, note that it reads HSFS from the PCI config space using MMIO, by just reading the mapped memory offset. The read register callback reads a different type of registers with a different mechanism (eg it does a writel before a readl). By being a MTD, it doesn't need to read for example the Bios Control register (which I need), or other registers that I need but are irrelevant for MTD operations.
Quoted 3 lines
I should add a new interface to the driver just to read these registers or an interface to read an arbitrary offset from the mapped memory.
* Finally, some of the registers I need are present in the PCI Config Space
Config space of *which* device in particular? Is this the Atom MFD device, the SPI-NOR host, or something else?
Quoted 7 lines
(others are in other places), but the offsets (and/or the offsets of the fields) vary depending on the architecture of the CPU or the PCH. That's why I first detect the architecture based on the VID/DID and then use the appropriate definition. Moreover, there are cases where the same registers is obtained by reading the PCI CFG in some architectures, whereas it is obtained by reading MMIO in other architectures (eg Atom). All this information is provided in the Intel's datasheets.
Is this MMIO space part of a PCI device BAR, or how do you find it? If it belongs to a PCI device, which one is this, and why can't there be a driver for it?
Quoted 4 lines
Because of these reasons, I'm proposing a misc (not-device) driver that supports many Intel architectures (and families) to expose the information. I understand your proposal to first enhance existing _device_ drivers, but I couldn't find suitable options.
Maybe try adding an interface to one of the drivers at first, and then extend it to the other hardware after an initial code review. Do not bypass the driver model or try to do everything at once with a single module that knows details of multiple unrelated hardware implementations.
Arnd
Arnd Bergmann
maintainerQuoted 10 lines · Arnd Bergmann
Quoted 5 lines
Because of these reasons, I'm proposing a misc (not-device) driver that supports many Intel architectures (and families) to expose the information. I understand your proposal to first enhance existing _device_ drivers, but I couldn't find suitable options.
Maybe try adding an interface to one of the drivers at first, and then extend it to the other hardware after an initial code review. Do not bypass the driver model or try to do everything at once with a single module that knows details of multiple unrelated hardware implementations.
To clarify further how I think you can have a chance of getting the interface you want, here's a step-by-step list:
1. keep the current securityfs interface (or any other user space ABI if you have already changed it), but put it into a separate loadable module with a pair of exported functions:
spi_lpc_register_info(struct spi_lpc_data *info); spi_lpc_unregister_info(struct spi_lpc_data *info);
The names will have to change later, but the idea is that any driver can just pass the information you want to export to user space, and the interface module does not care where those values came from.
2. For any PCI device ID that is handled by drivers/mtd/spi-nor/intel-spi-pci.c, move the code to call the function from your driver into that file, reading the registers with pci_read_config_dword() or readl(ispi->base + CONSTANT).
3. For any PCI device ID that is handled by drivers/mfd/lpc_ich.c, do the same by moving the code to drivers/mtd/spi-nor/controllers/intel-spi-platform.c.
4. For any remaining PCI device ID you look at that does not have a driver, create a new PCI driver that binds to those IDs and does the same thing. If you have multiple device IDs that use the same register layout, then handle those with a common driver.
Arnd
A message that is not in the archive (sent off-list or not yet received): CAFmMkTGkmBgmv6wmS1kNWxGm0ktN56u9pJVJQKyPvLipyHsgqw@mail.gmail.com
Greg Kroah-Hartman
maintainerQuoted 26 lines · Daniel Gutson
Quoted 16 lines · Arnd Bergmann
Quoted 2 lines · Arnd Bergmann
Quoted 2 lines
Because of these reasons, I'm proposing a misc (not-device) driver
that supports
Quoted 2 lines
Quoted 2 lines
many Intel architectures (and families) to expose the information. I understand your proposal to first enhance existing _device_ drivers,
but I
Quoted 3 lines
Quoted 1 line
couldn't find suitable options.
Maybe try adding an interface to one of the drivers at first, and then
extend
Quoted 1 line
it to the other hardware after an initial code review. Do not bypass the
driver
Quoted 2 lines
model or try to do everything at once with a single module that knows details of multiple unrelated hardware implementations.
Quoted 6 lines
To clarify further how I think you can have a chance of getting the interface you want, here's a step-by-step list:
1. keep the current securityfs interface (or any other user space ABI if you have already changed it), but put it into a separate loadable module
Quoted 6 lines
If it is a loadable module, how can I ensure that it was loaded before the intel-spi driver, so the latter can call
the API of the former? What if the driver was not loaded, when the intel-spi driver will try to call
your suggestedspi_lpc_register_info? In other words, how can I prevent to call functions from an unloaded driver?
THe symbol will not be resolved so the module will not be able to be loaded in the first place, OR your module will be loaded first by the system to prevent that.
Quoted 3 lines
Do I just add the dependency in the
Kconfig? But if so, what about the order of initialization?
A hint please?
Try it and see what happens, it should all "just work" :)
thanks,
greg k-h
Arnd Bergmann
maintainerQuoted 5 lines · Daniel Gutson
After analyzing the intel-spi driver, I came up to these observations that led me conclude that it is not what I need to use:
* Some SPI Controllers have
0xFFFFas their VID DID bytes in the PCI config space. This causes that the PCI devices enumeration doesn't include them, and thus a PCI device driver won't be probed even despite listing the DID that the datasheet specifies. I effectively confirmed this by doing a PCI device driver and trying the intel-spi in systems with this characteristic. In short, the intel-spi driver doesn't work with these systems.
Maybe this part can be handled with a fixup in drivers/pci that changes the effective
PCI device ID on the systems that do need to access the device.
Adding the PCI mailing list for other ideas. Basically it sounds like the BIOS has
intentionally configured the SPI-NOR device to be hidden from PCI probing to prevent operating systems from accessing it, but you want to ignore that and access it anyway, correct?
Arnd
Greg Kroah-Hartman
maintainerdrivers/misc/spi_lpc/bios_data_access.h line 9
Quoted 12 lines · Daniel Gutson
drivers/misc/spi_lpc/bios_data_access.h new file +9
-0@@ -0,0 +1,181 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* SPI LPC flash platform security driver +* +* Copyright 2020 (c) Daniel Gutson ([email protected]) +* +*/ +#ifndef BIOS_DATA_ACCESS_H +#define BIOS_DATA_ACCESS_H
What BIOS? Is this a UEFI thing? ACPI? Uboot? Fastboot?
drivers/misc/spi_lpc/bios_data_access.h line 13
Quoted 4 lines
drivers/misc/spi_lpc/bios_data_access.h new file +4
-0+ +#include <linux/types.h> + +enum PCH_Arch {
Why the upper-case name?
Quoted 8 lines
drivers/misc/spi_lpc/bios_data_access.h new file +8
-0+ pch_none, + pch_6_c200, + pch_7_c210, + pch_c60x_x79, + pch_communications_89xx, + pch_8_c220, + pch_c61x_x99, + pch_5_mobile,
drivers/misc/spi_lpc/bios_data_access.h line 31
Quoted 10 lines
drivers/misc/spi_lpc/bios_data_access.h new file +10
-0+ pch_6_mobile, + pch_7_8_mobile, + pch_1xx, + pch_c620, + pch_2xx, + pch_3xx, + pch_4xx, + pch_495, + pch_5xx, + PCH_Archs_count
Do these have real values that the hardware expects? If so, you need to assign them numbers, right? If not, what do all of these mean?
Quoted 18 lines
drivers/misc/spi_lpc/bios_data_access.h new file +18
-0+}; + +enum CPU_Arch { + cpu_none, + cpu_bdw, + cpu_bdx, + cpu_hsw, + cpu_hsx, + cpu_ivt, + cpu_jkt, + cpu_kbl, + cpu_skl, + cpu_ivb, + cpu_snb, + cpu_avn, + cpu_cfl, + cpu_byt, + cpu_whl,
drivers/misc/spi_lpc/bios_data_access.h line 59
Quoted 10 lines
drivers/misc/spi_lpc/bios_data_access.h new file +10
-0+ cpu_cml, + cpu_icl, + cpu_apl, + cpu_glk, + cpu_tgl, + cpu_amd, + CPU_Archs_count +}; + +enum RegisterSource { RegSource_PCH, RegSource_CPU };
Again all of the Caps, please don't use, that's not Linux styles (and checkpatch.pl should have warned you about this, did you run it on your patch?)
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 16 lines · Daniel Gutson
This kernel module exports configuration attributes for the system SPI chip.
This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM Bios Write Protect (SMM_BWP) fields of the Bios Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.
A technical note: I check if *ppos ==
BUFFER_SIZEin the reading function to exit early and avoid an extra access to the HW, for example when using the 'cat' command, which causes two read operations.Signed-off-by Daniel Gutson <[email protected]>
Quoted 15 lines
--- Documentation/ABI/stable/securityfs-spi-lpc | 23 + MAINTAINERS | 6 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/spi_lpc/Kconfig | 20 + drivers/misc/spi_lpc/Makefile | 8 + drivers/misc/spi_lpc/bios_data_access.c | 559 +++++++++++++++++++ drivers/misc/spi_lpc/bios_data_access.h | 181 +++++++ drivers/misc/spi_lpc/low_level_access.c | 59 ++ drivers/misc/spi_lpc/low_level_access.h | 21 + drivers/misc/spi_lpc/spi_lpc_main.c | 176 ++++++ drivers/misc/spi_lpc/viddid_arch_map.c | 566 ++++++++++++++++++++ drivers/misc/spi_lpc/viddid_arch_map.h | 17 + 13 files changed, 1638 insertions(+)
A single driver that is 1500 lines long is fine, why split this up into tiny pieces?
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 1 line · Daniel Gutson
+EXPORT_SYMBOL_GPL(spi_read_sbase);
Why are you exporting symbols? Nothing in this patch uses them.
And that's the spi_* namespace for the SPI core, not your tiny driver, why pollute the global namespace in a confusing way like this?
thanks,
greg k-h
kernel test robot
build botI love your patch! Yet something to improve:
Hi Daniel,
I love your patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on soc/for-next linus/master v5.8-rc3 next-20200701] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Daniel-Gutson/SPI-LPC-information-kernel-module/20200630-070234 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git ba2104c24aba1fa7e19d53f08c985526a6786d8b config: um-allmodconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=um
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/misc/spi_lpc/spi_lpc_main.c:11:
include/asm-generic/fixmap.h: In function 'fix_to_virt':
include/asm-generic/fixmap.h:32:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~~~~~~~~~~~
In file included from include/linux/string.h:6,
from include/linux/uuid.h:12,
from include/linux/mod_devicetable.h:13,
from include/linux/pci.h:27,
from drivers/misc/spi_lpc/low_level_access.c:11:
include/asm-generic/fixmap.h: In function 'fix_to_virt':
include/asm-generic/fixmap.h:32:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~~~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/huge_mm.h:8,
from include/linux/mm.h:675,
from include/linux/scatterlist.h:8,
from include/linux/dma-mapping.h:11,
from include/linux/pci-dma-compat.h:8,
from include/linux/pci.h:2415,
from drivers/misc/spi_lpc/low_level_access.c:11:
arch/um/include/asm/uaccess.h: In function '__access_ok':
arch/um/include/asm/uaccess.h:17:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
17 | (((unsigned long) (addr) >= FIXADDR_USER_START) && \
| ^~
arch/um/include/asm/uaccess.h:45:3: note: in expansion of macro '__access_ok_vsyscall'
45 | __access_ok_vsyscall(addr, size) ||
| ^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/debugfs.h:15,
from drivers/misc/eeprom/idt_89hpesx.c:78:
arch/um/include/asm/uaccess.h: In function '__access_ok':
arch/um/include/asm/uaccess.h:17:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
17 | (((unsigned long) (addr) >= FIXADDR_USER_START) && \
| ^~
arch/um/include/asm/uaccess.h:45:3: note: in expansion of macro '__access_ok_vsyscall'
45 | __access_ok_vsyscall(addr, size) ||
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'pci_read_byte':
>> drivers/misc/spi_lpc/low_level_access.c:42:31: error: implicit declaration of function 'pci_find_bus'; did you mean 'pci_find_next_bus'? [-Werror=implicit-function-declaration]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:56:1: note: in expansion of macro 'GENERIC_PCI_READ'
56 | GENERIC_PCI_READ(byte, u8)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:42:31: warning: initialization of 'struct pci_bus *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:56:1: note: in expansion of macro 'GENERIC_PCI_READ'
56 | GENERIC_PCI_READ(byte, u8)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:46:10: error: implicit declaration of function 'pci_bus_read_config_byte'; did you mean 'pci_read_config_byte'? [-Werror=implicit-function-declaration]
46 | ret = pci_bus_read_config_##Suffix( \
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:56:1: note: in expansion of macro 'GENERIC_PCI_READ'
56 | GENERIC_PCI_READ(byte, u8)
| ^~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'pci_read_word':
>> drivers/misc/spi_lpc/low_level_access.c:42:31: warning: initialization of 'struct pci_bus *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:57:1: note: in expansion of macro 'GENERIC_PCI_READ'
57 | GENERIC_PCI_READ(word, u16)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:46:10: error: implicit declaration of function 'pci_bus_read_config_word'; did you mean 'pci_read_config_word'? [-Werror=implicit-function-declaration]
46 | ret = pci_bus_read_config_##Suffix( \
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:57:1: note: in expansion of macro 'GENERIC_PCI_READ'
57 | GENERIC_PCI_READ(word, u16)
| ^~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'pci_read_dword':
>> drivers/misc/spi_lpc/low_level_access.c:42:31: warning: initialization of 'struct pci_bus *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:58:1: note: in expansion of macro 'GENERIC_PCI_READ'
58 | GENERIC_PCI_READ(dword, u32)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:46:10: error: implicit declaration of function 'pci_bus_read_config_dword'; did you mean 'pci_read_config_dword'? [-Werror=implicit-function-declaration]
46 | ret = pci_bus_read_config_##Suffix( \
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:58:1: note: in expansion of macro 'GENERIC_PCI_READ'
58 | GENERIC_PCI_READ(dword, u32)
| ^~~~~~~~~~~~~~~~ drivers/misc/enclosure.c:115: warning: Function parameter or member 'name' not described in 'enclosure_register' drivers/misc/enclosure.c:115: warning: Function parameter or member 'cb' not described in 'enclosure_register' drivers/misc/enclosure.c:283: warning: Function parameter or member 'number' not described in 'enclosure_component_alloc' drivers/misc/enclosure.c:283: warning: Excess function parameter 'num' description in 'enclosure_component_alloc' drivers/misc/enclosure.c:363: warning: Function parameter or member 'component' not described in 'enclosure_add_device' drivers/misc/enclosure.c:363: warning: Excess function parameter 'num' description in 'enclosure_add_device' drivers/misc/enclosure.c:398: warning: Function parameter or member 'dev' not described in 'enclosure_remove_device' drivers/misc/enclosure.c:398: warning: Excess function parameter 'num' description in 'enclosure_remove_device'
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:280: drivers/misc/spi_lpc/low_level_access.o] Error 1
make[4]: Target '__build' not remade because of errors.
make[3]: *** [scripts/Makefile.build:497: drivers/misc/spi_lpc] Error 2
cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
make[2]: *** [scripts/Makefile.build:497: drivers/misc] Error 2
make[2]: Target '__build' not remade because of errors.
make[3]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1756: drivers] Error 2
make[1]: Target 'drivers/misc/' not remade because of errors.
--
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/misc/spi_lpc/spi_lpc_main.c:11:
include/asm-generic/fixmap.h: In function 'fix_to_virt':
include/asm-generic/fixmap.h:32:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~~~~~~~~~~~
In file included from include/linux/string.h:6,
from include/linux/uuid.h:12,
from include/linux/mod_devicetable.h:13,
from include/linux/pci.h:27,
from drivers/misc/spi_lpc/low_level_access.c:11:
include/asm-generic/fixmap.h: In function 'fix_to_virt':
include/asm-generic/fixmap.h:32:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~~~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/huge_mm.h:8,
from include/linux/mm.h:675,
from include/linux/scatterlist.h:8,
from include/linux/dma-mapping.h:11,
from include/linux/pci-dma-compat.h:8,
from include/linux/pci.h:2415,
from drivers/misc/spi_lpc/low_level_access.c:11:
arch/um/include/asm/uaccess.h: In function '__access_ok':
arch/um/include/asm/uaccess.h:17:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
17 | (((unsigned long) (addr) >= FIXADDR_USER_START) && \
| ^~
arch/um/include/asm/uaccess.h:45:3: note: in expansion of macro '__access_ok_vsyscall'
45 | __access_ok_vsyscall(addr, size) ||
| ^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/debugfs.h:15,
from drivers/misc/eeprom/idt_89hpesx.c:78:
arch/um/include/asm/uaccess.h: In function '__access_ok':
arch/um/include/asm/uaccess.h:17:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
17 | (((unsigned long) (addr) >= FIXADDR_USER_START) && \
| ^~
arch/um/include/asm/uaccess.h:45:3: note: in expansion of macro '__access_ok_vsyscall'
45 | __access_ok_vsyscall(addr, size) ||
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'pci_read_byte':
>> drivers/misc/spi_lpc/low_level_access.c:42:31: error: implicit declaration of function 'pci_find_bus'; did you mean 'pci_find_next_bus'? [-Werror=implicit-function-declaration]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:56:1: note: in expansion of macro 'GENERIC_PCI_READ'
56 | GENERIC_PCI_READ(byte, u8)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:42:31: warning: initialization of 'struct pci_bus *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:56:1: note: in expansion of macro 'GENERIC_PCI_READ'
56 | GENERIC_PCI_READ(byte, u8)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:46:10: error: implicit declaration of function 'pci_bus_read_config_byte'; did you mean 'pci_read_config_byte'? [-Werror=implicit-function-declaration]
46 | ret = pci_bus_read_config_##Suffix( \
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:56:1: note: in expansion of macro 'GENERIC_PCI_READ'
56 | GENERIC_PCI_READ(byte, u8)
| ^~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'pci_read_word':
>> drivers/misc/spi_lpc/low_level_access.c:42:31: warning: initialization of 'struct pci_bus *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:57:1: note: in expansion of macro 'GENERIC_PCI_READ'
57 | GENERIC_PCI_READ(word, u16)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:46:10: error: implicit declaration of function 'pci_bus_read_config_word'; did you mean 'pci_read_config_word'? [-Werror=implicit-function-declaration]
46 | ret = pci_bus_read_config_##Suffix( \
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:57:1: note: in expansion of macro 'GENERIC_PCI_READ'
57 | GENERIC_PCI_READ(word, u16)
| ^~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c: In function 'pci_read_dword':
>> drivers/misc/spi_lpc/low_level_access.c:42:31: warning: initialization of 'struct pci_bus *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
42 | struct pci_bus *found_bus = pci_find_bus(0, bus); \
| ^~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:58:1: note: in expansion of macro 'GENERIC_PCI_READ'
58 | GENERIC_PCI_READ(dword, u32)
| ^~~~~~~~~~~~~~~~
>> drivers/misc/spi_lpc/low_level_access.c:46:10: error: implicit declaration of function 'pci_bus_read_config_dword'; did you mean 'pci_read_config_dword'? [-Werror=implicit-function-declaration]
46 | ret = pci_bus_read_config_##Suffix( \
| ^~~~~~~~~~~~~~~~~~~~
drivers/misc/spi_lpc/low_level_access.c:58:1: note: in expansion of macro 'GENERIC_PCI_READ'
58 | GENERIC_PCI_READ(dword, u32)
| ^~~~~~~~~~~~~~~~ drivers/misc/enclosure.c:115: warning: Function parameter or member 'name' not described in 'enclosure_register' drivers/misc/enclosure.c:115: warning: Function parameter or member 'cb' not described in 'enclosure_register' drivers/misc/enclosure.c:283: warning: Function parameter or member 'number' not described in 'enclosure_component_alloc' drivers/misc/enclosure.c:283: warning: Excess function parameter 'num' description in 'enclosure_component_alloc' drivers/misc/enclosure.c:363: warning: Function parameter or member 'component' not described in 'enclosure_add_device' drivers/misc/enclosure.c:363: warning: Excess function parameter 'num' description in 'enclosure_add_device' drivers/misc/enclosure.c:398: warning: Function parameter or member 'dev' not described in 'enclosure_remove_device' drivers/misc/enclosure.c:398: warning: Excess function parameter 'num' description in 'enclosure_remove_device'
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:280: drivers/misc/spi_lpc/low_level_access.o] Error 1
make[4]: Target '__build' not remade because of errors.
make[3]: *** [scripts/Makefile.build:497: drivers/misc/spi_lpc] Error 2
cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
make[2]: *** [scripts/Makefile.build:497: drivers/misc] Error 2
make[2]: Target '__build' not remade because of errors.
make[3]: Target '__build' not remade because of errors.
..
vim +42 drivers/misc/spi_lpc/low_level_access.c
36
37 #define GENERIC_PCI_READ(Suffix, Type) \
38 int pci_read_##Suffix(Type *value, u64 bus, u64 device, u64 function, \
39 u64 offset) \
40 { \
41 int ret; \
> 42 struct pci_bus *found_bus = pci_find_bus(0, bus); \
43 pr_debug("Reading PCI 0x%llx 0x%llx 0x%llx 0x%llx\n", bus, \
44 device, function, offset); \
45 if (found_bus != NULL) { \
> 46 ret = pci_bus_read_config_##Suffix( \
47 found_bus, PCI_DEVFN(device, function), \
48 offset, value); \
49 } else { \
50 pr_err("Couldn't find Bus 0x%llx\n", bus); \
51 ret = -EIO; \
52 } \
53 return ret; \
54 }
55
> 56 GENERIC_PCI_READ(byte, u8)---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org