Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull xen updates from Juergen Gross:

- fix the migration of a Xen virq to another cpu plus some related
cleanup work

- clean up Xen-PV mode specific code, resulting in removing some of
that code in the resulting binary in case CONFIG_XEN_PV is not set

- fixes and cleanup for suspend handling under Xen

* tag 'for-linus-6.18-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen: take system_transition_mutex on suspend
xen/manage: Fix suspend error path
xen/events: Update virq_to_irq on migration
xen/events: Return -EEXIST for bound VIRQs
xen/events: Cleanup find_virq() return codes
x86/xen: select HIBERNATE_CALLBACKS more directly
drivers/xen/gntdev: use xen_pv_domain() instead of cached value
xen: replace XENFEAT_auto_translated_physmap with xen_pv_domain()
xen: rework xen_pv_domain()

+101 -76
-1
arch/x86/configs/xen.config
··· 12 12 13 13 # x86 xen specific config options 14 14 CONFIG_XEN_PVH=y 15 - CONFIG_XEN_SAVE_RESTORE=y 16 15 # CONFIG_XEN_DEBUG_FS is not set 17 16 CONFIG_XEN_MCE_LOG=y 18 17 CONFIG_XEN_ACPI_PROCESSOR=m
+7 -7
arch/x86/include/asm/xen/page.h
··· 12 12 #include <asm/extable.h> 13 13 #include <asm/page.h> 14 14 15 + #include <xen/xen.h> 15 16 #include <xen/interface/xen.h> 16 17 #include <xen/interface/grant_table.h> 17 - #include <xen/features.h> 18 18 19 19 /* Xen machine address */ 20 20 typedef struct xmaddr { ··· 162 162 * pfn_to_mfn. This will have to be removed when we figured 163 163 * out which call. 164 164 */ 165 - if (xen_feature(XENFEAT_auto_translated_physmap)) 165 + if (!xen_pv_domain()) 166 166 return pfn; 167 167 168 168 mfn = __pfn_to_mfn(pfn); ··· 175 175 176 176 static inline int phys_to_machine_mapping_valid(unsigned long pfn) 177 177 { 178 - if (xen_feature(XENFEAT_auto_translated_physmap)) 178 + if (!xen_pv_domain()) 179 179 return 1; 180 180 181 181 return __pfn_to_mfn(pfn) != INVALID_P2M_ENTRY; ··· 210 210 * gfn_to_pfn. This will have to be removed when we figure 211 211 * out which call. 212 212 */ 213 - if (xen_feature(XENFEAT_auto_translated_physmap)) 213 + if (!xen_pv_domain()) 214 214 return mfn; 215 215 216 216 pfn = mfn_to_pfn_no_overrides(mfn); ··· 242 242 /* Pseudo-physical <-> Guest conversion */ 243 243 static inline unsigned long pfn_to_gfn(unsigned long pfn) 244 244 { 245 - if (xen_feature(XENFEAT_auto_translated_physmap)) 245 + if (!xen_pv_domain()) 246 246 return pfn; 247 247 else 248 248 return pfn_to_mfn(pfn); ··· 250 250 251 251 static inline unsigned long gfn_to_pfn(unsigned long gfn) 252 252 { 253 - if (xen_feature(XENFEAT_auto_translated_physmap)) 253 + if (!xen_pv_domain()) 254 254 return gfn; 255 255 else 256 256 return mfn_to_pfn(gfn); ··· 284 284 { 285 285 unsigned long pfn; 286 286 287 - if (xen_feature(XENFEAT_auto_translated_physmap)) 287 + if (!xen_pv_domain()) 288 288 return mfn; 289 289 290 290 pfn = mfn_to_pfn(mfn);
+1 -6
arch/x86/xen/Kconfig
··· 8 8 depends on PARAVIRT 9 9 select PARAVIRT_CLOCK 10 10 select X86_HV_CALLBACK_VECTOR 11 + select HIBERNATE_CALLBACKS 11 12 depends on X86_64 || (X86_32 && X86_PAE) 12 13 depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MATOM) 13 14 depends on X86_LOCAL_APIC && X86_TSC ··· 64 63 depends on XEN_PVHVM && PCI 65 64 help 66 65 Support running as a Xen PVHVM guest. 67 - 68 - config XEN_SAVE_RESTORE 69 - bool 70 - depends on XEN 71 - select HIBERNATE_CALLBACKS 72 - default y 73 66 74 67 config XEN_DEBUG_FS 75 68 bool "Enable Xen debug and tuning parameters in debugfs"
+1 -1
arch/x86/xen/enlighten_pv.c
··· 382 382 383 383 static void __init xen_init_capabilities(void) 384 384 { 385 - setup_force_cpu_cap(X86_FEATURE_XENPV); 386 385 setup_clear_cpu_cap(X86_FEATURE_DCA); 387 386 setup_clear_cpu_cap(X86_FEATURE_APERFMPERF); 388 387 setup_clear_cpu_cap(X86_FEATURE_MTRR); ··· 1401 1402 JMP32_INSN_SIZE); 1402 1403 1403 1404 xen_domain_type = XEN_PV_DOMAIN; 1405 + setup_force_cpu_cap(X86_FEATURE_XENPV); 1404 1406 xen_start_flags = xen_start_info->flags; 1405 1407 /* Interrupts are guaranteed to be off initially. */ 1406 1408 early_boot_irqs_disabled = true;
+1 -1
arch/x86/xen/mmu.c
··· 41 41 int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, 42 42 int nr, struct page **pages) 43 43 { 44 - if (xen_feature(XENFEAT_auto_translated_physmap)) 44 + if (!xen_pv_domain()) 45 45 return xen_xlate_unmap_gfn_range(vma, nr, pages); 46 46 47 47 if (!pages)
+2 -2
arch/x86/xen/p2m.c
··· 686 686 int i, ret = 0; 687 687 pte_t *pte; 688 688 689 - if (xen_feature(XENFEAT_auto_translated_physmap)) 689 + if (!xen_pv_domain()) 690 690 return 0; 691 691 692 692 if (kmap_ops) { ··· 769 769 { 770 770 int i, ret = 0; 771 771 772 - if (xen_feature(XENFEAT_auto_translated_physmap)) 772 + if (!xen_pv_domain()) 773 773 return 0; 774 774 775 775 for (i = 0; i < count; i++) {
+2 -2
drivers/xen/balloon.c
··· 302 302 * are not restored since this region is now known not to 303 303 * conflict with any devices. 304 304 */ 305 - if (!xen_feature(XENFEAT_auto_translated_physmap)) { 305 + if (xen_pv_domain()) { 306 306 unsigned long pfn, i; 307 307 308 308 pfn = PFN_DOWN(resource->start); ··· 626 626 */ 627 627 BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE); 628 628 629 - if (!xen_feature(XENFEAT_auto_translated_physmap)) { 629 + if (xen_pv_domain()) { 630 630 ret = xen_alloc_p2m_entry(page_to_pfn(page)); 631 631 if (ret < 0) 632 632 goto out_undo;
+29 -8
drivers/xen/events/events_base.c
··· 1314 1314 } 1315 1315 EXPORT_SYMBOL_GPL(bind_interdomain_evtchn_to_irq_lateeoi); 1316 1316 1317 - static int find_virq(unsigned int virq, unsigned int cpu, evtchn_port_t *evtchn) 1317 + static int find_virq(unsigned int virq, unsigned int cpu, evtchn_port_t *evtchn, 1318 + bool percpu) 1318 1319 { 1319 1320 struct evtchn_status status; 1320 1321 evtchn_port_t port; 1321 - int rc = -ENOENT; 1322 + bool exists = false; 1322 1323 1323 1324 memset(&status, 0, sizeof(status)); 1324 1325 for (port = 0; port < xen_evtchn_max_channels(); port++) { 1326 + int rc; 1327 + 1325 1328 status.dom = DOMID_SELF; 1326 1329 status.port = port; 1327 1330 rc = HYPERVISOR_event_channel_op(EVTCHNOP_status, &status); ··· 1332 1329 continue; 1333 1330 if (status.status != EVTCHNSTAT_virq) 1334 1331 continue; 1335 - if (status.u.virq == virq && status.vcpu == xen_vcpu_nr(cpu)) { 1332 + if (status.u.virq != virq) 1333 + continue; 1334 + if (status.vcpu == xen_vcpu_nr(cpu)) { 1336 1335 *evtchn = port; 1337 - break; 1336 + return 0; 1337 + } else if (!percpu) { 1338 + exists = true; 1338 1339 } 1339 1340 } 1340 - return rc; 1341 + return exists ? -EEXIST : -ENOENT; 1341 1342 } 1342 1343 1343 1344 /** ··· 1388 1381 evtchn = bind_virq.port; 1389 1382 else { 1390 1383 if (ret == -EEXIST) 1391 - ret = find_virq(virq, cpu, &evtchn); 1392 - BUG_ON(ret < 0); 1384 + ret = find_virq(virq, cpu, &evtchn, percpu); 1385 + if (ret) { 1386 + __unbind_from_irq(info, info->irq); 1387 + goto out; 1388 + } 1393 1389 } 1394 1390 1395 1391 ret = xen_irq_info_virq_setup(info, cpu, evtchn, virq); ··· 1797 1787 * virq or IPI channel, which don't actually need to be rebound. Ignore 1798 1788 * it, but don't do the xenlinux-level rebind in that case. 1799 1789 */ 1800 - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0) 1790 + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0) { 1791 + int old_cpu = info->cpu; 1792 + 1801 1793 bind_evtchn_to_cpu(info, tcpu, false); 1794 + 1795 + if (info->type == IRQT_VIRQ) { 1796 + int virq = info->u.virq; 1797 + int irq = per_cpu(virq_to_irq, old_cpu)[virq]; 1798 + 1799 + per_cpu(virq_to_irq, old_cpu)[virq] = -1; 1800 + per_cpu(virq_to_irq, tcpu)[virq] = irq; 1801 + } 1802 + } 1802 1803 1803 1804 do_unmask(info, EVT_MASK_REASON_TEMPORARY); 1804 1805
+3 -4
drivers/xen/gntdev-dmabuf.c
··· 720 720 721 721 /* DMA buffer IOCTL support. */ 722 722 723 - long gntdev_ioctl_dmabuf_exp_from_refs(struct gntdev_priv *priv, int use_ptemod, 723 + long gntdev_ioctl_dmabuf_exp_from_refs(struct gntdev_priv *priv, 724 724 struct ioctl_gntdev_dmabuf_exp_from_refs __user *u) 725 725 { 726 726 struct ioctl_gntdev_dmabuf_exp_from_refs op; 727 727 u32 *refs; 728 728 long ret; 729 729 730 - if (use_ptemod) { 731 - pr_debug("Cannot provide dma-buf: use_ptemode %d\n", 732 - use_ptemod); 730 + if (xen_pv_domain()) { 731 + pr_debug("Cannot provide dma-buf in a PV domain\n"); 733 732 return -EINVAL; 734 733 } 735 734
+1 -1
drivers/xen/gntdev-dmabuf.h
··· 18 18 19 19 void gntdev_dmabuf_fini(struct gntdev_dmabuf_priv *priv); 20 20 21 - long gntdev_ioctl_dmabuf_exp_from_refs(struct gntdev_priv *priv, int use_ptemod, 21 + long gntdev_ioctl_dmabuf_exp_from_refs(struct gntdev_priv *priv, 22 22 struct ioctl_gntdev_dmabuf_exp_from_refs __user *u); 23 23 24 24 long gntdev_ioctl_dmabuf_exp_wait_released(struct gntdev_priv *priv,
+14 -19
drivers/xen/gntdev.c
··· 73 73 MODULE_PARM_DESC(limit, 74 74 "Maximum number of grants that may be mapped by one mapping request"); 75 75 76 - /* True in PV mode, false otherwise */ 77 - static int use_ptemod; 78 - 79 76 static void unmap_grant_pages(struct gntdev_grant_map *map, 80 77 int offset, int pages); 81 78 ··· 160 163 NULL == add->pages || 161 164 NULL == add->being_removed) 162 165 goto err; 163 - if (use_ptemod) { 166 + if (xen_pv_domain()) { 164 167 add->kmap_ops = kvmalloc_array(count, sizeof(add->kmap_ops[0]), 165 168 GFP_KERNEL); 166 169 add->kunmap_ops = kvmalloc_array(count, sizeof(add->kunmap_ops[0]), ··· 208 211 add->grants[i].ref = INVALID_GRANT_REF; 209 212 add->map_ops[i].handle = INVALID_GRANT_HANDLE; 210 213 add->unmap_ops[i].handle = INVALID_GRANT_HANDLE; 211 - if (use_ptemod) { 214 + if (xen_pv_domain()) { 212 215 add->kmap_ops[i].handle = INVALID_GRANT_HANDLE; 213 216 add->kunmap_ops[i].handle = INVALID_GRANT_HANDLE; 214 217 } ··· 265 268 if (!refcount_dec_and_test(&map->users)) 266 269 return; 267 270 268 - if (map->pages && !use_ptemod) { 271 + if (map->pages && !xen_pv_domain()) { 269 272 /* 270 273 * Increment the reference count. This ensures that the 271 274 * subsequent call to unmap_grant_pages() will not wind up ··· 295 298 */ 296 299 } 297 300 298 - if (use_ptemod && map->notifier_init) 301 + if (xen_pv_domain() && map->notifier_init) 299 302 mmu_interval_notifier_remove(&map->notifier); 300 303 301 304 if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) { ··· 331 334 size_t alloced = 0; 332 335 int i, err = 0; 333 336 334 - if (!use_ptemod) { 337 + if (!xen_pv_domain()) { 335 338 /* Note: it could already be mapped */ 336 339 if (map->map_ops[0].handle != INVALID_GRANT_HANDLE) 337 340 return 0; ··· 386 389 if (map->flags & GNTMAP_device_map) 387 390 map->unmap_ops[i].dev_bus_addr = map->map_ops[i].dev_bus_addr; 388 391 389 - if (use_ptemod) { 392 + if (xen_pv_domain()) { 390 393 if (map->kmap_ops[i].status == GNTST_okay) { 391 394 alloced++; 392 395 map->kunmap_ops[i].handle = map->kmap_ops[i].handle; ··· 418 421 map->unmap_ops[offset+i].handle, 419 422 map->unmap_ops[offset+i].status); 420 423 map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; 421 - if (use_ptemod) { 424 + if (xen_pv_domain()) { 422 425 if (map->kunmap_ops[offset + i].status == GNTST_okay && 423 426 map->kunmap_ops[offset + i].handle != INVALID_GRANT_HANDLE) 424 427 successful_unmaps++; ··· 461 464 } 462 465 463 466 map->unmap_data.unmap_ops = map->unmap_ops + offset; 464 - map->unmap_data.kunmap_ops = use_ptemod ? map->kunmap_ops + offset : NULL; 467 + map->unmap_data.kunmap_ops = xen_pv_domain() ? map->kunmap_ops + offset : NULL; 465 468 map->unmap_data.pages = map->pages + offset; 466 469 map->unmap_data.count = pages; 467 470 map->unmap_data.done = __unmap_grant_pages_done; ··· 1036 1039 1037 1040 #ifdef CONFIG_XEN_GNTDEV_DMABUF 1038 1041 case IOCTL_GNTDEV_DMABUF_EXP_FROM_REFS: 1039 - return gntdev_ioctl_dmabuf_exp_from_refs(priv, use_ptemod, ptr); 1042 + return gntdev_ioctl_dmabuf_exp_from_refs(priv, ptr); 1040 1043 1041 1044 case IOCTL_GNTDEV_DMABUF_EXP_WAIT_RELEASED: 1042 1045 return gntdev_ioctl_dmabuf_exp_wait_released(priv, ptr); ··· 1083 1086 1084 1087 vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP | VM_MIXEDMAP); 1085 1088 1086 - if (use_ptemod) 1089 + if (xen_pv_domain()) 1087 1090 vm_flags_set(vma, VM_DONTCOPY); 1088 1091 1089 1092 vma->vm_private_data = map; ··· 1099 1102 1100 1103 map->pages_vm_start = vma->vm_start; 1101 1104 1102 - if (use_ptemod) { 1105 + if (xen_pv_domain()) { 1103 1106 err = mmu_interval_notifier_insert_locked( 1104 1107 &map->notifier, vma->vm_mm, vma->vm_start, 1105 1108 vma->vm_end - vma->vm_start, &gntdev_mmu_ops); ··· 1110 1113 } 1111 1114 mutex_unlock(&priv->lock); 1112 1115 1113 - if (use_ptemod) { 1116 + if (xen_pv_domain()) { 1114 1117 /* 1115 1118 * gntdev takes the address of the PTE in find_grant_ptes() and 1116 1119 * passes it to the hypervisor in gntdev_map_grant_pages(). The ··· 1136 1139 if (err) 1137 1140 goto out_put_map; 1138 1141 1139 - if (!use_ptemod) { 1142 + if (!xen_pv_domain()) { 1140 1143 err = vm_map_pages_zero(vma, map->pages, map->count); 1141 1144 if (err) 1142 1145 goto out_put_map; ··· 1151 1154 out_unlock_put: 1152 1155 mutex_unlock(&priv->lock); 1153 1156 out_put_map: 1154 - if (use_ptemod) 1157 + if (xen_pv_domain()) 1155 1158 unmap_grant_pages(map, 0, map->count); 1156 1159 gntdev_put_map(priv, map); 1157 1160 return err; ··· 1179 1182 1180 1183 if (!xen_domain()) 1181 1184 return -ENODEV; 1182 - 1183 - use_ptemod = !xen_feature(XENFEAT_auto_translated_physmap); 1184 1185 1185 1186 err = misc_register(&gntdev_miscdev); 1186 1187 if (err != 0) {
+3 -3
drivers/xen/grant-table.c
··· 1449 1449 unsigned int nr_gframes = end_idx + 1; 1450 1450 int rc; 1451 1451 1452 - if (xen_feature(XENFEAT_auto_translated_physmap)) { 1452 + if (!xen_pv_domain()) { 1453 1453 struct xen_add_to_physmap xatp; 1454 1454 unsigned int i = end_idx; 1455 1455 rc = 0; ··· 1570 1570 if (max_nr_gframes < nr_grant_frames) 1571 1571 return -ENOSYS; 1572 1572 1573 - if (xen_feature(XENFEAT_auto_translated_physmap) && gnttab_shared.addr == NULL) { 1573 + if (!xen_pv_domain() && gnttab_shared.addr == NULL) { 1574 1574 gnttab_shared.addr = xen_auto_xlat_grant_frames.vaddr; 1575 1575 if (gnttab_shared.addr == NULL) { 1576 1576 pr_warn("gnttab share frames is not mapped!\n"); ··· 1588 1588 1589 1589 int gnttab_suspend(void) 1590 1590 { 1591 - if (!xen_feature(XENFEAT_auto_translated_physmap)) 1591 + if (xen_pv_domain()) 1592 1592 gnttab_interface->unmap_frames(); 1593 1593 return 0; 1594 1594 }
+12 -2
drivers/xen/manage.c
··· 11 11 #include <linux/reboot.h> 12 12 #include <linux/sysrq.h> 13 13 #include <linux/stop_machine.h> 14 + #include <linux/suspend.h> 14 15 #include <linux/freezer.h> 15 16 #include <linux/syscore_ops.h> 16 17 #include <linux/export.h> ··· 96 95 97 96 shutting_down = SHUTDOWN_SUSPEND; 98 97 98 + if (!mutex_trylock(&system_transition_mutex)) 99 + { 100 + pr_err("%s: failed to take system_transition_mutex\n", __func__); 101 + goto out; 102 + } 103 + 99 104 err = freeze_processes(); 100 105 if (err) { 101 106 pr_err("%s: freeze processes failed %d\n", __func__, err); 102 - goto out; 107 + goto out_unlock; 103 108 } 104 109 105 110 err = freeze_kernel_threads(); ··· 117 110 err = dpm_suspend_start(PMSG_FREEZE); 118 111 if (err) { 119 112 pr_err("%s: dpm_suspend_start %d\n", __func__, err); 120 - goto out_thaw; 113 + goto out_resume_end; 121 114 } 122 115 123 116 printk(KERN_DEBUG "suspending xenstore...\n"); ··· 157 150 else 158 151 xs_suspend_cancel(); 159 152 153 + out_resume_end: 160 154 dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); 161 155 162 156 out_thaw: 163 157 thaw_processes(); 158 + out_unlock: 159 + mutex_unlock(&system_transition_mutex); 164 160 out: 165 161 shutting_down = SHUTDOWN_INVALID; 166 162 }
+6 -8
drivers/xen/privcmd.c
··· 271 271 struct mmap_gfn_state state; 272 272 273 273 /* We only support privcmd_ioctl_mmap_batch for non-auto-translated. */ 274 - if (xen_feature(XENFEAT_auto_translated_physmap)) 274 + if (!xen_pv_domain()) 275 275 return -ENOSYS; 276 276 277 277 if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd))) ··· 353 353 struct page **cur_pages = NULL; 354 354 int ret; 355 355 356 - if (xen_feature(XENFEAT_auto_translated_physmap)) 356 + if (!xen_pv_domain()) 357 357 cur_pages = &pages[st->index]; 358 358 359 359 BUG_ON(nr < 0); ··· 535 535 ret = -EINVAL; 536 536 goto out_unlock; 537 537 } 538 - if (xen_feature(XENFEAT_auto_translated_physmap)) { 538 + if (!xen_pv_domain()) { 539 539 ret = alloc_empty_pages(vma, nr_pages); 540 540 if (ret < 0) 541 541 goto out_unlock; ··· 779 779 goto out; 780 780 } 781 781 782 - if (IS_ENABLED(CONFIG_XEN_AUTO_XLATE) && 783 - xen_feature(XENFEAT_auto_translated_physmap)) { 782 + if (IS_ENABLED(CONFIG_XEN_AUTO_XLATE) && !xen_pv_domain()) { 784 783 unsigned int nr = DIV_ROUND_UP(kdata.num, XEN_PFN_PER_PAGE); 785 784 struct page **pages; 786 785 unsigned int i; ··· 810 811 if (rc) 811 812 goto out; 812 813 813 - if (IS_ENABLED(CONFIG_XEN_AUTO_XLATE) && 814 - xen_feature(XENFEAT_auto_translated_physmap)) { 814 + if (IS_ENABLED(CONFIG_XEN_AUTO_XLATE) && !xen_pv_domain()) { 815 815 rc = xen_remap_vma_range(vma, kdata.addr, kdata.num << PAGE_SHIFT); 816 816 } else { 817 817 unsigned int domid = ··· 1589 1591 int numgfns = (vma->vm_end - vma->vm_start) >> XEN_PAGE_SHIFT; 1590 1592 int rc; 1591 1593 1592 - if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages) 1594 + if (xen_pv_domain() || !numpgs || !pages) 1593 1595 return; 1594 1596 1595 1597 rc = xen_unmap_domain_gfn_range(vma, numgfns, pages);
+2 -2
drivers/xen/unpopulated-alloc.c
··· 105 105 * are not restored since this region is now known not to 106 106 * conflict with any devices. 107 107 */ 108 - if (!xen_feature(XENFEAT_auto_translated_physmap)) { 108 + if (xen_pv_domain()) { 109 109 xen_pfn_t pfn = PFN_DOWN(res->start); 110 110 111 111 for (i = 0; i < alloc_pages; i++) { ··· 184 184 pages[i] = pg; 185 185 186 186 #ifdef CONFIG_XEN_HAVE_PVMMU 187 - if (!xen_feature(XENFEAT_auto_translated_physmap)) { 187 + if (xen_pv_domain()) { 188 188 ret = xen_alloc_p2m_entry(page_to_pfn(pg)); 189 189 if (ret < 0) { 190 190 unsigned int j;
+1 -1
drivers/xen/xenbus/xenbus_client.c
··· 955 955 void __init xenbus_ring_ops_init(void) 956 956 { 957 957 #ifdef CONFIG_XEN_PV 958 - if (!xen_feature(XENFEAT_auto_translated_physmap)) 958 + if (xen_pv_domain()) 959 959 ring_ops = &ring_ops_pv; 960 960 else 961 961 #endif
+2 -2
include/xen/grant_table.h
··· 164 164 { 165 165 if (flags & GNTMAP_contains_pte) 166 166 map->host_addr = addr; 167 - else if (xen_feature(XENFEAT_auto_translated_physmap)) 167 + else if (!xen_pv_domain()) 168 168 map->host_addr = __pa(addr); 169 169 else 170 170 map->host_addr = addr; ··· 181 181 { 182 182 if (flags & GNTMAP_contains_pte) 183 183 unmap->host_addr = addr; 184 - else if (xen_feature(XENFEAT_auto_translated_physmap)) 184 + else if (!xen_pv_domain()) 185 185 unmap->host_addr = __pa(addr); 186 186 else 187 187 unmap->host_addr = addr;
+2 -2
include/xen/mem-reservation.h
··· 39 39 xen_pfn_t *frames) 40 40 { 41 41 #ifdef CONFIG_XEN_HAVE_PVMMU 42 - if (!xen_feature(XENFEAT_auto_translated_physmap)) 42 + if (xen_pv_domain()) 43 43 __xenmem_reservation_va_mapping_update(count, pages, frames); 44 44 #endif 45 45 } ··· 48 48 struct page **pages) 49 49 { 50 50 #ifdef CONFIG_XEN_HAVE_PVMMU 51 - if (!xen_feature(XENFEAT_auto_translated_physmap)) 51 + if (xen_pv_domain()) 52 52 __xenmem_reservation_va_mapping_reset(count, pages); 53 53 #endif 54 54 }
+4 -3
include/xen/xen-ops.h
··· 6 6 #include <linux/notifier.h> 7 7 #include <linux/efi.h> 8 8 #include <linux/virtio_anchor.h> 9 + #include <xen/xen.h> 9 10 #include <xen/features.h> 10 11 #include <asm/xen/interface.h> 11 12 #include <xen/interface/vcpu.h> ··· 117 116 unsigned int domid, 118 117 struct page **pages) 119 118 { 120 - if (xen_feature(XENFEAT_auto_translated_physmap)) 119 + if (!xen_pv_domain()) 121 120 return xen_xlate_remap_gfn_array(vma, addr, gfn, nr, err_ptr, 122 121 prot, domid, pages); 123 122 ··· 151 150 int nr, int *err_ptr, 152 151 pgprot_t prot, unsigned int domid) 153 152 { 154 - if (xen_feature(XENFEAT_auto_translated_physmap)) 153 + if (!xen_pv_domain()) 155 154 return -EOPNOTSUPP; 156 155 157 156 return xen_remap_pfn(vma, addr, mfn, nr, err_ptr, prot, domid, ··· 176 175 pgprot_t prot, unsigned int domid, 177 176 struct page **pages) 178 177 { 179 - if (xen_feature(XENFEAT_auto_translated_physmap)) 178 + if (!xen_pv_domain()) 180 179 return -EOPNOTSUPP; 181 180 182 181 return xen_remap_pfn(vma, addr, &gfn, nr, NULL, prot, domid, false);
+8 -1
include/xen/xen.h
··· 22 22 #define xen_pvh 0 23 23 #endif 24 24 25 + #ifdef CONFIG_X86 26 + #include <asm/cpufeature.h> 27 + 28 + #define xen_pv_domain() (cpu_feature_enabled(X86_FEATURE_XENPV)) 29 + #else 30 + #define xen_pv_domain() 0 31 + #endif 32 + 25 33 #define xen_domain() (xen_domain_type != XEN_NATIVE) 26 - #define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN) 27 34 #define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN) 28 35 #define xen_pvh_domain() (xen_pvh) 29 36