From patchwork Thu Jan 11 10:11:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Guo X-Patchwork-Id: 858989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="d1JEwd5v"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zHMBj37Jxz9t62 for ; Thu, 11 Jan 2018 21:12:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933291AbeAKKMm (ORCPT ); Thu, 11 Jan 2018 05:12:42 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35655 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932982AbeAKKMl (ORCPT ); Thu, 11 Jan 2018 05:12:41 -0500 Received: by mail-pf0-f195.google.com with SMTP id t12so1306765pfg.2; Thu, 11 Jan 2018 02:12:41 -0800 (PST) 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; bh=rG775xg9CG6SNK9PCraQCI9l3jLjrhvwFP2QuzKCghM=; b=d1JEwd5vRF3z827zv4z59PNzNtEA9RfZ1XYT+hgbVZyXVxe35LhmDnyYMEaaDY968o GV0rDaOejomobi/ItVYiqne687Cp8weHQEGZefTLQIyn0aRGEgSsRfFjm/F9SxXU373r q0eRFKhUrvl4Tzr2wMlv1hQY/2F1iJ0a977dleOoRiOaEFDvpYZbC5sgZ7mTFbf7cSjT d3KjFpZfLLSjUN53ZdqrThy3dWNeRE1wwwjCUNSn4OPvn7JXqeBY99vOSW44IBBfyVY8 xrRtkkhQBLGbvZ61IhpNCvKPwb+2xfMCgqvdBvXmZtvdoFOSTpbprQJMMbJofOTZorza TpEg== 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; bh=rG775xg9CG6SNK9PCraQCI9l3jLjrhvwFP2QuzKCghM=; b=lW6HPAEXJ93r//Gcx+oy91hy9PCI7UKBKQFhwWyshHZW025pyCFexcWbZEmzsupPlv ZtXOdiLHmMxgPXmht2DNk+2DP8/eaoF1MGcbzxC6JL97wftA3w1xhZg5j0p4byLPx2aO 7ku3bh0cv0i72bb493hVdK5vR3DFZhSh7Ybxl7bUSXieNkhZn3E/xd+FQGkj3YyNwljF M7Ye7O7U6mCB06pBbNVQpNK/MbRHFSlwChKToCd4Xn5M8W7sxe2XuNjkbteEy59cMPo2 M4QGhzxrKFGtoGfrOxA3xMBp3yB4pPH0jgXc6O26u+Azx8iYrHxIIrxaVD8DX5roba7v oVtg== X-Gm-Message-State: AKGB3mJLky9tfPq2r5dL54/f9Yb+TodzgPJ/F7kQulSOEKEJtJd/sqAP HpOl4iQN9tnNd/fOgW2IB+i6Hg== X-Google-Smtp-Source: ACJfBouus4S2gK5hG94ZQ1K7kR39pDvSPeRC6EMAhyIvRDMil9E1XUMPsihj9iZA+rinqBMS/PvUCA== X-Received: by 10.159.229.202 with SMTP id t10mr21784307plq.424.1515665560715; Thu, 11 Jan 2018 02:12:40 -0800 (PST) Received: from simonLocalRHEL7.cn.ibm.com ([112.73.0.88]) by smtp.gmail.com with ESMTPSA id m11sm34336122pgt.56.2018.01.11.02.12.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jan 2018 02:12:40 -0800 (PST) From: wei.guo.simon@gmail.com To: linuxppc-dev@lists.ozlabs.org Cc: Paul Mackerras , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Simon Guo Subject: [PATCH 14/26] KVM: PPC: Book3S PR: export tm_enable()/tm_disable/tm_abort() APIs Date: Thu, 11 Jan 2018 18:11:27 +0800 Message-Id: <1515665499-31710-15-git-send-email-wei.guo.simon@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515665499-31710-1-git-send-email-wei.guo.simon@gmail.com> References: <1515665499-31710-1-git-send-email-wei.guo.simon@gmail.com> Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org From: Simon Guo This patch exports tm_enable()/tm_disable/tm_abort() APIs, which will be used for PR KVM transaction memory logic. Signed-off-by: Simon Guo Reviewed-by: Paul Mackerras --- arch/powerpc/include/asm/asm-prototypes.h | 3 +++ arch/powerpc/include/asm/tm.h | 2 -- arch/powerpc/kernel/tm.S | 12 ++++++++++++ arch/powerpc/mm/hash_utils_64.c | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h index 9c3b290..2a0f54e 100644 --- a/arch/powerpc/include/asm/asm-prototypes.h +++ b/arch/powerpc/include/asm/asm-prototypes.h @@ -133,4 +133,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, void _kvmppc_save_tm_pr(struct kvm_vcpu *vcpu, u64 guest_msr); #endif +void tm_enable(void); +void tm_disable(void); +void tm_abort(uint8_t cause); #endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */ diff --git a/arch/powerpc/include/asm/tm.h b/arch/powerpc/include/asm/tm.h index b1658c9..e94f6db 100644 --- a/arch/powerpc/include/asm/tm.h +++ b/arch/powerpc/include/asm/tm.h @@ -10,12 +10,10 @@ #ifndef __ASSEMBLY__ -extern void tm_enable(void); extern void tm_reclaim(struct thread_struct *thread, uint8_t cause); extern void tm_reclaim_current(uint8_t cause); extern void tm_recheckpoint(struct thread_struct *thread); -extern void tm_abort(uint8_t cause); extern void tm_save_sprs(struct thread_struct *thread); extern void tm_restore_sprs(struct thread_struct *thread); diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S index b92ac8e..ff12f47 100644 --- a/arch/powerpc/kernel/tm.S +++ b/arch/powerpc/kernel/tm.S @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef CONFIG_VSX /* See fpu.S, this is borrowed from there */ @@ -55,6 +56,16 @@ _GLOBAL(tm_enable) or r4, r4, r3 mtmsrd r4 1: blr +EXPORT_SYMBOL_GPL(tm_enable); + +_GLOBAL(tm_disable) + mfmsr r4 + li r3, MSR_TM >> 32 + sldi r3, r3, 32 + andc r4, r4, r3 + mtmsrd r4 + blr +EXPORT_SYMBOL_GPL(tm_disable); _GLOBAL(tm_save_sprs) mfspr r0, SPRN_TFHAR @@ -78,6 +89,7 @@ _GLOBAL(tm_restore_sprs) _GLOBAL(tm_abort) TABORT(R3) blr +EXPORT_SYMBOL_GPL(tm_abort); /* void tm_reclaim(struct thread_struct *thread, * uint8_t cause) diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 655a5a9..d354de6 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -63,6 +63,7 @@ #include #include #include +#include #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)