2023-01-03 18:26:11

by Jonathan Corbet

[permalink] [raw]
Subject: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation

Yann Sionneau <[email protected]> writes:

> Add some documentation for kvx arch and its Linux port.
>
> CC: Jonathan Corbet <[email protected]>
> CC: [email protected]
> CC: [email protected]
> Co-developed-by: Clement Leger <[email protected]>
> Signed-off-by: Clement Leger <[email protected]>
> Co-developed-by: Guillaume Thouvenin <[email protected]>
> Signed-off-by: Guillaume Thouvenin <[email protected]>
> Signed-off-by: Yann Sionneau <[email protected]>
> ---
> Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++
> Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++
> Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++
> Documentation/kvx/kvx-smp.txt | 36 ++++
> Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++
> 5 files changed, 1005 insertions(+)
> create mode 100644 Documentation/kvx/kvx-exceptions.txt
> create mode 100644 Documentation/kvx/kvx-iommu.txt
> create mode 100644 Documentation/kvx/kvx-mmu.txt
> create mode 100644 Documentation/kvx/kvx-smp.txt
> create mode 100644 Documentation/kvx/kvx.txt

Please write this documentation in the RST format (you're 95% of the way
there now) and incorporate into the kernel docs build.

Thanks,

jon


2023-01-09 10:24:13

by Bagas Sanjaya

[permalink] [raw]
Subject: [PATCH 0/8] kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation)

Jonathan Corbet <[email protected]> writes:
>> Add some documentation for kvx arch and its Linux port.
>>
>> CC: Jonathan Corbet <[email protected]>
>> CC: [email protected]
>> CC: [email protected]
>> Co-developed-by: Clement Leger <[email protected]>
>> Signed-off-by: Clement Leger <[email protected]>
>> Co-developed-by: Guillaume Thouvenin <[email protected]>
>> Signed-off-by: Guillaume Thouvenin <[email protected]>
>> Signed-off-by: Yann Sionneau <[email protected]>
>> ---
>> Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++
>> Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++
>> Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++
>> Documentation/kvx/kvx-smp.txt | 36 ++++
>> Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++
>> 5 files changed, 1005 insertions(+)
>> create mode 100644 Documentation/kvx/kvx-exceptions.txt
>> create mode 100644 Documentation/kvx/kvx-iommu.txt
>> create mode 100644 Documentation/kvx/kvx-mmu.txt
>> create mode 100644 Documentation/kvx/kvx-smp.txt
>> create mode 100644 Documentation/kvx/kvx.txt
>
>Please write this documentation in the RST format (you're 95% of the way
>there now) and incorporate into the kernel docs build.

Here is the polished documentation in reST format. Yann, can you please
squash this series into your documentation patch?

Bagas Sanjaya (8):
Documentation: kvx: Convert to reST
Documentation: kvx: Wrap diagrams in literal code block
Documentation: kvx: Fix lists
Documentation: kvx: kvx-iommu: Use reST syntax for subsections
Documentation: kvx: kvx-iommu: monospacize kvx iommu device tree path
Documentation: kvx: Promote title headings
Documentation: kvx: Use literal code block for command-line inputs
Documentation: kvx: reword

Documentation/arch.rst | 1 +
Documentation/kvx/index.rst | 12 ++
Documentation/kvx/kvx-exceptions.rst | 258 +++++++++++++++++++++++
Documentation/kvx/kvx-exceptions.txt | 246 ----------------------
Documentation/kvx/kvx-iommu.rst | 188 +++++++++++++++++
Documentation/kvx/kvx-iommu.txt | 183 -----------------
Documentation/kvx/kvx-mmu.rst | 294 +++++++++++++++++++++++++++
Documentation/kvx/kvx-mmu.txt | 272 -------------------------
Documentation/kvx/kvx-smp.rst | 36 ++++
Documentation/kvx/kvx-smp.txt | 36 ----
Documentation/kvx/kvx.rst | 269 ++++++++++++++++++++++++
Documentation/kvx/kvx.txt | 268 ------------------------
12 files changed, 1058 insertions(+), 1005 deletions(-)
create mode 100644 Documentation/kvx/index.rst
create mode 100644 Documentation/kvx/kvx-exceptions.rst
delete mode 100644 Documentation/kvx/kvx-exceptions.txt
create mode 100644 Documentation/kvx/kvx-iommu.rst
delete mode 100644 Documentation/kvx/kvx-iommu.txt
create mode 100644 Documentation/kvx/kvx-mmu.rst
delete mode 100644 Documentation/kvx/kvx-mmu.txt
create mode 100644 Documentation/kvx/kvx-smp.rst
delete mode 100644 Documentation/kvx/kvx-smp.txt
create mode 100644 Documentation/kvx/kvx.rst
delete mode 100644 Documentation/kvx/kvx.txt

--
An old man doll... just what I always wanted! - Clara

2023-01-09 10:29:19

by Bagas Sanjaya

[permalink] [raw]
Subject: [PATCH 6/8] Documentation: kvx: Promote title headings

The documentation contains headings which all marked up using the same
heading level, which cause doc sections to also appear in index TOC
alongside doc titles.

Promote title headings while expanding their title text to be more
descriptive.

Signed-off-by: Bagas Sanjaya <[email protected]>
---
Documentation/kvx/kvx-exceptions.rst | 6 ++++--
Documentation/kvx/kvx-iommu.rst | 4 ++--
Documentation/kvx/kvx-mmu.rst | 5 +++--
Documentation/kvx/kvx-smp.rst | 5 +++--
Documentation/kvx/kvx.rst | 1 +
5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Documentation/kvx/kvx-exceptions.rst b/Documentation/kvx/kvx-exceptions.rst
index bd485efd2362c1..15692f14b9219d 100644
--- a/Documentation/kvx/kvx-exceptions.rst
+++ b/Documentation/kvx/kvx-exceptions.rst
@@ -1,5 +1,7 @@
-Exceptions
-==========
+=========================
+Exception handling in kvx
+=========================
+
On kvx, handlers are set using $ev (exception vector) register which
specifies a base address.
An offset is added to $ev upon exception and the result is used as
diff --git a/Documentation/kvx/kvx-iommu.rst b/Documentation/kvx/kvx-iommu.rst
index c97035ba624c22..5e84dc12adb437 100644
--- a/Documentation/kvx/kvx-iommu.rst
+++ b/Documentation/kvx/kvx-iommu.rst
@@ -1,5 +1,5 @@
-IOMMU
-=====
+IOMMU in kvx
+============

General Overview
----------------
diff --git a/Documentation/kvx/kvx-mmu.rst b/Documentation/kvx/kvx-mmu.rst
index faa6bda2c39959..05b9bc111e02db 100644
--- a/Documentation/kvx/kvx-mmu.rst
+++ b/Documentation/kvx/kvx-mmu.rst
@@ -1,5 +1,6 @@
-MMU
-===
+==========================
+kvx Memory Management Unit
+==========================

Virtual addresses are on 41 bits for kvx when using 64-bit mode.
To differentiate kernel from user space, we use the high order bit
diff --git a/Documentation/kvx/kvx-smp.rst b/Documentation/kvx/kvx-smp.rst
index 1b69d77db8cdaf..f170bc48ea5f7f 100644
--- a/Documentation/kvx/kvx-smp.rst
+++ b/Documentation/kvx/kvx-smp.rst
@@ -1,5 +1,6 @@
-SMP
-===
+===============================================
+Symmetric Multiprocessing Implementation in kvx
+===============================================

On kvx, 5 clusters are organized as groups of 16 processors + 1
secure core (RM) for each cluster. These 17 processors are L1$ coherent
diff --git a/Documentation/kvx/kvx.rst b/Documentation/kvx/kvx.rst
index 8982d10f2678df..4aac7fce4e3d01 100644
--- a/Documentation/kvx/kvx.rst
+++ b/Documentation/kvx/kvx.rst
@@ -1,3 +1,4 @@
+=======================
kvx Core Implementation
=======================

--
An old man doll... just what I always wanted! - Clara

2023-01-09 10:48:13

by Bagas Sanjaya

[permalink] [raw]
Subject: [PATCH 4/8] Documentation: kvx: kvx-iommu: Use reST syntax for subsections

Subsection headings of "IOMMU implementation" is written using
triple-hash syntax, which is valid only for Markdown. Since the
documentation is written in reST, use appropriate syntax instead
(tilde underline).

Signed-off-by: Bagas Sanjaya <[email protected]>
---
Documentation/kvx/kvx-iommu.rst | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/kvx/kvx-iommu.rst b/Documentation/kvx/kvx-iommu.rst
index f7f61777eee21e..5ed34463b8bb1f 100644
--- a/Documentation/kvx/kvx-iommu.rst
+++ b/Documentation/kvx/kvx-iommu.rst
@@ -110,7 +110,8 @@ the cluster.
IOMMU is related to a specific bus like PCIe we will be able to specify that
all peripherals will go through this IOMMU.

-### IOMMU Page table
+IOMMU Page table
+~~~~~~~~~~~~~~~~

We need to be able to know which IO virtual addresses (IOVA) are mapped in the
TLB in order to be able to remove entries when a device finishes a transfer and
@@ -137,7 +138,8 @@ huge page table for a given IOMMU (typically the PCIe IOMMU).
As we won't refill the TLB we know that we won't have more than 128*16 entries.
In this case we can simply keep a table with all possible entries.

-### Maintenance interface
+Maintenance interface
+~~~~~~~~~~~~~~~~~~~~~

It is possible to have several "maintainers" for the same IOMMU. The driver is
using two of them. One that writes the TLB and another interface reads TLB. For
@@ -149,7 +151,8 @@ following command in gdb:
Since different management interface are used for read and write it is safe to
execute the above command at any moment.

-### Interrupts
+Interrupts
+~~~~~~~~~~

IOMMU can have 3 kind of interrupts that corresponds to 3 different types of
errors (no mapping. protection, parity). When the IOMMU is shared between
@@ -163,7 +166,8 @@ stall one. So when an interrupt occurs it is managed by the driver. All others
interrupts that occurs are stored and the IOMMU is stalled. When driver cleans
the first interrupt others will be managed one by one.

-### ASN (Address Space Number)
+ASN (Address Space Number)
+~~~~~~~~~~~~~~~~~~~~~~~~~~

This is also know as ASID in some other architecture. Each device will have a
given ASN that will be given through the device tree. As address space is
--
An old man doll... just what I always wanted! - Clara

2023-01-09 10:49:03

by Bagas Sanjaya

[permalink] [raw]
Subject: [PATCH 2/8] Documentation: kvx: Wrap diagrams in literal code block

Wrap code path diagrams in literal code block, just like other diagrams
in the kernel documentation. This avoids confusion with other constructs
(tables, block quotes, and inline substitutions).

Signed-off-by: Bagas Sanjaya <[email protected]>
---
Documentation/kvx/kvx-exceptions.rst | 241 ++++++++++++++-------------
Documentation/kvx/kvx-iommu.rst | 64 +++----
Documentation/kvx/kvx-mmu.rst | 41 +++--
Documentation/kvx/kvx.rst | 96 +++++------
4 files changed, 225 insertions(+), 217 deletions(-)

diff --git a/Documentation/kvx/kvx-exceptions.rst b/Documentation/kvx/kvx-exceptions.rst
index d3e52f30285223..bb9010efb14196 100644
--- a/Documentation/kvx/kvx-exceptions.rst
+++ b/Documentation/kvx/kvx-exceptions.rst
@@ -10,21 +10,21 @@ The offset depends on which exception vector the cpu wants to jump to:
* $ev + 0x80 for interrupt
* $ev + 0xc0 for syscall

-Then, handlers are laid in the following order:
+Then, handlers are laid in the following order::

- +-------------+
- | |
- | Syscall |
- +-------------+
- | |
- | Interrupts |
- +-------------+
- | |
- | Traps |
- +-------------+
- | | ^
- | Debug | | Stride
-BASE -> +-------------+ v
+ +-------------+
+ | |
+ | Syscall |
+ +-------------+
+ | |
+ | Interrupts |
+ +-------------+
+ | |
+ | Traps |
+ +-------------+
+ | | ^
+ | Debug | | Stride
+ BASE -> +-------------+ v


Interrupts, and traps are serviced similarly, ie:
@@ -99,65 +99,66 @@ When handling a signal, the path is the following:
7 - User application is restored at the exact point it was interrupted
before.

+ ::

- +----------+
- | 1 |
- | User app | @func
- | (user) |
- +---+------+
- |
- | it/trap/scall
- |
- +---v-------+
- | 2 |
- | exception |
- | handling |
- | (kernel) |
- +---+-------+
- |
- | Check if signal are pending, if so, handle signals
- |
- +---v--------+
- | 3 |
- | do_signal |
- | handling |
- | (kernel) |
- +----+-------+
- |
- | Return to user signal handler
- |
- +----v------+
- | 4 |
- | signal |
- | handler |
- | (user) |
- +----+------+
- |
- | Return to sigreturn trampoline
- |
- +----v-------+
- | 5 |
- | syscall |
- |rt_sigreturn|
- | (user) |
- +----+-------+
- |
- | Syscall to rt_sigreturn
- |
- +----v-------+
- | 6 |
- | sigreturn |
- | handler |
- | (kernel) |
- +----+-------+
- |
- | Modify context to return to original func
- |
- +----v-----+
- | 7 |
- | User app | @func
- | (user) |
- +----------+
+ +----------+
+ | 1 |
+ | User app | @func
+ | (user) |
+ +---+------+
+ |
+ | it/trap/scall
+ |
+ +---v-------+
+ | 2 |
+ | exception |
+ | handling |
+ | (kernel) |
+ +---+-------+
+ |
+ | Check if signal are pending, if so, handle signals
+ |
+ +---v--------+
+ | 3 |
+ | do_signal |
+ | handling |
+ | (kernel) |
+ +----+-------+
+ |
+ | Return to user signal handler
+ |
+ +----v------+
+ | 4 |
+ | signal |
+ | handler |
+ | (user) |
+ +----+------+
+ |
+ | Return to sigreturn trampoline
+ |
+ +----v-------+
+ | 5 |
+ | syscall |
+ |rt_sigreturn|
+ | (user) |
+ +----+-------+
+ |
+ | Syscall to rt_sigreturn
+ |
+ +----v-------+
+ | 6 |
+ | sigreturn |
+ | handler |
+ | (kernel) |
+ +----+-------+
+ |
+ | Modify context to return to original func
+ |
+ +----v-----+
+ | 7 |
+ | User app | @func
+ | (user) |
+ +----------+

Registers handling
==================
@@ -174,62 +175,62 @@ Interrupts and traps

When interrupt and traps are triggered, we only save the caller-saved registers.
Indeed, we rely on the fact that C code will save and restore callee-saved and
-hence, there is no need to save them. This path is the following:
+hence, there is no need to save them. This path is the following::

- +------------+ +-----------+ +---------------+
-IT | Save caller| C Call | Execute C | Ret | Restore caller| Ret from IT
-+--->+ saved +--------->+ handler +------->+ saved +----->
- | registers | +-----------+ | registers |
- +------------+ +---------------+
+ +------------+ +-----------+ +---------------+
+ IT | Save caller| C Call | Execute C | Ret | Restore caller| Ret from IT
+ +--->+ saved +--------->+ handler +------->+ saved +----->
+ | registers | +-----------+ | registers |
+ +------------+ +---------------+

However, when returning to user, we check if there is work_pending. If a signal
is pending and there is a signal handler to be called, then we need all
registers to be saved on the stack in the pt_regs before executing the signal
handler and restored after that. Since we only saved caller-saved registers, we
need to also save callee-saved registers to restore them correctly when
-returning to user. This path is the following (a bit more complicated !):
+returning to user. This path is the following (a bit more complicated !)::

- +------------+
- | Save caller| +-----------+ Ret +------------+
- IT | saved | C Call | Execute C | to asm | Check work |
- +--->+ registers +--------->+ handler +------->+ pending |
- | to pt_regs | +-----------+ +--+---+-----+
- +------------+ | |
- Work pending | | No work pending
- +--------------------------------------------+ |
- | |
- | +------------+
- v |
- +------+------+ v
- | Save callee | +-------+-------+
- | saved | | Restore caller| RFE from IT
- | registers | | saved +------->
- | to pt_regs | | registers |
- +--+-------+--+ | from pt_regs |
- | | +-------+-------+
- | | +---------+ ^
- | | | Execute | |
- | +-------->+ needed +-----------+
- | | work |
- | +---------+
- |Signal handler ?
- v
-+----+----------+ RFE to user +-------------+ +--------------+
-| Copy all | handler | Execute | ret | rt_sigreturn |
-| registers +------------>+ user signal +------>+ trampoline |
-| from pt_regs | | handler | | to kernel |
-| to user stack | +-------------+ +------+-------+
-+---------------+ |
- syscall rt_sigreturn |
- +-------------------------------------------------+
- |
- v
-+--------+-------+ +-------------+
-| Recopy all | | Restore all | RFE
-| registers from +--------------------->+ saved +------->
-| user stack | Return | registers |
-| to pt_regs | from sigreturn |from pt_regs |
-+----------------+ (via ret_from_fork) +-------------+
+ +------------+
+ | Save caller| +-----------+ Ret +------------+
+ IT | saved | C Call | Execute C | to asm | Check work |
+ +--->+ registers +--------->+ handler +------->+ pending |
+ | to pt_regs | +-----------+ +--+---+-----+
+ +------------+ | |
+ Work pending | | No work pending
+ +--------------------------------------------+ |
+ | |
+ | +------------+
+ v |
+ +------+------+ v
+ | Save callee | +-------+-------+
+ | saved | | Restore caller| RFE from IT
+ | registers | | saved +------->
+ | to pt_regs | | registers |
+ +--+-------+--+ | from pt_regs |
+ | | +-------+-------+
+ | | +---------+ ^
+ | | | Execute | |
+ | +-------->+ needed +-----------+
+ | | work |
+ | +---------+
+ |Signal handler ?
+ v
+ +----+----------+ RFE to user +-------------+ +--------------+
+ | Copy all | handler | Execute | ret | rt_sigreturn |
+ | registers +------------>+ user signal +------>+ trampoline |
+ | from pt_regs | | handler | | to kernel |
+ | to user stack | +-------------+ +------+-------+
+ +---------------+ |
+ syscall rt_sigreturn |
+ +-------------------------------------------------+
+ |
+ v
+ +--------+-------+ +-------------+
+ | Recopy all | | Restore all | RFE
+ | registers from +--------------------->+ saved +------->
+ | user stack | Return | registers |
+ | to pt_regs | from sigreturn |from pt_regs |
+ +----------------+ (via ret_from_fork) +-------------+


Syscalls
diff --git a/Documentation/kvx/kvx-iommu.rst b/Documentation/kvx/kvx-iommu.rst
index 96b74ce71acb3e..69eca8d1bc37a1 100644
--- a/Documentation/kvx/kvx-iommu.rst
+++ b/Documentation/kvx/kvx-iommu.rst
@@ -63,39 +63,39 @@ IOMMU implementation
--------------------

The kvx is providing several IOMMUs. Here is a simplified view of all IOMMUs
-and translations that occurs between memory and devices:
+and translations that occurs between memory and devices::

- +---------------------------------------------------------------------+
- | +------------+ +---------+ | CLUSTER X |
- | | Cores 0-15 +---->+ Crypto | +-----------|
- | +-----+------+ +----+----+ |
- | | | |
- | v v |
- | +-------+ +------------------------------+ |
- | | MMU | +----+ IOMMU x4 (secure + insecure) | |
- | +---+---+ | +------------------------------+ |
- | | | |
- +--------------------+ |
- | | | |
- v v | |
- +---+--------+-+ | |
- | MEMORY | | +----------+ +--------+ +-------+ |
- | +<-|-----+ IOMMU Rx |<----+ DMA Rx |<----+ | |
- | | | +----------+ +--------+ | | |
- | | | | NoC | |
- | | | +----------+ +--------+ | | |
- | +--|---->| IOMMU Tx +---->| DMA Tx +---->+ | |
- | | | +----------+ +--------+ +-------+ |
- | | +------------------------------------------------+
- | |
- | | +--------------+ +------+
- | |<--->+ IOMMU Rx/Tx +<--->+ PCIe +
- | | +--------------+ +------+
- | |
- | | +--------------+ +------------------------+
- | |<--->+ IOMMU Rx/Tx +<--->+ master Soc Peripherals |
- | | +--------------+ +------------------------+
- +--------------+
+ +---------------------------------------------------------------------+
+ | +------------+ +---------+ | CLUSTER X |
+ | | Cores 0-15 +---->+ Crypto | +-----------|
+ | +-----+------+ +----+----+ |
+ | | | |
+ | v v |
+ | +-------+ +------------------------------+ |
+ | | MMU | +----+ IOMMU x4 (secure + insecure) | |
+ | +---+---+ | +------------------------------+ |
+ | | | |
+ +--------------------+ |
+ | | | |
+ v v | |
+ +---+--------+-+ | |
+ | MEMORY | | +----------+ +--------+ +-------+ |
+ | +<-|-----+ IOMMU Rx |<----+ DMA Rx |<----+ | |
+ | | | +----------+ +--------+ | | |
+ | | | | NoC | |
+ | | | +----------+ +--------+ | | |
+ | +--|---->| IOMMU Tx +---->| DMA Tx +---->+ | |
+ | | | +----------+ +--------+ +-------+ |
+ | | +------------------------------------------------+
+ | |
+ | | +--------------+ +------+
+ | |<--->+ IOMMU Rx/Tx +<--->+ PCIe +
+ | | +--------------+ +------+
+ | |
+ | | +--------------+ +------------------------+
+ | |<--->+ IOMMU Rx/Tx +<--->+ master Soc Peripherals |
+ | | +--------------+ +------------------------+
+ +--------------+


There is also an IOMMU dedicated to the crypto module but this module will not
diff --git a/Documentation/kvx/kvx-mmu.rst b/Documentation/kvx/kvx-mmu.rst
index 59bda2afc9abde..832fb7c41a49d8 100644
--- a/Documentation/kvx/kvx-mmu.rst
+++ b/Documentation/kvx/kvx-mmu.rst
@@ -157,14 +157,17 @@ We only support three levels for the page table and 4KB for page size.
3 levels page table
-------------------

-...-----+--------+--------+--------+--------+--------+
- 40|39 32|31 24|23 16|15 8|7 0|
-...-----++-------+--+-----+---+----+----+---+--------+
- | | | |
- | | | +---> [11:0] Offset (12 bits)
- | | +-------------> [20:12] PTE offset (9 bits)
- | +-----------------------> [29:21] PMD offset (9 bits)
- +----------------------------------> [39:30] PGD offset (10 bits)
+::
+
+ ...-----+--------+--------+--------+--------+--------+
+ 40|39 32|31 24|23 16|15 8|7 0|
+ ...-----++-------+--+-----+---+----+----+---+--------+
+ | | | |
+ | | | +---> [11:0] Offset (12 bits)
+ | | +-------------> [20:12] PTE offset (9 bits)
+ | +-----------------------> [29:21] PMD offset (9 bits)
+ +----------------------------------> [39:30] PGD offset (10 bits)
+
Bits 40 to 64 are signed extended according to bit 39. If bit 39 is equal to 1
we are in kernel space.

@@ -175,12 +178,14 @@ PTE format

About the format of the PTE entry, as we are not forced by hardware for choices,
we choose to follow the format described in the RiscV implementation as a
-starting point.
+starting point::
+
+ +---------+--------+----+--------+---+---+---+---+---+---+------+---+---+
+ | 63..23 | 22..13 | 12 | 11..10 | 9 | 8 | 7 | 6 | 5 | 4 | 3..2 | 1 | 0 |
+ +---------+--------+----+--------+---+---+---+---+---+---+------+---+---+
+ PFN Unused S PageSZ H G X W R D CP A P
+

- +---------+--------+----+--------+---+---+---+---+---+---+------+---+---+
- | 63..23 | 22..13 | 12 | 11..10 | 9 | 8 | 7 | 6 | 5 | 4 | 3..2 | 1 | 0 |
- +---------+--------+----+--------+---+---+---+---+---+---+------+---+---+
- PFN Unused S PageSZ H G X W R D CP A P
where:
P: Present
A: Accessed
@@ -231,10 +236,12 @@ kvx implementation to use them is based on other architectures (such as arc
or xtensa) and uses a wrapping ASN counter containing both cycle/generation and
asn.

-+---------+--------+
-|63 10|9 0|
-+---------+--------+
- Cycle ASN
+::
+
+ +---------+--------+
+ |63 10|9 0|
+ +---------+--------+
+ Cycle ASN

This ASN counter is incremented monotonously to allocate new ASNs. When the
counter reaches 511 (9 bit), TLB is completely flushed and a new cycle is
diff --git a/Documentation/kvx/kvx.rst b/Documentation/kvx/kvx.rst
index 8ce0703de6813b..20c3666f445e26 100644
--- a/Documentation/kvx/kvx.rst
+++ b/Documentation/kvx/kvx.rst
@@ -15,17 +15,17 @@ On kvx, we have 4 levels of privilege level starting from 0 (most
privileged one) to 3 (less privilege one). A system of owners allows
to delegate ownership of resources by using specials system registers.

-The 2 main software stacks for Linux Kernel are the following:
+The 2 main software stacks for Linux Kernel are the following::

-+-------------+ +-------------+
-| PL0: Debug | | PL0: Debug |
-+-------------+ +-------------+
-| PL1: Linux | | PL1: HyperV |
-+-------------+ +-------------+
-| PL2: User | | PL2: Linux |
-+-------------+ +-------------+
-| | | PL3: User |
-+-------------+ +-------------+
+ +-------------+ +-------------+
+ | PL0: Debug | | PL0: Debug |
+ +-------------+ +-------------+
+ | PL1: Linux | | PL1: HyperV |
+ +-------------+ +-------------+
+ | PL2: User | | PL2: Linux |
+ +-------------+ +-------------+
+ | | | PL3: User |
+ +-------------+ +-------------+

In both cases, the kvx support for privileges has been designed using
only relative PL and thus should work on both configurations without
@@ -201,45 +201,45 @@ to it, the kernel sends an interrupt using a mailbox.
If the L2$ node is not present in the device tree, then, the RM will directly go
into sleeping.

-Boot diagram:
+Boot diagram::

- RM PE 0
- +
- +---------+ |
- | Boot | |
- +----+----+ |
- | |
- v |
- +-----+-----+ |
- | Prepare | |
- | L2 shared | |
- | memory | |
- |(registers)| |
- +-----+-----+ |
- | | +-----------+
- +------------------->+ Boot |
- | | +-----+-----+
- v | |
- +--------+---------+ | |
- | L2 firmware | | |
- | parameters: | | |
- | r0 = registers | | |
- | r1 = DTB | | |
- +--------+---------+ | |
- | | |
- v | |
- +-------+--------+ | +------+------+
- | L2 firmware | | | Wait for L2 |
- | execution | | | to be ready |
- +-------+--------+ | +------+------+
- | | |
- +------v-------+ | v
- | L2 requests | | +------+------+
-+--->+ handling | | | Enable |
-| +-------+------+ | | L2 caching |
-| | | +------+------+
-| | | |
-+------------+ + v
+ RM PE 0
+ +
+ +---------+ |
+ | Boot | |
+ +----+----+ |
+ | |
+ v |
+ +-----+-----+ |
+ | Prepare | |
+ | L2 shared | |
+ | memory | |
+ |(registers)| |
+ +-----+-----+ |
+ | | +-----------+
+ +------------------->+ Boot |
+ | | +-----+-----+
+ v | |
+ +--------+---------+ | |
+ | L2 firmware | | |
+ | parameters: | | |
+ | r0 = registers | | |
+ | r1 = DTB | | |
+ +--------+---------+ | |
+ | | |
+ v | |
+ +-------+--------+ | +------+------+
+ | L2 firmware | | | Wait for L2 |
+ | execution | | | to be ready |
+ +-------+--------+ | +------+------+
+ | | |
+ +------v-------+ | v
+ | L2 requests | | +------+------+
+ +--->+ handling | | | Enable |
+ | +-------+------+ | | L2 caching |
+ | | | +------+------+
+ | | | |
+ +------------+ + v


Since this driver is started early (before SMP boot), A lot of drivers are not
--
An old man doll... just what I always wanted! - Clara

2023-01-09 11:17:23

by Jules Maselbas

[permalink] [raw]
Subject: Re: [PATCH 0/8] kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation)

Hi Bagas,

On Mon, Jan 09, 2023 at 04:51:00PM +0700, Bagas Sanjaya wrote:
> Jonathan Corbet <[email protected]> writes:
> >> Add some documentation for kvx arch and its Linux port.
> >>
> >> CC: Jonathan Corbet <[email protected]>
> >> CC: [email protected]
> >> CC: [email protected]
> >> Co-developed-by: Clement Leger <[email protected]>
> >> Signed-off-by: Clement Leger <[email protected]>
> >> Co-developed-by: Guillaume Thouvenin <[email protected]>
> >> Signed-off-by: Guillaume Thouvenin <[email protected]>
> >> Signed-off-by: Yann Sionneau <[email protected]>
> >> ---
> >> Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++
> >> Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++
> >> Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++
> >> Documentation/kvx/kvx-smp.txt | 36 ++++
> >> Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++
> >> 5 files changed, 1005 insertions(+)
> >> create mode 100644 Documentation/kvx/kvx-exceptions.txt
> >> create mode 100644 Documentation/kvx/kvx-iommu.txt
> >> create mode 100644 Documentation/kvx/kvx-mmu.txt
> >> create mode 100644 Documentation/kvx/kvx-smp.txt
> >> create mode 100644 Documentation/kvx/kvx.txt
> >
> >Please write this documentation in the RST format (you're 95% of the way
> >there now) and incorporate into the kernel docs build.
>
> Here is the polished documentation in reST format. Yann, can you please
> squash this series into your documentation patch?
Thanks a lot, I've already converted the documentation to reST, but I will
take a look at this series and see what I can apply.

> Bagas Sanjaya (8):
> Documentation: kvx: Convert to reST
> Documentation: kvx: Wrap diagrams in literal code block
> Documentation: kvx: Fix lists
> Documentation: kvx: kvx-iommu: Use reST syntax for subsections
> Documentation: kvx: kvx-iommu: monospacize kvx iommu device tree path
> Documentation: kvx: Promote title headings
> Documentation: kvx: Use literal code block for command-line inputs
> Documentation: kvx: reword
>
> Documentation/arch.rst | 1 +
> Documentation/kvx/index.rst | 12 ++
> Documentation/kvx/kvx-exceptions.rst | 258 +++++++++++++++++++++++
> Documentation/kvx/kvx-exceptions.txt | 246 ----------------------
> Documentation/kvx/kvx-iommu.rst | 188 +++++++++++++++++
> Documentation/kvx/kvx-iommu.txt | 183 -----------------
> Documentation/kvx/kvx-mmu.rst | 294 +++++++++++++++++++++++++++
> Documentation/kvx/kvx-mmu.txt | 272 -------------------------
> Documentation/kvx/kvx-smp.rst | 36 ++++
> Documentation/kvx/kvx-smp.txt | 36 ----
> Documentation/kvx/kvx.rst | 269 ++++++++++++++++++++++++
> Documentation/kvx/kvx.txt | 268 ------------------------
> 12 files changed, 1058 insertions(+), 1005 deletions(-)
> create mode 100644 Documentation/kvx/index.rst
> create mode 100644 Documentation/kvx/kvx-exceptions.rst
> delete mode 100644 Documentation/kvx/kvx-exceptions.txt
> create mode 100644 Documentation/kvx/kvx-iommu.rst
> delete mode 100644 Documentation/kvx/kvx-iommu.txt
> create mode 100644 Documentation/kvx/kvx-mmu.rst
> delete mode 100644 Documentation/kvx/kvx-mmu.txt
> create mode 100644 Documentation/kvx/kvx-smp.rst
> delete mode 100644 Documentation/kvx/kvx-smp.txt
> create mode 100644 Documentation/kvx/kvx.rst
> delete mode 100644 Documentation/kvx/kvx.txt
>
> --
> An old man doll... just what I always wanted! - Clara
>
>
>
>
>




2023-01-10 00:36:56

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 0/8] kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation)

Hi Bagas,

On 1/9/23 01:51, Bagas Sanjaya wrote:
> Jonathan Corbet <[email protected]> writes:
>>> Add some documentation for kvx arch and its Linux port.
>>>
...
>>
>> Please write this documentation in the RST format (you're 95% of the way
>> there now) and incorporate into the kernel docs build.
>
> Here is the polished documentation in reST format. Yann, can you please
> squash this series into your documentation patch?

JFYI, to me "improv" applies mostly to jazz (music) or comedy. :)

https://www.merriam-webster.com/dictionary/improv
https://en.wikipedia.org/wiki/Improv

Thanks for the patches.

--
~Randy

2023-01-18 09:53:47

by Yann Sionneau

[permalink] [raw]
Subject: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation

On 03/01/2023 18:50, Jonathan Corbet wrote:

> Yann Sionneau <[email protected]> writes:
>
>> Add some documentation for kvx arch and its Linux port.
>>
>> CC: Jonathan Corbet <[email protected]>
>> CC: [email protected]
>> CC: [email protected]
>> Co-developed-by: Clement Leger <[email protected]>
>> Signed-off-by: Clement Leger <[email protected]>
>> Co-developed-by: Guillaume Thouvenin <[email protected]>
>> Signed-off-by: Guillaume Thouvenin <[email protected]>
>> Signed-off-by: Yann Sionneau <[email protected]>
>> ---
>> Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++
>> Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++
>> Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++
>> Documentation/kvx/kvx-smp.txt | 36 ++++
>> Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++
>> 5 files changed, 1005 insertions(+)
>> create mode 100644 Documentation/kvx/kvx-exceptions.txt
>> create mode 100644 Documentation/kvx/kvx-iommu.txt
>> create mode 100644 Documentation/kvx/kvx-mmu.txt
>> create mode 100644 Documentation/kvx/kvx-smp.txt
>> create mode 100644 Documentation/kvx/kvx.txt
> Please write this documentation in the RST format (you're 95% of the way
> there now) and incorporate into the kernel docs build.

Ack, it will be part of the V2, thanks for the review.

--

Yann