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>
This commit is contained in:
Shiqing Gao
2019-05-07 16:52:39 +08:00
committed by David Kinder
parent ffb924542b
commit 474496fc0e
8 changed files with 255 additions and 162 deletions

View File

@@ -71,14 +71,59 @@
/*
* VCPU related APIs
*/
/**
* @defgroup virt_int_injection Event ID supported for virtual interrupt injection
*
* This is a group that includes Event ID supported for virtual interrupt injection.
*
* @{
*/
/**
* @brief Request for exception injection
*/
#define ACRN_REQUEST_EXCP 0U
/**
* @brief Request for vLAPIC event
*/
#define ACRN_REQUEST_EVENT 1U
/**
* @brief Request for external interrupt from vPIC
*/
#define ACRN_REQUEST_EXTINT 2U
/**
* @brief Request for non-maskable interrupt
*/
#define ACRN_REQUEST_NMI 3U
/**
* @brief Request for EOI exit bitmap update
*/
#define ACRN_REQUEST_EOI_EXIT_BITMAP_UPDATE 4U
/**
* @brief Request for EPT flush
*/
#define ACRN_REQUEST_EPT_FLUSH 5U
/**
* @brief Request for triple fault
*/
#define ACRN_REQUEST_TRP_FAULT 6U
#define ACRN_REQUEST_VPID_FLUSH 7U /* flush vpid tlb */
/**
* @brief Request for VPID TLB flush
*/
#define ACRN_REQUEST_VPID_FLUSH 7U
/**
* @}
*/
/* End of virt_int_injection */
#define save_segment(seg, SEG_NAME) \
{ \

View File

@@ -25,10 +25,20 @@ uint32_t ioapic_irq_to_pin(uint32_t irq);
int32_t init_ioapic_id_info(void);
uint8_t ioapic_irq_to_ioapic_id(uint32_t irq);
/**
* @defgroup ioapic_ext_apis IOAPIC External Interfaces
*
* This is a group that includes IOAPIC External Interfaces.
*
* @{
*/
/**
* @brief Get irq num from pin num
*
* @param[in] pin The pin number
*
* @return irq number
*/
uint32_t ioapic_pin_to_irq(uint32_t pin);
@@ -54,9 +64,25 @@ void ioapic_set_rte(uint32_t irq, union ioapic_rte rte);
*/
void ioapic_get_rte(uint32_t irq, union ioapic_rte *rte);
/**
* @brief Suspend ioapic
*
* Suspend ioapic, mainly save the RTEs.
*/
void suspend_ioapic(void);
/**
* @brief Resume ioapic
*
* Resume ioapic, mainly restore the RTEs.
*/
void resume_ioapic(void);
/**
* @}
*/
/* End of ioapic_ext_apis */
void ioapic_gsi_mask_irq(uint32_t irq);
void ioapic_gsi_unmask_irq(uint32_t irq);

View File

@@ -90,7 +90,6 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data);
void init_default_irqs(uint16_t cpu_id);
void dispatch_exception(struct intr_excp_ctx *ctx);
void dispatch_interrupt(const struct intr_excp_ctx *ctx);
void setup_notification(void);
void setup_posted_intr_notification(void);
@@ -101,14 +100,6 @@ extern spurious_handler_t spurious_handler;
uint32_t alloc_irq_num(uint32_t req_irq);
uint32_t alloc_irq_vector(uint32_t irq);
/**
* @brief Get vector number of an interupt from irq number
*
* @param[in] irq The irq_num to convert
*/
uint32_t irq_to_vector(uint32_t irq);
/* RFLAGS */
#define HV_ARCH_VCPU_RFLAGS_IF (1UL<<9U)
#define HV_ARCH_VCPU_RFLAGS_RF (1UL<<16U)
@@ -219,15 +210,6 @@ int32_t interrupt_window_vmexit_handler(struct acrn_vcpu *vcpu);
int32_t external_interrupt_vmexit_handler(struct acrn_vcpu *vcpu);
int32_t acrn_handle_pending_request(struct acrn_vcpu *vcpu);
/**
* @brief Initialize the interrupt
*
* To do interrupt initialization for a cpu, will be called for each physical cpu.
*
* @param[in] pcpu_id The id of physical cpu to initialize
*/
void init_interrupt(uint16_t pcpu_id);
void cancel_event_injection(struct acrn_vcpu *vcpu);
extern uint64_t irq_alloc_bitmap[IRQ_ALLOC_BITMAP_SIZE];
@@ -255,6 +237,14 @@ struct irq_desc {
#endif
};
/**
* @defgroup phys_int_ext_apis Physical Interrupt External Interfaces
*
* This is a group that includes Physical Interrupt External Interfaces.
*
* @{
*/
/**
* @brief Request an interrupt
*
@@ -295,6 +285,37 @@ void free_irq(uint32_t irq);
*/
void set_irq_trigger_mode(uint32_t irq, bool is_level_triggered);
/**
* @brief Get vector number of an interrupt from irq number
*
* @param[in] irq The irq_num to convert
*
* @return vector number
*/
uint32_t irq_to_vector(uint32_t irq);
/**
* @brief Dispatch interrupt
*
* To dispatch an interrupt, an action callback will be called if registered.
*
* @param ctx Pointer to interrupt exception context
*/
void dispatch_interrupt(const struct intr_excp_ctx *ctx);
/**
* @brief Initialize interrupt
*
* To do interrupt initialization for a cpu, will be called for each physical cpu.
*
* @param[in] pcpu_id The id of physical cpu to initialize
*/
void init_interrupt(uint16_t pcpu_id);
/**
* @}
*/
/* End of phys_int_ext_apis */
/**
* @}

View File

@@ -76,22 +76,67 @@ union apic_icr {
};
/**
* @brief Save context of lapic
* @defgroup lapic_ext_apis LAPIC External Interfaces
*
* This is a group that includes LAPIC External Interfaces.
*
* @{
*/
/**
* @brief Save context of LAPIC
*
* @param[inout] regs Pointer to struct lapic_regs to hold the
* context of current lapic
* context of current LAPIC
*/
void save_lapic(struct lapic_regs *regs);
/**
* @brief Enable LAPIC in x2APIC mode
*
* Enable LAPIC in x2APIC mode via MSR writes.
*
*/
void early_init_lapic(void);
/**
* @brief Suspend LAPIC
*
* Suspend LAPIC by getting the APIC base addr and saving the registers.
*/
void suspend_lapic(void);
/**
* @brief Resume LAPIC
*
* Resume LAPIC by setting the APIC base addr and restoring the registers.
*/
void resume_lapic(void);
/**
* @brief Get the LAPIC ID
*
* Get the LAPIC ID via MSR read.
*
* @return LAPIC ID
*/
uint32_t get_cur_lapic_id(void);
/**
* @}
*/
/* End of lapic_ext_apis */
void init_lapic(uint16_t pcpu_id);
void send_lapic_eoi(void);
/**
* @brief Get the lapic id
* @defgroup ipi_ext_apis IPI External Interfaces
*
* @return lapic id
* This is a group that includes IPI External Interfaces.
*
* @{
*/
uint32_t get_cur_lapic_id(void);
/**
* @brief Send an SIPI to a specific cpu
@@ -124,6 +169,11 @@ void send_dest_ipi_mask(uint32_t dest_mask, uint32_t vector);
*/
void send_single_ipi(uint16_t pcpu_id, uint32_t vector);
/**
* @}
*/
/* End of ipi_ext_apis */
/**
* @brief Send an INIT signal to a single pCPU
*
@@ -133,7 +183,4 @@ void send_single_ipi(uint16_t pcpu_id, uint32_t vector);
*/
void send_single_init(uint16_t pcpu_id);
void suspend_lapic(void);
void resume_lapic(void);
#endif /* INTR_LAPIC_H */

View File

@@ -31,23 +31,87 @@
#define PAGE_CACHE_UC_MINUS PAGE_PCD
#define PAGE_CACHE_UC (PAGE_PCD | PAGE_PWT)
/**
* @defgroup ept_mem_access_right EPT Memory Access Right
*
* This is a group that includes EPT Memory Access Right Definitions.
*
* @{
*/
/**
* @brief EPT memory access right is read-only.
*/
#define EPT_RD (1UL << 0U)
/**
* @brief EPT memory access right is read/write.
*/
#define EPT_WR (1UL << 1U)
/**
* @brief EPT memory access right is executable.
*/
#define EPT_EXE (1UL << 2U)
/**
* @brief EPT memory access right is read/write and executable.
*/
#define EPT_RWX (EPT_RD | EPT_WR | EPT_EXE)
/**
* @}
*/
/* End of ept_mem_access_right */
/**
* @defgroup ept_mem_type EPT Memory Type
*
* This is a group that includes EPT Memory Type Definitions.
*
* @{
*/
/**
* @brief EPT memory type is specified in bits 5:3 of the EPT paging-structure entry.
*/
#define EPT_MT_SHIFT 3U
/**
* @brief EPT memory type is uncacheable.
*/
#define EPT_UNCACHED (0UL << EPT_MT_SHIFT)
/**
* @brief EPT memory type is write combining.
*/
#define EPT_WC (1UL << EPT_MT_SHIFT)
/**
* @brief EPT memory type is write through.
*/
#define EPT_WT (4UL << EPT_MT_SHIFT)
/**
* @brief EPT memory type is write protected.
*/
#define EPT_WP (5UL << EPT_MT_SHIFT)
/**
* @brief EPT memory type is write back.
*/
#define EPT_WB (6UL << EPT_MT_SHIFT)
/**
* @}
*/
/* End of ept_mem_type */
#define EPT_MT_MASK (7UL << EPT_MT_SHIFT)
/* VTD: Second-Level Paging Entries: Snoop Control */
#define EPT_SNOOP_CTRL (1UL << 11U)
#define EPT_VE (1UL << 63U)
#define EPT_RWX (EPT_RD | EPT_WR | EPT_EXE)
#define PML4E_SHIFT 39U
#define PTRS_PER_PML4E 512UL
#define PML4E_SIZE (1UL << PML4E_SHIFT)