Skip to content

consolidate PowerPC instruction encoding macros

Balamuruhan S linuxppc-dev 3 versions – Applied

Status from this message: Applied to powerpc/next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/26 patches 1 replyApplied
  2. v2 RFC posting 1/27 patches 8 repliesSuperseded
  3. v1 RFC4 patches 4 repliesSuperseded

Changes in v2 from the cover letter

-------------
* Fixed review comments from mpe by not wrapping the macro definitions
* Include Acked-by from Sandipan
* Rebase on master branch of linuxppc tree, to avoid conflict with prefixed instruction support

Patches in v2 posting 2/2 Applied

#Subject and filesSizeRepliesApplied
1/6powerpc/ppc-opcode: introduce PPC_RAW_* macros for base instruction encodingarch/powerpc/include/asm/ppc-opcode.h+82 -80 replies
2/6powerpc/ppc-opcode: move ppc instruction encoding from test_emulate_steparch/powerpc/include/asm/ppc-opcode.h arch/powerpc/lib/test_emulate_step.c+74 -990 replies
3/6powerpc/bpf_jit: reuse instruction macros from ppc-opcode.harch/powerpc/net/bpf_jit.h arch/powerpc/net/bpf_jit32.h arch/powerpc/net/bpf_jit64.h +2 more+19 -350 replies
4/6powerpc/ppc-opcode: consolidate powerpc instructions from bpf_jit.harch/powerpc/include/asm/ppc-opcode.h arch/powerpc/net/bpf_jit.h arch/powerpc/net/bpf_jit32.h +3 more+324 -3730 replies
5/6powerpc/ppc-opcode: reuse raw instruction macros to stringifyarch/powerpc/include/asm/ppc-opcode.h+71 -1490 replies
6/6powerpc/ppc-opcode: fold PPC_INST_* macros into PPC_RAW_* macrosarch/powerpc/include/asm/ppc-opcode.h+125 -2570 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchNaveen N. RaoSandipan Das
1/6A-b T-b
2/6A-b T-b A-b
3/6A-b T-b A-b
4/6A-b T-b A-b
5/6A-b T-b
6/6A-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/6] consolidate PowerPC instruction encoding macros

ppc-opcode.h have base instruction encoding wrapped with stringify_in_c() for raw encoding to have compatibility. But there are redundant macros for base instruction encodings in bpf, instruction emulation test infrastructure and powerpc selftests.

Currently PPC_INST_* macros are used for encoding instruction opcode and PPC_* for raw instuction encoding, this rfc patchset introduces PPC_RAW_* macros for base instruction encoding and reuse it from elsewhere. With this change we can avoid redundant macro definitions in multiple files and start adding new instructions in ppc-opcode.h in future.

Changes in v2:
-------------
* Fixed review comments from mpe by not wrapping the macro definitions
* Include Acked-by from Sandipan
* Rebase on master branch of linuxppc tree, to avoid conflict with prefixed instruction support

Changes in v1:
-------------
* Drop the patch that had changes in stringloops Makefile.
* Include Acked-by and Tested-by tag from Naveen.
* Rebased on next branch of linuxppc tree.

Changes in rfc v2:
-----------------
Fix review comments/suggestions from Naveen and Michael Ellerman,

* Rename PPC_ENCODE_* to PPC_RAW_* for base instruction encoding macros.
* Split the patches that does mass renaming and make them simpler that just adds new macros.
* Keep the patch to update all the existing names later (patch 6).
* Lot of PPC_INST_* macros are used only in ppc-opcode.h for PPC_* macros, fold PPC_INST_* encoding into PPC_RAW_* to avoid using them accidentally.
* Fixed clipped macros that was due to a typo/copy-paste
* Consolidated all the instruction encoding macros from bpf_jit.h to ppc-opcode.h
* squashed patch that removes the duplicate macro PPC_MR() in bpf_jit.h
* merge few changes in bpf_jit files from patch 2 into patch 3
* few fixes in powerpc selftest stringloops Makefile
* build tested for ppc64le_defconfig, ppc64e_defconfig and pmac32_defconfig
* Rebased on next branch of linuxppc tree

Testing:
-------
* Tested it by compiling vmlinux and comparing objdump of it with and without the patchset and observed that it remains same,

  # diff vmlinux_objdump vmlinux_rfc_objdump 
  2c2
  < vmlinux:     file format elf64-powerpcle
  ---
Quoted 1 line

vmlinux_rfc: file format elf64-powerpcle

* Tested building it with this changes for Fedora30 config, booted VM with powerpc next and powerpc next + patchset to run powerpc selftest and ftrace selftest. There were couple of failures that were common and patchset did not introduce any new failures.

ftrace selftest:
---------------
# # of passed: 96
# # of failed: 1
# # of unresolved: 7
# # of untested: 0
# # of unsupported: 1
# # of xfailed: 1
# # of undefined(test bug): 0
not ok 1 selftests: ftrace: ftracetest # exit=1

powerpc selftest:
----------------
not ok 7 selftests: powerpc/dscr: dscr_sysfs_thread_test # exit=1 not ok 20 selftests: powerpc/pmu/ebb: lost_exception_test # TIMEOUT not ok 2 selftests: powerpc/security: spectre_v2 # exit=1

Thanks to Naveen, Sandipan and Michael on overall suggestions/improvements.

I would request for review and suggestions to make it better.

v1: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-May/211441.html
rfc v2: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-April/209395.html
rfc v1: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-March/206494.html

Balamuruhan S (6):
powerpc/ppc-opcode: introduce PPC_RAW_* macros for base instruction
encoding
powerpc/ppc-opcode: move ppc instruction encoding from
test_emulate_step
powerpc/bpf_jit: reuse instruction macros from ppc-opcode.h powerpc/ppc-opcode: consolidate powerpc instructions from bpf_jit.h powerpc/ppc-opcode: reuse raw instruction macros to stringify powerpc/ppc-opcode: fold PPC_INST_* macros into PPC_RAW_* macros

 arch/powerpc/include/asm/ppc-opcode.h | 541 ++++++++++++--------------
 arch/powerpc/lib/test_emulate_step.c  | 155 +++-----
 arch/powerpc/net/bpf_jit.h            | 184 +--------
 arch/powerpc/net/bpf_jit32.h          |  34 +-
 arch/powerpc/net/bpf_jit64.h          |  16 +-
 arch/powerpc/net/bpf_jit_comp.c       | 134 +++----
 arch/powerpc/net/bpf_jit_comp64.c     | 298 +++++++-------
 7 files changed, 568 insertions(+), 794 deletions(-)

base-commit: 64677779e8962c20b580b471790fe42367750599

Signature · 1 line
2.24.1