All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v2 5/5] x86/mm: only a single instance of gw_page_flags[] is needed
Date: Mon, 26 Oct 2015 14:59:32 +0000	[thread overview]
Message-ID: <562E3FD4.5020302@citrix.com> (raw)
In-Reply-To: <562E225002000078000AE8AF@prv-mh.provo.novell.com>

On 26/10/15 11:53, Jan Beulich wrote:
> None of its elements depends on GUEST_PAGING_LEVELS.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> v2: Re-base on top of earlier changes.

Acked-by: George Dunlap <george.dunlap@citrix.com>

> 
> --- a/xen/arch/x86/mm/guest_walk.c
> +++ b/xen/arch/x86/mm/guest_walk.c
> @@ -32,30 +32,32 @@ asm(".file \"" __OBJECT_FILE__ "\"");
>  #include <asm/page.h>
>  #include <asm/guest_pt.h>
>  
> +extern const uint32_t gw_page_flags[];
> +#if GUEST_PAGING_LEVELS == CONFIG_PAGING_LEVELS
> +const uint32_t gw_page_flags[] = {
> +    /* I/F -  Usr Wr */
> +    /* 0   0   0   0 */ _PAGE_PRESENT,
> +    /* 0   0   0   1 */ _PAGE_PRESENT|_PAGE_RW,
> +    /* 0   0   1   0 */ _PAGE_PRESENT|_PAGE_USER,
> +    /* 0   0   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER,
> +    /* 0   1   0   0 */ _PAGE_PRESENT,
> +    /* 0   1   0   1 */ _PAGE_PRESENT|_PAGE_RW,
> +    /* 0   1   1   0 */ _PAGE_PRESENT|_PAGE_USER,
> +    /* 0   1   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER,
> +    /* 1   0   0   0 */ _PAGE_PRESENT|_PAGE_NX_BIT,
> +    /* 1   0   0   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT,
> +    /* 1   0   1   0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT,
> +    /* 1   0   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT,
> +    /* 1   1   0   0 */ _PAGE_PRESENT|_PAGE_NX_BIT,
> +    /* 1   1   0   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT,
> +    /* 1   1   1   0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT,
> +    /* 1   1   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT,
> +};
> +#endif
>  
>  /* Flags that are needed in a pagetable entry, with the sense of NX inverted */
>  static uint32_t mandatory_flags(struct vcpu *v, uint32_t pfec) 
>  {
> -    static const uint32_t flags[] = {
> -        /* I/F -  Usr Wr */
> -        /* 0   0   0   0 */ _PAGE_PRESENT, 
> -        /* 0   0   0   1 */ _PAGE_PRESENT|_PAGE_RW,
> -        /* 0   0   1   0 */ _PAGE_PRESENT|_PAGE_USER,
> -        /* 0   0   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER,
> -        /* 0   1   0   0 */ _PAGE_PRESENT, 
> -        /* 0   1   0   1 */ _PAGE_PRESENT|_PAGE_RW,
> -        /* 0   1   1   0 */ _PAGE_PRESENT|_PAGE_USER,
> -        /* 0   1   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER,
> -        /* 1   0   0   0 */ _PAGE_PRESENT|_PAGE_NX_BIT, 
> -        /* 1   0   0   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT,
> -        /* 1   0   1   0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT,
> -        /* 1   0   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT,
> -        /* 1   1   0   0 */ _PAGE_PRESENT|_PAGE_NX_BIT, 
> -        /* 1   1   0   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT,
> -        /* 1   1   1   0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT,
> -        /* 1   1   1   1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT,
> -    };
> -
>      /* Don't demand not-NX if the CPU wouldn't enforce it. */
>      if ( !guest_supports_nx(v) )
>          pfec &= ~PFEC_insn_fetch;
> @@ -65,7 +67,7 @@ static uint32_t mandatory_flags(struct v
>           && !(pfec & PFEC_user_mode) )
>          pfec &= ~PFEC_write_access;
>  
> -    return flags[(pfec & 0x1f) >> 1] | _PAGE_INVALID_BITS;
> +    return gw_page_flags[(pfec & 0x1f) >> 1] | _PAGE_INVALID_BITS;
>  }
>  
>  /* Modify a guest pagetable entry to set the Accessed and Dirty bits.
> 
> 
> 

      reply	other threads:[~2015-10-26 14:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26 10:47 [PATCH v2 0/5] disambiguate symbol names (part 2) Jan Beulich
2015-10-26 11:49 ` [PATCH v2 1/5] symbols: prefix static symbols with their source file names Jan Beulich
2015-10-28 12:55   ` Andrew Cooper
2015-10-28 13:25     ` Jan Beulich
2015-10-28 13:42       ` Andrew Cooper
2015-10-28 14:29         ` Jan Beulich
2015-11-02 13:47   ` Ian Campbell
2015-11-02 13:55     ` Jan Beulich
2015-11-02 14:54       ` Ian Campbell
2015-11-02 14:58         ` Jan Beulich
2015-11-02 15:11           ` Ian Campbell
2015-10-26 11:50 ` [PATCH v2 2/5] compat: enforce distinguishable file names in symbol table Jan Beulich
2015-10-28 13:08   ` Andrew Cooper
2015-11-02 15:20   ` Ian Campbell
2015-11-02 16:11     ` Jan Beulich
2015-11-03 12:22       ` Ian Campbell
2015-11-03 12:50         ` Jan Beulich
2015-11-03 13:39           ` Ian Campbell
2015-11-03 15:31             ` Jan Beulich
2015-11-03 15:42               ` Ian Campbell
2015-10-26 11:51 ` [PATCH v2 3/5] x86/mm: override stored file names for multiply built sources Jan Beulich
2015-10-26 12:52   ` Andrew Cooper
2015-10-26 14:34   ` Martin Pohlack
2015-10-26 14:57     ` George Dunlap
2015-10-26 15:12       ` Jan Beulich
2015-10-26 16:27   ` George Dunlap
2015-10-26 11:52 ` [PATCH v2 4/5] x86/mm: build map_domain_gfn() just once Jan Beulich
2015-10-26 12:52   ` Andrew Cooper
2015-10-26 14:58   ` George Dunlap
2015-10-26 11:53 ` [PATCH v2 5/5] x86/mm: only a single instance of gw_page_flags[] is needed Jan Beulich
2015-10-26 14:59   ` George Dunlap [this message]

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=562E3FD4.5020302@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.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.