Skip to content

Commit

Permalink
Automatic merge of 'master' into merge-test (2024-10-06 12:41)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpe committed Oct 6, 2024
2 parents 7beb771 + 8f60227 commit c526eb1
Show file tree
Hide file tree
Showing 1,163 changed files with 3,738 additions and 3,161 deletions.
2 changes: 1 addition & 1 deletion Documentation/arch/arm/mem_alignment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ones.

Of course this is a bad idea to rely on the alignment trap to perform
unaligned memory access in general. If those access are predictable, you
are better to use the macros provided by include/asm/unaligned.h. The
are better to use the macros provided by include/linux/unaligned.h. The
alignment trap can fixup misaligned access for the exception cases, but at
a high performance cost. It better be rare.

Expand Down
6 changes: 6 additions & 0 deletions Documentation/arch/arm64/silicon-errata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A715 | #2645198 | ARM64_ERRATUM_2645198 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A715 | #3456084 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A720 | #3456091 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 |
Expand Down Expand Up @@ -186,6 +188,8 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-N2 | #3324339 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-N3 | #3456111 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-V1 | #1619801 | N/A |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-V1 | #3324341 | ARM64_ERRATUM_3194386 |
Expand Down Expand Up @@ -289,3 +293,5 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| Microsoft | Azure Cobalt 100| #2253138 | ARM64_ERRATUM_2253138 |
+----------------+-----------------+-----------------+-----------------------------+
| Microsoft | Azure Cobalt 100| #3324339 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
212 changes: 212 additions & 0 deletions Documentation/core-api/folio_queue.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
.. SPDX-License-Identifier: GPL-2.0+
===========
Folio Queue
===========

:Author: David Howells <[email protected]>

.. Contents:
* Overview
* Initialisation
* Adding and removing folios
* Querying information about a folio
* Querying information about a folio_queue
* Folio queue iteration
* Folio marks
* Lockless simultaneous production/consumption issues
Overview
========

The folio_queue struct forms a single segment in a segmented list of folios
that can be used to form an I/O buffer. As such, the list can be iterated over
using the ITER_FOLIOQ iov_iter type.

The publicly accessible members of the structure are::

struct folio_queue {
struct folio_queue *next;
struct folio_queue *prev;
...
};

A pair of pointers are provided, ``next`` and ``prev``, that point to the
segments on either side of the segment being accessed. Whilst this is a
doubly-linked list, it is intentionally not a circular list; the outward
sibling pointers in terminal segments should be NULL.

Each segment in the list also stores:

* an ordered sequence of folio pointers,
* the size of each folio and
* three 1-bit marks per folio,

but hese should not be accessed directly as the underlying data structure may
change, but rather the access functions outlined below should be used.

The facility can be made accessible by::

#include <linux/folio_queue.h>

and to use the iterator::

#include <linux/uio.h>


Initialisation
==============

A segment should be initialised by calling::

void folioq_init(struct folio_queue *folioq);

with a pointer to the segment to be initialised. Note that this will not
necessarily initialise all the folio pointers, so care must be taken to check
the number of folios added.


Adding and removing folios
==========================

Folios can be set in the next unused slot in a segment struct by calling one
of::

unsigned int folioq_append(struct folio_queue *folioq,
struct folio *folio);

unsigned int folioq_append_mark(struct folio_queue *folioq,
struct folio *folio);

Both functions update the stored folio count, store the folio and note its
size. The second function also sets the first mark for the folio added. Both
functions return the number of the slot used. [!] Note that no attempt is made
to check that the capacity wasn't overrun and the list will not be extended
automatically.

A folio can be excised by calling::

void folioq_clear(struct folio_queue *folioq, unsigned int slot);

This clears the slot in the array and also clears all the marks for that folio,
but doesn't change the folio count - so future accesses of that slot must check
if the slot is occupied.


Querying information about a folio
==================================

Information about the folio in a particular slot may be queried by the
following function::

struct folio *folioq_folio(const struct folio_queue *folioq,
unsigned int slot);

If a folio has not yet been set in that slot, this may yield an undefined
pointer. The size of the folio in a slot may be queried with either of::

unsigned int folioq_folio_order(const struct folio_queue *folioq,
unsigned int slot);

size_t folioq_folio_size(const struct folio_queue *folioq,
unsigned int slot);

The first function returns the size as an order and the second as a number of
bytes.


Querying information about a folio_queue
========================================

Information may be retrieved about a particular segment with the following
functions::

unsigned int folioq_nr_slots(const struct folio_queue *folioq);

unsigned int folioq_count(struct folio_queue *folioq);

bool folioq_full(struct folio_queue *folioq);

The first function returns the maximum capacity of a segment. It must not be
assumed that this won't vary between segments. The second returns the number
of folios added to a segments and the third is a shorthand to indicate if the
segment has been filled to capacity.

Not that the count and fullness are not affected by clearing folios from the
segment. These are more about indicating how many slots in the array have been
initialised, and it assumed that slots won't get reused, but rather the segment
will get discarded as the queue is consumed.


Folio marks
===========

Folios within a queue can also have marks assigned to them. These marks can be
used to note information such as if a folio needs folio_put() calling upon it.
There are three marks available to be set for each folio.

The marks can be set by::

void folioq_mark(struct folio_queue *folioq, unsigned int slot);
void folioq_mark2(struct folio_queue *folioq, unsigned int slot);
void folioq_mark3(struct folio_queue *folioq, unsigned int slot);

Cleared by::

void folioq_unmark(struct folio_queue *folioq, unsigned int slot);
void folioq_unmark2(struct folio_queue *folioq, unsigned int slot);
void folioq_unmark3(struct folio_queue *folioq, unsigned int slot);

And the marks can be queried by::

bool folioq_is_marked(const struct folio_queue *folioq, unsigned int slot);
bool folioq_is_marked2(const struct folio_queue *folioq, unsigned int slot);
bool folioq_is_marked3(const struct folio_queue *folioq, unsigned int slot);

The marks can be used for any purpose and are not interpreted by this API.


Folio queue iteration
=====================

A list of segments may be iterated over using the I/O iterator facility using
an ``iov_iter`` iterator of ``ITER_FOLIOQ`` type. The iterator may be
initialised with::

void iov_iter_folio_queue(struct iov_iter *i, unsigned int direction,
const struct folio_queue *folioq,
unsigned int first_slot, unsigned int offset,
size_t count);

This may be told to start at a particular segment, slot and offset within a
queue. The iov iterator functions will follow the next pointers when advancing
and prev pointers when reverting when needed.


Lockless simultaneous production/consumption issues
===================================================

If properly managed, the list can be extended by the producer at the head end
and shortened by the consumer at the tail end simultaneously without the need
to take locks. The ITER_FOLIOQ iterator inserts appropriate barriers to aid
with this.

Care must be taken when simultaneously producing and consuming a list. If the
last segment is reached and the folios it refers to are entirely consumed by
the IOV iterators, an iov_iter struct will be left pointing to the last segment
with a slot number equal to the capacity of that segment. The iterator will
try to continue on from this if there's another segment available when it is
used again, but care must be taken lest the segment got removed and freed by
the consumer before the iterator was advanced.

It is recommended that the queue always contain at least one segment, even if
that segment has never been filled or is entirely spent. This prevents the
head and tail pointers from collapsing.


API Function Reference
======================

.. kernel-doc:: include/linux/folio_queue.h
1 change: 1 addition & 0 deletions Documentation/core-api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Library functionality that is used throughout the kernel.
kref
cleanup
assoc_array
folio_queue
xarray
maple_tree
idr
Expand Down
2 changes: 1 addition & 1 deletion Documentation/core-api/unaligned-memory-access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Avoiding unaligned accesses
===========================

The easiest way to avoid unaligned access is to use the get_unaligned() and
put_unaligned() macros provided by the <asm/unaligned.h> header file.
put_unaligned() macros provided by the <linux/unaligned.h> header file.

Going back to an earlier example of code that potentially causes unaligned
access::
Expand Down
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ properties:
and length of the AXI DMA controller IO space, unless
axistream-connected is specified, in which case the reg
attribute of the node referenced by it is used.
minItems: 1
maxItems: 2

interrupts:
Expand Down Expand Up @@ -181,7 +182,7 @@ examples:
clock-names = "s_axi_lite_clk", "axis_clk", "ref_clk", "mgt_clk";
clocks = <&axi_clk>, <&axi_clk>, <&pl_enet_ref_clk>, <&mgt_clk>;
phy-mode = "mii";
reg = <0x00 0x40000000 0x00 0x40000>;
reg = <0x40000000 0x40000>;
xlnx,rxcsum = <0x2>;
xlnx,rxmem = <0x800>;
xlnx,txcsum = <0x2>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ properties:
default: 2

interrupts:
anyOf:
oneOf:
- minItems: 1
items:
- description: TX interrupt
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ properties:
- qcom,apq8096-sndcard
- qcom,qcm6490-idp-sndcard
- qcom,qcs6490-rb3gen2-sndcard
- qcom,qrb4210-rb2-sndcard
- qcom,qrb5165-rb5-sndcard
- qcom,sc7180-qdsp6-sndcard
- qcom,sc8280xp-sndcard
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ allOf:
reg-names:
items:
enum:
- scu
- sru
- ssi
- adg
# for Gen2/Gen3
Expand Down
4 changes: 2 additions & 2 deletions Documentation/gpu/drm-kms-helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Bridge Operations
Bridge Connector Helper
-----------------------

.. kernel-doc:: drivers/gpu/drm/drm_bridge_connector.c
.. kernel-doc:: drivers/gpu/drm/display/drm_bridge_connector.c
:doc: overview


Expand All @@ -204,7 +204,7 @@ MIPI-DSI bridge operation
Bridge Connector Helper Reference
---------------------------------

.. kernel-doc:: drivers/gpu/drm/drm_bridge_connector.c
.. kernel-doc:: drivers/gpu/drm/display/drm_bridge_connector.c
:export:

Panel-Bridge Helper Reference
Expand Down
5 changes: 2 additions & 3 deletions Documentation/networking/napi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ IRQ should only be unmasked after a successful call to napi_complete_done():
napi_schedule_irqoff() is a variant of napi_schedule() which takes advantage
of guarantees given by being invoked in IRQ context (no need to
mask interrupts). Note that PREEMPT_RT forces all interrupts
to be threaded so the interrupt may need to be marked ``IRQF_NO_THREAD``
to avoid issues on real-time kernel configurations.
mask interrupts). napi_schedule_irqoff() will fall back to napi_schedule() if
IRQs are threaded (such as if ``PREEMPT_RT`` is enabled).

Instance to queue mapping
-------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ field2会导致非对齐访问,这并不是不合理的。你会期望field2
避免非对齐访问
==============

避免非对齐访问的最简单方法是使用<asm/unaligned.h>头文件提供的get_unaligned()和
避免非对齐访问的最简单方法是使用<linux/unaligned.h>头文件提供的get_unaligned()和
put_unaligned()宏。

回到前面的一个可能导致非对齐访问的代码例子::
Expand Down
Loading

0 comments on commit c526eb1

Please sign in to comment.