From patchwork Mon Nov 30 22:24:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 7730901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 723099F387 for ; Mon, 30 Nov 2015 22:46:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86CB620660 for ; Mon, 30 Nov 2015 22:46:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2A7B2065F for ; Mon, 30 Nov 2015 22:46:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a3XAy-0008Sw-Sr; Mon, 30 Nov 2015 22:44:04 +0000 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a3XAw-0008PH-0s for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2015 22:44:02 +0000 Received: by pacej9 with SMTP id ej9so198604640pac.2 for ; Mon, 30 Nov 2015 14:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=5RCiLAeWSJzTzCoAPJIp4ghv9LaxaNUxgZhZVJHMMMw=; b=CF1GSqXFhC/dUlqDtaQL9dxQr/Qi6bmKlHBnZOJXEPkirSDwrtvnLO8KNSfCkiuLM2 W31llgoFQiKv+Hnz6W0xgFHLiDzQ2QrTus6YruhcbIaFlJObyRm1zEaqIuH3fI/PPcuc HEJmCk/GkznG/UuQb1C7k3I/pUD5lZ2Mbp8tg064wiFGYviG1S+sW7dhqs/n3lnVxQIM ik8QP9GntoTrg0fS1uhapGfVjh787qnYWx6nbDqmhZ/De77eNbOpjghqdgiiG/9q8yGc q9wKEtwYSZCu9rsSc3bi6dxp7MiHZQ0Ot759glLKapwaDnvecK1apJ2dk4LVGhdu2JN0 wckw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5RCiLAeWSJzTzCoAPJIp4ghv9LaxaNUxgZhZVJHMMMw=; b=aoFjKtrdYAu+hXkHE1542gHYcgWWqHppekkGcNzhTuH3P6v3elhju6zJfhCSOa9zoN rxJ5TP+hV53oJ0aYPVm152492d6KugKYcJBbwdXaGTX/G1bmE1k/CQa+Fy/pJ5BKa4pe ESbDGrgNc1A0XyI+VEz+GE+HCwOZVqAFo/I5HHPOAoyjijQ1rkDHPNBcUy4BfOH7qOAA zM1PKzK8YDNFWl+N1114zTceu5JjwDWgF4VE9Eo7ZmMVurUQCT0WqJ21lT0PHZaH5ZVd ULWo6AEK+xdhfrQcyew22A3weI1VuTUcBi3tadWPtDYxmH+HghR6qP7pB9PUMK6WHY+P rn0g== X-Gm-Message-State: ALoCoQkMQpIK4cn56/2IqNfHZOtUkAYBv3y+WFpmDmZOiUAj1siLdqlqEq9pqkD8kZvDMlv4VQih X-Received: by 10.98.14.67 with SMTP id w64mr75136473pfi.163.1448923420034; Mon, 30 Nov 2015 14:43:40 -0800 (PST) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id 186sm25045398pfa.24.2015.11.30.14.43.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Nov 2015 14:43:39 -0800 (PST) From: Yang Shi To: ast@kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, davem@davemloft.net Subject: [RESEND PATCH] arm64: bpf: add 'store immediate' instruction Date: Mon, 30 Nov 2015 14:24:07 -0800 Message-Id: <1448922247-5692-1-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151130_144402_117715_723B43D3 X-CRM114-Status: GOOD ( 10.84 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yang.shi@linaro.org, linaro-kernel@lists.linaro.org, zlim.lnx@gmail.com, linux-kernel@vger.kernel.org, xi.wang@gmail.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP aarch64 doesn't have native store immediate instruction, such operation has to be implemented by the below instruction sequence: Load immediate to register Store register Signed-off-by: Yang Shi CC: Zi Shen Lim CC: Xi Wang Reviewed-by: Zi Shen Lim --- Thsi patch might be buried by the storm of xadd discussion, however, it is absolutely irrelevent to xadd, so resend the patch itself. arch/arm64/net/bpf_jit_comp.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 6809647..49c1f1b 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -563,7 +563,25 @@ emit_cond_jmp: case BPF_ST | BPF_MEM | BPF_H: case BPF_ST | BPF_MEM | BPF_B: case BPF_ST | BPF_MEM | BPF_DW: - goto notyet; + /* Load imm to a register then store it */ + ctx->tmp_used = 1; + emit_a64_mov_i(1, tmp2, off, ctx); + emit_a64_mov_i(1, tmp, imm, ctx); + switch (BPF_SIZE(code)) { + case BPF_W: + emit(A64_STR32(tmp, dst, tmp2), ctx); + break; + case BPF_H: + emit(A64_STRH(tmp, dst, tmp2), ctx); + break; + case BPF_B: + emit(A64_STRB(tmp, dst, tmp2), ctx); + break; + case BPF_DW: + emit(A64_STR64(tmp, dst, tmp2), ctx); + break; + } + break; /* STX: *(size *)(dst + off) = src */ case BPF_STX | BPF_MEM | BPF_W: