|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 08/10] mini-os: add proper pvh grant table handling
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |