qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH v3] tcg/ppc: Improve unaligned load/store handling on 64-bit backend
Date: Tue, 21 Jul 2015 07:27:22 +0100	[thread overview]
Message-ID: <55ADE64A.7050702@twiddle.net> (raw)
In-Reply-To: <1437455978.5809.2.camel@kernel.crashing.org>

On 07/21/2015 06:19 AM, Benjamin Herrenschmidt wrote:
> +    /* Clear the non-page, non-alignment bits from the address */
>       if (TCG_TARGET_REG_BITS == 32 || TARGET_LONG_BITS == 32) {
> +        /* We don't support unaligned accesses on 32-bits, preserve
> +         * the bottom bits and thus trigger a comparison failure on
> +         * unaligned accesses
> +         */
>           tcg_out_rlw(s, RLWINM, TCG_REG_R0, addrlo, 0,
>                       (32 - s_bits) & 31, 31 - TARGET_PAGE_BITS);

Why don't you support this unaligned acess with 32-bit guests?

> -    } else if (!s_bits) {
> -        tcg_out_rld(s, RLDICR, TCG_REG_R0, addrlo,
> -                    0, 63 - TARGET_PAGE_BITS);
> +    } else if (s_bits) {
> +        /* > byte access, we need to handle alignment */
> +        if ((opc & MO_AMASK) == MO_ALIGN) {
> +            /* Alignment required by the front-end, same as 32-bits */
> +            tcg_out_rld(s, RLDICL, TCG_REG_R0, addrlo,
> +                        64 - TARGET_PAGE_BITS, TARGET_PAGE_BITS - s_bits);
> +            tcg_out_rld(s, RLDICL, TCG_REG_R0, TCG_REG_R0, TARGET_PAGE_BITS, 0);
> +       } else {
> +           /* We support unaligned accesses, we need to make sure we fail
> +            * if we cross a page boundary. The trick is to add the
> +            * access_size-1 to the address before masking the low bits.
> +            * That will make the address overflow to the next page if we
> +            * cross a page boundary which will then force a mismatch of
> +            * the TLB compare since the next page cannot possibly be in
> +            * the same TLB index.
> +            */
> +            tcg_out32(s, ADDI | TAI(TCG_REG_R0, addrlo, (1 << s_bits) - 1));
> +            tcg_out_rld(s, RLDICR, TCG_REG_R0, TCG_REG_R0,
> +                        0, 63 - TARGET_PAGE_BITS);
> +        }
>       } else {
> -        tcg_out_rld(s, RLDICL, TCG_REG_R0, addrlo,
> -                    64 - TARGET_PAGE_BITS, TARGET_PAGE_BITS - s_bits);
> -        tcg_out_rld(s, RLDICL, TCG_REG_R0, TCG_REG_R0, TARGET_PAGE_BITS, 0);
> +        /* Byte access, just chop off the bits below the page index */
> +        tcg_out_rld(s, RLDICR, TCG_REG_R0, addrlo, 0, 63 - TARGET_PAGE_BITS);

  reply	other threads:[~2015-07-21  6:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21  5:19 [Qemu-devel] [PATCH v3] tcg/ppc: Improve unaligned load/store handling on 64-bit backend Benjamin Herrenschmidt
2015-07-21  6:27 ` Richard Henderson [this message]
2015-07-21  6:33   ` Benjamin Herrenschmidt
2015-07-21  6:39     ` Richard Henderson
2015-07-21  9:46       ` Benjamin Herrenschmidt
2015-07-21 12:04         ` Alexander Graf
2015-07-21 12:26           ` Benjamin Herrenschmidt
2015-07-21 13:48             ` Paolo Bonzini
2015-07-21 14:18               ` Alexander Graf
2015-07-21 21:09                 ` Benjamin Herrenschmidt
2015-07-21 21:06               ` Benjamin Herrenschmidt
2015-07-21 15:30           ` Aurelien Jarno
2015-07-21 15:29 ` Aurelien Jarno
2015-07-24 12:34 ` 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=55ADE64A.7050702@twiddle.net \
    --to=rth@twiddle.net \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=benh@kernel.crashing.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).