diff mbox

[v2,08/20] x86: change modify_xen_mappings to return error

Message ID 1472132255-23470-9-git-send-email-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk Aug. 25, 2016, 1:37 p.m. UTC
The implementation on x86 always returns zero, but
other platforms may return error values.

Suggested-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>

v2: First submission
---
 xen/arch/x86/livepatch.c | 4 +---
 xen/arch/x86/mm.c        | 5 +++--
 xen/include/xen/mm.h     | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

Comments

Andrew Cooper Aug. 25, 2016, 1:53 p.m. UTC | #1
On 25/08/16 14:37, Konrad Rzeszutek Wilk wrote:

> diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
> index 58bc0b8..f257bbc 100644
> --- a/xen/include/xen/mm.h
> +++ b/xen/include/xen/mm.h
> @@ -146,7 +146,7 @@ int map_pages_to_xen(
>       unsigned long nr_mfns,
>       unsigned int flags);
>   /* Alter the permissions of a range of Xen virtual address space. */
> -void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags);
> +int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags);
>   void destroy_xen_mappings(unsigned long v, unsigned long e);

destroy_xen_mappings() should also be changed to match, as its common.

With that, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 5b0c863..67dda07 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -234,9 +234,7 @@  int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type type)
     else
         flag = PAGE_HYPERVISOR_RO;
 
-    modify_xen_mappings(start, start + pages * PAGE_SIZE, flag);
-
-    return 0;
+    return modify_xen_mappings(start, start + pages * PAGE_SIZE, flag);
 }
 
 void __init arch_livepatch_init(void)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index ff8e904..94e684e 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5974,7 +5974,7 @@  int populate_pt_range(unsigned long virt, unsigned long mfn,
  *
  * It is an error to call with present flags over an unpopulated range.
  */
-void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
+int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 {
     bool_t locking = system_state > SYS_STATE_boot;
     l2_pgentry_t *pl2e;
@@ -6149,13 +6149,14 @@  void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
     flush_area(NULL, FLUSH_TLB_GLOBAL);
 
 #undef FLAGS_MASK
+    return 0;
 }
 
 #undef flush_area
 
 void destroy_xen_mappings(unsigned long s, unsigned long e)
 {
-    modify_xen_mappings(s, e, _PAGE_NONE);
+    (void)modify_xen_mappings(s, e, _PAGE_NONE);
 }
 
 void __set_fixmap(
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 58bc0b8..f257bbc 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -146,7 +146,7 @@  int map_pages_to_xen(
     unsigned long nr_mfns,
     unsigned int flags);
 /* Alter the permissions of a range of Xen virtual address space. */
-void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags);
+int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags);
 void destroy_xen_mappings(unsigned long v, unsigned long e);
 /*
  * Create only non-leaf page table entries for the