Skip to content

Commit b850dc2

Browse files
committed
Merge tag 'firewire-updates-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire updates from Takashi Sakamoto: "During the development period of v6.8 kernel, it became evident that there was a lack of helper utilities to trace the initial state of bus, while investigating certain PHYs compliant with different versions of IEEE 1394 specification. This series of changes includes the addition of tracepoints events, provided by 'firewire' subsystem. These events enable tracing of how firewire core functions during bus reset and asynchronous communication over IEEE 1394 bus. When implementing the tracepoints events, it was found that the existing serialization and deserialization helpers for several types of asynchronous packets are scattered across both firewire-core and firewire-ohci kernel modules. A set of inline functions is newly added to address it, along with some KUnit tests, serving as the foundation for the tracepoints events. This renders the dispersed code obsolete. The remaining changes constitute the final steps in phasing out the usage of deprecated PCI MSI APIs, in continuation from the previous version" * tag 'firewire-updates-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: (29 commits) firewire: obsolete usage of *-objs in Makefile for KUnit test firewire: core: remove flag and width from u64 formats of tracepoints events firewire: core: fix type of timestamp for async_inbound_template tracepoints events firewire: core: add tracepoint event for handling bus reset Revert "firewire: core: option to log bus reset initiation" firewire: core: add tracepoints events for initiating bus reset firewire: ohci: obsolete OHCI_PARAM_DEBUG_BUSRESETS from debug module parameter firewire: ohci: add bus-reset event for initial set of handled irq firewire: core: add tracepoints event for asynchronous inbound phy packet firewire: core/cdev: add tracepoints events for asynchronous phy packet firewire: core: add tracepoints events for asynchronous outbound response firewire: core: add tracepoint event for asynchronous inbound request firewire: core: add tracepoints event for asynchronous inbound response firewire: core: add tracepoints events for asynchronous outbound request firewire: core: add support for Linux kernel tracepoints firewire: core: replace local macros with common inline functions for isochronous packet header firewire: core: add common macro to serialize/deserialize isochronous packet header firewire: core: obsolete tcode check macros with inline functions firewire: ohci: replace hard-coded values with common macros firewire: ohci: replace hard-coded values with inline functions for asynchronous packet header ...
2 parents 4f8b6f2 + 21151fd commit b850dc2

File tree

14 files changed

+1420
-195
lines changed

14 files changed

+1420
-195
lines changed

drivers/firewire/.kunitconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ CONFIG_PCI=y
33
CONFIG_FIREWIRE=y
44
CONFIG_FIREWIRE_KUNIT_UAPI_TEST=y
55
CONFIG_FIREWIRE_KUNIT_DEVICE_ATTRIBUTE_TEST=y
6+
CONFIG_FIREWIRE_KUNIT_PACKET_SERDES_TEST=y

drivers/firewire/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ config FIREWIRE_KUNIT_DEVICE_ATTRIBUTE_TEST
5050
For more information on KUnit and unit tests in general, refer
5151
to the KUnit documentation in Documentation/dev-tools/kunit/.
5252

53+
config FIREWIRE_KUNIT_PACKET_SERDES_TEST
54+
tristate "KUnit tests for packet serialization/deserialization" if !KUNIT_ALL_TESTS
55+
depends on FIREWIRE && KUNIT
56+
default KUNIT_ALL_TESTS
57+
help
58+
This builds the KUnit tests for packet serialization and
59+
deserialization.
60+
61+
KUnit tests run during boot and output the results to the debug
62+
log in TAP format (https://testanything.org/). Only useful for
63+
kernel devs running KUnit test harness and are not for inclusion
64+
into a production build.
65+
66+
For more information on KUnit and unit tests in general, refer
67+
to the KUnit documentation in Documentation/dev-tools/kunit/.
68+
5369
config FIREWIRE_OHCI
5470
tristate "OHCI-1394 controllers"
5571
depends on PCI && FIREWIRE && MMU

drivers/firewire/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Makefile for the Linux IEEE 1394 implementation
44
#
55

6-
firewire-core-y += core-card.o core-cdev.o core-device.o \
6+
firewire-core-y += core-trace.o core-card.o core-cdev.o core-device.o \
77
core-iso.o core-topology.o core-transaction.o
88
firewire-ohci-y += ohci.o
99
firewire-sbp2-y += sbp2.o
@@ -16,5 +16,5 @@ obj-$(CONFIG_FIREWIRE_NET) += firewire-net.o
1616
obj-$(CONFIG_FIREWIRE_NOSY) += nosy.o
1717
obj-$(CONFIG_PROVIDE_OHCI1394_DMA_INIT) += init_ohci1394_dma.o
1818

19-
firewire-uapi-test-objs += uapi-test.o
20-
obj-$(CONFIG_FIREWIRE_KUNIT_UAPI_TEST) += firewire-uapi-test.o
19+
obj-$(CONFIG_FIREWIRE_KUNIT_UAPI_TEST) += uapi-test.o
20+
obj-$(CONFIG_FIREWIRE_KUNIT_PACKET_SERDES_TEST) += packet-serdes-test.o

drivers/firewire/core-card.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <asm/byteorder.h>
2424

2525
#include "core.h"
26+
#include <trace/events/firewire.h>
2627

2728
#define define_fw_printk_level(func, kern_level) \
2829
void func(const struct fw_card *card, const char *fmt, ...) \
@@ -221,11 +222,15 @@ static int reset_bus(struct fw_card *card, bool short_reset)
221222
int reg = short_reset ? 5 : 1;
222223
int bit = short_reset ? PHY_BUS_SHORT_RESET : PHY_BUS_RESET;
223224

225+
trace_bus_reset_initiate(card->generation, short_reset);
226+
224227
return card->driver->update_phy_reg(card, reg, 0, bit);
225228
}
226229

227230
void fw_schedule_bus_reset(struct fw_card *card, bool delayed, bool short_reset)
228231
{
232+
trace_bus_reset_schedule(card->generation, short_reset);
233+
229234
/* We don't try hard to sort out requests of long vs. short resets. */
230235
card->br_short = short_reset;
231236

@@ -244,6 +249,8 @@ static void br_work(struct work_struct *work)
244249
/* Delay for 2s after last reset per IEEE 1394 clause 8.2.1. */
245250
if (card->reset_jiffies != 0 &&
246251
time_before64(get_jiffies_64(), card->reset_jiffies + 2 * HZ)) {
252+
trace_bus_reset_postpone(card->generation, card->br_short);
253+
247254
if (!queue_delayed_work(fw_workqueue, &card->br_work, 2 * HZ))
248255
fw_card_put(card);
249256
return;

drivers/firewire/core-cdev.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636

3737
#include "core.h"
38+
#include <trace/events/firewire.h>
3839

3940
/*
4041
* ABI version history is documented in linux/firewire-cdev.h.
@@ -1558,6 +1559,9 @@ static void outbound_phy_packet_callback(struct fw_packet *packet,
15581559
struct client *e_client = e->client;
15591560
u32 rcode;
15601561

1562+
trace_async_phy_outbound_complete((uintptr_t)packet, status, packet->generation,
1563+
packet->timestamp);
1564+
15611565
switch (status) {
15621566
// expected:
15631567
case ACK_COMPLETE:
@@ -1655,6 +1659,9 @@ static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
16551659
memcpy(pp->data, a->data, sizeof(a->data));
16561660
}
16571661

1662+
trace_async_phy_outbound_initiate((uintptr_t)&e->p, e->p.generation, e->p.header[1],
1663+
e->p.header[2]);
1664+
16581665
card->driver->send_request(card, &e->p);
16591666

16601667
return 0;

drivers/firewire/core-topology.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <asm/byteorder.h>
2121

2222
#include "core.h"
23+
#include <trace/events/firewire.h>
2324

2425
#define SELF_ID_PHY_ID(q) (((q) >> 24) & 0x3f)
2526
#define SELF_ID_EXTENDED(q) (((q) >> 23) & 0x01)
@@ -507,6 +508,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
507508
struct fw_node *local_node;
508509
unsigned long flags;
509510

511+
trace_bus_reset_handle(generation, node_id, bm_abdicate, self_ids, self_id_count);
512+
510513
spin_lock_irqsave(&card->lock, flags);
511514

512515
/*

drivers/firewire/core-trace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
// Copyright (c) 2024 Takashi Sakamoto
3+
4+
#define CREATE_TRACE_POINTS
5+
#include <trace/events/firewire.h>

0 commit comments

Comments
 (0)