@@ -380,11 +380,6 @@ static int xive_select_target(struct kvm *kvm, u32 *server, u8 prio)
380380 return - EBUSY ;
381381}
382382
383- static u32 xive_vp (struct kvmppc_xive * xive , u32 server )
384- {
385- return xive -> vp_base + kvmppc_pack_vcpu_id (xive -> kvm , server );
386- }
387-
388383static u8 xive_lock_and_mask (struct kvmppc_xive * xive ,
389384 struct kvmppc_xive_src_block * sb ,
390385 struct kvmppc_xive_irq_state * state )
@@ -430,8 +425,8 @@ static u8 xive_lock_and_mask(struct kvmppc_xive *xive,
430425 */
431426 if (xd -> flags & OPAL_XIVE_IRQ_MASK_VIA_FW ) {
432427 xive_native_configure_irq (hw_num ,
433- xive_vp (xive , state -> act_server ),
434- MASKED , state -> number );
428+ kvmppc_xive_vp (xive , state -> act_server ),
429+ MASKED , state -> number );
435430 /* set old_p so we can track if an H_EOI was done */
436431 state -> old_p = true;
437432 state -> old_q = false;
@@ -486,8 +481,8 @@ static void xive_finish_unmask(struct kvmppc_xive *xive,
486481 */
487482 if (xd -> flags & OPAL_XIVE_IRQ_MASK_VIA_FW ) {
488483 xive_native_configure_irq (hw_num ,
489- xive_vp (xive , state -> act_server ),
490- state -> act_priority , state -> number );
484+ kvmppc_xive_vp (xive , state -> act_server ),
485+ state -> act_priority , state -> number );
491486 /* If an EOI is needed, do it here */
492487 if (!state -> old_p )
493488 xive_vm_source_eoi (hw_num , xd );
@@ -563,7 +558,7 @@ static int xive_target_interrupt(struct kvm *kvm,
563558 kvmppc_xive_select_irq (state , & hw_num , NULL );
564559
565560 return xive_native_configure_irq (hw_num ,
566- xive_vp (xive , server ),
561+ kvmppc_xive_vp (xive , server ),
567562 prio , state -> number );
568563}
569564
@@ -951,7 +946,7 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
951946 * which is fine for a never started interrupt.
952947 */
953948 xive_native_configure_irq (hw_irq ,
954- xive_vp (xive , state -> act_server ),
949+ kvmppc_xive_vp (xive , state -> act_server ),
955950 state -> act_priority , state -> number );
956951
957952 /*
@@ -1027,7 +1022,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
10271022
10281023 /* Reconfigure the IPI */
10291024 xive_native_configure_irq (state -> ipi_number ,
1030- xive_vp (xive , state -> act_server ),
1025+ kvmppc_xive_vp (xive , state -> act_server ),
10311026 state -> act_priority , state -> number );
10321027
10331028 /*
@@ -1049,7 +1044,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
10491044}
10501045EXPORT_SYMBOL_GPL (kvmppc_xive_clr_mapped );
10511046
1052- static void kvmppc_xive_disable_vcpu_interrupts (struct kvm_vcpu * vcpu )
1047+ void kvmppc_xive_disable_vcpu_interrupts (struct kvm_vcpu * vcpu )
10531048{
10541049 struct kvmppc_xive_vcpu * xc = vcpu -> arch .xive_vcpu ;
10551050 struct kvm * kvm = vcpu -> kvm ;
@@ -1166,7 +1161,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
11661161 xc -> xive = xive ;
11671162 xc -> vcpu = vcpu ;
11681163 xc -> server_num = cpu ;
1169- xc -> vp_id = xive_vp (xive , cpu );
1164+ xc -> vp_id = kvmppc_xive_vp (xive , cpu );
11701165 xc -> mfrr = 0xff ;
11711166 xc -> valid = true;
11721167
@@ -1883,6 +1878,43 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
18831878 return 0 ;
18841879}
18851880
1881+ int kvmppc_xive_debug_show_queues (struct seq_file * m , struct kvm_vcpu * vcpu )
1882+ {
1883+ struct kvmppc_xive_vcpu * xc = vcpu -> arch .xive_vcpu ;
1884+ unsigned int i ;
1885+
1886+ for (i = 0 ; i < KVMPPC_XIVE_Q_COUNT ; i ++ ) {
1887+ struct xive_q * q = & xc -> queues [i ];
1888+ u32 i0 , i1 , idx ;
1889+
1890+ if (!q -> qpage && !xc -> esc_virq [i ])
1891+ continue ;
1892+
1893+ seq_printf (m , " [q%d]: " , i );
1894+
1895+ if (q -> qpage ) {
1896+ idx = q -> idx ;
1897+ i0 = be32_to_cpup (q -> qpage + idx );
1898+ idx = (idx + 1 ) & q -> msk ;
1899+ i1 = be32_to_cpup (q -> qpage + idx );
1900+ seq_printf (m , "T=%d %08x %08x...\n" , q -> toggle ,
1901+ i0 , i1 );
1902+ }
1903+ if (xc -> esc_virq [i ]) {
1904+ struct irq_data * d = irq_get_irq_data (xc -> esc_virq [i ]);
1905+ struct xive_irq_data * xd =
1906+ irq_data_get_irq_handler_data (d );
1907+ u64 pq = xive_vm_esb_load (xd , XIVE_ESB_GET );
1908+
1909+ seq_printf (m , "E:%c%c I(%d:%llx:%llx)" ,
1910+ (pq & XIVE_ESB_VAL_P ) ? 'P' : 'p' ,
1911+ (pq & XIVE_ESB_VAL_Q ) ? 'Q' : 'q' ,
1912+ xc -> esc_virq [i ], pq , xd -> eoi_page );
1913+ seq_puts (m , "\n" );
1914+ }
1915+ }
1916+ return 0 ;
1917+ }
18861918
18871919static int xive_debug_show (struct seq_file * m , void * private )
18881920{
@@ -1908,7 +1940,6 @@ static int xive_debug_show(struct seq_file *m, void *private)
19081940
19091941 kvm_for_each_vcpu (i , vcpu , kvm ) {
19101942 struct kvmppc_xive_vcpu * xc = vcpu -> arch .xive_vcpu ;
1911- unsigned int i ;
19121943
19131944 if (!xc )
19141945 continue ;
@@ -1918,33 +1949,8 @@ static int xive_debug_show(struct seq_file *m, void *private)
19181949 xc -> server_num , xc -> cppr , xc -> hw_cppr ,
19191950 xc -> mfrr , xc -> pending ,
19201951 xc -> stat_rm_h_xirr , xc -> stat_vm_h_xirr );
1921- for (i = 0 ; i < KVMPPC_XIVE_Q_COUNT ; i ++ ) {
1922- struct xive_q * q = & xc -> queues [i ];
1923- u32 i0 , i1 , idx ;
19241952
1925- if (!q -> qpage && !xc -> esc_virq [i ])
1926- continue ;
1927-
1928- seq_printf (m , " [q%d]: " , i );
1929-
1930- if (q -> qpage ) {
1931- idx = q -> idx ;
1932- i0 = be32_to_cpup (q -> qpage + idx );
1933- idx = (idx + 1 ) & q -> msk ;
1934- i1 = be32_to_cpup (q -> qpage + idx );
1935- seq_printf (m , "T=%d %08x %08x... \n" , q -> toggle , i0 , i1 );
1936- }
1937- if (xc -> esc_virq [i ]) {
1938- struct irq_data * d = irq_get_irq_data (xc -> esc_virq [i ]);
1939- struct xive_irq_data * xd = irq_data_get_irq_handler_data (d );
1940- u64 pq = xive_vm_esb_load (xd , XIVE_ESB_GET );
1941- seq_printf (m , "E:%c%c I(%d:%llx:%llx)" ,
1942- (pq & XIVE_ESB_VAL_P ) ? 'P' : 'p' ,
1943- (pq & XIVE_ESB_VAL_Q ) ? 'Q' : 'q' ,
1944- xc -> esc_virq [i ], pq , xd -> eoi_page );
1945- seq_printf (m , "\n" );
1946- }
1947- }
1953+ kvmppc_xive_debug_show_queues (m , vcpu );
19481954
19491955 t_rm_h_xirr += xc -> stat_rm_h_xirr ;
19501956 t_rm_h_ipoll += xc -> stat_rm_h_ipoll ;
0 commit comments