mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 02:06:49 +07:00
d5d8184d35
This commit introduces the framework for guest memory management through the use of 2nd stage translation. Each VM has a pointer to a level-1 table (the pgd field in struct kvm_arch) which is used for the 2nd stage translations. Entries are added when handling guest faults (later patch) and the table itself can be allocated and freed through the following functions implemented in arch/arm/kvm/arm_mmu.c: - kvm_alloc_stage2_pgd(struct kvm *kvm); - kvm_free_stage2_pgd(struct kvm *kvm); Each entry in TLBs and caches are tagged with a VMID identifier in addition to ASIDs. The VMIDs are assigned consecutively to VMs in the order that VMs are executed, and caches and tlbs are invalidated when the VMID space has been used to allow for more than 255 simultaenously running guests. The 2nd stage pgd is allocated in kvm_arch_init_vm(). The table is freed in kvm_arch_destroy_vm(). Both functions are called from the main KVM code. We pre-allocate page table memory to be able to synchronize using a spinlock and be called under rcu_read_lock from the MMU notifiers. We steal the mmu_memory_cache implementation from x86 and adapt for our specific usage. We support MMU notifiers (thanks to Marc Zyngier) through kvm_unmap_hva and kvm_set_spte_hva. Finally, define kvm_phys_addr_ioremap() to map a device at a guest IPA, which is used by VGIC support to map the virtual CPU interface registers to the guest. This support is added by Marc Zyngier. Reviewed-by: Will Deacon <will.deacon@arm.com> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
#
|
|
# KVM configuration
|
|
#
|
|
|
|
source "virt/kvm/Kconfig"
|
|
|
|
menuconfig VIRTUALIZATION
|
|
bool "Virtualization"
|
|
---help---
|
|
Say Y here to get to see options for using your Linux host to run
|
|
other operating systems inside virtual machines (guests).
|
|
This option alone does not add any kernel code.
|
|
|
|
If you say N, all options in this submenu will be skipped and
|
|
disabled.
|
|
|
|
if VIRTUALIZATION
|
|
|
|
config KVM
|
|
bool "Kernel-based Virtual Machine (KVM) support"
|
|
select PREEMPT_NOTIFIERS
|
|
select ANON_INODES
|
|
select KVM_MMIO
|
|
select KVM_ARM_HOST
|
|
depends on ARM_VIRT_EXT && ARM_LPAE
|
|
---help---
|
|
Support hosting virtualized guest machines. You will also
|
|
need to select one or more of the processor modules below.
|
|
|
|
This module provides access to the hardware capabilities through
|
|
a character device node named /dev/kvm.
|
|
|
|
If unsure, say N.
|
|
|
|
config KVM_ARM_HOST
|
|
bool "KVM host support for ARM cpus."
|
|
depends on KVM
|
|
depends on MMU
|
|
select MMU_NOTIFIER
|
|
---help---
|
|
Provides host support for ARM processors.
|
|
|
|
config KVM_ARM_MAX_VCPUS
|
|
int "Number maximum supported virtual CPUs per VM"
|
|
depends on KVM_ARM_HOST
|
|
default 4
|
|
help
|
|
Static number of max supported virtual CPUs per VM.
|
|
|
|
If you choose a high number, the vcpu structures will be quite
|
|
large, so only choose a reasonable number that you expect to
|
|
actually use.
|
|
|
|
source drivers/virtio/Kconfig
|
|
|
|
endif # VIRTUALIZATION
|