public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: Matt Fleming <matt@console-pimps.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [PATCH] EFI: Do not use __pa() to get the physical address of an ioremapped memory range
Date: Fri, 02 Sep 2011 10:18:56 +0800	[thread overview]
Message-ID: <1314929936.15006.19.camel@rui> (raw)
In-Reply-To: <1314880125.8038.39.camel@mfleming-mobl1.ger.corp.intel.com>

On Thu, 2011-09-01 at 20:28 +0800, Matt Fleming wrote:
> On Thu, 2011-09-01 at 16:14 +0800, Zhang Rui wrote:
> > On Thu, 2011-09-01 at 14:55 +0800, Zhang, Rui wrote: 
> > > From: Zhang Rui <rui.zhang@intel.com>
> > > Date: Wed, 31 Aug 2011 09:59:01 +0800
> > > Subject: Do not use __pa() to get the physical address of an ioremapped memory range.
> > > 
> > > set_memory_uc uses __pa() to translate the virtual address to the physical address.
> > > This breaks a EFI_MEMORY_MAPPED_IO memory region in my case as it was ioremapped first.
> > > 
> > oops, wrong patch was attached.
> > 
> > here is the correct patch.
> > 
> > From: Zhang Rui <rui.zhang@intel.com>
> > Date: Wed, 31 Aug 2011 09:59:01 +0800
> > Subject: Do not use __pa() to get the physical address of an ioremapped memory range.
> > 
> > set_memory_uc uses __pa() to translate the virtual address to the physical address.
> > This breaks a EFI_MEMORY_MAPPED_IO memory region in my case as it was ioremapped first.
> 
> Hmm.. does anyone know why we ioremap_cache() the memory on
> CONFIG_X86_32 instead of ioremap_nocache()? 

Perhaps this is because not all the memory range need ioremap_nocache(),
e.g. EFI_BOOT_SERVICES_CODE, EFI_BOOT_SERVICES_DATA, etc?

So the current logic is to use ioremap_cache for all of them first, and
then set all the non-write-back memory ranges to uncacheable.

> In the case of
> EFI_MEMORY_MAPPED_IO the memory really needs to be uncached. Then if
> we've ioremap'd the memory we should skip set_memory_uc() altogether,
> no?
> 
In the beginning, I tried to fix efi_ioremap, i.e. use ioremap_nocache
for EFI_MEMORY_MAPPED_IO and ioremap_cache for others.
But I'm not sure if that is the right FIX, as I don't know if there
might be other memory ranges that also need to be set to uncached.

thanks,
rui


  reply	other threads:[~2011-09-02  2:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01  6:55 [PATCH] EFI: Do not use __pa() to get the physical address of an ioremapped memory range Zhang Rui
2011-09-01  8:14 ` Zhang Rui
2011-09-01 12:28   ` Matt Fleming
2011-09-02  2:18     ` Zhang Rui [this message]
2011-09-02  5:12     ` huang ying
2011-09-12 14:52       ` Matt Fleming
2011-09-13  8:48         ` huang ying
2011-09-14 19:16           ` Matt Fleming
2011-09-15  1:22         ` Shaohua Li
2011-09-15  1:52           ` Zhang Rui
2011-09-15  3:21             ` huang ying

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=1314929936.15006.19.camel@rui \
    --to=rui.zhang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@console-pimps.org \
    --cc=mjg59@srcf.ucam.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