tcpi refactoring
v2 cover tcpi refactoring
Rewrite the tcpi test so we use the new LTP API.
- rewrite kernel module
- rewrite LTP test
- merge kernel module and LTP test in the same folder
---
Changes in v2:
- fix commit tag
- check that device exists
- skip PCI_DISABLE because it's an unreliable test
- Link to v1: https://lore.kernel.org/[email protected]
---
Andrea Cervesato (2):
tpci: refactor kernel module
tpci: refactor test using new API
.../pci/{tpci_kernel => tpci}/.gitignore | 3 +-
testcases/kernel/device-drivers/pci/tpci/Makefile | 22 ++
.../pci/{tpci_kernel => tpci}/ltp_tpci.c | 230 +++++++++++----------
testcases/kernel/device-drivers/pci/tpci/tpci.c | 166 +++++++++++++++
testcases/kernel/device-drivers/pci/tpci/tpci.h | 36 ++++
.../kernel/device-drivers/pci/tpci_kernel/Makefile | 35 ----
.../pci/tpci_kernel/pci-exp-tests-HOWTO | 58 ------
.../kernel/device-drivers/pci/tpci_kernel/tpci.h | 43 ----
.../kernel/device-drivers/pci/tpci_user/.gitignore | 1 -
.../kernel/device-drivers/pci/tpci_user/Makefile | 20 --
.../kernel/device-drivers/pci/tpci_user/tpci.c | 115 -----------
11 files changed, 342 insertions(+), 387 deletions(-)---
base-commit: 12fcadf63a99fc4bec76f9b4715cda626256562f
change-id: 20260804-tpci_refactoring-64b59221ae5c
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/2 tpci: refactor kernel module
From: Andrea Cervesato <[email protected]>
The kernel module lacked proper SPDX licensing, documentation, and used deprecated permission macros.
Update the code to modern kernel standards by applying SPDX tags, replacing sscanf with kstrto*, replacing custom print macros with standard pr_* macros, adding a documentation block, and removing the stale pci-exp-tests-HOWTO file which references long-removed paths and macros.
--- .../device-drivers/pci/tpci_kernel/ltp_tpci.c | 230 +++++++++++---------- .../pci/tpci_kernel/pci-exp-tests-HOWTO | 58 ------ .../kernel/device-drivers/pci/tpci_kernel/tpci.h | 21 +- 3 files changed, 123 insertions(+), 186 deletions(-)
testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c +116 -114
@@ -1,47 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) International Business Machines Corp., 2001 +* 5/20/2003 - Sean Ruyle ([email protected]) * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. +* 8/20/2004 - Amit Khanna ([email protected]) +* Copyright (C) 2026 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +/*\ +* This PCI and PCI-Express testing kernel module allows test calls to be +* driven through various sysfs interactions in a user-space program. * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -* the GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* This pci and pci-express testing kernel module will allow test calls -* to be driven through various ioctl calls in a -* user space program that has attained the appropriate -* file descriptor for this device. For the functions of -* this module to work correctly there must be a pci / pci-express -* device somewhere in the system. The tests do not need -* a specific device, and the first pci device available -* will be grabbed. +* For the functions of this module to work correctly, there must be a +* PCI / PCI-Express device somewhere in the system. The tests do not need +* a specific device; the first PCI device available will be grabbed. * -* author: Sean Ruyle ([email protected]) -* date: 5/20/2003 -* PCI-Express test scripts author: Amit Khanna ([email protected]) -* date: 8/20/2004 +* The following test cases can be called from user-space: * -* file: tpci.c, -* module: tpci +* - PCI_DISABLE +* - PCI_ENABLE +* - FIND_BUS +* - FIND_DEVICE +* - FIND_CLASS +* - FIND_SUBSYS +* - BUS_SCAN +* - SLOT_SCAN +* - BUS_ADD_DEVICES +* - MATCH_DEVICE +* - REG_DRIVER +* - UNREG_DRIVER +* - PCI_RESOURCES +* - SAVE_STATE +* - RESTORE_STATE +* - FIND_CAP +* - PCI_EXP_CAP_CONFIG */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/fs.h> -#include <linux/ioctl.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> -#include "tpci.h" MODULE_AUTHOR ("Sean Ruyle <[email protected]>" );
@@ -50,13 +52,6 @@ MODULE_AUTHOR("Copyright (c) 2013 Oracle and/or its affiliates");MODULE_DESCRIPTION ("LTP PCI Test" );MODULE_LICENSE ("GPL" ); -#define prk_err (fmt, ...) \ - pr_err(PCI_DEVICE_NAME ": " fmt "\n", ##__VA_ARGS__) -#define prk_info (fmt, ...) \ - pr_info(PCI_DEVICE_NAME ": " fmt "\n", ##__VA_ARGS__) -#define prk_debug (fmt, ...) \ - pr_debug(PCI_DEVICE_NAME ": " fmt "\n", ##__VA_ARGS__) -#define TPASS 0#define TFAIL 1#define TSKIP 32
@@ -105,15 +100,19 @@ static int probe_pci_dev(unsigned int bus, unsigned int slot) } dev =pci_get_domain_bus_and_slot (0 , bus, slot); -if (!dev || !dev->driver) +if (!dev) +return -ENODEV ; +if (!dev->driver) { +pci_dev_put (dev);return -ENODEV ; + } -prk_info ("found pci_dev '%s', bus %u, devfn %u" , +pr_info ("found pci_dev '%s', bus %u, devfn %u\n" ,pci_name (dev), bus, slot); ltp_pci.dev = dev; ltp_pci.bus = dev->bus; -prk_info ("Bus number: %d" , dev->bus->number); +pr_info ("Bus number: %d\n" , dev->bus->number);return 0 ; }
@@ -126,20 +125,20 @@ static int pci_enable(void) {struct pci_dev *dev = ltp_pci.dev; -prk_info ("enable pci device" ); +pr_info ("enable pci device\n" );/* check if can enable the device pointer */ if (!dev) { -prk_err ("dev is NULL" ); +pr_err ("dev is NULL\n" );return TFAIL ; }if (pci_enable_device (dev)) { -prk_err ("failed to enable pci device" ); +pr_err ("failed to enable pci device\n" );return TFAIL ; } -prk_info ("enabled pci device" ); +pr_info ("enabled pci device\n" );return TPASS ; }
@@ -147,15 +146,15 @@ static int pci_disable(void) {struct pci_dev *dev = ltp_pci.dev; -prk_info ("disable pci device" ); +pr_info ("disable pci device\n" );/* check if device pointer exists */ if (!dev) { -prk_err ("dev is NULL" ); +pr_err ("dev is NULL\n" );return TFAIL ; } -prk_info ("is pci enabled '%d', is managed '%d'" , +pr_info ("is pci enabled '%d', is managed '%d'\n" ,pci_is_enabled (dev),pci_is_managed (dev));pci_release_regions (dev);
@@ -164,13 +163,13 @@ static int pci_disable(void)if (dev->current_state == PCI_D3hot || dev->current_state == PCI_D3cold) { -prk_info ("disabled pci device, state '%s'" , +pr_info ("disabled pci device, state '%s'\n" ,pci_power_name (dev->current_state));return TPASS ; } -prk_err ("failed to disable pci device, state '%s'" , +pr_err ("failed to disable pci device, state '%s'\n" ,pci_power_name (dev->current_state));return TFAIL ; }
@@ -186,19 +185,19 @@ static int test_find_bus(void)int num = ltp_pci.bus->number;struct pci_bus *temp =NULL ; -prk_info ("find bus" ); +pr_info ("find bus\n" ); temp =pci_find_bus (pci_domain_nr (ltp_pci.bus), num);if (!temp) { -prk_info ("pci_find_bus failed" ); +pr_info ("pci_find_bus failed\n" );return TFAIL ; }else if (temp->number != num) { -prk_err ("returned bus pointer w/ wrong bus number" ); +pr_err ("returned bus pointer w/ wrong bus number\n" );return TFAIL ; } -prk_info ("success returned bus pointer" ); +pr_info ("success returned bus pointer\n" );return TPASS ; }
@@ -212,16 +211,16 @@ static int test_find_class(void)unsigned int num = ltp_pci.dev->class;struct pci_dev *temp =NULL ; -prk_info ("find pci class" ); +pr_info ("find pci class\n" ); temp =pci_get_class (num,NULL );if (!temp) { -prk_err ("failed to find pci device from class number" ); +pr_err ("failed to find pci device from class number\n" );return TFAIL ; } -prk_info ("found pci device from class number" ); +pr_info ("found pci device from class number\n" );pci_dev_put (temp);return TPASS ;
@@ -238,16 +237,16 @@ static int test_find_device(void)struct pci_dev *temp =NULL ;unsigned short ven = ltp_pci.dev->vendor, dev = ltp_pci.dev->device; -prk_info ("get pci device" ); +pr_info ("get pci device\n" ); temp =pci_get_device (ven, dev,NULL );if (!temp) { -prk_err ("failed to find pci device from device info" ); +pr_err ("failed to find pci device from device info\n" );return TFAIL ; } -prk_info ("found pci device from device info" ); +pr_info ("found pci device from device info\n" );pci_dev_put (temp);return TPASS ;
@@ -267,15 +266,15 @@ static int test_find_subsys(void) ss_ven = ltp_pci.dev->subsystem_vendor, ss_dev = ltp_pci.dev->subsystem_device; -prk_info ("get pci subsys" ); +pr_info ("get pci subsys\n" ); temp =pci_get_subsys (ven, dev, ss_ven, ss_dev,NULL );if (!temp) { -prk_err ("failed to find pci device from subsys info" ); +pr_err ("failed to find pci device from subsys info\n" );return TFAIL ; } -prk_info ("found pci device from subsys info" ); +pr_info ("found pci device from subsys info\n" );pci_dev_put (temp);return TPASS ;
@@ -293,7 +292,7 @@ static int test_scan_bus(void)int num;struct pci_bus *bus = ltp_pci.bus; -prk_info ("scan pci bus" ); +pr_info ("scan pci bus\n" ); num =pci_rescan_bus (bus);/*
@@ -301,10 +300,10 @@ static int test_scan_bus(void)* max number of bus or less than 0 */ if (num >MAX_BUS || num <0 ) { -prk_err ("failed scan bus" ); +pr_err ("failed scan bus\n" );return TFAIL ; } -prk_info ("success scan bus" ); +pr_info ("success scan bus\n" );return TPASS ; }
@@ -319,18 +318,18 @@ static int test_slot_scan(void)int ret, num = ltp_pci.dev->devfn;struct pci_bus *bus = ltp_pci.bus; -prk_info ("scan pci slot" ); +pr_info ("scan pci slot\n" );if ((num %8 ) !=0 )return TPASS ; ret =pci_scan_slot (bus, num);if (ret >=0 ) { -prk_info ("found '%d' devices from scan slot" , ret); +pr_info ("found '%d' devices from scan slot\n" , ret);return TPASS ; } -prk_err ("pci_scan_slot failed" ); +pr_err ("pci_scan_slot failed\n" );return TFAIL ; }
@@ -345,16 +344,16 @@ static int test_bus_add_devices(void) {struct pci_bus *bus = ltp_pci.bus; -prk_info ("add bus device" ); +pr_info ("add bus device\n" );pci_bus_add_devices (bus);if (bus) { -prk_info ("called bus_add_device" ); +pr_info ("called bus_add_device\n" );return TPASS ; } -prk_err ("bus_add_device failed" ); +pr_err ("bus_add_device failed\n" );return TFAIL ; }
@@ -369,23 +368,23 @@ static int test_match_device(void)struct pci_driver *drv;const struct pci_device_id *id; -prk_info ("test pci_device_id()" ); +pr_info ("test pci_device_id()\n" ); drv =pci_dev_driver (dev);if (!drv) { -prk_err ("driver pointer not allocated for pci_dev" ); +pr_err ("driver pointer not allocated for pci_dev\n" );return TFAIL ; } id =pci_match_id (drv->id_table, dev);if (id) { -prk_info ("match device success" ); +pr_info ("match device success\n" );return TPASS ; } -prk_err ("failed return pci_device_id" ); +pr_err ("failed return pci_device_id\n" );return TFAIL ; }
@@ -398,13 +397,13 @@ static int test_match_device(void)*/ static int test_reg_driver (void ) { -prk_info ("test pci_register_driver" ); +pr_info ("test pci_register_driver\n" );if (pci_register_driver (<p_pci_driver)) { -prk_err ("unsuccessful registering pci driver" ); +pr_err ("unsuccessful registering pci driver\n" );return TFAIL ; } pci_registered =1 ; -prk_info ("success driver register" ); +pr_info ("success driver register\n" );return TPASS ; }
@@ -431,12 +430,12 @@ static int test_assign_resources(void)struct pci_dev *dev = ltp_pci.dev;struct resource *r; -prk_info ("assign resources" ); +pr_info ("assign resources\n" );for (i =0 ; i <7 ; ++i) { -prk_info ("assign resource #%d" , i); +pr_info ("assign resource #%d\n" , i); r = &dev->resource[i]; -prk_info ("name = %s, flags = %lu, start 0x%lx, end 0x%lx" , +pr_info ("name = %s, flags = %lu, start 0x%lx, end 0x%lx\n" , r->name, r->flags, (unsigned long )r->start, (unsigned long )r->end);
@@ -450,14 +449,14 @@ static int test_assign_resources(void)pci_release_resource (dev, i); ret =pci_assign_resource (dev, i); -prk_info ("assign resource to '%d', ret '%d'" , i, ret); +pr_info ("assign resource to '%d', ret '%d'\n" , i, ret);if (ret ==0 && dev->hdr_type ==PCI_HEADER_TYPE_NORMAL ) {int attach_ret; attach_ret =device_attach (&dev->dev);if (attach_ret <0 ) -prk_info ("device_attach failed for endpoint, ret: %d" , attach_ret); +pr_info ("device_attach failed for endpoint, ret: %d\n" , attach_ret); } rc |= (ret <0 && ret != -EBUSY ) ?TFAIL :TPASS ;
@@ -483,14 +482,14 @@ static int test_save_state(void) {struct pci_dev *dev = ltp_pci.dev; -prk_info ("save state" ); +pr_info ("save state\n" );if (pci_save_state (dev)) { -prk_err ("failed save state" ); +pr_err ("failed save state\n" );return TFAIL ; } -prk_info ("saved state of device" ); +pr_info ("saved state of device\n" );return TPASS ; }
@@ -503,7 +502,7 @@ static int test_restore_state(void) {struct pci_dev *dev = ltp_pci.dev; -prk_info ("restore state" ); +pr_info ("restore state\n" );pci_restore_state (dev);
@@ -521,12 +520,12 @@ static int test_find_cap(void) {struct pci_dev *dev = ltp_pci.dev; -prk_info ("find device capability" ); +pr_info ("find device capability\n" );if (pci_find_capability (dev,PCI_CAP_ID_PM )) -prk_info ("does not have tested capability" ); +pr_info ("device has PM capability\n" );else -prk_info ("device has PM capability" ); +pr_info ("does not have tested capability\n" );return TPASS ; }
@@ -546,24 +545,24 @@ static int test_read_pci_exp_config(void)/* skip the test if device doesn't have PCIe capability */ pos =pci_pcie_cap (dev);if (!pos) { -prk_info ("device doesn't have PCI-EXP capability" ); +pr_info ("device doesn't have PCI-EXP capability\n" );return TSKIP ; } -prk_info ("read the PCI Express configuration registers at 0x%x" , pos); +pr_info ("read the PCI Express configuration registers at 0x%x\n" , pos);if (pci_read_config_dword (dev, pos, &header)) { -prk_err ("failed to read config dword" ); +pr_err ("failed to read config dword\n" );return TFAIL ; }/* comparing the value read with PCI_CAP_ID_EXP macro */ if ((header &0x000000ff ) ==PCI_CAP_ID_EXP ) { -prk_info ("correct val read using PCIE driver installed: 0x%x" , +pr_info ("correct val read using PCIE driver installed: 0x%x\n" , header);return TPASS ; } -prk_err ("incorrect val read. PCIE driver/device not installed: 0x%x" , +pr_err ("incorrect val read. PCIE driver/device not installed: 0x%x\n" , header);return TFAIL ; }
@@ -573,7 +572,7 @@ static int test_case(unsigned int cmd)int rc =TSKIP ;if (!ltp_pci.dev || !ltp_pci.bus) { -prk_err ("device or bus not selected for test" ); +pr_err ("device or bus not selected for test\n" );return TFAIL ; }
@@ -630,7 +629,7 @@ static int test_case(unsigned int cmd) rc =test_read_pci_exp_config ();break ;default : -prk_info ("mismatching test-case command %d" , cmd); +pr_info ("mismatching test-case command %d\n" , cmd);break ; }
@@ -645,7 +644,7 @@ static int test_result;static void device_release (struct device *dev) { -prk_info ("device released\n" ); +pr_info ("device released\n" ); }static struct device tdev = {
@@ -654,34 +653,36 @@ static struct device tdev = { };/* print test result to sysfs file */ -static ssize_t sys_result (struct device *dev, +static ssize_t result_show (struct device *dev,struct device_attribute *attr,char *buf) {return scnprintf (buf,PAGE_SIZE ,"%d\n" , test_result); } -static DEVICE_ATTR(result, S_IRUSR, sys_result, NULL); +static DEVICE_ATTR_RO (result); -static ssize_t sys_tcase (struct device *dev, +static ssize_t tcase_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {int tc =0 ; -sscanf (buf,"%d" , &tc); -prk_info ("test-case %d" , tc); +if (kstrtoint (buf,10 , &tc) <0 ) +return -EINVAL ; +pr_info ("test-case %d\n" , tc); test_result =test_case (tc);return count; } -static DEVICE_ATTR(tcase, S_IWUSR, NULL, sys_tcase); +static DEVICE_ATTR_WO (tcase); -static ssize_t sys_bus_slot (struct device *dev, +static ssize_t bus_slot_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {unsigned int res, bus, slot;int ret; -sscanf (buf,"%u" , &res); +if (kstrtouint (buf,10 , &res) <0 ) +return -EINVAL ; bus = res >>8 &0xFF ; slot = res &0xFF ;
@@ -692,35 +693,36 @@ static ssize_t sys_bus_slot(struct device *dev,return count; } -static DEVICE_ATTR(bus_slot, S_IWUSR, NULL, sys_bus_slot); +static DEVICE_ATTR_WO (bus_slot);static int tpci_init_module (void ) {int err =0 ; -prk_info ("Starting module" ); + +pr_info ("Starting module\n" ); err =device_register (&tdev);if (err) { -prk_err ("Unable to register device" ); +pr_err ("Unable to register device\n" ); goto err0; } -prk_info ("device registered\n" ); +pr_info ("device registered\n" ); err =device_create_file (&tdev, &dev_attr_result);if (err) { -prk_err ("Can't create sysfs file 'result'" ); +pr_err ("Can't create sysfs file 'result'\n" ); goto err1; } err =device_create_file (&tdev, &dev_attr_tcase);if (err) { -prk_err (": Can't create sysfs file 'tc'" ); +pr_err ("Can't create sysfs file 'tc'\n" ); goto err2; } err =device_create_file (&tdev, &dev_attr_bus_slot);if (err) { -prk_err (": Can't create sysfs file 'bus_slot'" ); +pr_err ("Can't create sysfs file 'bus_slot'\n" ); goto err3; }
@@ -739,7 +741,7 @@ module_init(tpci_init_module)static void tpci_exit_module (void ) { -prk_debug ("Unloading module\n" ); +pr_debug ("Unloading module\n" );if (ltp_pci.dev)pci_dev_put (ltp_pci.dev);
testcases/kernel/device-drivers/pci/tpci_kernel/pci-exp-tests-HOWTO deleted +0 -58
58 lines not on this page · raw message
testcases/kernel/device-drivers/pci/tpci_kernel/tpci.h +7 -14
@@ -1,22 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (c) International Business Machines Corp., 2001 * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -* the GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* Copyright (C) 2026 SUSE LLC Andrea Cervesato <[email protected]> */ +#ifndef LTP_TPCI_H +#define LTP_TPCI_H +#define PCI_DEVICE_NAME "ltp_tpci"#define MAX_DEVFN 256#define MAX_BUS 256
@@ -41,3 +32,5 @@ enum PCI_TCASES {PCI_EXP_CAP_CONFIG , PCI_TCASES_NUM, }; + +#endif
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] tpci: refactor kernel module
Hi Andrea,
Quoted 1 line · Andrea Cervesato
tpci: refactor kernel module
--- [PATCH 2/2] ---
Review
Quoted 3 lines
(quoted diff) +3
-0+ for (int i = 0; i < PCI_TCASES_NUM; ++i) { + if (i == PCI_DISABLE) + continue;
Could the successful PCI_ENABLE and PCI_RESOURCES calls be balanced on all exit paths instead of unconditionally skipping PCI_DISABLE?
In Linux 7.2, pci_enable_device() increments pci_dev.enable_cnt even when the device is already enabled, and pci_disable_device() must be called once for each successful enable. These two test cases therefore leak at least two enable references per run with -d, and more with -i. Unloading the test module does not restore that system-wide PCI state.
Review
Quoted 4 lines
(quoted diff) +4
-0+ if (!is_target && is_destructive_test(i)) + continue; + + SAFE_FILE_PRINTF(DEV_TCASE, "%d", i);
Could PCI_RESOURCES guarantee that the target's original driver is rebound before this destructive case is enabled?
test_assign_resources() releases the driver before pci_assign_resource(), but only calls device_attach() when assignment returns zero. It also ignores a zero or negative device_attach() result and treats -EBUSY from assignment as TPASS. An assignment or reprobe failure can therefore leave the selected device unbound after the test, and module cleanup does not restore it.
Quoted 5 lines
Merge kernel module with the current test inside the same folder and refactor tpci test using new API.
Now test has a -d option to select device for operating destructive tests on target.
Could the commit message explain why the directory merge, API conversion, and selective destructive execution are needed? The current body only restates what the patch changes.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 2/2 tpci: refactor test using new API
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
Merge kernel module with the current test inside the same folder and refactor tpci test using new API.
Now test has a -d option to select device for operating destructive tests on target.
---
.../pci/{tpci_kernel => tpci}/.gitignore | 3 +-
testcases/kernel/device-drivers/pci/tpci/Makefile | 22 +++
.../pci/{tpci_kernel => tpci}/ltp_tpci.c | 4 +-
testcases/kernel/device-drivers/pci/tpci/tpci.c | 166 +++++++++++++++++++++
.../pci/{tpci_kernel => tpci}/tpci.h | 0
.../kernel/device-drivers/pci/tpci_kernel/Makefile | 35 -----
.../kernel/device-drivers/pci/tpci_user/.gitignore | 1 -
.../kernel/device-drivers/pci/tpci_user/Makefile | 20 ---
.../kernel/device-drivers/pci/tpci_user/tpci.c | 115 --------------
9 files changed, 192 insertions(+), 174 deletions(-)testcases/kernel/device-drivers/pci/tpci/.gitignore renamed from testcases/kernel/device-drivers/pci/tpci_kernel/.gitignore +2 -1
@@ -1,3 +1,4 @@ +/tpci /ltp_tpci.ko /*.mod.c /modules.order
@@ -5,4 +6,4 @@ /.*.ko /.*.cmd /Module.symvers -modules.livepatch +/modules.livepatch
testcases/kernel/device-drivers/pci/tpci/Makefile new file +22 -0
@@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2026 SUSE LLC Andrea Cervesato <[email protected]> + +ifneq ($(KERNELRELEASE),) + +obj-m := ltp_tpci.o + +else + +top_srcdir ?= ../../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +REQ_VERSION_MAJOR := 2 +REQ_VERSION_PATCH := 6 + +MAKE_TARGETS := tpci ltp_tpci.ko + +include $(top_srcdir)/include/mk/module.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk + +endif
testcases/kernel/device-drivers/pci/tpci/ltp_tpci.c renamed from testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c +2 -2
@@ -12,8 +12,8 @@* driven through various sysfs interactions in a user-space program. * * For the functions of this module to work correctly, there must be a -* PCI / PCI-Express device somewhere in the system. The tests do not need -* a specific device; the first PCI device available will be grabbed. +* PCI / PCI-Express device somewhere in the system. The user-space test +* selects each device through the bus_slot sysfs file. * * The following test cases can be called from user-space: *
testcases/kernel/device-drivers/pci/tpci/tpci.c new file +166 -0
166 lines not on this page · raw message
testcases/kernel/device-drivers/pci/tpci/tpci.h renamed from testcases/kernel/device-drivers/pci/tpci_kernel/tpci.h +0 -0
testcases/kernel/device-drivers/pci/tpci_kernel/Makefile deleted +0 -35
@@ -1,35 +0,0 @@ -# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it would be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -ifneq ($(KERNELRELEASE),) - -obj-m := ltp_tpci.o - -else - -top_srcdir ?= ../../../../.. - -include $(top_srcdir)/include/mk/env_pre.mk - -REQ_VERSION_MAJOR := 2 -REQ_VERSION_PATCH := 6 - -MAKE_TARGETS := ltp_tpci.ko - -include $(top_srcdir)/include/mk/module.mk -include $(top_srcdir)/include/mk/generic_leaf_target.mk - -endif
testcases/kernel/device-drivers/pci/tpci_user/.gitignore deleted +0 -1
@@ -1 +0,0 @@ -/tpci
testcases/kernel/device-drivers/pci/tpci_user/Makefile deleted +0 -20
@@ -1,20 +0,0 @@ -# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it would be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -top_srcdir ?= ../../../../.. - -include $(top_srcdir)/include/mk/testcases.mk -include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/device-drivers/pci/tpci_user/tpci.c deleted +0 -115
115 lines not on this page · raw message
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp