qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-s390x@nongnu.org,
	Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	Anthony Green <green@moxielogic.com>,
	Chris Wulff <crwulff@gmail.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Alexander Graf <agraf@suse.de>, Max Filippov <jcmvbkbc@gmail.com>,
	Michael Walle <michael@walle.cc>,
	qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	Artyom Tarasenko <atar4qemu@gmail.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	Stafford Horne <shorne@gmail.com>,
	Guan Xuetao <gxt@mprc.pku.edu.cn>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [qemu-s390x] [PATCH 1/6] accel/tcg: add size paremeter in tlb_fill()
Date: Wed, 10 Jan 2018 14:42:42 +0100	[thread overview]
Message-ID: <525f7d10-54c5-eca9-0b45-62771afe9c59@vivier.eu> (raw)
In-Reply-To: <66de9088-f8ed-2be4-c71a-5d149c63587b@redhat.com>

Le 10/01/2018 à 09:43, David Hildenbrand a écrit :
> On 09.01.2018 00:10, Laurent Vivier wrote:
>> The MC68040 MMU provides the size of the access that
>> triggers the page fault.
>>
>> This size is set in the Special Status Word which
>> is written in the stack frame of the access fault
>> exception.
>>
>> So we need the size in m68k_cpu_unassigned_access() and
>> m68k_cpu_handle_mmu_fault().
>>
>> To be able to do that, this patch modifies the prototype of
>> handle_mmu_fault handler, tlb_fill() and probe_write().
>> do_unassigned_access() already includes a size parameter.
>>
>> This patch also updates handle_mmu_fault handlers and
>> tlb_fill() of all targets (only parameter, no code change).
>>
> 
> There are a couple of places where you use "1" (when no other size is
> available). e.g. in get_page_addr_code().
> 
> Wonder if that's the right thing to do - are there any architectures
> that e.g. always fetch at least 2 bytes in these conditions?
> 

It's a good question.

"1" is passed to probe_write() and tlb_fill() and handle_mmu_fault().
probe_write() calls tlb_fill(), and tlb_fill() calls machine
handle_mmu_fault handler.

As no existing handle_mmu_fault takes care of the access size, I think
passing 1 and ignoring it doesn't change the existing behavior.

probe_write() is used to check if a page is writable, and none of the
callers is guessing the write can cross a page boundary, so 1 is the
good value in this case.

get_page_addr_code() is the only user of tlb_fill() with 1. and callers
of get_page_addr_code() never guess the code address can run across a
page boundary. Some of them calls get_page_addr_code() a second time to
check this case. So I think using 1 is good solution, but perhaps the
code could be improved by adding the size parameter to get_page_addr_code().

My purpose was not to change the functions behavior, only to add the new
parameter. So using "1" when the size is not obvious is a good solution
to me.

Thank you for your comment!

Laurent

  reply	other threads:[~2018-01-10 13:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 23:10 [Qemu-devel] [PATCH 0/6] target/m68k: supervisor mode (part 2) Laurent Vivier
2018-01-08 23:10 ` [Qemu-devel] [PATCH 1/6] accel/tcg: add size paremeter in tlb_fill() Laurent Vivier
2018-01-10  8:43   ` [Qemu-devel] [qemu-s390x] " David Hildenbrand
2018-01-10 13:42     ` Laurent Vivier [this message]
2018-01-10 18:47       ` Richard Henderson
2018-01-08 23:10 ` [Qemu-devel] [PATCH 2/6] target/m68k: add MC68040 MMU Laurent Vivier
2018-01-10 20:12   ` Richard Henderson
2018-01-12 18:46     ` Laurent Vivier
2018-01-08 23:10 ` [Qemu-devel] [PATCH 3/6] target/m68k: add Transparent Translation Laurent Vivier
2018-01-10 21:08   ` Richard Henderson
2018-01-08 23:10 ` [Qemu-devel] [PATCH 4/6] target/m68k: add moves Laurent Vivier
2018-01-10 21:22   ` Richard Henderson
2018-01-08 23:10 ` [Qemu-devel] [PATCH 5/6] target/m68k: add pflush/ptest Laurent Vivier
2018-01-10 21:25   ` Richard Henderson
2018-01-08 23:10 ` [Qemu-devel] [PATCH 6/6] target/m68k: add HMP command "info tlb" Laurent Vivier
2018-01-10 21:27   ` Richard Henderson

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=525f7d10-54c5-eca9-0b45-62771afe9c59@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=agraf@suse.de \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=crwulff@gmail.com \
    --cc=david@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=green@moxielogic.com \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=jcmvbkbc@gmail.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=michael@walle.cc \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shorne@gmail.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).