public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/4] riscv: Introduce support for defining instructions
@ 2022-08-19 14:02 Andrew Jones
  2022-08-19 14:02 ` [PATCH 1/4] riscv: Add X register names to gpr-nums Andrew Jones
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Andrew Jones @ 2022-08-19 14:02 UTC (permalink / raw)
  To: linux-riscv, kvm-riscv
  Cc: linux-kernel, paul.walmsley, palmer, aou, anup, mchitale, heiko

When compiling with toolchains that haven't yet been taught about
new instructions we need to encode them ourselves. This series
creates a new file where support for instruction definitions can
evolve. For starters the file is initiated with a macro for R-type
encodings. The series then applies the R-type encoding macro to all
instances of hard coded instruction definitions in KVM.

Not only should using instruction encoding macros improve readability
and maintainability of code, but we should also gain potential for
more optimized code after compilation as the compiler will have control
over the input and output registers used, which may provide more
opportunities for inlining.

I grepped for other places we may want to use these macros and the
only place I found was ALT_CMO_OP(), but I didn't dare touch it :-)
I do suggest we apply this to the Svinal support [1] as we won't
want to frustrate the compiler's inlining efforts with hard coded
register selection.

[1] https://lore.kernel.org/linux-riscv/20220812042921.14508-1-mchitale@ventanamicro.com/

Andrew Jones (4):
  riscv: Add X register names to gpr-nums
  riscv: Introduce support for defining instructions
  riscv: KVM: Apply insn-def to hfence encodings
  riscv: KVM: Apply insn-def to hlv encodings

 arch/riscv/Kconfig                |   3 +
 arch/riscv/include/asm/gpr-num.h  |   8 ++
 arch/riscv/include/asm/insn-def.h | 104 ++++++++++++++++++++++++++
 arch/riscv/kvm/tlb.c              | 117 ++++--------------------------
 arch/riscv/kvm/vcpu_exit.c        |  29 ++------
 5 files changed, 133 insertions(+), 128 deletions(-)
 create mode 100644 arch/riscv/include/asm/insn-def.h

-- 
2.37.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-08-30  3:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-19 14:02 [PATCH 0/4] riscv: Introduce support for defining instructions Andrew Jones
2022-08-19 14:02 ` [PATCH 1/4] riscv: Add X register names to gpr-nums Andrew Jones
2022-08-29  8:24   ` Anup Patel
2022-08-19 14:02 ` [PATCH 2/4] riscv: Introduce support for defining instructions Andrew Jones
2022-08-19 14:26   ` Andrew Jones
2022-08-29  8:31   ` Anup Patel
2022-08-19 14:02 ` [PATCH 3/4] riscv: KVM: Apply insn-def to hfence encodings Andrew Jones
2022-08-29  8:37   ` Anup Patel
2022-08-29  9:47     ` Andrew Jones
2022-08-30  3:12       ` Anup Patel
2022-08-19 14:02 ` [PATCH 4/4] riscv: KVM: Apply insn-def to hlv encodings Andrew Jones
2022-08-29  8:44   ` Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox