2008-04-17 12:28:09 +08:00
|
|
|
#
|
|
|
|
# Makefile for Kernel-based Virtual Machine module
|
|
|
|
#
|
|
|
|
|
2009-06-10 04:48:51 +08:00
|
|
|
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
|
|
|
|
|
2010-09-23 04:51:09 +08:00
|
|
|
ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
|
2013-05-14 21:31:02 +08:00
|
|
|
KVM := ../../../virt/kvm
|
2008-04-17 12:28:09 +08:00
|
|
|
|
2013-05-14 21:31:02 +08:00
|
|
|
common-objs-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \
|
|
|
|
$(KVM)/eventfd.o
|
2008-04-17 12:28:09 +08:00
|
|
|
|
2009-06-18 22:47:27 +08:00
|
|
|
CFLAGS_44x_tlb.o := -I.
|
2013-01-11 22:22:45 +08:00
|
|
|
CFLAGS_e500_mmu.o := -I.
|
|
|
|
CFLAGS_e500_mmu_host.o := -I.
|
2009-06-18 22:47:27 +08:00
|
|
|
CFLAGS_emulate.o := -I.
|
|
|
|
|
2009-10-30 13:47:24 +08:00
|
|
|
common-objs-y += powerpc.o emulate.o
|
2008-12-03 05:51:57 +08:00
|
|
|
obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
|
2010-04-16 06:11:41 +08:00
|
|
|
obj-$(CONFIG_KVM_BOOK3S_HANDLER) += book3s_exports.o
|
2008-04-17 12:28:09 +08:00
|
|
|
|
|
|
|
AFLAGS_booke_interrupts.o := -I$(obj)
|
|
|
|
|
2008-11-05 23:36:16 +08:00
|
|
|
kvm-440-objs := \
|
2009-10-30 13:47:24 +08:00
|
|
|
$(common-objs-y) \
|
2008-11-05 23:36:16 +08:00
|
|
|
booke.o \
|
2009-01-04 06:23:06 +08:00
|
|
|
booke_emulate.o \
|
2008-11-05 23:36:16 +08:00
|
|
|
booke_interrupts.o \
|
|
|
|
44x.o \
|
|
|
|
44x_tlb.o \
|
|
|
|
44x_emulate.o
|
2009-10-30 13:47:24 +08:00
|
|
|
kvm-objs-$(CONFIG_KVM_440) := $(kvm-440-objs)
|
2009-01-04 06:23:10 +08:00
|
|
|
|
|
|
|
kvm-e500-objs := \
|
2009-10-30 13:47:24 +08:00
|
|
|
$(common-objs-y) \
|
2009-01-04 06:23:10 +08:00
|
|
|
booke.o \
|
|
|
|
booke_emulate.o \
|
|
|
|
booke_interrupts.o \
|
|
|
|
e500.o \
|
2013-01-11 22:22:45 +08:00
|
|
|
e500_mmu.o \
|
|
|
|
e500_mmu_host.o \
|
2009-01-04 06:23:10 +08:00
|
|
|
e500_emulate.o
|
2012-02-16 07:40:00 +08:00
|
|
|
kvm-objs-$(CONFIG_KVM_E500V2) := $(kvm-e500-objs)
|
2009-10-30 13:47:24 +08:00
|
|
|
|
2011-12-20 23:34:47 +08:00
|
|
|
kvm-e500mc-objs := \
|
|
|
|
$(common-objs-y) \
|
|
|
|
booke.o \
|
|
|
|
booke_emulate.o \
|
|
|
|
bookehv_interrupts.o \
|
|
|
|
e500mc.o \
|
2013-01-11 22:22:45 +08:00
|
|
|
e500_mmu.o \
|
|
|
|
e500_mmu_host.o \
|
2011-12-20 23:34:47 +08:00
|
|
|
e500_emulate.o
|
|
|
|
kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs)
|
|
|
|
|
2013-10-08 00:47:50 +08:00
|
|
|
kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) := \
|
|
|
|
book3s_64_vio_hv.o
|
|
|
|
|
KVM: PPC: Add support for Book3S processors in hypervisor mode
This adds support for KVM running on 64-bit Book 3S processors,
specifically POWER7, in hypervisor mode. Using hypervisor mode means
that the guest can use the processor's supervisor mode. That means
that the guest can execute privileged instructions and access privileged
registers itself without trapping to the host. This gives excellent
performance, but does mean that KVM cannot emulate a processor
architecture other than the one that the hardware implements.
This code assumes that the guest is running paravirtualized using the
PAPR (Power Architecture Platform Requirements) interface, which is the
interface that IBM's PowerVM hypervisor uses. That means that existing
Linux distributions that run on IBM pSeries machines will also run
under KVM without modification. In order to communicate the PAPR
hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
to include/linux/kvm.h.
Currently the choice between book3s_hv support and book3s_pr support
(i.e. the existing code, which runs the guest in user mode) has to be
made at kernel configuration time, so a given kernel binary can only
do one or the other.
This new book3s_hv code doesn't support MMIO emulation at present.
Since we are running paravirtualized guests, this isn't a serious
restriction.
With the guest running in supervisor mode, most exceptions go straight
to the guest. We will never get data or instruction storage or segment
interrupts, alignment interrupts, decrementer interrupts, program
interrupts, single-step interrupts, etc., coming to the hypervisor from
the guest. Therefore this introduces a new KVMTEST_NONHV macro for the
exception entry path so that we don't have to do the KVM test on entry
to those exception handlers.
We do however get hypervisor decrementer, hypervisor data storage,
hypervisor instruction storage, and hypervisor emulation assist
interrupts, so we have to handle those.
In hypervisor mode, real-mode accesses can access all of RAM, not just
a limited amount. Therefore we put all the guest state in the vcpu.arch
and use the shadow_vcpu in the PACA only for temporary scratch space.
We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
We don't have a shared page with the guest, but we still need a
kvm_vcpu_arch_shared struct to store the values of various registers,
so we include one in the vcpu_arch struct.
The POWER7 processor has a restriction that all threads in a core have
to be in the same partition. MMU-on kernel code counts as a partition
(partition 0), so we have to do a partition switch on every entry to and
exit from the guest. At present we require the host and guest to run
in single-thread mode because of this hardware restriction.
This code allocates a hashed page table for the guest and initializes
it with HPTEs for the guest's Virtual Real Memory Area (VRMA). We
require that the guest memory is allocated using 16MB huge pages, in
order to simplify the low-level memory management. This also means that
we can get away without tracking paging activity in the host for now,
since huge pages can't be paged or swapped.
This also adds a few new exports needed by the book3s_hv code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:21:34 +08:00
|
|
|
kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_PR) := \
|
2010-02-19 18:00:40 +08:00
|
|
|
fpu.o \
|
2010-02-19 18:00:44 +08:00
|
|
|
book3s_paired_singles.o \
|
2011-06-29 08:17:58 +08:00
|
|
|
book3s_pr.o \
|
2011-08-08 23:21:15 +08:00
|
|
|
book3s_pr_papr.o \
|
2010-04-16 06:11:32 +08:00
|
|
|
book3s_emulate.o \
|
|
|
|
book3s_interrupts.o \
|
2010-06-30 21:18:46 +08:00
|
|
|
book3s_mmu_hpte.o \
|
2009-10-30 13:47:24 +08:00
|
|
|
book3s_64_mmu_host.o \
|
|
|
|
book3s_64_mmu.o \
|
|
|
|
book3s_32_mmu.o
|
2013-10-08 00:47:50 +08:00
|
|
|
|
2013-10-08 00:47:52 +08:00
|
|
|
ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
|
|
|
|
kvm-book3s_64-module-objs := \
|
|
|
|
$(KVM)/coalesced_mmio.o
|
|
|
|
|
|
|
|
kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
|
2011-07-23 15:41:11 +08:00
|
|
|
book3s_rmhandlers.o
|
2013-10-08 00:47:52 +08:00
|
|
|
endif
|
KVM: PPC: Add support for Book3S processors in hypervisor mode
This adds support for KVM running on 64-bit Book 3S processors,
specifically POWER7, in hypervisor mode. Using hypervisor mode means
that the guest can use the processor's supervisor mode. That means
that the guest can execute privileged instructions and access privileged
registers itself without trapping to the host. This gives excellent
performance, but does mean that KVM cannot emulate a processor
architecture other than the one that the hardware implements.
This code assumes that the guest is running paravirtualized using the
PAPR (Power Architecture Platform Requirements) interface, which is the
interface that IBM's PowerVM hypervisor uses. That means that existing
Linux distributions that run on IBM pSeries machines will also run
under KVM without modification. In order to communicate the PAPR
hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
to include/linux/kvm.h.
Currently the choice between book3s_hv support and book3s_pr support
(i.e. the existing code, which runs the guest in user mode) has to be
made at kernel configuration time, so a given kernel binary can only
do one or the other.
This new book3s_hv code doesn't support MMIO emulation at present.
Since we are running paravirtualized guests, this isn't a serious
restriction.
With the guest running in supervisor mode, most exceptions go straight
to the guest. We will never get data or instruction storage or segment
interrupts, alignment interrupts, decrementer interrupts, program
interrupts, single-step interrupts, etc., coming to the hypervisor from
the guest. Therefore this introduces a new KVMTEST_NONHV macro for the
exception entry path so that we don't have to do the KVM test on entry
to those exception handlers.
We do however get hypervisor decrementer, hypervisor data storage,
hypervisor instruction storage, and hypervisor emulation assist
interrupts, so we have to handle those.
In hypervisor mode, real-mode accesses can access all of RAM, not just
a limited amount. Therefore we put all the guest state in the vcpu.arch
and use the shadow_vcpu in the PACA only for temporary scratch space.
We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
We don't have a shared page with the guest, but we still need a
kvm_vcpu_arch_shared struct to store the values of various registers,
so we include one in the vcpu_arch struct.
The POWER7 processor has a restriction that all threads in a core have
to be in the same partition. MMU-on kernel code counts as a partition
(partition 0), so we have to do a partition switch on every entry to and
exit from the guest. At present we require the host and guest to run
in single-thread mode because of this hardware restriction.
This code allocates a hashed page table for the guest and initializes
it with HPTEs for the guest's Virtual Real Memory Area (VRMA). We
require that the guest memory is allocated using 16MB huge pages, in
order to simplify the low-level memory management. This also means that
we can get away without tracking paging activity in the host for now,
since huge pages can't be paged or swapped.
This also adds a few new exports needed by the book3s_hv code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:21:34 +08:00
|
|
|
|
2013-10-08 00:47:52 +08:00
|
|
|
kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_HV) += \
|
KVM: PPC: Add support for Book3S processors in hypervisor mode
This adds support for KVM running on 64-bit Book 3S processors,
specifically POWER7, in hypervisor mode. Using hypervisor mode means
that the guest can use the processor's supervisor mode. That means
that the guest can execute privileged instructions and access privileged
registers itself without trapping to the host. This gives excellent
performance, but does mean that KVM cannot emulate a processor
architecture other than the one that the hardware implements.
This code assumes that the guest is running paravirtualized using the
PAPR (Power Architecture Platform Requirements) interface, which is the
interface that IBM's PowerVM hypervisor uses. That means that existing
Linux distributions that run on IBM pSeries machines will also run
under KVM without modification. In order to communicate the PAPR
hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
to include/linux/kvm.h.
Currently the choice between book3s_hv support and book3s_pr support
(i.e. the existing code, which runs the guest in user mode) has to be
made at kernel configuration time, so a given kernel binary can only
do one or the other.
This new book3s_hv code doesn't support MMIO emulation at present.
Since we are running paravirtualized guests, this isn't a serious
restriction.
With the guest running in supervisor mode, most exceptions go straight
to the guest. We will never get data or instruction storage or segment
interrupts, alignment interrupts, decrementer interrupts, program
interrupts, single-step interrupts, etc., coming to the hypervisor from
the guest. Therefore this introduces a new KVMTEST_NONHV macro for the
exception entry path so that we don't have to do the KVM test on entry
to those exception handlers.
We do however get hypervisor decrementer, hypervisor data storage,
hypervisor instruction storage, and hypervisor emulation assist
interrupts, so we have to handle those.
In hypervisor mode, real-mode accesses can access all of RAM, not just
a limited amount. Therefore we put all the guest state in the vcpu.arch
and use the shadow_vcpu in the PACA only for temporary scratch space.
We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
We don't have a shared page with the guest, but we still need a
kvm_vcpu_arch_shared struct to store the values of various registers,
so we include one in the vcpu_arch struct.
The POWER7 processor has a restriction that all threads in a core have
to be in the same partition. MMU-on kernel code counts as a partition
(partition 0), so we have to do a partition switch on every entry to and
exit from the guest. At present we require the host and guest to run
in single-thread mode because of this hardware restriction.
This code allocates a hashed page table for the guest and initializes
it with HPTEs for the guest's Virtual Real Memory Area (VRMA). We
require that the guest memory is allocated using 16MB huge pages, in
order to simplify the low-level memory management. This also means that
we can get away without tracking paging activity in the host for now,
since huge pages can't be paged or swapped.
This also adds a few new exports needed by the book3s_hv code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:21:34 +08:00
|
|
|
book3s_hv.o \
|
|
|
|
book3s_hv_interrupts.o \
|
|
|
|
book3s_64_mmu_hv.o
|
2013-10-08 00:47:50 +08:00
|
|
|
|
2013-04-18 04:31:15 +08:00
|
|
|
kvm-book3s_64-builtin-xics-objs-$(CONFIG_KVM_XICS) := \
|
|
|
|
book3s_hv_rm_xics.o
|
2013-10-08 00:47:50 +08:00
|
|
|
|
|
|
|
kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HV) += \
|
2011-07-23 15:41:11 +08:00
|
|
|
book3s_hv_rmhandlers.o \
|
2011-06-29 08:22:41 +08:00
|
|
|
book3s_hv_rm_mmu.o \
|
KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking
Currently, if a machine check interrupt happens while we are in the
guest, we exit the guest and call the host's machine check handler,
which tends to cause the host to panic. Some machine checks can be
triggered by the guest; for example, if the guest creates two entries
in the SLB that map the same effective address, and then accesses that
effective address, the CPU will take a machine check interrupt.
To handle this better, when a machine check happens inside the guest,
we call a new function, kvmppc_realmode_machine_check(), while still in
real mode before exiting the guest. On POWER7, it handles the cases
that the guest can trigger, either by flushing and reloading the SLB,
or by flushing the TLB, and then it delivers the machine check interrupt
directly to the guest without going back to the host. On POWER7, the
OPAL firmware patches the machine check interrupt vector so that it
gets control first, and it leaves behind its analysis of the situation
in a structure pointed to by the opal_mc_evt field of the paca. The
kvmppc_realmode_machine_check() function looks at this, and if OPAL
reports that there was no error, or that it has handled the error, we
also go straight back to the guest with a machine check. We have to
deliver a machine check to the guest since the machine check interrupt
might have trashed valid values in SRR0/1.
If the machine check is one we can't handle in real mode, and one that
OPAL hasn't already handled, or on PPC970, we exit the guest and call
the host's machine check handler. We do this by jumping to the
machine_check_fwnmi label, rather than absolute address 0x200, because
we don't want to re-execute OPAL's handler on POWER7. On PPC970, the
two are equivalent because address 0x200 just contains a branch.
Then, if the host machine check handler decides that the system can
continue executing, kvmppc_handle_exit() delivers a machine check
interrupt to the guest -- once again to let the guest know that SRR0/1
have been modified.
Signed-off-by: Paul Mackerras <paulus@samba.org>
[agraf: fix checkpatch warnings]
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-24 06:37:50 +08:00
|
|
|
book3s_hv_ras.o \
|
2013-04-18 04:31:15 +08:00
|
|
|
book3s_hv_builtin.o \
|
2013-07-02 13:45:16 +08:00
|
|
|
book3s_hv_cma.o \
|
2013-04-18 04:31:15 +08:00
|
|
|
$(kvm-book3s_64-builtin-xics-objs-y)
|
KVM: PPC: Add support for Book3S processors in hypervisor mode
This adds support for KVM running on 64-bit Book 3S processors,
specifically POWER7, in hypervisor mode. Using hypervisor mode means
that the guest can use the processor's supervisor mode. That means
that the guest can execute privileged instructions and access privileged
registers itself without trapping to the host. This gives excellent
performance, but does mean that KVM cannot emulate a processor
architecture other than the one that the hardware implements.
This code assumes that the guest is running paravirtualized using the
PAPR (Power Architecture Platform Requirements) interface, which is the
interface that IBM's PowerVM hypervisor uses. That means that existing
Linux distributions that run on IBM pSeries machines will also run
under KVM without modification. In order to communicate the PAPR
hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
to include/linux/kvm.h.
Currently the choice between book3s_hv support and book3s_pr support
(i.e. the existing code, which runs the guest in user mode) has to be
made at kernel configuration time, so a given kernel binary can only
do one or the other.
This new book3s_hv code doesn't support MMIO emulation at present.
Since we are running paravirtualized guests, this isn't a serious
restriction.
With the guest running in supervisor mode, most exceptions go straight
to the guest. We will never get data or instruction storage or segment
interrupts, alignment interrupts, decrementer interrupts, program
interrupts, single-step interrupts, etc., coming to the hypervisor from
the guest. Therefore this introduces a new KVMTEST_NONHV macro for the
exception entry path so that we don't have to do the KVM test on entry
to those exception handlers.
We do however get hypervisor decrementer, hypervisor data storage,
hypervisor instruction storage, and hypervisor emulation assist
interrupts, so we have to handle those.
In hypervisor mode, real-mode accesses can access all of RAM, not just
a limited amount. Therefore we put all the guest state in the vcpu.arch
and use the shadow_vcpu in the PACA only for temporary scratch space.
We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
We don't have a shared page with the guest, but we still need a
kvm_vcpu_arch_shared struct to store the values of various registers,
so we include one in the vcpu_arch struct.
The POWER7 processor has a restriction that all threads in a core have
to be in the same partition. MMU-on kernel code counts as a partition
(partition 0), so we have to do a partition switch on every entry to and
exit from the guest. At present we require the host and guest to run
in single-thread mode because of this hardware restriction.
This code allocates a hashed page table for the guest and initializes
it with HPTEs for the guest's Virtual Real Memory Area (VRMA). We
require that the guest memory is allocated using 16MB huge pages, in
order to simplify the low-level memory management. This also means that
we can get away without tracking paging activity in the host for now,
since huge pages can't be paged or swapped.
This also adds a few new exports needed by the book3s_hv code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:21:34 +08:00
|
|
|
|
2013-04-18 04:30:26 +08:00
|
|
|
kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
|
|
|
|
book3s_xics.o
|
|
|
|
|
2013-10-08 00:47:52 +08:00
|
|
|
kvm-book3s_64-module-objs += \
|
2013-05-14 21:31:02 +08:00
|
|
|
$(KVM)/kvm_main.o \
|
|
|
|
$(KVM)/eventfd.o \
|
KVM: PPC: Add support for Book3S processors in hypervisor mode
This adds support for KVM running on 64-bit Book 3S processors,
specifically POWER7, in hypervisor mode. Using hypervisor mode means
that the guest can use the processor's supervisor mode. That means
that the guest can execute privileged instructions and access privileged
registers itself without trapping to the host. This gives excellent
performance, but does mean that KVM cannot emulate a processor
architecture other than the one that the hardware implements.
This code assumes that the guest is running paravirtualized using the
PAPR (Power Architecture Platform Requirements) interface, which is the
interface that IBM's PowerVM hypervisor uses. That means that existing
Linux distributions that run on IBM pSeries machines will also run
under KVM without modification. In order to communicate the PAPR
hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
to include/linux/kvm.h.
Currently the choice between book3s_hv support and book3s_pr support
(i.e. the existing code, which runs the guest in user mode) has to be
made at kernel configuration time, so a given kernel binary can only
do one or the other.
This new book3s_hv code doesn't support MMIO emulation at present.
Since we are running paravirtualized guests, this isn't a serious
restriction.
With the guest running in supervisor mode, most exceptions go straight
to the guest. We will never get data or instruction storage or segment
interrupts, alignment interrupts, decrementer interrupts, program
interrupts, single-step interrupts, etc., coming to the hypervisor from
the guest. Therefore this introduces a new KVMTEST_NONHV macro for the
exception entry path so that we don't have to do the KVM test on entry
to those exception handlers.
We do however get hypervisor decrementer, hypervisor data storage,
hypervisor instruction storage, and hypervisor emulation assist
interrupts, so we have to handle those.
In hypervisor mode, real-mode accesses can access all of RAM, not just
a limited amount. Therefore we put all the guest state in the vcpu.arch
and use the shadow_vcpu in the PACA only for temporary scratch space.
We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
We don't have a shared page with the guest, but we still need a
kvm_vcpu_arch_shared struct to store the values of various registers,
so we include one in the vcpu_arch struct.
The POWER7 processor has a restriction that all threads in a core have
to be in the same partition. MMU-on kernel code counts as a partition
(partition 0), so we have to do a partition switch on every entry to and
exit from the guest. At present we require the host and guest to run
in single-thread mode because of this hardware restriction.
This code allocates a hashed page table for the guest and initializes
it with HPTEs for the guest's Virtual Real Memory Area (VRMA). We
require that the guest memory is allocated using 16MB huge pages, in
order to simplify the low-level memory management. This also means that
we can get away without tracking paging activity in the host for now,
since huge pages can't be paged or swapped.
This also adds a few new exports needed by the book3s_hv code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:21:34 +08:00
|
|
|
powerpc.o \
|
|
|
|
emulate.o \
|
|
|
|
book3s.o \
|
2012-03-16 05:58:34 +08:00
|
|
|
book3s_64_vio.o \
|
2013-04-18 04:30:00 +08:00
|
|
|
book3s_rtas.o \
|
KVM: PPC: Add support for Book3S processors in hypervisor mode
This adds support for KVM running on 64-bit Book 3S processors,
specifically POWER7, in hypervisor mode. Using hypervisor mode means
that the guest can use the processor's supervisor mode. That means
that the guest can execute privileged instructions and access privileged
registers itself without trapping to the host. This gives excellent
performance, but does mean that KVM cannot emulate a processor
architecture other than the one that the hardware implements.
This code assumes that the guest is running paravirtualized using the
PAPR (Power Architecture Platform Requirements) interface, which is the
interface that IBM's PowerVM hypervisor uses. That means that existing
Linux distributions that run on IBM pSeries machines will also run
under KVM without modification. In order to communicate the PAPR
hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
to include/linux/kvm.h.
Currently the choice between book3s_hv support and book3s_pr support
(i.e. the existing code, which runs the guest in user mode) has to be
made at kernel configuration time, so a given kernel binary can only
do one or the other.
This new book3s_hv code doesn't support MMIO emulation at present.
Since we are running paravirtualized guests, this isn't a serious
restriction.
With the guest running in supervisor mode, most exceptions go straight
to the guest. We will never get data or instruction storage or segment
interrupts, alignment interrupts, decrementer interrupts, program
interrupts, single-step interrupts, etc., coming to the hypervisor from
the guest. Therefore this introduces a new KVMTEST_NONHV macro for the
exception entry path so that we don't have to do the KVM test on entry
to those exception handlers.
We do however get hypervisor decrementer, hypervisor data storage,
hypervisor instruction storage, and hypervisor emulation assist
interrupts, so we have to handle those.
In hypervisor mode, real-mode accesses can access all of RAM, not just
a limited amount. Therefore we put all the guest state in the vcpu.arch
and use the shadow_vcpu in the PACA only for temporary scratch space.
We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
We don't have a shared page with the guest, but we still need a
kvm_vcpu_arch_shared struct to store the values of various registers,
so we include one in the vcpu_arch struct.
The POWER7 processor has a restriction that all threads in a core have
to be in the same partition. MMU-on kernel code counts as a partition
(partition 0), so we have to do a partition switch on every entry to and
exit from the guest. At present we require the host and guest to run
in single-thread mode because of this hardware restriction.
This code allocates a hashed page table for the guest and initializes
it with HPTEs for the guest's Virtual Real Memory Area (VRMA). We
require that the guest memory is allocated using 16MB huge pages, in
order to simplify the low-level memory management. This also means that
we can get away without tracking paging activity in the host for now,
since huge pages can't be paged or swapped.
This also adds a few new exports needed by the book3s_hv code.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-06-29 08:21:34 +08:00
|
|
|
$(kvm-book3s_64-objs-y)
|
2011-06-29 08:22:05 +08:00
|
|
|
|
|
|
|
kvm-objs-$(CONFIG_KVM_BOOK3S_64) := $(kvm-book3s_64-module-objs)
|
2009-10-30 13:47:24 +08:00
|
|
|
|
2010-04-16 06:11:58 +08:00
|
|
|
kvm-book3s_32-objs := \
|
|
|
|
$(common-objs-y) \
|
|
|
|
fpu.o \
|
|
|
|
book3s_paired_singles.o \
|
|
|
|
book3s.o \
|
2011-06-29 08:17:58 +08:00
|
|
|
book3s_pr.o \
|
2010-04-16 06:11:58 +08:00
|
|
|
book3s_emulate.o \
|
|
|
|
book3s_interrupts.o \
|
2010-06-30 21:18:46 +08:00
|
|
|
book3s_mmu_hpte.o \
|
2010-04-16 06:11:58 +08:00
|
|
|
book3s_32_mmu_host.o \
|
|
|
|
book3s_32_mmu.o
|
|
|
|
kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs)
|
|
|
|
|
2013-04-12 22:08:46 +08:00
|
|
|
kvm-objs-$(CONFIG_KVM_MPIC) += mpic.o
|
2013-05-14 21:31:02 +08:00
|
|
|
kvm-objs-$(CONFIG_HAVE_KVM_IRQ_ROUTING) += $(KVM)/irqchip.o
|
2013-04-12 22:08:46 +08:00
|
|
|
|
2009-10-30 13:47:24 +08:00
|
|
|
kvm-objs := $(kvm-objs-m) $(kvm-objs-y)
|
|
|
|
|
|
|
|
obj-$(CONFIG_KVM_440) += kvm.o
|
2012-02-16 07:40:00 +08:00
|
|
|
obj-$(CONFIG_KVM_E500V2) += kvm.o
|
2011-12-20 23:34:47 +08:00
|
|
|
obj-$(CONFIG_KVM_E500MC) += kvm.o
|
2009-10-30 13:47:24 +08:00
|
|
|
obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o
|
2010-04-16 06:11:58 +08:00
|
|
|
obj-$(CONFIG_KVM_BOOK3S_32) += kvm.o
|
2009-10-30 13:47:24 +08:00
|
|
|
|
2011-06-29 08:22:05 +08:00
|
|
|
obj-y += $(kvm-book3s_64-builtin-objs-y)
|