From patchwork Mon Apr 17 20:12:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 751543 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3w6KFN6gplz9s2x for ; Tue, 18 Apr 2017 06:12:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756015AbdDQUMy (ORCPT ); Mon, 17 Apr 2017 16:12:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45754 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754786AbdDQUMw (ORCPT ); Mon, 17 Apr 2017 16:12:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A90B17D0DC; Mon, 17 Apr 2017 20:12:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A90B17D0DC Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=davem@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A90B17D0DC Received: from localhost (ovpn-112-32.rdu2.redhat.com [10.10.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id BECC7783B5; Mon, 17 Apr 2017 20:12:50 +0000 (UTC) Date: Mon, 17 Apr 2017 16:12:50 -0400 (EDT) Message-Id: <20170417.161250.104252645310622929.davem@redhat.com> To: daniel@iogearbox.net Cc: sparclinux@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org Subject: Re: [PATCH RFC] sparc64: eBPF JIT From: David Miller In-Reply-To: <58F50D13.3090001@iogearbox.net> References: <20170416.233825.1748421481008153466.davem@davemloft.net> <58F50D13.3090001@iogearbox.net> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 17 Apr 2017 20:12:51 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Daniel Borkmann Date: Mon, 17 Apr 2017 20:44:35 +0200 > On a quick initial glance, you also need to map BPF_REG_AX. If > I understand the convention correctly, you could use L7 for that. > > You can test for it through tools/testing/selftests/bpf/test_kmod.sh > which exercises the test_bpf.ko under various sysctl combinations as > part of the BPF selftest suite. Ok, blinding works properly with this fix: --- arch/sparc/net/bpf_jit.h~ 2017-04-13 17:44:24.084936201 -0700 +++ arch/sparc/net/bpf_jit.h 2017-04-17 12:07:22.559029482 -0700 @@ -17,8 +17,10 @@ #ifndef __ASSEMBLER__ #define G0 0x00 #define G1 0x01 +#define G2 0x02 #define G3 0x03 #define G6 0x06 +#define G7 0x07 #define O0 0x08 #define O1 0x09 #define O2 0x0a --- arch/sparc/net/bpf_jit_comp.c~ 2017-04-16 20:24:49.060342700 -0700 +++ arch/sparc/net/bpf_jit_comp.c 2017-04-17 12:05:08.470048483 -0700 @@ -195,10 +195,12 @@ static const int bpf2sparc[] = { /* read-only frame pointer to access stack */ [BPF_REG_FP] = FP, + [BPF_REG_AX] = G7, + /* temporary register for internal BPF JIT */ [TMP_REG_1] = G1, - [TMP_REG_2] = G3, - [TMP_REG_3] = L6, + [TMP_REG_2] = G2, + [TMP_REG_3] = G3, [SKB_HLEN_REG] = L4, [SKB_DATA_REG] = L5, --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -31,7 +31,8 @@ config SPARC select ARCH_WANT_IPC_PARSE_VERSION select GENERIC_PCI_IOMAP select HAVE_NMI_WATCHDOG if SPARC64 - select HAVE_CBPF_JIT + select HAVE_CBPF_JIT if SPARC32 + select HAVE_EBPF_JIT if SPARC64 select HAVE_DEBUG_BUGVERBOSE select GENERIC_SMP_IDLE_THREAD select GENERIC_CLOCKEVENTS