mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"gang.chen@asianux.com" <gang.chen@asianux.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jaccon.bastiaansen@gmail.com" <jaccon.bastiaansen@gmail.com>
Subject: Re: [PATCH v3] arm: remove !CPU_V6 and !GENERIC_ATOMIC64 build dependencies for XEN
Date: Tue, 21 Jan 2014 11:08:26 +0000	[thread overview]
Message-ID: <20140121110826.GG30706@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1401201523240.21510@kaball.uk.xensource.com>

On Mon, Jan 20, 2014 at 03:32:48PM +0000, Stefano Stabellini wrote:
> On Thu, 16 Jan 2014, Will Deacon wrote:
> > For the xchg part, yes, that looks a lot better. I don't like the #undef
> > CONFIG_CPU_V6 though, can that be rewritten to use __LINUX_ARM_ARCH__?
> 
> The problem is that the 1 and 2 byte parameter size cases in __cmpxchg
> are ifdef'ed CONFIG_CPU_V6 but drivers/xen/grant-table.c needs them.
> 
> So we can either undef CONFIG_CPU_V6 in grant-table.c or call a
> different function.
> 
> If I switch from ifdef CONFIG_CPU_V6 to if __LINUX_ARM_ARCH__ > 6 in
> __cmpxchg, we still have the problem that if __LINUX_ARM_ARCH__ == 6,
> grant-table.c doesn't compile.
> 
> Maybe the approach taken by the other patch for cmpxchg is better, see
> below.

Yes, I prefer this approach. Minor comment below.

> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index c1f1a7e..ae54ae0 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1881,8 +1881,7 @@ config XEN_DOM0
>  config XEN
>  	bool "Xen guest support on ARM (EXPERIMENTAL)"
>  	depends on ARM && AEABI && OF
> -	depends on CPU_V7 && !CPU_V6
> -	depends on !GENERIC_ATOMIC64
> +	depends on CPU_V7
>  	select ARM_PSCI
>  	select SWIOTLB_XEN
>  	help
> diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
> index df2fbba..cc8a4a2 100644
> --- a/arch/arm/include/asm/cmpxchg.h
> +++ b/arch/arm/include/asm/cmpxchg.h
> @@ -133,6 +133,44 @@ extern void __bad_cmpxchg(volatile void *ptr, int size);
>   * cmpxchg only support 32-bits operands on ARMv6.
>   */
>  
> +static inline unsigned long __cmpxchg8(volatile void *ptr, unsigned long old,
> +				      unsigned long new)
> +{
> +	unsigned long oldval, res;
> +
> +	do {
> +		asm volatile("@ __cmpxchg1\n"
> +		"	ldrexb	%1, [%2]\n"
> +		"	mov	%0, #0\n"
> +		"	teq	%1, %3\n"
> +		"	strexbeq %0, %4, [%2]\n"
> +			: "=&r" (res), "=&r" (oldval)
> +			: "r" (ptr), "Ir" (old), "r" (new)
> +			: "memory", "cc");
> +	} while (res);
> +
> +	return oldval;
> +}
> +
> +static inline unsigned long __cmpxchg16(volatile void *ptr, unsigned long old,
> +				      unsigned long new)
> +{
> +	unsigned long oldval, res;
> +
> +	do {
> +		asm volatile("@ __cmpxchg1\n"

Can you fix this comment while you're here please?

Will

  reply	other threads:[~2014-01-21 11:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 18:00 Stefano Stabellini
2014-01-09 10:30 ` Will Deacon
2014-01-09 11:04   ` Arnd Bergmann
2014-01-09 12:47     ` Stefano Stabellini
2014-01-09 18:42       ` Will Deacon
2014-01-10 16:48         ` Chen Gang F T
2014-01-13  8:12           ` Jaccon Bastiaansen
2014-01-16 16:27         ` Stefano Stabellini
2014-01-16 19:31           ` Will Deacon
2014-01-20 15:32             ` Stefano Stabellini
2014-01-21 11:08               ` Will Deacon [this message]
2014-01-21 12:08                 ` Stefano Stabellini

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=20140121110826.GG30706@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=arnd@arndb.de \
    --cc=gang.chen@asianux.com \
    --cc=jaccon.bastiaansen@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=stefano.stabellini@eu.citrix.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

Powered by JetHome