From patchwork Tue Nov 10 22:41:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 7592581 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 7ABBF9F392 for ; Tue, 10 Nov 2015 23:02:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A82AC20445 for ; Tue, 10 Nov 2015 23:02:19 +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 D7B04205EE for ; Tue, 10 Nov 2015 23:02:18 +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 1ZwHuA-0007NA-L1; Tue, 10 Nov 2015 23:00:46 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZwHu7-0007Ge-77 for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2015 23:00:44 +0000 Received: by pacdm15 with SMTP id dm15so10509617pac.3 for ; Tue, 10 Nov 2015 15:00:22 -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:in-reply-to:references; bh=LxxOLTEFSExeYixZYFW9vwwvihNdl5MGLdtg1RymEgw=; b=AzmCgcYKzvvazxXTko1S+StQsZEexlrPpxMN/lQBNlW76GB7pmQ4TEzUv8dOOsX99S ssqqi6QvzexZ4xK9yhO22vZ7vSQ79NFxpugxkSPQ7619sBbj0xCO/v4VvHpL+j9f/qxk +z+p5esTuY62vZ+5fJiN6p0+T9k4ZHqERXGMRKVhKvXw6DBDZms44U9ZF/3lKnVV9B6m P4r7k+oAETQ6bqc818dxyWpD3pH9yRwPfsobGNqvlbB7pcVhC25i4J880Hfm1E1N+Uhk RogpWeB4Uo4mfKpn0hdEYS6jj4+uYJlYsF21EJBc9LqETebWJ8I1GEUOa8QlhQbM+j6r vimQ== 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:in-reply-to :references; bh=LxxOLTEFSExeYixZYFW9vwwvihNdl5MGLdtg1RymEgw=; b=AZErppBIFUglNKxQh2UcoURQnuCw+gwDi/pYPM0Tn/UYg3B0UVrDPhx+UwFLOP2TsN 4kt2ljIJ9f2sAmfgKC0ptP6Zu0EERNADmsd+JaI+PspCoNO+Ap1BxjGYTn7gHNI0LeMr Mpwv7IHfPkx0212mMSosupipKIAW6em+WT8A7VicDc0nlvE164h+46jmmLDRpBpU8JZR jIZqcvdAKYgn+gRgoJp9HeJIfxXqxVNr0CzkYG0R51WFv0C5L5e47Vks7IbefTT1Ufhl 81Wo31UsEY8LQC6OTvLMbMYduqiAmENsSidzgbCL6PJ9DFeSa1MVtBn2fHAngTKfHzzC a9+w== X-Gm-Message-State: ALoCoQnDC00aVR9q5Vk7DHGrX0fO2YiGjwEi0kQC11/mvHcam5bD6xsGjFxCFRVsVtuKd72ULtIY X-Received: by 10.68.203.132 with SMTP id kq4mr9604241pbc.82.1447196422268; Tue, 10 Nov 2015 15:00:22 -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 c5sm6102743pbu.18.2015.11.10.15.00.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2015 15:00:21 -0800 (PST) From: Yang Shi To: ast@kernel.org, daniel@iogearbox.net, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH 1/2] arm64: bpf: add 'store immediate' instruction Date: Tue, 10 Nov 2015 14:41:40 -0800 Message-Id: <1447195301-16757-2-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1447195301-16757-1-git-send-email-yang.shi@linaro.org> References: <1447195301-16757-1-git-send-email-yang.shi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151110_150043_346899_4431DE33 X-CRM114-Status: GOOD ( 11.60 ) 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 --- 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: