Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp781238lqo; Fri, 17 May 2024 01:00:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVE1JqV+GK8x8VV+Fn5mTvZ7Fib7Zz/V6NkjbfkWIJUPdvY+CXb21VNyTlf+fVw1x6blK/LB6RdVhs05vQD8VNvMgstAeVrlqQ0otwKbQ== X-Google-Smtp-Source: AGHT+IFjxpvQP5vNdljyBVQdA20VAm0QYae/bKswdppr+GDkD0xg1umIUu4/j57cd9tzgKaWF9TI X-Received: by 2002:a17:902:bcc4:b0:1ee:c491:ab62 with SMTP id d9443c01a7336-1ef43d2ea47mr193108885ad.25.1715932805648; Fri, 17 May 2024 01:00:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715932805; cv=pass; d=google.com; s=arc-20160816; b=decrEtSMKsoKnnqDUwXK1D7x6MHk04KyvRIG8PU1N5BVAv1gbNxhrPuUkmOYOlQz5i LBHytALWmnSCmcboFhJCvAD42JJnTxSg3SoH//AFkPS/+6a3AfIW0FuW94pND+HhxBq4 uUyX0ObpeRM/ixvlPnomsLHgbOb32Rvt5DW50NZgFB3F/3tLT8+g5UPc5dPVdn9/zVnG jVC0C6rW1xxXCAA0AoVMdRN9MXP8EYpYrKAkC+2RZ1NOqhc6AY/B1PTw277XPbZbjFqu g9GBi5VtquvmAccWXFZ/md1UVQ1aylFKGlQbGjxq7ba1yPy1J3eXqbo3JFJH/+A7zdBD tPkQ== 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=EsCKnSd8SY21HTUjj+hbf4r5AF/uUdXnBR6lfnTM7uI=; fh=GqQv+Wf+lcinXVluNkF8mHeoGyIkWWhsV76wytrlFbc=; b=yPuo011DIfRFJaeq/XMXE10k8rpYG2FI4UXRzApQ5uvw7CEkQqR4XVhNPdmSM1wg2L 3EveOymFln+U3sBQLVF6EofH0kDDLTJEi8nVlUXS5WH8WHS78eG4i7Ay0PexDQgJOU5S zu9Qh5dFUKxR7uTE7Rp7nbiIMyczEQ3gVrB8w43QhXz5qLdKn0p1q9kZ72gAKFrv6jHF hU5uTW5QyqWQXGJYxBXW47p9J9d6O67PX0zMAHzy4G61ElMK9pf/k7DHVmiWH+JgYnvi EM75BuxwJ6I7WPV3ZGGvNc5eXAyi91SG1TKz2/LwCRyAR15fCg3ZZAE4VpwF5WAgT9q8 O+Kg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QiDohHNl; 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-181830-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181830-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f10e8f2a21si30605385ad.255.2024.05.17.01.00.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 01:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181830-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QiDohHNl; 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-181830-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181830-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 48224B21EA2 for ; Fri, 17 May 2024 07:58:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D962136B01; Fri, 17 May 2024 07:57:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QiDohHNl" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 912C52BD06 for ; Fri, 17 May 2024 07:57:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932630; cv=none; b=GaWLK9Bg7ynUppUWruwJexRCy0okpsWm/SXAUlDwW4OrpltZsGOvpN3YJKuJ2F+h7ILD3p9zSCr6lIc9lYXdeITweuV/RHXzanAGDltHfL9tR+wYt+cw9Ebw+QPXZrpNlPCBL8e4TusoNbVXOFQNeqxrB/cc/5iyyZRcJgnAO/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932630; c=relaxed/simple; bh=z3AwgBqlBUWCWye022RyFCz2f5ylMRfnUjZq4yLjspw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jEE7yzI8F2BZisvayvhc4xWUjq8ZiahA3ptc9ulKhguS2KdzL1aALq232gxeLydvLg9l742e1pjlfSkXcoJ1KyJ2PhAEg9gYMVd8jK+E+oufeqz3ESwgZc9U23ODK/vINruQBRC6csAzPVdiowgcGmT63+I4bdd2JnI+WsKya58= 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=QiDohHNl; arc=none smtp.client-ip=170.10.133.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=1715932627; 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=EsCKnSd8SY21HTUjj+hbf4r5AF/uUdXnBR6lfnTM7uI=; b=QiDohHNl2UxsSvd1HKGiKdzbEqzbGN8sc7SAsMhEoAiyji3AqmR6lw4h8+eh68X/yuSocA ZTDj0BqHjmlkg10TtVXXcHAWS6qjlX+P5NOgFK/hNBFsEeJm3Y6VpoeU9RbcDzF5kxB0Mj NH/F7MXdc255m94UFkWVTHmSRJaCDNU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-402-vWFqYgpbOEGkJTvFzMf7zg-1; Fri, 17 May 2024 03:57:05 -0400 X-MC-Unique: vWFqYgpbOEGkJTvFzMf7zg-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 765E529AA3AC; Fri, 17 May 2024 07:57:04 +0000 (UTC) Received: from alecto.usersys.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD402740F; Fri, 17 May 2024 07:57:02 +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 4/5] powerpc64/bpf: jit support for sign extended mov Date: Fri, 17 May 2024 09:56:49 +0200 Message-ID: <20240517075650.248801-5-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 sign extended mov. Tested using test_bpf module. Signed-off-by: Artem Savkov --- arch/powerpc/net/bpf_jit_comp64.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index b9f47398b311d..811775cfd3a1b 100644 --- a/arch/powerpc/net/bpf_jit_comp64.c +++ b/arch/powerpc/net/bpf_jit_comp64.c @@ -676,8 +676,14 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code /* special mov32 for zext */ EMIT(PPC_RAW_RLWINM(dst_reg, dst_reg, 0, 0, 31)); break; - } - EMIT(PPC_RAW_MR(dst_reg, src_reg)); + } else if (off == 8) { + EMIT(PPC_RAW_EXTSB(dst_reg, src_reg)); + } else if (off == 16) { + EMIT(PPC_RAW_EXTSH(dst_reg, src_reg)); + } else if (off == 32) { + EMIT(PPC_RAW_EXTSW(dst_reg, src_reg)); + } else if (dst_reg != src_reg) + EMIT(PPC_RAW_MR(dst_reg, src_reg)); goto bpf_alu32_trunc; case BPF_ALU | BPF_MOV | BPF_K: /* (u32) dst = imm */ case BPF_ALU64 | BPF_MOV | BPF_K: /* dst = (s64) imm */ -- 2.45.0