Commit 582b910edafd283dfab78f41f437a92a65ee5103
Committed by
Benjamin Herrenschmidt
1 parent
fd17dc7b9a
Exists in
master
and in
13 other branches
ppc/kvm: Clear the runlatch bit of a vcpu before napping
When the guest cedes the vcpu or the vcpu has no guest to run it naps. Clear the runlatch bit of the vcpu before napping to indicate an idle cpu. Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com> Acked-by: Paul Mackerras <paulus@samba.org> Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff
arch/powerpc/kvm/book3s_hv_rmhandlers.S
... | ... | @@ -315,6 +315,11 @@ |
315 | 315 | li r0, KVM_HWTHREAD_IN_NAP |
316 | 316 | stb r0, HSTATE_HWTHREAD_STATE(r13) |
317 | 317 | kvm_do_nap: |
318 | + /* Clear the runlatch bit before napping */ | |
319 | + mfspr r2, SPRN_CTRLF | |
320 | + clrrdi r2, r2, 1 | |
321 | + mtspr SPRN_CTRLT, r2 | |
322 | + | |
318 | 323 | li r3, LPCR_PECE0 |
319 | 324 | mfspr r4, SPRN_LPCR |
320 | 325 | rlwimi r4, r3, 0, LPCR_PECE0 | LPCR_PECE1 |
321 | 326 | |
... | ... | @@ -2005,8 +2010,13 @@ |
2005 | 2010 | |
2006 | 2011 | /* |
2007 | 2012 | * Take a nap until a decrementer or external or doobell interrupt |
2008 | - * occurs, with PECE1, PECE0 and PECEDP set in LPCR | |
2013 | + * occurs, with PECE1, PECE0 and PECEDP set in LPCR. Also clear the | |
2014 | + * runlatch bit before napping. | |
2009 | 2015 | */ |
2016 | + mfspr r2, SPRN_CTRLF | |
2017 | + clrrdi r2, r2, 1 | |
2018 | + mtspr SPRN_CTRLT, r2 | |
2019 | + | |
2010 | 2020 | li r0,1 |
2011 | 2021 | stb r0,HSTATE_HWTHREAD_REQ(r13) |
2012 | 2022 | mfspr r5,SPRN_LPCR |