@@ -225,6 +225,7 @@ int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq);
225
225
extern int kvm_vm_ioctl_rtas_define_token (struct kvm * kvm , void __user * argp );
226
226
extern int kvmppc_rtas_hcall (struct kvm_vcpu * vcpu );
227
227
extern void kvmppc_rtas_tokens_free (struct kvm * kvm );
228
+
228
229
extern int kvmppc_xics_set_xive (struct kvm * kvm , u32 irq , u32 server ,
229
230
u32 priority );
230
231
extern int kvmppc_xics_get_xive (struct kvm * kvm , u32 irq , u32 * server ,
@@ -412,6 +413,14 @@ static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr)
412
413
paca [cpu ].kvm_hstate .xics_phys = (void __iomem * )addr ;
413
414
}
414
415
416
+ static inline void kvmppc_set_xive_tima (int cpu ,
417
+ unsigned long phys_addr ,
418
+ void __iomem * virt_addr )
419
+ {
420
+ paca [cpu ].kvm_hstate .xive_tima_phys = (void __iomem * )phys_addr ;
421
+ paca [cpu ].kvm_hstate .xive_tima_virt = virt_addr ;
422
+ }
423
+
415
424
static inline u32 kvmppc_get_xics_latch (void )
416
425
{
417
426
u32 xirr ;
@@ -442,6 +451,11 @@ static inline void __init kvm_cma_reserve(void)
442
451
static inline void kvmppc_set_xics_phys (int cpu , unsigned long addr )
443
452
{}
444
453
454
+ static inline void kvmppc_set_xive_tima (int cpu ,
455
+ unsigned long phys_addr ,
456
+ void __iomem * virt_addr )
457
+ {}
458
+
445
459
static inline u32 kvmppc_get_xics_latch (void )
446
460
{
447
461
return 0 ;
@@ -492,6 +506,10 @@ extern long kvmppc_deliver_irq_passthru(struct kvm_vcpu *vcpu, __be32 xirr,
492
506
struct kvmppc_irq_map * irq_map ,
493
507
struct kvmppc_passthru_irqmap * pimap ,
494
508
bool * again );
509
+
510
+ extern int kvmppc_xics_set_irq (struct kvm * kvm , int irq_source_id , u32 irq ,
511
+ int level , bool line_status );
512
+
495
513
extern int h_ipi_redirect ;
496
514
#else
497
515
static inline struct kvmppc_passthru_irqmap * kvmppc_get_passthru_irqmap (
@@ -509,6 +527,60 @@ static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
509
527
{ return 0 ; }
510
528
#endif
511
529
530
+ #ifdef CONFIG_KVM_XIVE
531
+ /*
532
+ * Below the first "xive" is the "eXternal Interrupt Virtualization Engine"
533
+ * ie. P9 new interrupt controller, while the second "xive" is the legacy
534
+ * "eXternal Interrupt Vector Entry" which is the configuration of an
535
+ * interrupt on the "xics" interrupt controller on P8 and earlier. Those
536
+ * two function consume or produce a legacy "XIVE" state from the
537
+ * new "XIVE" interrupt controller.
538
+ */
539
+ extern int kvmppc_xive_set_xive (struct kvm * kvm , u32 irq , u32 server ,
540
+ u32 priority );
541
+ extern int kvmppc_xive_get_xive (struct kvm * kvm , u32 irq , u32 * server ,
542
+ u32 * priority );
543
+ extern int kvmppc_xive_int_on (struct kvm * kvm , u32 irq );
544
+ extern int kvmppc_xive_int_off (struct kvm * kvm , u32 irq );
545
+ extern void kvmppc_xive_init_module (void );
546
+ extern void kvmppc_xive_exit_module (void );
547
+
548
+ extern int kvmppc_xive_connect_vcpu (struct kvm_device * dev ,
549
+ struct kvm_vcpu * vcpu , u32 cpu );
550
+ extern void kvmppc_xive_cleanup_vcpu (struct kvm_vcpu * vcpu );
551
+ extern int kvmppc_xive_set_mapped (struct kvm * kvm , unsigned long guest_irq ,
552
+ struct irq_desc * host_desc );
553
+ extern int kvmppc_xive_clr_mapped (struct kvm * kvm , unsigned long guest_irq ,
554
+ struct irq_desc * host_desc );
555
+ extern u64 kvmppc_xive_get_icp (struct kvm_vcpu * vcpu );
556
+ extern int kvmppc_xive_set_icp (struct kvm_vcpu * vcpu , u64 icpval );
557
+
558
+ extern int kvmppc_xive_set_irq (struct kvm * kvm , int irq_source_id , u32 irq ,
559
+ int level , bool line_status );
560
+ #else
561
+ static inline int kvmppc_xive_set_xive (struct kvm * kvm , u32 irq , u32 server ,
562
+ u32 priority ) { return -1 ; }
563
+ static inline int kvmppc_xive_get_xive (struct kvm * kvm , u32 irq , u32 * server ,
564
+ u32 * priority ) { return -1 ; }
565
+ static inline int kvmppc_xive_int_on (struct kvm * kvm , u32 irq ) { return -1 ; }
566
+ static inline int kvmppc_xive_int_off (struct kvm * kvm , u32 irq ) { return -1 ; }
567
+ static inline void kvmppc_xive_init_module (void ) { }
568
+ static inline void kvmppc_xive_exit_module (void ) { }
569
+
570
+ static inline int kvmppc_xive_connect_vcpu (struct kvm_device * dev ,
571
+ struct kvm_vcpu * vcpu , u32 cpu ) { return - EBUSY ; }
572
+ static inline void kvmppc_xive_cleanup_vcpu (struct kvm_vcpu * vcpu ) { }
573
+ static inline int kvmppc_xive_set_mapped (struct kvm * kvm , unsigned long guest_irq ,
574
+ struct irq_desc * host_desc ) { return - ENODEV ; }
575
+ static inline int kvmppc_xive_clr_mapped (struct kvm * kvm , unsigned long guest_irq ,
576
+ struct irq_desc * host_desc ) { return - ENODEV ; }
577
+ static inline u64 kvmppc_xive_get_icp (struct kvm_vcpu * vcpu ) { return 0 ; }
578
+ static inline int kvmppc_xive_set_icp (struct kvm_vcpu * vcpu , u64 icpval ) { return - ENOENT ; }
579
+
580
+ static inline int kvmppc_xive_set_irq (struct kvm * kvm , int irq_source_id , u32 irq ,
581
+ int level , bool line_status ) { return - ENODEV ; }
582
+ #endif /* CONFIG_KVM_XIVE */
583
+
512
584
/*
513
585
* Prototypes for functions called only from assembler code.
514
586
* Having prototypes reduces sparse errors.
@@ -546,6 +618,8 @@ long kvmppc_h_clear_mod(struct kvm_vcpu *vcpu, unsigned long flags,
546
618
long kvmppc_hpte_hv_fault (struct kvm_vcpu * vcpu , unsigned long addr ,
547
619
unsigned long slb_v , unsigned int status , bool data );
548
620
unsigned long kvmppc_rm_h_xirr (struct kvm_vcpu * vcpu );
621
+ unsigned long kvmppc_rm_h_xirr_x (struct kvm_vcpu * vcpu );
622
+ unsigned long kvmppc_rm_h_ipoll (struct kvm_vcpu * vcpu , unsigned long server );
549
623
int kvmppc_rm_h_ipi (struct kvm_vcpu * vcpu , unsigned long server ,
550
624
unsigned long mfrr );
551
625
int kvmppc_rm_h_cppr (struct kvm_vcpu * vcpu , unsigned long cppr );
0 commit comments