All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>, Yann Sionneau <ysionneau@kalray.eu>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Clement Leger <clement.leger@bootlin.com>,
	Guillaume Thouvenin <gthouvenin@kalray.eu>,
	Bagas Sanjaya <bagasdotme@gmail.com>
Subject: [PATCH 3/8] Documentation: kvx: Fix lists
Date: Mon,  9 Jan 2023 16:51:03 +0700	[thread overview]
Message-ID: <20230109095108.21229-4-bagasdotme@gmail.com> (raw)
In-Reply-To: <20230109095108.21229-1-bagasdotme@gmail.com>

Many "unexpected indentation" and block quote warnings are generated due
to errors in lists. Fix them up by:

  * Align lists texts just after the lists marker
  * Add required blank line between nested lists and between paragraphs
    and the lists
  * Use appropriate syntax for numbered lists

While at it, also lightly reword.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Documentation/kvx/kvx-exceptions.rst | 53 ++++++++++++++-----------
 Documentation/kvx/kvx-iommu.rst      |  3 +-
 Documentation/kvx/kvx-mmu.rst        | 37 +++++++++--------
 Documentation/kvx/kvx.rst            | 59 +++++++++++++++-------------
 4 files changed, 85 insertions(+), 67 deletions(-)

diff --git a/Documentation/kvx/kvx-exceptions.rst b/Documentation/kvx/kvx-exceptions.rst
index bb9010efb14196..bd485efd2362c1 100644
--- a/Documentation/kvx/kvx-exceptions.rst
+++ b/Documentation/kvx/kvx-exceptions.rst
@@ -5,6 +5,7 @@ specifies a base address.
 An offset is added to $ev upon exception and the result is used as
 "Next $pc".
 The offset depends on which exception vector the cpu wants to jump to:
+
 * $ev + 0x00 for debug
 * $ev + 0x40 for trap
 * $ev + 0x80 for interrupt
@@ -28,6 +29,7 @@ Then, handlers are laid in the following order::
 
 
 Interrupts, and traps are serviced similarly, ie:
+
 - Jump to handler
 - Save all registers
 - Prepare the call (do_IRQ or trap_handler)
@@ -58,12 +60,15 @@ The following steps are then taken:
 
 - Switch to kernel stack
 - Extract syscall number
-- Check that the syscall number is not bogus
- - If so, set syscall func to a not implemented one
-- Check if tracing is enabled
- - If so, jump to trace_syscall_enter
+- Check that the syscall number is not bogus.
+  If so, set syscall func to a not implemented one
+
+- Check if tracing is enabled.
+  If so, jump to trace_syscall_enter, then:
+
  - Save syscall arguments (r0 -> r7) on stack in pt_regs
  - Call do_trace_syscall_enter function
+
 - Restore syscall arguments since they have been modified by C call
 - Call the syscall function
 - Save $r0 in pt_regs since it can be cloberred afterward
@@ -80,24 +85,28 @@ Signals
 Signals are handled when exiting kernel before returning to user.
 When handling a signal, the path is the following:
 
-1 - User application is executing normally
-    Then any exception happens (syscall, interrupt, trap)
-2 - The exception handling path is taken
-    and before returning to user, pending signals are checked
-3 - Signal are handled by do_signal
-    Registers are saved and a special part of the stack is modified
-    to create a trampoline to call rt_sigreturn
-    $spc is modified to jump to user signal handler
-    $ra is modified to jump to sigreturn trampoline directly after
-    returning from user signal handler.
-4 - User signal handler is called after rfe from exception
-    when returning, $ra is retored to $pc, resulting in a call
-    to the syscall trampoline.
-5 - syscall trampoline is executed, leading to rt_sigreturn syscall
-6 - rt_sigreturn syscall is executed
-    Previous registers are restored to allow returning to user correctly
-7 - User application is restored at the exact point it was interrupted
-    before.
+1. User application is executing normally, then exception occurs (syscall,
+   interrupt, trap)
+2. The exception handling path is taken
+   and before returning to user, pending signals are checked.
+
+3. The signal handling path is as follows:
+
+   * Signals are handled by do_signal.
+   * Registers are saved and a special part of the stack is modified
+     to create a trampoline to call rt_sigreturn.
+   * $spc is modified to jump to user signal handler.
+   * $ra is modified to jump to sigreturn trampoline directly after
+     returning from user signal handler.
+
+4. User signal handler is called after rfe from exception.
+   When returning, $ra is retored to $pc, resulting in a call
+   to the syscall trampoline.
+5. syscall trampoline is executed, leading to rt_sigreturn syscall
+6. rt_sigreturn syscall is executed.
+   Previous registers are restored to allow returning to user correctly
+7. User application is restored at the exact point it was interrupted
+   before.
 
     ::
 
diff --git a/Documentation/kvx/kvx-iommu.rst b/Documentation/kvx/kvx-iommu.rst
index 69eca8d1bc37a1..f7f61777eee21e 100644
--- a/Documentation/kvx/kvx-iommu.rst
+++ b/Documentation/kvx/kvx-iommu.rst
@@ -32,7 +32,8 @@ Cluster IOMMUs
 --------------
 
 IOMMUs on cluster are used for DMA and cryptographic accelerators.
-There are six IOMMUs connected to the:
+There are six IOMMUs connected:
+
 	- cluster DMA tx
 	- cluster DMA rx
 	- first non secure cryptographic accelerator
diff --git a/Documentation/kvx/kvx-mmu.rst b/Documentation/kvx/kvx-mmu.rst
index 832fb7c41a49d8..faa6bda2c39959 100644
--- a/Documentation/kvx/kvx-mmu.rst
+++ b/Documentation/kvx/kvx-mmu.rst
@@ -77,6 +77,7 @@ routine which would (obviously) not work... Once this is done, we can flush the
 entries and that new entries inserted in JTLB will apply.
 
 By default, the following policy is applied on vmlinux sections:
+
 - init_data: RW
 - init_text: RX (or RWX if parameter rodata=off)
 - text: RX (or RWX if parameter rodata=off)
@@ -92,8 +93,9 @@ spaces to be in the same space as the user. The kernel will have the
 $ps.mmup set in kernel (PL1) and unset for user (PL2).
 As said in kvx documentation, we have two cases when the kernel is
 booted:
-- Either we have been booted by someone (bootloader, hypervisor, etc)
-- Or we are alone (boot from flash)
+
+- Boot via intermediaries (bootloader, hypervisor, etc)
+- Direct boot from flash
 
 In both cases, we will use the virtual space 0. Indeed, if we are alone
 on the core, then it means nobody is using the MMU and we can take the
@@ -115,6 +117,7 @@ setup_bootmem: Memory  : 0x100000000 - 0x120000000
 setup_bootmem: Reserved: 0x10001f000 - 0x1002d1bc0
 
 During the paging init we need to set:
+
   - min_low_pfn that is the lowest PFN available in the system
   - max_low_pfn that indicates the end if NORMAL zone
   - max_pfn that is the number of pages in the system
@@ -213,16 +216,16 @@ kvx core does not feature a hardware page walker. This work must be done
 by the core in software. In order to optimize TLB refill, a special fast
 path is taken when entering in kernel space.
 In order to speed up the process, the following actions are taken:
-# Save some registers in a per process scratchpad
-# If the trap is a nomapping then try the fastpath
-# Save some more registers for this fastpath
-# Check if faulting address is a memory direct mapping one.
- # If entry is a direct mapping one and RWX is not enabled, add an entry into LTLB
- # If not, continue
-# Try to walk the page table
- # If entry is not present, take the slowpath (do_page_fault)
-# Refill the tlb properly
-# Exit by restoring only a few registers
+
+1. Save some registers in a per process scratchpad
+2. If the trap is a nomapping then try the fastpath
+3. Save some more registers for this fastpath
+4. Check if faulting address is a memory direct mapping one. If entry is a
+   direct mapping one and RWX is not enabled, add an entry into LTLB.
+   Otherwise, continue
+5. Try to walk the page table. If entry is not present, take the slowpath (do_page_fault)
+6. Refill the tlb properly
+7. Exit by restoring only a few registers
 
 ASN Handling
 ============
@@ -273,13 +276,15 @@ Debug
 
 In order to debug the page table and tlb entries, gdb scripts contains commands
 which allows to dump the page table:
+
 - lx-kvx-page-table-walk
- - Display the current process page table by default
+    Display the current process page table by default
 - lx-kvx-tlb-decode
- - Display the content of $tel and $teh into something readable
+    Display the content of $tel and $teh into something readable
 
 Other commands available in kvx-gdb are the following:
+
 - mppa-dump-tlb
- - Display the content of TLBs (JTLB and LTLB)
+    Display the content of TLBs (JTLB and LTLB)
 - mppa-lookup-addr
- - Find physical address matching a virtual one
+    Find physical address matching a virtual one
diff --git a/Documentation/kvx/kvx.rst b/Documentation/kvx/kvx.rst
index 20c3666f445e26..8982d10f2678df 100644
--- a/Documentation/kvx/kvx.rst
+++ b/Documentation/kvx/kvx.rst
@@ -74,6 +74,7 @@ When entering the C (kvx_lowlevel_start) the kernel will look for a special
 magic in $r0 (0x494C314B). This magic tells the kernel if there is arguments
 passed by a bootloader.
 Currently, the following values are passed through registers:
+
  - r1: pointer to command line setup by bootloader
  - r2: device tree
 
@@ -105,11 +106,13 @@ of the LTLB.
 
 The first entry will map the first 1G of virtual address space to the first
 1G of DDR:
+
   - TLB[0]: 0xffffff0000000000 -> 0x100000000 (size 512Mo)
 
 The second entry will be a flat mapping of the first 512 Ko of the SMEM. It
 is required to have this flat mapping because there is still code located at
 this address that needs to be executed:
+
   - TLB[1]: 0x0 -> 0x0 (size 512Ko)
 
 Once virtual space reached the second entry is removed.
@@ -151,19 +154,19 @@ r20 and r21 to special values containing the function to call.
 
 The normal path for a kernel thread will be the following:
 
- 1 - Enter copy_thread_tls and setup callee saved registers which will
-     be restored in __switch_to.
- 2 - set r20 and r21 (in thread_struct) to function and argument and
-     ra to ret_from_kernel_thread.
-     These callee saved will be restored in switch_to.
- 3 - Call _switch_to at some point.
- 4 - Save all callee saved register since switch_to is seen as a
-     standard function call by the caller.
- 5 - Change stack pointer to the new stack
- 6 - At the end of switch to, set sr0 to the new task and use ret to
-     jump to ret_from_kernel_thread (address restored from ra).
- 7 - In ret_from_kernel_thread, execute the function with arguments by
-     using r20, r21 and we are done
+ 1. Enter copy_thread_tls and setup callee saved registers which will
+    be restored in __switch_to.
+ 2. set r20 and r21 (in thread_struct) to function and argument and
+    ra to ret_from_kernel_thread.
+    These callee saved will be restored in switch_to.
+ 3. Call _switch_to at some point.
+ 4. Save all callee saved register since switch_to is seen as a
+    standard function call by the caller.
+ 5. Change stack pointer to the new stack
+ 6. At the end of switch to, set sr0 to the new task and use ret to
+    jump to ret_from_kernel_thread (address restored from ra).
+ 7. In ret_from_kernel_thread, execute the function with arguments by
+    using r20, r21 and we are done
 
 For more explanation, you can refer to https://lwn.net/Articles/520227/
 
@@ -173,21 +176,21 @@ User thread creation
 We are using almost the same path as copy_thread to create it.
 The detailed path is the following:
 
- 1 - Call start_thread which will setup user pc and stack pointer in
-     task regs. We also set sps and clear privilege mode bit.
-     When returning from exception, it will "flip" to user mode.
- 2 - Enter copy_thread_tls and setup callee saved registers which will
-     be restored in __switch_to. Also, set the "return" function to be
-     ret_from_fork which will be called at end of switch_to
- 3 - set r20 (in thread_struct) with tracing information.
-     (simply by lazyness to avoid computing it in assembly...)
- 4 - Call _switch_to at some point.
- 5 - The current pc will then be restored to be ret_from fork.
- 6 - Ret from fork calls schedule_tail and then check if tracing is
-     enabled. If so call syscall_trace_exit
- 7 - finally, instead of returning to kernel, we restore all registers
-     that have been setup by start_thread by restoring regs stored on
-     stack
+ 1. Call start_thread which will setup user pc and stack pointer in
+    task regs. We also set sps and clear privilege mode bit.
+    When returning from exception, it will "flip" to user mode.
+ 2. Enter copy_thread_tls and setup callee saved registers which will
+    be restored in __switch_to. Also, set the "return" function to be
+    ret_from_fork which will be called at end of switch_to
+ 3. set r20 (in thread_struct) with tracing information.
+    (simply by lazyness to avoid computing it in assembly...)
+ 4. Call _switch_to at some point.
+ 5. The current pc will then be restored to be ret_from fork.
+ 6. Ret from fork calls schedule_tail and then check if tracing is
+    enabled. If so call syscall_trace_exit
+ 7. Finally, instead of returning to kernel, we restore all registers
+    that have been setup by start_thread by restoring regs stored on
+    stack
 
 L2$ handling
 ============
-- 
An old man doll... just what I always wanted! - Clara


  parent reply	other threads:[~2023-01-09  9:53 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 16:43 [RFC PATCH 00/25] Upstream kvx Linux port Yann Sionneau
2023-01-03 16:43 ` Yann Sionneau
2023-01-03 16:43 ` Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 01/25] Documentation: kvx: Add basic documentation Yann Sionneau
2023-01-03 17:50   ` Jonathan Corbet
2023-01-09  9:51     ` [PATCH 0/8] kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation) Bagas Sanjaya
2023-01-09  9:51       ` [PATCH 1/8] Documentation: kvx: Convert to reST Bagas Sanjaya
2023-01-09  9:51       ` [PATCH 2/8] Documentation: kvx: Wrap diagrams in literal code block Bagas Sanjaya
2023-01-09  9:51       ` Bagas Sanjaya [this message]
2023-01-09  9:51       ` [PATCH 4/8] Documentation: kvx: kvx-iommu: Use reST syntax for subsections Bagas Sanjaya
2023-01-09  9:51       ` [PATCH 5/8] Documentation: kvx: kvx-iommu: monospacize kvx iommu device tree path Bagas Sanjaya
2023-01-09  9:51       ` [PATCH 6/8] Documentation: kvx: Promote title headings Bagas Sanjaya
2023-01-09  9:51       ` [PATCH 7/8] Documentation: kvx: Use literal code block for command-line inputs Bagas Sanjaya
2023-01-09  9:51       ` [PATCH 8/8] Documentation: kvx: reword Bagas Sanjaya
2023-01-09 10:59       ` [PATCH 0/8] kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation) Jules Maselbas
2023-01-10  0:18       ` Randy Dunlap
2023-01-18  8:44     ` [RFC PATCH 01/25] Documentation: kvx: Add basic documentation Yann Sionneau
2023-01-05 18:38   ` kernel test robot
2023-01-18 15:09   ` Jeff Xie
2023-01-03 16:43 ` [RFC PATCH 02/25] kvx: Add ELF-related definitions Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-03 21:35   ` Eric W. Biederman
2023-01-03 21:35     ` Eric W. Biederman
2023-01-18  8:48     ` Yann Sionneau
2023-01-18  8:48       ` Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 03/25] kvx: Add build infrastructure Yann Sionneau
2023-01-03 17:29   ` Randy Dunlap
2023-01-05 13:12     ` Jules Maselbas
2023-01-06  0:43   ` kernel test robot
2023-01-03 16:43 ` [RFC PATCH 04/25] kvx: Add CPU definition headers Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 05/25] kvx: Add atomic/locking headers Yann Sionneau
2023-01-04  9:53   ` Mark Rutland
2023-01-06 14:11     ` Jules Maselbas
2023-01-10 13:24       ` Mark Rutland
2023-01-18 13:40         ` Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 06/25] kvx: Add other common headers Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 07/25] kvx: Add boot and setup routines Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 08/25] kvx: Add exception/interrupt handling Yann Sionneau
2023-01-09 20:54   ` Thomas Gleixner
2023-01-03 16:43 ` [RFC PATCH 09/25] kvx: irqchip: Add support for irq controllers Yann Sionneau
2023-01-03 21:28   ` Rob Herring
2023-01-03 16:43 ` [RFC PATCH 10/25] kvx: Add process management Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 11/25] kvx: Add memory management Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-04 11:37   ` Mike Rapoport
2023-01-04 11:37     ` Mike Rapoport
2023-01-03 16:43 ` [RFC PATCH 12/25] kvx: Add system call support Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-04 15:07   ` Arnd Bergmann
2023-01-04 15:07     ` Arnd Bergmann
2023-01-09 20:55   ` Thomas Gleixner
2023-01-09 20:55     ` Thomas Gleixner
2023-01-03 16:43 ` [RFC PATCH 13/25] kvx: Add signal handling support Yann Sionneau
2023-01-04 11:28   ` Mark Rutland
2023-01-03 16:43 ` [RFC PATCH 14/25] kvx: Add ELF relocations and module support Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 15/25] kvx: Add misc common routines Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 16/25] kvx: Add some library functions Yann Sionneau
2023-01-05 13:05   ` Clément Léger
2023-01-03 16:43 ` [RFC PATCH 17/25] kvx: Add multi-processor (SMP) support Yann Sionneau
2023-01-03 21:22   ` Rob Herring
2023-01-05  8:12   ` Clément Léger
2023-01-03 16:43 ` [RFC PATCH 18/25] kvx: Add kvx default config file Yann Sionneau
2023-01-04 13:02   ` Bagas Sanjaya
2023-01-06 14:52     ` Jules Maselbas
2023-01-03 16:43 ` [RFC PATCH 19/25] kvx: power: scall poweroff driver Yann Sionneau
2023-01-04 17:08   ` Sebastian Reichel
2023-01-03 16:43 ` [RFC PATCH 20/25] kvx: gdb: add kvx related gdb helpers Yann Sionneau
2023-01-04  7:41   ` Jan Kiszka
2023-01-05 15:19     ` Dmitrii Bundin
2023-01-03 16:43 ` [RFC PATCH 21/25] kvx: Add support for ftrace Yann Sionneau
2023-01-05 12:55   ` Clément Léger
2023-01-05 14:20     ` Steven Rostedt
2023-01-05 14:50   ` Mark Rutland
2023-01-03 16:43 ` [RFC PATCH 22/25] kvx: Add support for jump labels Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 23/25] kvx: Add debugging related support Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 24/25] kvx: Add support for CPU Perf Monitors Yann Sionneau
2023-01-03 16:43   ` Yann Sionneau
2023-01-03 16:43 ` [RFC PATCH 25/25] kvx: Add support for cpuinfo Yann Sionneau
2023-01-03 20:52 ` [RFC PATCH 00/25] Upstream kvx Linux port Rob Herring
2023-01-03 20:52   ` Rob Herring
2023-01-03 20:52   ` Rob Herring
2023-01-04 15:58 ` Arnd Bergmann
2023-01-04 15:58   ` Arnd Bergmann
2023-01-04 15:58   ` Arnd Bergmann
2023-01-05 10:40   ` Jules Maselbas
2023-01-05 10:40     ` Jules Maselbas
2023-01-05 10:40     ` Jules Maselbas
2023-01-05 12:05     ` Arnd Bergmann
2023-01-05 12:05       ` Arnd Bergmann
2023-01-05 12:05       ` Arnd Bergmann
2023-01-05 14:12       ` Steven Rostedt
2023-01-05 14:12         ` Steven Rostedt
2023-01-05 14:12         ` Steven Rostedt
2023-01-07  6:25 ` Jeff Xie
2023-01-07  6:25   ` Jeff Xie
2023-01-07  6:25   ` Jeff Xie
2023-01-09 13:21   ` Yann Sionneau
2023-01-09 13:21     ` Yann Sionneau
2023-01-09 13:21     ` Yann Sionneau
2023-01-09 15:11     ` Jeff Xie
2023-01-09 15:11       ` Jeff Xie
2023-01-09 15:11       ` Jeff Xie
2023-01-09 15:30       ` Yann Sionneau
2023-01-09 15:30         ` Yann Sionneau
2023-01-09 15:53         ` Jeff Xie
2023-01-09 15:53           ` Jeff Xie
2023-01-16  7:31           ` Jeff Xie
2023-01-16  7:31             ` Jeff Xie
2023-01-16  7:31             ` Jeff Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230109095108.21229-4-bagasdotme@gmail.com \
    --to=bagasdotme@gmail.com \
    --cc=clement.leger@bootlin.com \
    --cc=corbet@lwn.net \
    --cc=gthouvenin@kalray.eu \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ysionneau@kalray.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.