All of lore.kernel.org
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 5/6] arm64/xen: implement xen_remap on arm64
Date: Fri, 31 May 2013 16:56:13 +0100	[thread overview]
Message-ID: <20130531155613.GF15551@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1305311622150.4799@kaball.uk.xensource.com>

On Fri, May 31, 2013 at 04:23:20PM +0100, Stefano Stabellini wrote:
> On Fri, 31 May 2013, Stefano Stabellini wrote:
> > On Fri, 31 May 2013, Catalin Marinas wrote:
> > > On Fri, May 31, 2013 at 02:21:16PM +0100, Stefano Stabellini wrote:
> > > > On Fri, 31 May 2013, Catalin Marinas wrote:
> > > > > On Thu, May 30, 2013 at 05:18:32PM +0100, Stefano Stabellini wrote:
> > > > > > --- a/arch/arm/include/asm/xen/page.h
> > > > > > +++ b/arch/arm/include/asm/xen/page.h
> > > > > > @@ -90,6 +90,10 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> > > > > >  	return __set_phys_to_machine(pfn, mfn);
> > > > > >  }
> > > > > >  
> > > > > > +#ifdef CONFIG_ARM64
> > > > > > +#define xen_remap(cookie, size) __ioremap((cookie), (size), __pgprot(PROT_NORMAL))
> > > > > > +#else
> > > > > >  #define xen_remap(cookie, size) __arm_ioremap((cookie), (size), MT_MEMORY);
> > > > > > +#endif
> > > > > 
> > > > > Now I saw the ARM-specific part. Can you not use something like
> > > > > ioremap_cached() which would give normal cacheable memory (at least on
> > > > > ARMv7).
> > > > 
> > > > No, I cannot because ioremap_cached uses MT_DEVICE_CACHED, while this
> > > > needs to be MT_MEMORY. It is used for normal memory pages, not device
> > > > memory.
> > > 
> > > MT_DEVICE_CACHED is Normal memory for ARMv7.
> > 
> > I didn't realize that MT_DEVICE_CACHED and MT_MEMORY end up having the
> > same AttrIndx encoding!
> > In that case yes, I should be able to use it.
> > I take that I should just implement ioremap_cached on arm64 as well?
> > 
> 
> Should just use MT_MEMORY and call it PROT_NORMAL?
> 
> #define PROT_NORMAL     (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
> #define ioremap_cached(addr, size)     __ioremap((addr), (size), __pgprot(PROT_NORMAL))

Looks fine.

-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Will Deacon <Will.Deacon@arm.com>,
	"Ian.Campbell@citrix.com" <Ian.Campbell@citrix.com>,
	"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>
Subject: Re: [PATCH RFC 5/6] arm64/xen: implement xen_remap on arm64
Date: Fri, 31 May 2013 16:56:13 +0100	[thread overview]
Message-ID: <20130531155613.GF15551@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1305311622150.4799@kaball.uk.xensource.com>

On Fri, May 31, 2013 at 04:23:20PM +0100, Stefano Stabellini wrote:
> On Fri, 31 May 2013, Stefano Stabellini wrote:
> > On Fri, 31 May 2013, Catalin Marinas wrote:
> > > On Fri, May 31, 2013 at 02:21:16PM +0100, Stefano Stabellini wrote:
> > > > On Fri, 31 May 2013, Catalin Marinas wrote:
> > > > > On Thu, May 30, 2013 at 05:18:32PM +0100, Stefano Stabellini wrote:
> > > > > > --- a/arch/arm/include/asm/xen/page.h
> > > > > > +++ b/arch/arm/include/asm/xen/page.h
> > > > > > @@ -90,6 +90,10 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> > > > > >  	return __set_phys_to_machine(pfn, mfn);
> > > > > >  }
> > > > > >  
> > > > > > +#ifdef CONFIG_ARM64
> > > > > > +#define xen_remap(cookie, size) __ioremap((cookie), (size), __pgprot(PROT_NORMAL))
> > > > > > +#else
> > > > > >  #define xen_remap(cookie, size) __arm_ioremap((cookie), (size), MT_MEMORY);
> > > > > > +#endif
> > > > > 
> > > > > Now I saw the ARM-specific part. Can you not use something like
> > > > > ioremap_cached() which would give normal cacheable memory (at least on
> > > > > ARMv7).
> > > > 
> > > > No, I cannot because ioremap_cached uses MT_DEVICE_CACHED, while this
> > > > needs to be MT_MEMORY. It is used for normal memory pages, not device
> > > > memory.
> > > 
> > > MT_DEVICE_CACHED is Normal memory for ARMv7.
> > 
> > I didn't realize that MT_DEVICE_CACHED and MT_MEMORY end up having the
> > same AttrIndx encoding!
> > In that case yes, I should be able to use it.
> > I take that I should just implement ioremap_cached on arm64 as well?
> > 
> 
> Should just use MT_MEMORY and call it PROT_NORMAL?
> 
> #define PROT_NORMAL     (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
> #define ioremap_cached(addr, size)     __ioremap((addr), (size), __pgprot(PROT_NORMAL))

Looks fine.

-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"Ian.Campbell@citrix.com" <Ian.Campbell@citrix.com>,
	"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
	Will Deacon <Will.Deacon@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RFC 5/6] arm64/xen: implement xen_remap on arm64
Date: Fri, 31 May 2013 16:56:13 +0100	[thread overview]
Message-ID: <20130531155613.GF15551@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1305311622150.4799@kaball.uk.xensource.com>

On Fri, May 31, 2013 at 04:23:20PM +0100, Stefano Stabellini wrote:
> On Fri, 31 May 2013, Stefano Stabellini wrote:
> > On Fri, 31 May 2013, Catalin Marinas wrote:
> > > On Fri, May 31, 2013 at 02:21:16PM +0100, Stefano Stabellini wrote:
> > > > On Fri, 31 May 2013, Catalin Marinas wrote:
> > > > > On Thu, May 30, 2013 at 05:18:32PM +0100, Stefano Stabellini wrote:
> > > > > > --- a/arch/arm/include/asm/xen/page.h
> > > > > > +++ b/arch/arm/include/asm/xen/page.h
> > > > > > @@ -90,6 +90,10 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> > > > > >  	return __set_phys_to_machine(pfn, mfn);
> > > > > >  }
> > > > > >  
> > > > > > +#ifdef CONFIG_ARM64
> > > > > > +#define xen_remap(cookie, size) __ioremap((cookie), (size), __pgprot(PROT_NORMAL))
> > > > > > +#else
> > > > > >  #define xen_remap(cookie, size) __arm_ioremap((cookie), (size), MT_MEMORY);
> > > > > > +#endif
> > > > > 
> > > > > Now I saw the ARM-specific part. Can you not use something like
> > > > > ioremap_cached() which would give normal cacheable memory (at least on
> > > > > ARMv7).
> > > > 
> > > > No, I cannot because ioremap_cached uses MT_DEVICE_CACHED, while this
> > > > needs to be MT_MEMORY. It is used for normal memory pages, not device
> > > > memory.
> > > 
> > > MT_DEVICE_CACHED is Normal memory for ARMv7.
> > 
> > I didn't realize that MT_DEVICE_CACHED and MT_MEMORY end up having the
> > same AttrIndx encoding!
> > In that case yes, I should be able to use it.
> > I take that I should just implement ioremap_cached on arm64 as well?
> > 
> 
> Should just use MT_MEMORY and call it PROT_NORMAL?
> 
> #define PROT_NORMAL     (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
> #define ioremap_cached(addr, size)     __ioremap((addr), (size), __pgprot(PROT_NORMAL))

Looks fine.

-- 
Catalin

  reply	other threads:[~2013-05-31 15:56 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 16:18 [PATCH RFC 0/6] Introduce Xen support to ARM64 Stefano Stabellini
2013-05-30 16:18 ` Stefano Stabellini
2013-05-30 16:18 ` Stefano Stabellini
2013-05-30 16:18 ` [PATCH RFC 1/6] [HACK!] arm64/xen: create links to arch/arm include files and Xen code Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-31 10:36   ` Catalin Marinas
2013-05-31 10:36     ` Catalin Marinas
2013-05-31 12:02     ` Stefano Stabellini
2013-05-31 12:02       ` Stefano Stabellini
2013-05-31 13:10       ` Catalin Marinas
2013-05-31 13:10         ` Catalin Marinas
2013-05-31 13:10         ` Catalin Marinas
2013-05-31 15:20         ` Stefano Stabellini
2013-05-31 15:20           ` Stefano Stabellini
2013-05-30 16:18 ` [PATCH RFC 2/6] arm64/xen: arm/xen header changes to compile on arm64 Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-31 10:43   ` Catalin Marinas
2013-05-31 10:43     ` Catalin Marinas
2013-05-31 10:43     ` Catalin Marinas
2013-05-31 13:25     ` Stefano Stabellini
2013-05-31 13:25       ` Stefano Stabellini
2013-05-30 16:18 ` [PATCH RFC 3/6] arm64/xen: use XEN_IO_PROTO_ABI_ARM on ARM64 Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18 ` [PATCH RFC 4/6] arm64/xen: introduce asm/hypervisor.h and sys_bitops.h Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18 ` [PATCH RFC 5/6] arm64/xen: implement xen_remap on arm64 Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-31 10:59   ` Catalin Marinas
2013-05-31 10:59     ` Catalin Marinas
2013-05-31 10:59     ` Catalin Marinas
2013-05-31 13:21     ` Stefano Stabellini
2013-05-31 13:21       ` Stefano Stabellini
2013-05-31 14:16       ` Catalin Marinas
2013-05-31 14:16         ` Catalin Marinas
2013-05-31 14:50         ` Stefano Stabellini
2013-05-31 14:50           ` Stefano Stabellini
2013-05-31 15:23           ` Stefano Stabellini
2013-05-31 15:23             ` Stefano Stabellini
2013-05-31 15:56             ` Catalin Marinas [this message]
2013-05-31 15:56               ` Catalin Marinas
2013-05-31 15:56               ` Catalin Marinas
2013-05-30 16:18 ` [PATCH RFC 6/6] arm64/xen: introduce CONFIG_XEN and hypercall.S on ARM64 Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-30 16:18   ` Stefano Stabellini
2013-05-31 11:02   ` Catalin Marinas
2013-05-31 11:02     ` Catalin Marinas
2013-05-31 11:02     ` Catalin Marinas

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=20130531155613.GF15551@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.