Skip to content
  • Shreyas B. Prabhu's avatar
    powerpc/kvm: make hypervisor state restore a function · 17065671
    Shreyas B. Prabhu authored
    
    
    In the current code, when the thread wakes up in reset vector, some
    of the state restore code and check for whether a thread needs to
    branch to kvm is duplicated. Reorder the code such that this
    duplication is avoided.
    
    At a higher level this is what the change looks like-
    
    Before this patch -
    power7_wakeup_tb_loss:
    	restore hypervisor state
    	if (thread needed by kvm)
    		goto kvm_start_guest
    	restore nvgprs, cr, pc
    	rfid to process context
    
    power7_wakeup_loss:
    	restore nvgprs, cr, pc
    	rfid to process context
    
    reset vector:
    	if (waking from deep idle states)
    		goto power7_wakeup_tb_loss
    	else
    		if (thread needed by kvm)
    			goto kvm_start_guest
    		goto power7_wakeup_loss
    
    After this patch -
    power7_wakeup_tb_loss:
    	restore hypervisor state
    	return
    
    power7_restore_hyp_resource():
    	if (waking from deep idle states)
    		goto power7_wakeup_tb_loss
    	return
    
    power7_wakeup_loss:
    	restore nvgprs, cr, pc
    	rfid to process context
    
    reset vector:
    	power7_restore_hyp_resource()
    	if (thread needed by kvm)
                    goto kvm_start_guest
    	goto power7_wakeup_loss
    
    Reviewed-by: default avatarPaul Mackerras <paulus@samba.org>
    Reviewed-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
    Signed-off-by: default avatarShreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    17065671