From patchwork Mon Apr 5 01:19:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1462190 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=CBvEiTa8; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4FDCXd3ygDz9sj0 for ; Mon, 5 Apr 2021 11:21:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231835AbhDEBVJ (ORCPT ); Sun, 4 Apr 2021 21:21:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231775AbhDEBVI (ORCPT ); Sun, 4 Apr 2021 21:21:08 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 212D5C061756 for ; Sun, 4 Apr 2021 18:21:03 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id t23so2030826pjy.3 for ; Sun, 04 Apr 2021 18:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8zIiezjZW/ByRW+n+QDDz4LjyD5A6sN0OuFEjYqvHKk=; b=CBvEiTa86AkJgU+tNxlO08DebjgRTX+VUAo5zTG5AdWncCf8lCXz5Y/71LUqEqLjH7 Vt6eahLIznf+UugihRG65XV3eeYftHk022xB5hspQl6I59ilFi+48rmk9EwyQj67eM8f 1vufC4uwArE9x+BxZqejXt6YLygKU1vDZHGDbbRZYeBmtlNUNcv9fGt9K/lSqrGn/pjs eGnSEfv4lE4YYZfzXpySoncgJuMFEyJO24M9+ZPrgE1M3+QvX3klfxP7AIkF3aCWNBH0 vw2gCsubgKnk7y11MFLsA1d40p9A+PFGdFUeX6wxgNZhM6NvyhY4WFUPEbpZvB9ECT6y s/PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8zIiezjZW/ByRW+n+QDDz4LjyD5A6sN0OuFEjYqvHKk=; b=VQCvx4kNY7loMjalYCz47SzU4YlR0IrIwnmRd0hOZBsTdW66th3w7XUBI4ZdcsW6AM I8r0jvd7WKKnFeGYCr9eiPaN6uk6jDHlrm3tB8obKl+uQCiu5EQqtz7TKqxSVR6AhtxM BRSGh7mAaK9pQ3k3Ra+NJPDLM8LJUg5+HDNzV+SLjE6E+dNcWz6VGEd/hcoFnOpFty4y iplArONfUiMbvsLVqIyUOZ37CfG9SYoo62CI/Va+U3/R8kt1P5V0s9YFs7WlMDSn0YZY OkwTpZ2gOKh2rC4iaqdifZqzy7gd3Ylt9rnYNKq95DHYJceZEfvdOES7lcuMPYG1F0wr QV4A== X-Gm-Message-State: AOAM533iPgz3+PqK2sAAmzvDOykjrO4Cg/DGWb4Mg6qIL4mhH8fR8Txv Zpn+xLkJqgLVO2pavq94niGXZl5H4qqu5w== X-Google-Smtp-Source: ABdhPJwHDtiTUAi9cbGtynVZFA/Rfm5aZMUGl9w2p9sVmmhZGZBBCfPKy8CsDexl1E11VDcXGNzGRw== X-Received: by 2002:a17:90a:bb8b:: with SMTP id v11mr24625131pjr.4.1617585662630; Sun, 04 Apr 2021 18:21:02 -0700 (PDT) Received: from bobo.ibm.com ([1.132.215.134]) by smtp.gmail.com with ESMTPSA id e3sm14062536pfm.43.2021.04.04.18.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Apr 2021 18:21:02 -0700 (PDT) From: Nicholas Piggin To: kvm-ppc@vger.kernel.org Cc: Nicholas Piggin , linuxppc-dev@lists.ozlabs.org, Alexey Kardashevskiy Subject: [PATCH v6 17/48] KVM: PPC: Book3S 64: move bad_host_intr check to HV handler Date: Mon, 5 Apr 2021 11:19:17 +1000 Message-Id: <20210405011948.675354-18-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210405011948.675354-1-npiggin@gmail.com> References: <20210405011948.675354-1-npiggin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org This is not used by PR KVM. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_64_entry.S | 4 ---- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 +++- arch/powerpc/kvm/book3s_segment.S | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_entry.S b/arch/powerpc/kvm/book3s_64_entry.S index 2c9d106145e8..66170ea85bc2 100644 --- a/arch/powerpc/kvm/book3s_64_entry.S +++ b/arch/powerpc/kvm/book3s_64_entry.S @@ -107,16 +107,12 @@ do_kvm_interrupt: beq- .Lmaybe_skip .Lno_skip: #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE - cmpwi r9,KVM_GUEST_MODE_HOST_HV - beq kvmppc_bad_host_intr #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE cmpwi r9,KVM_GUEST_MODE_GUEST - ld r9,HSTATE_SCRATCH2(r13) beq kvmppc_interrupt_pr #endif b kvmppc_interrupt_hv #else - ld r9,HSTATE_SCRATCH2(r13) b kvmppc_interrupt_pr #endif diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index f976efb7e4a9..75405ef53238 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -1265,6 +1265,7 @@ hdec_soon: kvmppc_interrupt_hv: /* * Register contents: + * R9 = HSTATE_IN_GUEST * R12 = (guest CR << 32) | interrupt vector * R13 = PACA * guest R12 saved in shadow VCPU SCRATCH0 @@ -1272,6 +1273,8 @@ kvmppc_interrupt_hv: * guest R9 saved in HSTATE_SCRATCH2 */ /* We're now back in the host but in guest MMU context */ + cmpwi r9,KVM_GUEST_MODE_HOST_HV + beq kvmppc_bad_host_intr li r9, KVM_GUEST_MODE_HOST_HV stb r9, HSTATE_IN_GUEST(r13) @@ -3272,7 +3275,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_P9_TM_HV_ASSIST) * cfar is saved in HSTATE_CFAR(r13) * ppr is saved in HSTATE_PPR(r13) */ -.global kvmppc_bad_host_intr kvmppc_bad_host_intr: /* * Switch to the emergency stack, but start half-way down in diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S index 1f492aa4c8d6..202046a83fc1 100644 --- a/arch/powerpc/kvm/book3s_segment.S +++ b/arch/powerpc/kvm/book3s_segment.S @@ -164,12 +164,15 @@ kvmppc_interrupt_pr: /* 64-bit entry. Register usage at this point: * * SPRG_SCRATCH0 = guest R13 + * R9 = HSTATE_IN_GUEST * R12 = (guest CR << 32) | exit handler id * R13 = PACA * HSTATE.SCRATCH0 = guest R12 + * HSTATE.SCRATCH2 = guest R9 */ #ifdef CONFIG_PPC64 /* Match 32-bit entry */ + ld r9,HSTATE_SCRATCH2(r13) rotldi r12, r12, 32 /* Flip R12 halves for stw */ stw r12, HSTATE_SCRATCH1(r13) /* CR is now in the low half */ srdi r12, r12, 32 /* shift trap into low half */