Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp780606lqo; Fri, 17 May 2024 00:58:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUB4fO69rOzLdL9kWfFVLpp2zUW197nEi6a+Mezj4Murycr8rTOGptvIakiaRPAgxDKc3yfGiT+YLrbb6tPDjdSrUXRi41f0mtppRLQNA== X-Google-Smtp-Source: AGHT+IGBDbxLxFSDKAzkLQSIxyHJl4B0DkqRJ+79KnilBMzeAxfxV+NMr/jsSSxJYKtdGzxF7+wW X-Received: by 2002:a9d:3e49:0:b0:6f0:e813:8809 with SMTP id 46e09a7af769-6f0e90f3a34mr25213849a34.6.1715932694861; Fri, 17 May 2024 00:58:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715932694; cv=pass; d=google.com; s=arc-20160816; b=TZ5lWQrWBSswyKuzWp3AIM0PDoH/H+BCi4uVa5oP+K7huigqs0YpZj45fVoNpqA/qU 5HYAISBoFnaqa7OTNM0E5+tES4yy/SQZsy4W65tBMVqobyPRh7Jk+fWpESlz5BEh74ZI KnEcLtJkg2X9ieWtLeWGhz1gXW6+37b68olCjcAOIgUDuS8jxVjw9Qs3qsd0Ul9Zotxw bMH68R6jyO01+bB/lCeJ9q9DV0DYruXkcY9+VFB1ToYRFg63/PVioTA3Kpllm5ymCrc7 ZhLRGFZfR4BwM5h0ONkNaT8JHFqfyqUu6nY38r0bqJDAiKEug3VFE55KMnIH06KMHtCn raKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5CsmDbbLDOx1vnhJg69VuCy0uaob3Dg5hNF61pmV/Vg=; fh=GqQv+Wf+lcinXVluNkF8mHeoGyIkWWhsV76wytrlFbc=; b=YVd4MAOIGpSTT15mb/wVnKYbMS7E9uo/fvfgidz/HBJZhx0m9tIDd4C0oKGMG4CVvt ThQd/5DfaIXogv6Z6nSYalPM5S3O0NtMVixD57UwdAoDKdLPmAlrmqFvrmDADnF2CYvC PTE2ILCOTJPd0QTWUxr12kJ4YPwAl+gUfXhj4KW6bBFe8zLvsCD7xOYMxBPVDArvCdpL UZ0+CJzpZpBrROw4FNjIk9gN8G04c37w0Hx51SP3N5tn4/cDon04JlWEFa19gwHqOF1a fE68k+PRgxt3YjlMhPOovgLmDJGCVT2FP1redSZFSygX5wb6JbJtMlWmu4IvHd8ddoF0 NSjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JVAjOPT0; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-181828-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181828-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-65c22a17162si2169490a12.475.2024.05.17.00.58.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 00:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181828-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JVAjOPT0; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-181828-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181828-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 492892829B4 for ; Fri, 17 May 2024 07:58:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54BA72E41C; Fri, 17 May 2024 07:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JVAjOPT0" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4BEB1A28D for ; Fri, 17 May 2024 07:57:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932628; cv=none; b=HP6Lyj3G3UHHu6hfkLAfvhIgyA7hIHKMAXCJJjx9YJnC1RmoS9DEkEfokO1/gToxrqFF3EgwEfDdvQ+Xau2hjX9KE6LisGSOhx6GbkHiafDggz/iAJz1yl5PPrND57LXEL8Zajz1zUlG8vlFl/NtrANw5hrr+fbgWbOb7o/gMQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932628; c=relaxed/simple; bh=0Zhpfwr2bblfm7k3g5cvVUI3dQpNdm2TqtvTSVzfgYM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vxt+SSNXPy+rRU99gbLrxj39F/4OEqdNQbDAX1F5i4dVT4u+41g1doSV6G+MviOyaBsDxKWEe3nZugBmH+O6zHbCvzyETAu0OQNRG7Q7glRUEBynIZS4E1rkuqorffu11dTna5NZr/usrB6dRcUC6XyPwfrtQSLqK52eCfVWI1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JVAjOPT0; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715932624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5CsmDbbLDOx1vnhJg69VuCy0uaob3Dg5hNF61pmV/Vg=; b=JVAjOPT08W1HIekJDx0EewE6euPdT7iAlrNNfBBrwuZVl1TBnOl5yFE1nw/YWOfNRGKT2B 90INl4S7HYfYinlmMMkm6xKss1iqBmRjaUkqUqgBaf5yzaytLtFMqL0Nn7jyDPLiKMVutd 1LZf3wYI3g5rr608ib4C2Swzs2gLo18= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-315-HFKoaS62NtCAXc51ApmXvA-1; Fri, 17 May 2024 03:57:01 -0400 X-MC-Unique: HFKoaS62NtCAXc51ApmXvA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DAEC5802079; Fri, 17 May 2024 07:57:00 +0000 (UTC) Received: from alecto.usersys.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E28F740F; Fri, 17 May 2024 07:56:59 +0000 (UTC) From: Artem Savkov To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , linuxppc-dev@lists.ozlabs.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Artem Savkov Subject: [PATCH 2/5] powerpc64/bpf: jit support for unconditional byte swap Date: Fri, 17 May 2024 09:56:47 +0200 Message-ID: <20240517075650.248801-3-asavkov@redhat.com> In-Reply-To: <20240517075650.248801-1-asavkov@redhat.com> References: <20240517075650.248801-1-asavkov@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Add jit support for unconditional byte swap. Tested using BSWAP tests from test_bpf module. Signed-off-by: Artem Savkov --- arch/powerpc/net/bpf_jit_comp64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index 3071205782b15..97191cf091bbf 100644 --- a/arch/powerpc/net/bpf_jit_comp64.c +++ b/arch/powerpc/net/bpf_jit_comp64.c @@ -699,11 +699,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code */ case BPF_ALU | BPF_END | BPF_FROM_LE: case BPF_ALU | BPF_END | BPF_FROM_BE: + case BPF_ALU64 | BPF_END | BPF_FROM_LE: #ifdef __BIG_ENDIAN__ if (BPF_SRC(code) == BPF_FROM_BE) goto emit_clear; #else /* !__BIG_ENDIAN__ */ - if (BPF_SRC(code) == BPF_FROM_LE) + if (BPF_CLASS(code) == BPF_ALU && BPF_SRC(code) == BPF_FROM_LE) goto emit_clear; #endif switch (imm) { -- 2.45.0