History

Merge tag 'for-linus-4.18-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross: "This contains some minor code cleanups (fixing return types of functions), some fixes for Linux running as Xen PVH guest, and adding of a new guest resource mapping feature for Xen tools" * tag 'for-linus-4.18-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/PVH: Make GDT selectors PVH-specific xen/PVH: Set up GS segment for stack canary xen/store: do not store local values in xen_start_info xen-netfront: fix xennet_start_xmit()'s return type xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE xen: Change return type to vm_fault_t

Linus Torvalds committed 8 years ago

Commit a94fc252 parents 68abbe7 7f47e1c10 files · +332 −36Browse files

Unified · Split

10 files
  1. arch/arm/xen/enlighten.c +11 −0
  2. arch/x86/xen/mmu.c +43 −17
  3. arch/x86/xen/xen-pvh.S +37 −10
  4. drivers/net/xen-netfront.c +1 −1
  5. drivers/xen/privcmd.c +134 −1
  6. drivers/xen/xenbus/xenbus_probe.c +2 −3
  7. include/uapi/xen/privcmd.h +11 −0
  8. include/xen/interface/memory.h +66 −0
  9. include/xen/interface/xen.h +4 −3
  10. include/xen/xen-ops.h +23 −1
arch/arm/xen/enlighten.c+11−0
@@ -89,6 +89,17 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · 88 unmodified lines
8989 }
9090 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
9191
92+/* Not used by XENFEAT_auto_translated guests. */
93+int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
94+ unsigned long addr,
95+ xen_pfn_t *mfn, int nr,
96+ int *err_ptr, pgprot_t prot,
97+ unsigned int domid, struct page **pages)
98+{
99+ return -ENOSYS;
100+}
101+EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_array);
102+
92103 static void xen_read_wallclock(struct timespec64 *ts)
93104 {
94105 u32 version;
arch/x86/xen/mmu.c+43−17
@@ -63,37 +63,44 @@ static noinline void xen_flush_tlb_all(void) · 62 unmodified lines
6363 #define REMAP_BATCH_SIZE 16
6464
6565 struct remap_data {
66− xen_pfn_t *mfn;
66+ xen_pfn_t *pfn;
6767 bool contiguous;
68+ bool no_translate;
6869 pgprot_t prot;
6970 struct mmu_update *mmu_update;
7071 };
7172
72−static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token,
73+static int remap_area_pfn_pte_fn(pte_t *ptep, pgtable_t token,
7374 unsigned long addr, void *data)
7475 {
7576 struct remap_data *rmd = data;
76− pte_t pte = pte_mkspecial(mfn_pte(*rmd->mfn, rmd->prot));
77+ pte_t pte = pte_mkspecial(mfn_pte(*rmd->pfn, rmd->prot));
7778
78− /* If we have a contiguous range, just update the mfn itself,
79− else update pointer to be "next mfn". */
79+ /*
80+ * If we have a contiguous range, just update the pfn itself,
81+ * else update pointer to be "next pfn".
82+ */
8083 if (rmd->contiguous)
81− (*rmd->mfn)++;
84+ (*rmd->pfn)++;
8285 else
83− rmd->mfn++;
86+ rmd->pfn++;
8487
85− rmd->mmu_update->ptr = virt_to_machine(ptep).maddr | MMU_NORMAL_PT_UPDATE;
88+ rmd->mmu_update->ptr = virt_to_machine(ptep).maddr;
89+ rmd->mmu_update->ptr |= rmd->no_translate ?
90+ MMU_PT_UPDATE_NO_TRANSLATE :
91+ MMU_NORMAL_PT_UPDATE;
8692 rmd->mmu_update->val = pte_val_ma(pte);
8793 rmd->mmu_update++;
8894
8995 return 0;
9096 }
9197
92−static int do_remap_gfn(struct vm_area_struct *vma,
98+static int do_remap_pfn(struct vm_area_struct *vma,
9399 unsigned long addr,
94− xen_pfn_t *gfn, int nr,
100+ xen_pfn_t *pfn, int nr,
95101 int *err_ptr, pgprot_t prot,
96− unsigned domid,
102+ unsigned int domid,
103+ bool no_translate,
97104 struct page **pages)
98105 {
99106 int err = 0;
@@ -104,11 +111,14 @@ static int do_remap_gfn(struct vm_area_struct *vma, · 4 unmodified lines
104111
105112 BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_IO)) == (VM_PFNMAP | VM_IO)));
106113
107− rmd.mfn = gfn;
114+ rmd.pfn = pfn;
108115 rmd.prot = prot;
109− /* We use the err_ptr to indicate if there we are doing a contiguous
110− * mapping or a discontigious mapping. */
116+ /*
117+ * We use the err_ptr to indicate if there we are doing a contiguous
118+ * mapping or a discontigious mapping.
119+ */
111120 rmd.contiguous = !err_ptr;
121+ rmd.no_translate = no_translate;
112122
113123 while (nr) {
114124 int index = 0;
@@ -119,7 +129,7 @@ static int do_remap_gfn(struct vm_area_struct *vma, · 4 unmodified lines
119129
120130 rmd.mmu_update = mmu_update;
121131 err = apply_to_page_range(vma->vm_mm, addr, range,
122− remap_area_mfn_pte_fn, &rmd);
132+ remap_area_pfn_pte_fn, &rmd);
123133 if (err)
124134 goto out;
125135
@@ -173,7 +183,8 @@ int xen_remap_domain_gfn_range(struct vm_area_struct *vma, · 47 unmodified lines
173183 if (xen_feature(XENFEAT_auto_translated_physmap))
174184 return -EOPNOTSUPP;
175185
176− return do_remap_gfn(vma, addr, &gfn, nr, NULL, prot, domid, pages);
186+ return do_remap_pfn(vma, addr, &gfn, nr, NULL, prot, domid, false,
187+ pages);
177188 }
178189 EXPORT_SYMBOL_GPL(xen_remap_domain_gfn_range);
179190
@@ -192,10 +203,25 @@ int xen_remap_domain_gfn_array(struct vm_area_struct *vma, · 12 unmodified lines
192203 * cause of "wrong memory was mapped in".
193204 */
194205 BUG_ON(err_ptr == NULL);
195− return do_remap_gfn(vma, addr, gfn, nr, err_ptr, prot, domid, pages);
206+ return do_remap_pfn(vma, addr, gfn, nr, err_ptr, prot, domid,
207+ false, pages);
196208 }
197209 EXPORT_SYMBOL_GPL(xen_remap_domain_gfn_array);
198210
211+int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
212+ unsigned long addr,
213+ xen_pfn_t *mfn, int nr,
214+ int *err_ptr, pgprot_t prot,
215+ unsigned int domid, struct page **pages)
216+{
217+ if (xen_feature(XENFEAT_auto_translated_physmap))
218+ return -EOPNOTSUPP;
219+
220+ return do_remap_pfn(vma, addr, mfn, nr, err_ptr, prot, domid,
221+ true, pages);
222+}
223+EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_array);
224+
199225 /* Returns: 0 success */
200226 int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
201227 int nr, struct page **pages)
arch/x86/xen/xen-pvh.S+37−10
@@ -54,12 +54,19 @@ · 53 unmodified lines
5454 * charge of setting up it's own stack, GDT and IDT.
5555 */
5656
57+#define PVH_GDT_ENTRY_CS 1
58+#define PVH_GDT_ENTRY_DS 2
59+#define PVH_GDT_ENTRY_CANARY 3
60+#define PVH_CS_SEL (PVH_GDT_ENTRY_CS * 8)
61+#define PVH_DS_SEL (PVH_GDT_ENTRY_DS * 8)
62+#define PVH_CANARY_SEL (PVH_GDT_ENTRY_CANARY * 8)
63+
5764 ENTRY(pvh_start_xen)
5865 cld
5966
6067 lgdt (_pa(gdt))
6168
62− mov $(__BOOT_DS),%eax
69+ mov $PVH_DS_SEL,%eax
6370 mov %eax,%ds
6471 mov %eax,%es
6572 mov %eax,%ss
@@ -93,11 +100,17 @@ ENTRY(pvh_start_xen) · 27 unmodified lines
93100 mov %eax, %cr0
94101
95102 /* Jump to 64-bit mode. */
96− ljmp $__KERNEL_CS, $_pa(1f)
103+ ljmp $PVH_CS_SEL, $_pa(1f)
97104
98105 /* 64-bit entry point. */
99106 .code64
100107 1:
108+ /* Set base address in stack canary descriptor. */
109+ mov $MSR_GS_BASE,%ecx
110+ mov $_pa(canary), %eax
111+ xor %edx, %edx
112+ wrmsr
113+
101114 call xen_prepare_pvh
102115
103116 /* startup_64 expects boot_params in %rsi. */
@@ -107,6 +120,17 @@ ENTRY(pvh_start_xen) · 3 unmodified lines
107120
108121 #else /* CONFIG_X86_64 */
109122
123+ /* Set base address in stack canary descriptor. */
124+ movl $_pa(gdt_start),%eax
125+ movl $_pa(canary),%ecx
126+ movw %cx, (PVH_GDT_ENTRY_CANARY * 8) + 2(%eax)
127+ shrl $16, %ecx
128+ movb %cl, (PVH_GDT_ENTRY_CANARY * 8) + 4(%eax)
129+ movb %ch, (PVH_GDT_ENTRY_CANARY * 8) + 7(%eax)
130+
131+ mov $PVH_CANARY_SEL,%eax
132+ mov %eax,%gs
133+
110134 call mk_early_pgtbl_32
111135
112136 mov $_pa(initial_page_table), %eax
@@ -116,13 +140,13 @@ ENTRY(pvh_start_xen) · 3 unmodified lines
116140 or $(X86_CR0_PG | X86_CR0_PE), %eax
117141 mov %eax, %cr0
118142
119− ljmp $__BOOT_CS, $1f
143+ ljmp $PVH_CS_SEL, $1f
120144 1:
121145 call xen_prepare_pvh
122146 mov $_pa(pvh_bootparams), %esi
123147
124148 /* startup_32 doesn't expect paging and PAE to be on. */
125− ljmp $__BOOT_CS, $_pa(2f)
149+ ljmp $PVH_CS_SEL, $_pa(2f)
126150 2:
127151 mov %cr0, %eax
128152 and $~X86_CR0_PG, %eax
@@ -131,7 +155,7 @@ ENTRY(pvh_start_xen) · 2 unmodified lines
131155 and $~X86_CR4_PAE, %eax
132156 mov %eax, %cr4
133157
134− ljmp $__BOOT_CS, $_pa(startup_32)
158+ ljmp $PVH_CS_SEL, $_pa(startup_32)
135159 #endif
136160 END(pvh_start_xen)
137161
@@ -143,16 +167,19 @@ gdt: · 5 unmodified lines
143167 .word 0
144168 gdt_start:
145169 .quad 0x0000000000000000 /* NULL descriptor */
146− .quad 0x0000000000000000 /* reserved */
147170 #ifdef CONFIG_X86_64
148− .quad GDT_ENTRY(0xa09a, 0, 0xfffff) /* __KERNEL_CS */
171+ .quad GDT_ENTRY(0xa09a, 0, 0xfffff) /* PVH_CS_SEL */
149172 #else
150− .quad GDT_ENTRY(0xc09a, 0, 0xfffff) /* __KERNEL_CS */
173+ .quad GDT_ENTRY(0xc09a, 0, 0xfffff) /* PVH_CS_SEL */
151174 #endif
152− .quad GDT_ENTRY(0xc092, 0, 0xfffff) /* __KERNEL_DS */
175+ .quad GDT_ENTRY(0xc092, 0, 0xfffff) /* PVH_DS_SEL */
176+ .quad GDT_ENTRY(0x4090, 0, 0x18) /* PVH_CANARY_SEL */
153177 gdt_end:
154178
155− .balign 4
179+ .balign 16
180+canary:
181+ .fill 48, 1, 0
182+
156183 early_stack:
157184 .fill 256, 1, 0
158185 early_stack_end:
drivers/net/xen-netfront.c+1−1
@@ -564,7 +564,7 @@ static u16 xennet_select_queue(struct net_device *dev, struct sk_buff *skb, · 563 unmodified lines
564564
565565 #define MAX_XEN_SKB_FRAGS (65536 / XEN_PAGE_SIZE + 1)
566566
567−static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
567+static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
568568 {
569569 struct netfront_info *np = netdev_priv(dev);
570570 struct netfront_stats *tx_stats = this_cpu_ptr(np->tx_stats);
drivers/xen/privcmd.c+134−1
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <xen/xen.h>
3434 #include <xen/privcmd.h>
3535 #include <xen/interface/xen.h>
36+#include <xen/interface/memory.h>
3637 #include <xen/interface/hvm/dm_op.h>
3738 #include <xen/features.h>
3839 #include <xen/page.h>
@@ -722,6 +723,134 @@ static long privcmd_ioctl_restrict(struct file *file, void __user *udata) · 683 unmodified lines
722723 return 0;
723724 }
724725
726+struct remap_pfn {
727+ struct mm_struct *mm;
728+ struct page **pages;
729+ pgprot_t prot;
730+ unsigned long i;
731+};
732+
733+static int remap_pfn_fn(pte_t *ptep, pgtable_t token, unsigned long addr,
734+ void *data)
735+{
736+ struct remap_pfn *r = data;
737+ struct page *page = r->pages[r->i];
738+ pte_t pte = pte_mkspecial(pfn_pte(page_to_pfn(page), r->prot));
739+
740+ set_pte_at(r->mm, addr, ptep, pte);
741+ r->i++;
742+
743+ return 0;
744+}
745+
746+static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata)
747+{
748+ struct privcmd_data *data = file->private_data;
749+ struct mm_struct *mm = current->mm;
750+ struct vm_area_struct *vma;
751+ struct privcmd_mmap_resource kdata;
752+ xen_pfn_t *pfns = NULL;
753+ struct xen_mem_acquire_resource xdata;
754+ int rc;
755+
756+ if (copy_from_user(&kdata, udata, sizeof(kdata)))
757+ return -EFAULT;
758+
759+ /* If restriction is in place, check the domid matches */
760+ if (data->domid != DOMID_INVALID && data->domid != kdata.dom)
761+ return -EPERM;
762+
763+ down_write(&mm->mmap_sem);
764+
765+ vma = find_vma(mm, kdata.addr);
766+ if (!vma || vma->vm_ops != &privcmd_vm_ops) {
767+ rc = -EINVAL;
768+ goto out;
769+ }
770+
771+ pfns = kcalloc(kdata.num, sizeof(*pfns), GFP_KERNEL);
772+ if (!pfns) {
773+ rc = -ENOMEM;
774+ goto out;
775+ }
776+
777+ if (xen_feature(XENFEAT_auto_translated_physmap)) {
778+ unsigned int nr = DIV_ROUND_UP(kdata.num, XEN_PFN_PER_PAGE);
779+ struct page **pages;
780+ unsigned int i;
781+
782+ rc = alloc_empty_pages(vma, nr);
783+ if (rc < 0)
784+ goto out;
785+
786+ pages = vma->vm_private_data;
787+ for (i = 0; i < kdata.num; i++) {
788+ xen_pfn_t pfn =
789+ page_to_xen_pfn(pages[i / XEN_PFN_PER_PAGE]);
790+
791+ pfns[i] = pfn + (i % XEN_PFN_PER_PAGE);
792+ }
793+ } else
794+ vma->vm_private_data = PRIV_VMA_LOCKED;
795+
796+ memset(&xdata, 0, sizeof(xdata));
797+ xdata.domid = kdata.dom;
798+ xdata.type = kdata.type;
799+ xdata.id = kdata.id;
800+ xdata.frame = kdata.idx;
801+ xdata.nr_frames = kdata.num;
802+ set_xen_guest_handle(xdata.frame_list, pfns);
803+
804+ xen_preemptible_hcall_begin();
805+ rc = HYPERVISOR_memory_op(XENMEM_acquire_resource, &xdata);
806+ xen_preemptible_hcall_end();
807+
808+ if (rc)
809+ goto out;
810+
811+ if (xen_feature(XENFEAT_auto_translated_physmap)) {
812+ struct remap_pfn r = {
813+ .mm = vma->vm_mm,
814+ .pages = vma->vm_private_data,
815+ .prot = vma->vm_page_prot,
816+ };
817+
818+ rc = apply_to_page_range(r.mm, kdata.addr,
819+ kdata.num << PAGE_SHIFT,
820+ remap_pfn_fn, &r);
821+ } else {
822+ unsigned int domid =
823+ (xdata.flags & XENMEM_rsrc_acq_caller_owned) ?
824+ DOMID_SELF : kdata.dom;
825+ int num;
826+
827+ num = xen_remap_domain_mfn_array(vma,
828+ kdata.addr & PAGE_MASK,
829+ pfns, kdata.num, (int *)pfns,
830+ vma->vm_page_prot,
831+ domid,
832+ vma->vm_private_data);
833+ if (num < 0)
834+ rc = num;
835+ else if (num != kdata.num) {
836+ unsigned int i;
837+
838+ for (i = 0; i < num; i++) {
839+ rc = pfns[i];
840+ if (rc < 0)
841+ break;
842+ }
843+ } else
844+ rc = 0;
845+ }
846+
847+out:
848+ up_write(&mm->mmap_sem);
849+ kfree(pfns);
850+
851+ return rc;
852+}
853+
725854 static long privcmd_ioctl(struct file *file,
726855 unsigned int cmd, unsigned long data)
727856 {
@@ -753,6 +882,10 @@ static long privcmd_ioctl(struct file *file, · 25 unmodified lines
753882 ret = privcmd_ioctl_restrict(file, udata);
754883 break;
755884
885+ case IOCTL_PRIVCMD_MMAP_RESOURCE:
886+ ret = privcmd_ioctl_mmap_resource(file, udata);
887+ break;
888+
756889 default:
757890 break;
758891 }
@@ -801,7 +934,7 @@ static void privcmd_close(struct vm_area_struct *vma) · 42 unmodified lines
801934 kfree(pages);
802935 }
803936
804−static int privcmd_fault(struct vm_fault *vmf)
937+static vm_fault_t privcmd_fault(struct vm_fault *vmf)
805938 {
806939 printk(KERN_DEBUG "privcmd_fault: vma=%p %lx-%lx, pgoff=%lx, uv=%p\n",
807940 vmf->vma, vmf->vma->vm_start, vmf->vma->vm_end,
drivers/xen/xenbus/xenbus_probe.c+2−3
@@ -710,7 +710,7 @@ static int __init xenstored_local_init(void) · 709 unmodified lines
710710 if (!page)
711711 goto out_err;
712712
713− xen_store_gfn = xen_start_info->store_mfn = virt_to_gfn((void *)page);
713+ xen_store_gfn = virt_to_gfn((void *)page);
714714
715715 /* Next allocate a local port which xenstored can bind to */
716716 alloc_unbound.dom = DOMID_SELF;
@@ -722,8 +722,7 @@ static int __init xenstored_local_init(void) · 5 unmodified lines
722722 goto out_err;
723723
724724 BUG_ON(err);
725− xen_store_evtchn = xen_start_info->store_evtchn =
726− alloc_unbound.port;
725+ xen_store_evtchn = alloc_unbound.port;
727726
728727 return 0;
729728
include/uapi/xen/privcmd.h+11−0
@@ -89,6 +89,15 @@ struct privcmd_dm_op { · 88 unmodified lines
8989 const struct privcmd_dm_op_buf __user *ubufs;
9090 };
9191
92+struct privcmd_mmap_resource {
93+ domid_t dom;
94+ __u32 type;
95+ __u32 id;
96+ __u32 idx;
97+ __u64 num;
98+ __u64 addr;
99+};
100+
92101 /*
93102 * @cmd: IOCTL_PRIVCMD_HYPERCALL
94103 * @arg: &privcmd_hypercall_t
@@ -114,5 +123,7 @@ struct privcmd_dm_op { · 19 unmodified lines
114123 _IOC(_IOC_NONE, 'P', 5, sizeof(struct privcmd_dm_op))
115124 #define IOCTL_PRIVCMD_RESTRICT \
116125 _IOC(_IOC_NONE, 'P', 6, sizeof(domid_t))
126+#define IOCTL_PRIVCMD_MMAP_RESOURCE \
127+ _IOC(_IOC_NONE, 'P', 7, sizeof(struct privcmd_mmap_resource))
117128
118129 #endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
include/xen/interface/memory.h+66−0
@@ -265,4 +265,70 @@ struct xen_remove_from_physmap { · 264 unmodified lines
265265 };
266266 DEFINE_GUEST_HANDLE_STRUCT(xen_remove_from_physmap);
267267
268+/*
269+ * Get the pages for a particular guest resource, so that they can be
270+ * mapped directly by a tools domain.
271+ */
272+#define XENMEM_acquire_resource 28
273+struct xen_mem_acquire_resource {
274+ /* IN - The domain whose resource is to be mapped */
275+ domid_t domid;
276+ /* IN - the type of resource */
277+ uint16_t type;
278+
279+#define XENMEM_resource_ioreq_server 0
280+#define XENMEM_resource_grant_table 1
281+
282+ /*
283+ * IN - a type-specific resource identifier, which must be zero
284+ * unless stated otherwise.
285+ *
286+ * type == XENMEM_resource_ioreq_server -> id == ioreq server id
287+ * type == XENMEM_resource_grant_table -> id defined below
288+ */
289+ uint32_t id;
290+
291+#define XENMEM_resource_grant_table_id_shared 0
292+#define XENMEM_resource_grant_table_id_status 1
293+
294+ /* IN/OUT - As an IN parameter number of frames of the resource
295+ * to be mapped. However, if the specified value is 0 and
296+ * frame_list is NULL then this field will be set to the
297+ * maximum value supported by the implementation on return.
298+ */
299+ uint32_t nr_frames;
300+ /*
301+ * OUT - Must be zero on entry. On return this may contain a bitwise
302+ * OR of the following values.
303+ */
304+ uint32_t flags;
305+
306+ /* The resource pages have been assigned to the calling domain */
307+#define _XENMEM_rsrc_acq_caller_owned 0
308+#define XENMEM_rsrc_acq_caller_owned (1u << _XENMEM_rsrc_acq_caller_owned)
309+
310+ /*
311+ * IN - the index of the initial frame to be mapped. This parameter
312+ * is ignored if nr_frames is 0.
313+ */
314+ uint64_t frame;
315+
316+#define XENMEM_resource_ioreq_server_frame_bufioreq 0
317+#define XENMEM_resource_ioreq_server_frame_ioreq(n) (1 + (n))
318+
319+ /*
320+ * IN/OUT - If the tools domain is PV then, upon return, frame_list
321+ * will be populated with the MFNs of the resource.
322+ * If the tools domain is HVM then it is expected that, on
323+ * entry, frame_list will be populated with a list of GFNs
324+ * that will be mapped to the MFNs of the resource.
325+ * If -EIO is returned then the frame_list has only been
326+ * partially mapped and it is up to the caller to unmap all
327+ * the GFNs.
328+ * This parameter may be NULL if nr_frames is 0.
329+ */
330+ GUEST_HANDLE(xen_pfn_t) frame_list;
331+};
332+DEFINE_GUEST_HANDLE_STRUCT(xen_mem_acquire_resource);
333+
268334 #endif /* __XEN_PUBLIC_MEMORY_H__ */
include/xen/interface/xen.h+4−3
@@ -265,9 +265,10 @@ · 264 unmodified lines
265265 *
266266 * PAT (bit 7 on) --> PWT (bit 3 on) and clear bit 7.
267267 */
268−#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
269−#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
270−#define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */
268+#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
269+#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
270+#define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */
271+#define MMU_PT_UPDATE_NO_TRANSLATE 3 /* checked '*ptr = val'. ptr is MA. */
271272
272273 /*
273274 * MMU EXTENDED OPERATIONS
include/xen/xen-ops.h+23−1
@@ -63,7 +63,7 @@ static inline void xen_destroy_contiguous_region(phys_addr_t pstart, · 62 unmodified lines
6363 struct vm_area_struct;
6464
6565 /*
66− * xen_remap_domain_gfn_array() - map an array of foreign frames
66+ * xen_remap_domain_gfn_array() - map an array of foreign frames by gfn
6767 * @vma: VMA to map the pages into
6868 * @addr: Address at which to map the pages
6969 * @gfn: Array of GFNs to map
@@ -86,6 +86,28 @@ int xen_remap_domain_gfn_array(struct vm_area_struct *vma, · 16 unmodified lines
8686 unsigned domid,
8787 struct page **pages);
8888
89+/*
90+ * xen_remap_domain_mfn_array() - map an array of foreign frames by mfn
91+ * @vma: VMA to map the pages into
92+ * @addr: Address at which to map the pages
93+ * @mfn: Array of MFNs to map
94+ * @nr: Number entries in the MFN array
95+ * @err_ptr: Returns per-MFN error status.
96+ * @prot: page protection mask
97+ * @domid: Domain owning the pages
98+ * @pages: Array of pages if this domain has an auto-translated physmap
99+ *
100+ * @mfn and @err_ptr may point to the same buffer, the MFNs will be
101+ * overwritten by the error codes after they are mapped.
102+ *
103+ * Returns the number of successfully mapped frames, or a -ve error
104+ * code.
105+ */
106+int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
107+ unsigned long addr, xen_pfn_t *mfn, int nr,
108+ int *err_ptr, pgprot_t prot,
109+ unsigned int domid, struct page **pages);
110+
89111 /* xen_remap_domain_gfn_range() - map a range of foreign frames
90112 * @vma: VMA to map the pages into
91113 * @addr: Address at which to map the pages

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t