diff options
author | Scott Wood <scottwood@freescale.com> | 2013-04-12 10:08:47 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-04-26 14:27:24 -0400 |
commit | eb1e4f43e0f47f2655372c7d32c43db9711c278e (patch) | |
tree | ac084d48a5590f6ca712242e0ca139abf57250a5 /arch/powerpc/include | |
parent | 5df554ad5b7522ea62b0ff9d5be35183494efc21 (diff) |
kvm/ppc/mpic: add KVM_CAP_IRQ_MPIC
Enabling this capability connects the vcpu to the designated in-kernel
MPIC. Using explicit connections between vcpus and irqchips allows
for flexibility, but the main benefit at the moment is that it
simplifies the code -- KVM doesn't need vm-global state to remember
which MPIC object is associated with this vm, and it doesn't need to
care about ordering between irqchip creation and vcpu creation.
Signed-off-by: Scott Wood <scottwood@freescale.com>
[agraf: add stub functions for kvmppc_mpic_{dis,}connect_vcpu]
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 9 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_ppc.h | 15 |
2 files changed, 23 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 153c8c2b0f88..c3f8ceffa412 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -377,6 +377,11 @@ struct kvmppc_booke_debug_reg { | |||
377 | u64 dac[KVMPPC_BOOKE_MAX_DAC]; | 377 | u64 dac[KVMPPC_BOOKE_MAX_DAC]; |
378 | }; | 378 | }; |
379 | 379 | ||
380 | #define KVMPPC_IRQ_DEFAULT 0 | ||
381 | #define KVMPPC_IRQ_MPIC 1 | ||
382 | |||
383 | struct openpic; | ||
384 | |||
380 | struct kvm_vcpu_arch { | 385 | struct kvm_vcpu_arch { |
381 | ulong host_stack; | 386 | ulong host_stack; |
382 | u32 host_pid; | 387 | u32 host_pid; |
@@ -558,6 +563,10 @@ struct kvm_vcpu_arch { | |||
558 | unsigned long magic_page_pa; /* phys addr to map the magic page to */ | 563 | unsigned long magic_page_pa; /* phys addr to map the magic page to */ |
559 | unsigned long magic_page_ea; /* effect. addr to map the magic page to */ | 564 | unsigned long magic_page_ea; /* effect. addr to map the magic page to */ |
560 | 565 | ||
566 | int irq_type; /* one of KVM_IRQ_* */ | ||
567 | int irq_cpu_id; | ||
568 | struct openpic *mpic; /* KVM_IRQ_MPIC */ | ||
569 | |||
561 | #ifdef CONFIG_KVM_BOOK3S_64_HV | 570 | #ifdef CONFIG_KVM_BOOK3S_64_HV |
562 | struct kvm_vcpu_arch_shared shregs; | 571 | struct kvm_vcpu_arch_shared shregs; |
563 | 572 | ||
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index 3810f9c7616c..df9c80b37905 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h | |||
@@ -248,7 +248,6 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *); | |||
248 | void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid); | 248 | void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid); |
249 | 249 | ||
250 | struct openpic; | 250 | struct openpic; |
251 | void kvmppc_mpic_put(struct openpic *opp); | ||
252 | 251 | ||
253 | #ifdef CONFIG_KVM_BOOK3S_64_HV | 252 | #ifdef CONFIG_KVM_BOOK3S_64_HV |
254 | static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr) | 253 | static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr) |
@@ -278,6 +277,9 @@ static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr) | |||
278 | #ifdef CONFIG_KVM_MPIC | 277 | #ifdef CONFIG_KVM_MPIC |
279 | 278 | ||
280 | void kvmppc_mpic_set_epr(struct kvm_vcpu *vcpu); | 279 | void kvmppc_mpic_set_epr(struct kvm_vcpu *vcpu); |
280 | int kvmppc_mpic_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, | ||
281 | u32 cpu); | ||
282 | void kvmppc_mpic_disconnect_vcpu(struct openpic *opp, struct kvm_vcpu *vcpu); | ||
281 | 283 | ||
282 | #else | 284 | #else |
283 | 285 | ||
@@ -285,6 +287,17 @@ static inline void kvmppc_mpic_set_epr(struct kvm_vcpu *vcpu) | |||
285 | { | 287 | { |
286 | } | 288 | } |
287 | 289 | ||
290 | static inline int kvmppc_mpic_connect_vcpu(struct kvm_device *dev, | ||
291 | struct kvm_vcpu *vcpu, u32 cpu) | ||
292 | { | ||
293 | return -EINVAL; | ||
294 | } | ||
295 | |||
296 | static inline void kvmppc_mpic_disconnect_vcpu(struct openpic *opp, | ||
297 | struct kvm_vcpu *vcpu) | ||
298 | { | ||
299 | } | ||
300 | |||
288 | #endif /* CONFIG_KVM_MPIC */ | 301 | #endif /* CONFIG_KVM_MPIC */ |
289 | 302 | ||
290 | int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu, | 303 | int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu, |