dm: mmio_dev: add mmio device pass through support

We could add MMIO device pass through by two ways:
a) If the MMIO device only has MMIO regions and no ACPI Table touched, using
"--mmiodev_pt MMIO_regions",
b) If the MMIO device touches ACPI Table, using "--acpidev_pt HID"

Now only support TPM2 MSFT0101 MMIO device pass through through launch script
using "--acpidev_pt MSFT0101". When we want to pass through the TPM2 deivce,
we would not allow to emulate the vTPM2 at the same time. This is becuase
the ACRN-DM emulate the TPM2 as MSFT0101 too. Otherwise, the VM can't boot.

Besides, we could only support one TPM2 device PT and one MMIO device PT.
For TPM2 device PT, the MMIO resources are hard-coded. For the MMIO device PT,
we could pass through the MMIO resources on the cmdline.

ToDo:
1. We may use HID to discover the MMIO regions and ACPI Table instaed of
hard-coded.
2. To identify a MMIO device only by MMIO regions.
3. To allocate virtual MMIO regions in a reserved guest MMIO regions.

Tracked-On: #5053
Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
Li Fei1
2020-07-23 11:24:11 +08:00
committed by wenlingz
parent 158f3d17a2
commit f13d5c25b6
7 changed files with 237 additions and 7 deletions

View File

@@ -48,6 +48,7 @@ extern bool stdio_in_use;
extern char *mac_seed;
extern bool lapic_pt;
extern bool is_rtvm;
extern bool pt_tpm2;
extern bool is_winvm;
int vmexit_task_switch(struct vmctx *ctx, struct vhm_request *vhm_req,

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2020 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _MMIO_DEV_H_
#define _MMIO_DEV_H_
int parse_pt_acpidev(char *arg);
int parse_pt_mmiodev(char *arg);
int init_mmio_devs(struct vmctx *ctx);
int deinit_mmio_devs(struct vmctx *ctx);
#endif /* _MMIO_DEV_H_ */

View File

@@ -9,7 +9,7 @@
#define _TPM_H_
#define TPM_CRB_MMIO_ADDR 0xFED40000UL
#define TPM_CRB_MMIO_SIZE 0x1000U
#define TPM_CRB_MMIO_SIZE 0x5000U
/* TPM CRB registers */
enum {