mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 09:17:58 +00:00
HV: move dmar info definition to board.c
The DMAR info is board specific so move the structure definition to board.c. As a configruation file, the whole board.c could be generated by acrn-config tool for each board. Please note we only provide DMAR info MACROs for nuc7i7dnb board. For other boards, ACPI_PARSE_ENABLED must be set to y in Kconfig to let hypervisor parse DMAR info, or use acrn-config tool to generate DMAR info MACROs if user won't enable ACPI parse code for FuSa consideration. The patch also moves the function of get_dmar_info() to vtd.c, so dmar_info.c could be removed. Tracked-On: #3977 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -5,7 +5,14 @@
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include <vtd.h>
|
||||
|
||||
#ifndef CONFIG_ACPI_PARSE_ENABLED
|
||||
#error "DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \
|
||||
Or use acrn-config tool to generate platform DMAR info."
|
||||
#endif
|
||||
|
||||
struct dmar_info plat_dmar_info;
|
||||
struct platform_clos_info platform_clos_array[0];
|
||||
uint16_t platform_clos_num = 0;
|
||||
const struct cpu_state_table board_cpu_state_tbl;
|
||||
|
@@ -6,6 +6,14 @@
|
||||
|
||||
#include <board.h>
|
||||
#include <msr.h>
|
||||
#include <vtd.h>
|
||||
|
||||
#ifndef CONFIG_ACPI_PARSE_ENABLED
|
||||
#error "DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \
|
||||
Or use acrn-config tool to generate platform DMAR info."
|
||||
#endif
|
||||
|
||||
struct dmar_info plat_dmar_info;
|
||||
|
||||
struct platform_clos_info platform_clos_array[4] = {
|
||||
{
|
||||
|
@@ -5,7 +5,14 @@
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include <vtd.h>
|
||||
|
||||
#ifndef CONFIG_ACPI_PARSE_ENABLED
|
||||
#error "DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \
|
||||
Or use acrn-config tool to generate platform DMAR info."
|
||||
#endif
|
||||
|
||||
struct dmar_info plat_dmar_info;
|
||||
struct platform_clos_info platform_clos_array[0];
|
||||
uint16_t platform_clos_num = 0;
|
||||
const struct cpu_state_table board_cpu_state_tbl;
|
||||
|
@@ -5,7 +5,14 @@
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include <vtd.h>
|
||||
|
||||
#ifndef CONFIG_ACPI_PARSE_ENABLED
|
||||
#error "DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \
|
||||
Or use acrn-config tool to generate platform DMAR info."
|
||||
#endif
|
||||
|
||||
struct dmar_info plat_dmar_info;
|
||||
struct platform_clos_info platform_clos_array[0];
|
||||
uint16_t platform_clos_num = 0;
|
||||
const struct cpu_state_table board_cpu_state_tbl;
|
||||
|
@@ -5,6 +5,13 @@
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include <vtd.h>
|
||||
|
||||
#ifndef CONFIG_ACPI_PARSE_ENABLED
|
||||
#error "DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \
|
||||
Or use acrn-config tool to generate platform DMAR info."
|
||||
#endif
|
||||
|
||||
struct dmar_info plat_dmar_info;
|
||||
struct platform_clos_info platform_clos_array[0];
|
||||
uint16_t platform_clos_num = 0;
|
||||
|
@@ -5,7 +5,14 @@
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include <vtd.h>
|
||||
|
||||
#ifndef CONFIG_ACPI_PARSE_ENABLED
|
||||
#error "DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \
|
||||
Or use acrn-config tool to generate platform DMAR info."
|
||||
#endif
|
||||
|
||||
struct dmar_info plat_dmar_info;
|
||||
struct platform_clos_info platform_clos_array[0];
|
||||
uint16_t platform_clos_num = 0;
|
||||
const struct cpu_state_table board_cpu_state_tbl;
|
||||
|
@@ -5,6 +5,55 @@
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include <vtd.h>
|
||||
|
||||
static struct dmar_dev_scope drhd0_dev_scope[DRHD0_DEV_CNT] = {
|
||||
{
|
||||
.type = DRHD0_DEVSCOPE0_TYPE,
|
||||
.id = DRHD0_DEVSCOPE0_ID,
|
||||
.bus = DRHD0_DEVSCOPE0_BUS,
|
||||
.devfun = DRHD0_DEVSCOPE0_PATH
|
||||
},
|
||||
};
|
||||
|
||||
static struct dmar_dev_scope drhd1_dev_scope[DRHD1_DEV_CNT] = {
|
||||
{
|
||||
.type = DRHD1_DEVSCOPE0_TYPE,
|
||||
.id = DRHD1_DEVSCOPE0_ID,
|
||||
.bus = DRHD1_DEVSCOPE0_BUS,
|
||||
.devfun = DRHD1_DEVSCOPE0_PATH
|
||||
},
|
||||
{
|
||||
.type = DRHD1_DEVSCOPE1_TYPE,
|
||||
.id = DRHD1_DEVSCOPE1_ID,
|
||||
.bus = DRHD1_DEVSCOPE1_BUS,
|
||||
.devfun = DRHD1_DEVSCOPE1_PATH
|
||||
},
|
||||
};
|
||||
|
||||
static struct dmar_drhd drhd_info_array[DRHD_COUNT] = {
|
||||
{
|
||||
.dev_cnt = DRHD0_DEV_CNT,
|
||||
.segment = DRHD0_SEGMENT,
|
||||
.flags = DRHD0_FLAGS,
|
||||
.reg_base_addr = DRHD0_REG_BASE,
|
||||
.ignore = DRHD0_IGNORE,
|
||||
.devices = drhd0_dev_scope
|
||||
},
|
||||
{
|
||||
.dev_cnt = DRHD1_DEV_CNT,
|
||||
.segment = DRHD1_SEGMENT,
|
||||
.flags = DRHD1_FLAGS,
|
||||
.reg_base_addr = DRHD1_REG_BASE,
|
||||
.ignore = DRHD1_IGNORE,
|
||||
.devices = drhd1_dev_scope
|
||||
},
|
||||
};
|
||||
|
||||
struct dmar_info plat_dmar_info = {
|
||||
.drhd_count = DRHD_COUNT,
|
||||
.drhd_units = drhd_info_array,
|
||||
};
|
||||
|
||||
struct platform_clos_info platform_clos_array[0];
|
||||
uint16_t platform_clos_num = 0;
|
||||
|
@@ -43,61 +43,28 @@
|
||||
|
||||
#define DRHD_COUNT 2U
|
||||
|
||||
#define DRHD0_DEV_CNT 1U
|
||||
#define DRHD0_SEGMENT 0U
|
||||
#define DRHD0_FLAGS 0U
|
||||
#define DRHD0_DEV_CNT 0x1U
|
||||
#define DRHD0_SEGMENT 0x0U
|
||||
#define DRHD0_FLAGS 0x0U
|
||||
#define DRHD0_REG_BASE 0xFED90000UL
|
||||
#define DRHD0_IGNORE false
|
||||
#define DRHD0_IGNORE true
|
||||
#define DRHD0_DEVSCOPE0_TYPE 0x1U
|
||||
#define DRHD0_DEVSCOPE0_ID 0x0U
|
||||
#define DRHD0_DEVSCOPE0_BUS 0x0U
|
||||
#define DRHD0_DEVSCOPE0_PATH 0x10U
|
||||
#define DRHD0_DEVSCOPE1_BUS 0x0U
|
||||
#define DRHD0_DEVSCOPE1_PATH 0x0U
|
||||
#define DRHD0_DEVSCOPE2_BUS 0x0U
|
||||
#define DRHD0_DEVSCOPE2_PATH 0x0U
|
||||
#define DRHD0_DEVSCOPE3_BUS 0x0U
|
||||
#define DRHD0_DEVSCOPE3_PATH 0x0U
|
||||
|
||||
#define DRHD1_DEV_CNT 2U
|
||||
#define DRHD1_SEGMENT 0U
|
||||
#define DRHD1_FLAGS 1U
|
||||
#define DRHD1_DEV_CNT 0x2U
|
||||
#define DRHD1_SEGMENT 0x0U
|
||||
#define DRHD1_FLAGS 0x1U
|
||||
#define DRHD1_REG_BASE 0xFED91000UL
|
||||
#define DRHD1_IGNORE false
|
||||
#define DRHD1_DEVSCOPE0_TYPE 0x3U
|
||||
#define DRHD1_DEVSCOPE0_ID 0x2U
|
||||
#define DRHD1_DEVSCOPE0_BUS 0xf0U
|
||||
#define DRHD1_DEVSCOPE0_PATH 0xf8U
|
||||
#define DRHD1_DEVSCOPE1_TYPE 0x4U
|
||||
#define DRHD1_DEVSCOPE1_ID 0x0U
|
||||
#define DRHD1_DEVSCOPE1_BUS 0x0U
|
||||
#define DRHD1_DEVSCOPE1_PATH 0xf8U
|
||||
#define DRHD1_DEVSCOPE2_BUS 0x0U
|
||||
#define DRHD1_DEVSCOPE2_PATH 0x0U
|
||||
#define DRHD1_DEVSCOPE3_BUS 0x0U
|
||||
#define DRHD1_DEVSCOPE3_PATH 0x0U
|
||||
#define DRHD1_IOAPIC_ID 2U
|
||||
|
||||
#define DRHD2_DEV_CNT 0U
|
||||
#define DRHD2_SEGMENT 0U
|
||||
#define DRHD2_FLAGS 0U
|
||||
#define DRHD2_REG_BASE 0x00UL
|
||||
#define DRHD2_IGNORE false
|
||||
#define DRHD2_DEVSCOPE0_BUS 0x0U
|
||||
#define DRHD2_DEVSCOPE0_PATH 0x0U
|
||||
#define DRHD2_DEVSCOPE1_BUS 0x0U
|
||||
#define DRHD2_DEVSCOPE1_PATH 0x0U
|
||||
#define DRHD2_DEVSCOPE2_BUS 0x0U
|
||||
#define DRHD2_DEVSCOPE2_PATH 0x0U
|
||||
#define DRHD2_DEVSCOPE3_BUS 0x0U
|
||||
#define DRHD2_DEVSCOPE3_PATH 0x0U
|
||||
|
||||
#define DRHD3_DEV_CNT 0U
|
||||
#define DRHD3_SEGMENT 0U
|
||||
#define DRHD3_FLAGS 0U
|
||||
#define DRHD3_REG_BASE 0x00UL
|
||||
#define DRHD3_IGNORE false
|
||||
#define DRHD3_DEVSCOPE0_BUS 0x0U
|
||||
#define DRHD3_DEVSCOPE0_PATH 0x0U
|
||||
#define DRHD3_DEVSCOPE1_BUS 0x0U
|
||||
#define DRHD3_DEVSCOPE1_PATH 0x0U
|
||||
#define DRHD3_DEVSCOPE2_BUS 0x0U
|
||||
#define DRHD3_DEVSCOPE2_PATH 0x0U
|
||||
#define DRHD3_DEVSCOPE3_BUS 0x0U
|
||||
#define DRHD3_DEVSCOPE3_PATH 0x0U
|
||||
|
||||
#endif /* PLATFORM_ACPI_INFO_H */
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <vtd.h>
|
||||
#include <timer.h>
|
||||
#include <logmsg.h>
|
||||
#include <board.h>
|
||||
#include <vm_configurations.h>
|
||||
|
||||
#define DBG_IOMMU 0
|
||||
@@ -1329,6 +1330,18 @@ void resume_iommu(void)
|
||||
do_action_for_iommus(dmar_resume);
|
||||
}
|
||||
|
||||
/**
|
||||
* @post return != NULL
|
||||
* @post return->drhd_count > 0U
|
||||
*/
|
||||
static struct dmar_info *get_dmar_info(void)
|
||||
{
|
||||
#ifdef CONFIG_ACPI_PARSE_ENABLED
|
||||
parse_dmar_table(&plat_dmar_info);
|
||||
#endif
|
||||
return &plat_dmar_info;
|
||||
}
|
||||
|
||||
int32_t init_iommu(void)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
|
Reference in New Issue
Block a user