From patchwork Thu Jul 21 06:44:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 651005 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rw4W952nJz9sR8 for ; Thu, 21 Jul 2016 17:03:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=oLaLor2Y; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3rw4W93zd8zDqdG for ; Thu, 21 Jul 2016 17:03:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=oLaLor2Y; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rw45X2dlfzDqTC for ; Thu, 21 Jul 2016 16:44:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=oLaLor2Y; dkim-atps=neutral Received: by mail-pf0-x243.google.com with SMTP id h186so4887846pfg.2 for ; Wed, 20 Jul 2016 23:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AZth78eWduFJk5WjEIx8Zx3NkFqQsewcbiij6FBjm3U=; b=oLaLor2YuNCHfetQZUz77yX9KvL/u6oGKRueo3mRFAxLLTUMLOL3JCYEBOzO/CLFbO JGXMR1YjkMmO7bt9MXsiszv9efR0tuQYj8a9yiIsHXxT4ecADBZq7cqd0ppSeDEoHNLt t0ru3MAOj6pGOp2to5Pc80/SgiJcmcqD2YB7nPDFJ1cq4XROOtm4grbJjrkMPff4zgYr +qFmg4B3dH9rljGv8tOPipSiA2KCD44M0BM9Ru082KE24LdsnRRZx+OaAkr7qmPE9J12 ua9PWsV9wRUouZ8BbIjIGSMkUMJafiys/xBW+sg1buMY8xUywKfakqUY1Ct8FN3xFFJU xVHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AZth78eWduFJk5WjEIx8Zx3NkFqQsewcbiij6FBjm3U=; b=jdxs4vIR0p4T7bA5tkJtgLnzJBypmEQUhMpmydPMtu613yYc125SDZA51ZLcd2u1vT vG5ityWxvDCtwbMq53/rJzLNbOk3cHDIv9BETmCoHEH7H8t51SYWRqeVoo5hPwlkh6An ABQ6eMgsglokXGGEZaqw5JKlp0+MaGVoZlB1t7Js3KM9XAayzPOCaeEAM+pwn1t7UqM5 S/mx3YW/PBGItqVX49xDEvLQ0cFazKaoEzKRXOYZ0RSpuHSuk5QOZOuz7WkH+CQF0P8w ShNcZLLkfn2Y8dmQ1HwWgKm7B8zHqln4K4pXnpZ+s1Dh1lZOSPqOdkImIt+wbZRnciHT HiMw== X-Gm-Message-State: ALyK8tJfsSDl3NEhALw+Cj7qAx0XXSiJU6IjGzhC8yYzHzIeUkfizl2gCvQ6M46kev+0Mw== X-Received: by 10.98.10.148 with SMTP id 20mr70534736pfk.154.1469083486380; Wed, 20 Jul 2016 23:44:46 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id z10sm9071053pff.95.2016.07.20.23.44.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 23:44:46 -0700 (PDT) From: Nicholas Piggin X-Google-Original-From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 02/14] powerpc/pseries: remove cross-fixup branches in exception code Date: Thu, 21 Jul 2016 16:44:01 +1000 Message-Id: <1469083453-9279-3-git-send-email-npiggin@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1469083453-9279-1-git-send-email-npiggin@gmail.com> References: <1469083453-9279-1-git-send-email-npiggin@gmail.com> X-Mailman-Approved-At: Thu, 21 Jul 2016 16:57:30 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for reworking the alternate feature patching code, remove a case of cross-fixup branching in the exception code. That is, a branch from one alt feature section targeting another alt feature section. We have the following: BEGIN_FTR_SECTION b do_kvm_0x502 ... do_kvm_0x502: ... FTR_SECTION_ELSE b do_kvm_0x500 ... do_kvm_0x500: ... ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) BEGIN_FTR_SECTION b do_kvm_0x502 FTR_SECTION_ELSE b do_kvm_0x500 ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE) This somehow manages to work today. The first branch to do_kvm_0x500 works as expected and branches to the do_kvm_0x500 code that is moved to the destination location. The second branch to it branches to the linked location of the do_kvm_0x500 code. Two copies of the code are being executed. A subsequent patch moves the patchcode far away and discards it after boot, so this type of branch doesn't work. Signed-off-by: Nick Piggin --- arch/powerpc/kernel/exceptions-64s.S | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 4c94406..18befa5 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -257,13 +257,18 @@ hardware_interrupt_hv: BEGIN_FTR_SECTION _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV) - KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502) FTR_SECTION_ELSE _MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR) - KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500) ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) + /* + * Relon code jumps to these KVM handlers too so can't put them + * in the feature sections. + */ + KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502) + KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500) + STD_EXCEPTION_PSERIES(0x600, alignment) KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x600)