xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
Cc: julien.grall@linaro.org, tim@xen.org, ian.campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v1 1/2] xen/arm: Introduce clean_and_invalidate_xen_dcache() macro
Date: Thu, 6 Mar 2014 14:09:01 +0000	[thread overview]
Message-ID: <5318817D.5000400@citrix.com> (raw)
In-Reply-To: <1394113851-17321-2-git-send-email-oleksandr.tyshchenko@globallogic.com>

On 06/03/14 13:50, Oleksandr Tyshchenko wrote:
> This macro is very similar to clean_xen_dcache(), but it performs
> clean and invalidate dcache.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
> ---
>  xen/include/asm-arm/page.h |   26 ++++++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
> index e00be9e..34effa1 100644
> --- a/xen/include/asm-arm/page.h
> +++ b/xen/include/asm-arm/page.h
> @@ -226,7 +226,7 @@ static inline lpae_t mfn_to_xen_entry(unsigned long mfn)
>  /* Actual cacheline size on the boot CPU. */
>  extern size_t cacheline_bytes;
>  
> -/* Function for flushing medium-sized areas.
> +/* Functions for flushing medium-sized areas.
>   * if 'range' is large enough we might want to use model-specific
>   * full-cache flushes. */
>  static inline void clean_xen_dcache_va_range(void *p, unsigned long size)
> @@ -238,7 +238,17 @@ static inline void clean_xen_dcache_va_range(void *p, unsigned long size)
>      dsb();           /* So we know the flushes happen before continuing */
>  }
>  
> -/* Macro for flushing a single small item.  The predicate is always
> +static inline void clean_and_invalidate_xen_dcache_va_range(void *p,

>From a style point of view, this would  be better if void *p was on the
next line and indented once

> +		unsigned long size)
> +{
> +    void *end;

Newline here, as per CODING_STYLE in the Xen root.

~Andrew

> +    dsb();           /* So the CPU issues all writes to the range */
> +    for ( end = p + size; p < end; p += cacheline_bytes )
> +        asm volatile (__clean_and_invalidate_xen_dcache_one(0) : : "r" (p));
> +    dsb();           /* So we know the flushes happen before continuing */
> +}
> +
> +/* Macros for flushing a single small item.  The predicate is always
>   * compile-time constant so this will compile down to 3 instructions in
>   * the common case. */
>  #define clean_xen_dcache(x) do {                                        \
> @@ -253,6 +263,18 @@ static inline void clean_xen_dcache_va_range(void *p, unsigned long size)
>              : : "r" (_p), "m" (*_p));                                   \
>  } while (0)
>  
> +#define clean_and_invalidate_xen_dcache(x) do {                         \
> +    typeof(x) *_p = &(x);                                               \
> +    if ( sizeof(x) > MIN_CACHELINE_BYTES || sizeof(x) > alignof(x) )    \
> +        clean_and_invalidate_xen_dcache_va_range(_p, sizeof(x));        \
> +    else                                                                \
> +        asm volatile (                                                  \
> +            "dsb sy;"   /* Finish all earlier writes */                 \
> +            __clean_and_invalidate_xen_dcache_one(0)                    \
> +            "dsb sy;"   /* Finish flush before continuing */            \
> +            : : "r" (_p), "m" (*_p));                                   \
> +} while (0)
> +
>  /* Flush the dcache for an entire page. */
>  void flush_page_to_ram(unsigned long mfn);
>  

  reply	other threads:[~2014-03-06 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 13:50 [PATCH v1 0/2] Clean and invalidate dcache for boot pagetables during setup Oleksandr Tyshchenko
2014-03-06 13:50 ` [PATCH v1 1/2] xen/arm: Introduce clean_and_invalidate_xen_dcache() macro Oleksandr Tyshchenko
2014-03-06 14:09   ` Andrew Cooper [this message]
2014-03-07 10:20     ` Oleksandr Tyshchenko
2014-03-07  3:40   ` Ian Campbell
2014-03-07 10:27     ` Oleksandr Tyshchenko
2014-03-06 13:50 ` [PATCH v1 2/2] xen/arm: Clean and invalidate dcache for boot pagetables Oleksandr Tyshchenko
2014-03-07  4:16   ` Julien Grall
2014-03-07  4:14 ` [PATCH v1 0/2] Clean and invalidate dcache for boot pagetables during setup Julien Grall
2014-03-07 10:46   ` Oleksandr Tyshchenko

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=5318817D.5000400@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=oleksandr.tyshchenko@globallogic.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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).