diff mbox

[Xen-devel,v3,2/4] xen/xsm: Add xsm_core_init function

Message ID 1395407109-19153-3-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall March 21, 2014, 1:05 p.m. UTC
This function contains non-specific architecture code (mostly the tail of
xsm_multiboot_init). It will be used later to avoid code duplication.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>

---
    Changes in v2:
        - Patch added
---
 xen/xsm/xsm_core.c |   26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

Comments

Jan Beulich March 21, 2014, 1:39 p.m. UTC | #1
>>> On 21.03.14 at 14:05, Julien Grall <julien.grall@linaro.org> wrote:
> --- a/xen/xsm/xsm_core.c
> +++ b/xen/xsm/xsm_core.c
> @@ -43,6 +43,21 @@ static void __init do_xsm_initcalls(void)
>      }
>  }
>  
> +static int __init xsm_core_init(void)
> +{
> +    if ( verify(&dummy_xsm_ops) )
> +    {
> +        printk("%s could not verify "
> +               "dummy_xsm_ops structure.\n", __FUNCTION__);
> +        return -EIO;
> +    }
> +
> +    xsm_ops = &dummy_xsm_ops;
> +    do_xsm_initcalls();
> +
> +    return 0;
> +}
> +
>  #ifdef CONFIG_MULTIBOOT
>  int __init xsm_multiboot_init(unsigned long *module_map,
>                                const multiboot_info_t *mbi,
> @@ -63,16 +78,7 @@ int __init xsm_multiboot_init(unsigned long *module_map,
>          }
>      }
>  
> -    if ( verify(&dummy_xsm_ops) )
> -    {
> -        bootstrap_map(NULL);

So where did that call go?

Jan

> -        printk("%s could not verify "
> -               "dummy_xsm_ops structure.\n", __FUNCTION__);
> -        return -EIO;
> -    }
> -
> -    xsm_ops = &dummy_xsm_ops;
> -    do_xsm_initcalls();
> +    ret = xsm_core_init();
>      bootstrap_map(NULL);
>  
>      return 0;
Julien Grall March 21, 2014, 2:02 p.m. UTC | #2
Hi Jan,

On 03/21/2014 01:39 PM, Jan Beulich wrote:
>>>> On 21.03.14 at 14:05, Julien Grall <julien.grall@linaro.org> wrote:
>> --- a/xen/xsm/xsm_core.c
>> +++ b/xen/xsm/xsm_core.c
>> @@ -43,6 +43,21 @@ static void __init do_xsm_initcalls(void)
>>      }
>>  }
>>  
>> +static int __init xsm_core_init(void)
>> +{
>> +    if ( verify(&dummy_xsm_ops) )
>> +    {
>> +        printk("%s could not verify "
>> +               "dummy_xsm_ops structure.\n", __FUNCTION__);
>> +        return -EIO;
>> +    }
>> +
>> +    xsm_ops = &dummy_xsm_ops;
>> +    do_xsm_initcalls();
>> +
>> +    return 0;
>> +}
>> +
>>  #ifdef CONFIG_MULTIBOOT
>>  int __init xsm_multiboot_init(unsigned long *module_map,
>>                                const multiboot_info_t *mbi,
>> @@ -63,16 +78,7 @@ int __init xsm_multiboot_init(unsigned long *module_map,
>>          }
>>      }
>>  
>> -    if ( verify(&dummy_xsm_ops) )
>> -    {
>> -        bootstrap_map(NULL);
> 
> So where did that call go?

After xsm_core_init (see below).

>> -        printk("%s could not verify "
>> -               "dummy_xsm_ops structure.\n", __FUNCTION__);
>> -        return -EIO;
>> -    }
>> -
>> -    xsm_ops = &dummy_xsm_ops;
>> -    do_xsm_initcalls();
>> +    ret = xsm_core_init();
>>      bootstrap_map(NULL);

Just here.

Regards,
Daniel De Graaf March 21, 2014, 2:16 p.m. UTC | #3
On 03/21/2014 09:05 AM, Julien Grall wrote:
> This function contains non-specific architecture code (mostly the tail of
> xsm_multiboot_init). It will be used later to avoid code duplication.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>

Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Jan Beulich March 21, 2014, 2:46 p.m. UTC | #4
>>> On 21.03.14 at 15:02, Julien Grall <julien.grall@linaro.org> wrote:
> Hi Jan,
> 
> On 03/21/2014 01:39 PM, Jan Beulich wrote:
>>>>> On 21.03.14 at 14:05, Julien Grall <julien.grall@linaro.org> wrote:
>>> --- a/xen/xsm/xsm_core.c
>>> +++ b/xen/xsm/xsm_core.c
>>> @@ -43,6 +43,21 @@ static void __init do_xsm_initcalls(void)
>>>      }
>>>  }
>>>  
>>> +static int __init xsm_core_init(void)
>>> +{
>>> +    if ( verify(&dummy_xsm_ops) )
>>> +    {
>>> +        printk("%s could not verify "
>>> +               "dummy_xsm_ops structure.\n", __FUNCTION__);
>>> +        return -EIO;
>>> +    }
>>> +
>>> +    xsm_ops = &dummy_xsm_ops;
>>> +    do_xsm_initcalls();
>>> +
>>> +    return 0;
>>> +}
>>> +
>>>  #ifdef CONFIG_MULTIBOOT
>>>  int __init xsm_multiboot_init(unsigned long *module_map,
>>>                                const multiboot_info_t *mbi,
>>> @@ -63,16 +78,7 @@ int __init xsm_multiboot_init(unsigned long *module_map,
>>>          }
>>>      }
>>>  
>>> -    if ( verify(&dummy_xsm_ops) )
>>> -    {
>>> -        bootstrap_map(NULL);
>> 
>> So where did that call go?
> 
> After xsm_core_init (see below).
> 
>>> -        printk("%s could not verify "
>>> -               "dummy_xsm_ops structure.\n", __FUNCTION__);
>>> -        return -EIO;
>>> -    }
>>> -
>>> -    xsm_ops = &dummy_xsm_ops;
>>> -    do_xsm_initcalls();
>>> +    ret = xsm_core_init();
>>>      bootstrap_map(NULL);
> 
> Just here.

Oh, right, you're just folding both paths as far as this function is
concerned. That's fine then of course.

Jan
diff mbox

Patch

diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index 11a9ca7..24b0ff4 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -43,6 +43,21 @@  static void __init do_xsm_initcalls(void)
     }
 }
 
+static int __init xsm_core_init(void)
+{
+    if ( verify(&dummy_xsm_ops) )
+    {
+        printk("%s could not verify "
+               "dummy_xsm_ops structure.\n", __FUNCTION__);
+        return -EIO;
+    }
+
+    xsm_ops = &dummy_xsm_ops;
+    do_xsm_initcalls();
+
+    return 0;
+}
+
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_init(unsigned long *module_map,
                               const multiboot_info_t *mbi,
@@ -63,16 +78,7 @@  int __init xsm_multiboot_init(unsigned long *module_map,
         }
     }
 
-    if ( verify(&dummy_xsm_ops) )
-    {
-        bootstrap_map(NULL);
-        printk("%s could not verify "
-               "dummy_xsm_ops structure.\n", __FUNCTION__);
-        return -EIO;
-    }
-
-    xsm_ops = &dummy_xsm_ops;
-    do_xsm_initcalls();
+    ret = xsm_core_init();
     bootstrap_map(NULL);
 
     return 0;