[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 08/10] mini-os: add proper pvh grant table handling



Juergen Gross, le lun. 06 déc. 2021 08:23:35 +0100, a ecrit:
> Grant table initialization for PVH requires some additional actions
> compared to PV mode. Add those.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  arch/x86/gnttab.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/arch/x86/gnttab.c b/arch/x86/gnttab.c
> index 56e59d7..281c207 100644
> --- a/arch/x86/gnttab.c
> +++ b/arch/x86/gnttab.c
> @@ -22,11 +22,15 @@
>   */
>  
>  #include <mini-os/os.h>
> +#include <mini-os/console.h>
> +#include <mini-os/e820.h>
>  #include <mini-os/hypervisor.h>
>  #include <mini-os/gnttab.h>
>  #include <mini-os/mm.h>
>  #include <mini-os/types.h>
> +#include <xen/memory.h>
>  
> +#ifdef CONFIG_PARAVIRT
>  grant_entry_v1_t *arch_init_gnttab(int nr_grant_frames)
>  {
>      struct gnttab_setup_table setup;
> @@ -39,6 +43,33 @@ grant_entry_v1_t *arch_init_gnttab(int nr_grant_frames)
>      HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1);
>      return map_frames(frames, nr_grant_frames);
>  }
> +#else
> +grant_entry_v1_t *arch_init_gnttab(int nr_grant_frames)
> +{
> +    int i, rc;
> +    struct xen_add_to_physmap xatp;
> +    unsigned long pfn;
> +    unsigned long frames[nr_grant_frames];
> +
> +    pfn = e820_get_reserved_pfns(nr_grant_frames);
> +    for ( i = 0; i < nr_grant_frames; i++ )
> +    {
> +        xatp.domid = DOMID_SELF;
> +        xatp.idx = i;
> +        xatp.space = XENMAPSPACE_grant_table;
> +        xatp.gpfn = pfn + i;
> +        rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp);
> +        if ( rc )
> +        {
> +            xprintk("could not init grant table\n");
> +            do_exit();
> +        }
> +        frames[i] = pfn + i;
> +    }
> +
> +    return map_frames(frames, nr_grant_frames);
> +}
> +#endif
>  
>  void arch_suspend_gnttab(grant_entry_v1_t *gnttab_table, int nr_grant_frames)
>  {
> -- 
> 2.26.2
> 

-- 
Samuel
 > Il [e2fsck] a bien démarré, mais il m'a rendu la main aussitot en me
 > disant "houlala, c'est pas beau à voir votre truc, je préfèrerai que
 > vous teniez vous même la tronçonneuse" (traduction libre)
 NC in Guide du linuxien pervers : "Bien configurer sa tronçonneuse."



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.