HV: refine location of platform_acpi_info header

platform_acpi_info.h should be BOARD specific so move the header file
to configs/$(CONFIG_BOARD)/ folder.

So the target acpi info file detect process is:

Compiler search for $(CONFIG_BOARD)_acpi_info.h under
hypervisor/arch/x86/$(CONFIG_BOARD)/ first (the file is supposed to be
generated by offline tool so it is not included in original source), if
found, then the file is the target acpi info file. If not and at the
same time the ENFORCE_VALIDATED_ACPI_INFO Kconfig was set, the compiler
will stop and hint user to add target acpi info file by offline tool.
If ENFORCE_VALIDATED_ACPI_INFO was unset, then compiler will continue to
search for platform_acpi_info.h as target acpi info file under
hypervisor/arch/x86/$(CONFIG_BOARD) folder (with this file we could bypass
ENFORCE_VALIDATED_ACPI_INFO check and benifit for development). If this
file is not exist, then hypervisor/arch/x86/configs/platform_acpi_info.h
will be included as final target acpi info.

The process should work for UEFI path also, with a valid platform acpi
info file, S3/S5 should work on UEFI platform.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun 2019-03-05 11:21:54 +08:00 committed by ACRN System Integration
parent ff9ef2a19d
commit 649406b049
8 changed files with 98 additions and 30 deletions

View File

@ -231,7 +231,6 @@ INCLUDE_PATH += bsp/include/uefi
C_SRCS += bsp/uefi/uefi.c
C_SRCS += bsp/uefi/cmdline.c
C_SRCS += boot/uefi/uefi_boot.c
TEMPLATE_ACPI_INFO_HEADER := bsp/include/uefi/platform_acpi_info.h
else
ifeq ($(CONFIG_PLATFORM_SBL),y)
C_SRCS += bsp/sbl/sbl.c
@ -239,7 +238,6 @@ C_SRCS += bsp/sbl/const_dmar.c
C_SRCS += boot/sbl/multiboot.c
C_SRCS += boot/sbl/sbl_seed_parse.c
C_SRCS += boot/sbl/abl_seed_parse.c
TEMPLATE_ACPI_INFO_HEADER := bsp/include/sbl/platform_acpi_info.h
endif
endif
@ -266,7 +264,9 @@ DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
VERSION := $(HV_OBJDIR)/include/version.h
# Create platform_acpi_info.h
SOURCE_ACPI_INFO_HEADER := bsp/include/$(CONFIG_BOARD)_acpi_info.h
TEMPLATE_ACPI_INFO_HEADER := arch/x86/configs/platform_acpi_info.h
BOARDTEMPLATE_ACPI_INFO_HEADER := arch/x86/configs/$(CONFIG_BOARD)/platform_acpi_info.h
SOURCE_ACPI_INFO_HEADER := arch/x86/configs/$(CONFIG_BOARD)/$(CONFIG_BOARD)_acpi_info.h
TARGET_ACPI_INFO_HEADER := $(HV_OBJDIR)/include/platform_acpi_info.h
$(TARGET_ACPI_INFO_HEADER): $(HV_OBJDIR)/$(HV_CONFIG)
@ -282,11 +282,16 @@ ifdef CONFIG_ENFORCE_VALIDATED_ACPI_INFO
echo "If you want to build the hypervisor with the template ACPI info," && \
echo "unset ENFORCE_VALIDATED_ACPI_INFO using 'make menuconfig'." && \
false
else
else ifeq (,$(wildcard $(BOARDTEMPLATE_ACPI_INFO_HEADER)))
@echo "" && \
echo "Using the template at $(TEMPLATE_ACPI_INFO_HEADER) instead" && \
echo "**********************************"
@cp $(TEMPLATE_ACPI_INFO_HEADER) $(TARGET_ACPI_INFO_HEADER)
else
@echo "" && \
echo "Using the template at $(BOARDTEMPLATE_ACPI_INFO_HEADER) instead" && \
echo "**********************************"
@cp $(BOARDTEMPLATE_ACPI_INFO_HEADER) $(TARGET_ACPI_INFO_HEADER)
endif
else
@cp $(SOURCE_ACPI_INFO_HEADER) $(TARGET_ACPI_INFO_HEADER)

View File

@ -4,8 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
/* This is a template header file for platform ACPI info definition,
* we should use a user space tool running on target to generate this file.
/* This is a template header file for apl-mrb platform ACPI info definition,
* we should use a user space tool running on target to generate apl-mrb
* specific acpi info file named as apl-mrb_acpi_info.h
* and put it in hypervisor/arch/x86/configs/apl-mrb/.
*/
#ifndef PLATFORM_ACPI_INFO_H
#define PLATFORM_ACPI_INFO_H

View File

@ -0,0 +1,83 @@
/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* This is a template header file for platform ACPI info definition,
* we should use a user space tool running on target to generate
* board specific acpi info file named as $(CONFIG_BOARD)_acpi_info.h
* and put it in hypervisor/arch/x86/configs/$(CONFIG_BOARD)/.
*/
#ifndef PLATFORM_ACPI_INFO_H
#define PLATFORM_ACPI_INFO_H
/* pm sstate data */
#define PM1A_EVT_ACCESS_SIZE 0U
#define PM1A_EVT_ADDRESS 0UL
#define PM1A_CNT_ADDRESS 0UL
#define WAKE_VECTOR_32 0UL
#define WAKE_VECTOR_64 0UL
/* DRHD of DMAR */
#define DRHD_COUNT 0U
#define DRHD0_DEV_CNT 0U
#define DRHD0_SEGMENT 0U
#define DRHD0_FLAGS 0U
#define DRHD0_REG_BASE 0UL
#define DRHD0_IGNORE false
#define DRHD0_DEVSCOPE0_BUS 0U
#define DRHD0_DEVSCOPE0_PATH 0U
#define DRHD0_DEVSCOPE1_BUS 0U
#define DRHD0_DEVSCOPE1_PATH 0U
#define DRHD0_DEVSCOPE2_BUS 0U
#define DRHD0_DEVSCOPE2_PATH 0U
#define DRHD0_DEVSCOPE3_BUS 0U
#define DRHD0_DEVSCOPE3_PATH 0U
#define DRHD1_DEV_CNT 0U
#define DRHD1_SEGMENT 0U
#define DRHD1_FLAGS 0U
#define DRHD1_REG_BASE 0UL
#define DRHD1_IGNORE false
#define DRHD1_DEVSCOPE0_BUS 0U
#define DRHD1_DEVSCOPE0_PATH 0U
#define DRHD1_DEVSCOPE1_BUS 0U
#define DRHD1_DEVSCOPE1_PATH 0U
#define DRHD1_DEVSCOPE2_BUS 0U
#define DRHD1_DEVSCOPE2_PATH 0U
#define DRHD1_DEVSCOPE3_BUS 0U
#define DRHD1_DEVSCOPE3_PATH 0U
#define DRHD1_IOAPIC_ID 0U
#define DRHD2_DEV_CNT 0U
#define DRHD2_SEGMENT 0U
#define DRHD2_FLAGS 0U
#define DRHD2_REG_BASE 0U
#define DRHD2_IGNORE false
#define DRHD2_DEVSCOPE0_BUS 0U
#define DRHD2_DEVSCOPE0_PATH 0U
#define DRHD2_DEVSCOPE1_BUS 0U
#define DRHD2_DEVSCOPE1_PATH 0U
#define DRHD2_DEVSCOPE2_BUS 0U
#define DRHD2_DEVSCOPE2_PATH 0U
#define DRHD2_DEVSCOPE3_BUS 0U
#define DRHD2_DEVSCOPE3_PATH 0U
#define DRHD3_DEV_CNT 0U
#define DRHD3_SEGMENT 0U
#define DRHD3_FLAGS 0U
#define DRHD3_REG_BASE 0U
#define DRHD3_IGNORE false
#define DRHD3_DEVSCOPE0_BUS 0U
#define DRHD3_DEVSCOPE0_PATH 0U
#define DRHD3_DEVSCOPE1_BUS 0U
#define DRHD3_DEVSCOPE1_PATH 0U
#define DRHD3_DEVSCOPE2_BUS 0U
#define DRHD3_DEVSCOPE2_PATH 0U
#define DRHD3_DEVSCOPE3_BUS 0U
#define DRHD3_DEVSCOPE3_PATH 0U
#endif /* PLATFORM_ACPI_INFO_H */

View File

@ -9,6 +9,7 @@
#include <vm.h>
#include <io.h>
#include <logmsg.h>
#include <platform_acpi_info.h>
int32_t validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl)
{

View File

@ -18,9 +18,6 @@
#ifndef BSP_EXTERN_H
#define BSP_EXTERN_H
#include "default_acpi_info.h"
#include "platform_acpi_info.h"
/* BSP Interfaces */
void init_bsp(void);
uint64_t bsp_get_ap_trampoline(void);

View File

@ -1,21 +0,0 @@
/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* This is a template header file for platform ACPI info definition,
* we should use a user space tool running on target to generate this file.
*/
#ifndef PLATFORM_ACPI_INFO_H
#define PLATFORM_ACPI_INFO_H
/* pm sstate data */
#define PM1A_EVT_ACCESS_SIZE 0U
#define PM1A_EVT_ADDRESS 0UL
#define PM1A_CNT_ADDRESS 0UL
#define WAKE_VECTOR_32 0UL
#define WAKE_VECTOR_64 0UL
#endif /* PLATFORM_ACPI_INFO_H */

View File

@ -6,6 +6,7 @@
#include <hypervisor.h>
#include <vtd.h>
#include <platform_acpi_info.h>
#ifndef CONFIG_DMAR_PARSE_ENABLED