WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [IA64] kexec: Use a separate RID for EFI

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] kexec: Use a separate RID for EFI
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2008 05:50:31 -0700
Delivery-date: Mon, 11 Aug 2008 05:51:26 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
# Date 1216696502 -32400
# Node ID fb5cfb8b122e118f9ceca2a9dd93467e8dad3f0e
# Parent  18a933a52874b59ee6a0bf4843b9a23034ece9db
[IA64] kexec: Use a separate RID for EFI

This activates the use of the EFI RID.

The basic idea is to switch to this RID, which is in the range reserved
for the hypervisor, before making EFI, PAL or SAL calls. The page fault
handler where the identity mapping checks for this RID, if present it
does the identity mapping, else it just follows the normal mapping
rules. In this way, VMX domains should not be able to access this
memory, and they should be able to use the virtual addresses that are
used by EFI for their own purposes.

Subsequent patches move EFI memory such that faults to it will
be protected by the EFI RID.

Cc: Tristan Gingold <tgingold@xxxxxxx>
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Cc: Alex Williamson <alex.williamson@xxxxxx>
Cc: Aron Griffis <aron@xxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 xen/arch/ia64/linux-xen/efi.c            |   27 +++++++++++++++++++++++++++
 xen/include/asm-ia64/linux-xen/asm/pal.h |   15 +++++++++++++++
 xen/include/asm-ia64/linux-xen/asm/sal.h |    9 +++++++++
 3 files changed, 51 insertions(+)

diff -r 18a933a52874 -r fb5cfb8b122e xen/arch/ia64/linux-xen/efi.c
--- a/xen/arch/ia64/linux-xen/efi.c     Tue Jul 22 12:15:02 2008 +0900
+++ b/xen/arch/ia64/linux-xen/efi.c     Tue Jul 22 12:15:02 2008 +0900
@@ -65,11 +65,14 @@ prefix##_get_time (efi_time_t *tm, efi_t
        struct ia64_fpreg fr[6];                                                
                  \
        efi_time_cap_t *atc = NULL;                                             
                  \
        efi_status_t ret;                                                       
                  \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
                  \
        if (tc)                                                                 
                  \
                atc = adjust_arg(tc);                                           
                  \
        ia64_save_scratch_fpregs(fr);                                           
                  \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), 
adjust_arg(tm), atc); \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
                  \
        return ret;                                                             
                  \
 }
@@ -80,9 +83,12 @@ prefix##_set_time (efi_time_t *tm)                           
                
 {                                                                              
                \
        struct ia64_fpreg fr[6];                                                
                \
        efi_status_t ret;                                                       
                \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
                \
        ia64_save_scratch_fpregs(fr);                                           
                \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_set_time_t *) __va(runtime->set_time), 
adjust_arg(tm));    \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
                \
        return ret;                                                             
                \
 }
@@ -93,10 +99,13 @@ prefix##_get_wakeup_time (efi_bool_t *en
 {                                                                              
                \
        struct ia64_fpreg fr[6];                                                
                \
        efi_status_t ret;                                                       
                \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
                \
        ia64_save_scratch_fpregs(fr);                                           
                \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_get_wakeup_time_t *) 
__va(runtime->get_wakeup_time),       \
                                adjust_arg(enabled), adjust_arg(pending), 
adjust_arg(tm));      \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
                \
        return ret;                                                             
                \
 }
@@ -108,12 +117,15 @@ prefix##_set_wakeup_time (efi_bool_t ena
        struct ia64_fpreg fr[6];                                                
                \
        efi_time_t *atm = NULL;                                                 
                \
        efi_status_t ret;                                                       
                \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
                \
        if (tm)                                                                 
                \
                atm = adjust_arg(tm);                                           
                \
        ia64_save_scratch_fpregs(fr);                                           
                \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_set_wakeup_time_t *) 
__va(runtime->set_wakeup_time),       \
                                enabled, atm);                                  
                \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
                \
        return ret;                                                             
                \
 }
@@ -126,13 +138,16 @@ prefix##_get_variable (efi_char16_t *nam
        struct ia64_fpreg fr[6];                                                
        \
        u32 *aattr = NULL;                                                      
                \
        efi_status_t ret;                                                       
        \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
        \
        if (attr)                                                               
        \
                aattr = adjust_arg(attr);                                       
        \
        ia64_save_scratch_fpregs(fr);                                           
        \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_get_variable_t *) 
__va(runtime->get_variable),     \
                                adjust_arg(name), adjust_arg(vendor), aattr,    
        \
                                adjust_arg(data_size), adjust_arg(data));       
        \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
        \
        return ret;                                                             
        \
 }
@@ -143,10 +158,13 @@ prefix##_get_next_variable (unsigned lon
 {                                                                              
                \
        struct ia64_fpreg fr[6];                                                
                \
        efi_status_t ret;                                                       
                \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
                \
        ia64_save_scratch_fpregs(fr);                                           
                \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_get_next_variable_t *) 
__va(runtime->get_next_variable),   \
                                adjust_arg(name_size), adjust_arg(name), 
adjust_arg(vendor));   \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
                \
        return ret;                                                             
                \
 }
@@ -158,11 +176,14 @@ prefix##_set_variable (efi_char16_t *nam
 {                                                                              
        \
        struct ia64_fpreg fr[6];                                                
        \
        efi_status_t ret;                                                       
        \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
        \
        ia64_save_scratch_fpregs(fr);                                           
        \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_set_variable_t *) 
__va(runtime->set_variable),     \
                                adjust_arg(name), adjust_arg(vendor), attr, 
data_size,  \
                                adjust_arg(data));                              
        \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
        \
        return ret;                                                             
        \
 }
@@ -173,10 +194,13 @@ prefix##_get_next_high_mono_count (u32 *
 {                                                                              
                \
        struct ia64_fpreg fr[6];                                                
                \
        efi_status_t ret;                                                       
                \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
                \
        ia64_save_scratch_fpregs(fr);                                           
                \
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
                  \
        ret = efi_call_##prefix((efi_get_next_high_mono_count_t *)              
                \
                                __va(runtime->get_next_high_mono_count), 
adjust_arg(count));    \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
                \
        return ret;                                                             
                \
 }
@@ -188,14 +212,17 @@ prefix##_reset_system (int reset_type, e
 {                                                                              
\
        struct ia64_fpreg fr[6];                                                
\
        efi_char16_t *adata = NULL;                                             
\
+       XEN_EFI_RR_DECLARE(rr6, rr7);                                           
                  \
                                                                                
\
        if (data)                                                               
\
                adata = adjust_arg(data);                                       
\
                                                                                
\
        ia64_save_scratch_fpregs(fr);                                           
\
+       XEN_EFI_RR_ENTER(rr6, rr7);                                             
\
        efi_call_##prefix((efi_reset_system_t *) __va(runtime->reset_system),   
\
                          reset_type, status, data_size, adata);                
\
        /* should not return, but just in case... */                            
\
+       XEN_EFI_RR_LEAVE(rr6, rr7);                                             
                  \
        ia64_load_scratch_fpregs(fr);                                           
\
 }
 
diff -r 18a933a52874 -r fb5cfb8b122e xen/include/asm-ia64/linux-xen/asm/pal.h
--- a/xen/include/asm-ia64/linux-xen/asm/pal.h  Tue Jul 22 12:15:02 2008 +0900
+++ b/xen/include/asm-ia64/linux-xen/asm/pal.h  Tue Jul 22 12:15:02 2008 +0900
@@ -93,6 +93,9 @@
 
 #include <linux/types.h>
 #include <asm/fpu.h>
+#ifdef XEN
+#include <linux/efi.h>
+#endif
 
 /*
  * Data types needed to pass information into PAL procedures and
@@ -791,29 +794,41 @@ extern void ia64_load_scratch_fpregs (st
 
 #define PAL_CALL(iprv,a0,a1,a2,a3) do {                        \
        struct ia64_fpreg fr[6];                        \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                   \
        ia64_save_scratch_fpregs(fr);                   \
+       XEN_EFI_RR_ENTER(rr6, rr7);                     \
        iprv = ia64_pal_call_static(a0, a1, a2, a3);    \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                     \
        ia64_load_scratch_fpregs(fr);                   \
 } while (0)
 
 #define PAL_CALL_STK(iprv,a0,a1,a2,a3) do {            \
        struct ia64_fpreg fr[6];                        \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                   \
        ia64_save_scratch_fpregs(fr);                   \
+       XEN_EFI_RR_ENTER(rr6, rr7);                     \
        iprv = ia64_pal_call_stacked(a0, a1, a2, a3);   \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                     \
        ia64_load_scratch_fpregs(fr);                   \
 } while (0)
 
 #define PAL_CALL_PHYS(iprv,a0,a1,a2,a3) do {                   \
        struct ia64_fpreg fr[6];                                \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                           \
        ia64_save_scratch_fpregs(fr);                           \
+       XEN_EFI_RR_ENTER(rr6, rr7);                             \
        iprv = ia64_pal_call_phys_static(a0, a1, a2, a3);       \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                             \
        ia64_load_scratch_fpregs(fr);                           \
 } while (0)
 
 #define PAL_CALL_PHYS_STK(iprv,a0,a1,a2,a3) do {               \
        struct ia64_fpreg fr[6];                                \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                           \
        ia64_save_scratch_fpregs(fr);                           \
+       XEN_EFI_RR_ENTER(rr6, rr7);                             \
        iprv = ia64_pal_call_phys_stacked(a0, a1, a2, a3);      \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                             \
        ia64_load_scratch_fpregs(fr);                           \
 } while (0)
 
diff -r 18a933a52874 -r fb5cfb8b122e xen/include/asm-ia64/linux-xen/asm/sal.h
--- a/xen/include/asm-ia64/linux-xen/asm/sal.h  Tue Jul 22 12:15:02 2008 +0900
+++ b/xen/include/asm-ia64/linux-xen/asm/sal.h  Tue Jul 22 12:15:02 2008 +0900
@@ -52,9 +52,12 @@ extern spinlock_t sal_lock;
 # define SAL_CALL(result,args...) do {                         \
        unsigned long __ia64_sc_flags;                          \
        struct ia64_fpreg __ia64_sc_fr[6];                      \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                           \
        ia64_save_scratch_fpregs(__ia64_sc_fr);                 \
        spin_lock_irqsave(&sal_lock, __ia64_sc_flags);          \
+       XEN_EFI_RR_ENTER(rr6, rr7);                             \
        __SAL_CALL(result, args);                               \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                             \
        spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags);     \
        ia64_load_scratch_fpregs(__ia64_sc_fr);                 \
 } while (0)
@@ -62,18 +65,24 @@ extern spinlock_t sal_lock;
 # define SAL_CALL_NOLOCK(result,args...) do {          \
        unsigned long __ia64_scn_flags;                 \
        struct ia64_fpreg __ia64_scn_fr[6];             \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                   \
        ia64_save_scratch_fpregs(__ia64_scn_fr);        \
        local_irq_save(__ia64_scn_flags);               \
+       XEN_EFI_RR_ENTER(rr6, rr7);                     \
        __SAL_CALL(result, args);                       \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                     \
        local_irq_restore(__ia64_scn_flags);            \
        ia64_load_scratch_fpregs(__ia64_scn_fr);        \
 } while (0)
 
 # define SAL_CALL_REENTRANT(result,args...) do {       \
        struct ia64_fpreg __ia64_scs_fr[6];             \
+       XEN_EFI_RR_DECLARE(rr6, rr7);                   \
        ia64_save_scratch_fpregs(__ia64_scs_fr);        \
        preempt_disable();                              \
+       XEN_EFI_RR_ENTER(rr6, rr7);                     \
        __SAL_CALL(result, args);                       \
+       XEN_EFI_RR_LEAVE(rr6, rr7);                     \
        preempt_enable();                               \
        ia64_load_scratch_fpregs(__ia64_scs_fr);        \
 } while (0)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] kexec: Use a separate RID for EFI, Xen patchbot-unstable <=