acrn-hypervisor/hypervisor/scenarios/logical_partition/pt_dev.c
dongshen 73cff9ef08 HV: predefine pci vbar's base address for pre-launched VMs in vm_config
For pre-launched VMs, currently we set all vbars to 0s initially in
bar emulation code, guest OS will reprogram the bars when it sees the bars are uninited (0s).
We consider this is not the right solution, change to populate the
vbars (to non zero valid pci hole address) based on the vbar base
addresses predefined in vm_config.

Store a pointer to acrn_vm_pci_ptdev_config in struct pci_vdev

Tracked-On: #3022
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-05-22 10:00:15 +08:00

47 lines
1017 B
C

/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <vm_config.h>
#include <pci_devices.h>
struct acrn_vm_pci_ptdev_config vm0_pci_ptdevs[VM0_CONFIG_PCI_PTDEV_NUM] = {
{
.vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x00U},
HOST_BRIDGE
},
{
.vbdf.bits = {.b = 0x00U, .d = 0x01U, .f = 0x00U},
.vbar[0] = 0xc0084000UL,
.vbar[1] = 0xc0086000UL,
.vbar[5] = 0xc0087000UL,
VM0_STORAGE_CONTROLLER
},
{
.vbdf.bits = {.b = 0x00U, .d = 0x02U, .f = 0x00U},
.vbar[0] = 0xc0000000UL,
.vbar[3] = 0xc0080000UL,
VM0_NETWORK_CONTROLLER
},
};
struct acrn_vm_pci_ptdev_config vm1_pci_ptdevs[VM1_CONFIG_PCI_PTDEV_NUM] = {
{
.vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x00U},
HOST_BRIDGE
},
{
.vbdf.bits = {.b = 0x00U, .d = 0x01U, .f = 0x00U},
.vbar[0] = 0xc0000000UL,
VM1_STORAGE_CONTROLLER
},
#if defined(VM1_NETWORK_CONTROLLER)
{
.vbdf.bits = {.b = 0x00U, .d = 0x02U, .f = 0x00U},
VM1_NETWORK_CONTROLLER
},
#endif
};