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: 9921641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C60160349 for ; Fri, 25 Aug 2017 09:53:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BC0427D4A for ; Fri, 25 Aug 2017 09:53:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80B5B27EE2; Fri, 25 Aug 2017 09:53:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00E4927E5A for ; Fri, 25 Aug 2017 09:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754710AbdHYJxr (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-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: