Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: James Hogan <james.hogan@imgtec.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH v2 01/12] MIPS: Fix definition of KSEGX() for 64-bit
Date: Fri, 15 Jul 2016 16:19:33 +0200	[thread overview]
Message-ID: <20160715141932.GD1024@linux-mips.org> (raw)
In-Reply-To: <1468268620-8600-1-git-send-email-james.hogan@imgtec.com>

On Mon, Jul 11, 2016 at 09:23:40PM +0100, James Hogan wrote:

> The KSEGX() macro is defined to 32-bit sign extend the address argument
> and logically AND the result with 0xe0000000, with the final result
> usually compared against one of the CKSEG macros. However the literal
> 0xe0000000 is unsigned as the high bit is set, and is therefore
> zero-extended on 64-bit kernels, resulting in the sign extension bits of
> the argument being masked to zero. This results in the odd situation
> where:
> 
>   KSEGX(CKSEG0) != CKSEG0
>   (0xffffffff80000000 & 0x00000000e0000000) != 0xffffffff80000000)
> 
> Fix this by 32-bit sign extending the 0xe0000000 literal using
> _ACAST32_.
> 
> This will help some MIPS KVM code handling 32-bit guest addresses to
> work on 64-bit host kernels, but will also affect a couple of other
> users:
> 
> - KSEGX in dec_kn01_be_backend() on a 64-bit DECstation kernel. Maciej
>   has confirmed this is not a valid combination.
> 
> - The SiByte DMA page ops KSEGX check in clear_page() and copy_page() on
>   64-bit SB1 kernels, which appears not to be designed with 64-bit
>   segments in mind anyway. This would (perhaps unintentionally) have
>   always fallen back to the CPU copy on 64-bit kernels anyway, so we
>   make this explicit by making CONFIG_SIBYTE_DMA_PAGEOPS depend on
>   32BIT, so the change of KSEGX behaviour can't break anything.
> 
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Maciej W. Rozycki <macro@linux-mips.org>
> Cc: linux-mips@linux-mips.org

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

  reply	other threads:[~2016-07-15 14:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 10:53 [PATCH 00/12] MIPS: KVM: 64-bit host support James Hogan
2016-07-08 10:53 ` [PATCH 01/12] MIPS: Fix definition of KSEGX() for 64-bit James Hogan
2016-07-11 14:56   ` Maciej W. Rozycki
2016-07-11 19:03     ` James Hogan
2016-07-11 20:23   ` [PATCH v2 " James Hogan
2016-07-15 14:19     ` Ralf Baechle [this message]
2016-07-08 10:53 ` [PATCH 02/12] MIPS: KVM: Use virt_to_phys() to get commpage PFN James Hogan
2016-07-08 10:53 ` [PATCH 03/12] MIPS: KVM: Use kmap instead of CKSEG0ADDR() James Hogan
2016-07-08 10:53 ` [PATCH 04/12] MIPS: KVM: Make entry code MIPS64 friendly James Hogan
2016-07-08 10:53 ` [PATCH 05/12] MIPS: KVM: Set CP0_Status.KX on MIPS64 James Hogan
2016-07-08 10:53 ` [PATCH 06/12] MIPS: KVM: Use 64-bit CP0_EBase when appropriate James Hogan
2016-07-08 10:53 ` [PATCH 07/12] MIPS: KVM: Fail if ebase doesn't fit in CP0_EBase James Hogan
2016-07-08 10:53 ` [PATCH 08/12] MIPS: KVM: Fix 64-bit big endian dynamic translation James Hogan
2016-07-08 10:53 ` [PATCH 09/12] MIPS: KVM: Sign extend MFC0/RDHWR results James Hogan
2016-07-08 10:53 ` [PATCH 10/12] MIPS: KVM: Fix ptr->int cast via KVM_GUEST_KSEGX() James Hogan
2016-07-08 10:53 ` [PATCH 11/12] MIPS: KVM: Reset CP0_PageMask during host TLB flush James Hogan
2016-07-08 10:53 ` [PATCH 12/12] MIPS: Select HAVE_KVM for MIPS64_R{2,6} James Hogan

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=20160715141932.GD1024@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=james.hogan@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.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