All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation
@ 2021-04-09  9:10 Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 01/11] docs/zh_CN: add core-api irq concepts.rst translation Yanteng Si
                   ` (9 more replies)
  0 siblings, 10 replies; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This series of patches translates core-api/irq/* and openrisc/* into
Chinese

v1 -> v2:

Modify some words under Xiangcheng Wu's suggestion. Thanks for his rewiew!

Yanteng Si(11):
docs/zh_CN: add core-api irq concepts.rst translation
docs/zh_CN: add core-api irq irq-affinity.rst translation
docs/zh_CN: add core-api/irq/irq-domain.rst translation
docs/zh_CN: add core-api irq irqflags-tracing.rst
docs/zh_CN: add core-api irq index.rst translation
docs/zh_CN: add core-api/index.rst translation
docs/zh_CN: add translation to zh_CN index
docs/zh_CN: add openrisc openrisc_port.rst translation
docs/zh_CN: add openrisc/todo.rst translation
docs/zh_CN: add openrisc/index.rst translation
docs/zh_CN: add translation to zh_CN index

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
Documentation/translations/zh_CN/core-api/index.rst                     | 126 ++++++++++++++
Documentation/translations/zh_CN/core-api/irq/concepts.rst              | 24  ++++++++++++++
Documentation/translations/zh_CN/core-api/irq/index.rst                 | 19  ++++++++++++++
Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst          | 73  ++++++++++++++
Documentation/translations/zh_CN/core-api/irq/irq-domain.rst            | 228 ++++++++++++++
Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst      | 45  ++++++++++++++
Documentation/translations/zh_CN/index.rst                              | 2   ++++++++++++++
Documentation/translations/zh_CN/openrisc/index.rst                     | 27  ++++++++++++++
Documentation/translations/zh_CN/openrisc/openrisc_port.rst             | 124 ++++++++++++++
Documentation/translations/zh_CN/openrisc/todo.rst                      | 20  ++++++++++++++
10 files changed, 688 insertions(+)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 01/11] docs/zh_CN: add core-api irq concepts.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09 10:09   ` Wu X.C.
  2021-04-09  9:10 ` [PATCH v2 02/11] docs/zh_CN: add core-api irq irq-affinity.rst translation Yanteng Si
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/core-api/irq/concepts.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../zh_CN/core-api/irq/concepts.rst           | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/core-api/irq/concepts.rst

diff --git a/Documentation/translations/zh_CN/core-api/irq/concepts.rst b/Documentation/translations/zh_CN/core-api/irq/concepts.rst
new file mode 100644
index 000000000000..b8b98a196a5d
--- /dev/null
+++ b/Documentation/translations/zh_CN/core-api/irq/concepts.rst
@@ -0,0 +1,24 @@
+.. include:: ../../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../../core-api/irq/concepts`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_concepts.rst:
+
+
+===============
+什么是IRQ?
+===============
+
+IRQ (Interrupt ReQuest) 指来自设备的中断请求。
+目前,它们可以通过一个引脚或通过一个数据包进入。
+多个设备可以连接到同一个引脚,从而共享一个IRQ。
+
+IRQ编号是用来描述硬件中断源的内核标识符。通常它是一个到全局irq_desc数组的索引,
+但是除了在linux/interrupt.h中实现的之外,其它细节是体系结构特征相关的。
+
+IRQ编号是对机器上可能的中断源的枚举。通常枚举的是系统中所有中断控制器的输入引脚
+编号。在ISA(工业标准体系结构)的情况下所枚举的是两个i8259中断控制器的16个输入引脚。
+
+体系结构可以给IRQ号赋予额外的含义,在涉及到硬件手动配置的情况下,我们鼓励这样做。
+ISA IRQ是赋予这种额外含义的一个典型例子。
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 02/11] docs/zh_CN: add core-api irq irq-affinity.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 01/11] docs/zh_CN: add core-api irq concepts.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09 10:51   ` Wu X.C.
  2021-04-09  9:10 ` [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation Yanteng Si
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/core-api/irq/irq-affinity.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../zh_CN/core-api/irq/irq-affinity.rst       | 74 +++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst

diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst b/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
new file mode 100644
index 000000000000..34aaf0d1ddc2
--- /dev/null
+++ b/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
@@ -0,0 +1,74 @@
+.. include:: ../../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../../core-api/irq/irq-affinity`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_irq-affinity.rst:
+
+
+================
+SMP IRQ 亲和性
+================
+
+变更记录:
+	- 作者:最初由Ingo Molnar <mingo@redhat.com>开始撰写
+	- 后期更新维护: Max Krasnyansky <maxk@qualcomm.com>
+
+
+/proc/irq/IRQ#/smp_affinity和/proc/irq/IRQ#/smp_affinity_list指定了哪些CPU能
+够关联到一个给定的IRQ源,这两个文件包含了这些指定cpu的cpu位掩码(smp_affinity)和cpu列
+表(smp_affinity_list)。它不允许关闭所有CPU, 同时如果IRQ控制器不支持中断请求亲和
+(IRQ affinity),那么所有cpu的默认值将保持不变(即关联到所有CPU).
+
+/proc/irq/default_smp_affinity指明了适用于所有非激活IRQ的默认亲和性掩码。一旦IRQ被
+分配/激活,它的亲和位掩码将被设置为默认掩码。然后可以如上所述改变它。默认掩码是0xffffffff。
+
+下面是一个先将IRQ44(eth1)限制在CPU0-3上,然后限制在CPU4-7上的例子(这是一个8CPU的SMP box)
+
+::
+
+	[root@moon 44]# cd /proc/irq/44
+	[root@moon 44]# cat smp_affinity
+	ffffffff
+
+	[root@moon 44]# echo 0f > smp_affinity
+	[root@moon 44]# cat smp_affinity
+	0000000f
+	[root@moon 44]# ping -f h
+	PING hell (195.4.7.3): 56 data bytes
+	...
+	--- hell ping statistics ---
+	6029 packets transmitted, 6027 packets received, 0% packet loss
+	round-trip min/avg/max = 0.1/0.1/0.4 ms
+	[root@moon 44]# cat /proc/interrupts | grep 'CPU\|44:'
+		CPU0       CPU1       CPU2       CPU3      CPU4       CPU5        CPU6       CPU7
+	44:       1068       1785       1785       1783         0          0           0         0    IO-APIC-level  eth1
+
+从上面一行可以看出,IRQ44只传递给前四个处理器(0-3)。
+现在让我们把这个IRQ限制在CPU(4-7)。
+
+::
+
+	[root@moon 44]# echo f0 > smp_affinity
+	[root@moon 44]# cat smp_affinity
+	000000f0
+	[root@moon 44]# ping -f h
+	PING hell (195.4.7.3): 56 data bytes
+	..
+	--- hell ping statistics ---
+	2779 packets transmitted, 2777 packets received, 0% packet loss
+	round-trip min/avg/max = 0.1/0.5/585.4 ms
+	[root@moon 44]# cat /proc/interrupts |  'CPU\|44:'
+		CPU0       CPU1       CPU2       CPU3      CPU4       CPU5        CPU6       CPU7
+	44:       1068       1785       1785       1783      1784       1069        1070       1069   IO-APIC-level  eth1
+
+这次IRQ44只传递给最后四个处理器。
+即CPU0-3的计数器没有变化。
+
+下面是一个将相同的irq(44)限制在cpus 1024到1031的例子:
+
+	[root@moon 44]# echo 1024-1031 > smp_affinity_list
+	[root@moon 44]# cat smp_affinity_list
+	1024-1031
+
+需要注意的是,如果要用位掩码来做这件事,就需要32个为0的位掩码来追踪其相关的一个。
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 01/11] docs/zh_CN: add core-api irq concepts.rst translation Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 02/11] docs/zh_CN: add core-api irq irq-affinity.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09 10:19   ` Wu X.C.
  2021-04-13  5:23   ` Alex Shi
  2021-04-09  9:10 ` [PATCH v2 04/11] docs/zh_CN: add core-api irq irqflags-tracing.rst translation Yanteng Si
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/core-api/irq/irq-domain.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../zh_CN/core-api/irq/irq-domain.rst         | 227 ++++++++++++++++++
 1 file changed, 227 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/core-api/irq/irq-domain.rst

diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
new file mode 100644
index 000000000000..03d3b7953e08
--- /dev/null
+++ b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
@@ -0,0 +1,227 @@
+.. include:: ../../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../../core-api/irq/irq-domain`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_irq-domain.rst:
+
+
+===============================================
+irq_domain 中断号映射库
+===============================================
+
+目前Linux内核的设计使用了一个巨大的数字空间,每个独立的IRQ源都被分配了一个不
+同的数字。
+当只有一个中断控制器时,这很简单,但在有多个中断控制器的系统中,内核必须确保每
+个中断控制器都能得到非重复的Linux IRQ号(数字)分配。
+
+注册为唯一的irqchips的中断控制器编号呈现出上升的趋势:例如GPIO控制器等不同
+种类的子驱动程序通过将其中断处理程序建模为irqchips,即实际上是级联中断控制器,
+避免了重新实现与IRQ核心系统相同的回调机制。
+
+在这里,中断号与硬件中断号离散了所有种类的对应关系:而在过去,IRQ号可以选择,
+使它们与硬件IRQ线进入根中断控制器(即实际向CPU发射中断线的组件)相匹配,现
+在这个编号仅仅是一个数字。
+
+出于这个原因,我们需要一种机制将控制器本地中断号(即硬件irq编号)与Linux IRQ
+号分开。
+
+irq_alloc_desc*() 和 irq_free_desc*() API 提供了对irq号的分配,但它们不
+提供任何对控制器本地IRQ(hwirq)号到Linux IRQ号空间的反向映射的支持。
+
+irq_domain 库在 irq_alloc_desc*() API 的基础上增加了 hwirq 和 IRQ 号码
+之间的映射。 相比于中断控制器驱动开放编码自己的反向映射方案,我们更喜欢用
+irq_domain来管理映射。
+
+irq_domain还实现了从抽象的irq_fwspec结构体到hwirq号的转换(到目前为止是
+Device Tree和ACPI GSI),并且可以很容易地扩展以支持其它IRQ拓扑数据源。
+
+irq_domain的用法
+================
+
+中断控制器驱动程序通过以下方式创建并注册一个irq_domain。调用
+irq_domain_add_*() 或 irq_domain_create_*()函数之一(每个映射方法都有不
+同的分配器函数,后面会详细介绍)。 函数成功后会返回一个指向irq_domain的指针。
+调用者必须向分配器函数提供一个irq_domain_ops结构体。
+
+在大多数情况下,irq_domain在开始时是空的,没有任何hwirq和IRQ号之间的映射。
+通过调用irq_create_mapping()将映射添加到irq_domain中,该函数接受
+irq_domain和一个hwirq号作为参数。 如果hwirq的映射还不存在,那么它将分配
+一个新的Linux irq_desc,将其与hwirq关联起来,并调用.map()回调,这样驱动
+程序就可以执行任何必要的硬件设置。
+
+当接收到一个中断时,应该使用irq_find_mapping()函数从hwirq号中找到
+Linux IRQ号。
+
+在调用irq_find_mapping()之前,至少要调用一次irq_create_mapping()函数,
+以免描述符不能被分配。
+
+如果驱动程序有Linux的IRQ号或irq_data指针,并且需要知道相关的hwirq号(比
+如在irq_chip回调中),那么可以直接从irq_data->hwirq中获得。
+
+irq_domain映射的类型
+============================
+
+从hwirq到Linux irq的反向映射有几种机制,每种机制使用不同的分配函数。应该
+使用哪种反向映射类型取决于用例。 下面介绍每一种反向映射类型:
+
+线性映射
+----------
+
+::
+
+	irq_domain_add_linear()
+	irq_domain_create_linear()
+
+线性反向映射维护了一个固定大小的表,该表以hwirq号为索引。 当一个hwirq被映射
+时,会给hwirq分配一个irq_desc,并将irq号存储在表中。
+
+当最大的hwirq号固定且数量相对较少时,线性图是一个很好的选择(~<256)。 这种
+映射的优点是固定时间查找IRQ号,而且irq_descs只分配给在用的IRQ。 缺点是该表
+必须尽可能大的hwirq号。
+
+irq_domain_add_linear()和irq_domain_create_linear()在功能上是等价的,
+除了第一个参数不同--前者接受一个Open Firmware特定的 'struct device_node' 而
+后者接受一个更通用的抽象 'struct fwnode_handle' 。
+
+大多数驱动应该使用线性映射
+
+树状映射
+----------
+
+::
+
+	irq_domain_add_tree()
+	irq_domain_create_tree()
+
+irq_domain维护着从hwirq号到Linux IRQ的radix的树状映射。 当一个hwirq被映射时,
+一个irq_desc被分配,hwirq被用作radix树的查找键。
+
+如果hwirq号可以非常大,树状映射是一个很好的选择,因为它不需要分配一个和最大hwirq
+号一样大的表。 缺点是,hwirq到IRQ号的查找取决于表中有多少条目。
+
+irq_domain_add_tree()和irq_domain_create_tree()在功能上是等价的,除了第一
+个参数不同——前者接受一个Open Firmware特定的 'struct device_node' ,而后者接受
+一个更通用的抽象 'struct fwnode_handle' 。
+
+很少有驱动应该需要这个映射。
+
+无映射
+--------
+
+::
+
+	irq_domain_add_nomap()
+
+当硬件中的hwirq号是可编程的时候,就可以采用无映射类型。 在这种情况下,最好将
+Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create_direct_mapping()
+会分配一个Linux IRQ号,并调用.map()回调,这样驱动就可以将Linux IRQ号编入硬件中。
+
+大多数驱动程序不能使用这个映射。
+
+传统映射类型
+--------------
+
+::
+
+	irq_domain_add_simple()
+	irq_domain_add_legacy()
+	irq_domain_add_legacy_isa()
+	irq_domain_create_simple()
+	irq_domain_create_legacy()
+
+传统映射是已经为 hwirqs 分配了一系列 irq_descs 的驱动程序的特殊情况。 当驱动程
+序不能立即转换为使用线性映射时,就会使用它。 例如,许多嵌入式系统板卡支持文件使用
+一组用于IRQ号的定义(#define),这些定义被传递给struct设备注册。 在这种情况下,
+不能动态分配Linux IRQ号,应该使用传统映射。
+
+传统映射假设已经为控制器分配了一个连续的IRQ号范围,并且可以通过向hwirq号添加一
+个固定的偏移来计算IRQ号,反之亦然。 缺点是需要中断控制器管理IRQ分配,并且需要为每
+个hwirq分配一个irq_desc,即使它没有被使用。
+
+只有在必须支持固定的IRQ映射时,才应使用传统映射。 例如,ISA控制器将使用传统映射来
+映射Linux IRQ 0-15,这样现有的ISA驱动程序就能得到正确的IRQ号。
+
+大多数使用传统映射的用户应该使用irq_domain_add_simple()或
+irq_domain_create_simple(),只有在系统提供IRQ范围时才会使用传统域,否则将使用
+线性域映射。这个调用的语义是这样的:如果指定了一个IRQ范围,那么 描述符将被即时分配
+给它,如果没有范围被分配,它将不会执行 irq_domain_add_linear() 或
+irq_domain_create_linear(),这意味着 *no* irq 描述符将被分配。
+
+一个简单域的典型用例是,irqchip供应商同时支持动态和静态IRQ分配。
+
+为了避免最终出现使用线性域而没有描述符被分配的情况,确保使用简单域的驱动程序在任何
+irq_find_mapping()之前调用irq_create_mapping()是非常重要的,因为后者实际上
+将用于静态IRQ分配情况。
+
+irq_domain_add_simple()和irq_domain_create_simple()以及
+irq_domain_add_legacy()和irq_domain_create_legacy()在功能上是等价的,只
+是第一个参数不同--前者接受Open Firmware特定的 'struct device_node' ,而后者
+接受一个更通用的抽象 'struct fwnode_handle' 。
+
+IRQ域层级结构
+--------------------
+
+在某些架构上,可能有多个中断控制器参与将一个中断从设备传送到目标CPU。
+让我们来看看x86平台上典型的中断传递路径吧
+::
+
+  Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU
+
+涉及到的中断控制器有三个:
+
+1) IOAPIC 控制器
+2) 中断重映射控制器
+3) Local APIC 控制器
+
+为了支持这样的硬件拓扑结构,使软件架构与硬件架构相匹配,为每个中断控制器建立一
+个irq_domain数据结构,并将这些irq_domain组织成层次结构。
+
+在建立irq_domain层次结构时,靠近设备的irq_domain为子域,靠近CPU的
+irq_domain为父域。所以在上面的例子中,将建立如下的层次结构。
+::
+
+	CPU Vector irq_domain (root irq_domain to manage CPU vectors)
+		^
+		|
+	Interrupt Remapping irq_domain (manage irq_remapping entries)
+		^
+		|
+	IOAPIC irq_domain (manage IOAPIC delivery entries/pins)
+
+使用irq_domain层次结构的主要接口有四个:
+
+1) irq_domain_alloc_irqs(): 分配IRQ描述符和与中断控制器相关的资源来传递这些中断。
+2) irq_domain_free_irqs(): 释放IRQ描述符和与这些中断相关的中断控制器资源。
+3) irq_domain_activate_irq(): 激活中断控制器硬件以传递中断。
+4) irq_domain_deactivate_irq(): 停用中断控制器硬件,停止传递中断。
+
+为了支持irq_domain层次结构,需要做如下修改:
+
+1) 一个新的字段 'parent' 被添加到irq_domain结构中;它用于维护irq_domain的层次信息。
+2) 一个新的字段 'parent_data' 被添加到irq_data结构中;它用于建立层次结构irq_data以
+   匹配irq_domain层次结构。irq_data用于存储irq_domain指针和硬件irq号。
+3) 新的回调被添加到irq_domain_ops结构中,以支持层次结构的irq_domain操作。
+
+在支持分层irq_domain和分层irq_data准备就绪后,为每个中断控制器建立一个irq_domain结
+构,并为每个与IRQ相关联的irq_domain分配一个irq_data结构。现在我们可以再进一步支持堆
+栈式(层次结构)的irq_chip。也就是说,一个irq_chip与层次结构中的每个irq_data相关联。
+一个子irq_chip可以自己或通过与它的父irq_chip合作来实现一个所需的操作。
+
+通过堆栈式的irq_chip,中断控制器驱动只需要处理自己管理的硬件,在需要的时候可以向其父
+irq_chip请求服务。所以我们可以实现更简洁的软件架构。
+
+为了让中断控制器驱动程序支持irq_domain层次结构,它需要做到以下几点:
+
+1) 实现 irq_domain_ops.alloc 和 irq_domain_ops.free
+2) 可选择地实现 irq_domain_ops.activate 和 irq_domain_ops.deactivate.
+3) 可选择地实现一个irq_chip来管理中断控制器硬件。
+4) 不需要实现irq_domain_ops.map和irq_domain_ops.unmap,它们在层次结构
+   irq_domain中是不用的。
+
+irq_domain层次结构绝不是x86特有的,大量用于支持其他架构,如ARM、ARM64等。
+
+调试功能
+=========
+
+打开CONFIG_GENERIC_IRQ_DEBUGFS on.ping,可让IRQ子系统的大部分内部结构都在debugfs中暴露出来。
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 04/11] docs/zh_CN: add core-api irq irqflags-tracing.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
                   ` (2 preceding siblings ...)
  2021-04-09  9:10 ` [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09 10:55   ` Wu X.C.
  2021-04-09  9:10 ` [PATCH v2 05/11] docs/zh_CN: add core-api irq index.rst translation Yanteng Si
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/core-api/irq/irqflags-tracing.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../zh_CN/core-api/irq/irqflags-tracing.rst   | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst

diff --git a/Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst b/Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst
new file mode 100644
index 000000000000..2a3f577ac6b5
--- /dev/null
+++ b/Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst
@@ -0,0 +1,45 @@
+.. include:: ../../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../../core-api/irq/irqflags-tracing`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_irqflags-tracing.rst:
+
+
+=======================
+IRQ-flags状态追踪
+=======================
+
+:Author: 最初由Ingo Molnar <mingo@redhat.com>开始撰写
+
+“irq-flags tracing”(中断标志追踪)功能可以 “追踪” hardirq和softirq的状态,它让
+感兴趣的子系统有机会了解到到内核中发生的每一个
+hardirqs-off/hardirqs-on、softirqs-off/softirqs-on事件。
+
+CONFIG_TRACE_IRQFLAGS_SUPPORT是通用锁调试代码提供的CONFIG_PROVE_SPIN_LOCKING
+和CONFIG_PROVE_RW_LOCKING所需要的。否则将只有CONFIG_PROVE_MUTEX_LOCKING和
+CONFIG_PROVE_RWSEM_LOCKING在一个架构上被提供--这些都是不在IRQ上下文中使用的
+锁API。(rwsems的一个异常是可以解决的)
+
+架构对这一点的支持当然不属于“微不足道”的范畴,因为很多低级的汇编代码都要处理irq-flags
+的状态变化。但是一个架构可以以一种相当直接且无风险的方式启用irq-flags-tracing。
+
+架构如果想支持这个,需要先做一些代码组织上的改变:
+
+- 在他们的arch级Kconfig文件中添加并启用TRACE_IRQFLAGS_SUPPORT。
+
+然后还需要做一些功能上的改变来实现对irq-flags-tracing的支持:
+
+- 在低级入口代码中增加(构建条件)对trace_hardirqs_off()/trace_hardirqs_on()
+  函数的调用。锁验证器会密切关注 “real”的irq-flags是否与 “virtual”的irq-flags
+  状态相匹配,如果两者不匹配,则会发出警告(并关闭自己)。通常维护arch中
+  irq-flags-track的大部分时间都是在这种状态下度过的:看看lockdep的警告,试着
+  找出我们还没有搞定的汇编代码。修复并重复。一旦系统启动,并且在irq-flags跟踪功
+  能中没有出现lockdep警告的情况下,arch支持就完成了。
+
+- 如果该架构有不可屏蔽的中断,那么需要通过lockdep_off()/lockdep_on()将这些中
+  断从irq跟踪[和锁验证]机制中排除。
+
+ 一般来说,在一个架构中,不完整的irq-flags-tracing实现是没有风险的:lockdep
+ 会检测到这一点,并将自己关闭。即锁验证器仍然可靠。应该不会因为irq-tracing的错
+ 误而崩溃。(除非通过修改不该修改的条件来更改汇编或寄存器而破坏其他代码)
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 05/11] docs/zh_CN: add core-api irq index.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
                   ` (3 preceding siblings ...)
  2021-04-09  9:10 ` [PATCH v2 04/11] docs/zh_CN: add core-api irq irqflags-tracing.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 06/11] docs/zh_CN: add core-api/index.rst translation Yanteng Si
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/core-api/irq/index.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Reviewed-by: Wu XiangCheng <bobwxc@email.cn>
---
 .../translations/zh_CN/core-api/irq/index.rst | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/core-api/irq/index.rst

diff --git a/Documentation/translations/zh_CN/core-api/irq/index.rst b/Documentation/translations/zh_CN/core-api/irq/index.rst
new file mode 100644
index 000000000000..910ccabf041f
--- /dev/null
+++ b/Documentation/translations/zh_CN/core-api/irq/index.rst
@@ -0,0 +1,19 @@
+.. include:: ../../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../../core-api/irq/index`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_irq_index.rst:
+
+
+====
+IRQs
+====
+
+.. toctree::
+   :maxdepth: 1
+
+   concepts
+   irq-affinity
+   irq-domain
+   irqflags-tracing
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 06/11] docs/zh_CN: add core-api/index.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
                   ` (4 preceding siblings ...)
  2021-04-09  9:10 ` [PATCH v2 05/11] docs/zh_CN: add core-api irq index.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09 10:25   ` Wu X.C.
  2021-04-09  9:10 ` [PATCH v2 07/11] docs/zh_CN: add translation to zh_CN index Yanteng Si
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/core-api/index.rst into Chinese.
add Documentation/translations/zh_CN/core-api/irq/* to zh_CN/core-api/index.rst.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../translations/zh_CN/core-api/index.rst     | 126 ++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/core-api/index.rst

diff --git a/Documentation/translations/zh_CN/core-api/index.rst b/Documentation/translations/zh_CN/core-api/index.rst
new file mode 100644
index 000000000000..1d0e73b03858
--- /dev/null
+++ b/Documentation/translations/zh_CN/core-api/index.rst
@@ -0,0 +1,126 @@
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../core-api/irq/index`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_core-api_index.rst:
+
+
+======================
+核心API文档
+======================
+
+这是核心内核API手册的首页。 非常感谢为本手册转换(和编写!)的文档!
+
+核心实用程序
+==============
+
+本节包含通用的和“核心中的核心”文档。 第一部分是 docbook 时期遗留下
+来的大量 kerneldoc 信息;有朝一日,若有人有动力的话,应当把它们拆分
+出来。
+
+Todolist:
+
+   kernel-api
+   workqueue
+   printk-basics
+   printk-formats
+   symbol-namespaces
+
+数据结构和低级实用程序
+=======================================
+
+在整个内核中使用的函数库。
+
+Todolist:
+
+   kobject
+   kref
+   assoc_array
+   xarray
+   idr
+   circular-buffers
+   rbtree
+   generic-radix-tree
+   packing
+   bus-virt-phys-mapping
+   this_cpu_ops
+   timekeeping
+   errseq
+
+并发原语
+======================
+
+Linux如何让一切同时发生。 详情请参阅
+:doc:`/locking/index`
+
+.. toctree::
+   :maxdepth: 1
+
+   irq/index
+
+Todolist:
+
+   refcount-vs-atomic
+   local_ops
+   padata
+   ../RCU/index
+
+低级硬件管理
+=============================
+
+缓存管理,CPU热插拔管理等。
+
+Todolist:
+
+   cachetlb
+   cpu_hotplug
+   memory-hotplug
+   genericirq
+   protection-keys
+
+
+内存管理
+=================
+
+如何在内核中分配和使用内存。请注意,在
+:doc:`/vm/index` 中有更多的内存管理文档。
+
+Todolist:
+
+   memory-allocation
+   unaligned-memory-access
+   dma-api
+   dma-api-howto
+   dma-attributes
+   dma-isa-lpc
+   mm-api
+   genalloc
+   pin_user_pages
+   boot-time-mm
+   gfp_mask-from-fs-io
+
+内核调试的接口
+===============================
+
+Todolist:
+
+   debug-objects
+   tracepoint
+   debugging-via-ohci1394
+
+其它文档
+===============
+
+不适合放在其它地方或尚未归类的文件;
+
+Todolist:
+
+   librs
+
+.. only:: subproject and html
+
+   Indices
+   =======
+
+   * :ref:`genindex`
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 07/11] docs/zh_CN: add translation to zh_CN index
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
                   ` (5 preceding siblings ...)
  2021-04-09  9:10 ` [PATCH v2 06/11] docs/zh_CN: add core-api/index.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 08/11] docs/zh_CN: add openrisc openrisc_port.rst translation Yanteng Si
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch add zh_CN/core-api to zh_CN/index.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Reviewed-by: Wu XiangCheng <bobwxc@email.cn>
---
 Documentation/translations/zh_CN/index.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index 4fdd57417ffb..041a04c8e775 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -22,6 +22,7 @@
    filesystems/index
    arm64/index
    sound/index
+   core-api/index
 
 目录和表格
 ----------
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 08/11] docs/zh_CN: add openrisc openrisc_port.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
                   ` (6 preceding siblings ...)
  2021-04-09  9:10 ` [PATCH v2 07/11] docs/zh_CN: add translation to zh_CN index Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 09/11] docs/zh_CN: add openrisc/todo.rst translation Yanteng Si
  2021-04-09  9:10 ` [PATCH v2 10/11] docs/zh_CN: add openrisc/index.rst translation Yanteng Si
  9 siblings, 0 replies; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch tranlates Documentation/openrisc/openrisc_port.rst into Chinese

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../zh_CN/openrisc/openrisc_port.rst          | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/openrisc/openrisc_port.rst

diff --git a/Documentation/translations/zh_CN/openrisc/openrisc_port.rst b/Documentation/translations/zh_CN/openrisc/openrisc_port.rst
new file mode 100644
index 000000000000..77754f2639cf
--- /dev/null
+++ b/Documentation/translations/zh_CN/openrisc/openrisc_port.rst
@@ -0,0 +1,124 @@
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../openrisc/openrisc_port`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_openrisc_port:
+
+==============
+OpenRISC Linux
+==============
+
+这是Linux对OpenRISC类微处理器的移植;具体来说,最早移植目标是32位
+OpenRISC 1000系列(或1k)。
+
+关于OpenRISC处理器和正在进行中的开发的信息:
+
+	=======		=============================
+	网站		https://openrisc.io
+	邮箱		openrisc@lists.librecores.org
+	=======		=============================
+
+---------------------------------------------------------------------
+
+OpenRISC工具链和Linux的构建指南
+===================================================
+
+为了构建和运行Linux for OpenRISC,你至少需要一个基本的工具链,或许
+还需要架构模拟器。 这里概述了准备就位这些部分的步骤。
+
+1) 工具链
+
+工具链二进制文件可以从openrisc.io或我们的github发布页面获得。不同
+工具链的构建指南可以在openrisc.io或Stafford的工具链构建和发布脚本
+中找到。
+
+	==========	=================================================
+	二进制          https://github.com/openrisc/or1k-gcc/releases
+	工具链          https://openrisc.io/software
+	构建            https://github.com/stffrdhrn/or1k-toolchain-build
+	==========	=================================================
+
+2) 构建
+
+像往常一样构建Linux内核::
+
+	make ARCH=openrisc CROSS_COMPILE="or1k-linux-" defconfig
+	make ARCH=openrisc CROSS_COMPILE="or1k-linux-"
+
+3) 在FPGA上运行(可选)
+
+OpenRISC社区通常使用FuseSoC来管理构建和编程SoC到FPGA中。 下面是用
+OpenRISC SoC对De0 Nano开发板进行编程的一个例子。 在构建过程中,
+FPGA RTL是从FuseSoC IP核库中下载的代码,并使用FPGA供应商工具构建。
+二进制文件用openocd加载到电路板上。
+
+::
+
+	git clone https://github.com/olofk/fusesoc
+	cd fusesoc
+	sudo pip install -e .
+
+	fusesoc init
+	fusesoc build de0_nano
+	fusesoc pgm de0_nano
+
+	openocd -f interface/altera-usb-blaster.cfg \
+		-f board/or1k_generic.cfg
+
+	telnet localhost 4444
+	> init
+	> halt; load_image vmlinux ; reset
+
+4) 在模拟器上运行(可选)
+
+QEMU是一个处理器仿真器,我们推荐它来模拟OpenRISC平台。 请按照QEMU网
+站上的OpenRISC说明,让Linux在QEMU上运行。 你可以自己构建QEMU,但你的
+Linux发行版可能提供了支持OpenRISC的二进制包。
+
+	=============	======================================================
+	qemu openrisc	https://wiki.qemu.org/Documentation/Platforms/OpenRISC
+	=============	======================================================
+
+---------------------------------------------------------------------
+
+术语表
+===========
+
+代码中使用了以下符号约定以将范围限制在几个特定处理器实现上:
+
+========= =======================================
+openrisc: OpenRISC类型处理器
+or1k:     OpenRISC 1000系列处理器
+or1200:   OpenRISC 1200处理器
+========= =======================================
+
+---------------------------------------------------------------------
+
+历史
+========
+
+2003-11-18	Matjaz Breskvar (phoenix@bsemi.com)
+   将linux初步移植到OpenRISC或32架构。
+       所有的核心功能都实现了,并且可以使用。
+
+2003-12-08	Matjaz Breskvar (phoenix@bsemi.com)
+   彻底改变TLB失误处理。
+   重写异常处理。
+   在默认的initrd中实现了sash-3.6的所有功能。
+   大幅改进的版本。
+
+2004-04-10	Matjaz Breskvar (phoenix@bsemi.com)
+   大量的bug修复。
+   支持以太网,http和telnet服务器功能。
+   可以运行许多标准的linux应用程序。
+
+2004-06-26	Matjaz Breskvar (phoenix@bsemi.com)
+   移植到2.6.x。
+
+2004-11-30	Matjaz Breskvar (phoenix@bsemi.com)
+   大量的bug修复和增强功能。
+   增加了opencores framebuffer驱动。
+
+2010-10-09    Jonas Bonn (jonas@southpole.se)
+   重大重写,使其与上游的Linux 2.6.36看齐。
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 09/11] docs/zh_CN: add openrisc/todo.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
                   ` (7 preceding siblings ...)
  2021-04-09  9:10 ` [PATCH v2 08/11] docs/zh_CN: add openrisc openrisc_port.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  2021-04-09 10:30   ` Wu X.C.
  2021-04-09  9:10 ` [PATCH v2 10/11] docs/zh_CN: add openrisc/index.rst translation Yanteng Si
  9 siblings, 1 reply; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/openrisc/todo.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../translations/zh_CN/openrisc/todo.rst      | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/openrisc/todo.rst

diff --git a/Documentation/translations/zh_CN/openrisc/todo.rst b/Documentation/translations/zh_CN/openrisc/todo.rst
new file mode 100644
index 000000000000..0e5d1c9122f8
--- /dev/null
+++ b/Documentation/translations/zh_CN/openrisc/todo.rst
@@ -0,0 +1,20 @@
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../openrisc/todo`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_openrisc_todo.rst:
+
+===========
+待办事项
+===========
+
+OpenRISC Linux的移植已经完全投入使用,并且从 2.6.35 开始就一直在上游同步。
+然而,还有一些剩余的项目需要在未来几个月内完成。 下面是一个即将进行调查的已知
+不尽完美的项目列表,即我们的待办事项列表。
+
+-   实现其余的DMA API……dma_map_sg等。
+
+-   完成重命名清理工作……代码中提到了or32,这是架构的一个老名字。 我们
+    已经确定的名字是or1k,这个改变正在以缓慢积累的方式进行。 目前,or32相当
+    于or1k。
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 10/11] docs/zh_CN: add openrisc/index.rst translation
  2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
                   ` (8 preceding siblings ...)
  2021-04-09  9:10 ` [PATCH v2 09/11] docs/zh_CN: add openrisc/todo.rst translation Yanteng Si
@ 2021-04-09  9:10 ` Yanteng Si
  9 siblings, 0 replies; 21+ messages in thread
From: Yanteng Si @ 2021-04-09  9:10 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng, Yanteng Si

This patch translates Documentation/openrisc/index.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Reviewed-by: Wu XiangCheng <bobwxc@email.cn>
---
 .../translations/zh_CN/openrisc/index.rst     | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/openrisc/index.rst

diff --git a/Documentation/translations/zh_CN/openrisc/index.rst b/Documentation/translations/zh_CN/openrisc/index.rst
new file mode 100644
index 000000000000..89432b9cf8e1
--- /dev/null
+++ b/Documentation/translations/zh_CN/openrisc/index.rst
@@ -0,0 +1,27 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../openrisc/index`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_openrisc_index:
+
+
+=====================
+OpenRISC 体系架构
+=====================
+
+.. toctree::
+   :maxdepth: 2
+
+   openrisc_port
+   todo
+
+
+.. only::  subproject and html
+
+   Indices
+   =======
+
+   * :ref:`genindex`
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 01/11] docs/zh_CN: add core-api irq concepts.rst translation
  2021-04-09  9:10 ` [PATCH v2 01/11] docs/zh_CN: add core-api irq concepts.rst translation Yanteng Si
@ 2021-04-09 10:09   ` Wu X.C.
  0 siblings, 0 replies; 21+ messages in thread
From: Wu X.C. @ 2021-04-09 10:09 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang,
	Harry Wei, linux-doc, realpuyuwang, siyanteng01

On Fri, Apr 09, 2021 at 05:10:03PM +0800, Yanteng Si wrote:
> This patch translates Documentation/core-api/irq/concepts.rst into Chinese.
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>

Reviewed-by: Wu XiangCheng <bobwxc@email.cn>

> ---
>  .../zh_CN/core-api/irq/concepts.rst           | 24 +++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/core-api/irq/concepts.rst
> 
> diff --git a/Documentation/translations/zh_CN/core-api/irq/concepts.rst b/Documentation/translations/zh_CN/core-api/irq/concepts.rst
> new file mode 100644
> index 000000000000..b8b98a196a5d
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/core-api/irq/concepts.rst
> @@ -0,0 +1,24 @@
> +.. include:: ../../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../../core-api/irq/concepts`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_concepts.rst:
> +
> +
> +===============
> +什么是IRQ?
> +===============
> +
> +IRQ (Interrupt ReQuest) 指来自设备的中断请求。
> +目前,它们可以通过一个引脚或通过一个数据包进入。
> +多个设备可以连接到同一个引脚,从而共享一个IRQ。
> +
> +IRQ编号是用来描述硬件中断源的内核标识符。通常它是一个到全局irq_desc数组的索引,
> +但是除了在linux/interrupt.h中实现的之外,其它细节是体系结构特征相关的。
> +
> +IRQ编号是对机器上可能的中断源的枚举。通常枚举的是系统中所有中断控制器的输入引脚
> +编号。在ISA(工业标准体系结构)的情况下所枚举的是两个i8259中断控制器的16个输入引脚。
> +
> +体系结构可以给IRQ号赋予额外的含义,在涉及到硬件手动配置的情况下,我们鼓励这样做。
> +ISA IRQ是赋予这种额外含义的一个典型例子。
> -- 
> 2.27.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation
  2021-04-09  9:10 ` [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation Yanteng Si
@ 2021-04-09 10:19   ` Wu X.C.
  2021-04-13 11:59     ` yanteng si
  2021-04-13  5:23   ` Alex Shi
  1 sibling, 1 reply; 21+ messages in thread
From: Wu X.C. @ 2021-04-09 10:19 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang,
	Harry Wei, linux-doc, realpuyuwang, siyanteng01

On Fri, Apr 09, 2021 at 05:10:05PM +0800, Yanteng Si wrote:
> This patch translates Documentation/core-api/irq/irq-domain.rst into Chinese.
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  .../zh_CN/core-api/irq/irq-domain.rst         | 227 ++++++++++++++++++
>  1 file changed, 227 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> 
> diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> new file mode 100644
> index 000000000000..03d3b7953e08
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> @@ -0,0 +1,227 @@
> +.. include:: ../../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../../core-api/irq/irq-domain`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_irq-domain.rst:
> +
> +
> +===============================================
> +irq_domain 中断号映射库
> +===============================================
> +
> +目前Linux内核的设计使用了一个巨大的数字空间,每个独立的IRQ源都被分配了一个不
> +同的数字。
> +当只有一个中断控制器时,这很简单,但在有多个中断控制器的系统中,内核必须确保每
> +个中断控制器都能得到非重复的Linux IRQ号(数字)分配。
> +
> +注册为唯一的irqchips的中断控制器编号呈现出上升的趋势:例如GPIO控制器等不同
> +种类的子驱动程序通过将其中断处理程序建模为irqchips,即实际上是级联中断控制器,
> +避免了重新实现与IRQ核心系统相同的回调机制。
> +
> +在这里,中断号与硬件中断号离散了所有种类的对应关系:而在过去,IRQ号可以选择,
> +使它们与硬件IRQ线进入根中断控制器(即实际向CPU发射中断线的组件)相匹配,现
> +在这个编号仅仅是一个数字。
> +
> +出于这个原因,我们需要一种机制将控制器本地中断号(即硬件irq编号)与Linux IRQ
> +号分开。
> +
> +irq_alloc_desc*() 和 irq_free_desc*() API 提供了对irq号的分配,但它们不
> +提供任何对控制器本地IRQ(hwirq)号到Linux IRQ号空间的反向映射的支持。
> +
> +irq_domain 库在 irq_alloc_desc*() API 的基础上增加了 hwirq 和 IRQ 号码
> +之间的映射。 相比于中断控制器驱动开放编码自己的反向映射方案,我们更喜欢用
> +irq_domain来管理映射。
> +
> +irq_domain还实现了从抽象的irq_fwspec结构体到hwirq号的转换(到目前为止是
> +Device Tree和ACPI GSI),并且可以很容易地扩展以支持其它IRQ拓扑数据源。
> +
> +irq_domain的用法
> +================
> +
> +中断控制器驱动程序通过以下方式创建并注册一个irq_domain。调用
> +irq_domain_add_*() 或 irq_domain_create_*()函数之一(每个映射方法都有不
> +同的分配器函数,后面会详细介绍)。 函数成功后会返回一个指向irq_domain的指针。
> +调用者必须向分配器函数提供一个irq_domain_ops结构体。
> +
> +在大多数情况下,irq_domain在开始时是空的,没有任何hwirq和IRQ号之间的映射。
> +通过调用irq_create_mapping()将映射添加到irq_domain中,该函数接受
> +irq_domain和一个hwirq号作为参数。 如果hwirq的映射还不存在,那么它将分配
> +一个新的Linux irq_desc,将其与hwirq关联起来,并调用.map()回调,这样驱动
> +程序就可以执行任何必要的硬件设置。
> +
> +当接收到一个中断时,应该使用irq_find_mapping()函数从hwirq号中找到
> +Linux IRQ号。
> +
> +在调用irq_find_mapping()之前,至少要调用一次irq_create_mapping()函数,
> +以免描述符不能被分配。
> +
> +如果驱动程序有Linux的IRQ号或irq_data指针,并且需要知道相关的hwirq号(比
> +如在irq_chip回调中),那么可以直接从irq_data->hwirq中获得。
> +
> +irq_domain映射的类型
> +============================
> +
> +从hwirq到Linux irq的反向映射有几种机制,每种机制使用不同的分配函数。应该
> +使用哪种反向映射类型取决于用例。 下面介绍每一种反向映射类型:
> +
> +线性映射
> +----------
> +
> +::
> +
> +	irq_domain_add_linear()
> +	irq_domain_create_linear()
> +
> +线性反向映射维护了一个固定大小的表,该表以hwirq号为索引。 当一个hwirq被映射
> +时,会给hwirq分配一个irq_desc,并将irq号存储在表中。
> +
> +当最大的hwirq号固定且数量相对较少时,线性图是一个很好的选择(~<256)。 这种
> +映射的优点是固定时间查找IRQ号,而且irq_descs只分配给在用的IRQ。 缺点是该表
> +必须尽可能大的hwirq号。
> +
> +irq_domain_add_linear()和irq_domain_create_linear()在功能上是等价的,
> +除了第一个参数不同--前者接受一个Open Firmware特定的 'struct device_node' 而
> +后者接受一个更通用的抽象 'struct fwnode_handle' 。
> +
> +大多数驱动应该使用线性映射
> +
> +树状映射
> +----------
> +
> +::
> +
> +	irq_domain_add_tree()
> +	irq_domain_create_tree()
> +
> +irq_domain维护着从hwirq号到Linux IRQ的radix的树状映射。 当一个hwirq被映射时,
> +一个irq_desc被分配,hwirq被用作radix树的查找键。
> +
> +如果hwirq号可以非常大,树状映射是一个很好的选择,因为它不需要分配一个和最大hwirq
> +号一样大的表。 缺点是,hwirq到IRQ号的查找取决于表中有多少条目。
> +
> +irq_domain_add_tree()和irq_domain_create_tree()在功能上是等价的,除了第一
> +个参数不同——前者接受一个Open Firmware特定的 'struct device_node' ,而后者接受
> +一个更通用的抽象 'struct fwnode_handle' 。
> +
> +很少有驱动应该需要这个映射。
> +
> +无映射
> +--------
> +
> +::
> +
> +	irq_domain_add_nomap()
> +
> +当硬件中的hwirq号是可编程的时候,就可以采用无映射类型。 在这种情况下,最好将
> +Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create_direct_mapping()
> +会分配一个Linux IRQ号,并调用.map()回调,这样驱动就可以将Linux IRQ号编入硬件中。
> +
> +大多数驱动程序不能使用这个映射。
> +
> +传统映射类型
> +--------------
> +
> +::
> +
> +	irq_domain_add_simple()
> +	irq_domain_add_legacy()
> +	irq_domain_add_legacy_isa()
> +	irq_domain_create_simple()
> +	irq_domain_create_legacy()
> +
> +传统映射是已经为 hwirqs 分配了一系列 irq_descs 的驱动程序的特殊情况。 当驱动程
> +序不能立即转换为使用线性映射时,就会使用它。 例如,许多嵌入式系统板卡支持文件使用
> +一组用于IRQ号的定义(#define),这些定义被传递给struct设备注册。 在这种情况下,
> +不能动态分配Linux IRQ号,应该使用传统映射。
> +
> +传统映射假设已经为控制器分配了一个连续的IRQ号范围,并且可以通过向hwirq号添加一
> +个固定的偏移来计算IRQ号,反之亦然。 缺点是需要中断控制器管理IRQ分配,并且需要为每
> +个hwirq分配一个irq_desc,即使它没有被使用。
> +
> +只有在必须支持固定的IRQ映射时,才应使用传统映射。 例如,ISA控制器将使用传统映射来
> +映射Linux IRQ 0-15,这样现有的ISA驱动程序就能得到正确的IRQ号。
> +
> +大多数使用传统映射的用户应该使用irq_domain_add_simple()或
> +irq_domain_create_simple(),只有在系统提供IRQ范围时才会使用传统域,否则将使用
> +线性域映射。这个调用的语义是这样的:如果指定了一个IRQ范围,那么 描述符将被即时分配
> +给它,如果没有范围被分配,它将不会执行 irq_domain_add_linear() 或
> +irq_domain_create_linear(),这意味着 *no* irq 描述符将被分配。
> +
> +一个简单域的典型用例是,irqchip供应商同时支持动态和静态IRQ分配。
> +
> +为了避免最终出现使用线性域而没有描述符被分配的情况,确保使用简单域的驱动程序在任何
> +irq_find_mapping()之前调用irq_create_mapping()是非常重要的,因为后者实际上
> +将用于静态IRQ分配情况。
> +
> +irq_domain_add_simple()和irq_domain_create_simple()以及
> +irq_domain_add_legacy()和irq_domain_create_legacy()在功能上是等价的,只
> +是第一个参数不同--前者接受Open Firmware特定的 'struct device_node' ,而后者
> +接受一个更通用的抽象 'struct fwnode_handle' 。
> +
> +IRQ域层级结构
> +--------------------
> +
> +在某些架构上,可能有多个中断控制器参与将一个中断从设备传送到目标CPU。
> +让我们来看看x86平台上典型的中断传递路径吧
> +::
> +
> +  Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU
> +
> +涉及到的中断控制器有三个:
> +
> +1) IOAPIC 控制器
> +2) 中断重映射控制器
> +3) Local APIC 控制器
> +
> +为了支持这样的硬件拓扑结构,使软件架构与硬件架构相匹配,为每个中断控制器建立一
> +个irq_domain数据结构,并将这些irq_domain组织成层次结构。
> +
> +在建立irq_domain层次结构时,靠近设备的irq_domain为子域,靠近CPU的
> +irq_domain为父域。所以在上面的例子中,将建立如下的层次结构。
> +::
> +
> +	CPU Vector irq_domain (root irq_domain to manage CPU vectors)
> +		^
> +		|
> +	Interrupt Remapping irq_domain (manage irq_remapping entries)
> +		^
> +		|
> +	IOAPIC irq_domain (manage IOAPIC delivery entries/pins)
> +
> +使用irq_domain层次结构的主要接口有四个:
> +
> +1) irq_domain_alloc_irqs(): 分配IRQ描述符和与中断控制器相关的资源来传递这些中断。
> +2) irq_domain_free_irqs(): 释放IRQ描述符和与这些中断相关的中断控制器资源。
> +3) irq_domain_activate_irq(): 激活中断控制器硬件以传递中断。
> +4) irq_domain_deactivate_irq(): 停用中断控制器硬件,停止传递中断。
> +
> +为了支持irq_domain层次结构,需要做如下修改:
> +
> +1) 一个新的字段 'parent' 被添加到irq_domain结构中;它用于维护irq_domain的层次信息。
> +2) 一个新的字段 'parent_data' 被添加到irq_data结构中;它用于建立层次结构irq_data以
> +   匹配irq_domain层次结构。irq_data用于存储irq_domain指针和硬件irq号。
> +3) 新的回调被添加到irq_domain_ops结构中,以支持层次结构的irq_domain操作。
> +
> +在支持分层irq_domain和分层irq_data准备就绪后,为每个中断控制器建立一个irq_domain结
> +构,并为每个与IRQ相关联的irq_domain分配一个irq_data结构。现在我们可以再进一步支持堆
> +栈式(层次结构)的irq_chip。也就是说,一个irq_chip与层次结构中的每个irq_data相关联。
> +一个子irq_chip可以自己或通过与它的父irq_chip合作来实现一个所需的操作。
> +
> +通过堆栈式的irq_chip,中断控制器驱动只需要处理自己管理的硬件,在需要的时候可以向其父
> +irq_chip请求服务。所以我们可以实现更简洁的软件架构。
> +
> +为了让中断控制器驱动程序支持irq_domain层次结构,它需要做到以下几点:
> +
> +1) 实现 irq_domain_ops.alloc 和 irq_domain_ops.free
> +2) 可选择地实现 irq_domain_ops.activate 和 irq_domain_ops.deactivate.
> +3) 可选择地实现一个irq_chip来管理中断控制器硬件。
> +4) 不需要实现irq_domain_ops.map和irq_domain_ops.unmap,它们在层次结构
> +   irq_domain中是不用的。
> +
> +irq_domain层次结构绝不是x86特有的,大量用于支持其他架构,如ARM、ARM64等。
> +
> +调试功能
> +=========
> +
> +打开CONFIG_GENERIC_IRQ_DEBUGFS on.ping,可让IRQ子系统的大部分内部结构都在debugfs中暴露出来。

Please fix "on.ping".

> -- 
> 2.27.0

Thanks!

Wu X.C.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 06/11] docs/zh_CN: add core-api/index.rst translation
  2021-04-09  9:10 ` [PATCH v2 06/11] docs/zh_CN: add core-api/index.rst translation Yanteng Si
@ 2021-04-09 10:25   ` Wu X.C.
  0 siblings, 0 replies; 21+ messages in thread
From: Wu X.C. @ 2021-04-09 10:25 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang,
	Harry Wei, linux-doc, realpuyuwang, siyanteng01

On Fri, Apr 09, 2021 at 05:10:08PM +0800, Yanteng Si wrote:
> This patch translates Documentation/core-api/index.rst into Chinese.
> add Documentation/translations/zh_CN/core-api/irq/* to zh_CN/core-api/index.rst.
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>

Reviewed-by: Wu XiangCheng <bobwxc@email.cn>

> ---
>  .../translations/zh_CN/core-api/index.rst     | 126 ++++++++++++++++++
>  1 file changed, 126 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/core-api/index.rst
> 
> diff --git a/Documentation/translations/zh_CN/core-api/index.rst b/Documentation/translations/zh_CN/core-api/index.rst
> new file mode 100644
> index 000000000000..1d0e73b03858
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/core-api/index.rst
> @@ -0,0 +1,126 @@
> +.. include:: ../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../core-api/irq/index`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_core-api_index.rst:
> +
> +
> +======================
> +核心API文档
> +======================
> +
> +这是核心内核API手册的首页。 非常感谢为本手册转换(和编写!)的文档!
> +
> +核心实用程序
> +==============
> +
> +本节包含通用的和“核心中的核心”文档。 第一部分是 docbook 时期遗留下
> +来的大量 kerneldoc 信息;有朝一日,若有人有动力的话,应当把它们拆分
> +出来。
> +
> +Todolist:
> +
> +   kernel-api
> +   workqueue
> +   printk-basics
> +   printk-formats
> +   symbol-namespaces
> +
> +数据结构和低级实用程序
> +=======================================
> +
> +在整个内核中使用的函数库。
> +
> +Todolist:
> +
> +   kobject
> +   kref
> +   assoc_array
> +   xarray
> +   idr
> +   circular-buffers
> +   rbtree
> +   generic-radix-tree
> +   packing
> +   bus-virt-phys-mapping
> +   this_cpu_ops
> +   timekeeping
> +   errseq
> +
> +并发原语
> +======================
> +
> +Linux如何让一切同时发生。 详情请参阅
> +:doc:`/locking/index`
> +
> +.. toctree::
> +   :maxdepth: 1
> +
> +   irq/index
> +
> +Todolist:
> +
> +   refcount-vs-atomic
> +   local_ops
> +   padata
> +   ../RCU/index
> +
> +低级硬件管理
> +=============================
> +
> +缓存管理,CPU热插拔管理等。
> +
> +Todolist:
> +
> +   cachetlb
> +   cpu_hotplug
> +   memory-hotplug
> +   genericirq
> +   protection-keys
> +
> +
> +内存管理
> +=================
> +
> +如何在内核中分配和使用内存。请注意,在
> +:doc:`/vm/index` 中有更多的内存管理文档。
> +
> +Todolist:
> +
> +   memory-allocation
> +   unaligned-memory-access
> +   dma-api
> +   dma-api-howto
> +   dma-attributes
> +   dma-isa-lpc
> +   mm-api
> +   genalloc
> +   pin_user_pages
> +   boot-time-mm
> +   gfp_mask-from-fs-io
> +
> +内核调试的接口
> +===============================
> +
> +Todolist:
> +
> +   debug-objects
> +   tracepoint
> +   debugging-via-ohci1394
> +
> +其它文档
> +===============
> +
> +不适合放在其它地方或尚未归类的文件;
> +
> +Todolist:
> +
> +   librs
> +
> +.. only:: subproject and html
> +
> +   Indices
> +   =======
> +
> +   * :ref:`genindex`
> -- 
> 2.27.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 09/11] docs/zh_CN: add openrisc/todo.rst translation
  2021-04-09  9:10 ` [PATCH v2 09/11] docs/zh_CN: add openrisc/todo.rst translation Yanteng Si
@ 2021-04-09 10:30   ` Wu X.C.
  0 siblings, 0 replies; 21+ messages in thread
From: Wu X.C. @ 2021-04-09 10:30 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang,
	Harry Wei, linux-doc, realpuyuwang, siyanteng01

On Fri, Apr 09, 2021 at 05:10:11PM +0800, Yanteng Si wrote:
> This patch translates Documentation/openrisc/todo.rst into Chinese.
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>

Reviewed-by: Wu XiangCheng <bobwxc@email.cn>

> ---
>  .../translations/zh_CN/openrisc/todo.rst      | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/openrisc/todo.rst
> 
> diff --git a/Documentation/translations/zh_CN/openrisc/todo.rst b/Documentation/translations/zh_CN/openrisc/todo.rst
> new file mode 100644
> index 000000000000..0e5d1c9122f8
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/openrisc/todo.rst
> @@ -0,0 +1,20 @@
> +.. include:: ../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../openrisc/todo`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_openrisc_todo.rst:
> +
> +===========
> +待办事项
> +===========
> +
> +OpenRISC Linux的移植已经完全投入使用,并且从 2.6.35 开始就一直在上游同步。
> +然而,还有一些剩余的项目需要在未来几个月内完成。 下面是一个即将进行调查的已知
> +不尽完美的项目列表,即我们的待办事项列表。
> +
> +-   实现其余的DMA API……dma_map_sg等。
> +
> +-   完成重命名清理工作……代码中提到了or32,这是架构的一个老名字。 我们
> +    已经确定的名字是or1k,这个改变正在以缓慢积累的方式进行。 目前,or32相当
> +    于or1k。
> -- 
> 2.27.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 02/11] docs/zh_CN: add core-api irq irq-affinity.rst translation
  2021-04-09  9:10 ` [PATCH v2 02/11] docs/zh_CN: add core-api irq irq-affinity.rst translation Yanteng Si
@ 2021-04-09 10:51   ` Wu X.C.
  2021-04-13 11:27     ` yanteng si
  0 siblings, 1 reply; 21+ messages in thread
From: Wu X.C. @ 2021-04-09 10:51 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang,
	Harry Wei, linux-doc, realpuyuwang, siyanteng01

On Fri, Apr 09, 2021 at 05:10:04PM +0800, Yanteng Si wrote:
> This patch translates Documentation/core-api/irq/irq-affinity.rst into Chinese.
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  .../zh_CN/core-api/irq/irq-affinity.rst       | 74 +++++++++++++++++++
>  1 file changed, 74 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
> 
> diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst b/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
> new file mode 100644
> index 000000000000..34aaf0d1ddc2
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
> @@ -0,0 +1,74 @@
> +.. include:: ../../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../../core-api/irq/irq-affinity`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_irq-affinity.rst:
> +
> +
> +================
> +SMP IRQ 亲和性
> +================
> +
> +变更记录:
> +	- 作者:最初由Ingo Molnar <mingo@redhat.com>开始撰写
> +	- 后期更新维护: Max Krasnyansky <maxk@qualcomm.com>
> +
> +
> +/proc/irq/IRQ#/smp_affinity和/proc/irq/IRQ#/smp_affinity_list指定了哪些CPU能
> +够关联到一个给定的IRQ源,这两个文件包含了这些指定cpu的cpu位掩码(smp_affinity)和cpu列
> +表(smp_affinity_list)。它不允许关闭所有CPU, 同时如果IRQ控制器不支持中断请求亲和
> +(IRQ affinity),那么所有cpu的默认值将保持不变(即关联到所有CPU).
> +
> +/proc/irq/default_smp_affinity指明了适用于所有非激活IRQ的默认亲和性掩码。一旦IRQ被
> +分配/激活,它的亲和位掩码将被设置为默认掩码。然后可以如上所述改变它。默认掩码是0xffffffff。
> +
> +下面是一个先将IRQ44(eth1)限制在CPU0-3上,然后限制在CPU4-7上的例子(这是一个8CPU的SMP box)
> +
> +::
> +
> +	[root@moon 44]# cd /proc/irq/44
> +	[root@moon 44]# cat smp_affinity
> +	ffffffff
> +
> +	[root@moon 44]# echo 0f > smp_affinity
> +	[root@moon 44]# cat smp_affinity
> +	0000000f
> +	[root@moon 44]# ping -f h
> +	PING hell (195.4.7.3): 56 data bytes
> +	...
> +	--- hell ping statistics ---
> +	6029 packets transmitted, 6027 packets received, 0% packet loss
> +	round-trip min/avg/max = 0.1/0.1/0.4 ms
> +	[root@moon 44]# cat /proc/interrupts | grep 'CPU\|44:'
> +		CPU0       CPU1       CPU2       CPU3      CPU4       CPU5        CPU6       CPU7
> +	44:       1068       1785       1785       1783         0          0           0         0    IO-APIC-level  eth1
> +
> +从上面一行可以看出,IRQ44只传递给前四个处理器(0-3)。
> +现在让我们把这个IRQ限制在CPU(4-7)。
> +
> +::
> +
> +	[root@moon 44]# echo f0 > smp_affinity
> +	[root@moon 44]# cat smp_affinity
> +	000000f0
> +	[root@moon 44]# ping -f h
> +	PING hell (195.4.7.3): 56 data bytes
> +	..
> +	--- hell ping statistics ---
> +	2779 packets transmitted, 2777 packets received, 0% packet loss
> +	round-trip min/avg/max = 0.1/0.5/585.4 ms
> +	[root@moon 44]# cat /proc/interrupts |  'CPU\|44:'
> +		CPU0       CPU1       CPU2       CPU3      CPU4       CPU5        CPU6       CPU7
> +	44:       1068       1785       1785       1783      1784       1069        1070       1069   IO-APIC-level  eth1
> +
> +这次IRQ44只传递给最后四个处理器。
> +即CPU0-3的计数器没有变化。
> +
> +下面是一个将相同的irq(44)限制在cpus 1024到1031的例子:

':' -> '::'

This is a code block.

> +
> +	[root@moon 44]# echo 1024-1031 > smp_affinity_list
> +	[root@moon 44]# cat smp_affinity_list
> +	1024-1031
> +
> +需要注意的是,如果要用位掩码来做这件事,就需要32个为0的位掩码来追踪其相关的一个。
> -- 
> 2.27.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 04/11] docs/zh_CN: add core-api irq irqflags-tracing.rst translation
  2021-04-09  9:10 ` [PATCH v2 04/11] docs/zh_CN: add core-api irq irqflags-tracing.rst translation Yanteng Si
@ 2021-04-09 10:55   ` Wu X.C.
  0 siblings, 0 replies; 21+ messages in thread
From: Wu X.C. @ 2021-04-09 10:55 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang,
	Harry Wei, linux-doc, realpuyuwang, siyanteng01

On Fri, Apr 09, 2021 at 05:10:06PM +0800, Yanteng Si wrote:
> This patch translates Documentation/core-api/irq/irqflags-tracing.rst into Chinese.
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>

Reviewed-by: Wu XiangCheng <bobwxc@email.cn>

> ---
>  .../zh_CN/core-api/irq/irqflags-tracing.rst   | 46 +++++++++++++++++++
>  1 file changed, 46 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst
> 
> diff --git a/Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst b/Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst
> new file mode 100644
> index 000000000000..2a3f577ac6b5
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/core-api/irq/irqflags-tracing.rst
> @@ -0,0 +1,45 @@
> +.. include:: ../../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../../core-api/irq/irqflags-tracing`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_irqflags-tracing.rst:
> +
> +
> +=======================
> +IRQ-flags状态追踪
> +=======================
> +
> +:Author: 最初由Ingo Molnar <mingo@redhat.com>开始撰写
> +
> +“irq-flags tracing”(中断标志追踪)功能可以 “追踪” hardirq和softirq的状态,它让
> +感兴趣的子系统有机会了解到到内核中发生的每一个
> +hardirqs-off/hardirqs-on、softirqs-off/softirqs-on事件。
> +
> +CONFIG_TRACE_IRQFLAGS_SUPPORT是通用锁调试代码提供的CONFIG_PROVE_SPIN_LOCKING
> +和CONFIG_PROVE_RW_LOCKING所需要的。否则将只有CONFIG_PROVE_MUTEX_LOCKING和
> +CONFIG_PROVE_RWSEM_LOCKING在一个架构上被提供--这些都是不在IRQ上下文中使用的
> +锁API。(rwsems的一个异常是可以解决的)
> +
> +架构对这一点的支持当然不属于“微不足道”的范畴,因为很多低级的汇编代码都要处理irq-flags
> +的状态变化。但是一个架构可以以一种相当直接且无风险的方式启用irq-flags-tracing。
> +
> +架构如果想支持这个,需要先做一些代码组织上的改变:
> +
> +- 在他们的arch级Kconfig文件中添加并启用TRACE_IRQFLAGS_SUPPORT。
> +
> +然后还需要做一些功能上的改变来实现对irq-flags-tracing的支持:
> +
> +- 在低级入口代码中增加(构建条件)对trace_hardirqs_off()/trace_hardirqs_on()
> +  函数的调用。锁验证器会密切关注 “real”的irq-flags是否与 “virtual”的irq-flags
> +  状态相匹配,如果两者不匹配,则会发出警告(并关闭自己)。通常维护arch中
> +  irq-flags-track的大部分时间都是在这种状态下度过的:看看lockdep的警告,试着
> +  找出我们还没有搞定的汇编代码。修复并重复。一旦系统启动,并且在irq-flags跟踪功
> +  能中没有出现lockdep警告的情况下,arch支持就完成了。
> +
> +- 如果该架构有不可屏蔽的中断,那么需要通过lockdep_off()/lockdep_on()将这些中
> +  断从irq跟踪[和锁验证]机制中排除。
> +
> + 一般来说,在一个架构中,不完整的irq-flags-tracing实现是没有风险的:lockdep
> + 会检测到这一点,并将自己关闭。即锁验证器仍然可靠。应该不会因为irq-tracing的错
> + 误而崩溃。(除非通过修改不该修改的条件来更改汇编或寄存器而破坏其他代码)
> -- 
> 2.27.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation
  2021-04-09  9:10 ` [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation Yanteng Si
  2021-04-09 10:19   ` Wu X.C.
@ 2021-04-13  5:23   ` Alex Shi
  2021-04-13 11:19     ` yanteng si
  1 sibling, 1 reply; 21+ messages in thread
From: Alex Shi @ 2021-04-13  5:23 UTC (permalink / raw)
  To: Yanteng Si, Jonathan Corbet
  Cc: Alex Shi, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, siyanteng01, Wu XiangCheng



On 2021/4/9 下午5:10, Yanteng Si wrote:
> +树状映射
> +----------

Ops, please keep the signs number equal to the title char, like
here the '-' should be 8 for 4 Chinese chars, since a Chinese char
takes 2 times width as English char.

And check for all similar signs in your patches.

Thanks
Alex
> +

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation
  2021-04-13  5:23   ` Alex Shi
@ 2021-04-13 11:19     ` yanteng si
  0 siblings, 0 replies; 21+ messages in thread
From: yanteng si @ 2021-04-13 11:19 UTC (permalink / raw)
  To: Alex Shi
  Cc: Yanteng Si, Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen,
	Jiaxun Yang, Harry Wei, linux-doc, Puyu Wang, Wu XiangCheng

OK! :-)


Thanks
Yan teng

Alex Shi <seakeel@gmail.com> 于2021年4月13日周二 下午1:23写道:
>
>
>
> On 2021/4/9 下午5:10, Yanteng Si wrote:
> > +树状映射
> > +----------
>
> Ops, please keep the signs number equal to the title char, like
> here the '-' should be 8 for 4 Chinese chars, since a Chinese char
> takes 2 times width as English char.
>
> And check for all similar signs in your patches.
>
> Thanks
> Alex
> > +

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 02/11] docs/zh_CN: add core-api irq irq-affinity.rst translation
  2021-04-09 10:51   ` Wu X.C.
@ 2021-04-13 11:27     ` yanteng si
  0 siblings, 0 replies; 21+ messages in thread
From: yanteng si @ 2021-04-13 11:27 UTC (permalink / raw)
  To: Wu X.C.
  Cc: Yanteng Si, Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen,
	Jiaxun Yang, Harry Wei, linux-doc, Puyu Wang

OK!

thanks
Yan teng

Wu X.C. <bobwxc@email.cn> 于2021年4月9日周五 下午6:52写道:
>
> On Fri, Apr 09, 2021 at 05:10:04PM +0800, Yanteng Si wrote:
> > This patch translates Documentation/core-api/irq/irq-affinity.rst into Chinese.
> >
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >  .../zh_CN/core-api/irq/irq-affinity.rst       | 74 +++++++++++++++++++
> >  1 file changed, 74 insertions(+)
> >  create mode 100644 Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
> >
> > diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst b/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
> > new file mode 100644
> > index 000000000000..34aaf0d1ddc2
> > --- /dev/null
> > +++ b/Documentation/translations/zh_CN/core-api/irq/irq-affinity.rst
> > @@ -0,0 +1,74 @@
> > +.. include:: ../../disclaimer-zh_CN.rst
> > +
> > +:Original: :doc:`../../../../core-api/irq/irq-affinity`
> > +:Translator: Yanteng Si <siyanteng@loongson.cn>
> > +
> > +.. _cn_irq-affinity.rst:
> > +
> > +
> > +================
> > +SMP IRQ 亲和性
> > +================
> > +
> > +变更记录:
> > +     - 作者:最初由Ingo Molnar <mingo@redhat.com>开始撰写
> > +     - 后期更新维护: Max Krasnyansky <maxk@qualcomm.com>
> > +
> > +
> > +/proc/irq/IRQ#/smp_affinity和/proc/irq/IRQ#/smp_affinity_list指定了哪些CPU能
> > +够关联到一个给定的IRQ源,这两个文件包含了这些指定cpu的cpu位掩码(smp_affinity)和cpu列
> > +表(smp_affinity_list)。它不允许关闭所有CPU, 同时如果IRQ控制器不支持中断请求亲和
> > +(IRQ affinity),那么所有cpu的默认值将保持不变(即关联到所有CPU).
> > +
> > +/proc/irq/default_smp_affinity指明了适用于所有非激活IRQ的默认亲和性掩码。一旦IRQ被
> > +分配/激活,它的亲和位掩码将被设置为默认掩码。然后可以如上所述改变它。默认掩码是0xffffffff。
> > +
> > +下面是一个先将IRQ44(eth1)限制在CPU0-3上,然后限制在CPU4-7上的例子(这是一个8CPU的SMP box)
> > +
> > +::
> > +
> > +     [root@moon 44]# cd /proc/irq/44
> > +     [root@moon 44]# cat smp_affinity
> > +     ffffffff
> > +
> > +     [root@moon 44]# echo 0f > smp_affinity
> > +     [root@moon 44]# cat smp_affinity
> > +     0000000f
> > +     [root@moon 44]# ping -f h
> > +     PING hell (195.4.7.3): 56 data bytes
> > +     ...
> > +     --- hell ping statistics ---
> > +     6029 packets transmitted, 6027 packets received, 0% packet loss
> > +     round-trip min/avg/max = 0.1/0.1/0.4 ms
> > +     [root@moon 44]# cat /proc/interrupts | grep 'CPU\|44:'
> > +             CPU0       CPU1       CPU2       CPU3      CPU4       CPU5        CPU6       CPU7
> > +     44:       1068       1785       1785       1783         0          0           0         0    IO-APIC-level  eth1
> > +
> > +从上面一行可以看出,IRQ44只传递给前四个处理器(0-3)。
> > +现在让我们把这个IRQ限制在CPU(4-7)。
> > +
> > +::
> > +
> > +     [root@moon 44]# echo f0 > smp_affinity
> > +     [root@moon 44]# cat smp_affinity
> > +     000000f0
> > +     [root@moon 44]# ping -f h
> > +     PING hell (195.4.7.3): 56 data bytes
> > +     ..
> > +     --- hell ping statistics ---
> > +     2779 packets transmitted, 2777 packets received, 0% packet loss
> > +     round-trip min/avg/max = 0.1/0.5/585.4 ms
> > +     [root@moon 44]# cat /proc/interrupts |  'CPU\|44:'
> > +             CPU0       CPU1       CPU2       CPU3      CPU4       CPU5        CPU6       CPU7
> > +     44:       1068       1785       1785       1783      1784       1069        1070       1069   IO-APIC-level  eth1
> > +
> > +这次IRQ44只传递给最后四个处理器。
> > +即CPU0-3的计数器没有变化。
> > +
> > +下面是一个将相同的irq(44)限制在cpus 1024到1031的例子:
>
> ':' -> '::'
>
> This is a code block.
>
> > +
> > +     [root@moon 44]# echo 1024-1031 > smp_affinity_list
> > +     [root@moon 44]# cat smp_affinity_list
> > +     1024-1031
> > +
> > +需要注意的是,如果要用位掩码来做这件事,就需要32个为0的位掩码来追踪其相关的一个。
> > --
> > 2.27.0
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation
  2021-04-09 10:19   ` Wu X.C.
@ 2021-04-13 11:59     ` yanteng si
  0 siblings, 0 replies; 21+ messages in thread
From: yanteng si @ 2021-04-13 11:59 UTC (permalink / raw)
  To: Wu X.C.
  Cc: Yanteng Si, Jonathan Corbet, Alex Shi, Alex Shi, Huacai Chen,
	Jiaxun Yang, Harry Wei, linux-doc, Puyu Wang

OK!

Thanks
Yanteng

Wu X.C. <bobwxc@email.cn> 于2021年4月9日周五 下午6:19写道:
>
> On Fri, Apr 09, 2021 at 05:10:05PM +0800, Yanteng Si wrote:
> > This patch translates Documentation/core-api/irq/irq-domain.rst into Chinese.
> >
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >  .../zh_CN/core-api/irq/irq-domain.rst         | 227 ++++++++++++++++++
> >  1 file changed, 227 insertions(+)
> >  create mode 100644 Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> >
> > diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> > new file mode 100644
> > index 000000000000..03d3b7953e08
> > --- /dev/null
> > +++ b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> > @@ -0,0 +1,227 @@
> > +.. include:: ../../disclaimer-zh_CN.rst
> > +
> > +:Original: :doc:`../../../../core-api/irq/irq-domain`
> > +:Translator: Yanteng Si <siyanteng@loongson.cn>
> > +
> > +.. _cn_irq-domain.rst:
> > +
> > +
> > +===============================================
> > +irq_domain 中断号映射库
> > +===============================================
> > +
> > +目前Linux内核的设计使用了一个巨大的数字空间,每个独立的IRQ源都被分配了一个不
> > +同的数字。
> > +当只有一个中断控制器时,这很简单,但在有多个中断控制器的系统中,内核必须确保每
> > +个中断控制器都能得到非重复的Linux IRQ号(数字)分配。
> > +
> > +注册为唯一的irqchips的中断控制器编号呈现出上升的趋势:例如GPIO控制器等不同
> > +种类的子驱动程序通过将其中断处理程序建模为irqchips,即实际上是级联中断控制器,
> > +避免了重新实现与IRQ核心系统相同的回调机制。
> > +
> > +在这里,中断号与硬件中断号离散了所有种类的对应关系:而在过去,IRQ号可以选择,
> > +使它们与硬件IRQ线进入根中断控制器(即实际向CPU发射中断线的组件)相匹配,现
> > +在这个编号仅仅是一个数字。
> > +
> > +出于这个原因,我们需要一种机制将控制器本地中断号(即硬件irq编号)与Linux IRQ
> > +号分开。
> > +
> > +irq_alloc_desc*() 和 irq_free_desc*() API 提供了对irq号的分配,但它们不
> > +提供任何对控制器本地IRQ(hwirq)号到Linux IRQ号空间的反向映射的支持。
> > +
> > +irq_domain 库在 irq_alloc_desc*() API 的基础上增加了 hwirq 和 IRQ 号码
> > +之间的映射。 相比于中断控制器驱动开放编码自己的反向映射方案,我们更喜欢用
> > +irq_domain来管理映射。
> > +
> > +irq_domain还实现了从抽象的irq_fwspec结构体到hwirq号的转换(到目前为止是
> > +Device Tree和ACPI GSI),并且可以很容易地扩展以支持其它IRQ拓扑数据源。
> > +
> > +irq_domain的用法
> > +================
> > +
> > +中断控制器驱动程序通过以下方式创建并注册一个irq_domain。调用
> > +irq_domain_add_*() 或 irq_domain_create_*()函数之一(每个映射方法都有不
> > +同的分配器函数,后面会详细介绍)。 函数成功后会返回一个指向irq_domain的指针。
> > +调用者必须向分配器函数提供一个irq_domain_ops结构体。
> > +
> > +在大多数情况下,irq_domain在开始时是空的,没有任何hwirq和IRQ号之间的映射。
> > +通过调用irq_create_mapping()将映射添加到irq_domain中,该函数接受
> > +irq_domain和一个hwirq号作为参数。 如果hwirq的映射还不存在,那么它将分配
> > +一个新的Linux irq_desc,将其与hwirq关联起来,并调用.map()回调,这样驱动
> > +程序就可以执行任何必要的硬件设置。
> > +
> > +当接收到一个中断时,应该使用irq_find_mapping()函数从hwirq号中找到
> > +Linux IRQ号。
> > +
> > +在调用irq_find_mapping()之前,至少要调用一次irq_create_mapping()函数,
> > +以免描述符不能被分配。
> > +
> > +如果驱动程序有Linux的IRQ号或irq_data指针,并且需要知道相关的hwirq号(比
> > +如在irq_chip回调中),那么可以直接从irq_data->hwirq中获得。
> > +
> > +irq_domain映射的类型
> > +============================
> > +
> > +从hwirq到Linux irq的反向映射有几种机制,每种机制使用不同的分配函数。应该
> > +使用哪种反向映射类型取决于用例。 下面介绍每一种反向映射类型:
> > +
> > +线性映射
> > +----------
> > +
> > +::
> > +
> > +     irq_domain_add_linear()
> > +     irq_domain_create_linear()
> > +
> > +线性反向映射维护了一个固定大小的表,该表以hwirq号为索引。 当一个hwirq被映射
> > +时,会给hwirq分配一个irq_desc,并将irq号存储在表中。
> > +
> > +当最大的hwirq号固定且数量相对较少时,线性图是一个很好的选择(~<256)。 这种
> > +映射的优点是固定时间查找IRQ号,而且irq_descs只分配给在用的IRQ。 缺点是该表
> > +必须尽可能大的hwirq号。
> > +
> > +irq_domain_add_linear()和irq_domain_create_linear()在功能上是等价的,
> > +除了第一个参数不同--前者接受一个Open Firmware特定的 'struct device_node' 而
> > +后者接受一个更通用的抽象 'struct fwnode_handle' 。
> > +
> > +大多数驱动应该使用线性映射
> > +
> > +树状映射
> > +----------
> > +
> > +::
> > +
> > +     irq_domain_add_tree()
> > +     irq_domain_create_tree()
> > +
> > +irq_domain维护着从hwirq号到Linux IRQ的radix的树状映射。 当一个hwirq被映射时,
> > +一个irq_desc被分配,hwirq被用作radix树的查找键。
> > +
> > +如果hwirq号可以非常大,树状映射是一个很好的选择,因为它不需要分配一个和最大hwirq
> > +号一样大的表。 缺点是,hwirq到IRQ号的查找取决于表中有多少条目。
> > +
> > +irq_domain_add_tree()和irq_domain_create_tree()在功能上是等价的,除了第一
> > +个参数不同——前者接受一个Open Firmware特定的 'struct device_node' ,而后者接受
> > +一个更通用的抽象 'struct fwnode_handle' 。
> > +
> > +很少有驱动应该需要这个映射。
> > +
> > +无映射
> > +--------
> > +
> > +::
> > +
> > +     irq_domain_add_nomap()
> > +
> > +当硬件中的hwirq号是可编程的时候,就可以采用无映射类型。 在这种情况下,最好将
> > +Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create_direct_mapping()
> > +会分配一个Linux IRQ号,并调用.map()回调,这样驱动就可以将Linux IRQ号编入硬件中。
> > +
> > +大多数驱动程序不能使用这个映射。
> > +
> > +传统映射类型
> > +--------------
> > +
> > +::
> > +
> > +     irq_domain_add_simple()
> > +     irq_domain_add_legacy()
> > +     irq_domain_add_legacy_isa()
> > +     irq_domain_create_simple()
> > +     irq_domain_create_legacy()
> > +
> > +传统映射是已经为 hwirqs 分配了一系列 irq_descs 的驱动程序的特殊情况。 当驱动程
> > +序不能立即转换为使用线性映射时,就会使用它。 例如,许多嵌入式系统板卡支持文件使用
> > +一组用于IRQ号的定义(#define),这些定义被传递给struct设备注册。 在这种情况下,
> > +不能动态分配Linux IRQ号,应该使用传统映射。
> > +
> > +传统映射假设已经为控制器分配了一个连续的IRQ号范围,并且可以通过向hwirq号添加一
> > +个固定的偏移来计算IRQ号,反之亦然。 缺点是需要中断控制器管理IRQ分配,并且需要为每
> > +个hwirq分配一个irq_desc,即使它没有被使用。
> > +
> > +只有在必须支持固定的IRQ映射时,才应使用传统映射。 例如,ISA控制器将使用传统映射来
> > +映射Linux IRQ 0-15,这样现有的ISA驱动程序就能得到正确的IRQ号。
> > +
> > +大多数使用传统映射的用户应该使用irq_domain_add_simple()或
> > +irq_domain_create_simple(),只有在系统提供IRQ范围时才会使用传统域,否则将使用
> > +线性域映射。这个调用的语义是这样的:如果指定了一个IRQ范围,那么 描述符将被即时分配
> > +给它,如果没有范围被分配,它将不会执行 irq_domain_add_linear() 或
> > +irq_domain_create_linear(),这意味着 *no* irq 描述符将被分配。
> > +
> > +一个简单域的典型用例是,irqchip供应商同时支持动态和静态IRQ分配。
> > +
> > +为了避免最终出现使用线性域而没有描述符被分配的情况,确保使用简单域的驱动程序在任何
> > +irq_find_mapping()之前调用irq_create_mapping()是非常重要的,因为后者实际上
> > +将用于静态IRQ分配情况。
> > +
> > +irq_domain_add_simple()和irq_domain_create_simple()以及
> > +irq_domain_add_legacy()和irq_domain_create_legacy()在功能上是等价的,只
> > +是第一个参数不同--前者接受Open Firmware特定的 'struct device_node' ,而后者
> > +接受一个更通用的抽象 'struct fwnode_handle' 。
> > +
> > +IRQ域层级结构
> > +--------------------
> > +
> > +在某些架构上,可能有多个中断控制器参与将一个中断从设备传送到目标CPU。
> > +让我们来看看x86平台上典型的中断传递路径吧
> > +::
> > +
> > +  Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU
> > +
> > +涉及到的中断控制器有三个:
> > +
> > +1) IOAPIC 控制器
> > +2) 中断重映射控制器
> > +3) Local APIC 控制器
> > +
> > +为了支持这样的硬件拓扑结构,使软件架构与硬件架构相匹配,为每个中断控制器建立一
> > +个irq_domain数据结构,并将这些irq_domain组织成层次结构。
> > +
> > +在建立irq_domain层次结构时,靠近设备的irq_domain为子域,靠近CPU的
> > +irq_domain为父域。所以在上面的例子中,将建立如下的层次结构。
> > +::
> > +
> > +     CPU Vector irq_domain (root irq_domain to manage CPU vectors)
> > +             ^
> > +             |
> > +     Interrupt Remapping irq_domain (manage irq_remapping entries)
> > +             ^
> > +             |
> > +     IOAPIC irq_domain (manage IOAPIC delivery entries/pins)
> > +
> > +使用irq_domain层次结构的主要接口有四个:
> > +
> > +1) irq_domain_alloc_irqs(): 分配IRQ描述符和与中断控制器相关的资源来传递这些中断。
> > +2) irq_domain_free_irqs(): 释放IRQ描述符和与这些中断相关的中断控制器资源。
> > +3) irq_domain_activate_irq(): 激活中断控制器硬件以传递中断。
> > +4) irq_domain_deactivate_irq(): 停用中断控制器硬件,停止传递中断。
> > +
> > +为了支持irq_domain层次结构,需要做如下修改:
> > +
> > +1) 一个新的字段 'parent' 被添加到irq_domain结构中;它用于维护irq_domain的层次信息。
> > +2) 一个新的字段 'parent_data' 被添加到irq_data结构中;它用于建立层次结构irq_data以
> > +   匹配irq_domain层次结构。irq_data用于存储irq_domain指针和硬件irq号。
> > +3) 新的回调被添加到irq_domain_ops结构中,以支持层次结构的irq_domain操作。
> > +
> > +在支持分层irq_domain和分层irq_data准备就绪后,为每个中断控制器建立一个irq_domain结
> > +构,并为每个与IRQ相关联的irq_domain分配一个irq_data结构。现在我们可以再进一步支持堆
> > +栈式(层次结构)的irq_chip。也就是说,一个irq_chip与层次结构中的每个irq_data相关联。
> > +一个子irq_chip可以自己或通过与它的父irq_chip合作来实现一个所需的操作。
> > +
> > +通过堆栈式的irq_chip,中断控制器驱动只需要处理自己管理的硬件,在需要的时候可以向其父
> > +irq_chip请求服务。所以我们可以实现更简洁的软件架构。
> > +
> > +为了让中断控制器驱动程序支持irq_domain层次结构,它需要做到以下几点:
> > +
> > +1) 实现 irq_domain_ops.alloc 和 irq_domain_ops.free
> > +2) 可选择地实现 irq_domain_ops.activate 和 irq_domain_ops.deactivate.
> > +3) 可选择地实现一个irq_chip来管理中断控制器硬件。
> > +4) 不需要实现irq_domain_ops.map和irq_domain_ops.unmap,它们在层次结构
> > +   irq_domain中是不用的。
> > +
> > +irq_domain层次结构绝不是x86特有的,大量用于支持其他架构,如ARM、ARM64等。
> > +
> > +调试功能
> > +=========
> > +
> > +打开CONFIG_GENERIC_IRQ_DEBUGFS on.ping,可让IRQ子系统的大部分内部结构都在debugfs中暴露出来。
>
> Please fix "on.ping".
>
> > --
> > 2.27.0
>
> Thanks!
>
> Wu X.C.
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-04-13 11:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  9:10 [PATCH v2 00/11] docs/zh_CN: add core api and openrisc translation Yanteng Si
2021-04-09  9:10 ` [PATCH v2 01/11] docs/zh_CN: add core-api irq concepts.rst translation Yanteng Si
2021-04-09 10:09   ` Wu X.C.
2021-04-09  9:10 ` [PATCH v2 02/11] docs/zh_CN: add core-api irq irq-affinity.rst translation Yanteng Si
2021-04-09 10:51   ` Wu X.C.
2021-04-13 11:27     ` yanteng si
2021-04-09  9:10 ` [PATCH v2 03/11] docs/zh_CN: add core-api/irq/irq-domain.rst translation Yanteng Si
2021-04-09 10:19   ` Wu X.C.
2021-04-13 11:59     ` yanteng si
2021-04-13  5:23   ` Alex Shi
2021-04-13 11:19     ` yanteng si
2021-04-09  9:10 ` [PATCH v2 04/11] docs/zh_CN: add core-api irq irqflags-tracing.rst translation Yanteng Si
2021-04-09 10:55   ` Wu X.C.
2021-04-09  9:10 ` [PATCH v2 05/11] docs/zh_CN: add core-api irq index.rst translation Yanteng Si
2021-04-09  9:10 ` [PATCH v2 06/11] docs/zh_CN: add core-api/index.rst translation Yanteng Si
2021-04-09 10:25   ` Wu X.C.
2021-04-09  9:10 ` [PATCH v2 07/11] docs/zh_CN: add translation to zh_CN index Yanteng Si
2021-04-09  9:10 ` [PATCH v2 08/11] docs/zh_CN: add openrisc openrisc_port.rst translation Yanteng Si
2021-04-09  9:10 ` [PATCH v2 09/11] docs/zh_CN: add openrisc/todo.rst translation Yanteng Si
2021-04-09 10:30   ` Wu X.C.
2021-04-09  9:10 ` [PATCH v2 10/11] docs/zh_CN: add openrisc/index.rst translation Yanteng Si

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.