All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergej Proskurin <proskurin@sec.in.tum.de>
To: xen-devel@lists.xenproject.org
Cc: Sergej Proskurin <proskurin@sec.in.tum.de>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v8 09/13] arm/guest_access: Rename vgic_access_guest_memory
Date: Wed,  9 Aug 2017 10:20:34 +0200	[thread overview]
Message-ID: <20170809082038.3236-10-proskurin@sec.in.tum.de> (raw)
In-Reply-To: <20170809082038.3236-1-proskurin@sec.in.tum.de>

This commit renames the function vgic_access_guest_memory to
access_guest_memory_by_ipa. As the function name suggests, the functions
expects an IPA as argument. All invocations of this function have been
adapted accordingly. Apart from that, we have adjusted all printk
messages for cleanup and to eliminate artefacts of the function's
previous location.

Signed-off-by: Sergej Proskurin <proskurin@sec.in.tum.de>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
---
v6: We added this patch to our patch series.

v7: Renamed the function's argument ipa back to gpa.

    Removed any mentioning of "vITS" in the function's printk messages
    and adjusted the commit message accordingly.
---
 xen/arch/arm/guestcopy.c           | 10 +++++-----
 xen/arch/arm/vgic-v3-its.c         | 36 ++++++++++++++++++------------------
 xen/include/asm-arm/guest_access.h |  4 ++--
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c
index 938ffe2668..4ee07fcea3 100644
--- a/xen/arch/arm/guestcopy.c
+++ b/xen/arch/arm/guestcopy.c
@@ -123,8 +123,8 @@ unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned le
  * Temporarily map one physical guest page and copy data to or from it.
  * The data to be copied cannot cross a page boundary.
  */
-int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
-                             uint32_t size, bool is_write)
+int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf,
+                               uint32_t size, bool is_write)
 {
     struct page_info *page;
     uint64_t offset = gpa & ~PAGE_MASK;  /* Offset within the mapped page */
@@ -134,7 +134,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
     /* Do not cross a page boundary. */
     if ( size > (PAGE_SIZE - offset) )
     {
-        printk(XENLOG_G_ERR "d%d: vITS: memory access would cross page boundary\n",
+        printk(XENLOG_G_ERR "d%d: guestcopy: memory access crosses page boundary.\n",
                d->domain_id);
         return -EINVAL;
     }
@@ -142,7 +142,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
     page = get_page_from_gfn(d, paddr_to_pfn(gpa), &p2mt, P2M_ALLOC);
     if ( !page )
     {
-        printk(XENLOG_G_ERR "d%d: vITS: Failed to get table entry\n",
+        printk(XENLOG_G_ERR "d%d: guestcopy: failed to get table entry.\n",
                d->domain_id);
         return -EINVAL;
     }
@@ -150,7 +150,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
     if ( !p2m_is_ram(p2mt) )
     {
         put_page(page);
-        printk(XENLOG_G_ERR "d%d: vITS: memory used by the ITS should be RAM.",
+        printk(XENLOG_G_ERR "d%d: guestcopy: guest memory should be RAM.\n",
                d->domain_id);
         return -EINVAL;
     }
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 1af6820cab..72a5c70656 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -131,9 +131,9 @@ static int its_set_collection(struct virt_its *its, uint16_t collid,
     if ( collid >= its->max_collections )
         return -ENOENT;
 
-    return vgic_access_guest_memory(its->d,
-                                    addr + collid * sizeof(coll_table_entry_t),
-                                    &vcpu_id, sizeof(vcpu_id), true);
+    return access_guest_memory_by_ipa(its->d,
+                                      addr + collid * sizeof(coll_table_entry_t),
+                                      &vcpu_id, sizeof(vcpu_id), true);
 }
 
 /* Must be called with the ITS lock held. */
@@ -149,9 +149,9 @@ static struct vcpu *get_vcpu_from_collection(struct virt_its *its,
     if ( collid >= its->max_collections )
         return NULL;
 
-    ret = vgic_access_guest_memory(its->d,
-                                   addr + collid * sizeof(coll_table_entry_t),
-                                   &vcpu_id, sizeof(coll_table_entry_t), false);
+    ret = access_guest_memory_by_ipa(its->d,
+                                     addr + collid * sizeof(coll_table_entry_t),
+                                     &vcpu_id, sizeof(coll_table_entry_t), false);
     if ( ret )
         return NULL;
 
@@ -171,9 +171,9 @@ static int its_set_itt_address(struct virt_its *its, uint32_t devid,
     if ( devid >= its->max_devices )
         return -ENOENT;
 
-    return vgic_access_guest_memory(its->d,
-                                    addr + devid * sizeof(dev_table_entry_t),
-                                    &itt_entry, sizeof(itt_entry), true);
+    return access_guest_memory_by_ipa(its->d,
+                                      addr + devid * sizeof(dev_table_entry_t),
+                                      &itt_entry, sizeof(itt_entry), true);
 }
 
 /*
@@ -189,9 +189,9 @@ static int its_get_itt(struct virt_its *its, uint32_t devid,
     if ( devid >= its->max_devices )
         return -EINVAL;
 
-    return vgic_access_guest_memory(its->d,
-                                    addr + devid * sizeof(dev_table_entry_t),
-                                    itt, sizeof(*itt), false);
+    return access_guest_memory_by_ipa(its->d,
+                                      addr + devid * sizeof(dev_table_entry_t),
+                                      itt, sizeof(*itt), false);
 }
 
 /*
@@ -236,7 +236,7 @@ static bool read_itte(struct virt_its *its, uint32_t devid, uint32_t evid,
     if ( addr == INVALID_PADDR )
         return false;
 
-    if ( vgic_access_guest_memory(its->d, addr, &itte, sizeof(itte), false) )
+    if ( access_guest_memory_by_ipa(its->d, addr, &itte, sizeof(itte), false) )
         return false;
 
     vcpu = get_vcpu_from_collection(its, itte.collection);
@@ -270,7 +270,7 @@ static bool write_itte(struct virt_its *its, uint32_t devid,
     itte.collection = collid;
     itte.vlpi = vlpi;
 
-    if ( vgic_access_guest_memory(its->d, addr, &itte, sizeof(itte), true) )
+    if ( access_guest_memory_by_ipa(its->d, addr, &itte, sizeof(itte), true) )
         return false;
 
     return true;
@@ -415,8 +415,8 @@ static int update_lpi_property(struct domain *d, struct pending_irq *p)
 
     addr = d->arch.vgic.rdist_propbase & GENMASK(51, 12);
 
-    ret = vgic_access_guest_memory(d, addr + p->irq - LPI_OFFSET,
-                                   &property, sizeof(property), false);
+    ret = access_guest_memory_by_ipa(d, addr + p->irq - LPI_OFFSET,
+                                     &property, sizeof(property), false);
     if ( ret )
         return ret;
 
@@ -920,8 +920,8 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its)
     {
         int ret;
 
-        ret = vgic_access_guest_memory(d, addr + its->creadr,
-                                       command, sizeof(command), false);
+        ret = access_guest_memory_by_ipa(d, addr + its->creadr,
+                                         command, sizeof(command), false);
         if ( ret )
             return ret;
 
diff --git a/xen/include/asm-arm/guest_access.h b/xen/include/asm-arm/guest_access.h
index 49716501a4..e321c8a144 100644
--- a/xen/include/asm-arm/guest_access.h
+++ b/xen/include/asm-arm/guest_access.h
@@ -10,8 +10,8 @@ unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from,
 unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
 unsigned long raw_clear_guest(void *to, unsigned len);
 
-int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
-                             uint32_t size, bool_t is_write);
+int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf,
+                               uint32_t size, bool_t is_write);
 
 #define __raw_copy_to_guest raw_copy_to_guest
 #define __raw_copy_from_guest raw_copy_from_guest
-- 
2.13.3


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

  parent reply	other threads:[~2017-08-09  8:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09  8:20 [PATCH v8 00/13] arm/mem_access: Walk guest page tables in SW if mem_access is active Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 01/13] arm/mem_access: Add and cleanup (TCR_|TTBCR_)* defines Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 02/13] arm/mem_access: Add defines supporting PTs with varying page sizes Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 03/13] arm/lpae: Introduce lpae_is_page helper Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 04/13] arm/mem_access: Add short-descriptor pte typedefs and macros Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 05/13] arm/mem_access: Introduce GV2M_EXEC permission Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 06/13] arm/mem_access: Introduce BIT_ULL bit operation Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 07/13] arm/mem_access: Introduce GENMASK_ULL " Sergej Proskurin
2017-08-15 18:08   ` Sergej Proskurin
2017-08-15 22:24   ` Stefano Stabellini
2017-08-09  8:20 ` [PATCH v8 08/13] arm/guest_access: Move vgic_access_guest_memory to guest_access.h Sergej Proskurin
2017-08-16  9:58   ` Sergej Proskurin
2017-08-16 10:11     ` Julien Grall
2017-08-16 12:35       ` Sergej Proskurin
2017-08-09  8:20 ` Sergej Proskurin [this message]
2017-08-14 17:29   ` [PATCH v8 09/13] arm/guest_access: Rename vgic_access_guest_memory Julien Grall
2017-08-09  8:20 ` [PATCH v8 10/13] arm/mem_access: Add software guest-page-table walk Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 11/13] arm/mem_access: Add long-descriptor based gpt Sergej Proskurin
2017-08-14 17:37   ` Julien Grall
2017-08-14 21:03     ` Sergej Proskurin
2017-08-15 10:13       ` Julien Grall
2017-08-15 18:03         ` Sergej Proskurin
2017-08-15 22:25         ` Stefano Stabellini
2017-08-15 22:28           ` Andrew Cooper
2017-08-16  8:53             ` Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 12/13] arm/mem_access: Add short-descriptor " Sergej Proskurin
2017-08-09  8:20 ` [PATCH v8 13/13] arm/mem_access: Walk the guest's pt in software Sergej Proskurin

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=20170809082038.3236-10-proskurin@sec.in.tum.de \
    --to=proskurin@sec.in.tum.de \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.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.