mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 05:02:24 +00:00
HV: remove vm_config pointer in acrn_vm struct
For each vm_array[] item, its config is located in corresponding index of vm_configs[], so vm_config pointer is not needed any more. 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:
parent
7bf9b1be2c
commit
253b25937b
@ -2087,7 +2087,9 @@ static int32_t vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool w
|
|||||||
vlapic = vcpu_vlapic(vcpu);
|
vlapic = vcpu_vlapic(vcpu);
|
||||||
if (is_x2apic_enabled(vlapic)) {
|
if (is_x2apic_enabled(vlapic)) {
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
if (vcpu->vm->vm_config->lapic_pt) {
|
struct acrn_vm_config *vm_config = get_vm_config(vcpu->vm->vm_id);
|
||||||
|
|
||||||
|
if (vm_config->lapic_pt) {
|
||||||
if (msr == MSR_IA32_EXT_APIC_ICR) {
|
if (msr == MSR_IA32_EXT_APIC_ICR) {
|
||||||
error = vlapic_x2apic_pt_icr_access(vcpu->vm, *val);
|
error = vlapic_x2apic_pt_icr_access(vcpu->vm, *val);
|
||||||
}
|
}
|
||||||
|
@ -124,10 +124,6 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
|
|||||||
vm = &vm_array[vm_id];
|
vm = &vm_array[vm_id];
|
||||||
(void)memset((void *)vm, 0U, sizeof(struct acrn_vm));
|
(void)memset((void *)vm, 0U, sizeof(struct acrn_vm));
|
||||||
vm->vm_id = vm_id;
|
vm->vm_id = vm_id;
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
|
||||||
/* Map Virtual Machine to its VM Description */
|
|
||||||
vm->vm_config = vm_config;
|
|
||||||
#endif
|
|
||||||
vm->hw.created_vcpus = 0U;
|
vm->hw.created_vcpus = 0U;
|
||||||
vm->emul_mmio_regions = 0U;
|
vm->emul_mmio_regions = 0U;
|
||||||
vm->snoopy_mem = true;
|
vm->snoopy_mem = true;
|
||||||
|
@ -574,7 +574,9 @@ void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu)
|
|||||||
void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu)
|
void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
uint32_t value32;
|
uint32_t value32;
|
||||||
if(vcpu->vm->vm_config->lapic_pt) {
|
struct acrn_vm_config *vm_config = get_vm_config(vcpu->vm->vm_id);
|
||||||
|
|
||||||
|
if(vm_config->lapic_pt) {
|
||||||
/*
|
/*
|
||||||
* Disable external interrupt exiting and irq ack
|
* Disable external interrupt exiting and irq ack
|
||||||
* Disable posted interrupt processing
|
* Disable posted interrupt processing
|
||||||
|
@ -21,6 +21,7 @@ int32_t init_vm_boot_info(struct acrn_vm *vm)
|
|||||||
{
|
{
|
||||||
struct multiboot_module *mods = NULL;
|
struct multiboot_module *mods = NULL;
|
||||||
struct multiboot_info *mbi = NULL;
|
struct multiboot_info *mbi = NULL;
|
||||||
|
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||||
int32_t ret = -EINVAL;
|
int32_t ret = -EINVAL;
|
||||||
|
|
||||||
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) {
|
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) {
|
||||||
@ -48,9 +49,9 @@ int32_t init_vm_boot_info(struct acrn_vm *vm)
|
|||||||
vm->sw.kernel_info.kernel_src_addr = hpa2hva((uint64_t)mods[0].mm_mod_start);
|
vm->sw.kernel_info.kernel_src_addr = hpa2hva((uint64_t)mods[0].mm_mod_start);
|
||||||
vm->sw.kernel_info.kernel_size = mods[0].mm_mod_end - mods[0].mm_mod_start;
|
vm->sw.kernel_info.kernel_size = mods[0].mm_mod_end - mods[0].mm_mod_start;
|
||||||
vm->sw.kernel_info.kernel_load_addr = (void *)(16 * 1024 * 1024UL);
|
vm->sw.kernel_info.kernel_load_addr = (void *)(16 * 1024 * 1024UL);
|
||||||
vm->sw.linux_info.bootargs_src_addr = (void *)vm->vm_config->bootargs;
|
vm->sw.linux_info.bootargs_src_addr = (void *)vm_config->bootargs;
|
||||||
vm->sw.linux_info.bootargs_size = strnlen_s(vm->vm_config->bootargs, MEM_2K);
|
vm->sw.linux_info.bootargs_size = strnlen_s(vm_config->bootargs, MEM_2K);
|
||||||
vm->sw.linux_info.bootargs_load_addr = (void *)(vm->vm_config->mem_size - 8*1024UL);
|
vm->sw.linux_info.bootargs_load_addr = (void *)(vm_config->mem_size - 8*1024UL);
|
||||||
clac();
|
clac();
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
@ -809,7 +809,7 @@ static int32_t shell_to_sos_console(__unused int32_t argc, __unused char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
vm_config = vm->vm_config;
|
vm_config = get_vm_config(guest_no);
|
||||||
if (vm_config != NULL && vm_config->vm_vuart == false) {
|
if (vm_config != NULL && vm_config->vm_vuart == false) {
|
||||||
snprintf(temp_str, TEMP_STR_SIZE, "No vUART configured for vm%d\n", guest_no);
|
snprintf(temp_str, TEMP_STR_SIZE, "No vUART configured for vm%d\n", guest_no);
|
||||||
shell_puts(temp_str);
|
shell_puts(temp_str);
|
||||||
|
@ -36,9 +36,10 @@ static struct pci_vdev *partition_mode_find_vdev(struct acrn_vpci *vpci, union p
|
|||||||
{
|
{
|
||||||
struct vpci_vdev_array *vdev_array;
|
struct vpci_vdev_array *vdev_array;
|
||||||
struct pci_vdev *vdev;
|
struct pci_vdev *vdev;
|
||||||
|
struct acrn_vm_config *vm_config = get_vm_config(vpci->vm->vm_id);
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
vdev_array = vpci->vm->vm_config->vpci_vdev_array;
|
vdev_array = vm_config->vpci_vdev_array;
|
||||||
for (i = 0; i < vdev_array->num_pci_vdev; i++) {
|
for (i = 0; i < vdev_array->num_pci_vdev; i++) {
|
||||||
vdev = &vdev_array->vpci_vdev_list[i];
|
vdev = &vdev_array->vpci_vdev_list[i];
|
||||||
if (vdev->vbdf.value == vbdf.value) {
|
if (vdev->vbdf.value == vbdf.value) {
|
||||||
@ -54,9 +55,10 @@ static int32_t partition_mode_vpci_init(const struct acrn_vm *vm)
|
|||||||
struct vpci_vdev_array *vdev_array;
|
struct vpci_vdev_array *vdev_array;
|
||||||
const struct acrn_vpci *vpci = &vm->vpci;
|
const struct acrn_vpci *vpci = &vm->vpci;
|
||||||
struct pci_vdev *vdev;
|
struct pci_vdev *vdev;
|
||||||
|
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
vdev_array = vm->vm_config->vpci_vdev_array;
|
vdev_array = vm_config->vpci_vdev_array;
|
||||||
|
|
||||||
for (i = 0; i < vdev_array->num_pci_vdev; i++) {
|
for (i = 0; i < vdev_array->num_pci_vdev; i++) {
|
||||||
vdev = &vdev_array->vpci_vdev_list[i];
|
vdev = &vdev_array->vpci_vdev_list[i];
|
||||||
@ -77,9 +79,10 @@ static void partition_mode_vpci_deinit(const struct acrn_vm *vm)
|
|||||||
{
|
{
|
||||||
struct vpci_vdev_array *vdev_array;
|
struct vpci_vdev_array *vdev_array;
|
||||||
struct pci_vdev *vdev;
|
struct pci_vdev *vdev;
|
||||||
|
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
vdev_array = vm->vm_config->vpci_vdev_array;
|
vdev_array = vm_config->vpci_vdev_array;
|
||||||
|
|
||||||
for (i = 0; i < vdev_array->num_pci_vdev; i++) {
|
for (i = 0; i < vdev_array->num_pci_vdev; i++) {
|
||||||
vdev = &vdev_array->vpci_vdev_list[i];
|
vdev = &vdev_array->vpci_vdev_list[i];
|
||||||
|
@ -157,7 +157,6 @@ struct acrn_vm {
|
|||||||
struct acrn_vpci vpci;
|
struct acrn_vpci vpci;
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
struct mptable_info mptable;
|
struct mptable_info mptable;
|
||||||
struct acrn_vm_config *vm_config;
|
|
||||||
uint8_t vrtc_offset;
|
uint8_t vrtc_offset;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user