linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Léger" <cleger@rivosinc.com>
To: "Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Stafford Horne" <shorne@gmail.com>,
	"Brian Cain" <bcain@quicinc.com>,
	"Kefeng Wang" <wangkefeng.wang@huawei.com>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Clément Léger" <cleger@rivosinc.com>,
	"Sunil V L" <sunilvl@ventanamicro.com>,
	"Anup Patel" <apatel@ventanamicro.com>,
	"Atish Patra" <atishp@rivosinc.com>,
	"Andrew Jones" <ajones@ventanamicro.com>,
	"Conor Dooley" <conor.dooley@microchip.com>,
	"Heiko Stuebner" <heiko@sntech.de>, "Guo Ren" <guoren@kernel.org>,
	"Alexandre Ghiti" <alexghiti@rivosinc.com>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Xianting Tian" <xianting.tian@linux.alibaba.com>,
	"Sia Jee Heng" <jeeheng.sia@starfivetech.com>,
	"Li Zhengyu" <lizhengyu3@huawei.com>,
	"Jisheng Zhang" <jszhang@kernel.org>,
	"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Marc Zyngier" <maz@kernel.org>,
	"Björn Töpel" <bjorn@rivosinc.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 0/6] Add support to handle misaligned accesses in S-mode
Date: Sat, 24 Jun 2023 14:20:43 +0200	[thread overview]
Message-ID: <20230624122049.7886-1-cleger@rivosinc.com> (raw)

Since commit 61cadb9 ("Provide new description of misaligned load/store
behavior compatible with privileged architecture.") in the RISC-V ISA
manual, it is stated that misaligned load/store might not be supported.
However, the RISC-V kernel uABI describes that misaligned accesses are
supported. In order to support that, this series adds support for S-mode
handling of misaligned accesses, SBI call for misaligned trap delegation
as well prctl support for PR_SET_UNALIGN.

Handling misaligned access in kernel allows for a finer grain control
of the misaligned accesses behavior, and thanks to the prctl call, can
allow disabling misaligned access emulation to generate SIGBUS. User
space software can then be optimized by removing such access based on
SIGBUS generation.

This series relies on a SBI extension [1] allowing to request delegation of
the misaligned load/store traps to the S-mode software. This extension
has been submitted for review to the riscv tech-prs group.

This work was tested on spike since Qemu does transparently handles
misaligned access.

[1] https://lists.riscv.org/g/tech-prs/message/472i

Clément Léger (6):
  riscv: remove unused functions in traps_misaligned.c
  riscv: add support for misaligned handling in S-mode
  riscv: allow S-mode to handle misaligned traps
  riscv: add support for SBI misalignment trap delegation
  riscv: add support for PR_SET_UNALIGN and PR_GET_UNALIGN
  riscv: add floating point insn support to misaligned access emulation

 arch/riscv/include/asm/processor.h   |   9 +
 arch/riscv/include/asm/sbi.h         |  12 ++
 arch/riscv/kernel/Makefile           |   2 +-
 arch/riscv/kernel/fpu.S              | 118 ++++++++++++
 arch/riscv/kernel/process.c          |  20 ++
 arch/riscv/kernel/sbi.c              |  28 +++
 arch/riscv/kernel/traps.c            |   7 -
 arch/riscv/kernel/traps_misaligned.c | 276 ++++++++++++++++++++++-----
 8 files changed, 417 insertions(+), 55 deletions(-)

-- 
2.40.1


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

             reply	other threads:[~2023-06-24 12:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-24 12:20 Clément Léger [this message]
2023-06-24 12:20 ` [RFC PATCH 1/6] riscv: remove unused functions in traps_misaligned.c Clément Léger
2023-06-24 12:20 ` [RFC PATCH 2/6] riscv: add support for misaligned handling in S-mode Clément Léger
2023-06-24 12:20 ` [RFC PATCH 3/6] riscv: allow S-mode to handle misaligned traps Clément Léger
2023-06-24 12:20 ` [RFC PATCH 4/6] riscv: add support for SBI misalignment trap delegation Clément Léger
2023-06-24 12:20 ` [RFC PATCH 5/6] riscv: add support for PR_SET_UNALIGN and PR_GET_UNALIGN Clément Léger
2023-06-24 12:20 ` [RFC PATCH 6/6] riscv: add floating point insn support to misaligned access emulation Clément Léger

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=20230624122049.7886-1-cleger@rivosinc.com \
    --to=cleger@rivosinc.com \
    --cc=ajones@ventanamicro.com \
    --cc=alexghiti@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=atishp@rivosinc.com \
    --cc=bcain@quicinc.com \
    --cc=bjorn@rivosinc.com \
    --cc=conor.dooley@microchip.com \
    --cc=gautham.shenoy@amd.com \
    --cc=guoren@kernel.org \
    --cc=heiko@sntech.de \
    --cc=jeeheng.sia@starfivetech.com \
    --cc=jszhang@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lizhengyu3@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=masahiroy@kernel.org \
    --cc=maz@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=peterz@infradead.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=shorne@gmail.com \
    --cc=sunilvl@ventanamicro.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xianting.tian@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).