Received: by 10.213.65.68 with SMTP id h4csp148625imn; Thu, 15 Mar 2018 12:20:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELv0+O7gLlqs4RSOWqIMupYGZnPV4FpRJ6SbFA0vzRQnmEm4sopDjC7Gi2n+0FssIbjvSR6X X-Received: by 2002:a17:902:9a81:: with SMTP id w1-v6mr9391999plp.344.1521141620835; Thu, 15 Mar 2018 12:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521141620; cv=none; d=google.com; s=arc-20160816; b=H8+VBrbYkKkzdR+ZySyvExnIyaBf2pz36ypVG1DwADtz3mooG5mXm3pQ9c7CGDs0rG Wm3xR5pEXL9Pj+pJA5/TN3XuBunCXS8ZnL2hMO9jHsSy+LMR1PvhERytx3NZXBRqo+mf qI9iUtu6qpib99WgqO3/sw7u42a+Tihtif3Aj0Ma2hLOUcM+vLscuQqUhYzlcBBK2Cvc eUx4hcFEy0PQwiUT1KoLErOPlGwvQpCRoWyTAafLLocZlkHVpp+KiX3UjpKehBidGAdv /aLwKfQG8xdaAfy8lQdDoQ6XeyyEmSvDBoHINLkF7Pv2xWP+Vc1uFWais7Aom2gZtb2f Nxnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=MjeQH6/o+pSQUiPMo6susXjsjdsbYhgfwRnxrq1rbxc=; b=Xq4u0Kvnz7aKQW385aE2cUjEWU2FzEKj32zro30qc+/U2YlhoOzuLlyni1mzQDngif LT1G/QxRvJLcbMs3e3s1Pmpcre8tvV0IBGuyuRdH6IfovPrNeXPFWgDGtJF47v82tCtr BcHP5FzzFBziEoQYZSgmKFRs0DsiK7jFzElTnC41pR2ZdgTpJItrKaziEKur6n7T3igw c/NmU5dq6T2GX4QDhFY3vOUxOl+EukUuJ+xgxbHTTQuQaHb9+I8UCFllhqg6heuWdCc8 oWVhaib8ORiV2dTYRhCJffoeDjSAyPVI+fEm1t9iKbj+JgJG1DPK40DWF6Rcp8rmhCxn aQ+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si4247154pfk.72.2018.03.15.12.20.05; Thu, 15 Mar 2018 12:20:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752981AbeCOTQY (ORCPT + 99 others); Thu, 15 Mar 2018 15:16:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:45131 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752803AbeCOTQW (ORCPT ); Thu, 15 Mar 2018 15:16:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F1E9DAE16; Thu, 15 Mar 2018 19:16:20 +0000 (UTC) From: Michal Suchanek To: linuxppc-dev@lists.ozlabs.org Cc: Kate Stewart , Madhavan Srinivasan , Paul Mackerras , Michael Neuling , "Bryant G. Ly" , Mahesh Salgaonkar , "Naveen N. Rao" , Daniel Axtens , Nicholas Piggin , Al Viro , David Gibson , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Sergey Senozhatsky , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Masami Hiramatsu , Andrew Donnellan , Philippe Ombredanne , Joe Perches , Oliver O'Halloran , Andrew Morton , "Tobin C. Harding" , Michal Suchanek Subject: [PATCH RFC rebase 1/9] powerpc: Add barrier_nospec Date: Thu, 15 Mar 2018 20:15:50 +0100 Message-Id: <8cb7d41beef9bdd351120d0512f73ac3bfada168.1521141122.git.msuchanek@suse.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: <20180313200108.GA4082@hirez.programming.kicks-ass.net> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the firmware supports it an otherwise useless combination of ORI instruction arguments is interpreted as speculation barrier. Implement barrier_nospec using this instruction. Based on the out-of-tree gmb() implementation. Signed-off-by: Michal Suchanek --- arch/powerpc/include/asm/barrier.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h index 10daa1d56e0a..8e47b3abe405 100644 --- a/arch/powerpc/include/asm/barrier.h +++ b/arch/powerpc/include/asm/barrier.h @@ -75,6 +75,15 @@ do { \ ___p1; \ }) +/* TODO: add patching so this can be disabled */ +/* Prevent speculative execution past this barrier. */ +#define barrier_nospec_asm ori 31,31,0 +#ifdef __ASSEMBLY__ +#define barrier_nospec barrier_nospec_asm +#else +#define barrier_nospec() __asm__ __volatile__ (stringify_in_c(barrier_nospec_asm) : : :) +#endif + #include #endif /* _ASM_POWERPC_BARRIER_H */ -- 2.13.6