From patchwork Fri Aug 25 09:52:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mackerras X-Patchwork-Id: 805815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="CFBPsXyF"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xdxM26b2Kz9t2f for ; Fri, 25 Aug 2017 19:53:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754668AbdHYJxr (ORCPT ); Fri, 25 Aug 2017 05:53:47 -0400 Received: from ozlabs.org ([103.22.144.67]:33217 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754608AbdHYJxo (ORCPT ); Fri, 25 Aug 2017 05:53:44 -0400 Received: by ozlabs.org (Postfix, from userid 1003) id 3xdxLt6slMz9sNd; Fri, 25 Aug 2017 19:53:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1503654822; bh=4yVnPkiF+OaGI2gvyCxpcROUrNDEtHZ5eLWvcE8N7Co=; h=Date:From:To:Subject:From; b=CFBPsXyFdo+yZDUVprU+AVEjNmuKOswoGv7PiO9AZ5v+kSwm0+9P9fE+sCqJmkens E9rFt079JBRuo3GXZsYh8Jdffm6Z1zpe7pqhfl5AYlw3bYdP2WIvaZEo7OPGdEh4TC ms200rwevtKtJ3nmKImcvb1Q/oVt+LZE7L18jif9s8Dz2U7LpuV1ZdmO6y2enhoA2w OjzjljJoj7bSCcu3IqT859+UcboUKfdVuqAiaI1+w5va+h36c//lueLBHBrtXMEM9H AnvO+PuRaBqJJi0SHIp38GIr1V4clt7jZEF7F24N7neWdGjysNRc8rGDYNpgtgOgWi ZxTwh/Ly7s30g== Date: Fri, 25 Aug 2017 19:52:12 +1000 From: Paul Mackerras To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Subject: [PATCH] KVM: PPC: Book3S HV: Fix case where HDEC is treated as 32-bit on POWER9 Message-ID: <20170825095212.GB14035@fergus.ozlabs.ibm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Commit 2f2724630f7a ("KVM: PPC: Book3S HV: Cope with host using large decrementer mode", 2017-05-22) added code to treat the hypervisor decrementer (HDEC) as a 64-bit value on POWER9 rather than 32-bit. Unfortunately, that commit missed one place where HDEC is treated as a 32-bit value. This fixes it. This bug should not have any user-visible consequences that I can think of, beyond an occasional unnecessary exit to the host kernel. If the hypervisor decrementer has gone negative, then the bottom 32 bits will be negative for about 4 seconds after that, so as long as we get out of the guest within those 4 seconds we won't conclude that the HDEC interrupt is spurious. Reported-by: Suraj Jitindar Singh Fixes: 2f2724630f7a ("KVM: PPC: Book3S HV: Cope with host using large decrementer mode") Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index c52184a..9f1521e 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -1280,7 +1280,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) cmpwi r12,BOOK3S_INTERRUPT_HV_DECREMENTER bne 2f mfspr r3,SPRN_HDEC - cmpwi r3,0 + EXTEND_HDEC(r3) + cmpdi r3,0 mr r4,r9 bge fast_guest_return 2: