From patchwork Fri Nov 9 06:19:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [11/14] powerpc: Add wrappers to enable/disable relocation on exceptions X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 197940 Message-Id: <1352441953-29096-13-git-send-email-mikey@neuling.org> To: Benjamin Herrenschmidt Cc: Michael Neuling , linuxppc-dev@lists.ozlabs.org, Ian Munsie , Matt Evans Date: Fri, 9 Nov 2012 17:19:10 +1100 From: Michael Neuling List-Id: Linux on PowerPC Developers Mail List From: Ian Munsie These wrappers hide the parameters that have to be passed to H_SET_MODE to enable/disable relocation on during exceptions. As noted in the comments, since these have partition wide scope, they may take some time to complete and must be periodically retried until H_SUCCESS is returned. Signed-off-by: Ian Munsie Signed-off-by: Michael Neuling --- arch/powerpc/platforms/pseries/plpar_wrappers.h | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h index 44ad214..e6cc34a 100644 --- a/arch/powerpc/platforms/pseries/plpar_wrappers.h +++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h @@ -279,4 +279,29 @@ static inline long plpar_set_mode(unsigned long mflags, unsigned long resource, { return plpar_hcall_norets(H_SET_MODE, mflags, resource, value1, value2); } + +/* + * Enable relocation on exceptions on this partition + * + * Note: this call has a partition wide scope and can take a while to complete. + * If it returns H_LONG_BUSY_* it should be retried periodically until it + * returns H_SUCCESS. + */ +static inline long enable_reloc_on_exceptions(void) +{ + /* mflags = 3: Exceptions at 0xC000000000004000 */ + return plpar_set_mode(3, 3, 0, 0); +} + +/* + * Disable relocation on exceptions on this partition + * + * Note: this call has a partition wide scope and can take a while to complete. + * If it returns H_LONG_BUSY_* it should be retried periodically until it + * returns H_SUCCESS. + */ +static inline long disable_reloc_on_exceptions(void) { + return plpar_set_mode(0, 3, 0, 0); +} + #endif /* _PSERIES_PLPAR_WRAPPERS_H */