History

Merge tag 'firewire-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394

Pull firewire updates from Takashi Sakamoto: "This consist of three parts; UAPI update, OHCI driver update, and several bug fixes. Firstly, the 1394 OHCI specification defines method to retrieve hardware time stamps for asynchronous communication, which was previously unavailable in user space. This adds new events to the UAPI, allowing applications to retrieve the time when asynchronous packet are received and sent. The new events are tested in the bleeding edge of libhinawa and look to work well. The new version of libhinawa will be released after current merge window is closed: https://git.kernel.org/pub/scm/libs/ieee1394/libhinawa.git/ Secondly, the FireWire stack includes a PCM device driver for 1394 OHCI hardware, This change modernizes the driver by managed resource (devres) framework. Lastly, bug fixes for firewire-net and firewire-core" * tag 'firewire-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: (25 commits) firewire: net: fix use after free in fwnet_finish_incoming_packet() firewire: core: obsolete usage of GFP_ATOMIC at building node tree firewire: ohci: release buffer for AR req/resp contexts when managed resource is released firewire: ohci: use devres for content of configuration ROM firewire: ohci: use devres for IT, IR, AT/receive, and AT/request contexts firewire: ohci: use devres for list of isochronous contexts firewire: ohci: use devres for requested IRQ firewire: ohci: use devres for misc DMA buffer firewire: ohci: use devres for MMIO region mapping firewire: ohci: use devres for PCI-related resources firewire: ohci: use devres for memory object of ohci structure firewire: fix warnings to generate UAPI documentation firewire: fix build failure due to missing module license firewire: cdev: implement new event relevant to phy packet with time stamp firewire: cdev: add new event to notify phy packet with time stamp firewire: cdev: code refactoring to dispatch event for phy packet firewire: cdev: implement new event to notify response subaction with time stamp firewire: cdev: add new event to notify response subaction with time stamp firewire: cdev: code refactoring to operate event of response firewire: core: implement variations to send request and wait for response with time stamp ...

Linus Torvalds committed 3 years ago

Commit 406fb9e2 parents f196220 3ff256713 files · +694 −231Browse files

Showing the changes to include/uapi/linux (1 of 13 files). Show all

Unified · Split

include/uapi/linux/firewire-cdev.h+156−22
@@ -46,6 +46,12 @@ · 45 unmodified lines
4646 #define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08
4747 #define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09
4848
49+/* available since kernel version 6.5 */
50+#define FW_CDEV_EVENT_REQUEST3 0x0a
51+#define FW_CDEV_EVENT_RESPONSE2 0x0b
52+#define FW_CDEV_EVENT_PHY_PACKET_SENT2 0x0c
53+#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED2 0x0d
54+
4955 /**
5056 * struct fw_cdev_event_common - Common part of all fw_cdev_event_* types
5157 * @closure: For arbitrary use by userspace
@@ -103,6 +109,32 @@ struct fw_cdev_event_bus_reset { · 51 unmodified lines
103109 * @length: Data length, i.e. the response's payload size in bytes
104110 * @data: Payload data, if any
105111 *
112+ * This event is sent instead of &fw_cdev_event_response if the kernel or the client implements
113+ * ABI version <= 5. It has the lack of time stamp field comparing to &fw_cdev_event_response2.
114+ */
115+struct fw_cdev_event_response {
116+ __u64 closure;
117+ __u32 type;
118+ __u32 rcode;
119+ __u32 length;
120+ __u32 data[];
121+};
122+
123+/**
124+ * struct fw_cdev_event_response2 - Sent when a response packet was received
125+ * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
126+ * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
127+ * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
128+ * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
129+ * @rcode: Response code returned by the remote node
130+ * @length: Data length, i.e. the response's payload size in bytes
131+ * @request_tstamp: The time stamp of isochronous cycle at which the request was sent.
132+ * @response_tstamp: The time stamp of isochronous cycle at which the response was sent.
133+ * @padding: Padding to keep the size of structure as multiples of 8 in various architectures
134+ * since 4 byte alignment is used for 8 byte of object type in System V ABI for i386
135+ * architecture.
136+ * @data: Payload data, if any
137+ *
106138 * This event is sent when the stack receives a response to an outgoing request
107139 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses
108140 * carrying data (read and lock responses) follows immediately and can be
@@ -112,12 +144,21 @@ struct fw_cdev_event_bus_reset { · 3 unmodified lines
112144 * involve response packets. This includes unified write transactions,
113145 * broadcast write transactions, and transmission of asynchronous stream
114146 * packets. @rcode indicates success or failure of such transmissions.
147+ *
148+ * The value of @request_tstamp expresses the isochronous cycle at which the request was sent to
149+ * initiate the transaction. The value of @response_tstamp expresses the isochronous cycle at which
150+ * the response arrived to complete the transaction. Each value is unsigned 16 bit integer
151+ * containing three low order bits of second field and all 13 bits of cycle field in format of
152+ * CYCLE_TIMER register.
115153 */
116−struct fw_cdev_event_response {
154+struct fw_cdev_event_response2 {
117155 __u64 closure;
118156 __u32 type;
119157 __u32 rcode;
120158 __u32 length;
159+ __u32 request_tstamp;
160+ __u32 response_tstamp;
161+ __u32 padding;
121162 __u32 data[];
122163 };
123164
@@ -159,6 +200,41 @@ struct fw_cdev_event_request { · 35 unmodified lines
159200 * @length: Data length, i.e. the request's payload size in bytes
160201 * @data: Incoming data, if any
161202 *
203+ * This event is sent instead of &fw_cdev_event_request3 if the kernel or the client implements
204+ * ABI version <= 5. It has the lack of time stamp field comparing to &fw_cdev_event_request3.
205+ */
206+struct fw_cdev_event_request2 {
207+ __u64 closure;
208+ __u32 type;
209+ __u32 tcode;
210+ __u64 offset;
211+ __u32 source_node_id;
212+ __u32 destination_node_id;
213+ __u32 card;
214+ __u32 generation;
215+ __u32 handle;
216+ __u32 length;
217+ __u32 data[];
218+};
219+
220+/**
221+ * struct fw_cdev_event_request3 - Sent on incoming request to an address region
222+ * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
223+ * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
224+ * @tcode: Transaction code of the incoming request
225+ * @offset: The offset into the 48-bit per-node address space
226+ * @source_node_id: Sender node ID
227+ * @destination_node_id: Destination node ID
228+ * @card: The index of the card from which the request came
229+ * @generation: Bus generation in which the request is valid
230+ * @handle: Reference to the kernel-side pending request
231+ * @length: Data length, i.e. the request's payload size in bytes
232+ * @tstamp: The time stamp of isochronous cycle at which the request arrived.
233+ * @padding: Padding to keep the size of structure as multiples of 8 in various architectures
234+ * since 4 byte alignment is used for 8 byte of object type in System V ABI for i386
235+ * architecture.
236+ * @data: Incoming data, if any
237+ *
162238 * This event is sent when the stack receives an incoming request to an address
163239 * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is
164240 * guaranteed to be completely contained in the specified region. Userspace is
@@ -191,10 +267,14 @@ struct fw_cdev_event_request { · 26 unmodified lines
191267 * sent.
192268 *
193269 * If the client subsequently needs to initiate requests to the sender node of
194− * an &fw_cdev_event_request2, it needs to use a device file with matching
270+ * an &fw_cdev_event_request3, it needs to use a device file with matching
195271 * card index, node ID, and generation for outbound requests.
272+ *
273+ * @tstamp is isochronous cycle at which the request arrived. It is 16 bit integer value and the
274+ * higher 3 bits expresses three low order bits of second field in the format of CYCLE_TIME
275+ * register and the rest 13 bits expresses cycle field.
196276 */
197−struct fw_cdev_event_request2 {
277+struct fw_cdev_event_request3 {
198278 __u64 closure;
199279 __u32 type;
200280 __u32 tcode;
@@ -205,6 +285,8 @@ struct fw_cdev_event_request2 { · 4 unmodified lines
205285 __u32 generation;
206286 __u32 handle;
207287 __u32 length;
288+ __u32 tstamp;
289+ __u32 padding;
208290 __u32 data[];
209291 };
210292
@@ -341,20 +423,59 @@ struct fw_cdev_event_iso_resource { · 130 unmodified lines
341423 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
342424 * @rcode: %RCODE_..., indicates success or failure of transmission
343425 * @length: Data length in bytes
426+ * @data: Incoming data for %FW_CDEV_IOC_RECEIVE_PHY_PACKETS. For %FW_CDEV_IOC_SEND_PHY_PACKET
427+ * the field has the same data in the request, thus the length of 8 bytes.
428+ *
429+ * This event is sent instead of &fw_cdev_event_phy_packet2 if the kernel or
430+ * the client implements ABI version <= 5. It has the lack of time stamp field comparing to
431+ * &fw_cdev_event_phy_packet2.
432+ */
433+struct fw_cdev_event_phy_packet {
434+ __u64 closure;
435+ __u32 type;
436+ __u32 rcode;
437+ __u32 length;
438+ __u32 data[];
439+};
440+
441+/**
442+ * struct fw_cdev_event_phy_packet2 - A PHY packet was transmitted or received with time stamp.
443+ * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
444+ * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
445+ * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT2 or %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
446+ * @rcode: %RCODE_..., indicates success or failure of transmission
447+ * @length: Data length in bytes
448+ * @tstamp: For %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, the time stamp of isochronous cycle at
449+ * which the packet arrived. For %FW_CDEV_EVENT_PHY_PACKET_SENT2 and non-ping packet,
450+ * the time stamp of isochronous cycle at which the packet was sent. For ping packet,
451+ * the tick count for round-trip time measured by 1394 OHCI controller.
452+ * The time stamp of isochronous cycle at which either the response was sent for
453+ * %FW_CDEV_EVENT_PHY_PACKET_SENT2 or the request arrived for
454+ * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2.
344455 * @data: Incoming data
345456 *
346− * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
347− * except in case of a ping packet: Then, @length is 4, and @data[0] is the
348− * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
457+ * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT2, @length is 8 and @data consists of the two PHY
458+ * packet quadlets to be sent, in host byte order,
349459 *
350− * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
351− * consists of the two PHY packet quadlets, in host byte order.
460+ * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, @length is 8 and @data consists of the two PHY
461+ * packet quadlets, in host byte order.
462+ *
463+ * For %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, the @tstamp is the isochronous cycle at which the
464+ * packet arrived. It is 16 bit integer value and the higher 3 bits expresses three low order bits
465+ * of second field and the rest 13 bits expresses cycle field in the format of CYCLE_TIME register.
466+ *
467+ * For %FW_CDEV_EVENT_PHY_PACKET_SENT2, the @tstamp has different meanings whether to sent the
468+ * packet for ping or not. If it's not for ping, the @tstamp is the isochronous cycle at which the
469+ * packet was sent, and use the same format as the case of %FW_CDEV_EVENT_PHY_PACKET_SENT2. If it's
470+ * for ping, the @tstamp is for round-trip time measured by 1394 OHCI controller with 42.195 MHz
471+ * resolution.
352472 */
353−struct fw_cdev_event_phy_packet {
473+struct fw_cdev_event_phy_packet2 {
354474 __u64 closure;
355475 __u32 type;
356476 __u32 rcode;
357477 __u32 length;
478+ __u32 tstamp;
358479 __u32 data[];
359480 };
360481
@@ -375,6 +496,11 @@ struct fw_cdev_event_phy_packet { · 14 unmodified lines
375496 * %FW_CDEV_EVENT_PHY_PACKET_SENT or
376497 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED
377498 *
499+ * @request3: Valid if @common.type == %FW_CDEV_EVENT_REQUEST3
500+ * @response2: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE2
501+ * @phy_packet2: Valid if @common.type == %FW_CDEV_EVENT_PHY_PACKET_SENT2 or
502+ * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
503+ *
378504 * Convenience union for userspace use. Events could be read(2) into an
379505 * appropriately aligned char buffer and then cast to this union for further
380506 * processing. Note that for a request, response or iso_interrupt event,
@@ -393,6 +519,9 @@ union fw_cdev_event { · 12 unmodified lines
393519 struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */
394520 struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */
395521 struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */
522+ struct fw_cdev_event_request3 request3; /* added in 6.5 */
523+ struct fw_cdev_event_response2 response2; /* added in 6.5 */
524+ struct fw_cdev_event_phy_packet2 phy_packet2; /* added in 6.5 */
396525 };
397526
398527 /* available since kernel version 2.6.22 */
@@ -457,6 +586,11 @@ union fw_cdev_event { · 58 unmodified lines
457586 * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to
458587 * avoid dropping data
459588 * - added %FW_CDEV_IOC_FLUSH_ISO
589+ * 6 (6.5) - added some event for subactions of asynchronous transaction with time stamp
590+ * - %FW_CDEV_EVENT_REQUEST3
591+ * - %FW_CDEV_EVENT_RESPONSE2
592+ * - %FW_CDEV_EVENT_PHY_PACKET_SENT2
593+ * - %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
460594 */
461595
462596 /**
@@ -502,11 +636,11 @@ struct fw_cdev_get_info { · 39 unmodified lines
502636 * @data: Userspace pointer to payload
503637 * @generation: The bus generation where packet is valid
504638 *
505− * Send a request to the device. This ioctl implements all outgoing requests.
506− * Both quadlet and block request specify the payload as a pointer to the data
507− * in the @data field. Once the transaction completes, the kernel writes an
508− * &fw_cdev_event_response event back. The @closure field is passed back to
509− * user space in the response event.
639+ * Send a request to the device. This ioctl implements all outgoing requests. Both quadlet and
640+ * block request specify the payload as a pointer to the data in the @data field. Once the
641+ * transaction completes, the kernel writes either &fw_cdev_event_response event or
642+ * &fw_cdev_event_response event back. The @closure field is passed back to user space in the
643+ * response event.
510644 */
511645 struct fw_cdev_send_request {
512646 __u32 tcode;
@@ -989,10 +1123,9 @@ struct fw_cdev_allocate_iso_resource { · 476 unmodified lines
9891123 * @generation: The bus generation where packet is valid
9901124 * @speed: Speed to transmit at
9911125 *
992− * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
993− * to every device which is listening to the specified channel. The kernel
994− * writes an &fw_cdev_event_response event which indicates success or failure of
995− * the transmission.
1126+ * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet to every device
1127+ * which is listening to the specified channel. The kernel writes either &fw_cdev_event_response
1128+ * event or &fw_cdev_event_response2 event which indicates success or failure of the transmission.
9961129 */
9971130 struct fw_cdev_send_stream_packet {
9981131 __u32 length;
@@ -1011,8 +1144,8 @@ struct fw_cdev_send_stream_packet { · 12 unmodified lines
10111144 * @data: First and second quadlet of the PHY packet
10121145 * @generation: The bus generation where packet is valid
10131146 *
1014− * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
1015− * on the same card as this device. After transmission, an
1147+ * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes on the same card as this
1148+ * device. After transmission, either %FW_CDEV_EVENT_PHY_PACKET_SENT event or
10161149 * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
10171150 *
10181151 * The payload @data\[\] shall be specified in host byte order. Usually,
@@ -1031,8 +1164,9 @@ struct fw_cdev_send_phy_packet { · 12 unmodified lines
10311164 * struct fw_cdev_receive_phy_packets - start reception of PHY packets
10321165 * @closure: Passed back to userspace in phy packet events
10331166 *
1034− * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
1035− * incoming PHY packets from any node on the same bus as the device.
1167+ * This ioctl activates issuing of either %FW_CDEV_EVENT_PHY_PACKET_RECEIVED or
1168+ * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2 due to incoming PHY packets from any node on the same bus
1169+ * as the device.
10361170 *
10371171 * The ioctl is only permitted on device files which represent a local node.
10381172 */