From patchwork Wed May 23 07:01:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Guo X-Patchwork-Id: 918838 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rPzf4qqsz9s1b for ; Wed, 23 May 2018 17:59:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VbXAyiK+"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rPzf3DGYzF0dm for ; Wed, 23 May 2018 17:59:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="VbXAyiK+"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=wei.guo.simon@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VbXAyiK+"; dkim-atps=neutral Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (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 40rPk26CfdzDr43 for ; Wed, 23 May 2018 17:47:22 +1000 (AEST) Received: by mail-pl0-x241.google.com with SMTP id 30-v6so12502240pld.13 for ; Wed, 23 May 2018 00:47:22 -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; bh=OcCTrJlYrkmbeHXaZ316asCl+w1XeFls7UY79hpl59k=; b=VbXAyiK+F8XK7hKSB3pmBtaIuE1/JGY2A0kxPW8pVfxEGqUxKEKCORZNdQlqUB/7E6 iwTTRa48XigsEDr4HR1YweVNzLc4x2yKVY9lXOobgwQg3YIUrCFNaOyhTRe3d45PHVrP 69DLUiFPHkJiNx8IGSpfFPf2rkr9DMg9j95HjzFMp92c2HxkL2KTN+GsscC9Gr9uF9if hzI7O20PGdaBXg3MYfIawpK96uZkfUEJvnE6Z243ux6vKaItaxi8Lyv7xL2c/EA62OTF SF7swV8oPAODMd4H1gtTWFobxBa2ENd6Swrb5xxSPTqB701gTxDajlD5fTc4vKz4X0E5 ydMg== 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=OcCTrJlYrkmbeHXaZ316asCl+w1XeFls7UY79hpl59k=; b=oZI2zDwfQx5SzLry+MIK0M8JCwR2NdsDVeI5h3+wfzuhc2Hxq2mz8USLzR69z+1mdY AFxTBnvk1uCvDyNXIwVTrt1jTnI8CI4ZkM0ibMqbkPhPT75Iuwv1NYIQNSn0xuf43vbx Q72tx1odhny00Fi1EfPTiz+uqRLDaY3Rs32t8NXSVZKdwmjmrzMzKCckJ+B7YeqOyvjL xP6YWAc65nx/skq3k3g8rHzi8NWyAMt3AkGMCPagmP9xoFDN4F8uruH8PJo0GtPJA1/q AaUxOcjyB41/ctYs5DXNnh3wvjWfa4wEZz3XuG3vVBxTngz4IJ/kywh9AXyJU35OxiII DfEA== X-Gm-Message-State: ALKqPweGMAxApxGCyY5mxrEWRs3WLGnzhbixnH6YA8rEov4kCYKEiXTR CZxBmP4RrSlF10zPcjSwaN+tkg== X-Google-Smtp-Source: AB8JxZp656+rbBCHJbqqouUWn9+vtemYiuIeVk3SMqGsB5lQItxjphicGPtftriUv0td+suXcPRbYw== X-Received: by 2002:a17:902:8a91:: with SMTP id p17-v6mr1878980plo.18.1527061640847; Wed, 23 May 2018 00:47:20 -0700 (PDT) Received: from simonLocalRHEL7.cn.ibm.com ([112.73.0.89]) by smtp.gmail.com with ESMTPSA id a4-v6sm39079171pfj.19.2018.05.23.00.47.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 00:47:20 -0700 (PDT) From: wei.guo.simon@gmail.com To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v4 03/29] powerpc: export tm_enable()/tm_disable/tm_abort() APIs Date: Wed, 23 May 2018 15:01:46 +0800 Message-Id: <1527058932-7434-4-git-send-email-wei.guo.simon@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1527058932-7434-1-git-send-email-wei.guo.simon@gmail.com> References: <1527058932-7434-1-git-send-email-wei.guo.simon@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Simon Guo , kvm-ppc@vger.kernel.org, kvm@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 d9713ad..dfdcb23 100644 --- a/arch/powerpc/include/asm/asm-prototypes.h +++ b/arch/powerpc/include/asm/asm-prototypes.h @@ -141,4 +141,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, void pnv_power9_force_smt4_catch(void); void pnv_power9_force_smt4_release(void); +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 0bd3790..1bd8b4c1 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -64,6 +64,7 @@ #include #include #include +#include #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)