From: Andrew Jones <ajones@ventanamicro.com>
To: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, paul.walmsley@sifive.com,
palmer@dabbelt.com, aou@eecs.berkeley.edu, anup@brainfault.org,
mchitale@ventanamicro.com, heiko@sntech.de
Subject: [PATCH v2 0/4] riscv: Introduce support for defining instructions
Date: Wed, 31 Aug 2022 19:24:56 +0200 [thread overview]
Message-ID: <20220831172500.752195-1-ajones@ventanamicro.com> (raw)
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/
v2:
- Cleaned up some whitespace issues pointed out by Anup, myself
and checkpatch and dropped some {}
- Pushed the quoting of register tokens into the macros
- Picked up Anup's r-b's
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 | 113 ++++++++++++++++++++++++++
arch/riscv/kvm/tlb.c | 129 ++++--------------------------
arch/riscv/kvm/vcpu_exit.c | 29 ++-----
5 files changed, 146 insertions(+), 136 deletions(-)
create mode 100644 arch/riscv/include/asm/insn-def.h
--
2.37.2
next reply other threads:[~2022-08-31 17:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 17:24 Andrew Jones [this message]
2022-08-31 17:24 ` [PATCH v2 1/4] riscv: Add X register names to gpr-nums Andrew Jones
2022-09-02 6:51 ` Anup Patel
2022-08-31 17:24 ` [PATCH v2 2/4] riscv: Introduce support for defining instructions Andrew Jones
2022-09-02 6:52 ` Anup Patel
2022-09-08 15:49 ` Heiko Stübner
2022-09-08 16:03 ` Anup Patel
2022-09-08 16:55 ` Andrew Jones
2022-09-08 16:54 ` Andrew Jones
2022-09-09 11:23 ` Anup Patel
2022-09-09 12:10 ` Heiko Stübner
2022-08-31 17:24 ` [PATCH v2 3/4] riscv: KVM: Apply insn-def to hfence encodings Andrew Jones
2022-09-02 6:52 ` Anup Patel
2022-08-31 17:25 ` [PATCH v2 4/4] riscv: KVM: Apply insn-def to hlv encodings Andrew Jones
2022-09-02 6:53 ` Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220831172500.752195-1-ajones@ventanamicro.com \
--to=ajones@ventanamicro.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=heiko@sntech.de \
--cc=kvm-riscv@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mchitale@ventanamicro.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox