Skip to content

Commit 474496f

Browse files
shiqinggdbkinder
authored andcommitted
doc: remove hard-coded interfaces in .rst files
This patch removes hard-coded interfaces in .rst files and refers to the definition via doxygen style comments. This patch mainly focus on Hypervisor part. Other parts will be covered in seperate patches. Tracked-On: #1595 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
1 parent ffb9245 commit 474496f

File tree

8 files changed

+255
-162
lines changed

8 files changed

+255
-162
lines changed

doc/developer-guides/hld/hv-interrupt.rst

Lines changed: 12 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -386,71 +386,29 @@ IOAPIC
386386
The following APIs are external interfaces for IOAPIC related
387387
operations.
388388

389-
.. code-block:: c
390-
391-
void ioapic_get_rte(uint32_t irq, union ioapic_rte *rte)
392-
/* get the redirection table entry of an irq. */
393-
394-
void ioapic_set_rte(uint32_t irq, union ioapic_rte rte)
395-
/* Set the redirection table entry of an irq. */
396-
397-
uint32_t pin_to_irq(uint8_t pin)
398-
/* Get irq num from physical irq pin num */
399-
400-
void suspend_ioapic(void)
401-
/* Suspended ioapic, mainly save the RTEs. */
402-
403-
void resume_ioapic(void)
404-
/* Resume ioapic, mainly restore the RTEs. */
389+
.. doxygengroup:: ioapic_ext_apis
390+
:project: Project ACRN
391+
:content-only:
405392

406-
int get_ioapic_info(char *str_arg, int str_max_len)
407-
/* Dump information of ioapic for debug, such as irq num, pin,
408-
* RTE, vector, trigger mode etc. For debugging only.
409-
*/
410393

411394
LAPIC
412395
=====
413396

414397
The following APIs are external interfaces for LAPIC related operations.
415398

416-
.. code-block:: c
417-
418-
void write_lapic_reg32(uint32_t offset, uint32_t value)
419-
/* Write to lapic register. */
420-
421-
void early_init_lapic(void)
422-
/* To get the local apic base addr, map lapic registers and check the
423-
* xAPIC/x2APIC capability.
424-
*/
425-
426-
void save_lapic(struct lapic_regs *regs)
427-
/* Save context of lapic before entering s3. */
428-
429-
void restore_lapic(struct lapic_regs *regs)
430-
/* Restore context of lapic when resume from s3. */
431-
432-
void resume_lapic(void)
433-
/* Resume lapic by setting the apic base addr and restore the registers. */
399+
.. doxygengroup:: lapic_ext_apis
400+
:project: Project ACRN
401+
:content-only:
434402

435-
uint8_t get_cur_lapic_id(void)
436-
/* Get the lapic id. */
437403

438404
IPI
439405
===
440406

441407
The following APIs are external interfaces for IPI related operations.
442408

443-
.. code-block:: c
444-
445-
void send_startup_ipi(enum intr_cpu_startup_shorthand cpu_startup_shorthand,
446-
uint16_t dest_pcpu_id, uint64_t cpu_startup_start_address)
447-
/* Send an SIPI to a specific cpu, to notify the cpu to start booting. */
448-
449-
void send_dest_ipi(uint32_t dest, uint32_t vector, uint32_t dest_mode)
450-
/* Send an IPI to a specific cpu with dest mode specified. */
451-
452-
void send_single_ipi(uint16_t pcpu_id, uint32_t vector)
453-
/* Send an IPI to a specific cpu with physical dest mode. */
409+
.. doxygengroup:: ipi_ext_apis
410+
:project: Project ACRN
411+
:content-only:
454412

455413

456414
Physical Interrupt
@@ -459,32 +417,7 @@ Physical Interrupt
459417
The following APIs are external interfaces for physical interrupt
460418
related operations.
461419

462-
.. code-block:: c
463-
464-
int32_t request_irq(uint32_t req_irq, irq_action_t action_fn, void *priv_data,
465-
uint32_t flags)
466-
/* Request interrupt num if not specified, and register irq action for the
467-
* specified/allocated irq.
468-
*/
469-
470-
void free_irq(uint32_t irq)
471-
/* Free irq num and unregister the irq action. */
472-
473-
void set_irq_trigger_mode(uint32_t irq, bool is_level_triggered)
474-
/* Set the irq trigger mode: edge-triggered or level-triggered */
475-
476-
uint32_t irq_to_vector(uint32_t irq)
477-
/* Convert irq num to vector */
478-
479-
void get_cpu_interrupt_info(char *str_arg, int str_max)
480-
/* To dump interrupt statistics info, such as irq num, vector,
481-
* irq count on each physical cpu.
482-
*/
483-
484-
void dispatch_interrupt(struct intr_excp_ctx *ctx)
485-
/* To dispatch an interrupt, an action callback will be called if registered. */
420+
.. doxygengroup:: phys_int_ext_apis
421+
:project: Project ACRN
422+
:content-only:
486423

487-
void init_interrupt(uint16_t pcpu_id)
488-
/* To do interrupt initialization for a cpu, will be called for
489-
* each physical cpu.
490-
*/

doc/developer-guides/hld/hv-memmgt.rst

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,6 @@ of physical memory management.
165165

166166
Data Flow of Hypervisor Physical Memory Management
167167

168-
Data Structure Design
169-
=====================
170-
171-
The page tables operation type:
172-
173-
.. code-block:: c
174-
175-
enum _page_table_type {
176-
177-
PTT_HOST = 0, /* Operations for MMU page tables */
178-
PTT_EPT = 1, /* Operations for EPT page tables */
179-
PAGETABLE_TYPE_UNKNOWN, /* Page tables operation type is unknown */
180-
};
181-
182168
Interfaces Design
183169
=================
184170

@@ -354,44 +340,18 @@ the memory virtualization unit.
354340
Data Structure Design
355341
=====================
356342

357-
EPT Memory Type Data Definition:
358-
359-
.. code-block:: c
360-
361-
/* EPT memory type is specified in bits 5:3 of the last EPT
362-
* paging-structure entry */
363-
#define EPT_MT_SHIFT 3U
343+
EPT Memory Type Definition:
364344

365-
/* EPT memory type is uncacheable */
366-
#define EPT_UNCACHED (0UL << EPT_MT_SHIFT)
367-
368-
/* EPT memory type is write combining */
369-
#define EPT_WC (1UL << EPT_MT_SHIFT)
370-
371-
/* EPT memory type is write through */
372-
#define EPT_WT (4UL << EPT_MT_SHIFT)
373-
374-
/* EPT memory type is write protected */
375-
#define EPT_WP (5UL << EPT_MT_SHIFT)
376-
377-
/* EPT memory type is write back */
378-
#define EPT_WB (6UL << EPT_MT_SHIFT)
345+
.. doxygengroup:: ept_mem_type
346+
:project: Project ACRN
347+
:content-only:
379348

380349
EPT Memory Access Right Definition:
381350

382-
.. code-block:: c
383-
384-
/* EPT memory access right is read-only */
385-
#define EPT_RD (1UL << 0U)
386-
387-
/* EPT memory access right is read/write */
388-
#define EPT_WR (1UL << 1U)
389-
390-
/* EPT memory access right is executable */
391-
#define EPT_EXE (1UL << 2U)
351+
.. doxygengroup:: ept_mem_access_right
352+
:project: Project ACRN
353+
:content-only:
392354

393-
/* EPT memory access right is read/write and executable */
394-
define EPT_RWX (EPT_RD | EPT_WR | EPT_EXE)
395355

396356
Interfaces Design
397357
=================

doc/developer-guides/hld/hv-virt-interrupt.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,9 @@ requests such as flush EPT.
4545

4646
The eventid supported for virtual interrupt injection includes:
4747

48-
.. code-block:: c
49-
50-
#define ACRN_REQUEST_EXCP 0 /* request for exception injection */
51-
#define ACRN_REQUEST_EVENT 1 /* vLAPIC event */
52-
#define ACRN_REQUEST_EXTINT 2 /* external interrupt from vPIC */
53-
#define ACRN_REQUEST_NMI 3 /* non-maskable interrupt */
48+
.. doxygengroup:: virt_int_injection
49+
:project: Project ACRN
50+
:content-only:
5451

5552

5653
The *vcpu_make_request* is necessary for a virtual interrupt

hypervisor/include/arch/x86/guest/vcpu.h

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,59 @@
7171
/*
7272
* VCPU related APIs
7373
*/
74+
75+
/**
76+
* @defgroup virt_int_injection Event ID supported for virtual interrupt injection
77+
*
78+
* This is a group that includes Event ID supported for virtual interrupt injection.
79+
*
80+
* @{
81+
*/
82+
83+
/**
84+
* @brief Request for exception injection
85+
*/
7486
#define ACRN_REQUEST_EXCP 0U
87+
88+
/**
89+
* @brief Request for vLAPIC event
90+
*/
7591
#define ACRN_REQUEST_EVENT 1U
92+
93+
/**
94+
* @brief Request for external interrupt from vPIC
95+
*/
7696
#define ACRN_REQUEST_EXTINT 2U
97+
98+
/**
99+
* @brief Request for non-maskable interrupt
100+
*/
77101
#define ACRN_REQUEST_NMI 3U
102+
103+
/**
104+
* @brief Request for EOI exit bitmap update
105+
*/
78106
#define ACRN_REQUEST_EOI_EXIT_BITMAP_UPDATE 4U
107+
108+
/**
109+
* @brief Request for EPT flush
110+
*/
79111
#define ACRN_REQUEST_EPT_FLUSH 5U
112+
113+
/**
114+
* @brief Request for triple fault
115+
*/
80116
#define ACRN_REQUEST_TRP_FAULT 6U
81-
#define ACRN_REQUEST_VPID_FLUSH 7U /* flush vpid tlb */
117+
118+
/**
119+
* @brief Request for VPID TLB flush
120+
*/
121+
#define ACRN_REQUEST_VPID_FLUSH 7U
122+
123+
/**
124+
* @}
125+
*/
126+
/* End of virt_int_injection */
82127

83128
#define save_segment(seg, SEG_NAME) \
84129
{ \

hypervisor/include/arch/x86/ioapic.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,20 @@ uint32_t ioapic_irq_to_pin(uint32_t irq);
2525
int32_t init_ioapic_id_info(void);
2626
uint8_t ioapic_irq_to_ioapic_id(uint32_t irq);
2727

28+
/**
29+
* @defgroup ioapic_ext_apis IOAPIC External Interfaces
30+
*
31+
* This is a group that includes IOAPIC External Interfaces.
32+
*
33+
* @{
34+
*/
35+
2836
/**
2937
* @brief Get irq num from pin num
3038
*
3139
* @param[in] pin The pin number
40+
*
41+
* @return irq number
3242
*/
3343
uint32_t ioapic_pin_to_irq(uint32_t pin);
3444

@@ -54,9 +64,25 @@ void ioapic_set_rte(uint32_t irq, union ioapic_rte rte);
5464
*/
5565
void ioapic_get_rte(uint32_t irq, union ioapic_rte *rte);
5666

67+
/**
68+
* @brief Suspend ioapic
69+
*
70+
* Suspend ioapic, mainly save the RTEs.
71+
*/
5772
void suspend_ioapic(void);
73+
74+
/**
75+
* @brief Resume ioapic
76+
*
77+
* Resume ioapic, mainly restore the RTEs.
78+
*/
5879
void resume_ioapic(void);
5980

81+
/**
82+
* @}
83+
*/
84+
/* End of ioapic_ext_apis */
85+
6086
void ioapic_gsi_mask_irq(uint32_t irq);
6187
void ioapic_gsi_unmask_irq(uint32_t irq);
6288

0 commit comments

Comments
 (0)