All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "tamas@tklengyel.com" <tamas@tklengyel.com>,
	"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
	"rcojocaru@bitdefender.com" <rcojocaru@bitdefender.com>,
	"george.dunlap@eu.citrix.com" <george.dunlap@eu.citrix.com>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	Alexandru Stefan ISAILA <aisaila@bitdefender.com>,
	"roger.pau@citrix.com" <roger.pau@citrix.com>
Subject: [PATCH v3 2/3] x86/mm: Introduce altp2m_set_entry_by_page_order
Date: Tue, 9 Apr 2019 12:03:58 +0000	[thread overview]
Message-ID: <20190409120324.13940-2-aisaila@bitdefender.com> (raw)
In-Reply-To: <20190409120324.13940-1-aisaila@bitdefender.com>

This patch moves common code from p2m_set_altp2m_mem_access() and
p2m_change_altp2m_gfn() into one function

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
---
 xen/arch/x86/mm/mem_access.c |  2 +-
 xen/include/asm-x86/p2m.h    | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
index bf67ddb15a..6a22512555 100644
--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -279,7 +279,7 @@ int p2m_set_altp2m_mem_access(struct domain *d, struct p2m_domain *hp2m,
         gfn_t gfn2 = _gfn(gfn_l & mask);
         mfn_t mfn2 = _mfn(mfn_x(mfn) & mask);
 
-        /* Note: currently it is not safe to remap to a shared entry */
+	/* Note: currently it is not safe to remap to a shared entry */
         if ( t != p2m_ram_rw )
             return -ESRCH;
 
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 6de1546d76..90a6c135a7 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -467,6 +467,17 @@ static inline mfn_t altp2m_get_gfn_type_access(
     return mfn;
 }
 
+static inline int altp2m_set_entry_by_page_order(
+    struct p2m_domain *ap2m, unsigned long gfn,  mfn_t mfn,
+    unsigned int page_order, p2m_type_t t, p2m_access_t a)
+{
+    unsigned long mask = ~((1UL << page_order) - 1);
+    gfn_t gfn2 = _gfn(gfn & mask);
+    mfn_t mfn2 = _mfn(mfn_x(mfn) & mask);
+
+    return ap2m->set_entry(ap2m, gfn2, mfn2, page_order, t, a, 1);
+}
+
 /* Syntactic sugar: most callers will use one of these. */
 #define get_gfn(d, g, t)         get_gfn_type((d), (g), (t), P2M_ALLOC)
 #define get_gfn_query(d, g, t)   get_gfn_type((d), (g), (t), 0)
-- 
2.17.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "tamas@tklengyel.com" <tamas@tklengyel.com>,
	"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
	"rcojocaru@bitdefender.com" <rcojocaru@bitdefender.com>,
	"george.dunlap@eu.citrix.com" <george.dunlap@eu.citrix.com>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	Alexandru Stefan ISAILA <aisaila@bitdefender.com>,
	"roger.pau@citrix.com" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v3 2/3] x86/mm: Introduce altp2m_set_entry_by_page_order
Date: Tue, 9 Apr 2019 12:03:58 +0000	[thread overview]
Message-ID: <20190409120324.13940-2-aisaila@bitdefender.com> (raw)
Message-ID: <20190409120358.Sy1jFGy7IExO9xKl2J2GLHyaQoSYSOYBNB28oVy-snA@z> (raw)
In-Reply-To: <20190409120324.13940-1-aisaila@bitdefender.com>

This patch moves common code from p2m_set_altp2m_mem_access() and
p2m_change_altp2m_gfn() into one function

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
---
 xen/arch/x86/mm/mem_access.c |  2 +-
 xen/include/asm-x86/p2m.h    | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
index bf67ddb15a..6a22512555 100644
--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -279,7 +279,7 @@ int p2m_set_altp2m_mem_access(struct domain *d, struct p2m_domain *hp2m,
         gfn_t gfn2 = _gfn(gfn_l & mask);
         mfn_t mfn2 = _mfn(mfn_x(mfn) & mask);
 
-        /* Note: currently it is not safe to remap to a shared entry */
+	/* Note: currently it is not safe to remap to a shared entry */
         if ( t != p2m_ram_rw )
             return -ESRCH;
 
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 6de1546d76..90a6c135a7 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -467,6 +467,17 @@ static inline mfn_t altp2m_get_gfn_type_access(
     return mfn;
 }
 
+static inline int altp2m_set_entry_by_page_order(
+    struct p2m_domain *ap2m, unsigned long gfn,  mfn_t mfn,
+    unsigned int page_order, p2m_type_t t, p2m_access_t a)
+{
+    unsigned long mask = ~((1UL << page_order) - 1);
+    gfn_t gfn2 = _gfn(gfn & mask);
+    mfn_t mfn2 = _mfn(mfn_x(mfn) & mask);
+
+    return ap2m->set_entry(ap2m, gfn2, mfn2, page_order, t, a, 1);
+}
+
 /* Syntactic sugar: most callers will use one of these. */
 #define get_gfn(d, g, t)         get_gfn_type((d), (g), (t), P2M_ALLOC)
 #define get_gfn_query(d, g, t)   get_gfn_type((d), (g), (t), 0)
-- 
2.17.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-04-09 12:04 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 12:03 [PATCH v3 1/3] x86/mm: Introduce altp2m_get_gfn_type_access Alexandru Stefan ISAILA
2019-04-09 12:03 ` [Xen-devel] " Alexandru Stefan ISAILA
2019-04-09 12:03 ` Alexandru Stefan ISAILA [this message]
2019-04-09 12:03   ` [Xen-devel] [PATCH v3 2/3] x86/mm: Introduce altp2m_set_entry_by_page_order Alexandru Stefan ISAILA
2019-04-09 13:44   ` Tamas K Lengyel
2019-04-09 13:44     ` [Xen-devel] " Tamas K Lengyel
2019-04-10 14:18   ` George Dunlap
2019-04-10 14:18     ` [Xen-devel] " George Dunlap
2019-04-10 14:22     ` Alexandru Stefan ISAILA
2019-04-10 14:22       ` [Xen-devel] " Alexandru Stefan ISAILA
2019-05-02 14:46   ` Jan Beulich
2019-05-02 14:46     ` [Xen-devel] " Jan Beulich
2019-04-09 12:04 ` [PATCH v3 3/3] x86/mm: Fix p2m_set_suppress_ve Alexandru Stefan ISAILA
2019-04-09 12:04   ` [Xen-devel] " Alexandru Stefan ISAILA
2019-04-09 13:48 ` [PATCH v3 1/3] x86/mm: Introduce altp2m_get_gfn_type_access Tamas K Lengyel
2019-04-09 13:48   ` [Xen-devel] " Tamas K Lengyel
2019-04-09 14:03   ` Alexandru Stefan ISAILA
2019-04-09 14:03     ` [Xen-devel] " Alexandru Stefan ISAILA
2019-04-09 14:37     ` Tamas K Lengyel
2019-04-09 14:37       ` [Xen-devel] " Tamas K Lengyel
2019-04-09 14:48       ` Alexandru Stefan ISAILA
2019-04-09 14:48         ` [Xen-devel] " Alexandru Stefan ISAILA
2019-04-09 15:26         ` Tamas K Lengyel
2019-04-09 15:26           ` [Xen-devel] " Tamas K Lengyel
2019-04-09 15:37           ` Alexandru Stefan ISAILA
2019-04-09 15:37             ` [Xen-devel] " Alexandru Stefan ISAILA
2019-04-10 16:02 ` George Dunlap
2019-04-10 16:02   ` [Xen-devel] " George Dunlap
2019-04-11 12:17   ` Alexandru Stefan ISAILA
2019-04-11 12:17     ` [Xen-devel] " Alexandru Stefan ISAILA
2019-04-11 12:50     ` George Dunlap
2019-04-11 12:50       ` [Xen-devel] " George Dunlap
2019-04-11 13:28       ` Tamas K Lengyel
2019-04-11 13:28         ` [Xen-devel] " Tamas K Lengyel
2019-04-12 10:59         ` Alexandru Stefan ISAILA
2019-04-12 10:59           ` [Xen-devel] " Alexandru Stefan ISAILA
2019-05-02 14:43 ` Jan Beulich
2019-05-02 14:43   ` [Xen-devel] " Jan Beulich

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=20190409120324.13940-2-aisaila@bitdefender.com \
    --to=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=roger.pau@citrix.com \
    --cc=tamas@tklengyel.com \
    --cc=wei.liu2@citrix.com \
    --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.