qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: patches@linaro.org, "Richard Henderson" <rth@twiddle.net>,
	"Emilio G . Cota" <cota@braap.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"KONRAD Frederic" <frederic.konrad@adacore.com>
Subject: [Qemu-devel] [PATCH 0/6] accel/tcg: Support execution from MMIO and small MMU regions
Date: Tue, 10 Jul 2018 17:00:07 +0100	[thread overview]
Message-ID: <20180710160013.26559-1-peter.maydell@linaro.org> (raw)

This series adds support to TCG for executing from MMIO regions
and small MMU regions. The basic principle is that if get_page_addr_code()
finds that the region is not backed by a full page of RAM then it
returns -1, and tb_gen_code() then generates a non-cached TB
containing a single instruction. Execution from these regions
thus performs the instruction fetch every time, ensuring that we
get the read-from-MMIO and check-small-MMU-region permissions
checks right.

This means that the code path for "generate bus fault for failing
to load an instruction" no longer goes through get_page_addr_code(),
but instead via each target's translate code and its calls to
the cpu_ld*_code() or similar functions. Patch 1 makes sure we
can distinguish insn fetches from data loads when generating the
bus fault exceptions. (Aside: I have assumed that all cpu_ld*_code()
loads should trigger iside faults rather than dside. Hopefully this
is true...)

Patches 2 and 3 make trivial fixes to various callers of
get_page_addr_code(); patch 4 does the work of generating our
single-insn TBs. Patch 5 can then remove all the code that
(mis)handles MMIO regions from get_page_addr_code(). Finally
patch 6 drops the target/arm workarounds for not having support
for executing from small MPU regions.

Note for the Xilinx folks: this patchset makes the mmio-exec
testcase for running from the SPI flash pass. Cedric: you might
like to test the aspeed image you had that relies on execution
from an MMIO region too.

The diffstat is pretty satisfying for a patchset that adds
a feature, but it actually undersells it: this code renders the
hw/misc/mmio_interface.c and the mmio_ptr related code in memory.c
and the xilinx-spips device all obsolete, so there are another
couple of hundred lines of code to be deleted there. I opted not
to include that in this patchset, for ease of review.

NB: I tested this with icount, but there are potentially
some weird things that could happen with interactions between
icount's io-recompile and execution from an MMIO device
that returns different instructions each time it's read.

thanks
-- PMM


Peter Maydell (6):
  accel/tcg: Pass read access type through to io_readx()
  accel/tcg: Handle get_page_addr_code() returning -1 in hashtable
    lookups
  accel/tcg: Handle get_page_addr_code() returning -1 in
    tb_check_watchpoint()
  accel/tcg: tb_gen_code(): Create single-insn TB for execution from
    non-RAM
  accel/tcg: Return -1 for execution from MMIO regions in
    get_page_addr_code()
  target/arm: Allow execution from small regions

 accel/tcg/softmmu_template.h |  11 ++--
 include/qom/cpu.h            |   6 +++
 accel/tcg/cpu-exec.c         |   3 ++
 accel/tcg/cputlb.c           | 100 +++++------------------------------
 accel/tcg/translate-all.c    |  23 +++++++-
 memory.c                     |   3 +-
 target/arm/helper.c          |  23 --------
 7 files changed, 52 insertions(+), 117 deletions(-)

-- 
2.17.1

             reply	other threads:[~2018-07-10 16:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 16:00 Peter Maydell [this message]
2018-07-10 16:00 ` [Qemu-devel] [PATCH 1/6] accel/tcg: Pass read access type through to io_readx() Peter Maydell
2018-07-10 18:19   ` Richard Henderson
2018-07-11 14:06   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-07-10 16:00 ` [Qemu-devel] [PATCH 2/6] accel/tcg: Handle get_page_addr_code() returning -1 in hashtable lookups Peter Maydell
2018-07-10 18:23   ` Richard Henderson
2018-07-13 16:44   ` Emilio G. Cota
2018-07-10 16:00 ` [Qemu-devel] [PATCH 3/6] accel/tcg: Handle get_page_addr_code() returning -1 in tb_check_watchpoint() Peter Maydell
2018-07-10 18:27   ` Richard Henderson
2018-07-10 16:00 ` [Qemu-devel] [PATCH 4/6] accel/tcg: tb_gen_code(): Create single-insn TB for execution from non-RAM Peter Maydell
2018-07-10 18:30   ` Richard Henderson
2018-07-13 16:41   ` Emilio G. Cota
2018-07-10 16:00 ` [Qemu-devel] [PATCH 5/6] accel/tcg: Return -1 for execution from MMIO regions in get_page_addr_code() Peter Maydell
2018-07-10 18:33   ` Richard Henderson
2018-07-11 14:36   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-11-14 17:19   ` [Qemu-devel] " Thomas Huth
2018-11-15  7:32     ` Richard Henderson
2018-11-15 13:53       ` Peter Maydell
2018-11-15 16:00         ` Richard Henderson
2018-07-10 16:00 ` [Qemu-devel] [PATCH 6/6] target/arm: Allow execution from small regions Peter Maydell
2018-07-10 18:34   ` Richard Henderson
2018-07-11 15:09   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-07-11  4:21 ` [Qemu-devel] [Qemu-arm] [PATCH 0/6] accel/tcg: Support execution from MMIO and small MMU regions Philippe Mathieu-Daudé
2018-07-12 16:37   ` Peter Maydell
2018-07-13 15:13     ` Peter Maydell
2018-07-16 12:30 ` [Qemu-devel] " KONRAD Frederic
2018-07-16 13:02   ` Peter Maydell
2018-07-23 14:57 ` Cédric Le Goater
2018-07-23 15:17   ` Peter Maydell
2018-07-23 15:51     ` Cédric Le Goater
2018-07-23 15:11 ` Cédric Le Goater
2018-07-24 12:23 ` [Qemu-devel] [Qemu-arm] " Peter Maydell

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=20180710160013.26559-1-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=clg@kaod.org \
    --cc=cota@braap.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=frederic.konrad@adacore.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).