vuart_config: separate vuart config from vm config file

Not add mmio vuart support now.

Tracked-On: #8805
Signed-off-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Fei Li
2025-09-23 19:29:14 +08:00
committed by acrnsi-robot
parent f3ab8291f4
commit df5a5f2657
3 changed files with 41 additions and 27 deletions

View File

@@ -16,6 +16,7 @@
#include <asm/sgx.h>
#include <acrn_hv_defs.h>
#include <schedule.h>
#include <vuart_config.h>
#define AFFINITY_CPU(n) (1UL << (n))
#define MAX_VCPUS_PER_VM MAX_PCPU_NUM
@@ -86,32 +87,6 @@ struct acrn_vm_mem_config {
struct vm_hpa_regions *host_regions;
};
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);
enum os_kernel_type {
KERNEL_BZIMAGE = 1,
KERNEL_RAWIMAGE,

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2025-2025 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef VUART_CONFIG_H_
#define VUART_CONFIG_H_
#include <types.h>
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);
#endif /* VUART_CONFIG_H_ */

View File

@@ -30,6 +30,7 @@
#define VUART_H
#include <types.h>
#include <spinlock.h>
#include <vuart_config.h>
#include <asm/vm_config.h>
/**
@@ -123,4 +124,4 @@ void vuart_write_reg(struct acrn_vuart *vu, uint16_t offset, uint8_t value);
/**
* @}
*/
*/