mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 09:17:58 +00:00
HV: vuart: refine vuart config
Add vuart config in acrn_vm_config struct, support configuring 2 vuarts for each VM. The first vuart is used to work as VM's console. The second vuart is used to connect to other VM's vuart. When the port base for a vuart is set to 0, hypervisor will not create this vuart. Tracked-On: #2987 Signed-off-by: Victor Sun <victor.sun@intel.com> Signed-off-by: Conghui Chen <conghui.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
1234f4f7b1
commit
3c92d7bbc7
@@ -15,6 +15,7 @@
|
||||
#include <vm_configurations.h>
|
||||
|
||||
#define PLUG_CPU(n) (1U << (n))
|
||||
#define MAX_VUART_NUM_PER_VM 2U
|
||||
|
||||
/*
|
||||
* PRE_LAUNCHED_VM is launched by ACRN hypervisor, with LAPIC_PT;
|
||||
@@ -33,6 +34,32 @@ struct acrn_vm_mem_config {
|
||||
uint64_t size; /* VM memory size configuration */
|
||||
};
|
||||
|
||||
struct target_vuart {
|
||||
uint8_t vm_id; /* target VM id */
|
||||
uint8_t vuart_id; /* target vuart index in a VM */
|
||||
};
|
||||
|
||||
enum vuart_type {
|
||||
VUART_LEGACY_PIO = 0, /* legacy PIO vuart */
|
||||
VUART_PCI, /* PCI vuart, may removed */
|
||||
};
|
||||
|
||||
union vuart_addr {
|
||||
uint16_t port_base; /* addr for legacy type */
|
||||
struct { /* addr for pci type */
|
||||
uint8_t f : 3; /* BITs 0-2 */
|
||||
uint8_t d : 5; /* BITs 3-7 */
|
||||
uint8_t b; /* BITs 8-15 */
|
||||
} bdf;
|
||||
};
|
||||
|
||||
struct vuart_config {
|
||||
enum vuart_type type; /* legacy PIO or PCI */
|
||||
union vuart_addr addr; /* port addr if in legacy type, or bdf addr if in pci type */
|
||||
uint16_t irq;
|
||||
struct target_vuart t_vuart; /* target vuart */
|
||||
} __aligned(8);
|
||||
|
||||
struct acrn_vm_os_config {
|
||||
char name[MAX_VM_OS_NAME_LEN]; /* OS name, useful for debug */
|
||||
char bootargs[MAX_BOOTARGS_SIZE]; /* boot args/cmdline */
|
||||
@@ -62,6 +89,7 @@ struct acrn_vm_config {
|
||||
uint16_t clos; /* if guest_flags has GUEST_FLAG_CLOS_REQUIRED, then VM use this CLOS */
|
||||
|
||||
bool vm_vuart;
|
||||
struct vuart_config vuart[MAX_VUART_NUM_PER_VM];/* vuart configuration for VM */
|
||||
struct mptable_info *mptable; /* Pointer to mptable struct if VM type is pre-launched */
|
||||
} __aligned(8);
|
||||
|
||||
|
@@ -35,6 +35,17 @@
|
||||
#define RX_BUF_SIZE 256U
|
||||
#define TX_BUF_SIZE 8192U
|
||||
|
||||
#define COM1_BASE 0x3F8U
|
||||
#define COM2_BASE 0x2F8U
|
||||
#define COM3_BASE 0x3E8U
|
||||
#define COM4_BASE 0x2E8U
|
||||
#define INVALID_COM_BASE 0U
|
||||
|
||||
#define COM1_IRQ 4U
|
||||
#define COM2_IRQ 3U
|
||||
#define COM3_IRQ 6U
|
||||
#define COM4_IRQ 7U
|
||||
|
||||
struct fifo {
|
||||
char *buf;
|
||||
uint32_t rindex; /* index to read from */
|
||||
|
Reference in New Issue
Block a user