Message ID | 20211206072337.9517-9-jgross@suse.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | mini-os: add missing PVH features | expand |
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@suse.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> > --- > 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 >
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) {
Grant table initialization for PVH requires some additional actions compared to PV mode. Add those. Signed-off-by: Juergen Gross <jgross@suse.com> --- arch/x86/gnttab.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)