linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <nicholas.piggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: [PATCH 02/14] powerpc/pseries: remove cross-fixup branches in exception code
Date: Thu, 21 Jul 2016 16:44:01 +1000	[thread overview]
Message-ID: <1469083453-9279-3-git-send-email-npiggin@gmail.com> (raw)
In-Reply-To: <1469083453-9279-1-git-send-email-npiggin@gmail.com>

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 <npiggin@gmail.com>
---
 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)
 
-- 
2.8.1

  parent reply	other threads:[~2016-07-21  6:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21  6:43 [RFC][PATCH 00/14] pseries exception cleanups Nicholas Piggin
2016-07-21  6:44 ` [PATCH 01/14] powerpc: add arch/powerpc/tools directory Nicholas Piggin
2016-07-21  6:44 ` Nicholas Piggin [this message]
2016-07-21  6:44 ` [PATCH 03/14] powerpc: build-time fixup alternate feature relative addresses Nicholas Piggin
2016-07-21 13:39   ` Nicholas Piggin
2016-07-21  6:44 ` [PATCH 04/14] powerpc/pseries: move decrementer exception vector out of line Nicholas Piggin
2016-07-21  6:44 ` [PATCH 05/14] powerpc/pseries: 4GB exception handler offsets Nicholas Piggin
2016-07-21 14:34   ` David Laight
2016-07-22  7:52     ` Nicholas Piggin
2016-07-21  6:44 ` [PATCH 06/14] powerpc/pseries: h_facility_unavailable realmode exception location Nicholas Piggin
2016-07-21  6:44 ` [PATCH 07/14] powerpc/pseries: improved exception vector macros Nicholas Piggin
2016-07-21  6:44 ` [PATCH 08/14] powerpc/pseries: consolidate exception handler alignment Nicholas Piggin
2016-07-21  6:44 ` [PATCH 09/14] powerpc/64: use gas sections for arranging exception vectors Nicholas Piggin
2016-07-21  6:44 ` [PATCH 10/14] powerpc/pseries: move related exception code together Nicholas Piggin
2016-07-21  6:44 ` [PATCH 11/14] powerpc/pseries: use single macro for both parts of OOL exception Nicholas Piggin
2016-07-21  6:44 ` [PATCH 12/14] powerpc/pseries: remove unused exception code, small cleanups Nicholas Piggin
2016-07-21  6:44 ` [PATCH 13/14] powerpc/pseries: consolidate slb exceptions Nicholas Piggin
2016-07-21  6:44 ` [PATCH 14/14] powerpc/pseries: exceptions use short handler load again Nicholas Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469083453-9279-3-git-send-email-npiggin@gmail.com \
    --to=nicholas.piggin@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).