From patchwork Mon Jan 31 18:36:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12731016 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75AA1C4167D for ; Mon, 31 Jan 2022 18:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355653AbiAaSgy (ORCPT ); Mon, 31 Jan 2022 13:36:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350824AbiAaSgw (ORCPT ); Mon, 31 Jan 2022 13:36:52 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC408C06173D; Mon, 31 Jan 2022 10:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=95lu5RkgfPWM9UeysUZM6t6dw8NZZ00goVWEgHCmKMs=; b=ItaWmoz4PbYdOMsLLyDpOaIvQD NOdtZXydJYk7c8l3pkbwMpupRF9VISOkdds8ZDspyaS+vsfSvythYgl5mZFrBF29MWj1T532+UQOV pwzLy27M5cTsYyVhhvavloPO1YKJuCroorFpuK26xJjwFAvbK4NN/uizmUjIAxb+35cvYEShumIuA SIgL5VXp8BhY1aHLcQfDlApWaf8Hx1TNeRJybZTgsdLR30Iaa1MTJXarzPXPzdkogme9+Jr0Yvp0e oFtoaz7LtF5ekMqiGVWSlPlvzcpFKhn0s1Vb6oRUEzofREE/w+wm7aiYkmMj2hJR7PADztbxeBmcL h8Yi9TDw==; Received: from [2001:4bb8:191:327d:83ae:cf0e:db3c:eb79] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEbXj-00AOsE-5Q; Mon, 31 Jan 2022 18:36:47 +0000 From: Christoph Hellwig To: Jonathan Corbet , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , linux-doc@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 2/5] bpf, docs: Better document the regular load and store instructions Date: Mon, 31 Jan 2022 19:36:35 +0100 Message-Id: <20220131183638.3934982-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131183638.3934982-1-hch@lst.de> References: <20220131183638.3934982-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Add a separate section and a little intro blurb for the regular load and store instructions. Signed-off-by: Christoph Hellwig --- Documentation/bpf/instruction-set.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Documentation/bpf/instruction-set.rst b/Documentation/bpf/instruction-set.rst index 87f6ad62633a5..03da885301722 100644 --- a/Documentation/bpf/instruction-set.rst +++ b/Documentation/bpf/instruction-set.rst @@ -215,23 +215,30 @@ The mode modifier is one of: BPF_IMM 0x00 used for 64-bit mov BPF_ABS 0x20 legacy BPF packet access BPF_IND 0x40 legacy BPF packet access - BPF_MEM 0x60 all normal load and store operations + BPF_MEM 0x60 regular load and store operations BPF_ATOMIC 0xc0 atomic operations ============= ===== ==================================== -BPF_MEM | | BPF_STX means:: + +Regular load and store operations +--------------------------------- + +The ``BPF_MEM`` mode modifier is used to encode regular load and store +instructions that transfer data between a register and memory. + +``BPF_MEM | | BPF_STX`` means:: *(size *) (dst_reg + off) = src_reg -BPF_MEM | | BPF_ST means:: +``BPF_MEM | | BPF_ST`` means:: *(size *) (dst_reg + off) = imm32 -BPF_MEM | | BPF_LDX means:: +``BPF_MEM | | BPF_LDX`` means:: dst_reg = *(size *) (src_reg + off) -Where size is one of: BPF_B or BPF_H or BPF_W or BPF_DW. +Where size is one of: ``BPF_B``, ``BPF_H``, ``BPF_W``, or ``BPF_DW``. Atomic operations -----------------