From 80e28a00ecc9ba45f9f13d1728d699747c2f0703b8d6366c6936eca3bebe644a Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Mon, 17 Sep 2012 15:49:23 +0000 Subject: [PATCH] - Update to Xen 4.2.0 FCS c/s 25844 - unmodified_drivers: handle IRQF_SAMPLE_RANDOM, it was removed in 3.6-rc1 - bnc#778105 - first XEN-PV VM fails to spawn xend: Increase wait time for disk to appear in host bootloader Modified existing xen-domUloader.diff - Disable the snapshot patches. Snapshot only supported the qcow2 image format which was poorly implemented qemu 0.10.2. Snapshot support may be restored in the future when the newer upstream qemu is used by Xen. - bnc#776995 - attaching scsi control luns with pvscsi - xend/pvscsi: fix passing of SCSI control LUNs xen-bug776995-pvscsi-no-devname.patch - xend/pvscsi: fix usage of persistant device names for SCSI devices xen-bug776995-pvscsi-persistent-names.patch - xend/pvscsi: update sysfs parser for Linux 3.0 xen-bug776995-pvscsi-sysfs-parser.patch - Update to Xen 4.2.0 RC3+ c/s 25779 - Update to Xen 4.2.0 RC2+ c/s 25765 OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=199 --- 22998-x86-get_page_from_l1e-retcode.patch | 255 - 22999-x86-mod_l1_entry-retcode.patch | 114 - 23000-x86-mod_l2_entry-retcode.patch | 210 - ...trace_dynamic_tracebuffer_allocation.patch | 406 -- 23074-pfn.h.patch | 146 - ...ntrace_fix_t_info_pages_calculation..patch | 49 - ...lated_numbers_in_calculate_tbuf_size.patch | 30 - ..._since_they_are_not_in_guest_context.patch | 45 - 23094-xentrace_update_comments.patch | 34 - ...entrace_use_consistent_printk_prefix.patch | 111 - 23096-x86-hpet-no-cpumask_lock.patch | 95 - 23099-x86-rwlock-scalability.patch | 298 - 23103-x86-pirq-guest-eoi-check.patch | 27 - 23127-vtd-bios-settings.patch | 208 - ...ct_formula_to_calculate_t_info_pages.patch | 45 - ...entrace_remove_unneeded_debug_printk.patch | 30 - ...u_notifier_call_into_boot-time_init..patch | 39 - 23199-amd-iommu-unmapped-intr-fault.patch | 27 - 23236-svm-decode-assist-invlpg.patch | 121 - ...ck_for_number_of_per-cpu_trace_pages.patch | 69 - 23246-x86-xsave-enable.patch | 24 - 23303-cpufreq-misc.patch | 209 - ...irst_offset_into_calculate_tbuf_size.patch | 72 - ...mostly_because_its_only_written_once.patch | 27 - ..._when_assigning_pointer_value_to_dst.patch | 46 - 23334-amd-fam12+14-vpmu.patch | 40 - 23383-libxc-rm-static-vars.patch | 78 - ...ze_to_something_mfn_offset_can_reach.patch | 61 - ...offset_to_avoid_ouf-of-bounds_access.patch | 52 - ..._the_trace_record_to_individual_mfns.patch | 153 - ...non-contiguous_per-cpu_trace_buffers.patch | 155 - 23462-libxc-cpu-feature.patch | 288 - ...om_mfn_until_m2p_table_is_allocated..patch | 80 - ...hys_mapping_during_page_deallocation.patch | 62 - 23508-vmx-proc-based-ctls-probe.patch | 47 - ...Define_machine_to_phys_mapping_valid.patch | 36 - ...ging_remove_unused_spinlock_in_pager.patch | 199 - 23571-vtd-fault-verbosity.patch | 154 - 23574-x86-dom0-compressed-ELF.patch | 127 - 23575-x86-DMI.patch | 156 - ...page_walk_also_for_early_page_faults.patch | 151 - ...ral_bitop_functions_into_xc_bitops.h.patch | 1023 ---- ...ng_add_xs_handle_to_struct_xenpaging.patch | 79 - 23579-xenpaging_drop_xc.c_remove_ASSERT.patch | 48 - ..._drop_xc.c_remove_xc_platform_info_t.patch | 121 - ...g_drop_xc.c_remove_xc_wait_for_event.patch | 45 - ...move_xc_mem_paging_flush_ioemu_cache.patch | 96 - ....c_move_xc_wait_for_event_or_timeout.patch | 161 - ...-xenpaging_drop_xc.c_remove_xc_files.patch | 182 - ...g_of_pages_to_avoid_full_ring_buffer.patch | 59 - ...t_bounce_p2mt_back_to_the_hypervisor.patch | 49 - 23587-xenpaging_remove_srand_call.patch | 32 - ...ues_from_functions_that_can_not_fail.patch | 78 - ...ng_catch_xc_mem_paging_resume_errors.patch | 34 - ...ging_remove_local_domain_id_variable.patch | 57 - ...move_num_pages_into_xenpaging_struct.patch | 129 - ...rt_paging_in_the_middle_of_gfn_range.patch | 33 - ...s_integer_to_xenpaging_populate_page.patch | 74 - ...lper_function_for_unlinking_pagefile.patch | 53 - ...watch_thread_to_catch_guest_shutdown.patch | 96 - ...g_of_pager_by_sending_SIGTERM-SIGINT.patch | 187 - ...xenpaging_remove_private_mem_event.h.patch | 123 - ...build_after_recent_xenpaging_changes.patch | 30 - 23613-EFI-headers.patch | 2741 --------- 23614-x86_64-EFI-boot.patch | 2579 --------- 23615-x86_64-EFI-runtime.patch | 850 --- 23616-x86_64-EFI-MPS.patch | 158 - ..._Allow_tracing_to_be_enabled_at_boot.patch | 58 - 23676-x86_64-image-map-bounds.patch | 65 - 23697-pygrub-grub2.patch | 39 - ...-xentrace_update___trace_var_comment.patch | 37 - 23723-x86-CMOS-lock.patch | 283 - 23735-guest-dom0-cap.patch | 252 - 23747-mmcfg-base-address.patch | 66 - 23749-mmcfg-reservation.patch | 421 -- 23771-x86-ioapic-clear-pin.patch | 63 - 23772-x86-trampoline.patch | 383 -- 23774-x86_64-EFI-EDD.patch | 370 -- 23782-x86-ioapic-clear-irr.patch | 62 - 23783-ACPI-set-_PDC-bits.patch | 286 - 23800-x86_64-guest-addr-range.patch | 23 - 23804-x86-IPI-counts.patch | 109 - ...d_ref_counting_for_free_requestslots.patch | 144 - ...rk_and_pause_in_mem_event_check_ring.patch | 30 - ..._batch_of_pages_during_final_page-in.patch | 178 - ...omain_pointer_to_mem_event_functions.patch | 405 -- ...gbuffers_for_share_paging_and_access.patch | 868 --- ...mber_of_paged_pages_in_struct_domain.patch | 122 - 23897-x86-mce-offline-again.patch | 69 - ...et_entry_in_p2m_mem_paging_functions.patch | 131 - ..._locking_in_p2m_mem_paging_functions.patch | 157 - ...comment_from_p2m_mem_paging_populate.patch | 35 - 23933-pt-bus2bridge-update.patch | 138 - ...aging_clear_page_content_after_evict.patch | 53 - 23944-pygrub-debug.patch | 73 - ..._vcpu_set_affinitys_second_parameter.patch | 127 - 23953-xenpaging_handle_evict_failures.patch | 232 - 23957-cpufreq-error-paths.patch | 62 - ...eck_p2mt_in_p2m_mem_paging_functions.patch | 68 - ...ng_document_p2m_mem_paging_functions.patch | 158 - ...aging_disallow_paging_in_a_PoD_guest.patch | 58 - 23993-x86-microcode-amd-fix-23871.patch | 53 - 23999-pygrub-grub2.patch | 26 - 24064-pygrub-HybridISO.patch | 72 - ...eue_Double_size_of_x86_shadow_stack..patch | 27 - ...n_pointer_in_p2m_mem_paging_populate.patch | 30 - ...m_event_check_capabilities_only_once.patch | 112 - 24123-x86-cpuidle-quiesce.patch | 66 - 24124-x86-microcode-amd-quiesce.patch | 63 - ...aging_munmap_all_pages_after_page-in.patch | 33 - 24153-x86-emul-feature-checks.patch | 109 - ...llocate_whole_page_for_shadow_stack..patch | 68 - ...main-vcpu_pause_count_info_to_d_key..patch | 53 - ...-stack_overflow_and_crash_the_guest..patch | 68 - ...it_so_that_vcpu_is_definitely_on_the.patch | 49 - ...er-cpu_stacks_we_must_wake_up_on_teh.patch | 78 - ...npaging_remove_filename_from_comment.patch | 47 - ...move_obsolete_comment_in_resume_path.patch | 31 - ...-xenpaging_use_PERROR_to_print_errno.patch | 285 - 24211-xenpaging_simplify_file_op.patch | 91 - ...-xenpaging_print_gfn_in_failure_case.patch | 100 - 24213-xenpaging_update_xenpaging_init.patch | 78 - ...ng_remove_xc_dominfo_t_from_paging_t.patch | 145 - ..._track_the_number_of_paged-out_pages.patch | 58 - ...-resume_loops_into_its_own_function..patch | 172 - ...aging_improve_mainloop_exit_handling.patch | 53 - 24218-libxc_add_bitmap_clear_function.patch | 39 - 24219-xenpaging_retry_unpageable_gfns.patch | 55 - ...0-xenpaging_install_into_LIBEXEC_dir.patch | 33 - ...AGING_DIR_-_libxl_xenpaging_dir_path.patch | 58 - ...e_guests_tot_pages_as_working_target.patch | 192 - ...mory-target-tot_pages_xenstore_value.patch | 125 - ...ging_add_cmdline_interface_for_pager.patch | 273 - ...ing_improve_policy_mru_list_handling.patch | 127 - ..._debug_to_show_received_watch_event..patch | 27 - ...paging_restrict_pagefile_permissions.patch | 28 - ...aitqueue_Implement_wake_up_nroneall..patch | 69 - ...eference_to_a_domain_on_a_waitqueue..patch | 72 - ...em_event_domain_out_of_struct_domain.patch | 252 - ...e_d-mem_event_on_domain_destruction..patch | 27 - ...hys_mapping_during_page_deallocation.patch | 50 - 24275-x86-emul-lzcnt.patch | 90 - 24277-x86-dom0-features.patch | 58 - 24278-x86-dom0-no-PCID.patch | 49 - ...uring_foreign_mapping_of_paged_pages.patch | 105 - ...mediate_fill-in_of_the_page_contents.patch | 149 - ...in_page_oud_page_contents_on_prepare.patch | 86 - ...on-racy_xc_mem_paging_load_interface.patch | 100 - 24359-x86-domU-features.patch | 94 - 24360-x86-pv-domU-no-PCID.patch | 39 - 24391-x86-pcpu-version.patch | 155 - 24401-pygrub-scrolling.patch | 87 - 24402-pygrub-edit-fix.patch | 29 - 24459-libxl-vifname.patch | 30 - ...apping_pages_when_ENOENT_is_returned.patch | 34 - ...lag_to_xenstore_for_XS_RESET_WATCHES.patch | 45 - ...error_handling_in_xc_mem_paging_load.patch | 62 - ...Properly_account_for_paged_out_pages.patch | 33 - ...ux_privcmd_map_foreign_bulk_properly.patch | 44 - ...npaging_make_file_op_largefile_aware.patch | 39 - 24706-pygrub-extlinux.patch | 29 - 24780-x86-paging-use-clear_guest.patch | 396 -- 24781-x86-vmce-mcg_ctl.patch | 98 - 24805-x86-MSI-X-dom0-ro.patch | 32 - 24886-x86-vmce-mcg_ctl-default.patch | 49 - 24887-x86-vmce-sr.patch | 583 -- 25041-tapdisk2-create-init-name.patch | 23 - 25196-x86-HAP-PAT-sr.patch | 236 - 25247-SVM-no-rdtsc-intercept.patch | 39 - 25267-x86-text-unlikely.patch | 24 - 25269-x86-vMCE-addr-misc-write.patch | 101 - 25382-x86-masked-MCE-masking-NMI.patch | 73 - 25387-amd-iommu-workaround-73x.patch | 79 - 25430-x86-AMD-Fam15-reenable-topoext.patch | 48 - 25431-x86-EDD-MBR-sig-check.patch | 30 - 25459-page-list-splice.patch | 33 - 25479-x86-boot-trampoline-remove.patch | 463 -- 25485-x86_64-canonical-checks.patch | 78 - 25589-pygrub-size-limits.patch | 114 - 25616-x86-MCi_CTL-default.patch | 125 - 32on64-extra-mem.patch | 8 +- altgr_2.patch | 6 +- bdrv_default_rwflag.patch | 12 +- bdrv_open2_fix_flags.patch | 18 +- bdrv_open2_flags_2.patch | 33 +- blktap-close-fifos.patch | 8 +- blktap-disable-debug-printf.patch | 16 +- blktap-pv-cdrom.patch | 68 +- blktap.patch | 14 +- blktapctrl-default-to-ioemu.patch | 6 +- bridge-bonding.diff | 10 +- bridge-opensuse.patch | 8 +- bridge-record-creation.patch | 10 +- bridge-vlan.diff | 16 +- build-tapdisk-ioemu.patch | 24 +- capslock_enable.patch | 6 +- cdrom-removable.patch | 20 +- change-vnc-passwd.patch | 52 +- change_home_server.patch | 8 +- check_device_status.patch | 6 +- checkpoint-rename.patch | 6 +- cve-2012-0029-qemu-xen-unstable.patch | 21 + del_usb_xend_entry.patch | 8 +- disable-xl-when-using-xend.patch | 70 - disable_emulated_device.diff | 6 +- dom-print.patch | 8 +- domu-usb-controller.patch | 8 +- hibernate.patch | 42 +- hotplug.losetup.patch | 34 - hv_extid_compatibility.patch | 24 +- init.xendomains | 8 +- ...7615-qcow2-fix-alloc_cluster_link_l2.patch | 6 +- ioemu-9868-MSI-X.patch | 247 - ioemu-9869-MSI-X-init.patch | 53 - ioemu-9873-MSI-X-fix-unregister_iomem.patch | 57 - ioemu-9877-MSI-X-device-cleanup.patch | 73 - ioemu-bdrv-open-CACHE_WB.patch | 8 +- ioemu-blktap-barriers.patch | 6 +- ioemu-blktap-fv-init.patch | 10 +- ioemu-blktap-image-format.patch | 18 +- ioemu-blktap-zero-size.patch | 16 +- ioemu-debuginfo.patch | 12 +- ioemu-disable-emulated-ide-if-pv.patch | 26 +- ioemu-disable-scsi.patch | 20 +- ioemu-vnc-resize.patch | 6 +- ioemu-watchdog-ib700-timer.patch | 6 +- ioemu-watchdog-linkage.patch | 18 +- ioemu-watchdog-support.patch | 50 +- ipxe-enable-nics.patch | 16 +- ipxe-gcc45-warnings.patch | 16 +- ipxe-ipv4-fragment.patch | 89 +- ipxe.tar.bz2 | 3 + kernel-boot-hvm.patch | 24 +- libxen_permissive.patch | 6 +- log-guest-console.patch | 6 +- magic_ioport_compat.patch | 6 +- minios-fixups.patch | 8 +- multi-xvdp.patch | 8 +- network-nat-open-SuSEfirewall2-FORWARD.patch | 6 +- network-nat.patch | 6 +- pv-driver-build.patch | 9 + pvdrv-import-shared-info.patch | 18 +- pvdrv_emulation_control.patch | 6 +- qemu-dm-segfault.patch | 6 +- qemu-security-etch1.diff | 12 +- qemu-xen-dir-remote.tar.bz2 | 3 + qemu-xen-traditional-dir-remote.tar.bz2 | 3 + seabios-dir-remote.tar.bz2 | 3 + serial-split.patch | 8 +- snapshot-ioemu-delete.patch | 75 - snapshot-ioemu-restore.patch | 72 - snapshot-ioemu-save.patch | 251 - snapshot-without-pv-fix.patch | 394 -- snapshot-xend.patch | 728 --- stdvga-cache.patch | 6 +- stubdom.tar.bz2 | 4 +- supported_module.diff | 4 +- suspend_evtchn_lock.patch | 6 +- tapdisk-ioemu-logfile.patch | 6 +- tapdisk-ioemu-shutdown-fix.patch | 14 +- tmp-initscript-modprobe.patch | 49 +- tmp_build.patch | 14 +- tools-kboot.diff | 2171 ------- tools-watchdog-support.patch | 121 +- tools-xc_kexec.diff | 5124 ----------------- udev-rules.patch | 10 +- usb-list.patch | 6 +- vif-bridge-no-iptables.patch | 10 +- vif-bridge-tap-fix.patch | 6 +- vif-bridge.mtu.patch | 33 - vif-route-ifup.patch | 16 +- x86-cpufreq-report.patch | 41 +- x86-extra-trap-info.patch | 16 +- x86-ioapic-ack-default.patch | 24 +- x86_64-allow-unsafe-adjust.patch | 86 - xen-4.1.3-testing-src.tar.bz2 | 3 - xen-4.2.0-testing-src.tar.bz2 | 3 + xen-api-auth.patch | 6 +- xen-bug776995-pvscsi-no-devname.patch | 36 + xen-bug776995-pvscsi-persistent-names.patch | 39 + xen-bug776995-pvscsi-sysfs-parser.patch | 81 + xen-changeset.diff | 10 +- xen-config.diff | 92 - xen-cpupool-xl-config-format.patch | 6 +- xen-destdir.diff | 135 +- xen-disable-qemu-monitor.diff | 6 +- xen-domUloader.diff | 24 +- xen-fixme-doc.diff | 34 +- xen-hvm-default-bridge.diff | 30 +- xen-hvm-default-pae.diff | 8 +- xen-ioemu-hvm-pv-support.diff | 6 +- xen-max-free-mem.diff | 24 +- xen-minimum-restart-time.patch | 8 +- xen-no-dummy-nfs-ip.diff | 8 +- xen-paths.diff | 22 +- xen-qemu-iscsi-fix.patch | 18 +- xen-rpmoptflags.diff | 20 +- ...privcmd_map_foreign_bulk.retry_paged.patch | 110 - xen-utils-0.1.tar.bz2 | 4 +- xen-warnings-unused.diff | 478 +- xen-warnings.diff | 105 +- xen-xm-top-needs-root.diff | 6 +- xen-xmexample-vti.diff | 10 +- xen-xmexample.diff | 56 +- xen.changes | 47 + xen.no-default-runlevel-4.patch | 64 +- ...ate311487.xen_platform_pci.dmistring.patch | 6 +- xen.spec | 622 +- xenalyze.gcc46.patch | 6 +- xenapi-console-protocol.patch | 8 +- xencommons-proc-xen.patch | 43 +- xenconsole-no-multiple-connections.patch | 6 +- xend-config-enable-dump-comment.patch | 6 +- xend-config.diff | 23 +- xend-console-port-restore.patch | 24 +- xend-core-dump-loc.diff | 6 +- xend-cpuid.patch | 8 +- xend-devid-or-name.patch | 6 +- xend-disable-internal-logrotate.patch | 6 +- xend-domain-lock-sfex.patch | 48 +- xend-domain-lock.patch | 62 +- xend-migration-domname-fix.patch | 12 +- xend-sysconfig.patch | 14 +- xend-vcpu-affinity-fix.patch | 8 +- xenpaging.autostart.patch | 413 -- xenpaging.doc.patch | 92 - xenpaging.error-handling.patch | 189 - xenpaging.evict_fail_fast_forward.patch | 59 - xenpaging.evict_mmap_readonly.patch | 20 - xenpaging.guest-memusage.patch | 80 - xenpaging.mem_event-use-wait_queue.patch | 571 -- xenpaging.mmap-before-nominate.patch | 120 - xenpaging.p2m_is_paged.patch | 363 -- xenpaging.qemu.flush-cache.patch | 31 - xenpaging.speedup-page-in.gfn_to_slot.patch | 85 - ...page-out.evict_pages.free_slot_stack.patch | 69 - xenpaging.speedup-page-out.patch | 89 - ...peedup-page-out.policy_choose_victim.patch | 83 - ...e-out.resume_pages.find_next_bit_set.patch | 23 - xenpaging.versioned-interface.patch | 87 - xenpaging.waitqueue-paging.patch | 397 -- xenstored.XS_RESET_WATCHES.patch | 115 - xl-create-pv-with-qcow2-img.patch | 234 - xm-create-maxmem.patch | 6 +- xm-create-xflag.patch | 22 +- xm-save-check-file.patch | 18 +- xm-test-cleanup.diff | 14 - 347 files changed, 1552 insertions(+), 41499 deletions(-) delete mode 100644 22998-x86-get_page_from_l1e-retcode.patch delete mode 100644 22999-x86-mod_l1_entry-retcode.patch delete mode 100644 23000-x86-mod_l2_entry-retcode.patch delete mode 100644 23050-xentrace_dynamic_tracebuffer_allocation.patch delete mode 100644 23074-pfn.h.patch delete mode 100644 23091-xentrace_fix_t_info_pages_calculation..patch delete mode 100644 23092-xentrace_print_calculated_numbers_in_calculate_tbuf_size.patch delete mode 100644 23093-xentrace_remove_gdprintk_usage_since_they_are_not_in_guest_context.patch delete mode 100644 23094-xentrace_update_comments.patch delete mode 100644 23095-xentrace_use_consistent_printk_prefix.patch delete mode 100644 23096-x86-hpet-no-cpumask_lock.patch delete mode 100644 23099-x86-rwlock-scalability.patch delete mode 100644 23103-x86-pirq-guest-eoi-check.patch delete mode 100644 23127-vtd-bios-settings.patch delete mode 100644 23128-xentrace_correct_formula_to_calculate_t_info_pages.patch delete mode 100644 23129-xentrace_remove_unneeded_debug_printk.patch delete mode 100644 23173-xentrace_Move_register_cpu_notifier_call_into_boot-time_init..patch delete mode 100644 23199-amd-iommu-unmapped-intr-fault.patch delete mode 100644 23236-svm-decode-assist-invlpg.patch delete mode 100644 23239-xentrace_correct_overflow_check_for_number_of_per-cpu_trace_pages.patch delete mode 100644 23246-x86-xsave-enable.patch delete mode 100644 23303-cpufreq-misc.patch delete mode 100644 23308-xentrace_Move_the_global_variable_t_info_first_offset_into_calculate_tbuf_size.patch delete mode 100644 23309-xentrace_Mark_data_size___read_mostly_because_its_only_written_once.patch delete mode 100644 23310-xentrace_Remove_unneeded_cast_when_assigning_pointer_value_to_dst.patch delete mode 100644 23334-amd-fam12+14-vpmu.patch delete mode 100644 23383-libxc-rm-static-vars.patch delete mode 100644 23404-xentrace_reduce_trace_buffer_size_to_something_mfn_offset_can_reach.patch delete mode 100644 23405-xentrace_fix_type_of_offset_to_avoid_ouf-of-bounds_access.patch delete mode 100644 23406-xentrace_update___insert_record_to_copy_the_trace_record_to_individual_mfns.patch delete mode 100644 23407-xentrace_allocate_non-contiguous_per-cpu_trace_buffers.patch delete mode 100644 23462-libxc-cpu-feature.patch delete mode 100644 23506-x86_Disable_set_gpfn_from_mfn_until_m2p_table_is_allocated..patch delete mode 100644 23507-xenpaging_update_machine_to_phys_mapping_during_page_deallocation.patch delete mode 100644 23508-vmx-proc-based-ctls-probe.patch delete mode 100644 23509-x86_32_Fix_build_Define_machine_to_phys_mapping_valid.patch delete mode 100644 23562-xenpaging_remove_unused_spinlock_in_pager.patch delete mode 100644 23571-vtd-fault-verbosity.patch delete mode 100644 23574-x86-dom0-compressed-ELF.patch delete mode 100644 23575-x86-DMI.patch delete mode 100644 23576-x86_show_page_walk_also_for_early_page_faults.patch delete mode 100644 23577-tools_merge_several_bitop_functions_into_xc_bitops.h.patch delete mode 100644 23578-xenpaging_add_xs_handle_to_struct_xenpaging.patch delete mode 100644 23579-xenpaging_drop_xc.c_remove_ASSERT.patch delete mode 100644 23580-xenpaging_drop_xc.c_remove_xc_platform_info_t.patch delete mode 100644 23581-xenpaging_drop_xc.c_remove_xc_wait_for_event.patch delete mode 100644 23582-xenpaging_drop_xc.c_move_xc_mem_paging_flush_ioemu_cache.patch delete mode 100644 23583-xenpaging_drop_xc.c_move_xc_wait_for_event_or_timeout.patch delete mode 100644 23584-xenpaging_drop_xc.c_remove_xc_files.patch delete mode 100644 23585-xenpaging_correct_dropping_of_pages_to_avoid_full_ring_buffer.patch delete mode 100644 23586-xenpaging_do_not_bounce_p2mt_back_to_the_hypervisor.patch delete mode 100644 23587-xenpaging_remove_srand_call.patch delete mode 100644 23588-xenpaging_remove_return_values_from_functions_that_can_not_fail.patch delete mode 100644 23589-xenpaging_catch_xc_mem_paging_resume_errors.patch delete mode 100644 23590-xenpaging_remove_local_domain_id_variable.patch delete mode 100644 23591-xenpaging_move_num_pages_into_xenpaging_struct.patch delete mode 100644 23592-xenpaging_start_paging_in_the_middle_of_gfn_range.patch delete mode 100644 23593-xenpaging_pass_integer_to_xenpaging_populate_page.patch delete mode 100644 23594-xenpaging_add_helper_function_for_unlinking_pagefile.patch delete mode 100644 23595-xenpaging_add_watch_thread_to_catch_guest_shutdown.patch delete mode 100644 23596-xenpaging_implement_stopping_of_pager_by_sending_SIGTERM-SIGINT.patch delete mode 100644 23597-xenpaging_remove_private_mem_event.h.patch delete mode 100644 23599-tools_fix_build_after_recent_xenpaging_changes.patch delete mode 100644 23613-EFI-headers.patch delete mode 100644 23614-x86_64-EFI-boot.patch delete mode 100644 23615-x86_64-EFI-runtime.patch delete mode 100644 23616-x86_64-EFI-MPS.patch delete mode 100644 23643-xentrace_Allow_tracing_to_be_enabled_at_boot.patch delete mode 100644 23676-x86_64-image-map-bounds.patch delete mode 100644 23697-pygrub-grub2.patch delete mode 100644 23719-xentrace_update___trace_var_comment.patch delete mode 100644 23723-x86-CMOS-lock.patch delete mode 100644 23735-guest-dom0-cap.patch delete mode 100644 23747-mmcfg-base-address.patch delete mode 100644 23749-mmcfg-reservation.patch delete mode 100644 23771-x86-ioapic-clear-pin.patch delete mode 100644 23772-x86-trampoline.patch delete mode 100644 23774-x86_64-EFI-EDD.patch delete mode 100644 23782-x86-ioapic-clear-irr.patch delete mode 100644 23783-ACPI-set-_PDC-bits.patch delete mode 100644 23800-x86_64-guest-addr-range.patch delete mode 100644 23804-x86-IPI-counts.patch delete mode 100644 23817-mem_event_add_ref_counting_for_free_requestslots.patch delete mode 100644 23818-mem_event_use_mem_event_mark_and_pause_in_mem_event_check_ring.patch delete mode 100644 23827-xenpaging_use_batch_of_pages_during_final_page-in.patch delete mode 100644 23841-mem_event_pass_mem_event_domain_pointer_to_mem_event_functions.patch delete mode 100644 23842-mem_event_use_different_ringbuffers_for_share_paging_and_access.patch delete mode 100644 23874-xenpaging_track_number_of_paged_pages_in_struct_domain.patch delete mode 100644 23897-x86-mce-offline-again.patch delete mode 100644 23904-xenpaging_use_p2m-get_entry_in_p2m_mem_paging_functions.patch delete mode 100644 23905-xenpaging_fix_locking_in_p2m_mem_paging_functions.patch delete mode 100644 23906-xenpaging_remove_confusing_comment_from_p2m_mem_paging_populate.patch delete mode 100644 23933-pt-bus2bridge-update.patch delete mode 100644 23943-xenpaging_clear_page_content_after_evict.patch delete mode 100644 23944-pygrub-debug.patch delete mode 100644 23949-constify_vcpu_set_affinitys_second_parameter.patch delete mode 100644 23953-xenpaging_handle_evict_failures.patch delete mode 100644 23957-cpufreq-error-paths.patch delete mode 100644 23978-xenpaging_check_p2mt_in_p2m_mem_paging_functions.patch delete mode 100644 23979-xenpaging_document_p2m_mem_paging_functions.patch delete mode 100644 23980-xenpaging_disallow_paging_in_a_PoD_guest.patch delete mode 100644 23993-x86-microcode-amd-fix-23871.patch delete mode 100644 23999-pygrub-grub2.patch delete mode 100644 24064-pygrub-HybridISO.patch delete mode 100644 24104-waitqueue_Double_size_of_x86_shadow_stack..patch delete mode 100644 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch delete mode 100644 24106-mem_event_check_capabilities_only_once.patch delete mode 100644 24123-x86-cpuidle-quiesce.patch delete mode 100644 24124-x86-microcode-amd-quiesce.patch delete mode 100644 24138-xenpaging_munmap_all_pages_after_page-in.patch delete mode 100644 24153-x86-emul-feature-checks.patch delete mode 100644 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch delete mode 100644 24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch delete mode 100644 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch delete mode 100644 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch delete mode 100644 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch delete mode 100644 24208-xenpaging_remove_filename_from_comment.patch delete mode 100644 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch delete mode 100644 24210-xenpaging_use_PERROR_to_print_errno.patch delete mode 100644 24211-xenpaging_simplify_file_op.patch delete mode 100644 24212-xenpaging_print_gfn_in_failure_case.patch delete mode 100644 24213-xenpaging_update_xenpaging_init.patch delete mode 100644 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch delete mode 100644 24215-xenpaging_track_the_number_of_paged-out_pages.patch delete mode 100644 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch delete mode 100644 24217-xenpaging_improve_mainloop_exit_handling.patch delete mode 100644 24218-libxc_add_bitmap_clear_function.patch delete mode 100644 24219-xenpaging_retry_unpageable_gfns.patch delete mode 100644 24220-xenpaging_install_into_LIBEXEC_dir.patch delete mode 100644 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch delete mode 100644 24222-xenpaging_use_guests_tot_pages_as_working_target.patch delete mode 100644 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch delete mode 100644 24224-xenpaging_add_cmdline_interface_for_pager.patch delete mode 100644 24225-xenpaging_improve_policy_mru_list_handling.patch delete mode 100644 24226-xenpaging_add_debug_to_show_received_watch_event..patch delete mode 100644 24227-xenpaging_restrict_pagefile_permissions.patch delete mode 100644 24231-waitqueue_Implement_wake_up_nroneall..patch delete mode 100644 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch delete mode 100644 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch delete mode 100644 24270-Free_d-mem_event_on_domain_destruction..patch delete mode 100644 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch delete mode 100644 24275-x86-emul-lzcnt.patch delete mode 100644 24277-x86-dom0-features.patch delete mode 100644 24278-x86-dom0-no-PCID.patch delete mode 100644 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch delete mode 100644 24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch delete mode 100644 24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch delete mode 100644 24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch delete mode 100644 24359-x86-domU-features.patch delete mode 100644 24360-x86-pv-domU-no-PCID.patch delete mode 100644 24391-x86-pcpu-version.patch delete mode 100644 24401-pygrub-scrolling.patch delete mode 100644 24402-pygrub-edit-fix.patch delete mode 100644 24459-libxl-vifname.patch delete mode 100644 24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch delete mode 100644 24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch delete mode 100644 24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch delete mode 100644 24586-x86-mm_Properly_account_for_paged_out_pages.patch delete mode 100644 24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch delete mode 100644 24610-xenpaging_make_file_op_largefile_aware.patch delete mode 100644 24706-pygrub-extlinux.patch delete mode 100644 24780-x86-paging-use-clear_guest.patch delete mode 100644 24781-x86-vmce-mcg_ctl.patch delete mode 100644 24805-x86-MSI-X-dom0-ro.patch delete mode 100644 24886-x86-vmce-mcg_ctl-default.patch delete mode 100644 24887-x86-vmce-sr.patch delete mode 100644 25041-tapdisk2-create-init-name.patch delete mode 100644 25196-x86-HAP-PAT-sr.patch delete mode 100644 25247-SVM-no-rdtsc-intercept.patch delete mode 100644 25267-x86-text-unlikely.patch delete mode 100644 25269-x86-vMCE-addr-misc-write.patch delete mode 100644 25382-x86-masked-MCE-masking-NMI.patch delete mode 100644 25387-amd-iommu-workaround-73x.patch delete mode 100644 25430-x86-AMD-Fam15-reenable-topoext.patch delete mode 100644 25431-x86-EDD-MBR-sig-check.patch delete mode 100644 25459-page-list-splice.patch delete mode 100644 25479-x86-boot-trampoline-remove.patch delete mode 100644 25485-x86_64-canonical-checks.patch delete mode 100644 25589-pygrub-size-limits.patch delete mode 100644 25616-x86-MCi_CTL-default.patch create mode 100644 cve-2012-0029-qemu-xen-unstable.patch delete mode 100644 disable-xl-when-using-xend.patch delete mode 100644 hotplug.losetup.patch delete mode 100644 ioemu-9868-MSI-X.patch delete mode 100644 ioemu-9869-MSI-X-init.patch delete mode 100644 ioemu-9873-MSI-X-fix-unregister_iomem.patch delete mode 100644 ioemu-9877-MSI-X-device-cleanup.patch create mode 100644 ipxe.tar.bz2 create mode 100644 pv-driver-build.patch create mode 100644 qemu-xen-dir-remote.tar.bz2 create mode 100644 qemu-xen-traditional-dir-remote.tar.bz2 create mode 100644 seabios-dir-remote.tar.bz2 delete mode 100644 snapshot-ioemu-delete.patch delete mode 100644 snapshot-ioemu-restore.patch delete mode 100644 snapshot-ioemu-save.patch delete mode 100644 snapshot-without-pv-fix.patch delete mode 100644 snapshot-xend.patch delete mode 100644 tools-kboot.diff delete mode 100644 tools-xc_kexec.diff delete mode 100644 vif-bridge.mtu.patch delete mode 100644 x86_64-allow-unsafe-adjust.patch delete mode 100644 xen-4.1.3-testing-src.tar.bz2 create mode 100644 xen-4.2.0-testing-src.tar.bz2 create mode 100644 xen-bug776995-pvscsi-no-devname.patch create mode 100644 xen-bug776995-pvscsi-persistent-names.patch create mode 100644 xen-bug776995-pvscsi-sysfs-parser.patch delete mode 100644 xen-config.diff delete mode 100644 xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch delete mode 100644 xenpaging.autostart.patch delete mode 100644 xenpaging.doc.patch delete mode 100644 xenpaging.error-handling.patch delete mode 100644 xenpaging.evict_fail_fast_forward.patch delete mode 100644 xenpaging.evict_mmap_readonly.patch delete mode 100644 xenpaging.guest-memusage.patch delete mode 100644 xenpaging.mem_event-use-wait_queue.patch delete mode 100644 xenpaging.mmap-before-nominate.patch delete mode 100644 xenpaging.p2m_is_paged.patch delete mode 100644 xenpaging.qemu.flush-cache.patch delete mode 100644 xenpaging.speedup-page-in.gfn_to_slot.patch delete mode 100644 xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch delete mode 100644 xenpaging.speedup-page-out.patch delete mode 100644 xenpaging.speedup-page-out.policy_choose_victim.patch delete mode 100644 xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch delete mode 100644 xenpaging.versioned-interface.patch delete mode 100644 xenpaging.waitqueue-paging.patch delete mode 100644 xenstored.XS_RESET_WATCHES.patch delete mode 100644 xl-create-pv-with-qcow2-img.patch delete mode 100644 xm-test-cleanup.diff diff --git a/22998-x86-get_page_from_l1e-retcode.patch b/22998-x86-get_page_from_l1e-retcode.patch deleted file mode 100644 index b5a797c..0000000 --- a/22998-x86-get_page_from_l1e-retcode.patch +++ /dev/null @@ -1,255 +0,0 @@ -References: bnc#675363 - -# HG changeset patch -# User Keir Fraser -# Date 1299687371 0 -# Node ID e9fab50d7b61d151d51a4b1088930c9e1ca2da47 -# Parent 5f28dcea13555f7ab948c9cb95de3e79e0fbfc4b -x86: make get_page_from_l1e() return a proper error code - -... so that the guest can actually know the reason for the (hypercall) -failure. - -ptwr_do_page_fault() could propagate the error indicator received from -get_page_from_l1e() back to the guest in the high half of the error -code (entry_vector), provided we're sure all existing guests can deal -with that (or indicate so by means of a to-be-added guest feature -flag). Alternatively, a second virtual status register (like CR2) -could be introduced. - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1340271059 -7200 -# Node ID baa85434d0ec16629ca30b7c07deaa9beb3ea9c5 -# Parent d4cdcf4d541cc4ce72c48df2e26c2b506c5b04bd -x86/mm: fix mod_l1_entry() return value when encountering r/o MMIO page - -While putting together the workaround announced in -http://lists.xen.org/archives/html/xen-devel/2012-06/msg00709.html, I -found that mod_l1_entry(), upon encountering a set bit in -mmio_ro_ranges, would return 1 instead of 0 (the removal of the write -permission is supposed to be entirely transparent to the caller, even -more so to the calling guest). - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/mm/shadow/multi.c -+++ b/xen/arch/x86/mm/shadow/multi.c -@@ -872,7 +872,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl - // If a privileged domain is attempting to install a map of a page it does - // not own, we let it succeed anyway. - // -- if ( unlikely(!res) && -+ if ( unlikely(res < 0) && - !shadow_mode_translate(d) && - mfn_valid(mfn = shadow_l1e_get_mfn(sl1e)) && - (owner = page_get_owner(mfn_to_page(mfn))) && -@@ -883,11 +883,11 @@ shadow_get_page_from_l1e(shadow_l1e_t sl - SHADOW_PRINTK("privileged domain %d installs map of mfn %05lx " - "which is owned by domain %d: %s\n", - d->domain_id, mfn_x(mfn), owner->domain_id, -- res ? "success" : "failed"); -+ res >= 0 ? "success" : "failed"); - } - - /* Okay, it might still be a grant mapping PTE. Try it. */ -- if ( unlikely(!res) && -+ if ( unlikely(res < 0) && - (type == p2m_grant_map_rw || - (type == p2m_grant_map_ro && - !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) ) -@@ -900,7 +900,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl - res = get_page_from_l1e(sl1e, d, page_get_owner(mfn_to_page(mfn))); - } - -- if ( unlikely(!res) ) -+ if ( unlikely(res < 0) ) - { - perfc_incr(shadow_get_page_fail); - SHADOW_PRINTK("failed: l1e=" SH_PRI_pte "\n"); -@@ -1229,15 +1229,15 @@ static int shadow_set_l1e(struct vcpu *v - TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_GET_REF); - switch ( shadow_get_page_from_l1e(new_sl1e, d, new_type) ) - { -- case 0: -+ default: - /* Doesn't look like a pagetable. */ - flags |= SHADOW_SET_ERROR; - new_sl1e = shadow_l1e_empty(); - break; -- case -1: -+ case 1: - shadow_l1e_remove_flags(new_sl1e, _PAGE_RW); - /* fall through */ -- default: -+ case 0: - shadow_vram_get_l1e(new_sl1e, sl1e, sl1mfn, d); - break; - } ---- a/xen/arch/x86/mm.c -+++ b/xen/arch/x86/mm.c -@@ -800,12 +800,12 @@ get_page_from_l1e( - bool_t write; - - if ( !(l1f & _PAGE_PRESENT) ) -- return 1; -+ return 0; - - if ( unlikely(l1f & l1_disallow_mask(l1e_owner)) ) - { - MEM_LOG("Bad L1 flags %x", l1f & l1_disallow_mask(l1e_owner)); -- return 0; -+ return -EINVAL; - } - - if ( !mfn_valid(mfn) || -@@ -822,18 +822,21 @@ get_page_from_l1e( - if ( !iomem_access_permitted(pg_owner, mfn, mfn) ) - { - if ( mfn != (PADDR_MASK >> PAGE_SHIFT) ) /* INVALID_MFN? */ -+ { - MEM_LOG("Non-privileged (%u) attempt to map I/O space %08lx", - pg_owner->domain_id, mfn); -- return 0; -+ return -EPERM; -+ } -+ return -EINVAL; - } - - if ( !(l1f & _PAGE_RW) || IS_PRIV(pg_owner) || - !rangeset_contains_singleton(mmio_ro_ranges, mfn) ) -- return 1; -+ return 0; - dprintk(XENLOG_G_WARNING, - "d%d: Forcing read-only access to MFN %lx\n", - l1e_owner->domain_id, mfn); -- return -1; -+ return 1; - } - - if ( unlikely(real_pg_owner != pg_owner) ) -@@ -864,6 +867,7 @@ get_page_from_l1e( - { - unsigned long x, nx, y = page->count_info; - unsigned long cacheattr = pte_flags_to_cacheattr(l1f); -+ int err; - - if ( is_xen_heap_page(page) ) - { -@@ -871,7 +875,7 @@ get_page_from_l1e( - put_page_type(page); - put_page(page); - MEM_LOG("Attempt to change cache attributes of Xen heap page"); -- return 0; -+ return -EACCES; - } - - do { -@@ -879,7 +883,8 @@ get_page_from_l1e( - nx = (x & ~PGC_cacheattr_mask) | (cacheattr << PGC_cacheattr_base); - } while ( (y = cmpxchg(&page->count_info, x, nx)) != x ); - -- if ( unlikely(update_xen_mappings(mfn, cacheattr) != 0) ) -+ err = update_xen_mappings(mfn, cacheattr); -+ if ( unlikely(err) ) - { - cacheattr = y & PGC_cacheattr_mask; - do { -@@ -895,11 +900,11 @@ get_page_from_l1e( - " from L1 entry %" PRIpte ") for %d", - mfn, get_gpfn_from_mfn(mfn), - l1e_get_intpte(l1e), l1e_owner->domain_id); -- return 0; -+ return err; - } - } - -- return 1; -+ return 0; - - could_not_pin: - MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte -@@ -908,7 +913,7 @@ get_page_from_l1e( - l1e_get_intpte(l1e), l1e_owner->domain_id, pg_owner->domain_id); - if ( real_pg_owner != NULL ) - put_page(page); -- return 0; -+ return -EBUSY; - } - - -@@ -1198,17 +1203,20 @@ static int alloc_l1_table(struct page_in - unsigned long pfn = page_to_mfn(page); - l1_pgentry_t *pl1e; - unsigned int i; -+ int ret = 0; - - pl1e = map_domain_page(pfn); - - for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ ) - { - if ( is_guest_l1_slot(i) ) -- switch ( get_page_from_l1e(pl1e[i], d, d) ) -+ switch ( ret = get_page_from_l1e(pl1e[i], d, d) ) - { -- case 0: -+ default: - goto fail; -- case -1: -+ case 0: -+ break; -+ case 1: - l1e_remove_flags(pl1e[i], _PAGE_RW); - break; - } -@@ -1226,7 +1234,7 @@ static int alloc_l1_table(struct page_in - put_page_from_l1e(pl1e[i], d); - - unmap_domain_page(pl1e); -- return -EINVAL; -+ return ret; - } - - static int create_pae_xen_mappings(struct domain *d, l3_pgentry_t *pl3e) -@@ -1795,12 +1803,15 @@ static int mod_l1_entry(l1_pgentry_t *pl - return rc; - } - -- switch ( get_page_from_l1e(nl1e, pt_dom, pg_dom) ) -+ switch ( rc = get_page_from_l1e(nl1e, pt_dom, pg_dom) ) - { -- case 0: -+ default: - return 0; -- case -1: -+ case 0: -+ break; -+ case 1: - l1e_remove_flags(nl1e, _PAGE_RW); -+ rc = 0; - break; - } - -@@ -4976,7 +4987,7 @@ static int ptwr_emulated_update( - nl1e = l1e_from_intpte(val); - switch ( get_page_from_l1e(nl1e, d, d) ) - { -- case 0: -+ default: - if ( is_pv_32bit_domain(d) && (bytes == 4) && (unaligned_addr & 4) && - !do_cmpxchg && (l1e_get_flags(nl1e) & _PAGE_PRESENT) ) - { -@@ -4996,7 +5007,9 @@ static int ptwr_emulated_update( - return X86EMUL_UNHANDLEABLE; - } - break; -- case -1: -+ case 0: -+ break; -+ case 1: - l1e_remove_flags(nl1e, _PAGE_RW); - break; - } diff --git a/22999-x86-mod_l1_entry-retcode.patch b/22999-x86-mod_l1_entry-retcode.patch deleted file mode 100644 index a15cb99..0000000 --- a/22999-x86-mod_l1_entry-retcode.patch +++ /dev/null @@ -1,114 +0,0 @@ -References: bnc#675363 - -# HG changeset patch -# User Jan Beulich -# Date 1299687409 0 -# Node ID 82b5f8d12903e140f957ae8d13d66e44be076b05 -# Parent e9fab50d7b61d151d51a4b1088930c9e1ca2da47 -x86: make mod_l1_entry() return a proper error code - -... again is so that the guest can actually know the reason for the -(hypercall) failure. - -Signed-off-by: Jan Beulich - ---- a/xen/arch/x86/mm.c -+++ b/xen/arch/x86/mm.c -@@ -1766,15 +1766,16 @@ static int mod_l1_entry(l1_pgentry_t *pl - struct domain *pt_dom = pt_vcpu->domain; - unsigned long mfn; - p2m_type_t p2mt; -- int rc = 1; -+ int rc = 0; - - if ( unlikely(__copy_from_user(&ol1e, pl1e, sizeof(ol1e)) != 0) ) -- return 0; -+ return -EFAULT; - - if ( unlikely(paging_mode_refcounts(pt_dom)) ) - { -- rc = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu, preserve_ad); -- return rc; -+ if ( UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu, preserve_ad) ) -+ return 0; -+ return -EBUSY; - } - - if ( l1e_get_flags(nl1e) & _PAGE_PRESENT ) -@@ -1783,7 +1784,7 @@ static int mod_l1_entry(l1_pgentry_t *pl - mfn = mfn_x(gfn_to_mfn(p2m_get_hostp2m(pg_dom), - l1e_get_pfn(nl1e), &p2mt)); - if ( !p2m_is_ram(p2mt) || unlikely(mfn == INVALID_MFN) ) -- return 0; -+ return -EINVAL; - ASSERT((mfn & ~(PADDR_MASK >> PAGE_SHIFT)) == 0); - nl1e = l1e_from_pfn(mfn, l1e_get_flags(nl1e)); - -@@ -1791,22 +1792,23 @@ static int mod_l1_entry(l1_pgentry_t *pl - { - MEM_LOG("Bad L1 flags %x", - l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom)); -- return 0; -+ return -EINVAL; - } - - /* Fast path for identical mapping, r/w and presence. */ - if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) ) - { - adjust_guest_l1e(nl1e, pt_dom); -- rc = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu, -- preserve_ad); -- return rc; -+ if ( UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu, -+ preserve_ad) ) -+ return 0; -+ return -EBUSY; - } - - switch ( rc = get_page_from_l1e(nl1e, pt_dom, pg_dom) ) - { - default: -- return 0; -+ return rc; - case 0: - break; - case 1: -@@ -1820,13 +1822,13 @@ static int mod_l1_entry(l1_pgentry_t *pl - preserve_ad)) ) - { - ol1e = nl1e; -- rc = 0; -+ rc = -EBUSY; - } - } - else if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu, - preserve_ad)) ) - { -- return 0; -+ return -EBUSY; - } - - put_page_from_l1e(ol1e, pt_dom); -@@ -3518,9 +3520,10 @@ int do_mmu_update( - } - #endif - -- okay = mod_l1_entry(va, l1e, mfn, -- cmd == MMU_PT_UPDATE_PRESERVE_AD, v, -- pg_owner); -+ rc = mod_l1_entry(va, l1e, mfn, -+ cmd == MMU_PT_UPDATE_PRESERVE_AD, v, -+ pg_owner); -+ okay = !rc; - } - break; - case PGT_l2_page_table: -@@ -4302,7 +4305,7 @@ static int __do_update_va_mapping( - goto out; - } - -- rc = mod_l1_entry(pl1e, val, gl1mfn, 0, v, pg_owner) ? 0 : -EINVAL; -+ rc = mod_l1_entry(pl1e, val, gl1mfn, 0, v, pg_owner); - - page_unlock(gl1pg); - put_page(gl1pg); diff --git a/23000-x86-mod_l2_entry-retcode.patch b/23000-x86-mod_l2_entry-retcode.patch deleted file mode 100644 index 2ab61bb..0000000 --- a/23000-x86-mod_l2_entry-retcode.patch +++ /dev/null @@ -1,210 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1299687446 0 -# Node ID d428fa67abaa0db20b915a697f1d5ba16e554185 -# Parent 82b5f8d12903e140f957ae8d13d66e44be076b05 -x86: make mod_l2_entry() return a proper error code - -... so that finally all mod_lN_entry() functions behave identically, -allowing some cleanup in do_mmu_update() (which no longer needs to -track both an okay status and an error code). - -Signed-off-by: Jan Beulich - ---- a/xen/arch/x86/mm.c -+++ b/xen/arch/x86/mm.c -@@ -1847,16 +1847,16 @@ static int mod_l2_entry(l2_pgentry_t *pl - struct domain *d = vcpu->domain; - struct page_info *l2pg = mfn_to_page(pfn); - unsigned long type = l2pg->u.inuse.type_info; -- int rc = 1; -+ int rc = 0; - - if ( unlikely(!is_guest_l2_slot(d, type, pgentry_ptr_to_slot(pl2e))) ) - { - MEM_LOG("Illegal L2 update attempt in Xen-private area %p", pl2e); -- return 0; -+ return -EPERM; - } - - if ( unlikely(__copy_from_user(&ol2e, pl2e, sizeof(ol2e)) != 0) ) -- return 0; -+ return -EFAULT; - - if ( l2e_get_flags(nl2e) & _PAGE_PRESENT ) - { -@@ -1864,32 +1864,33 @@ static int mod_l2_entry(l2_pgentry_t *pl - { - MEM_LOG("Bad L2 flags %x", - l2e_get_flags(nl2e) & L2_DISALLOW_MASK); -- return 0; -+ return -EINVAL; - } - - /* Fast path for identical mapping and presence. */ - if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT) ) - { - adjust_guest_l2e(nl2e, d); -- rc = UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu, preserve_ad); -- return rc; -+ if ( UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu, preserve_ad) ) -+ return 0; -+ return -EBUSY; - } - -- if ( unlikely(get_page_from_l2e(nl2e, pfn, d) < 0) ) -- return 0; -+ if ( unlikely((rc = get_page_from_l2e(nl2e, pfn, d)) < 0) ) -+ return rc; - - adjust_guest_l2e(nl2e, d); - if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu, - preserve_ad)) ) - { - ol2e = nl2e; -- rc = 0; -+ rc = -EBUSY; - } - } - else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu, - preserve_ad)) ) - { -- return 0; -+ return -EBUSY; - } - - put_page_from_l2e(ol2e, pfn); -@@ -3369,7 +3370,7 @@ int do_mmu_update( - void *va; - unsigned long gpfn, gmfn, mfn; - struct page_info *page; -- int rc = 0, okay = 1, i = 0; -+ int rc = 0, i = 0; - unsigned int cmd, done = 0, pt_dom; - struct vcpu *v = current; - struct domain *d = v->domain, *pt_owner = d, *pg_owner; -@@ -3436,7 +3437,6 @@ int do_mmu_update( - } - - cmd = req.ptr & (sizeof(l1_pgentry_t)-1); -- okay = 0; - - switch ( cmd ) - { -@@ -3453,6 +3453,7 @@ int do_mmu_update( - rc = xsm_mmu_normal_update(d, pg_owner, req.val); - if ( rc ) - break; -+ rc = -EINVAL; - - req.ptr -= cmd; - gmfn = req.ptr >> PAGE_SHIFT; -@@ -3523,7 +3524,6 @@ int do_mmu_update( - rc = mod_l1_entry(va, l1e, mfn, - cmd == MMU_PT_UPDATE_PRESERVE_AD, v, - pg_owner); -- okay = !rc; - } - break; - case PGT_l2_page_table: -@@ -3547,13 +3547,12 @@ int do_mmu_update( - else if ( p2m_ram_shared == l2e_p2mt ) - { - MEM_LOG("Unexpected attempt to map shared page.\n"); -- rc = -EINVAL; - break; - } - - -- okay = mod_l2_entry(va, l2e, mfn, -- cmd == MMU_PT_UPDATE_PRESERVE_AD, v); -+ rc = mod_l2_entry(va, l2e, mfn, -+ cmd == MMU_PT_UPDATE_PRESERVE_AD, v); - } - break; - case PGT_l3_page_table: -@@ -3577,13 +3576,11 @@ int do_mmu_update( - else if ( p2m_ram_shared == l3e_p2mt ) - { - MEM_LOG("Unexpected attempt to map shared page.\n"); -- rc = -EINVAL; - break; - } - - rc = mod_l3_entry(va, l3e, mfn, - cmd == MMU_PT_UPDATE_PRESERVE_AD, 1, v); -- okay = !rc; - } - break; - #if CONFIG_PAGING_LEVELS >= 4 -@@ -3609,20 +3606,18 @@ int do_mmu_update( - else if ( p2m_ram_shared == l4e_p2mt ) - { - MEM_LOG("Unexpected attempt to map shared page.\n"); -- rc = -EINVAL; - break; - } - - rc = mod_l4_entry(va, l4e, mfn, - cmd == MMU_PT_UPDATE_PRESERVE_AD, 1, v); -- okay = !rc; - } - break; - #endif - case PGT_writable_page: - perfc_incr(writable_mmu_updates); -- okay = paging_write_guest_entry( -- v, va, req.val, _mfn(mfn)); -+ if ( paging_write_guest_entry(v, va, req.val, _mfn(mfn)) ) -+ rc = 0; - break; - } - page_unlock(page); -@@ -3632,8 +3627,8 @@ int do_mmu_update( - else if ( get_page_type(page, PGT_writable_page) ) - { - perfc_incr(writable_mmu_updates); -- okay = paging_write_guest_entry( -- v, va, req.val, _mfn(mfn)); -+ if ( paging_write_guest_entry(v, va, req.val, _mfn(mfn)) ) -+ rc = 0; - put_page_type(page); - } - -@@ -3654,17 +3649,18 @@ int do_mmu_update( - if ( unlikely(!get_page_from_pagenr(mfn, pg_owner)) ) - { - MEM_LOG("Could not get page for mach->phys update"); -+ rc = -EINVAL; - break; - } - - if ( unlikely(paging_mode_translate(pg_owner)) ) - { - MEM_LOG("Mach-phys update on auto-translate guest"); -+ rc = -EINVAL; - break; - } - - set_gpfn_from_mfn(mfn, gpfn); -- okay = 1; - - paging_mark_dirty(pg_owner, mfn); - -@@ -3674,15 +3670,11 @@ int do_mmu_update( - default: - MEM_LOG("Invalid page update command %x", cmd); - rc = -ENOSYS; -- okay = 0; - break; - } - -- if ( unlikely(!okay) ) -- { -- rc = rc ? rc : -EINVAL; -+ if ( unlikely(rc) ) - break; -- } - - guest_handle_add_offset(ureqs, 1); - } diff --git a/23050-xentrace_dynamic_tracebuffer_allocation.patch b/23050-xentrace_dynamic_tracebuffer_allocation.patch deleted file mode 100644 index 0f7971b..0000000 --- a/23050-xentrace_dynamic_tracebuffer_allocation.patch +++ /dev/null @@ -1,406 +0,0 @@ -changeset: 23050:4ebba54b666f -user: Olaf Hering -date: Thu Mar 17 13:29:01 2011 +0000 -files: xen/common/trace.c -description: -xentrace: dynamic tracebuffer allocation - -Allocate tracebuffers dynamically, based on the requested buffer size. -Calculate t_info_size from requested t_buf size. -Fix allocation failure path, free pages outside the spinlock. -Remove casts for rawbuf, it can be a void pointer since no math is -done. - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 249 ++++++++++++++++++++++------------------------------- - 1 file changed, 104 insertions(+), 145 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -42,14 +42,14 @@ CHECK_t_buf; - #define compat_t_rec t_rec - #endif - --/* opt_tbuf_size: trace buffer size (in pages) */ --static unsigned int opt_tbuf_size = 0; -+/* opt_tbuf_size: trace buffer size (in pages) for each cpu */ -+static unsigned int opt_tbuf_size; - integer_param("tbuf_size", opt_tbuf_size); - - /* Pointers to the meta-data objects for all system trace buffers */ - static struct t_info *t_info; --#define T_INFO_PAGES 2 /* Size fixed at 2 pages for now. */ --#define T_INFO_SIZE ((T_INFO_PAGES)*(PAGE_SIZE)) -+static unsigned int t_info_pages; -+ - static DEFINE_PER_CPU_READ_MOSTLY(struct t_buf *, t_bufs); - static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data); - static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock); -@@ -78,6 +78,21 @@ static u32 tb_event_mask = TRC_ALL; - * i.e., sizeof(_type) * ans >= _x. */ - #define fit_to_type(_type, _x) (((_x)+sizeof(_type)-1) / sizeof(_type)) - -+static int cpu_callback( -+ struct notifier_block *nfb, unsigned long action, void *hcpu) -+{ -+ unsigned int cpu = (unsigned long)hcpu; -+ -+ if ( action == CPU_UP_PREPARE ) -+ spin_lock_init(&per_cpu(t_lock, cpu)); -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block cpu_nfb = { -+ .notifier_call = cpu_callback -+}; -+ - static void calc_tinfo_first_offset(void) - { - int offset_in_bytes = offsetof(struct t_info, mfn_offset[NR_CPUS]); -@@ -85,20 +100,34 @@ static void calc_tinfo_first_offset(void - } - - /** -- * check_tbuf_size - check to make sure that the proposed size will fit -+ * calculate_tbuf_size - check to make sure that the proposed size will fit - * in the currently sized struct t_info and allows prod and cons to - * reach double the value without overflow. -+ * Initialize t_info_pages based on number of trace pages. - */ --static int check_tbuf_size(u32 pages) -+static int calculate_tbuf_size(unsigned int pages) - { - struct t_buf dummy; - typeof(dummy.prod) size; -- -- size = ((typeof(dummy.prod))pages) * PAGE_SIZE; -- -- return (size / PAGE_SIZE != pages) -- || (size + size < size) -- || (num_online_cpus() * pages + t_info_first_offset > T_INFO_SIZE / sizeof(uint32_t)); -+ -+ /* force maximum value for an unsigned type */ -+ size = -1; -+ -+ /* max size holds up to n pages */ -+ size /= PAGE_SIZE; -+ if ( pages > size ) -+ { -+ gdprintk(XENLOG_INFO, "%s: requested number of %u pages reduced to %u\n", -+ __func__, pages, (unsigned int)size); -+ pages = size; -+ } -+ -+ t_info_pages = num_online_cpus() * pages + t_info_first_offset; -+ t_info_pages *= sizeof(uint32_t); -+ t_info_pages /= PAGE_SIZE; -+ if ( t_info_pages % PAGE_SIZE ) -+ t_info_pages++; -+ return pages; - } - - /** -@@ -111,47 +140,28 @@ static int check_tbuf_size(u32 pages) - * This function may also be called later when enabling trace buffers - * via the SET_SIZE hypercall. - */ --static int alloc_trace_bufs(void) -+static int alloc_trace_bufs(unsigned int pages) - { -- int i, cpu, order; -- unsigned long nr_pages; -+ int i, cpu, order; - /* Start after a fixed-size array of NR_CPUS */ - uint32_t *t_info_mfn_list; - int offset; - -- if ( opt_tbuf_size == 0 ) -- return -EINVAL; -+ if ( t_info ) -+ return -EBUSY; - -- if ( check_tbuf_size(opt_tbuf_size) ) -- { -- printk("Xen trace buffers: tb size %d too large. " -- "Tracing disabled.\n", -- opt_tbuf_size); -+ if ( pages == 0 ) - return -EINVAL; -- } - -- /* t_info size is fixed for now. Currently this works great, so there -- * seems to be no need to make it dynamic. */ -- t_info = alloc_xenheap_pages(get_order_from_pages(T_INFO_PAGES), 0); -- if ( t_info == NULL ) -- { -- printk("Xen trace buffers: t_info allocation failed! " -- "Tracing disabled.\n"); -- return -ENOMEM; -- } -- -- for ( i = 0; i < T_INFO_PAGES; i++ ) -- share_xen_page_with_privileged_guests( -- virt_to_page(t_info) + i, XENSHARE_readonly); -- -- t_info_mfn_list = (uint32_t *)t_info; -- offset = t_info_first_offset; -+ /* Calculate offset in u32 of first mfn */ -+ calc_tinfo_first_offset(); - -- t_info->tbuf_size = opt_tbuf_size; -- printk(XENLOG_INFO "tbuf_size %d\n", t_info->tbuf_size); -+ pages = calculate_tbuf_size(pages); -+ order = get_order_from_pages(pages); - -- nr_pages = opt_tbuf_size; -- order = get_order_from_pages(nr_pages); -+ t_info = alloc_xenheap_pages(get_order_from_pages(t_info_pages), 0); -+ if ( t_info == NULL ) -+ goto out_dealloc; - - /* - * First, allocate buffers for all of the cpus. If any -@@ -159,27 +169,29 @@ static int alloc_trace_bufs(void) - */ - for_each_online_cpu(cpu) - { -- int flags; -- char *rawbuf; -+ void *rawbuf; - struct t_buf *buf; - - if ( (rawbuf = alloc_xenheap_pages( - order, MEMF_bits(32 + PAGE_SHIFT))) == NULL ) - { -- printk("Xen trace buffers: memory allocation failed\n"); -- opt_tbuf_size = 0; -+ printk("Xen trace buffers: memory allocation failed on cpu %d\n", cpu); - goto out_dealloc; - } - -- spin_lock_irqsave(&per_cpu(t_lock, cpu), flags); -- -- per_cpu(t_bufs, cpu) = buf = (struct t_buf *)rawbuf; -+ per_cpu(t_bufs, cpu) = buf = rawbuf; - buf->cons = buf->prod = 0; - per_cpu(t_data, cpu) = (unsigned char *)(buf + 1); -+ } - -- spin_unlock_irqrestore(&per_cpu(t_lock, cpu), flags); -+ offset = t_info_first_offset; -+ t_info_mfn_list = (uint32_t *)t_info; - -- } -+ for(i = 0; i < t_info_pages; i++) -+ share_xen_page_with_privileged_guests( -+ virt_to_page(t_info) + i, XENSHARE_readonly); -+ -+ t_info->tbuf_size = pages; - - /* - * Now share the pages to xentrace can map them, and write them in -@@ -188,89 +200,75 @@ static int alloc_trace_bufs(void) - for_each_online_cpu(cpu) - { - /* Share pages so that xentrace can map them. */ -- char *rawbuf; -+ void *rawbuf = per_cpu(t_bufs, cpu); -+ struct page_info *p = virt_to_page(rawbuf); -+ uint32_t mfn = virt_to_mfn(rawbuf); - -- if ( (rawbuf = (char *)per_cpu(t_bufs, cpu)) ) -+ for ( i = 0; i < pages; i++ ) - { -- struct page_info *p = virt_to_page(rawbuf); -- uint32_t mfn = virt_to_mfn(rawbuf); -+ share_xen_page_with_privileged_guests(p + i, XENSHARE_writable); - -- for ( i = 0; i < nr_pages; i++ ) -- { -- share_xen_page_with_privileged_guests( -- p + i, XENSHARE_writable); -- -- t_info_mfn_list[offset + i]=mfn + i; -- } -- /* Write list first, then write per-cpu offset. */ -- wmb(); -- t_info->mfn_offset[cpu]=offset; -- printk(XENLOG_INFO "p%d mfn %"PRIx32" offset %d\n", -- cpu, mfn, offset); -- offset+=i; -+ t_info_mfn_list[offset + i]=mfn + i; - } -+ t_info->mfn_offset[cpu]=offset; -+ printk(XENLOG_INFO "p%d mfn %"PRIx32" offset %d\n", -+ cpu, mfn, offset); -+ offset+=i; -+ -+ spin_lock_init(&per_cpu(t_lock, cpu)); - } - -- data_size = (opt_tbuf_size * PAGE_SIZE - sizeof(struct t_buf)); -+ data_size = (pages * PAGE_SIZE - sizeof(struct t_buf)); - t_buf_highwater = data_size >> 1; /* 50% high water */ -+ opt_tbuf_size = pages; -+ -+ register_cpu_notifier(&cpu_nfb); -+ -+ printk("Xen trace buffers: initialised\n"); -+ wmb(); /* above must be visible before tb_init_done flag set */ -+ tb_init_done = 1; - - return 0; -+ - out_dealloc: - for_each_online_cpu(cpu) - { -- int flags; -- char * rawbuf; -- -- spin_lock_irqsave(&per_cpu(t_lock, cpu), flags); -- if ( (rawbuf = (char *)per_cpu(t_bufs, cpu)) ) -+ void *rawbuf = per_cpu(t_bufs, cpu); -+ per_cpu(t_bufs, cpu) = NULL; -+ printk("Xen trace buffers: cpu %d p %p\n", cpu, rawbuf); -+ if ( rawbuf ) - { -- per_cpu(t_bufs, cpu) = NULL; - ASSERT(!(virt_to_page(rawbuf)->count_info & PGC_allocated)); - free_xenheap_pages(rawbuf, order); - } -- spin_unlock_irqrestore(&per_cpu(t_lock, cpu), flags); - } -- -+ free_xenheap_pages(t_info, get_order_from_pages(t_info_pages)); -+ t_info = NULL; -+ printk("Xen trace buffers: allocation failed! Tracing disabled.\n"); - return -ENOMEM; - } - - - /** -- * tb_set_size - handle the logic involved with dynamically -- * allocating and deallocating tbufs -+ * tb_set_size - handle the logic involved with dynamically allocating tbufs - * - * This function is called when the SET_SIZE hypercall is done. - */ --static int tb_set_size(int size) -+static int tb_set_size(unsigned int pages) - { - /* - * Setting size is a one-shot operation. It can be done either at - * boot time or via control tools, but not by both. Once buffers - * are created they cannot be destroyed. - */ -- int ret = 0; -- -- if ( opt_tbuf_size != 0 ) -+ if ( opt_tbuf_size && pages != opt_tbuf_size ) - { -- if ( size != opt_tbuf_size ) -- gdprintk(XENLOG_INFO, "tb_set_size from %d to %d not implemented\n", -- opt_tbuf_size, size); -+ gdprintk(XENLOG_INFO, "tb_set_size from %d to %d not implemented\n", -+ opt_tbuf_size, pages); - return -EINVAL; - } - -- if ( size <= 0 ) -- return -EINVAL; -- -- opt_tbuf_size = size; -- -- if ( (ret = alloc_trace_bufs()) != 0 ) -- { -- opt_tbuf_size = 0; -- return ret; -- } -- -- printk("Xen trace buffers: initialized\n"); -- return 0; -+ return alloc_trace_bufs(pages); - } - - int trace_will_trace_event(u32 event) -@@ -299,21 +297,6 @@ int trace_will_trace_event(u32 event) - return 1; - } - --static int cpu_callback( -- struct notifier_block *nfb, unsigned long action, void *hcpu) --{ -- unsigned int cpu = (unsigned long)hcpu; -- -- if ( action == CPU_UP_PREPARE ) -- spin_lock_init(&per_cpu(t_lock, cpu)); -- -- return NOTIFY_DONE; --} -- --static struct notifier_block cpu_nfb = { -- .notifier_call = cpu_callback --}; -- - /** - * init_trace_bufs - performs initialization of the per-cpu trace buffers. - * -@@ -323,37 +306,13 @@ static struct notifier_block cpu_nfb = { - */ - void __init init_trace_bufs(void) - { -- int i; -- -- /* Calculate offset in u32 of first mfn */ -- calc_tinfo_first_offset(); -- -- /* Per-cpu t_lock initialisation. */ -- for_each_online_cpu ( i ) -- spin_lock_init(&per_cpu(t_lock, i)); -- register_cpu_notifier(&cpu_nfb); -- -- if ( opt_tbuf_size == 0 ) -- { -- printk("Xen trace buffers: disabled\n"); -- goto fail; -- } -- -- if ( alloc_trace_bufs() != 0 ) -+ if ( opt_tbuf_size && alloc_trace_bufs(opt_tbuf_size) ) - { -- dprintk(XENLOG_INFO, "Xen trace buffers: " -- "allocation size %d failed, disabling\n", -- opt_tbuf_size); -- goto fail; -+ gdprintk(XENLOG_INFO, "Xen trace buffers: " -+ "allocation size %d failed, disabling\n", -+ opt_tbuf_size); -+ opt_tbuf_size = 0; - } -- -- printk("Xen trace buffers: initialised\n"); -- wmb(); /* above must be visible before tb_init_done flag set */ -- tb_init_done = 1; -- return; -- -- fail: -- opt_tbuf_size = 0; - } - - /** -@@ -372,7 +331,7 @@ int tb_control(xen_sysctl_tbuf_op_t *tbc - case XEN_SYSCTL_TBUFOP_get_info: - tbc->evt_mask = tb_event_mask; - tbc->buffer_mfn = t_info ? virt_to_mfn(t_info) : 0; -- tbc->size = T_INFO_PAGES * PAGE_SIZE; -+ tbc->size = t_info_pages * PAGE_SIZE; - break; - case XEN_SYSCTL_TBUFOP_set_cpu_mask: - rc = xenctl_cpumap_to_cpumask(&tb_cpu_mask, &tbc->cpu_mask); diff --git a/23074-pfn.h.patch b/23074-pfn.h.patch deleted file mode 100644 index 46ca8b0..0000000 --- a/23074-pfn.h.patch +++ /dev/null @@ -1,146 +0,0 @@ -References: fate#311376, fate#311529, bnc#578927, bnc#628554 - -# HG changeset patch -# User Keir Fraser -# Date 1300887295 0 -# Node ID c80e0fb4fe932b4d8379ea5739af93ae22a30ea5 -# Parent 3831bd253e02aa0536ed32e936777d026abb955e -Define new header for PFN_{DOWN,UP} macros. - -Signed-off-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/domain_build.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/domain_build.c -+++ xen-4.1.3-testing/xen/arch/x86/domain_build.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include -Index: xen-4.1.3-testing/xen/arch/x86/e820.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/e820.c -+++ xen-4.1.3-testing/xen/arch/x86/e820.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - #include - #include - #include -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -100,6 +100,7 @@ - #include - #include - #include -+#include - #include - #include - #include -Index: xen-4.1.3-testing/xen/arch/x86/msi.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/msi.c -+++ xen-4.1.3-testing/xen/arch/x86/msi.c -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - #include - #include - #include -Index: xen-4.1.3-testing/xen/arch/x86/numa.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/numa.c -+++ xen-4.1.3-testing/xen/arch/x86/numa.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - -Index: xen-4.1.3-testing/xen/arch/x86/setup.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/setup.c -+++ xen-4.1.3-testing/xen/arch/x86/setup.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #ifdef CONFIG_COMPAT -Index: xen-4.1.3-testing/xen/arch/x86/srat.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/srat.c -+++ xen-4.1.3-testing/xen/arch/x86/srat.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #include - -Index: xen-4.1.3-testing/xen/arch/x86/tboot.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/tboot.c -+++ xen-4.1.3-testing/xen/arch/x86/tboot.c -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - #include - #include - #include -Index: xen-4.1.3-testing/xen/include/asm-x86/page.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/page.h -+++ xen-4.1.3-testing/xen/include/asm-x86/page.h -@@ -396,8 +396,6 @@ static inline uint32_t cacheattr_to_pte_ - - #endif /* !__ASSEMBLY__ */ - --#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) --#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) - #define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK) - - #endif /* __X86_PAGE_H__ */ -Index: xen-4.1.3-testing/xen/include/xen/pci.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/pci.h -+++ xen-4.1.3-testing/xen/include/xen/pci.h -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - - /* - * The PCI interface treats multi-function devices as independent -Index: xen-4.1.3-testing/xen/include/xen/pfn.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/xen/pfn.h -@@ -0,0 +1,9 @@ -+#ifndef __XEN_PFN_H__ -+#define __XEN_PFN_H__ -+ -+#include -+ -+#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) -+#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) -+ -+#endif /* __XEN_PFN_H__ */ diff --git a/23091-xentrace_fix_t_info_pages_calculation..patch b/23091-xentrace_fix_t_info_pages_calculation..patch deleted file mode 100644 index 55f31bc..0000000 --- a/23091-xentrace_fix_t_info_pages_calculation..patch +++ /dev/null @@ -1,49 +0,0 @@ -changeset: 23091:67632e5cf652 -user: Olaf Hering -date: Fri Mar 25 08:56:33 2011 +0000 -files: xen/common/trace.c -description: -xentrace: fix t_info_pages calculation. - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -109,6 +110,7 @@ static int calculate_tbuf_size(unsigned - { - struct t_buf dummy; - typeof(dummy.prod) size; -+ unsigned int t_info_words, t_info_bytes; - - /* force maximum value for an unsigned type */ - size = -1; -@@ -122,11 +124,9 @@ static int calculate_tbuf_size(unsigned - pages = size; - } - -- t_info_pages = num_online_cpus() * pages + t_info_first_offset; -- t_info_pages *= sizeof(uint32_t); -- t_info_pages /= PAGE_SIZE; -- if ( t_info_pages % PAGE_SIZE ) -- t_info_pages++; -+ t_info_words = num_online_cpus() * pages + t_info_first_offset; -+ t_info_bytes = t_info_words * sizeof(uint32_t); -+ t_info_pages = PFN_UP(t_info_bytes); - return pages; - } - diff --git a/23092-xentrace_print_calculated_numbers_in_calculate_tbuf_size.patch b/23092-xentrace_print_calculated_numbers_in_calculate_tbuf_size.patch deleted file mode 100644 index e16980d..0000000 --- a/23092-xentrace_print_calculated_numbers_in_calculate_tbuf_size.patch +++ /dev/null @@ -1,30 +0,0 @@ -changeset: 23092:45dafa422812 -user: Olaf Hering -date: Fri Mar 25 08:57:28 2011 +0000 -files: xen/common/trace.c -description: -xentrace: print calculated numbers in calculate_tbuf_size() - -Print number of pages to allocate for per-cpu tracebuffer and metadata -to ease debugging when allocation fails. - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 2 ++ - 1 file changed, 2 insertions(+) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -127,6 +127,8 @@ static int calculate_tbuf_size(unsigned - t_info_words = num_online_cpus() * pages + t_info_first_offset; - t_info_bytes = t_info_words * sizeof(uint32_t); - t_info_pages = PFN_UP(t_info_bytes); -+ printk(XENLOG_INFO "xentrace: requesting %u t_info pages for %u trace pages on %u cpus\n", -+ t_info_pages, pages, num_online_cpus()); - return pages; - } - diff --git a/23093-xentrace_remove_gdprintk_usage_since_they_are_not_in_guest_context.patch b/23093-xentrace_remove_gdprintk_usage_since_they_are_not_in_guest_context.patch deleted file mode 100644 index 3b1195d..0000000 --- a/23093-xentrace_remove_gdprintk_usage_since_they_are_not_in_guest_context.patch +++ /dev/null @@ -1,45 +0,0 @@ -changeset: 23093:4b784605b089 -user: Olaf Hering -date: Fri Mar 25 08:57:47 2011 +0000 -files: xen/common/trace.c -description: -xentrace: remove gdprintk usage since they are not in guest context - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -119,7 +119,7 @@ static int calculate_tbuf_size(unsigned - size /= PAGE_SIZE; - if ( pages > size ) - { -- gdprintk(XENLOG_INFO, "%s: requested number of %u pages reduced to %u\n", -+ printk(XENLOG_INFO "%s: requested number of %u pages reduced to %u\n", - __func__, pages, (unsigned int)size); - pages = size; - } -@@ -265,7 +265,7 @@ static int tb_set_size(unsigned int page - */ - if ( opt_tbuf_size && pages != opt_tbuf_size ) - { -- gdprintk(XENLOG_INFO, "tb_set_size from %d to %d not implemented\n", -+ printk(XENLOG_INFO "tb_set_size from %d to %d not implemented\n", - opt_tbuf_size, pages); - return -EINVAL; - } -@@ -310,7 +310,7 @@ void __init init_trace_bufs(void) - { - if ( opt_tbuf_size && alloc_trace_bufs(opt_tbuf_size) ) - { -- gdprintk(XENLOG_INFO, "Xen trace buffers: " -+ printk(XENLOG_INFO "Xen trace buffers: " - "allocation size %d failed, disabling\n", - opt_tbuf_size); - opt_tbuf_size = 0; diff --git a/23094-xentrace_update_comments.patch b/23094-xentrace_update_comments.patch deleted file mode 100644 index 517b921..0000000 --- a/23094-xentrace_update_comments.patch +++ /dev/null @@ -1,34 +0,0 @@ -changeset: 23094:d09e8885bc82 -user: Olaf Hering -date: Fri Mar 25 08:58:04 2011 +0000 -files: xen/common/trace.c -description: -xentrace: update comments - -Fix a typo, remove redundant comment. - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -196,12 +196,11 @@ static int alloc_trace_bufs(unsigned int - t_info->tbuf_size = pages; - - /* -- * Now share the pages to xentrace can map them, and write them in -+ * Now share the pages so xentrace can map them, and write them in - * the global t_info structure. - */ - for_each_online_cpu(cpu) - { -- /* Share pages so that xentrace can map them. */ - void *rawbuf = per_cpu(t_bufs, cpu); - struct page_info *p = virt_to_page(rawbuf); - uint32_t mfn = virt_to_mfn(rawbuf); diff --git a/23095-xentrace_use_consistent_printk_prefix.patch b/23095-xentrace_use_consistent_printk_prefix.patch deleted file mode 100644 index a89677e..0000000 --- a/23095-xentrace_use_consistent_printk_prefix.patch +++ /dev/null @@ -1,111 +0,0 @@ -changeset: 23095:941119d58655 -user: Olaf Hering -date: Fri Mar 25 09:01:37 2011 +0000 -files: xen/common/trace.c -description: -xentrace: use consistent printk prefix - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 31 +++++++++++++++++-------------- - 1 file changed, 17 insertions(+), 14 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -119,16 +119,18 @@ static int calculate_tbuf_size(unsigned - size /= PAGE_SIZE; - if ( pages > size ) - { -- printk(XENLOG_INFO "%s: requested number of %u pages reduced to %u\n", -- __func__, pages, (unsigned int)size); -+ printk(XENLOG_INFO "xentrace: requested number of %u pages " -+ "reduced to %u\n", -+ pages, (unsigned int)size); - pages = size; - } - - t_info_words = num_online_cpus() * pages + t_info_first_offset; - t_info_bytes = t_info_words * sizeof(uint32_t); - t_info_pages = PFN_UP(t_info_bytes); -- printk(XENLOG_INFO "xentrace: requesting %u t_info pages for %u trace pages on %u cpus\n", -- t_info_pages, pages, num_online_cpus()); -+ printk(XENLOG_INFO "xentrace: requesting %u t_info pages " -+ "for %u trace pages on %u cpus\n", -+ t_info_pages, pages, num_online_cpus()); - return pages; - } - -@@ -177,7 +179,8 @@ static int alloc_trace_bufs(unsigned int - if ( (rawbuf = alloc_xenheap_pages( - order, MEMF_bits(32 + PAGE_SHIFT))) == NULL ) - { -- printk("Xen trace buffers: memory allocation failed on cpu %d\n", cpu); -+ printk(XENLOG_INFO "xentrace: memory allocation failed " -+ "on cpu %d\n", cpu); - goto out_dealloc; - } - -@@ -212,7 +215,7 @@ static int alloc_trace_bufs(unsigned int - t_info_mfn_list[offset + i]=mfn + i; - } - t_info->mfn_offset[cpu]=offset; -- printk(XENLOG_INFO "p%d mfn %"PRIx32" offset %d\n", -+ printk(XENLOG_INFO "xentrace: p%d mfn %"PRIx32" offset %d\n", - cpu, mfn, offset); - offset+=i; - -@@ -225,7 +228,7 @@ static int alloc_trace_bufs(unsigned int - - register_cpu_notifier(&cpu_nfb); - -- printk("Xen trace buffers: initialised\n"); -+ printk("xentrace: initialised\n"); - wmb(); /* above must be visible before tb_init_done flag set */ - tb_init_done = 1; - -@@ -236,7 +239,7 @@ out_dealloc: - { - void *rawbuf = per_cpu(t_bufs, cpu); - per_cpu(t_bufs, cpu) = NULL; -- printk("Xen trace buffers: cpu %d p %p\n", cpu, rawbuf); -+ printk(XENLOG_DEBUG "xentrace: cpu %d p %p\n", cpu, rawbuf); - if ( rawbuf ) - { - ASSERT(!(virt_to_page(rawbuf)->count_info & PGC_allocated)); -@@ -245,7 +248,7 @@ out_dealloc: - } - free_xenheap_pages(t_info, get_order_from_pages(t_info_pages)); - t_info = NULL; -- printk("Xen trace buffers: allocation failed! Tracing disabled.\n"); -+ printk(XENLOG_WARNING "xentrace: allocation failed! Tracing disabled.\n"); - return -ENOMEM; - } - -@@ -264,8 +267,9 @@ static int tb_set_size(unsigned int page - */ - if ( opt_tbuf_size && pages != opt_tbuf_size ) - { -- printk(XENLOG_INFO "tb_set_size from %d to %d not implemented\n", -- opt_tbuf_size, pages); -+ printk(XENLOG_INFO "xentrace: tb_set_size from %d to %d " -+ "not implemented\n", -+ opt_tbuf_size, pages); - return -EINVAL; - } - -@@ -309,9 +313,8 @@ void __init init_trace_bufs(void) - { - if ( opt_tbuf_size && alloc_trace_bufs(opt_tbuf_size) ) - { -- printk(XENLOG_INFO "Xen trace buffers: " -- "allocation size %d failed, disabling\n", -- opt_tbuf_size); -+ printk(XENLOG_INFO "xentrace: allocation size %d failed, disabling\n", -+ opt_tbuf_size); - opt_tbuf_size = 0; - } - } diff --git a/23096-x86-hpet-no-cpumask_lock.patch b/23096-x86-hpet-no-cpumask_lock.patch deleted file mode 100644 index 124570b..0000000 --- a/23096-x86-hpet-no-cpumask_lock.patch +++ /dev/null @@ -1,95 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1301043797 0 -# Node ID a65612bcbb921e98a8843157bf365e4ab16e8144 -# Parent 941119d58655f2b2df86d9ecc4cb502bbc5e783c -x86/hpet: eliminate cpumask_lock - -According to the (now getting removed) comment in struct -hpet_event_channel, this was to prevent accessing a CPU's -timer_deadline after it got cleared from cpumask. This can be done -without a lock altogether - hpet_broadcast_exit() can simply clear -the bit, and handle_hpet_broadcast() can read timer_deadline before -looking at the mask a second time (the cpumask bit was already -found set by the surrounding loop). - -Signed-off-by: Jan Beulich -Acked-by: Gang Wei - -Index: xen-4.1.2-testing/xen/arch/x86/hpet.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/hpet.c -+++ xen-4.1.2-testing/xen/arch/x86/hpet.c -@@ -34,18 +34,6 @@ struct hpet_event_channel - int shift; - s_time_t next_event; - cpumask_t cpumask; -- /* -- * cpumask_lock is used to prevent hpet intr handler from accessing other -- * cpu's timer_deadline after the other cpu's mask was cleared -- -- * mask cleared means cpu waken up, then accessing timer_deadline from -- * other cpu is not safe. -- * It is not used for protecting cpumask, so set ops needn't take it. -- * Multiple cpus clear cpumask simultaneously is ok due to the atomic -- * feature of cpu_clear, so hpet_broadcast_exit() can take read lock for -- * clearing cpumask, and handle_hpet_broadcast() have to take write lock -- * for read cpumask & access timer_deadline. -- */ -- rwlock_t cpumask_lock; - spinlock_t lock; - void (*event_handler)(struct hpet_event_channel *); - -@@ -208,17 +196,18 @@ again: - /* find all expired events */ - for_each_cpu_mask(cpu, ch->cpumask) - { -- write_lock_irq(&ch->cpumask_lock); -+ s_time_t deadline; - -- if ( cpu_isset(cpu, ch->cpumask) ) -- { -- if ( per_cpu(timer_deadline, cpu) <= now ) -- cpu_set(cpu, mask); -- else if ( per_cpu(timer_deadline, cpu) < next_event ) -- next_event = per_cpu(timer_deadline, cpu); -- } -+ rmb(); -+ deadline = per_cpu(timer_deadline, cpu); -+ rmb(); -+ if ( !cpu_isset(cpu, ch->cpumask) ) -+ continue; - -- write_unlock_irq(&ch->cpumask_lock); -+ if ( deadline <= now ) -+ cpu_set(cpu, mask); -+ else if ( deadline < next_event ) -+ next_event = deadline; - } - - /* wakeup the cpus which have an expired event. */ -@@ -598,7 +587,6 @@ void hpet_broadcast_init(void) - hpet_events[i].shift = 32; - hpet_events[i].next_event = STIME_MAX; - spin_lock_init(&hpet_events[i].lock); -- rwlock_init(&hpet_events[i].cpumask_lock); - wmb(); - hpet_events[i].event_handler = handle_hpet_broadcast; - } -@@ -634,7 +622,6 @@ void hpet_broadcast_init(void) - legacy_hpet_event.idx = 0; - legacy_hpet_event.flags = 0; - spin_lock_init(&legacy_hpet_event.lock); -- rwlock_init(&legacy_hpet_event.cpumask_lock); - wmb(); - legacy_hpet_event.event_handler = handle_hpet_broadcast; - -@@ -716,9 +703,7 @@ void hpet_broadcast_exit(void) - if ( !reprogram_timer(this_cpu(timer_deadline)) ) - raise_softirq(TIMER_SOFTIRQ); - -- read_lock_irq(&ch->cpumask_lock); - cpu_clear(cpu, ch->cpumask); -- read_unlock_irq(&ch->cpumask_lock); - - if ( ch != &legacy_hpet_event ) - { diff --git a/23099-x86-rwlock-scalability.patch b/23099-x86-rwlock-scalability.patch deleted file mode 100644 index 087d42c..0000000 --- a/23099-x86-rwlock-scalability.patch +++ /dev/null @@ -1,298 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1301126601 0 -# Node ID 612171ff82ea51aaf65d98fd1a551eb8d50fb481 -# Parent c9f745c153ec8c3775e2ee03adc3cb30370b84f6 -rwlock: Allow to scale to 2^31-1 readers on x86. - -Also rework to match the 'trylock' style of raw function used for -spinlocks. - -Inspired by Jan Beulich's patch to do similar improved scaling. - -Signed-off-by: Keir Fraser - -# HG changeset patch -# User Keir Fraser -# Date 1301214635 -3600 -# Node ID 0bc1c4746c8939337f693a513fd837fc03477db1 -# Parent 48dac730a93b27ff60a340564e9a7afd7f9385f4 -x86_32: Fix _raw_read_trylock() build on some gcc versions. - -Was broken by 23099:612171ff82ea. - -A bool_t is a single byte, and needs a 'q' register constraint. Avoid -the whole issue by changing the variable to an int, and explicitly -specify the operand suffix as 'l' for good measure. - -Signed-off-by: Keir Fraser - -Index: xen-4.1.2-testing/xen/common/spinlock.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/spinlock.c -+++ xen-4.1.2-testing/xen/common/spinlock.c -@@ -234,7 +234,11 @@ void _spin_unlock_recursive(spinlock_t * - void _read_lock(rwlock_t *lock) - { - check_lock(&lock->debug); -- _raw_read_lock(&lock->raw); -+ while ( unlikely(!_raw_read_trylock(&lock->raw)) ) -+ { -+ while ( likely(_raw_rw_is_write_locked(&lock->raw)) ) -+ cpu_relax(); -+ } - preempt_disable(); - } - -@@ -243,7 +247,13 @@ void _read_lock_irq(rwlock_t *lock) - ASSERT(local_irq_is_enabled()); - local_irq_disable(); - check_lock(&lock->debug); -- _raw_read_lock(&lock->raw); -+ while ( unlikely(!_raw_read_trylock(&lock->raw)) ) -+ { -+ local_irq_enable(); -+ while ( likely(_raw_rw_is_write_locked(&lock->raw)) ) -+ cpu_relax(); -+ local_irq_disable(); -+ } - preempt_disable(); - } - -@@ -252,11 +262,26 @@ unsigned long _read_lock_irqsave(rwlock_ - unsigned long flags; - local_irq_save(flags); - check_lock(&lock->debug); -- _raw_read_lock(&lock->raw); -+ while ( unlikely(!_raw_read_trylock(&lock->raw)) ) -+ { -+ local_irq_restore(flags); -+ while ( likely(_raw_rw_is_write_locked(&lock->raw)) ) -+ cpu_relax(); -+ local_irq_save(flags); -+ } - preempt_disable(); - return flags; - } - -+int _read_trylock(rwlock_t *lock) -+{ -+ check_lock(&lock->debug); -+ if ( !_raw_read_trylock(&lock->raw) ) -+ return 0; -+ preempt_disable(); -+ return 1; -+} -+ - void _read_unlock(rwlock_t *lock) - { - preempt_enable(); -@@ -280,7 +305,11 @@ void _read_unlock_irqrestore(rwlock_t *l - void _write_lock(rwlock_t *lock) - { - check_lock(&lock->debug); -- _raw_write_lock(&lock->raw); -+ while ( unlikely(!_raw_write_trylock(&lock->raw)) ) -+ { -+ while ( likely(_raw_rw_is_locked(&lock->raw)) ) -+ cpu_relax(); -+ } - preempt_disable(); - } - -@@ -289,7 +318,13 @@ void _write_lock_irq(rwlock_t *lock) - ASSERT(local_irq_is_enabled()); - local_irq_disable(); - check_lock(&lock->debug); -- _raw_write_lock(&lock->raw); -+ while ( unlikely(!_raw_write_trylock(&lock->raw)) ) -+ { -+ local_irq_enable(); -+ while ( likely(_raw_rw_is_locked(&lock->raw)) ) -+ cpu_relax(); -+ local_irq_disable(); -+ } - preempt_disable(); - } - -@@ -298,7 +333,13 @@ unsigned long _write_lock_irqsave(rwlock - unsigned long flags; - local_irq_save(flags); - check_lock(&lock->debug); -- _raw_write_lock(&lock->raw); -+ while ( unlikely(!_raw_write_trylock(&lock->raw)) ) -+ { -+ local_irq_restore(flags); -+ while ( likely(_raw_rw_is_locked(&lock->raw)) ) -+ cpu_relax(); -+ local_irq_save(flags); -+ } - preempt_disable(); - return flags; - } -Index: xen-4.1.2-testing/xen/include/asm-ia64/linux-xen/asm/spinlock.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/asm-ia64/linux-xen/asm/spinlock.h -+++ xen-4.1.2-testing/xen/include/asm-ia64/linux-xen/asm/spinlock.h -@@ -35,17 +35,6 @@ typedef struct { - } raw_rwlock_t; - #define _RAW_RW_LOCK_UNLOCKED /*(raw_rwlock_t)*/ { 0, 0 } - --#define _raw_read_lock(rw) \ --do { \ -- raw_rwlock_t *__read_lock_ptr = (rw); \ -- \ -- while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \ -- ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ -- while (*(volatile int *)__read_lock_ptr < 0) \ -- cpu_relax(); \ -- } \ --} while (0) -- - #define _raw_read_unlock(rw) \ - do { \ - raw_rwlock_t *__read_lock_ptr = (rw); \ -@@ -53,20 +42,6 @@ do { \ - } while (0) - - #ifdef ASM_SUPPORTED --#define _raw_write_lock(rw) \ --do { \ -- __asm__ __volatile__ ( \ -- "mov ar.ccv = r0\n" \ -- "dep r29 = -1, r0, 31, 1;;\n" \ -- "1:\n" \ -- "ld4 r2 = [%0];;\n" \ -- "cmp4.eq p0,p7 = r0,r2\n" \ -- "(p7) br.cond.spnt.few 1b \n" \ -- "cmpxchg4.acq r2 = [%0], r29, ar.ccv;;\n" \ -- "cmp4.eq p0,p7 = r0, r2\n" \ -- "(p7) br.cond.spnt.few 1b;;\n" \ -- :: "r"(rw) : "ar.ccv", "p7", "r2", "r29", "memory"); \ --} while(0) - - #define _raw_write_trylock(rw) \ - ({ \ -@@ -82,16 +57,6 @@ do { \ - - #else /* !ASM_SUPPORTED */ - --#define _raw_write_lock(l) \ --({ \ -- __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \ -- __u32 *ia64_write_lock_ptr = (__u32 *) (l); \ -- do { \ -- while (*ia64_write_lock_ptr) \ -- ia64_barrier(); \ -- ia64_val = ia64_cmpxchg4_acq(ia64_write_lock_ptr, ia64_set_val, 0); \ -- } while (ia64_val); \ --}) - - #define _raw_write_trylock(rw) \ - ({ \ -Index: xen-4.1.2-testing/xen/include/asm-x86/spinlock.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/asm-x86/spinlock.h -+++ xen-4.1.2-testing/xen/include/asm-x86/spinlock.h -@@ -35,51 +35,29 @@ typedef struct { - volatile int lock; - } raw_rwlock_t; - --#define RW_LOCK_BIAS 0x01000000 --#define _RAW_RW_LOCK_UNLOCKED /*(raw_rwlock_t)*/ { RW_LOCK_BIAS } -+#define RW_WRITE_BIAS 0x7fffffff -+#define _RAW_RW_LOCK_UNLOCKED /*(raw_rwlock_t)*/ { 0 } - --static always_inline void _raw_read_lock(raw_rwlock_t *rw) -+static always_inline int _raw_read_trylock(raw_rwlock_t *rw) - { -- asm volatile ( -- "1: lock; decl %0 \n" -- " jns 3f \n" -- " lock; incl %0 \n" -- "2: rep; nop \n" -- " cmpl $1,%0 \n" -- " js 2b \n" -- " jmp 1b \n" -- "3:" -- : "=m" (rw->lock) : : "memory" ); --} -+ int acquired; - --static always_inline void _raw_write_lock(raw_rwlock_t *rw) --{ - asm volatile ( -- "1: lock; subl %1,%0 \n" -- " jz 3f \n" -- " lock; addl %1,%0 \n" -- "2: rep; nop \n" -- " cmpl %1,%0 \n" -- " jne 2b \n" -+ " lock; decl %0 \n" -+ " jns 2f \n" -+ "1: .subsection 1 \n" -+ "2: lock; incl %0 \n" -+ " decl %1 \n" - " jmp 1b \n" -- "3:" -- : "=m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory" ); -+ " .subsection 0 \n" -+ : "=m" (rw->lock), "=r" (acquired) : "1" (1) : "memory" ); -+ -+ return acquired; - } - - static always_inline int _raw_write_trylock(raw_rwlock_t *rw) - { -- int rc; -- -- asm volatile ( -- " lock; subl %2,%0 \n" -- " jz 1f \n" -- " lock; addl %2,%0 \n" -- " dec %1 \n" -- "1:" -- : "=m" (rw->lock), "=r" (rc) : "i" (RW_LOCK_BIAS), "1" (1) -- : "memory" ); -- -- return rc; -+ return (cmpxchg(&rw->lock, 0, RW_WRITE_BIAS) == 0); - } - - static always_inline void _raw_read_unlock(raw_rwlock_t *rw) -@@ -92,11 +70,11 @@ static always_inline void _raw_read_unlo - static always_inline void _raw_write_unlock(raw_rwlock_t *rw) - { - asm volatile ( -- "lock ; addl %1,%0" -- : "=m" ((rw)->lock) : "i" (RW_LOCK_BIAS) : "memory" ); -+ "lock ; subl %1,%0" -+ : "=m" ((rw)->lock) : "i" (RW_WRITE_BIAS) : "memory" ); - } - --#define _raw_rw_is_locked(x) ((x)->lock < RW_LOCK_BIAS) --#define _raw_rw_is_write_locked(x) ((x)->lock <= 0) -+#define _raw_rw_is_locked(x) ((x)->lock != 0) -+#define _raw_rw_is_write_locked(x) ((x)->lock > 0) - - #endif /* __ASM_SPINLOCK_H */ -Index: xen-4.1.2-testing/xen/include/xen/spinlock.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/xen/spinlock.h -+++ xen-4.1.2-testing/xen/include/xen/spinlock.h -@@ -157,6 +157,7 @@ unsigned long _read_lock_irqsave(rwlock_ - void _read_unlock(rwlock_t *lock); - void _read_unlock_irq(rwlock_t *lock); - void _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags); -+int _read_trylock(rwlock_t *lock); - - void _write_lock(rwlock_t *lock); - void _write_lock_irq(rwlock_t *lock); -@@ -210,6 +211,7 @@ int _rw_is_write_locked(rwlock_t *lock); - #define read_unlock(l) _read_unlock(l) - #define read_unlock_irq(l) _read_unlock_irq(l) - #define read_unlock_irqrestore(l, f) _read_unlock_irqrestore(l, f) -+#define read_trylock(l) _read_trylock(l) - - #define write_lock(l) _write_lock(l) - #define write_lock_irq(l) _write_lock_irq(l) diff --git a/23103-x86-pirq-guest-eoi-check.patch b/23103-x86-pirq-guest-eoi-check.patch deleted file mode 100644 index 4f144f3..0000000 --- a/23103-x86-pirq-guest-eoi-check.patch +++ /dev/null @@ -1,27 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1301132521 0 -# Node ID 48dac730a93b27ff60a340564e9a7afd7f9385f4 -# Parent 8f001d864fefac689b7662bc9979eaddf4fd6e9c -x86: __pirq_guest_eoi() must check it is called for a fully -guest-bound irq before accessing desc->action. - -Signed-off-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/irq.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/irq.c -+++ xen-4.1.3-testing/xen/arch/x86/irq.c -@@ -1143,6 +1143,12 @@ static void __pirq_guest_eoi(struct doma - return; - } - -+ if ( !(desc->status & IRQ_GUEST) ) -+ { -+ spin_unlock_irq(&desc->lock); -+ return; -+ } -+ - action = (irq_guest_action_t *)desc->action; - irq = desc - irq_desc; - diff --git a/23127-vtd-bios-settings.patch b/23127-vtd-bios-settings.patch deleted file mode 100644 index c9c09dd..0000000 --- a/23127-vtd-bios-settings.patch +++ /dev/null @@ -1,208 +0,0 @@ -# HG changeset patch -# User Allen Kay -# Date 1301755765 -3600 -# Node ID 1046830079376a4b29fcad0cd037a834e808ed06 -# Parent 89c23f58aa986092da0c9a7dfac1c41befbe1f3f -[VTD] check BIOS settings before enabling interrupt remapping or x2apic - -Check flags field in ACPI DMAR structure before enabling interrupt -remapping or x2apic. This allows platform vendors to disable -interrupt remapping or x2apic features if on board BIOS does not -support them. - -Signed-off-by: Allen Kay - -# HG changeset patch -# User Allen Kay -# Date 1302077462 -3600 -# Node ID c7916d6f4dfba9d6c7eeb0fc2796068d75e2fb4a -# Parent 42fa70e0761bbb0596618ca5323664f31a2faa76 -[VTD] Fixes to ACPI DMAR flag checks. - - * platform_supports_{intremap,x2apic} should not be marked __init as - they are used during S3 resume. - * DMAR flags should be taken from the table passed to - acpi_parse_dmar() -- this is the trusted copy of the DMAR, when - running in TXT mode. - -Signed-off-by: Allen Kay - -Index: xen-4.1.3-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/apic.c -+++ xen-4.1.3-testing/xen/arch/x86/apic.c -@@ -572,7 +572,7 @@ static void resume_x2apic(void) - mask_8259A(); - mask_IO_APIC_setup(ioapic_entries); - -- iommu_enable_IR(); -+ iommu_enable_x2apic_IR(); - __enable_x2apic(); - - restore_IO_APIC_setup(ioapic_entries); -@@ -789,7 +789,7 @@ int lapic_suspend(void) - - local_irq_save(flags); - disable_local_APIC(); -- iommu_disable_IR(); -+ iommu_disable_x2apic_IR(); - local_irq_restore(flags); - return 0; - } -@@ -1035,7 +1035,7 @@ void __init x2apic_bsp_setup(void) - mask_8259A(); - mask_IO_APIC_setup(ioapic_entries); - -- if ( iommu_enable_IR() ) -+ if ( iommu_enable_x2apic_IR() ) - { - if ( x2apic_enabled ) - panic("Interrupt remapping could not be enabled while " -Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/dmar.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/dmar.c -+++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/dmar.c -@@ -46,6 +46,7 @@ LIST_HEAD(acpi_rmrr_units); - LIST_HEAD(acpi_atsr_units); - LIST_HEAD(acpi_rhsa_units); - -+static int __read_mostly dmar_flags; - static u64 igd_drhd_address; - u8 dmar_host_address_width; - -@@ -684,6 +685,7 @@ static int __init acpi_parse_dmar(struct - int ret = 0; - - dmar = (struct acpi_table_dmar *)table; -+ dmar_flags = dmar->flags; - - if ( !iommu_enabled ) - { -@@ -804,3 +806,22 @@ void acpi_dmar_zap(void) - dmar_table->signature[0] = 'X'; - dmar_table->checksum -= 'X'-'D'; - } -+ -+int platform_supports_intremap(void) -+{ -+ unsigned int flags = 0; -+ -+ flags = DMAR_INTR_REMAP; -+ return ((dmar_flags & flags) == DMAR_INTR_REMAP); -+} -+ -+int platform_supports_x2apic(void) -+{ -+ unsigned int flags = 0; -+ -+ if (!cpu_has_x2apic) -+ return 0; -+ -+ flags = DMAR_INTR_REMAP | DMAR_X2APIC_OPT_OUT; -+ return ((dmar_flags & flags) == DMAR_INTR_REMAP); -+} -Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/extern.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/extern.h -+++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/extern.h -@@ -87,5 +87,7 @@ void vtd_ops_preamble_quirk(struct iommu - void vtd_ops_postamble_quirk(struct iommu* iommu); - void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map); - void pci_vtd_quirk(struct pci_dev *pdev); -+int platform_supports_intremap(void); -+int platform_supports_x2apic(void); - - #endif // _VTD_EXTERN_H_ -Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/intremap.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/intremap.c -+++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/intremap.c -@@ -741,6 +741,13 @@ int enable_intremap(struct iommu *iommu, - - ASSERT(ecap_intr_remap(iommu->ecap) && iommu_intremap); - -+ if ( !platform_supports_intremap() ) -+ { -+ dprintk(XENLOG_ERR VTDPREFIX, -+ "Platform firmware does not support interrupt remapping\n"); -+ return -EINVAL; -+ } -+ - ir_ctrl = iommu_ir_ctrl(iommu); - sts = dmar_readl(iommu->reg, DMAR_GSTS_REG); - -@@ -847,10 +854,10 @@ out: - } - - /* -- * This function is used to enable Interrutp remapping when -+ * This function is used to enable Interrupt remapping when - * enable x2apic - */ --int iommu_enable_IR(void) -+int iommu_enable_x2apic_IR(void) - { - struct acpi_drhd_unit *drhd; - struct iommu *iommu; -@@ -858,6 +865,9 @@ int iommu_enable_IR(void) - if ( !iommu_supports_eim() ) - return -1; - -+ if ( !platform_supports_x2apic() ) -+ return -1; -+ - for_each_drhd_unit ( drhd ) - { - struct qi_ctrl *qi_ctrl = NULL; -@@ -907,7 +917,7 @@ int iommu_enable_IR(void) - * This function is used to disable Interrutp remapping when - * suspend local apic - */ --void iommu_disable_IR(void) -+void iommu_disable_x2apic_IR(void) - { - struct acpi_drhd_unit *drhd; - -Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.c -+++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c -@@ -2091,7 +2091,7 @@ static int init_vtd_hw(void) - { - iommu_intremap = 0; - dprintk(XENLOG_WARNING VTDPREFIX, -- "Failed to enable Interrupt Remapping!\n"); -+ "Interrupt Remapping not enabled\n"); - break; - } - } -Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.h -+++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h -@@ -22,6 +22,10 @@ - - #include - -+/* DMAR Flags bits */ -+#define DMAR_INTR_REMAP 0x1 -+#define DMAR_X2APIC_OPT_OUT 0x2 -+ - /* - * Intel IOMMU register specification per version 1.0 public spec. - */ -Index: xen-4.1.3-testing/xen/include/xen/iommu.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/iommu.h -+++ xen-4.1.3-testing/xen/include/xen/iommu.h -@@ -66,8 +66,8 @@ struct iommu { - - int iommu_setup(void); - int iommu_supports_eim(void); --int iommu_enable_IR(void); --void iommu_disable_IR(void); -+int iommu_enable_x2apic_IR(void); -+void iommu_disable_x2apic_IR(void); - - int iommu_add_device(struct pci_dev *pdev); - int iommu_remove_device(struct pci_dev *pdev); diff --git a/23128-xentrace_correct_formula_to_calculate_t_info_pages.patch b/23128-xentrace_correct_formula_to_calculate_t_info_pages.patch deleted file mode 100644 index 417442b..0000000 --- a/23128-xentrace_correct_formula_to_calculate_t_info_pages.patch +++ /dev/null @@ -1,45 +0,0 @@ -changeset: 23128:4a335f1000ea -user: Olaf Hering -date: Sat Apr 02 15:50:19 2011 +0100 -files: xen/common/trace.c -description: -xentrace: correct formula to calculate t_info_pages - -The current formula to calculate t_info_pages, based on the initial -code, is slightly incorrect. It may allocate more than needed. -Each cpu has some pages/mfns stored as uint32_t. -That list is stored with an offset at tinfo. - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -110,7 +110,7 @@ static int calculate_tbuf_size(unsigned - { - struct t_buf dummy; - typeof(dummy.prod) size; -- unsigned int t_info_words, t_info_bytes; -+ unsigned int t_info_words; - - /* force maximum value for an unsigned type */ - size = -1; -@@ -125,9 +125,8 @@ static int calculate_tbuf_size(unsigned - pages = size; - } - -- t_info_words = num_online_cpus() * pages + t_info_first_offset; -- t_info_bytes = t_info_words * sizeof(uint32_t); -- t_info_pages = PFN_UP(t_info_bytes); -+ t_info_words = num_online_cpus() * pages * sizeof(uint32_t); -+ t_info_pages = PFN_UP(t_info_first_offset + t_info_words); - printk(XENLOG_INFO "xentrace: requesting %u t_info pages " - "for %u trace pages on %u cpus\n", - t_info_pages, pages, num_online_cpus()); diff --git a/23129-xentrace_remove_unneeded_debug_printk.patch b/23129-xentrace_remove_unneeded_debug_printk.patch deleted file mode 100644 index 69ac2b6..0000000 --- a/23129-xentrace_remove_unneeded_debug_printk.patch +++ /dev/null @@ -1,30 +0,0 @@ -changeset: 23129:219ba19aedeb -user: Olaf Hering -date: Sat Apr 02 15:50:47 2011 +0100 -files: xen/common/trace.c -description: -xentrace: remove unneeded debug printk - -The pointer value in case of an allocation failure is rather -uninteresting. - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 1 - - 1 file changed, 1 deletion(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -238,7 +238,6 @@ out_dealloc: - { - void *rawbuf = per_cpu(t_bufs, cpu); - per_cpu(t_bufs, cpu) = NULL; -- printk(XENLOG_DEBUG "xentrace: cpu %d p %p\n", cpu, rawbuf); - if ( rawbuf ) - { - ASSERT(!(virt_to_page(rawbuf)->count_info & PGC_allocated)); diff --git a/23173-xentrace_Move_register_cpu_notifier_call_into_boot-time_init..patch b/23173-xentrace_Move_register_cpu_notifier_call_into_boot-time_init..patch deleted file mode 100644 index 8ee85df..0000000 --- a/23173-xentrace_Move_register_cpu_notifier_call_into_boot-time_init..patch +++ /dev/null @@ -1,39 +0,0 @@ -changeset: 23173:94cef9aaf0cd -user: Keir Fraser -date: Wed Apr 06 15:52:50 2011 +0100 -files: xen/common/trace.c -description: -xentrace: Move register_cpu_notifier() call into boot-time init. - -We can't do it lazily from alloc_trace_bufs() as that gets called -later if tracing is enabled later by dom0. - -Signed-off-by: Keir Fraser - - ---- - xen/common/trace.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -225,8 +225,6 @@ static int alloc_trace_bufs(unsigned int - t_buf_highwater = data_size >> 1; /* 50% high water */ - opt_tbuf_size = pages; - -- register_cpu_notifier(&cpu_nfb); -- - printk("xentrace: initialised\n"); - wmb(); /* above must be visible before tb_init_done flag set */ - tb_init_done = 1; -@@ -309,6 +307,8 @@ int trace_will_trace_event(u32 event) - */ - void __init init_trace_bufs(void) - { -+ register_cpu_notifier(&cpu_nfb); -+ - if ( opt_tbuf_size && alloc_trace_bufs(opt_tbuf_size) ) - { - printk(XENLOG_INFO "xentrace: allocation size %d failed, disabling\n", diff --git a/23199-amd-iommu-unmapped-intr-fault.patch b/23199-amd-iommu-unmapped-intr-fault.patch deleted file mode 100644 index 421ffd6..0000000 --- a/23199-amd-iommu-unmapped-intr-fault.patch +++ /dev/null @@ -1,27 +0,0 @@ -# HG changeset patch -# User Wei Wang -# Date 1302610857 -3600 -# Node ID dbd98ab2f87facba8117bb881fa2ea5dfdb92960 -# Parent 697ac895c11c6d5d82524de56796cee98fded2a5 -amd iommu: Unmapped interrupt should generate IO page faults. - -This helps us to debug interrupt issues. - -Signed-off-by: Wei Wang - -Index: xen-4.1.2-testing/xen/drivers/passthrough/amd/iommu_map.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/drivers/passthrough/amd/iommu_map.c -+++ xen-4.1.2-testing/xen/drivers/passthrough/amd/iommu_map.c -@@ -327,8 +327,9 @@ void amd_iommu_set_intremap_table(u32 *d - set_field_in_reg_u32(0xB, entry, - IOMMU_DEV_TABLE_INT_TABLE_LENGTH_MASK, - IOMMU_DEV_TABLE_INT_TABLE_LENGTH_SHIFT, &entry); -- /* ignore unmapped interrupts */ -- set_field_in_reg_u32(IOMMU_CONTROL_ENABLED, entry, -+ -+ /* unmapped interrupt results io page faults*/ -+ set_field_in_reg_u32(IOMMU_CONTROL_DISABLED, entry, - IOMMU_DEV_TABLE_INT_TABLE_IGN_UNMAPPED_MASK, - IOMMU_DEV_TABLE_INT_TABLE_IGN_UNMAPPED_SHIFT, &entry); - set_field_in_reg_u32(int_valid ? IOMMU_CONTROL_ENABLED : diff --git a/23236-svm-decode-assist-invlpg.patch b/23236-svm-decode-assist-invlpg.patch deleted file mode 100644 index 0cdfbf2..0000000 --- a/23236-svm-decode-assist-invlpg.patch +++ /dev/null @@ -1,121 +0,0 @@ -References: FATE#309900 - -# HG changeset patch -# User Christoph Egger -# Date 1302700499 -3600 -# Node ID 3b2182100ba2fa5c4a3a450e473717e2300aa8f1 -# Parent 2284c79b606ac14ef5c5bc2c1cce62188b5bd9ee -x86/svm/asid: Introduce svm_invlpga() - -Signed-off-by: Christoph Egger - -# HG changeset patch -# User Andre Przywara -# Date 1303117597 -3600 -# Node ID e324c4d1dd6eeb9417fec513640ca795bd0f5dd4 -# Parent 2c8ad607ece18b4740b9fc4ffe267a0e0893c141 -svm: implement INVLPG part of DecodeAssist - -Newer SVM implementations (Bulldozer) give the desired address on -a INVLPG intercept explicitly in the EXITINFO1 field of the VMCB. -Use this address to avoid a costly instruction fetch and decode -cycle. - -Signed-off-by: Andre Przywara - -# HG changeset patch -# User Christoph Egger -# Date 1305187246 -3600 -# Node ID 19d6541c4abec3486c83de76102ec46d7fe22a16 -# Parent b6e8e916ed2827fb1329de0de2e23ee5b6b78662 -nestedsvm: update rip on invlpga intercept - -Fixes endless loop. - -Signed-off-by: Christoph Egger - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/svm/emulate.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/svm/emulate.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/svm/emulate.c -@@ -102,6 +102,7 @@ MAKE_INSTR(INT3, 1, 0xcc); - MAKE_INSTR(RDTSC, 2, 0x0f, 0x31); - MAKE_INSTR(PAUSE, 1, 0x90); - MAKE_INSTR(XSETBV, 3, 0x0f, 0x01, 0xd1); -+MAKE_INSTR(INVLPGA,3, 0x0f, 0x01, 0xdf); - - static const u8 *opc_bytes[INSTR_MAX_COUNT] = - { -@@ -116,6 +117,7 @@ static const u8 *opc_bytes[INSTR_MAX_COU - [INSTR_RDTSC] = OPCODE_RDTSC, - [INSTR_PAUSE] = OPCODE_PAUSE, - [INSTR_XSETBV] = OPCODE_XSETBV, -+ [INSTR_INVLPGA] = OPCODE_INVLPGA, - }; - - static int fetch(struct vcpu *v, u8 *buf, unsigned long addr, int len) -Index: xen-4.1.3-testing/xen/arch/x86/hvm/svm/svm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/svm/svm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/svm/svm.c -@@ -1748,8 +1748,10 @@ asmlinkage void svm_vmexit_handler(struc - break; - - case VMEXIT_INVLPGA: -- if ( !handle_mmio() ) -- hvm_inject_exception(TRAP_gp_fault, 0, 0); -+ if ( (inst_len = __get_instruction_length(v, INSTR_INVLPGA)) == 0 ) -+ break; -+ svm_invlpga(regs->eax, v->arch.hvm_vcpu.asid); -+ __update_guest_eip(regs, inst_len); - break; - - case VMEXIT_VMMCALL: -Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/asid.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/asid.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/asid.h -@@ -34,10 +34,7 @@ static inline void svm_asid_g_invlpg(str - { - #if 0 - /* Optimization? */ -- asm volatile (".byte 0x0F,0x01,0xDF \n" -- : /* output */ -- : /* input */ -- "a" (g_vaddr), "c"(v->arch.hvm_svm.vmcb->guest_asid) ); -+ svm_invlpga(g_vaddr, v->arch.hvm_svm.vmcb->guest_asid); - #endif - - /* Safe fallback. Take a new ASID. */ -Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/emulate.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/emulate.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/emulate.h -@@ -33,6 +33,7 @@ enum instruction_index { - INSTR_RDTSC, - INSTR_PAUSE, - INSTR_XSETBV, -+ INSTR_INVLPGA, - INSTR_MAX_COUNT /* Must be last - Number of instructions supported */ - }; - -Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/svm.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/svm.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/svm.h -@@ -62,6 +62,15 @@ static inline void svm_vmsave(void *vmcb - : : "a" (__pa(vmcb)) : "memory" ); - } - -+static inline void svm_invlpga(unsigned long vaddr, uint32_t asid) -+{ -+ asm volatile ( -+ ".byte 0x0f,0x01,0xdf" -+ : /* output */ -+ : /* input */ -+ "a" (vaddr), "c" (asid)); -+} -+ - extern u32 svm_feature_flags; - - #define SVM_FEATURE_NPT 0 /* Nested page table support */ diff --git a/23239-xentrace_correct_overflow_check_for_number_of_per-cpu_trace_pages.patch b/23239-xentrace_correct_overflow_check_for_number_of_per-cpu_trace_pages.patch deleted file mode 100644 index f06ed2e..0000000 --- a/23239-xentrace_correct_overflow_check_for_number_of_per-cpu_trace_pages.patch +++ /dev/null @@ -1,69 +0,0 @@ -changeset: 23239:51d89366c859 -user: Olaf Hering -date: Mon Apr 18 15:12:04 2011 +0100 -files: xen/common/trace.c -description: -xentrace: correct overflow check for number of per-cpu trace pages - -The calculated number of per-cpu trace pages is stored in t_info and -shared with tools like xentrace. Since its an u16 the value may -overflow because the current check is based on u32. Using the u16 -means each cpu could in theory use up to 256MB as trace -buffer. However such a large allocation will currently fail on x86 due -to the MAX_ORDER limit. Check both max theoretical number of pages -per cpu and max number of pages reachable by struct t_buf->prod/cons -variables with requested number of pages. - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 22 +++++++++++++++------- - 1 file changed, 15 insertions(+), 7 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -104,25 +104,33 @@ static void calc_tinfo_first_offset(void - * calculate_tbuf_size - check to make sure that the proposed size will fit - * in the currently sized struct t_info and allows prod and cons to - * reach double the value without overflow. -+ * The t_info layout is fixed and cant be changed without breaking xentrace. - * Initialize t_info_pages based on number of trace pages. - */ - static int calculate_tbuf_size(unsigned int pages) - { -- struct t_buf dummy; -- typeof(dummy.prod) size; -+ struct t_buf dummy_size; -+ typeof(dummy_size.prod) max_size; -+ struct t_info dummy_pages; -+ typeof(dummy_pages.tbuf_size) max_pages; - unsigned int t_info_words; - - /* force maximum value for an unsigned type */ -- size = -1; -+ max_size = -1; -+ max_pages = -1; - - /* max size holds up to n pages */ -- size /= PAGE_SIZE; -- if ( pages > size ) -+ max_size /= PAGE_SIZE; -+ -+ if ( max_size < max_pages ) -+ max_pages = max_size; -+ -+ if ( pages > max_pages ) - { - printk(XENLOG_INFO "xentrace: requested number of %u pages " - "reduced to %u\n", -- pages, (unsigned int)size); -- pages = size; -+ pages, max_pages); -+ pages = max_pages; - } - - t_info_words = num_online_cpus() * pages * sizeof(uint32_t); diff --git a/23246-x86-xsave-enable.patch b/23246-x86-xsave-enable.patch deleted file mode 100644 index 4eae486..0000000 --- a/23246-x86-xsave-enable.patch +++ /dev/null @@ -1,24 +0,0 @@ -References: bnc#718668 - -# HG changeset patch -# User Tim Deegan -# Date 1303297371 -3600 -# Node ID eb4505f8dd97f894ee4b4e1b55ea1272c05e6759 -# Parent 3539ef956a378ad7fe39654ff9aca5b0e7bf8843 -xen/x86: re-enable xsave by default now that it supports live migration. - -Signed-off-by: Tim Deegan - -Index: xen-4.1.3-testing/xen/arch/x86/cpu/common.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/cpu/common.c -+++ xen-4.1.3-testing/xen/arch/x86/cpu/common.c -@@ -25,7 +25,7 @@ boolean_param("nofxsr", disable_x86_fxsr - static bool_t __cpuinitdata disable_x86_serial_nr; - boolean_param("noserialnumber", disable_x86_serial_nr); - --static bool_t __cpuinitdata use_xsave; -+static bool_t __cpuinitdata use_xsave = 1; - boolean_param("xsave", use_xsave); - - unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u; diff --git a/23303-cpufreq-misc.patch b/23303-cpufreq-misc.patch deleted file mode 100644 index a46da25..0000000 --- a/23303-cpufreq-misc.patch +++ /dev/null @@ -1,209 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1304930762 -3600 -# Node ID 82180954eda9cfe279e7ecf8c9ed4ffa29796bfb -# Parent c822888f36568f26e95f9844c7f0c5e06df7aa20 -misc cpufreq cleanup - -- proper handling of governor command line options when using the - default governor -- warning message for unrecognized command line options -- replacing a NR_CPUS sized array with per-CPU data -- a couple of __read_mostly annotations - -Signed-off-by: Jan Beulich - -Index: xen-4.1.2-testing/xen/drivers/cpufreq/cpufreq.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/drivers/cpufreq/cpufreq.c -+++ xen-4.1.2-testing/xen/drivers/cpufreq/cpufreq.c -@@ -47,7 +47,8 @@ - #include - #include - --static unsigned int usr_max_freq, usr_min_freq; -+static unsigned int __read_mostly usr_min_freq; -+static unsigned int __read_mostly usr_max_freq; - static void cpufreq_cmdline_common_para(struct cpufreq_policy *new_policy); - - struct cpufreq_dom { -@@ -57,7 +58,7 @@ struct cpufreq_dom { - }; - static LIST_HEAD(cpufreq_dom_list_head); - --struct cpufreq_governor *cpufreq_opt_governor; -+struct cpufreq_governor *__read_mostly cpufreq_opt_governor; - LIST_HEAD(cpufreq_governor_list); - - bool_t __read_mostly cpufreq_verbose; -@@ -543,6 +544,7 @@ void __init cpufreq_cmdline_parse(char * - { - static struct cpufreq_governor *__initdata cpufreq_governors[] = - { -+ CPUFREQ_DEFAULT_GOVERNOR, - &cpufreq_gov_userspace, - &cpufreq_gov_dbs, - &cpufreq_gov_performance, -@@ -576,8 +578,10 @@ void __init cpufreq_cmdline_parse(char * - } - - if (str && !cpufreq_handle_common_option(str, val) && -- cpufreq_governors[gov_index]->handle_option) -- cpufreq_governors[gov_index]->handle_option(str, val); -+ (!cpufreq_governors[gov_index]->handle_option || -+ !cpufreq_governors[gov_index]->handle_option(str, val))) -+ printk(XENLOG_WARNING "cpufreq/%s: option '%s' not recognized\n", -+ cpufreq_governors[gov_index]->name, str); - - str = end; - } while (str); -Index: xen-4.1.2-testing/xen/drivers/cpufreq/cpufreq_misc_governors.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/drivers/cpufreq/cpufreq_misc_governors.c -+++ xen-4.1.2-testing/xen/drivers/cpufreq/cpufreq_misc_governors.c -@@ -14,14 +14,17 @@ - * - */ - -+#include - #include -+#include - #include - #include - - /* - * cpufreq userspace governor - */ --static unsigned int cpu_set_freq[NR_CPUS]; -+static unsigned int __read_mostly userspace_cmdline_freq; -+static DEFINE_PER_CPU(unsigned int, cpu_set_freq); - - static int cpufreq_governor_userspace(struct cpufreq_policy *policy, - unsigned int event) -@@ -35,21 +38,21 @@ static int cpufreq_governor_userspace(st - - switch (event) { - case CPUFREQ_GOV_START: -- if (!cpu_set_freq[cpu]) -- cpu_set_freq[cpu] = policy->cur; -+ if (!per_cpu(cpu_set_freq, cpu)) -+ per_cpu(cpu_set_freq, cpu) = policy->cur; - break; - case CPUFREQ_GOV_STOP: -- cpu_set_freq[cpu] = 0; -+ per_cpu(cpu_set_freq, cpu) = 0; - break; - case CPUFREQ_GOV_LIMITS: -- if (policy->max < cpu_set_freq[cpu]) -+ if (policy->max < per_cpu(cpu_set_freq, cpu)) - ret = __cpufreq_driver_target(policy, policy->max, - CPUFREQ_RELATION_H); -- else if (policy->min > cpu_set_freq[cpu]) -+ else if (policy->min > per_cpu(cpu_set_freq, cpu)) - ret = __cpufreq_driver_target(policy, policy->min, - CPUFREQ_RELATION_L); - else -- ret = __cpufreq_driver_target(policy, cpu_set_freq[cpu], -+ ret = __cpufreq_driver_target(policy, per_cpu(cpu_set_freq, cpu), - CPUFREQ_RELATION_L); - - break; -@@ -68,7 +71,7 @@ int write_userspace_scaling_setspeed(uns - if (!cpu_online(cpu) || !(policy = per_cpu(cpufreq_cpu_policy, cpu))) - return -EINVAL; - -- cpu_set_freq[cpu] = freq; -+ per_cpu(cpu_set_freq, cpu) = freq; - - if (freq < policy->min) - freq = policy->min; -@@ -78,19 +81,35 @@ int write_userspace_scaling_setspeed(uns - return __cpufreq_driver_target(policy, freq, CPUFREQ_RELATION_L); - } - --static void __init -+static bool_t __init - cpufreq_userspace_handle_option(const char *name, const char *val) - { - if (!strcmp(name, "speed") && val) { -- unsigned int usr_cmdline_freq; -- unsigned int cpu; -+ userspace_cmdline_freq = simple_strtoul(val, NULL, 0); -+ return 1; -+ } -+ return 0; -+} - -- usr_cmdline_freq = simple_strtoul(val, NULL, 0); -- for (cpu = 0; cpu < NR_CPUS; cpu++) -- cpu_set_freq[cpu] = usr_cmdline_freq; -+static int cpufreq_userspace_cpu_callback( -+ struct notifier_block *nfb, unsigned long action, void *hcpu) -+{ -+ unsigned int cpu = (unsigned long)hcpu; -+ -+ switch (action) -+ { -+ case CPU_UP_PREPARE: -+ per_cpu(cpu_set_freq, cpu) = userspace_cmdline_freq; -+ break; - } -+ -+ return NOTIFY_DONE; - } - -+static struct notifier_block cpufreq_userspace_cpu_nfb = { -+ .notifier_call = cpufreq_userspace_cpu_callback -+}; -+ - struct cpufreq_governor cpufreq_gov_userspace = { - .name = "userspace", - .governor = cpufreq_governor_userspace, -@@ -99,6 +118,11 @@ struct cpufreq_governor cpufreq_gov_user - - static int __init cpufreq_gov_userspace_init(void) - { -+ unsigned int cpu; -+ -+ for_each_online_cpu(cpu) -+ per_cpu(cpu_set_freq, cpu) = userspace_cmdline_freq; -+ register_cpu_notifier(&cpufreq_userspace_cpu_nfb); - return cpufreq_register_governor(&cpufreq_gov_userspace); - } - __initcall(cpufreq_gov_userspace_init); -Index: xen-4.1.2-testing/xen/drivers/cpufreq/cpufreq_ondemand.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/drivers/cpufreq/cpufreq_ondemand.c -+++ xen-4.1.2-testing/xen/drivers/cpufreq/cpufreq_ondemand.c -@@ -296,7 +296,7 @@ int cpufreq_governor_dbs(struct cpufreq_ - return 0; - } - --static void __init cpufreq_dbs_handle_option(const char *name, const char *val) -+static bool_t __init cpufreq_dbs_handle_option(const char *name, const char *val) - { - if ( !strcmp(name, "rate") && val ) - { -@@ -334,6 +334,9 @@ static void __init cpufreq_dbs_handle_op - } - dbs_tuners_ins.powersave_bias = tmp; - } -+ else -+ return 0; -+ return 1; - } - - struct cpufreq_governor cpufreq_gov_dbs = { -Index: xen-4.1.2-testing/xen/include/acpi/cpufreq/cpufreq.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/acpi/cpufreq/cpufreq.h -+++ xen-4.1.2-testing/xen/include/acpi/cpufreq/cpufreq.h -@@ -93,7 +93,7 @@ struct cpufreq_governor { - char name[CPUFREQ_NAME_LEN]; - int (*governor)(struct cpufreq_policy *policy, - unsigned int event); -- void (*handle_option)(const char *name, const char *value); -+ bool_t (*handle_option)(const char *name, const char *value); - struct list_head governor_list; - }; - diff --git a/23308-xentrace_Move_the_global_variable_t_info_first_offset_into_calculate_tbuf_size.patch b/23308-xentrace_Move_the_global_variable_t_info_first_offset_into_calculate_tbuf_size.patch deleted file mode 100644 index ac398a1..0000000 --- a/23308-xentrace_Move_the_global_variable_t_info_first_offset_into_calculate_tbuf_size.patch +++ /dev/null @@ -1,72 +0,0 @@ -changeset: 23308:fb5313e64335 -user: Olaf Hering -date: Mon May 09 09:58:36 2011 +0100 -files: xen/common/trace.c -description: -xentrace: Move the global variable t_info_first_offset into calculate_tbuf_size() - -Move the global variable t_info_first_offset into -calculate_tbuf_size() because it is only used there. Change the type -from u32 to uint32_t to match type in other places. - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -55,7 +55,6 @@ static DEFINE_PER_CPU_READ_MOSTLY(struct - static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data); - static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock); - static u32 data_size; --static u32 t_info_first_offset __read_mostly; - - /* High water mark for trace buffers; */ - /* Send virtual interrupt when buffer level reaches this point */ -@@ -94,10 +93,10 @@ static struct notifier_block cpu_nfb = { - .notifier_call = cpu_callback - }; - --static void calc_tinfo_first_offset(void) -+static uint32_t calc_tinfo_first_offset(void) - { - int offset_in_bytes = offsetof(struct t_info, mfn_offset[NR_CPUS]); -- t_info_first_offset = fit_to_type(uint32_t, offset_in_bytes); -+ return fit_to_type(uint32_t, offset_in_bytes); - } - - /** -@@ -107,7 +106,7 @@ static void calc_tinfo_first_offset(void - * The t_info layout is fixed and cant be changed without breaking xentrace. - * Initialize t_info_pages based on number of trace pages. - */ --static int calculate_tbuf_size(unsigned int pages) -+static int calculate_tbuf_size(unsigned int pages, uint32_t t_info_first_offset) - { - struct t_buf dummy_size; - typeof(dummy_size.prod) max_size; -@@ -156,6 +155,7 @@ static int alloc_trace_bufs(unsigned int - int i, cpu, order; - /* Start after a fixed-size array of NR_CPUS */ - uint32_t *t_info_mfn_list; -+ uint32_t t_info_first_offset; - int offset; - - if ( t_info ) -@@ -165,9 +165,9 @@ static int alloc_trace_bufs(unsigned int - return -EINVAL; - - /* Calculate offset in u32 of first mfn */ -- calc_tinfo_first_offset(); -+ t_info_first_offset = calc_tinfo_first_offset(); - -- pages = calculate_tbuf_size(pages); -+ pages = calculate_tbuf_size(pages, t_info_first_offset); - order = get_order_from_pages(pages); - - t_info = alloc_xenheap_pages(get_order_from_pages(t_info_pages), 0); diff --git a/23309-xentrace_Mark_data_size___read_mostly_because_its_only_written_once.patch b/23309-xentrace_Mark_data_size___read_mostly_because_its_only_written_once.patch deleted file mode 100644 index 75720f5..0000000 --- a/23309-xentrace_Mark_data_size___read_mostly_because_its_only_written_once.patch +++ /dev/null @@ -1,27 +0,0 @@ -changeset: 23309:0ddcc8063690 -user: Olaf Hering -date: Mon May 09 09:59:13 2011 +0100 -files: xen/common/trace.c -description: -xentrace: Mark data_size __read_mostly because it's only written once - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -54,7 +54,7 @@ static unsigned int t_info_pages; - static DEFINE_PER_CPU_READ_MOSTLY(struct t_buf *, t_bufs); - static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data); - static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock); --static u32 data_size; -+static u32 data_size __read_mostly; - - /* High water mark for trace buffers; */ - /* Send virtual interrupt when buffer level reaches this point */ diff --git a/23310-xentrace_Remove_unneeded_cast_when_assigning_pointer_value_to_dst.patch b/23310-xentrace_Remove_unneeded_cast_when_assigning_pointer_value_to_dst.patch deleted file mode 100644 index 08d5bf0..0000000 --- a/23310-xentrace_Remove_unneeded_cast_when_assigning_pointer_value_to_dst.patch +++ /dev/null @@ -1,46 +0,0 @@ -changeset: 23310:b7ca55907bd3 -user: Olaf Hering -date: Mon May 09 09:59:50 2011 +0100 -files: xen/common/trace.c -description: -xentrace: Remove unneeded cast when assigning pointer value to dst - -Remove unneeded cast when assigning pointer value to dst. -Both arrays are uint32_t and memcpy takes a void pointer. - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -483,7 +483,7 @@ static inline void __insert_record(struc - const void *extra_data) - { - struct t_rec *rec; -- unsigned char *dst; -+ uint32_t *dst; - unsigned int extra_word = extra / sizeof(u32); - unsigned int local_rec_size = calc_rec_size(cycles, extra); - uint32_t next; -@@ -508,13 +508,13 @@ static inline void __insert_record(struc - - rec->event = event; - rec->extra_u32 = extra_word; -- dst = (unsigned char *)rec->u.nocycles.extra_u32; -+ dst = rec->u.nocycles.extra_u32; - if ( (rec->cycles_included = cycles) != 0 ) - { - u64 tsc = (u64)get_cycles(); - rec->u.cycles.cycles_lo = (uint32_t)tsc; - rec->u.cycles.cycles_hi = (uint32_t)(tsc >> 32); -- dst = (unsigned char *)rec->u.cycles.extra_u32; -+ dst = rec->u.cycles.extra_u32; - } - - if ( extra_data && extra ) diff --git a/23334-amd-fam12+14-vpmu.patch b/23334-amd-fam12+14-vpmu.patch deleted file mode 100644 index dcc7bd8..0000000 --- a/23334-amd-fam12+14-vpmu.patch +++ /dev/null @@ -1,40 +0,0 @@ -References: FATE#309902, FATE#309903 - -# HG changeset patch -# User Jacob Shin -# Date 1305188046 -3600 -# Node ID 23e33ea79cac0303c729d4e82905054cded16348 -# Parent fabdd682420c0c7b5e81f07f2f54211ebc11babe -hvm: vpmu: Enable HVM VPMU for AMD Family 12h and 14h processors - -HVM VPMU support can be enabled for AMD Family 12h and 14h processors -by taking the same code path as 10h. - -Signed-off-by: Jacob Shin - -Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/vpmu.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/vpmu.c -+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/vpmu.c -@@ -317,6 +317,8 @@ static void amd_vpmu_initialise(struct v - k7_counters_mirrored = 1; - break; - case 0x10: -+ case 0x12: -+ case 0x14: - default: - num_counters = F10H_NUM_COUNTERS; - counters = AMD_F10H_COUNTERS; -Index: xen-4.1.2-testing/xen/arch/x86/hvm/vpmu.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/hvm/vpmu.c -+++ xen-4.1.2-testing/xen/arch/x86/hvm/vpmu.c -@@ -101,6 +101,8 @@ void vpmu_initialise(struct vcpu *v) - switch ( family ) - { - case 0x10: -+ case 0x12: -+ case 0x14: - case 0x15: - vpmu->arch_vpmu_ops = &amd_vpmu_ops; - break; diff --git a/23383-libxc-rm-static-vars.patch b/23383-libxc-rm-static-vars.patch deleted file mode 100644 index 0334afb..0000000 --- a/23383-libxc-rm-static-vars.patch +++ /dev/null @@ -1,78 +0,0 @@ -# HG changeset patch -# User Ian Campbell -# Date 1306228450 -3600 -# Node ID 23b423a3955785c9a8679c3a877c3472066a2e1f -# Parent ba8da39c67298b19c2c277e5794981b7f23bedf2 -libxc: save/restore: remove static context variables - -20544:ad9d75d74bd5 and 20545:cc7d66ba0dad seemingly intended to change these -global static variables into stack variables but didn't remove the static -qualifier. - -Also zero the entire struct once with memset rather than clearing fields -piecemeal in two different places. - -Signed-off-by: Ian Campbell -Acked-by: Ian Jackson -Committed-by: Ian Jackson -Acked-by: Vincent Hanquez - -Index: xen-4.1.3-testing/tools/libxc/xc_domain_restore.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_domain_restore.c -+++ xen-4.1.3-testing/tools/libxc/xc_domain_restore.c -@@ -1145,23 +1145,19 @@ int xc_domain_restore(xc_interface *xch, - - int orig_io_fd_flags; - -- static struct restore_ctx _ctx = { -- .live_p2m = NULL, -- .p2m = NULL, -- }; -- static struct restore_ctx *ctx = &_ctx; -+ struct restore_ctx _ctx; -+ struct restore_ctx *ctx = &_ctx; - struct domain_info_context *dinfo = &ctx->dinfo; - - pagebuf_init(&pagebuf); - memset(&tailbuf, 0, sizeof(tailbuf)); - tailbuf.ishvm = hvm; - -- /* For info only */ -- ctx->nr_pfns = 0; -- - if ( superpages ) - return 1; - -+ memset(ctx, 0, sizeof(*ctx)); -+ - ctxt = xc_hypercall_buffer_alloc(xch, ctxt, sizeof(*ctxt)); - - if ( ctxt == NULL ) -Index: xen-4.1.3-testing/tools/libxc/xc_domain_save.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_domain_save.c -+++ xen-4.1.3-testing/tools/libxc/xc_domain_save.c -@@ -958,11 +958,8 @@ int xc_domain_save(xc_interface *xch, in - unsigned long mfn; - - struct outbuf ob; -- static struct save_ctx _ctx = { -- .live_p2m = NULL, -- .live_m2p = NULL, -- }; -- static struct save_ctx *ctx = &_ctx; -+ struct save_ctx _ctx; -+ struct save_ctx *ctx = &_ctx; - struct domain_info_context *dinfo = &ctx->dinfo; - - int completed = 0; -@@ -976,6 +973,8 @@ int xc_domain_save(xc_interface *xch, in - - outbuf_init(xch, &ob, OUTBUF_SIZE); - -+ memset(ctx, 0, sizeof(*ctx)); -+ - /* If no explicit control parameters given, use defaults */ - max_iters = max_iters ? : DEF_MAX_ITERS; - max_factor = max_factor ? : DEF_MAX_FACTOR; diff --git a/23404-xentrace_reduce_trace_buffer_size_to_something_mfn_offset_can_reach.patch b/23404-xentrace_reduce_trace_buffer_size_to_something_mfn_offset_can_reach.patch deleted file mode 100644 index 3a5c848..0000000 --- a/23404-xentrace_reduce_trace_buffer_size_to_something_mfn_offset_can_reach.patch +++ /dev/null @@ -1,61 +0,0 @@ -changeset: 23404:dd0eb070ee44 -user: Olaf Hering -date: Thu May 26 12:34:44 2011 +0100 -files: xen/common/trace.c -description: -xentrace: reduce trace buffer size to something mfn_offset can reach - -The start of the array which holds the list of mfns for each cpus -tracebuffer is stored in an unsigned short. This limits the total -amount of pages for each cpu as the number of active cpus increases. - -Update the math in calculate_tbuf_size() to apply also this rule to -the max number of trace pages. Without this change the index can -overflow. - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -112,11 +112,14 @@ static int calculate_tbuf_size(unsigned - typeof(dummy_size.prod) max_size; - struct t_info dummy_pages; - typeof(dummy_pages.tbuf_size) max_pages; -+ typeof(dummy_pages.mfn_offset[0]) max_mfn_offset; -+ unsigned int max_cpus = num_online_cpus(); - unsigned int t_info_words; - - /* force maximum value for an unsigned type */ - max_size = -1; - max_pages = -1; -+ max_mfn_offset = -1; - - /* max size holds up to n pages */ - max_size /= PAGE_SIZE; -@@ -124,6 +127,18 @@ static int calculate_tbuf_size(unsigned - if ( max_size < max_pages ) - max_pages = max_size; - -+ /* -+ * max mfn_offset holds up to n pages per cpu -+ * The array of mfns for the highest cpu can start at the maximum value -+ * mfn_offset can hold. So reduce the number of cpus and also the mfn_offset. -+ */ -+ max_mfn_offset -= t_info_first_offset - 1; -+ max_cpus--; -+ if ( max_cpus ) -+ max_mfn_offset /= max_cpus; -+ if ( max_mfn_offset < max_pages ) -+ max_pages = max_mfn_offset; -+ - if ( pages > max_pages ) - { - printk(XENLOG_INFO "xentrace: requested number of %u pages " diff --git a/23405-xentrace_fix_type_of_offset_to_avoid_ouf-of-bounds_access.patch b/23405-xentrace_fix_type_of_offset_to_avoid_ouf-of-bounds_access.patch deleted file mode 100644 index 08d4c8d..0000000 --- a/23405-xentrace_fix_type_of_offset_to_avoid_ouf-of-bounds_access.patch +++ /dev/null @@ -1,52 +0,0 @@ -changeset: 23405:3057b531d905 -user: Olaf Hering -date: Thu May 26 12:35:30 2011 +0100 -files: xen/common/trace.c -description: -xentrace: fix type of offset to avoid ouf-of-bounds access - -Update the type of the local offset variable to match the type where -this variable is stored. Also update the type of t_info_first_offset -because it has also a limited range. - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -106,7 +106,7 @@ static uint32_t calc_tinfo_first_offset( - * The t_info layout is fixed and cant be changed without breaking xentrace. - * Initialize t_info_pages based on number of trace pages. - */ --static int calculate_tbuf_size(unsigned int pages, uint32_t t_info_first_offset) -+static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset) - { - struct t_buf dummy_size; - typeof(dummy_size.prod) max_size; -@@ -170,8 +170,8 @@ static int alloc_trace_bufs(unsigned int - int i, cpu, order; - /* Start after a fixed-size array of NR_CPUS */ - uint32_t *t_info_mfn_list; -- uint32_t t_info_first_offset; -- int offset; -+ uint16_t t_info_first_offset; -+ uint16_t offset; - - if ( t_info ) - return -EBUSY; -@@ -179,7 +179,7 @@ static int alloc_trace_bufs(unsigned int - if ( pages == 0 ) - return -EINVAL; - -- /* Calculate offset in u32 of first mfn */ -+ /* Calculate offset in units of u32 of first mfn */ - t_info_first_offset = calc_tinfo_first_offset(); - - pages = calculate_tbuf_size(pages, t_info_first_offset); diff --git a/23406-xentrace_update___insert_record_to_copy_the_trace_record_to_individual_mfns.patch b/23406-xentrace_update___insert_record_to_copy_the_trace_record_to_individual_mfns.patch deleted file mode 100644 index 05a526c..0000000 --- a/23406-xentrace_update___insert_record_to_copy_the_trace_record_to_individual_mfns.patch +++ /dev/null @@ -1,153 +0,0 @@ -changeset: 23406:956438803307 -user: Olaf Hering -date: Thu May 26 12:36:03 2011 +0100 -files: xen/common/trace.c -description: -xentrace: update __insert_record() to copy the trace record to individual mfns - -Update __insert_record() to copy the trace record to individual mfns. -This is a prereq before changing the per-cpu allocation from -contiguous to non-contiguous allocation. - -v2: - update offset calculation to use shift and mask - update type of mfn_offset to match type of data source - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 71 +++++++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 55 insertions(+), 16 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -52,7 +52,6 @@ static struct t_info *t_info; - static unsigned int t_info_pages; - - static DEFINE_PER_CPU_READ_MOSTLY(struct t_buf *, t_bufs); --static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data); - static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock); - static u32 data_size __read_mostly; - -@@ -208,7 +207,6 @@ static int alloc_trace_bufs(unsigned int - - per_cpu(t_bufs, cpu) = buf = rawbuf; - buf->cons = buf->prod = 0; -- per_cpu(t_data, cpu) = (unsigned char *)(buf + 1); - } - - offset = t_info_first_offset; -@@ -472,10 +470,16 @@ static inline u32 calc_bytes_avail(const - return data_size - calc_unconsumed_bytes(buf); - } - --static inline struct t_rec *next_record(const struct t_buf *buf, -- uint32_t *next) -+static unsigned char *next_record(const struct t_buf *buf, uint32_t *next, -+ unsigned char **next_page, -+ uint32_t *offset_in_page) - { - u32 x = buf->prod, cons = buf->cons; -+ uint16_t per_cpu_mfn_offset; -+ uint32_t per_cpu_mfn_nr; -+ uint32_t *mfn_list; -+ uint32_t mfn; -+ unsigned char *this_page; - - barrier(); /* must read buf->prod and buf->cons only once */ - *next = x; -@@ -487,7 +491,27 @@ static inline struct t_rec *next_record( - - ASSERT(x < data_size); - -- return (struct t_rec *)&this_cpu(t_data)[x]; -+ /* add leading header to get total offset of next record */ -+ x += sizeof(struct t_buf); -+ *offset_in_page = x & ~PAGE_MASK; -+ -+ /* offset into array of mfns */ -+ per_cpu_mfn_nr = x >> PAGE_SHIFT; -+ per_cpu_mfn_offset = t_info->mfn_offset[smp_processor_id()]; -+ mfn_list = (uint32_t *)t_info; -+ mfn = mfn_list[per_cpu_mfn_offset + per_cpu_mfn_nr]; -+ this_page = mfn_to_virt(mfn); -+ if (per_cpu_mfn_nr + 1 >= opt_tbuf_size) -+ { -+ /* reached end of buffer? */ -+ *next_page = NULL; -+ } -+ else -+ { -+ mfn = mfn_list[per_cpu_mfn_offset + per_cpu_mfn_nr + 1]; -+ *next_page = mfn_to_virt(mfn); -+ } -+ return this_page; - } - - static inline void __insert_record(struct t_buf *buf, -@@ -497,28 +521,37 @@ static inline void __insert_record(struc - unsigned int rec_size, - const void *extra_data) - { -- struct t_rec *rec; -+ struct t_rec split_rec, *rec; - uint32_t *dst; -+ unsigned char *this_page, *next_page; - unsigned int extra_word = extra / sizeof(u32); - unsigned int local_rec_size = calc_rec_size(cycles, extra); - uint32_t next; -+ uint32_t offset; -+ uint32_t remaining; - - BUG_ON(local_rec_size != rec_size); - BUG_ON(extra & 3); - -- rec = next_record(buf, &next); -- if ( !rec ) -+ this_page = next_record(buf, &next, &next_page, &offset); -+ if ( !this_page ) - return; -- /* Double-check once more that we have enough space. -- * Don't bugcheck here, in case the userland tool is doing -- * something stupid. */ -- if ( (unsigned char *)rec + rec_size > this_cpu(t_data) + data_size ) -+ -+ remaining = PAGE_SIZE - offset; -+ -+ if ( unlikely(rec_size > remaining) ) - { -- if ( printk_ratelimit() ) -+ if ( next_page == NULL ) -+ { -+ /* access beyond end of buffer */ - printk(XENLOG_WARNING -- "%s: size=%08x prod=%08x cons=%08x rec=%u\n", -- __func__, data_size, next, buf->cons, rec_size); -- return; -+ "%s: size=%08x prod=%08x cons=%08x rec=%u remaining=%u\n", -+ __func__, data_size, next, buf->cons, rec_size, remaining); -+ return; -+ } -+ rec = &split_rec; -+ } else { -+ rec = (struct t_rec*)(this_page + offset); - } - - rec->event = event; -@@ -535,6 +568,12 @@ static inline void __insert_record(struc - if ( extra_data && extra ) - memcpy(dst, extra_data, extra); - -+ if ( unlikely(rec_size > remaining) ) -+ { -+ memcpy(this_page + offset, rec, remaining); -+ memcpy(next_page, (char *)rec + remaining, rec_size - remaining); -+ } -+ - wmb(); - - next += rec_size; diff --git a/23407-xentrace_allocate_non-contiguous_per-cpu_trace_buffers.patch b/23407-xentrace_allocate_non-contiguous_per-cpu_trace_buffers.patch deleted file mode 100644 index 000a9da..0000000 --- a/23407-xentrace_allocate_non-contiguous_per-cpu_trace_buffers.patch +++ /dev/null @@ -1,155 +0,0 @@ -changeset: 23407:b19898ac3e32 -user: Olaf Hering -date: Thu May 26 12:36:27 2011 +0100 -files: xen/common/trace.c -description: -xentrace: allocate non-contiguous per-cpu trace buffers - -Signed-off-by: Olaf Hering -Acked-by: George Dunlap - - ---- - xen/common/trace.c | 92 ++++++++++++++++++++++++++++------------------------- - 1 file changed, 50 insertions(+), 42 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -166,7 +166,7 @@ static int calculate_tbuf_size(unsigned - */ - static int alloc_trace_bufs(unsigned int pages) - { -- int i, cpu, order; -+ int i, cpu; - /* Start after a fixed-size array of NR_CPUS */ - uint32_t *t_info_mfn_list; - uint16_t t_info_first_offset; -@@ -182,34 +182,11 @@ static int alloc_trace_bufs(unsigned int - t_info_first_offset = calc_tinfo_first_offset(); - - pages = calculate_tbuf_size(pages, t_info_first_offset); -- order = get_order_from_pages(pages); - - t_info = alloc_xenheap_pages(get_order_from_pages(t_info_pages), 0); - if ( t_info == NULL ) -- goto out_dealloc; -+ goto out_dealloc_t_info; - -- /* -- * First, allocate buffers for all of the cpus. If any -- * fails, deallocate what you have so far and exit. -- */ -- for_each_online_cpu(cpu) -- { -- void *rawbuf; -- struct t_buf *buf; -- -- if ( (rawbuf = alloc_xenheap_pages( -- order, MEMF_bits(32 + PAGE_SHIFT))) == NULL ) -- { -- printk(XENLOG_INFO "xentrace: memory allocation failed " -- "on cpu %d\n", cpu); -- goto out_dealloc; -- } -- -- per_cpu(t_bufs, cpu) = buf = rawbuf; -- buf->cons = buf->prod = 0; -- } -- -- offset = t_info_first_offset; - t_info_mfn_list = (uint32_t *)t_info; - - for(i = 0; i < t_info_pages; i++) -@@ -219,27 +196,53 @@ static int alloc_trace_bufs(unsigned int - t_info->tbuf_size = pages; - - /* -- * Now share the pages so xentrace can map them, and write them in -- * the global t_info structure. -+ * Allocate buffers for all of the cpus. -+ * If any fails, deallocate what you have so far and exit. - */ - for_each_online_cpu(cpu) - { -- void *rawbuf = per_cpu(t_bufs, cpu); -- struct page_info *p = virt_to_page(rawbuf); -- uint32_t mfn = virt_to_mfn(rawbuf); -+ offset = t_info_first_offset + (cpu * pages); -+ t_info->mfn_offset[cpu] = offset; - - for ( i = 0; i < pages; i++ ) - { -- share_xen_page_with_privileged_guests(p + i, XENSHARE_writable); -- -- t_info_mfn_list[offset + i]=mfn + i; -+ void *p = alloc_xenheap_pages(0, MEMF_bits(32 + PAGE_SHIFT)); -+ if ( !p ) -+ { -+ printk(XENLOG_INFO "xentrace: memory allocation failed " -+ "on cpu %d after %d pages\n", cpu, i); -+ t_info_mfn_list[offset + i] = 0; -+ goto out_dealloc; -+ } -+ t_info_mfn_list[offset + i] = virt_to_mfn(p); - } -- t_info->mfn_offset[cpu]=offset; -- printk(XENLOG_INFO "xentrace: p%d mfn %"PRIx32" offset %d\n", -- cpu, mfn, offset); -- offset+=i; -+ } -+ -+ /* -+ * Initialize buffers for all of the cpus. -+ */ -+ for_each_online_cpu(cpu) -+ { -+ struct t_buf *buf; -+ struct page_info *pg; - - spin_lock_init(&per_cpu(t_lock, cpu)); -+ -+ offset = t_info->mfn_offset[cpu]; -+ -+ /* Initialize the buffer metadata */ -+ per_cpu(t_bufs, cpu) = buf = mfn_to_virt(t_info_mfn_list[offset]); -+ buf->cons = buf->prod = 0; -+ -+ printk(XENLOG_INFO "xentrace: p%d mfn %x offset %u\n", -+ cpu, t_info_mfn_list[offset], offset); -+ -+ /* Now share the trace pages */ -+ for ( i = 0; i < pages; i++ ) -+ { -+ pg = mfn_to_page(t_info_mfn_list[offset + i]); -+ share_xen_page_with_privileged_guests(pg, XENSHARE_writable); -+ } - } - - data_size = (pages * PAGE_SIZE - sizeof(struct t_buf)); -@@ -255,14 +258,19 @@ static int alloc_trace_bufs(unsigned int - out_dealloc: - for_each_online_cpu(cpu) - { -- void *rawbuf = per_cpu(t_bufs, cpu); -- per_cpu(t_bufs, cpu) = NULL; -- if ( rawbuf ) -+ offset = t_info->mfn_offset[cpu]; -+ if ( !offset ) -+ continue; -+ for ( i = 0; i < pages; i++ ) - { -- ASSERT(!(virt_to_page(rawbuf)->count_info & PGC_allocated)); -- free_xenheap_pages(rawbuf, order); -+ uint32_t mfn = t_info_mfn_list[offset + i]; -+ if ( !mfn ) -+ break; -+ ASSERT(!(mfn_to_page(mfn)->count_info & PGC_allocated)); -+ free_xenheap_pages(mfn_to_virt(mfn), 0); - } - } -+out_dealloc_t_info: - free_xenheap_pages(t_info, get_order_from_pages(t_info_pages)); - t_info = NULL; - printk(XENLOG_WARNING "xentrace: allocation failed! Tracing disabled.\n"); diff --git a/23462-libxc-cpu-feature.patch b/23462-libxc-cpu-feature.patch deleted file mode 100644 index c183964..0000000 --- a/23462-libxc-cpu-feature.patch +++ /dev/null @@ -1,288 +0,0 @@ -References: FATE#311951 - -# HG changeset patch -# User Keir Fraser -# Date 1307023264 -3600 -# Node ID 4804af7048cafecfc014c30cfea374eb0a0360e8 -# Parent 5839e797a1307fceffcd0b9ad35ed31644378b47 -libxc: Simplify and clean up xc_cpufeature.h - - * Remove Linux-private defns with no direct relation to CPUID - * Remove word offsets into Linux-defined cpu_caps array - * Hard tabs -> soft tabs - -Signed-off-by: Keir Fraser - -# HG changeset patch -# User Keir Fraser -# Date 1307118421 -3600 -# Node ID bcd2476c2e2d00dc6371e52fbff66fe3178b7944 -# Parent 55c5eff9bf84d4c5f3463c01f038edc1c46f30bc -libxc: Don't refer to meaningless 'word offsets' in xc_cpufeature.h - -Signed-off-by: Keir Fraser - -Index: xen-4.1.2-testing/tools/libxc/xc_cpufeature.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_cpufeature.h -+++ xen-4.1.2-testing/tools/libxc/xc_cpufeature.h -@@ -17,134 +17,115 @@ - #ifndef __LIBXC_CPUFEATURE_H - #define __LIBXC_CPUFEATURE_H - --/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */ --#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */ --#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */ --#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */ --#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */ --#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */ --#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */ --#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */ --#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */ --#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */ --#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */ --#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */ --#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */ --#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */ --#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */ --#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */ --#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */ --#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */ --#define X86_FEATURE_PN (0*32+18) /* Processor serial number */ --#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */ --#define X86_FEATURE_DS (0*32+21) /* Debug Store */ --#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */ --#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */ --#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */ -- /* of FPU context), and CR4.OSFXSR available */ --#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */ --#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */ --#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */ --#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */ --#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */ --#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */ --#define X86_FEATURE_PBE (0*32+31) /* Pending Break Enable */ -+/* Intel-defined CPU features, CPUID level 0x00000001 (edx) */ -+#define X86_FEATURE_FPU 0 /* Onboard FPU */ -+#define X86_FEATURE_VME 1 /* Virtual Mode Extensions */ -+#define X86_FEATURE_DE 2 /* Debugging Extensions */ -+#define X86_FEATURE_PSE 3 /* Page Size Extensions */ -+#define X86_FEATURE_TSC 4 /* Time Stamp Counter */ -+#define X86_FEATURE_MSR 5 /* Model-Specific Registers, RDMSR, WRMSR */ -+#define X86_FEATURE_PAE 6 /* Physical Address Extensions */ -+#define X86_FEATURE_MCE 7 /* Machine Check Architecture */ -+#define X86_FEATURE_CX8 8 /* CMPXCHG8 instruction */ -+#define X86_FEATURE_APIC 9 /* Onboard APIC */ -+#define X86_FEATURE_SEP 11 /* SYSENTER/SYSEXIT */ -+#define X86_FEATURE_MTRR 12 /* Memory Type Range Registers */ -+#define X86_FEATURE_PGE 13 /* Page Global Enable */ -+#define X86_FEATURE_MCA 14 /* Machine Check Architecture */ -+#define X86_FEATURE_CMOV 15 /* CMOV instruction */ -+#define X86_FEATURE_PAT 16 /* Page Attribute Table */ -+#define X86_FEATURE_PSE36 17 /* 36-bit PSEs */ -+#define X86_FEATURE_PN 18 /* Processor serial number */ -+#define X86_FEATURE_CLFLSH 19 /* Supports the CLFLUSH instruction */ -+#define X86_FEATURE_DS 21 /* Debug Store */ -+#define X86_FEATURE_ACPI 22 /* ACPI via MSR */ -+#define X86_FEATURE_MMX 23 /* Multimedia Extensions */ -+#define X86_FEATURE_FXSR 24 /* FXSAVE and FXRSTOR instructions */ -+#define X86_FEATURE_XMM 25 /* Streaming SIMD Extensions */ -+#define X86_FEATURE_XMM2 26 /* Streaming SIMD Extensions-2 */ -+#define X86_FEATURE_SELFSNOOP 27 /* CPU self snoop */ -+#define X86_FEATURE_HT 28 /* Hyper-Threading */ -+#define X86_FEATURE_ACC 29 /* Automatic clock control */ -+#define X86_FEATURE_IA64 30 /* IA-64 processor */ -+#define X86_FEATURE_PBE 31 /* Pending Break Enable */ - --/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ -+/* AMD-defined CPU features, CPUID level 0x80000001 */ - /* Don't duplicate feature flags which are redundant with Intel! */ --#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */ --#define X86_FEATURE_MP (1*32+19) /* MP Capable. */ --#define X86_FEATURE_NX (1*32+20) /* Execute Disable */ --#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ --#define X86_FEATURE_FFXSR (1*32+25) /* FFXSR instruction optimizations */ --#define X86_FEATURE_PAGE1GB (1*32+26) /* 1Gb large page support */ --#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */ --#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ --#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ --#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */ -- --/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ --#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */ --#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */ --#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */ -- --/* Other features, Linux-defined mapping, word 3 */ --/* This range is used for feature bits which conflict or are synthesized */ --#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */ --#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */ --#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ --#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ --/* cpu types for specific tunings: */ --#define X86_FEATURE_K8 (3*32+ 4) /* Opteron, Athlon64 */ --#define X86_FEATURE_K7 (3*32+ 5) /* Athlon */ --#define X86_FEATURE_P3 (3*32+ 6) /* P3 */ --#define X86_FEATURE_P4 (3*32+ 7) /* P4 */ --#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */ -- --/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ --#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ --#define X86_FEATURE_PCLMULQDQ (4*32+ 1) /* Carry-less multiplication */ --#define X86_FEATURE_DTES64 (4*32+ 2) /* 64-bit Debug Store */ --#define X86_FEATURE_MWAIT (4*32+ 3) /* Monitor/Mwait support */ --#define X86_FEATURE_DSCPL (4*32+ 4) /* CPL Qualified Debug Store */ --#define X86_FEATURE_VMXE (4*32+ 5) /* Virtual Machine Extensions */ --#define X86_FEATURE_SMXE (4*32+ 6) /* Safer Mode Extensions */ --#define X86_FEATURE_EST (4*32+ 7) /* Enhanced SpeedStep */ --#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */ --#define X86_FEATURE_SSSE3 (4*32+ 9) /* Supplemental Streaming SIMD Extensions-3 */ --#define X86_FEATURE_CID (4*32+10) /* Context ID */ --#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ --#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ --#define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */ --#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */ --#define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */ --#define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ --#define X86_FEATURE_X2APIC (4*32+21) /* x2APIC */ --#define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ --#define X86_FEATURE_TSC_DEADLINE (4*32+24) /* "tdt" TSC Deadline Timer */ --#define X86_FEATURE_AES (4*32+25) /* AES acceleration instructions */ --#define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */ --#define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */ --#define X86_FEATURE_F16C (4*32+29) /* Half-precision convert instruction */ --#define X86_FEATURE_RDRAND (4*32+30) /* Digital Random Number Generator */ --#define X86_FEATURE_HYPERVISOR (4*32+31) /* Running under some hypervisor */ -- --/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ --#define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */ --#define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */ --#define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */ --#define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */ --#define X86_FEATURE_ACE2 (5*32+ 8) /* Advanced Cryptography Engine v2 */ --#define X86_FEATURE_ACE2_EN (5*32+ 9) /* ACE v2 enabled */ --#define X86_FEATURE_PHE (5*32+ 10) /* PadLock Hash Engine */ --#define X86_FEATURE_PHE_EN (5*32+ 11) /* PHE enabled */ --#define X86_FEATURE_PMM (5*32+ 12) /* PadLock Montgomery Multiplier */ --#define X86_FEATURE_PMM_EN (5*32+ 13) /* PMM enabled */ -- --/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */ --#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */ --#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */ --#define X86_FEATURE_SVM (6*32+ 2) /* Secure virtual machine */ --#define X86_FEATURE_EXTAPIC (6*32+ 3) /* Extended APIC space */ --#define X86_FEATURE_CR8_LEGACY (6*32+ 4) /* CR8 in 32-bit mode */ --#define X86_FEATURE_ABM (6*32+ 5) /* Advanced bit manipulation */ --#define X86_FEATURE_SSE4A (6*32+ 6) /* SSE-4A */ --#define X86_FEATURE_MISALIGNSSE (6*32+ 7) /* Misaligned SSE mode */ --#define X86_FEATURE_3DNOWPREFETCH (6*32+ 8) /* 3DNow prefetch instructions */ --#define X86_FEATURE_OSVW (6*32+ 9) /* OS Visible Workaround */ --#define X86_FEATURE_IBS (6*32+10) /* Instruction Based Sampling */ --#define X86_FEATURE_XOP (6*32+11) /* extended AVX instructions */ --#define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */ --#define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */ --#define X86_FEATURE_LWP (6*32+15) /* Light Weight Profiling */ --#define X86_FEATURE_FMA4 (6*32+16) /* 4 operands MAC instructions */ --#define X86_FEATURE_NODEID_MSR (6*32+19) /* NodeId MSR */ --#define X86_FEATURE_TBM (6*32+21) /* trailing bit manipulations */ --#define X86_FEATURE_TOPOEXT (6*32+22) /* topology extensions CPUID leafs */ -- --/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ --#define X86_FEATURE_FSGSBASE (7*32+ 0) /* {RD,WR}{FS,GS}BASE instructions */ --#define X86_FEATURE_SMEP (7*32+ 7) /* Supervisor Mode Execution Protection */ --#define X86_FEATURE_ERMS (7*32+ 9) /* Enhanced REP MOVSB/STOSB */ -+#define X86_FEATURE_SYSCALL 11 /* SYSCALL/SYSRET */ -+#define X86_FEATURE_MP 19 /* MP Capable. */ -+#define X86_FEATURE_NX 20 /* Execute Disable */ -+#define X86_FEATURE_MMXEXT 22 /* AMD MMX extensions */ -+#define X86_FEATURE_FFXSR 25 /* FFXSR instruction optimizations */ -+#define X86_FEATURE_PAGE1GB 26 /* 1Gb large page support */ -+#define X86_FEATURE_RDTSCP 27 /* RDTSCP */ -+#define X86_FEATURE_LM 29 /* Long Mode (x86-64) */ -+#define X86_FEATURE_3DNOWEXT 30 /* AMD 3DNow! extensions */ -+#define X86_FEATURE_3DNOW 31 /* 3DNow! */ -+ -+/* Intel-defined CPU features, CPUID level 0x00000001 (ecx) */ -+#define X86_FEATURE_XMM3 0 /* Streaming SIMD Extensions-3 */ -+#define X86_FEATURE_PCLMULQDQ 1 /* Carry-less multiplication */ -+#define X86_FEATURE_DTES64 2 /* 64-bit Debug Store */ -+#define X86_FEATURE_MWAIT 3 /* Monitor/Mwait support */ -+#define X86_FEATURE_DSCPL 4 /* CPL Qualified Debug Store */ -+#define X86_FEATURE_VMXE 5 /* Virtual Machine Extensions */ -+#define X86_FEATURE_SMXE 6 /* Safer Mode Extensions */ -+#define X86_FEATURE_EST 7 /* Enhanced SpeedStep */ -+#define X86_FEATURE_TM2 8 /* Thermal Monitor 2 */ -+#define X86_FEATURE_SSSE3 9 /* Supplemental Streaming SIMD Exts-3 */ -+#define X86_FEATURE_CID 10 /* Context ID */ -+#define X86_FEATURE_CX16 13 /* CMPXCHG16B */ -+#define X86_FEATURE_XTPR 14 /* Send Task Priority Messages */ -+#define X86_FEATURE_PDCM 15 /* Perf/Debug Capability MSR */ -+#define X86_FEATURE_DCA 18 /* Direct Cache Access */ -+#define X86_FEATURE_SSE4_1 19 /* Streaming SIMD Extensions 4.1 */ -+#define X86_FEATURE_SSE4_2 20 /* Streaming SIMD Extensions 4.2 */ -+#define X86_FEATURE_X2APIC 21 /* x2APIC */ -+#define X86_FEATURE_POPCNT 23 /* POPCNT instruction */ -+#define X86_FEATURE_TSC_DEADLINE 24 /* "tdt" TSC Deadline Timer */ -+#define X86_FEATURE_AES 25 /* AES acceleration instructions */ -+#define X86_FEATURE_XSAVE 26 /* XSAVE/XRSTOR/XSETBV/XGETBV */ -+#define X86_FEATURE_AVX 28 /* Advanced Vector Extensions */ -+#define X86_FEATURE_F16C 29 /* Half-precision convert instruction */ -+#define X86_FEATURE_RDRAND 30 /* Digital Random Number Generator */ -+#define X86_FEATURE_HYPERVISOR 31 /* Running under some hypervisor */ -+ -+/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001 */ -+#define X86_FEATURE_XSTORE 2 /* on-CPU RNG present (xstore insn) */ -+#define X86_FEATURE_XSTORE_EN 3 /* on-CPU RNG enabled */ -+#define X86_FEATURE_XCRYPT 6 /* on-CPU crypto (xcrypt insn) */ -+#define X86_FEATURE_XCRYPT_EN 7 /* on-CPU crypto enabled */ -+#define X86_FEATURE_ACE2 8 /* Advanced Cryptography Engine v2 */ -+#define X86_FEATURE_ACE2_EN 9 /* ACE v2 enabled */ -+#define X86_FEATURE_PHE 10 /* PadLock Hash Engine */ -+#define X86_FEATURE_PHE_EN 11 /* PHE enabled */ -+#define X86_FEATURE_PMM 12 /* PadLock Montgomery Multiplier */ -+#define X86_FEATURE_PMM_EN 13 /* PMM enabled */ -+ -+/* More extended AMD flags: CPUID level 0x80000001, ecx */ -+#define X86_FEATURE_LAHF_LM 0 /* LAHF/SAHF in long mode */ -+#define X86_FEATURE_CMP_LEGACY 1 /* If yes HyperThreading not valid */ -+#define X86_FEATURE_SVM 2 /* Secure virtual machine */ -+#define X86_FEATURE_EXTAPIC 3 /* Extended APIC space */ -+#define X86_FEATURE_CR8_LEGACY 4 /* CR8 in 32-bit mode */ -+#define X86_FEATURE_ABM 5 /* Advanced bit manipulation */ -+#define X86_FEATURE_SSE4A 6 /* SSE-4A */ -+#define X86_FEATURE_MISALIGNSSE 7 /* Misaligned SSE mode */ -+#define X86_FEATURE_3DNOWPREFETCH 8 /* 3DNow prefetch instructions */ -+#define X86_FEATURE_OSVW 9 /* OS Visible Workaround */ -+#define X86_FEATURE_IBS 10 /* Instruction Based Sampling */ -+#define X86_FEATURE_XOP 11 /* extended AVX instructions */ -+#define X86_FEATURE_SKINIT 12 /* SKINIT/STGI instructions */ -+#define X86_FEATURE_WDT 13 /* Watchdog timer */ -+#define X86_FEATURE_LWP 15 /* Light Weight Profiling */ -+#define X86_FEATURE_FMA4 16 /* 4 operands MAC instructions */ -+#define X86_FEATURE_NODEID_MSR 19 /* NodeId MSR */ -+#define X86_FEATURE_TBM 21 /* trailing bit manipulations */ -+#define X86_FEATURE_TOPOEXT 22 /* topology extensions CPUID leafs */ -+ -+/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx) */ -+#define X86_FEATURE_FSGSBASE 0 /* {RD,WR}{FS,GS}BASE instructions */ -+#define X86_FEATURE_SMEP 7 /* Supervisor Mode Execution Protection */ -+#define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */ - - #endif /* __LIBXC_CPUFEATURE_H */ -Index: xen-4.1.2-testing/tools/libxc/xc_cpuid_x86.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_cpuid_x86.c -+++ xen-4.1.2-testing/tools/libxc/xc_cpuid_x86.c -@@ -25,9 +25,9 @@ - #include "xc_cpufeature.h" - #include - --#define bitmaskof(idx) (1u << ((idx) & 31)) --#define clear_bit(idx, dst) ((dst) &= ~(1u << ((idx) & 31))) --#define set_bit(idx, dst) ((dst) |= (1u << ((idx) & 31))) -+#define bitmaskof(idx) (1u << (idx)) -+#define clear_bit(idx, dst) ((dst) &= ~(1u << (idx))) -+#define set_bit(idx, dst) ((dst) |= (1u << (idx))) - - #define DEF_MAX_BASE 0x0000000du - #define DEF_MAX_EXT 0x80000008u diff --git a/23506-x86_Disable_set_gpfn_from_mfn_until_m2p_table_is_allocated..patch b/23506-x86_Disable_set_gpfn_from_mfn_until_m2p_table_is_allocated..patch deleted file mode 100644 index 0609398..0000000 --- a/23506-x86_Disable_set_gpfn_from_mfn_until_m2p_table_is_allocated..patch +++ /dev/null @@ -1,80 +0,0 @@ -changeset: 23506:d1309a79bde8 -user: Keir Fraser -date: Fri Jun 10 08:18:33 2011 +0100 -files: xen/arch/x86/x86_64/mm.c xen/include/asm-x86/mm.h -description: -x86: Disable set_gpfn_from_mfn until m2p table is allocated. - -This is a prerequisite for calling set_gpfn_from_mfn() unconditionally -from free_heap_pages(). - -Signed-off-by: Keir Fraser - - ---- - xen/arch/x86/x86_64/mm.c | 4 ++++ - xen/include/asm-x86/mm.h | 15 +++++++++++++-- - 2 files changed, 17 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mm.c -+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c -@@ -47,6 +47,8 @@ unsigned int __read_mostly pfn_pdx_hole_ - - unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START; - -+bool_t __read_mostly machine_to_phys_mapping_valid = 0; -+ - /* Top-level master (and idle-domain) page directory. */ - l4_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) - idle_pg_table[L4_PAGETABLE_ENTRIES]; -@@ -800,6 +802,8 @@ void __init paging_init(void) - #undef CNT - #undef MFN - -+ machine_to_phys_mapping_valid = 1; -+ - /* Set up linear page table mapping. */ - l4e_write(&idle_pg_table[l4_table_offset(LINEAR_PT_VIRT_START)], - l4e_from_paddr(__pa(idle_pg_table), __PAGE_HYPERVISOR)); -Index: xen-4.1.2-testing/xen/include/asm-x86/mm.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/asm-x86/mm.h -+++ xen-4.1.2-testing/xen/include/asm-x86/mm.h -@@ -469,7 +469,7 @@ TYPE_SAFE(unsigned long,mfn); - - #ifdef CONFIG_COMPAT - #define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START) --#define set_gpfn_from_mfn(mfn, pfn) ({ \ -+#define _set_gpfn_from_mfn(mfn, pfn) ({ \ - struct domain *d = page_get_owner(__mfn_to_page(mfn)); \ - unsigned long entry = (d && (d == dom_cow)) ? \ - SHARED_M2P_ENTRY : (pfn); \ -@@ -478,7 +478,7 @@ TYPE_SAFE(unsigned long,mfn); - machine_to_phys_mapping[(mfn)] = (entry)); \ - }) - #else --#define set_gpfn_from_mfn(mfn, pfn) ({ \ -+#define _set_gpfn_from_mfn(mfn, pfn) ({ \ - struct domain *d = page_get_owner(__mfn_to_page(mfn)); \ - if(d && (d == dom_cow)) \ - machine_to_phys_mapping[(mfn)] = SHARED_M2P_ENTRY; \ -@@ -486,6 +486,17 @@ TYPE_SAFE(unsigned long,mfn); - machine_to_phys_mapping[(mfn)] = (pfn); \ - }) - #endif -+ -+/* -+ * Disable some users of set_gpfn_from_mfn() (e.g., free_heap_pages()) until -+ * the machine_to_phys_mapping is actually set up. -+ */ -+extern bool_t machine_to_phys_mapping_valid; -+#define set_gpfn_from_mfn(mfn, pfn) do { \ -+ if ( machine_to_phys_mapping_valid ) \ -+ _set_gpfn_from_mfn(mfn, pfn); \ -+} while (0) -+ - #define get_gpfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)]) - - #define mfn_to_gmfn(_d, mfn) \ diff --git a/23507-xenpaging_update_machine_to_phys_mapping_during_page_deallocation.patch b/23507-xenpaging_update_machine_to_phys_mapping_during_page_deallocation.patch deleted file mode 100644 index 99f2a7f..0000000 --- a/23507-xenpaging_update_machine_to_phys_mapping_during_page_deallocation.patch +++ /dev/null @@ -1,62 +0,0 @@ -changeset: 23507:0a29c8c3ddf7 -user: Keir Fraser -date: Fri Jun 10 08:19:07 2011 +0100 -files: xen/common/page_alloc.c -description: -xenpaging: update machine_to_phys_mapping[] during page deallocation - -The machine_to_phys_mapping[] array needs updating during page -deallocation. If that page is allocated again, a call to -get_gpfn_from_mfn() will still return an old gfn from another guest. -This will cause trouble because this gfn number has no or different -meaning in the context of the current guest. - -This happens when the entire guest ram is paged-out before -xen_vga_populate_vram() runs. Then XENMEM_populate_physmap is called -with gfn 0xff000. A new page is allocated with alloc_domheap_pages. -This new page does not have a gfn yet. However, in -guest_physmap_add_entry() the passed mfn maps still to an old gfn -(perhaps from another old guest). This old gfn is in paged-out state -in this guests context and has no mfn anymore. As a result, the -ASSERT() triggers because p2m_is_ram() is true for p2m_ram_paging* -types. If the machine_to_phys_mapping[] array is updated properly, -both loops in guest_physmap_add_entry() turn into no-ops for the new -page and the mfn/gfn mapping will be done at the end of the function. - -If XENMEM_add_to_physmap is used with XENMAPSPACE_gmfn, -get_gpfn_from_mfn() will return an appearently valid gfn. As a -result, guest_physmap_remove_page() is called. The ASSERT in -p2m_remove_page triggers because the passed mfn does not match the old -mfn for the passed gfn. - -Signed-off-by: Olaf Hering - - ---- - xen/common/page_alloc.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -Index: xen-4.1.2-testing/xen/common/page_alloc.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/page_alloc.c -+++ xen-4.1.2-testing/xen/common/page_alloc.c -@@ -528,7 +528,7 @@ static int reserve_offlined_page(struct - static void free_heap_pages( - struct page_info *pg, unsigned int order) - { -- unsigned long mask; -+ unsigned long mask, mfn = page_to_mfn(pg); - unsigned int i, node = phys_to_nid(page_to_maddr(pg)), tainted = 0; - unsigned int zone = page_to_zone(pg); - -@@ -539,6 +539,10 @@ static void free_heap_pages( - - for ( i = 0; i < (1 << order); i++ ) - { -+ /* This page is not a guest frame any more. */ -+ page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */ -+ set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY); -+ - /* - * Cannot assume that count_info == 0, as there are some corner cases - * where it isn't the case and yet it isn't a bug: diff --git a/23508-vmx-proc-based-ctls-probe.patch b/23508-vmx-proc-based-ctls-probe.patch deleted file mode 100644 index 4a9a680..0000000 --- a/23508-vmx-proc-based-ctls-probe.patch +++ /dev/null @@ -1,47 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1307691167 -3600 -# Node ID 2ef6bbee50371e1135236035ed1a9a7b8748e09f -# Parent 0a29c8c3ddf7395ea8e68c5f4cd8633023490022 -x86/vmx: Small fixes to MSR_IA32_VMX_PROCBASED_CTLS feature probing. - -Should check for VIRTUAL_INTR_PENDING as we unconditionally make use -of it. Also check for CR8 exiting unconditionally on x86/64, as this -is of use to nestedvmx, and every 64-bit cpu should support it. - -Signed-off-by: Eddie Dong -Signed-off-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/vmx/vmcs.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/vmx/vmcs.c -@@ -143,6 +143,11 @@ static int vmx_init_vmcs_config(void) - MSR_IA32_VMX_PINBASED_CTLS, &mismatch); - - min = (CPU_BASED_HLT_EXITING | -+ CPU_BASED_VIRTUAL_INTR_PENDING | -+#ifdef __x86_64__ -+ CPU_BASED_CR8_LOAD_EXITING | -+ CPU_BASED_CR8_STORE_EXITING | -+#endif - CPU_BASED_INVLPG_EXITING | - CPU_BASED_CR3_LOAD_EXITING | - CPU_BASED_CR3_STORE_EXITING | -@@ -161,13 +166,9 @@ static int vmx_init_vmcs_config(void) - MSR_IA32_VMX_PROCBASED_CTLS, &mismatch); - _vmx_cpu_based_exec_control &= ~CPU_BASED_RDTSC_EXITING; - #ifdef __x86_64__ -- if ( !(_vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW) ) -- { -- min |= CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING; -- _vmx_cpu_based_exec_control = adjust_vmx_controls( -- "CPU-Based Exec Control", min, opt, -- MSR_IA32_VMX_PROCBASED_CTLS, &mismatch); -- } -+ if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW ) -+ _vmx_cpu_based_exec_control &= -+ ~(CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING); - #endif - - if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS ) diff --git a/23509-x86_32_Fix_build_Define_machine_to_phys_mapping_valid.patch b/23509-x86_32_Fix_build_Define_machine_to_phys_mapping_valid.patch deleted file mode 100644 index b5c718a..0000000 --- a/23509-x86_32_Fix_build_Define_machine_to_phys_mapping_valid.patch +++ /dev/null @@ -1,36 +0,0 @@ -changeset: 23509:782bc7b2661a -user: Keir Fraser -date: Fri Jun 10 13:51:39 2011 +0100 -files: xen/arch/x86/x86_32/mm.c -description: -x86_32: Fix build: Define machine_to_phys_mapping_valid - -Signed-off-by: Keir Fraser - - ---- - xen/arch/x86/x86_32/mm.c | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/x86_32/mm.c -+++ xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c -@@ -39,6 +39,8 @@ extern l1_pgentry_t l1_identmap[L1_PAGET - unsigned int __read_mostly PAGE_HYPERVISOR = __PAGE_HYPERVISOR; - unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE; - -+bool_t __read_mostly machine_to_phys_mapping_valid = 0; -+ - static unsigned long __read_mostly mpt_size; - - void *alloc_xen_pagetable(void) -@@ -123,6 +125,8 @@ void __init paging_init(void) - #undef CNT - #undef MFN - -+ machine_to_phys_mapping_valid = 1; -+ - /* Create page tables for ioremap()/map_domain_page_global(). */ - for ( i = 0; i < (IOREMAP_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ ) - { diff --git a/23562-xenpaging_remove_unused_spinlock_in_pager.patch b/23562-xenpaging_remove_unused_spinlock_in_pager.patch deleted file mode 100644 index 430f3d6..0000000 --- a/23562-xenpaging_remove_unused_spinlock_in_pager.patch +++ /dev/null @@ -1,199 +0,0 @@ -changeset: 23562:8a7f52c59d64 -user: Olaf Hering -date: Fri Jun 10 10:47:02 2011 +0200 -files: tools/xenpaging/mem_event.h tools/xenpaging/spinlock.h tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: remove unused spinlock in pager - -The spinlock code in the pager is a no-op because xenpaging is a single -threaded application. There is no locking when put_response() places a -response into the ringbuffer. -The only locking is inside the hypervisor, where mem_event_put_request() and -mem_event_get_response() lock the ringbuffer to protect multiple vcpus from -each other. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/mem_event.h | 5 --- - tools/xenpaging/spinlock.h | 69 -------------------------------------------- - tools/xenpaging/xenpaging.c | 12 ------- - tools/xenpaging/xenpaging.h | 1 - 4 files changed, 87 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/mem_event.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/mem_event.h -+++ xen-4.1.2-testing/tools/xenpaging/mem_event.h -@@ -25,7 +25,6 @@ - #define __XEN_MEM_EVENT_H__ - - --#include "spinlock.h" - #include "xc.h" - #include - -@@ -33,9 +32,6 @@ - #include - - --#define mem_event_ring_lock_init(_m) spin_lock_init(&(_m)->ring_lock) --#define mem_event_ring_lock(_m) spin_lock(&(_m)->ring_lock) --#define mem_event_ring_unlock(_m) spin_unlock(&(_m)->ring_lock) - - - typedef struct mem_event { -@@ -45,7 +41,6 @@ typedef struct mem_event { - mem_event_back_ring_t back_ring; - mem_event_shared_page_t *shared_page; - void *ring_page; -- spinlock_t ring_lock; - } mem_event_t; - - -Index: xen-4.1.2-testing/tools/xenpaging/spinlock.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/spinlock.h -+++ /dev/null -@@ -1,69 +0,0 @@ --/****************************************************************************** -- * tools/xenpaging/spinlock.h -- * -- * Spinlock implementation. -- * -- * Copyright (c) 2009 Citrix Systems, Inc. (Patrick Colp) -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- */ -- -- --#ifndef __SPINLOCK_H__ --#define __SPINLOCK_H__ -- -- --#include "bitops.h" -- -- --#define SPIN_LOCK_UNLOCKED 0 -- -- --typedef int spinlock_t; -- -- --static inline void spin_lock(spinlock_t *lock) --{ -- while ( test_and_set_bit(1, lock) ); --} -- --static inline void spin_lock_init(spinlock_t *lock) --{ -- *lock = SPIN_LOCK_UNLOCKED; --} -- --static inline void spin_unlock(spinlock_t *lock) --{ -- *lock = SPIN_LOCK_UNLOCKED; --} -- --static inline int spin_trylock(spinlock_t *lock) --{ -- return !test_and_set_bit(1, lock); --} -- -- --#endif // __SPINLOCK_H__ -- -- --/* -- * Local variables: -- * mode: C -- * c-set-style: "BSD" -- * c-basic-offset: 4 -- * tab-width: 4 -- * indent-tabs-mode: nil -- * End: -- */ -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -32,7 +32,6 @@ - #include - - #include "bitops.h" --#include "spinlock.h" - #include "file_ops.h" - #include "xc.h" - -@@ -127,9 +126,6 @@ static xenpaging_t *xenpaging_init(domid - BACK_RING_INIT(&paging->mem_event.back_ring, - (mem_event_sring_t *)paging->mem_event.ring_page, - PAGE_SIZE); -- -- /* Initialise lock */ -- mem_event_ring_lock_init(&paging->mem_event); - - /* Initialise Xen */ - rc = xc_mem_event_enable(xch, paging->mem_event.domain_id, -@@ -302,8 +298,6 @@ static int get_request(mem_event_t *mem_ - mem_event_back_ring_t *back_ring; - RING_IDX req_cons; - -- mem_event_ring_lock(mem_event); -- - back_ring = &mem_event->back_ring; - req_cons = back_ring->req_cons; - -@@ -315,8 +309,6 @@ static int get_request(mem_event_t *mem_ - back_ring->req_cons = req_cons; - back_ring->sring->req_event = req_cons + 1; - -- mem_event_ring_unlock(mem_event); -- - return 0; - } - -@@ -325,8 +317,6 @@ static int put_response(mem_event_t *mem - mem_event_back_ring_t *back_ring; - RING_IDX rsp_prod; - -- mem_event_ring_lock(mem_event); -- - back_ring = &mem_event->back_ring; - rsp_prod = back_ring->rsp_prod_pvt; - -@@ -338,8 +328,6 @@ static int put_response(mem_event_t *mem - back_ring->rsp_prod_pvt = rsp_prod; - RING_PUSH_RESPONSES(back_ring); - -- mem_event_ring_unlock(mem_event); -- - return 0; - } - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -25,7 +25,6 @@ - #define __XEN_PAGING2_H__ - - --#include "spinlock.h" - #include "xc.h" - #include - diff --git a/23571-vtd-fault-verbosity.patch b/23571-vtd-fault-verbosity.patch deleted file mode 100644 index 93b3e26..0000000 --- a/23571-vtd-fault-verbosity.patch +++ /dev/null @@ -1,154 +0,0 @@ -# HG changeset patch -# User Allen Kay -# Date 1308823884 -3600 -# Node ID d3ac71f22e8621d9a7604f82f3976337e6c97a9a -# Parent 065ca14be963fe4da55d629ed0b3692a14253a86 -[VTD] print out debug message in vt-d fault handler only when iommu=debug is set - -Print out debug messages in vtd_page_fault() handler only when -iommu=debug is set xen boot parameter. - -Signed-off-by: Allen Kay - -Index: xen-4.1.3-testing/xen/drivers/passthrough/amd/iommu_acpi.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/amd/iommu_acpi.c -+++ xen-4.1.3-testing/xen/drivers/passthrough/amd/iommu_acpi.c -@@ -822,7 +822,7 @@ static int __init parse_ivrs_table(struc - - BUG_ON(!table); - -- if ( amd_iommu_debug ) -+ if ( iommu_debug ) - dump_acpi_table_header(table); - - /* parse IVRS blocks */ -Index: xen-4.1.3-testing/xen/drivers/passthrough/iommu.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/iommu.c -+++ xen-4.1.3-testing/xen/drivers/passthrough/iommu.c -@@ -48,7 +48,7 @@ bool_t __read_mostly iommu_snoop = 1; - bool_t __read_mostly iommu_qinval = 1; - bool_t __read_mostly iommu_intremap = 1; - bool_t __read_mostly iommu_hap_pt_share; --bool_t __read_mostly amd_iommu_debug; -+bool_t __read_mostly iommu_debug; - bool_t __read_mostly amd_iommu_perdev_intremap; - - static void __init parse_iommu_param(char *s) -@@ -74,8 +74,8 @@ static void __init parse_iommu_param(cha - iommu_qinval = 0; - else if ( !strcmp(s, "no-intremap") ) - iommu_intremap = 0; -- else if ( !strcmp(s, "amd-iommu-debug") ) -- amd_iommu_debug = 1; -+ else if ( !strcmp(s, "debug") ) -+ iommu_debug = 1; - else if ( !strcmp(s, "amd-iommu-perdev-intremap") ) - amd_iommu_perdev_intremap = 1; - else if ( !strcmp(s, "dom0-passthrough") ) -Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.c -+++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c -@@ -844,7 +844,7 @@ static int iommu_page_fault_do_one(struc - - if ( fault_type == DMA_REMAP ) - { -- dprintk(XENLOG_WARNING VTDPREFIX, -+ INTEL_IOMMU_DEBUG( - "DMAR:[%s] Request device [%02x:%02x.%d] " - "fault addr %"PRIx64", iommu reg = %p\n" - "DMAR:[fault reason %02xh] %s\n", -@@ -853,12 +853,13 @@ static int iommu_page_fault_do_one(struc - PCI_FUNC(source_id & 0xFF), addr, iommu->reg, - fault_reason, reason); - #ifndef __i386__ /* map_domain_page() cannot be used in this context */ -- print_vtd_entries(iommu, (source_id >> 8), -+ if (iommu_debug) -+ print_vtd_entries(iommu, (source_id >> 8), - (source_id & 0xff), (addr >> PAGE_SHIFT)); - #endif - } - else -- dprintk(XENLOG_WARNING VTDPREFIX, -+ INTEL_IOMMU_DEBUG( - "INTR-REMAP: Request device [%02x:%02x.%d] " - "fault index %"PRIx64", iommu reg = %p\n" - "INTR-REMAP:[fault reason %02xh] %s\n", -@@ -872,26 +873,19 @@ static int iommu_page_fault_do_one(struc - static void iommu_fault_status(u32 fault_status) - { - if ( fault_status & DMA_FSTS_PFO ) -- dprintk(XENLOG_ERR VTDPREFIX, -- "iommu_fault_status: Fault Overflow\n"); -+ INTEL_IOMMU_DEBUG("iommu_fault_status: Fault Overflow\n"); - if ( fault_status & DMA_FSTS_PPF ) -- dprintk(XENLOG_ERR VTDPREFIX, -- "iommu_fault_status: Primary Pending Fault\n"); -+ INTEL_IOMMU_DEBUG("iommu_fault_status: Primary Pending Fault\n"); - if ( fault_status & DMA_FSTS_AFO ) -- dprintk(XENLOG_ERR VTDPREFIX, -- "iommu_fault_status: Advanced Fault Overflow\n"); -+ INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Fault Overflow\n"); - if ( fault_status & DMA_FSTS_APF ) -- dprintk(XENLOG_ERR VTDPREFIX, -- "iommu_fault_status: Advanced Pending Fault\n"); -+ INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Pending Fault\n"); - if ( fault_status & DMA_FSTS_IQE ) -- dprintk(XENLOG_ERR VTDPREFIX, -- "iommu_fault_status: Invalidation Queue Error\n"); -+ INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Queue Error\n"); - if ( fault_status & DMA_FSTS_ICE ) -- dprintk(XENLOG_ERR VTDPREFIX, -- "iommu_fault_status: Invalidation Completion Error\n"); -+ INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Completion Error\n"); - if ( fault_status & DMA_FSTS_ITE ) -- dprintk(XENLOG_ERR VTDPREFIX, -- "iommu_fault_status: Invalidation Time-out Error\n"); -+ INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Time-out Error\n"); - } - - #define PRIMARY_FAULT_REG_LEN (16) -Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.h -+++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h -@@ -512,4 +512,11 @@ struct intel_iommu { - struct acpi_drhd_unit *drhd; - }; - -+#define INTEL_IOMMU_DEBUG(fmt, args...) \ -+ do \ -+ { \ -+ if ( iommu_debug ) \ -+ dprintk(XENLOG_WARNING VTDPREFIX, fmt, ## args); \ -+ } while(0) -+ - #endif -Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h -@@ -34,7 +34,7 @@ - #define AMD_IOMMU_DEBUG(fmt, args...) \ - do \ - { \ -- if ( amd_iommu_debug ) \ -+ if ( iommu_debug ) \ - printk(XENLOG_INFO "AMD-Vi: " fmt, ## args); \ - } while(0) - -Index: xen-4.1.3-testing/xen/include/xen/iommu.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/iommu.h -+++ xen-4.1.3-testing/xen/include/xen/iommu.h -@@ -31,7 +31,7 @@ extern bool_t force_iommu, iommu_verbose - extern bool_t iommu_workaround_bios_bug, iommu_passthrough; - extern bool_t iommu_snoop, iommu_qinval, iommu_intremap; - extern bool_t iommu_hap_pt_share; --extern bool_t amd_iommu_debug; -+extern bool_t iommu_debug; - extern bool_t amd_iommu_perdev_intremap; - - /* Does this domain have a P2M table we can use as its IOMMU pagetable? */ diff --git a/23574-x86-dom0-compressed-ELF.patch b/23574-x86-dom0-compressed-ELF.patch deleted file mode 100644 index 25c1e93..0000000 --- a/23574-x86-dom0-compressed-ELF.patch +++ /dev/null @@ -1,127 +0,0 @@ -References: fate#311376, fate#311529, bnc#578927, bnc#628554 - -# HG changeset patch -# User Jan Beulich -# Date 1308825237 -3600 -# Node ID d7644abc218d3232b9d957ce94fc4b4bcc1f456e -# Parent 584c2e5e03d96f912cdfe90f8e9f910d5d661706 -x86: allow Dom0 image to be compressed ELF - -Rather than being able to decompress only the payloads of bzImage -containers, extend the logic to also decompress simple compressed ELF -images. At once, allow uncompressed bzImage payloads. - -This is a prerequisite for native EFI booting support (where, in the -absence of a capable secondary boot loader, the image will always be -in compressed form). - -Signed-off-by: Jan Beulich - -Index: xen-4.1.2-testing/xen/arch/x86/bzimage.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/bzimage.c -+++ xen-4.1.2-testing/xen/arch/x86/bzimage.c -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - #include - - #define HEAPORDER 3 -@@ -199,25 +200,36 @@ static __init int bzimage_check(struct s - return 1; - } - --int __init bzimage_headroom(char *image_start, unsigned long image_length) -+static unsigned long __initdata orig_image_len; -+ -+unsigned long __init bzimage_headroom(char *image_start, -+ unsigned long image_length) - { - struct setup_header *hdr = (struct setup_header *)image_start; -- char *img; -- int err, headroom; -+ int err; -+ unsigned long headroom; - - err = bzimage_check(hdr, image_length); -- if (err < 1) -+ if ( err < 0 ) - return 0; - -- img = image_start + (hdr->setup_sects+1) * 512; -- img += hdr->payload_offset; -+ if ( err > 0 ) -+ { -+ image_start += (hdr->setup_sects + 1) * 512 + hdr->payload_offset; -+ image_length = hdr->payload_length; -+ } -+ -+ if ( elf_is_elfbinary(image_start) ) -+ return 0; - -- headroom = output_length(img, hdr->payload_length); -- if (gzip_check(img, hdr->payload_length)) { -+ orig_image_len = image_length; -+ headroom = output_length(image_start, image_length); -+ if (gzip_check(image_start, image_length)) -+ { - headroom += headroom >> 12; /* Add 8 bytes for every 32K input block */ - headroom += (32768 + 18); /* Add 32K + 18 bytes of extra headroom */ - } else -- headroom += hdr->payload_length; -+ headroom += image_length; - headroom = (headroom + 4095) & ~4095; - - return headroom; -@@ -229,18 +241,24 @@ int __init bzimage_parse(char *image_bas - int err = bzimage_check(hdr, *image_len); - unsigned long output_len; - -- if (err < 1) -+ if ( err < 0 ) - return err; - -+ if ( err > 0 ) -+ { -+ *image_start += (hdr->setup_sects + 1) * 512 + hdr->payload_offset; -+ *image_len = hdr->payload_length; -+ } -+ -+ if ( elf_is_elfbinary(*image_start) ) -+ return 0; -+ - BUG_ON(!(image_base < *image_start)); - -- *image_start += (hdr->setup_sects+1) * 512; -- *image_start += hdr->payload_offset; -- *image_len = hdr->payload_length; -- output_len = output_length(*image_start, *image_len); -+ output_len = output_length(*image_start, orig_image_len); - -- if ( (err = perform_gunzip(image_base, *image_start, *image_len)) > 0 ) -- err = decompress(*image_start, *image_len, image_base); -+ if ( (err = perform_gunzip(image_base, *image_start, orig_image_len)) > 0 ) -+ err = decompress(*image_start, orig_image_len, image_base); - - if ( !err ) - { -Index: xen-4.1.2-testing/xen/include/asm-x86/bzimage.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/asm-x86/bzimage.h -+++ xen-4.1.2-testing/xen/include/asm-x86/bzimage.h -@@ -4,10 +4,9 @@ - #include - #include - --int __init bzimage_headroom(char *image_start, unsigned long image_length); -+unsigned long bzimage_headroom(char *image_start, unsigned long image_length); - --int __init bzimage_parse(char *image_base, -- char **image_start, -- unsigned long *image_len); -+int bzimage_parse(char *image_base, char **image_start, -+ unsigned long *image_len); - - #endif /* __X86_BZIMAGE_H__ */ diff --git a/23575-x86-DMI.patch b/23575-x86-DMI.patch deleted file mode 100644 index d089bc5..0000000 --- a/23575-x86-DMI.patch +++ /dev/null @@ -1,156 +0,0 @@ -References: fate#311376, fate#311529, bnc#578927, bnc#628554 - -# HG changeset patch -# User Jan Beulich -# Date 1308825280 -3600 -# Node ID 4d9598a6a7777c50e109d7e2eb6d1cb28bcb4509 -# Parent d7644abc218d3232b9d957ce94fc4b4bcc1f456e -x86/DMI: use proper structures instead of byte offsets - -Besides being (in my eyes) desirable cleanup, this at once represents -another prerequisite for native EFI booting support. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/dmi_scan.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/dmi_scan.c -+++ xen-4.1.3-testing/xen/arch/x86/dmi_scan.c -@@ -12,11 +12,31 @@ - #include - #include - --#define bt_ioremap(b,l) ((u8 *)__acpi_map_table(b,l)) -+#define bt_ioremap(b,l) ((void *)__acpi_map_table(b,l)) - #define bt_iounmap(b,l) ((void)0) - #define memcpy_fromio memcpy - #define alloc_bootmem(l) xmalloc_bytes(l) - -+struct dmi_eps { -+ char anchor[5]; /* "_DMI_" */ -+ u8 checksum; -+ u16 size; -+ u32 address; -+ u16 num_structures; -+ u8 revision; -+} __attribute__((packed)); -+ -+struct smbios_eps { -+ char anchor[4]; /* "_SM_" */ -+ u8 checksum; -+ u8 length; -+ u8 major, minor; -+ u16 max_size; -+ u8 revision; -+ u8 _rsrvd_[5]; -+ struct dmi_eps dmi; -+} __attribute__((packed)); -+ - struct dmi_header - { - u8 type; -@@ -92,62 +112,70 @@ static int __init dmi_table(u32 base, in - } - - --inline static int __init dmi_checksum(u8 *buf) -+static inline bool_t __init dmi_checksum(const void __iomem *buf, -+ unsigned int len) - { -- u8 sum=0; -- int a; -+ u8 sum = 0; -+ const u8 *p = buf; -+ unsigned int a; - -- for(a=0; a<15; a++) -- sum+=buf[a]; -- return (sum==0); -+ for (a = 0; a < len; a++) -+ sum += p[a]; -+ return sum == 0; - } - - int __init dmi_get_table(u32 *base, u32 *len) - { -- u8 buf[15]; -+ struct dmi_eps eps; - char __iomem *p, *q; - - p = maddr_to_virt(0xF0000); - for (q = p; q < p + 0x10000; q += 16) { -- memcpy_fromio(buf, q, 15); -- if (memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf)) { -- *base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8]; -- *len=buf[7]<<8|buf[6]; -+ memcpy_fromio(&eps, q, 15); -+ if (memcmp(eps.anchor, "_DMI_", 5) == 0 && -+ dmi_checksum(&eps, sizeof(eps))) { -+ *base = eps.address; -+ *len = eps.size; - return 0; - } - } - return -1; - } - -+static int __init _dmi_iterate(const struct dmi_eps *dmi, -+ const struct smbios_eps __iomem *smbios, -+ void (*decode)(struct dmi_header *)) -+{ -+ u16 num = dmi->num_structures; -+ u16 len = dmi->size; -+ u32 base = dmi->address; -+ -+ /* -+ * DMI version 0.0 means that the real version is taken from -+ * the SMBIOS version, which we may not know at this point. -+ */ -+ if (dmi->revision) -+ printk(KERN_INFO "DMI %d.%d present.\n", -+ dmi->revision >> 4, dmi->revision & 0x0f); -+ else if (!smbios) -+ printk(KERN_INFO "DMI present.\n"); -+ dmi_printk((KERN_INFO "%d structures occupying %d bytes.\n", -+ num, len)); -+ dmi_printk((KERN_INFO "DMI table at 0x%08X.\n", base)); -+ return dmi_table(base, len, num, decode); -+} -+ - static int __init dmi_iterate(void (*decode)(struct dmi_header *)) - { -- u8 buf[15]; -+ struct dmi_eps eps; - char __iomem *p, *q; - - p = maddr_to_virt(0xF0000); - for (q = p; q < p + 0x10000; q += 16) { -- memcpy_fromio(buf, q, 15); -- if (memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf)) { -- u16 num=buf[13]<<8|buf[12]; -- u16 len=buf[7]<<8|buf[6]; -- u32 base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8]; -- -- /* -- * DMI version 0.0 means that the real version is taken from -- * the SMBIOS version, which we don't know at this point. -- */ -- if(buf[14]!=0) -- printk(KERN_INFO "DMI %d.%d present.\n", -- buf[14]>>4, buf[14]&0x0F); -- else -- printk(KERN_INFO "DMI present.\n"); -- dmi_printk((KERN_INFO "%d structures occupying %d bytes.\n", -- num, len)); -- dmi_printk((KERN_INFO "DMI table at 0x%08X.\n", -- base)); -- if(dmi_table(base,len, num, decode)==0) -- return 0; -- } -+ memcpy_fromio(&eps, q, sizeof(eps)); -+ if (memcmp(eps.anchor, "_DMI_", 5) == 0 && -+ dmi_checksum(&eps, sizeof(eps))) -+ return _dmi_iterate(&eps, NULL, decode); - } - return -1; - } diff --git a/23576-x86_show_page_walk_also_for_early_page_faults.patch b/23576-x86_show_page_walk_also_for_early_page_faults.patch deleted file mode 100644 index 7a47875..0000000 --- a/23576-x86_show_page_walk_also_for_early_page_faults.patch +++ /dev/null @@ -1,151 +0,0 @@ -changeset: 23576:e2235fe267eb -user: Jan Beulich -date: Thu Jun 23 11:35:55 2011 +0100 -files: xen/arch/x86/mm.c xen/arch/x86/traps.c xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/mm.c xen/arch/x86/x86_64/traps.c -description: -x86: show page walk also for early page faults - -At once, move the common (between 32- and 64-bit) definition of -machine_to_phys_mapping_valid to a common location. - -Signed-off-by: Jan Beulich - - ---- - xen/arch/x86/mm.c | 2 ++ - xen/arch/x86/traps.c | 1 + - xen/arch/x86/x86_32/mm.c | 2 -- - xen/arch/x86/x86_32/traps.c | 9 ++++++--- - xen/arch/x86/x86_64/mm.c | 2 -- - xen/arch/x86/x86_64/traps.c | 12 ++++++++---- - 6 files changed, 17 insertions(+), 11 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -152,6 +152,8 @@ unsigned long __read_mostly pdx_group_va - (FRAMETABLE_SIZE / sizeof(*frame_table) + PDX_GROUP_COUNT - 1) - / PDX_GROUP_COUNT)] = { [0] = 1 }; - -+bool_t __read_mostly machine_to_phys_mapping_valid = 0; -+ - #define PAGE_CACHE_ATTRS (_PAGE_PAT|_PAGE_PCD|_PAGE_PWT) - - bool_t __read_mostly opt_allow_superpage; -Index: xen-4.1.3-testing/xen/arch/x86/traps.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/traps.c -+++ xen-4.1.3-testing/xen/arch/x86/traps.c -@@ -1454,6 +1454,7 @@ asmlinkage void __init do_early_page_fau - unsigned long *stk = (unsigned long *)regs; - printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n", - regs->cs, _p(regs->eip), _p(cr2), regs->error_code); -+ show_page_walk(cr2); - printk("Stack dump: "); - while ( ((long)stk & ((PAGE_SIZE - 1) & ~(BYTES_PER_LONG - 1))) != 0 ) - printk("%p ", _p(*stk++)); -Index: xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c -@@ -39,8 +39,6 @@ extern l1_pgentry_t l1_identmap[L1_PAGET - unsigned int __read_mostly PAGE_HYPERVISOR = __PAGE_HYPERVISOR; - unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE; - --bool_t __read_mostly machine_to_phys_mapping_valid = 0; -- - static unsigned long __read_mostly mpt_size; - - void *alloc_xen_pagetable(void) -Index: xen-4.1.3-testing/xen/arch/x86/x86_32/traps.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/traps.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_32/traps.c -@@ -164,7 +164,8 @@ void show_page_walk(unsigned long addr) - l3t += (cr3 & 0xFE0UL) >> 3; - l3e = l3t[l3_table_offset(addr)]; - mfn = l3e_get_pfn(l3e); -- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; -+ pfn = mfn_valid(mfn) && machine_to_phys_mapping_valid ? -+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; - printk(" L3[0x%03lx] = %"PRIpte" %08lx\n", - l3_table_offset(addr), l3e_get_intpte(l3e), pfn); - unmap_domain_page(l3t); -@@ -175,7 +176,8 @@ void show_page_walk(unsigned long addr) - l2t = map_domain_page(mfn); - l2e = l2t[l2_table_offset(addr)]; - mfn = l2e_get_pfn(l2e); -- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; -+ pfn = mfn_valid(mfn) && machine_to_phys_mapping_valid ? -+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; - printk(" L2[0x%03lx] = %"PRIpte" %08lx %s\n", - l2_table_offset(addr), l2e_get_intpte(l2e), pfn, - (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : ""); -@@ -188,7 +190,8 @@ void show_page_walk(unsigned long addr) - l1t = map_domain_page(mfn); - l1e = l1t[l1_table_offset(addr)]; - mfn = l1e_get_pfn(l1e); -- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; -+ pfn = mfn_valid(mfn) && machine_to_phys_mapping_valid ? -+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; - printk(" L1[0x%03lx] = %"PRIpte" %08lx\n", - l1_table_offset(addr), l1e_get_intpte(l1e), pfn); - unmap_domain_page(l1t); -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c -@@ -47,8 +47,6 @@ unsigned int __read_mostly pfn_pdx_hole_ - - unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START; - --bool_t __read_mostly machine_to_phys_mapping_valid = 0; -- - /* Top-level master (and idle-domain) page directory. */ - l4_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) - idle_pg_table[L4_PAGETABLE_ENTRIES]; -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/traps.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/traps.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/traps.c -@@ -176,7 +176,8 @@ void show_page_walk(unsigned long addr) - l4t = mfn_to_virt(mfn); - l4e = l4t[l4_table_offset(addr)]; - mfn = l4e_get_pfn(l4e); -- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; -+ pfn = mfn_valid(mfn) && machine_to_phys_mapping_valid ? -+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; - printk(" L4[0x%03lx] = %"PRIpte" %016lx\n", - l4_table_offset(addr), l4e_get_intpte(l4e), pfn); - if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) || -@@ -186,7 +187,8 @@ void show_page_walk(unsigned long addr) - l3t = mfn_to_virt(mfn); - l3e = l3t[l3_table_offset(addr)]; - mfn = l3e_get_pfn(l3e); -- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; -+ pfn = mfn_valid(mfn) && machine_to_phys_mapping_valid ? -+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; - printk(" L3[0x%03lx] = %"PRIpte" %016lx%s\n", - l3_table_offset(addr), l3e_get_intpte(l3e), pfn, - (l3e_get_flags(l3e) & _PAGE_PSE) ? " (PSE)" : ""); -@@ -198,7 +200,8 @@ void show_page_walk(unsigned long addr) - l2t = mfn_to_virt(mfn); - l2e = l2t[l2_table_offset(addr)]; - mfn = l2e_get_pfn(l2e); -- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; -+ pfn = mfn_valid(mfn) && machine_to_phys_mapping_valid ? -+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; - printk(" L2[0x%03lx] = %"PRIpte" %016lx %s\n", - l2_table_offset(addr), l2e_get_intpte(l2e), pfn, - (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : ""); -@@ -210,7 +213,8 @@ void show_page_walk(unsigned long addr) - l1t = mfn_to_virt(mfn); - l1e = l1t[l1_table_offset(addr)]; - mfn = l1e_get_pfn(l1e); -- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; -+ pfn = mfn_valid(mfn) && machine_to_phys_mapping_valid ? -+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY; - printk(" L1[0x%03lx] = %"PRIpte" %016lx\n", - l1_table_offset(addr), l1e_get_intpte(l1e), pfn); - } diff --git a/23577-tools_merge_several_bitop_functions_into_xc_bitops.h.patch b/23577-tools_merge_several_bitop_functions_into_xc_bitops.h.patch deleted file mode 100644 index f67311c..0000000 --- a/23577-tools_merge_several_bitop_functions_into_xc_bitops.h.patch +++ /dev/null @@ -1,1023 +0,0 @@ -changeset: 23577:607474aeefe1 -parent: 23570:065ca14be963 -user: Olaf Hering -date: Fri Jun 10 10:47:03 2011 +0200 -files: tools/blktap2/drivers/block-log.c tools/libxc/ia64/xc_ia64_linux_restore.c tools/libxc/ia64/xc_ia64_linux_save.c tools/libxc/ia64/xc_ia64_save_restore.h tools/libxc/xc_bitops.h tools/libxc/xc_domain_save.c tools/xenpaging/bitops.h tools/xenpaging/policy_default.c tools/xenpaging/xc.c tools/xenpaging/xc.h tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -tools: merge several bitop functions into xc_bitops.h - -Bitmaps are used in save/restore, xenpaging and blktap2. Merge the code into a -private xc_bitops.h file. All users are single threaded, so locking is not an -issue. The array of bits is handled as volatile because the x86 save/restore -code passes the bitmap to the hypervisor which in turn modifies the bitmap. - -blktap2 uses a private bitmap. There was a possible overflow in the -bitmap_size() function, the remainder was not considered. - -ia64 save/restore uses a bitmap to send the number of vcpus to the host. - -x86 save/restore uses a bitmap to track dirty pages. This bitmap is shared with -the hypervisor. An unused function count_bits() was removed and a new -bitmap_size() function is now used. - -xenpaging uses 3 private bitmaps to track the gfns which are in paged-out -state. It had a copy of some Linux bitops.h, which is now obsolete. Also the -BITS_PER_LONG macro was hardcoded to 64 which made it impossible to run 32bit -tools on a 64bit host. Wether this works at all has to be tested, yet. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/blktap2/drivers/block-log.c | 29 -- - tools/libxc/ia64/xc_ia64_linux_restore.c | 14 - tools/libxc/ia64/xc_ia64_linux_save.c | 29 -- - tools/libxc/ia64/xc_ia64_save_restore.h | 20 - - tools/libxc/xc_bitops.h | 57 +++ - tools/libxc/xc_domain_save.c | 66 ---- - tools/xenpaging/bitops.h | 448 ------------------------------- - tools/xenpaging/policy_default.c | 20 - - tools/xenpaging/xc.c | 14 - tools/xenpaging/xc.h | 2 - tools/xenpaging/xenpaging.c | 9 - tools/xenpaging/xenpaging.h | 1 - 12 files changed, 91 insertions(+), 618 deletions(-) - -Index: xen-4.1.3-testing/tools/blktap2/drivers/block-log.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/blktap2/drivers/block-log.c -+++ xen-4.1.3-testing/tools/blktap2/drivers/block-log.c -@@ -47,6 +47,7 @@ - #include - #include - -+#include "xc_bitops.h" - #include "log.h" - #include "tapdisk.h" - #include "tapdisk-server.h" -@@ -89,31 +90,6 @@ static void ctl_request(event_id_t, char - - /* large flat bitmaps don't scale particularly well either in size or scan - * time, but they'll do for now */ --#define BITS_PER_LONG (sizeof(unsigned long) * 8) --#define BITS_TO_LONGS(bits) (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) -- --#define BITMAP_ENTRY(_nr, _bmap) ((unsigned long*)(_bmap))[(_nr)/BITS_PER_LONG] --#define BITMAP_SHIFT(_nr) ((_nr) % BITS_PER_LONG) -- --static inline int test_bit(int nr, void* bmap) --{ -- return (BITMAP_ENTRY(nr, bmap) >> BITMAP_SHIFT(nr)) & 1; --} -- --static inline void clear_bit(int nr, void* bmap) --{ -- BITMAP_ENTRY(nr, bmap) &= ~(1UL << BITMAP_SHIFT(nr)); --} -- --static inline void set_bit(int nr, void* bmap) --{ -- BITMAP_ENTRY(nr, bmap) |= (1UL << BITMAP_SHIFT(nr)); --} -- --static inline int bitmap_size(uint64_t sz) --{ -- return sz >> 3; --} - - static int writelog_create(struct tdlog_state *s) - { -@@ -123,7 +99,8 @@ static int writelog_create(struct tdlog_ - - BDPRINTF("allocating %"PRIu64" bytes for dirty bitmap", bmsize); - -- if (!(s->writelog = calloc(bmsize, 1))) { -+ s->writelog = bitmap_alloc(s->size); -+ if (!s->writelog) { - BWPRINTF("could not allocate dirty bitmap of size %"PRIu64, bmsize); - return -1; - } -Index: xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_restore.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/ia64/xc_ia64_linux_restore.c -+++ xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_restore.c -@@ -218,14 +218,12 @@ xc_ia64_recv_vcpumap(xc_interface *xch, - max_virt_cpus, info->max_vcpu_id); - return -1; - } -- vcpumap_size = (max_virt_cpus + 1 + sizeof(vcpumap[0]) - 1) / -- sizeof(vcpumap[0]); -- vcpumap = malloc(vcpumap_size); -- if (vcpumap == NULL) { -+ vcpumap_size = bitmap_size(max_virt_cpus); -+ rc = bitmap_alloc(&vcpumap, max_virt_cpus); -+ if (rc < 0) { - ERROR("memory alloc for vcpumap"); -- return -1; -+ return rc; - } -- memset(vcpumap, 0, vcpumap_size); - if (read_exact(io_fd, vcpumap, vcpumap_size)) { - ERROR("read vcpumap"); - free(vcpumap); -@@ -353,7 +351,7 @@ xc_ia64_pv_recv_context_ver_three(xc_int - - /* vcpu context */ - for (i = 0; i <= info.max_vcpu_id; i++) { -- if (!__test_bit(i, vcpumap)) -+ if (!test_bit(i, vcpumap)) - continue; - - rc = xc_ia64_pv_recv_vcpu_context(xch, io_fd, dom, i); -@@ -454,7 +452,7 @@ xc_ia64_hvm_recv_context(xc_interface *x - /* A copy of the CPU context of the guest. */ - vcpu_guest_context_any_t ctxt_any; - -- if (!__test_bit(i, vcpumap)) -+ if (!test_bit(i, vcpumap)) - continue; - - if (xc_ia64_recv_vcpu_context(xch, io_fd, dom, i, &ctxt_any)) -Index: xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_save.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/ia64/xc_ia64_linux_save.c -+++ xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_save.c -@@ -32,6 +32,7 @@ - #include - - #include "xg_private.h" -+#include "xc_bitops.h" - #include "xc_ia64.h" - #include "xc_ia64_save_restore.h" - #include "xc_efi.h" -@@ -51,20 +52,6 @@ - ** During (live) save/migrate, we maintain a number of bitmaps to track - ** which pages we have to send, and to skip. - */ --static inline int test_bit(int nr, volatile void * addr) --{ -- return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1; --} -- --static inline void clear_bit(int nr, volatile void * addr) --{ -- BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr)); --} -- --static inline void set_bit(int nr, volatile void * addr) --{ -- BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr)); --} - - static int - suspend_and_state(int (*suspend)(void*), void* data, -@@ -207,19 +194,17 @@ xc_ia64_send_vcpumap(xc_interface *xch, - unsigned long vcpumap_size; - uint64_t *vcpumap = NULL; - -- vcpumap_size = (max_virt_cpus + 1 + sizeof(vcpumap[0]) - 1) / -- sizeof(vcpumap[0]); -- vcpumap = malloc(vcpumap_size); -- if (vcpumap == NULL) { -+ vcpumap_size = bitmap_size(max_virt_cpus); -+ rc = bitmap_alloc(&vcpumap, max_virt_cpus); -+ if (rc < 0) { - ERROR("memory alloc for vcpumap"); - goto out; - } -- memset(vcpumap, 0, vcpumap_size); - - for (i = 0; i <= info->max_vcpu_id; i++) { - xc_vcpuinfo_t vinfo; - if ((xc_vcpu_getinfo(xch, dom, i, &vinfo) == 0) && vinfo.online) -- __set_bit(i, vcpumap); -+ set_bit(i, vcpumap); - } - - if (write_exact(io_fd, &max_virt_cpus, sizeof(max_virt_cpus))) { -@@ -265,7 +250,7 @@ xc_ia64_pv_send_context(xc_interface *xc - - char *mem; - -- if (!__test_bit(i, vcpumap)) -+ if (!test_bit(i, vcpumap)) - continue; - - if (xc_ia64_send_vcpu_context(xch, io_fd, dom, i, &ctxt_any)) -@@ -332,7 +317,7 @@ xc_ia64_hvm_send_context(xc_interface *x - /* A copy of the CPU context of the guest. */ - vcpu_guest_context_any_t ctxt_any; - -- if (!__test_bit(i, vcpumap)) -+ if (!test_bit(i, vcpumap)) - continue; - - if (xc_ia64_send_vcpu_context(xch, io_fd, dom, i, &ctxt_any)) -Index: xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_save_restore.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/ia64/xc_ia64_save_restore.h -+++ xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_save_restore.h -@@ -33,26 +33,6 @@ - - #define XC_IA64_SR_FORMAT_VER_CURRENT XC_IA64_SR_FORMAT_VER_THREE - --/* --** During (live) save/migrate, we maintain a number of bitmaps to track --** which pages we have to send, and to skip. --*/ --#define BITS_PER_LONG (sizeof(unsigned long) * 8) -- --#define BITMAP_ENTRY(_nr,_bmap) \ -- ((unsigned long *)(_bmap))[(_nr)/BITS_PER_LONG] -- --#define BITMAP_SHIFT(_nr) ((_nr) % BITS_PER_LONG) -- --static inline int __test_bit(int nr, void * addr) --{ -- return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1; --} -- --static inline void __set_bit(int nr, void * addr) --{ -- BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr)); --} - - #endif /* XC_IA64_SAVE_RESTORE_H */ - -Index: xen-4.1.3-testing/tools/libxc/xc_bitops.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/tools/libxc/xc_bitops.h -@@ -0,0 +1,57 @@ -+#ifndef XC_BITOPS_H -+#define XC_BITOPS_H 1 -+ -+/* bitmap operations for single threaded access */ -+ -+#include -+ -+#define BITS_PER_LONG (sizeof(unsigned long) * 8) -+#define ORDER_LONG (sizeof(unsigned long) == 4 ? 5 : 6) -+ -+#define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr)/BITS_PER_LONG] -+#define BITMAP_SHIFT(_nr) ((_nr) % BITS_PER_LONG) -+ -+/* calculate required space for number of longs needed to hold nr_bits */ -+static inline int bitmap_size(int nr_bits) -+{ -+ int nr_long, nr_bytes; -+ nr_long = (nr_bits + BITS_PER_LONG - 1) >> ORDER_LONG; -+ nr_bytes = nr_long * sizeof(unsigned long); -+ return nr_bytes; -+} -+ -+static inline unsigned long *bitmap_alloc(int nr_bits) -+{ -+ return calloc(1, bitmap_size(nr_bits)); -+} -+ -+static inline int test_bit(int nr, volatile unsigned long *addr) -+{ -+ return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1; -+} -+ -+static inline void clear_bit(int nr, volatile unsigned long *addr) -+{ -+ BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr)); -+} -+ -+static inline void set_bit(int nr, volatile unsigned long *addr) -+{ -+ BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr)); -+} -+ -+static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) -+{ -+ int oldbit = test_bit(nr, addr); -+ clear_bit(nr, addr); -+ return oldbit; -+} -+ -+static inline int test_and_set_bit(int nr, volatile unsigned long *addr) -+{ -+ int oldbit = test_bit(nr, addr); -+ set_bit(nr, addr); -+ return oldbit; -+} -+ -+#endif /* XC_BITOPS_H */ -Index: xen-4.1.3-testing/tools/libxc/xc_domain_save.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_domain_save.c -+++ xen-4.1.3-testing/tools/libxc/xc_domain_save.c -@@ -27,6 +27,7 @@ - #include - - #include "xc_private.h" -+#include "xc_bitops.h" - #include "xc_dom.h" - #include "xg_private.h" - #include "xg_save_restore.h" -@@ -82,57 +83,6 @@ struct outbuf { - ((mfn_to_pfn(_mfn) < (dinfo->p2m_size)) && \ - (pfn_to_mfn(mfn_to_pfn(_mfn)) == (_mfn)))) - --/* --** During (live) save/migrate, we maintain a number of bitmaps to track --** which pages we have to send, to fixup, and to skip. --*/ -- --#define BITS_PER_LONG (sizeof(unsigned long) * 8) --#define BITS_TO_LONGS(bits) (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) --#define BITMAP_SIZE (BITS_TO_LONGS(dinfo->p2m_size) * sizeof(unsigned long)) -- --#define BITMAP_ENTRY(_nr,_bmap) \ -- ((volatile unsigned long *)(_bmap))[(_nr)/BITS_PER_LONG] -- --#define BITMAP_SHIFT(_nr) ((_nr) % BITS_PER_LONG) -- --#define ORDER_LONG (sizeof(unsigned long) == 4 ? 5 : 6) -- --static inline int test_bit (int nr, volatile void * addr) --{ -- return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1; --} -- --static inline void clear_bit (int nr, volatile void * addr) --{ -- BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr)); --} -- --static inline void set_bit ( int nr, volatile void * addr) --{ -- BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr)); --} -- --/* Returns the hamming weight (i.e. the number of bits set) in a N-bit word */ --static inline unsigned int hweight32(unsigned int w) --{ -- unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); -- res = (res & 0x33333333) + ((res >> 2) & 0x33333333); -- res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); -- res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); -- return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); --} -- --static inline int count_bits ( int nr, volatile void *addr) --{ -- int i, count = 0; -- volatile unsigned long *p = (volatile unsigned long *)addr; -- /* We know that the array is padded to unsigned long. */ -- for ( i = 0; i < (nr / (sizeof(unsigned long)*8)); i++, p++ ) -- count += hweight32(*p); -- return count; --} -- - static uint64_t tv_to_us(struct timeval *new) - { - return (new->tv_sec * 1000000) + new->tv_usec; -@@ -1067,9 +1017,9 @@ int xc_domain_save(xc_interface *xch, in - sent_last_iter = dinfo->p2m_size; - - /* Setup to_send / to_fix and to_skip bitmaps */ -- to_send = xc_hypercall_buffer_alloc_pages(xch, to_send, NRPAGES(BITMAP_SIZE)); -- to_skip = xc_hypercall_buffer_alloc_pages(xch, to_skip, NRPAGES(BITMAP_SIZE)); -- to_fix = calloc(1, BITMAP_SIZE); -+ to_send = xc_hypercall_buffer_alloc_pages(xch, to_send, NRPAGES(bitmap_size(dinfo->p2m_size))); -+ to_skip = xc_hypercall_buffer_alloc_pages(xch, to_skip, NRPAGES(bitmap_size(dinfo->p2m_size))); -+ to_fix = calloc(1, bitmap_size(dinfo->p2m_size)); - - if ( !to_send || !to_fix || !to_skip ) - { -@@ -1077,7 +1027,7 @@ int xc_domain_save(xc_interface *xch, in - goto out; - } - -- memset(to_send, 0xff, BITMAP_SIZE); -+ memset(to_send, 0xff, bitmap_size(dinfo->p2m_size)); - - if ( hvm ) - { -@@ -1490,7 +1440,7 @@ int xc_domain_save(xc_interface *xch, in - if ( last_iter && debug ) - { - int id = XC_SAVE_ID_ENABLE_VERIFY_MODE; -- memset(to_send, 0xff, BITMAP_SIZE); -+ memset(to_send, 0xff, bitmap_size(dinfo->p2m_size)); - debug = 0; - DPRINTF("Entering debug resend-all mode\n"); - -@@ -1971,8 +1921,8 @@ int xc_domain_save(xc_interface *xch, in - if ( ctx->live_m2p ) - munmap(ctx->live_m2p, M2P_SIZE(ctx->max_mfn)); - -- xc_hypercall_buffer_free_pages(xch, to_send, NRPAGES(BITMAP_SIZE)); -- xc_hypercall_buffer_free_pages(xch, to_skip, NRPAGES(BITMAP_SIZE)); -+ xc_hypercall_buffer_free_pages(xch, to_send, NRPAGES(bitmap_size(dinfo->p2m_size))); -+ xc_hypercall_buffer_free_pages(xch, to_skip, NRPAGES(bitmap_size(dinfo->p2m_size))); - - free(pfn_type); - free(pfn_batch); -Index: xen-4.1.3-testing/tools/xenpaging/bitops.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/bitops.h -+++ /dev/null -@@ -1,448 +0,0 @@ --#ifndef _X86_BITOPS_H --#define _X86_BITOPS_H -- --/* -- * Copyright 1992, Linus Torvalds. -- */ -- --//#include -- --#ifdef CONFIG_SMP --#define LOCK_PREFIX "lock ; " --#else --#define LOCK_PREFIX "" --#endif -- --/* -- * We specify the memory operand as both input and output because the memory -- * operand is both read from and written to. Since the operand is in fact a -- * word array, we also specify "memory" in the clobbers list to indicate that -- * words other than the one directly addressed by the memory operand may be -- * modified. We don't use "+m" because the gcc manual says that it should be -- * used only when the constraint allows the operand to reside in a register. -- */ -- --#define ADDR (*(volatile long *) addr) --#define CONST_ADDR (*(const volatile long *) addr) -- --extern void __bitop_bad_size(void); --#define bitop_bad_size(addr) (sizeof(*(addr)) < 4) -- --/** -- * set_bit - Atomically set a bit in memory -- * @nr: the bit to set -- * @addr: the address to start counting from -- * -- * This function is atomic and may not be reordered. See __set_bit() -- * if you do not require the atomic guarantees. -- * Note that @nr may be almost arbitrarily large; this function is not -- * restricted to acting on a single-word quantity. -- */ --static inline void set_bit(int nr, volatile void *addr) --{ -- asm volatile ( -- LOCK_PREFIX -- "btsl %1,%0" -- : "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); --} --#define set_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- set_bit(nr, addr); \ --}) -- --/** -- * __set_bit - Set a bit in memory -- * @nr: the bit to set -- * @addr: the address to start counting from -- * -- * Unlike set_bit(), this function is non-atomic and may be reordered. -- * If it's called on the same region of memory simultaneously, the effect -- * may be that only one operation succeeds. -- */ --static inline void __set_bit(int nr, volatile void *addr) --{ -- asm volatile ( -- "btsl %1,%0" -- : "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); --} --#define __set_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- __set_bit(nr, addr); \ --}) -- --/** -- * clear_bit - Clears a bit in memory -- * @nr: Bit to clear -- * @addr: Address to start counting from -- * -- * clear_bit() is atomic and may not be reordered. However, it does -- * not contain a memory barrier, so if it is used for locking purposes, -- * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() -- * in order to ensure changes are visible on other processors. -- */ --static inline void clear_bit(int nr, volatile void *addr) --{ -- asm volatile ( -- LOCK_PREFIX -- "btrl %1,%0" -- : "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); --} --#define clear_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- clear_bit(nr, addr); \ --}) -- --/** -- * __clear_bit - Clears a bit in memory -- * @nr: Bit to clear -- * @addr: Address to start counting from -- * -- * Unlike clear_bit(), this function is non-atomic and may be reordered. -- * If it's called on the same region of memory simultaneously, the effect -- * may be that only one operation succeeds. -- */ --static inline void __clear_bit(int nr, volatile void *addr) --{ -- asm volatile ( -- "btrl %1,%0" -- : "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); --} --#define __clear_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- __clear_bit(nr, addr); \ --}) -- --#define smp_mb__before_clear_bit() ((void)0) --#define smp_mb__after_clear_bit() ((void)0) -- --/** -- * __change_bit - Toggle a bit in memory -- * @nr: the bit to set -- * @addr: the address to start counting from -- * -- * Unlike change_bit(), this function is non-atomic and may be reordered. -- * If it's called on the same region of memory simultaneously, the effect -- * may be that only one operation succeeds. -- */ --static inline void __change_bit(int nr, volatile void *addr) --{ -- asm volatile ( -- "btcl %1,%0" -- : "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); --} --#define __change_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- __change_bit(nr, addr); \ --}) -- --/** -- * change_bit - Toggle a bit in memory -- * @nr: Bit to clear -- * @addr: Address to start counting from -- * -- * change_bit() is atomic and may not be reordered. -- * Note that @nr may be almost arbitrarily large; this function is not -- * restricted to acting on a single-word quantity. -- */ --static inline void change_bit(int nr, volatile void *addr) --{ -- asm volatile ( -- LOCK_PREFIX -- "btcl %1,%0" -- : "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); --} --#define change_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- change_bit(nr, addr); \ --}) -- --/** -- * test_and_set_bit - Set a bit and return its old value -- * @nr: Bit to set -- * @addr: Address to count from -- * -- * This operation is atomic and cannot be reordered. -- * It also implies a memory barrier. -- */ --static inline int test_and_set_bit(int nr, volatile void *addr) --{ -- int oldbit; -- -- asm volatile ( -- LOCK_PREFIX -- "btsl %2,%1\n\tsbbl %0,%0" -- : "=r" (oldbit), "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); -- return oldbit; --} --#define test_and_set_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- test_and_set_bit(nr, addr); \ --}) -- --/** -- * __test_and_set_bit - Set a bit and return its old value -- * @nr: Bit to set -- * @addr: Address to count from -- * -- * This operation is non-atomic and can be reordered. -- * If two examples of this operation race, one can appear to succeed -- * but actually fail. You must protect multiple accesses with a lock. -- */ --static inline int __test_and_set_bit(int nr, volatile void *addr) --{ -- int oldbit; -- -- asm volatile ( -- "btsl %2,%1\n\tsbbl %0,%0" -- : "=r" (oldbit), "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); -- return oldbit; --} --#define __test_and_set_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- __test_and_set_bit(nr, addr); \ --}) -- --/** -- * test_and_clear_bit - Clear a bit and return its old value -- * @nr: Bit to set -- * @addr: Address to count from -- * -- * This operation is atomic and cannot be reordered. -- * It also implies a memory barrier. -- */ --static inline int test_and_clear_bit(int nr, volatile void *addr) --{ -- int oldbit; -- -- asm volatile ( -- LOCK_PREFIX -- "btrl %2,%1\n\tsbbl %0,%0" -- : "=r" (oldbit), "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); -- return oldbit; --} --#define test_and_clear_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- test_and_clear_bit(nr, addr); \ --}) -- --/** -- * __test_and_clear_bit - Clear a bit and return its old value -- * @nr: Bit to set -- * @addr: Address to count from -- * -- * This operation is non-atomic and can be reordered. -- * If two examples of this operation race, one can appear to succeed -- * but actually fail. You must protect multiple accesses with a lock. -- */ --static inline int __test_and_clear_bit(int nr, volatile void *addr) --{ -- int oldbit; -- -- asm volatile ( -- "btrl %2,%1\n\tsbbl %0,%0" -- : "=r" (oldbit), "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); -- return oldbit; --} --#define __test_and_clear_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- __test_and_clear_bit(nr, addr); \ --}) -- --/* WARNING: non atomic and it can be reordered! */ --static inline int __test_and_change_bit(int nr, volatile void *addr) --{ -- int oldbit; -- -- asm volatile ( -- "btcl %2,%1\n\tsbbl %0,%0" -- : "=r" (oldbit), "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); -- return oldbit; --} --#define __test_and_change_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- __test_and_change_bit(nr, addr); \ --}) -- --/** -- * test_and_change_bit - Change a bit and return its new value -- * @nr: Bit to set -- * @addr: Address to count from -- * -- * This operation is atomic and cannot be reordered. -- * It also implies a memory barrier. -- */ --static inline int test_and_change_bit(int nr, volatile void *addr) --{ -- int oldbit; -- -- asm volatile ( -- LOCK_PREFIX -- "btcl %2,%1\n\tsbbl %0,%0" -- : "=r" (oldbit), "=m" (ADDR) -- : "Ir" (nr), "m" (ADDR) : "memory"); -- return oldbit; --} --#define test_and_change_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- test_and_change_bit(nr, addr); \ --}) -- --static inline int constant_test_bit(int nr, const volatile void *addr) --{ -- return ((1U << (nr & 31)) & -- (((const volatile unsigned int *)addr)[nr >> 5])) != 0; --} -- --static inline int variable_test_bit(int nr, const volatile void *addr) --{ -- int oldbit; -- -- asm volatile ( -- "btl %2,%1\n\tsbbl %0,%0" -- : "=r" (oldbit) -- : "m" (CONST_ADDR), "Ir" (nr) : "memory" ); -- return oldbit; --} -- --#define test_bit(nr, addr) ({ \ -- if ( bitop_bad_size(addr) ) __bitop_bad_size(); \ -- (__builtin_constant_p(nr) ? \ -- constant_test_bit((nr),(addr)) : \ -- variable_test_bit((nr),(addr))); \ --}) -- --extern unsigned int __find_first_bit( -- const unsigned long *addr, unsigned int size); --extern unsigned int __find_next_bit( -- const unsigned long *addr, unsigned int size, unsigned int offset); --extern unsigned int __find_first_zero_bit( -- const unsigned long *addr, unsigned int size); --extern unsigned int __find_next_zero_bit( -- const unsigned long *addr, unsigned int size, unsigned int offset); -- --static inline unsigned int __scanbit(unsigned long val, unsigned long max) --{ -- asm ( "bsf %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max) ); -- return (unsigned int)val; --} -- --/** -- * find_first_bit - find the first set bit in a memory region -- * @addr: The address to start the search at -- * @size: The maximum size to search -- * -- * Returns the bit-number of the first set bit, not the number of the byte -- * containing a bit. -- */ --#define find_first_bit(addr,size) \ --((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ -- (__scanbit(*(const unsigned long *)addr, size)) : \ -- __find_first_bit(addr,size))) -- --/** -- * find_next_bit - find the first set bit in a memory region -- * @addr: The address to base the search on -- * @offset: The bitnumber to start searching at -- * @size: The maximum size to search -- */ --#define find_next_bit(addr,size,off) \ --((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ -- ((off) + (__scanbit((*(const unsigned long *)addr) >> (off), size))) : \ -- __find_next_bit(addr,size,off))) -- --/** -- * find_first_zero_bit - find the first zero bit in a memory region -- * @addr: The address to start the search at -- * @size: The maximum size to search -- * -- * Returns the bit-number of the first zero bit, not the number of the byte -- * containing a bit. -- */ --#define find_first_zero_bit(addr,size) \ --((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ -- (__scanbit(~*(const unsigned long *)addr, size)) : \ -- __find_first_zero_bit(addr,size))) -- --/** -- * find_next_zero_bit - find the first zero bit in a memory region -- * @addr: The address to base the search on -- * @offset: The bitnumber to start searching at -- * @size: The maximum size to search -- */ --#define find_next_zero_bit(addr,size,off) \ --((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ -- ((off)+(__scanbit(~(((*(const unsigned long *)addr)) >> (off)), size))) : \ -- __find_next_zero_bit(addr,size,off))) -- -- --/** -- * find_first_set_bit - find the first set bit in @word -- * @word: the word to search -- * -- * Returns the bit-number of the first set bit. The input must *not* be zero. -- */ --static inline unsigned int find_first_set_bit(unsigned long word) --{ -- asm ( "bsf %1,%0" : "=r" (word) : "r" (word) ); -- return (unsigned int)word; --} -- --/** -- * ffs - find first bit set -- * @x: the word to search -- * -- * This is defined the same way as the libc and compiler builtin ffs routines. -- */ --#if 0 --static inline int ffs(unsigned long x) --{ -- long r; -- -- asm ( "bsf %1,%0\n\t" -- "jnz 1f\n\t" -- "mov $-1,%0\n" -- "1:" : "=r" (r) : "rm" (x)); -- return (int)r+1; --} --#endif -- --/** -- * fls - find last bit set -- * @x: the word to search -- * -- * This is defined the same way as ffs. -- */ --static inline int fls(unsigned long x) --{ -- long r; -- -- asm ( "bsr %1,%0\n\t" -- "jnz 1f\n\t" -- "mov $-1,%0\n" -- "1:" : "=r" (r) : "rm" (x)); -- return (int)r+1; --} -- --/** -- * hweightN - returns the hamming weight of a N-bit word -- * @x: the word to weigh -- * -- * The Hamming Weight of a number is the total number of bits set in it. -- */ --#define hweight64(x) generic_hweight64(x) --#define hweight32(x) generic_hweight32(x) --#define hweight16(x) generic_hweight16(x) --#define hweight8(x) generic_hweight8(x) -- --#endif /* _X86_BITOPS_H */ -Index: xen-4.1.3-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.3-testing/tools/xenpaging/policy_default.c -@@ -21,8 +21,7 @@ - */ - - --#include "bitops.h" --#include "xc.h" -+#include "xc_bitops.h" - #include "policy.h" - - -@@ -35,26 +34,23 @@ static unsigned int mru_size; - static unsigned long *bitmap; - static unsigned long *unconsumed; - static unsigned long current_gfn; --static unsigned long bitmap_size; - static unsigned long max_pages; - - - int policy_init(xenpaging_t *paging) - { - int i; -- int rc; -+ int rc = -ENOMEM; - - /* Allocate bitmap for pages not to page out */ -- rc = alloc_bitmap(&bitmap, paging->bitmap_size); -- if ( rc != 0 ) -+ bitmap = bitmap_alloc(paging->domain_info->max_pages); -+ if ( !bitmap ) - goto out; - /* Allocate bitmap to track unusable pages */ -- rc = alloc_bitmap(&unconsumed, paging->bitmap_size); -- if ( rc != 0 ) -+ unconsumed = bitmap_alloc(paging->domain_info->max_pages); -+ if ( !unconsumed ) - goto out; - -- /* record bitmap_size */ -- bitmap_size = paging->bitmap_size; - max_pages = paging->domain_info->max_pages; - - /* Initialise MRU list of paged in pages */ -@@ -65,10 +61,7 @@ int policy_init(xenpaging_t *paging) - - mru = malloc(sizeof(*mru) * mru_size); - if ( mru == NULL ) -- { -- rc = -ENOMEM; - goto out; -- } - - for ( i = 0; i < mru_size; i++ ) - mru[i] = INVALID_MFN; -@@ -76,6 +69,7 @@ int policy_init(xenpaging_t *paging) - /* Don't page out page 0 */ - set_bit(0, bitmap); - -+ rc = 0; - out: - return rc; - } -Index: xen-4.1.3-testing/tools/xenpaging/xc.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xc.c -+++ xen-4.1.3-testing/tools/xenpaging/xc.c -@@ -31,20 +31,6 @@ - #include "xc.h" - - --int alloc_bitmap(unsigned long **bitmap, unsigned long bitmap_size) --{ -- if ( *bitmap == NULL ) -- { -- *bitmap = calloc(bitmap_size / BITS_PER_LONG, sizeof(unsigned long)); -- -- if ( *bitmap == NULL ) -- return -ENOMEM; -- } -- -- memset(*bitmap, 0, bitmap_size / 8); -- -- return 0; --} - - int xc_mem_paging_flush_ioemu_cache(domid_t domain_id) - { -Index: xen-4.1.3-testing/tools/xenpaging/xc.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xc.h -+++ xen-4.1.3-testing/tools/xenpaging/xc.h -@@ -39,7 +39,6 @@ - #endif - - --#define BITS_PER_LONG 64 - - - typedef struct xc_platform_info { -@@ -50,7 +49,6 @@ typedef struct xc_platform_info { - } xc_platform_info_t; - - --int alloc_bitmap(unsigned long **bitmap, unsigned long bitmap_size); - - int xc_mem_paging_flush_ioemu_cache(domid_t domain_id); - int xc_wait_for_event(xc_interface *xch, xc_evtchn *xce); -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c -@@ -31,7 +31,7 @@ - - #include - --#include "bitops.h" -+#include "xc_bitops.h" - #include "file_ops.h" - #include "xc.h" - -@@ -200,11 +200,8 @@ static xenpaging_t *xenpaging_init(domid - } - - /* Allocate bitmap for tracking pages that have been paged out */ -- paging->bitmap_size = (paging->domain_info->max_pages + BITS_PER_LONG) & -- ~(BITS_PER_LONG - 1); -- -- rc = alloc_bitmap(&paging->bitmap, paging->bitmap_size); -- if ( rc != 0 ) -+ paging->bitmap = bitmap_alloc(paging->domain_info->max_pages); -+ if ( !paging->bitmap ) - { - ERROR("Error allocating bitmap"); - goto err; -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.h -@@ -40,7 +40,6 @@ typedef struct xenpaging { - xc_platform_info_t *platform_info; - xc_domaininfo_t *domain_info; - -- unsigned long bitmap_size; - unsigned long *bitmap; - - mem_event_t mem_event; diff --git a/23578-xenpaging_add_xs_handle_to_struct_xenpaging.patch b/23578-xenpaging_add_xs_handle_to_struct_xenpaging.patch deleted file mode 100644 index c2c9be4..0000000 --- a/23578-xenpaging_add_xs_handle_to_struct_xenpaging.patch +++ /dev/null @@ -1,79 +0,0 @@ -changeset: 23578:7299a9a44b35 -user: Olaf Hering -date: Wed Jun 22 14:47:09 2011 +0100 -files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: add xs_handle to struct xenpaging - -A xs_handle is currently used in the xc_mem_paging_flush_ioemu_cache() -function and will be used by a subsequent patch. -Add it to struct xenpaging. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson -Acked-by: Ian Campbell - - ---- - tools/xenpaging/xenpaging.c | 14 ++++++++++++++ - tools/xenpaging/xenpaging.h | 1 + - 2 files changed, 15 insertions(+) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - #include - -@@ -92,6 +93,14 @@ static xenpaging_t *xenpaging_init(domid - paging = malloc(sizeof(xenpaging_t)); - memset(paging, 0, sizeof(xenpaging_t)); - -+ /* Open connection to xenstore */ -+ paging->xs_handle = xs_open(0); -+ if ( paging->xs_handle == NULL ) -+ { -+ ERROR("Error initialising xenstore connection"); -+ goto err; -+ } -+ - p = getenv("XENPAGING_POLICY_MRU_SIZE"); - if ( p && *p ) - { -@@ -221,6 +230,8 @@ static xenpaging_t *xenpaging_init(domid - err: - if ( paging ) - { -+ if ( paging->xs_handle ) -+ xs_close(paging->xs_handle); - xc_interface_close(xch); - if ( paging->mem_event.shared_page ) - { -@@ -277,6 +288,9 @@ static int xenpaging_teardown(xenpaging_ - } - paging->mem_event.xce_handle = NULL; - -+ /* Close connection to xenstore */ -+ xs_close(paging->xs_handle); -+ - /* Close connection to Xen */ - rc = xc_interface_close(xch); - if ( rc != 0 ) -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -36,6 +36,7 @@ - - typedef struct xenpaging { - xc_interface *xc_handle; -+ struct xs_handle *xs_handle; - - xc_platform_info_t *platform_info; - xc_domaininfo_t *domain_info; diff --git a/23579-xenpaging_drop_xc.c_remove_ASSERT.patch b/23579-xenpaging_drop_xc.c_remove_ASSERT.patch deleted file mode 100644 index bb7468a..0000000 --- a/23579-xenpaging_drop_xc.c_remove_ASSERT.patch +++ /dev/null @@ -1,48 +0,0 @@ -changeset: 23579:868c8c898f73 -user: Olaf Hering -date: Fri Jun 10 10:47:06 2011 +0200 -files: tools/xenpaging/policy_default.c tools/xenpaging/xc.h -description: -xenpaging: drop xc.c, remove ASSERT - -The ASSERT is not needed, victim is never NULL. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/policy_default.c | 1 - - tools/xenpaging/xc.h | 7 ------- - 2 files changed, 8 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -78,7 +78,6 @@ int policy_choose_victim(xenpaging_t *pa - { - xc_interface *xch = paging->xc_handle; - unsigned long wrap = current_gfn; -- ASSERT(victim != NULL); - - do - { -Index: xen-4.1.2-testing/tools/xenpaging/xc.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.h -+++ xen-4.1.2-testing/tools/xenpaging/xc.h -@@ -30,13 +30,6 @@ - #include - - --#if 1 --#define ASSERT(_p) \ -- if ( !(_p) ) { DPRINTF("Assertion '%s' failed, line %d, file %s", #_p , \ -- __LINE__, __FILE__); *(int*)0=0; } --#else --#define ASSERT(_p) ((void)0) --#endif - - - diff --git a/23580-xenpaging_drop_xc.c_remove_xc_platform_info_t.patch b/23580-xenpaging_drop_xc.c_remove_xc_platform_info_t.patch deleted file mode 100644 index 2141277..0000000 --- a/23580-xenpaging_drop_xc.c_remove_xc_platform_info_t.patch +++ /dev/null @@ -1,121 +0,0 @@ -changeset: 23580:771b6984aa2a -user: Olaf Hering -date: Fri Jun 10 10:47:07 2011 +0200 -files: tools/xenpaging/xc.c tools/xenpaging/xc.h tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: drop xc.c, remove xc_platform_info_t - -xc_platform_info_t is not used in xenpaging. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xc.c | 10 ---------- - tools/xenpaging/xc.h | 8 -------- - tools/xenpaging/xenpaging.c | 17 ----------------- - tools/xenpaging/xenpaging.h | 1 - - 4 files changed, 36 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xc.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.c -+++ xen-4.1.2-testing/tools/xenpaging/xc.c -@@ -26,7 +26,6 @@ - #include - #include - #include --#include - #include - #include "xc.h" - -@@ -97,15 +96,6 @@ int xc_wait_for_event(xc_interface *xch, - return xc_wait_for_event_or_timeout(xch, xce, -1); - } - --int xc_get_platform_info(xc_interface *xc_handle, domid_t domain_id, -- xc_platform_info_t *platform_info) --{ -- return get_platform_info(xc_handle, domain_id, -- &platform_info->max_mfn, -- &platform_info->hvirt_start, -- &platform_info->pt_levels, -- &platform_info->guest_width); --} - - - /* -Index: xen-4.1.2-testing/tools/xenpaging/xc.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.h -+++ xen-4.1.2-testing/tools/xenpaging/xc.h -@@ -34,12 +34,6 @@ - - - --typedef struct xc_platform_info { -- unsigned long max_mfn; -- unsigned long hvirt_start; -- unsigned int pt_levels; -- unsigned int guest_width; --} xc_platform_info_t; - - - -@@ -47,8 +41,6 @@ int xc_mem_paging_flush_ioemu_cache(domi - int xc_wait_for_event(xc_interface *xch, xc_evtchn *xce); - int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms); - --int xc_get_platform_info(xc_interface *xc_handle, domid_t domain_id, -- xc_platform_info_t *platform_info); - - - #endif // __XC_H__ -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -176,22 +176,6 @@ static xenpaging_t *xenpaging_init(domid - - paging->mem_event.port = rc; - -- /* Get platform info */ -- paging->platform_info = malloc(sizeof(xc_platform_info_t)); -- if ( paging->platform_info == NULL ) -- { -- ERROR("Error allocating memory for platform info"); -- goto err; -- } -- -- rc = xc_get_platform_info(xch, paging->mem_event.domain_id, -- paging->platform_info); -- if ( rc != 1 ) -- { -- ERROR("Error getting platform info"); -- goto err; -- } -- - /* Get domaininfo */ - paging->domain_info = malloc(sizeof(xc_domaininfo_t)); - if ( paging->domain_info == NULL ) -@@ -246,7 +230,6 @@ static xenpaging_t *xenpaging_init(domid - } - - free(paging->bitmap); -- free(paging->platform_info); - free(paging->domain_info); - free(paging); - } -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -38,7 +38,6 @@ typedef struct xenpaging { - xc_interface *xc_handle; - struct xs_handle *xs_handle; - -- xc_platform_info_t *platform_info; - xc_domaininfo_t *domain_info; - - unsigned long *bitmap; diff --git a/23581-xenpaging_drop_xc.c_remove_xc_wait_for_event.patch b/23581-xenpaging_drop_xc.c_remove_xc_wait_for_event.patch deleted file mode 100644 index 317042a..0000000 --- a/23581-xenpaging_drop_xc.c_remove_xc_wait_for_event.patch +++ /dev/null @@ -1,45 +0,0 @@ -changeset: 23581:9ce56626a5ab -user: Olaf Hering -date: Fri Jun 10 10:47:08 2011 +0200 -files: tools/xenpaging/xc.c tools/xenpaging/xc.h -description: -xenpaging: drop xc.c, remove xc_wait_for_event - -xc_wait_for_event is not used in xenpaging. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xc.c | 4 ---- - tools/xenpaging/xc.h | 1 - - 2 files changed, 5 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xc.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.c -+++ xen-4.1.2-testing/tools/xenpaging/xc.c -@@ -91,10 +91,6 @@ int xc_wait_for_event_or_timeout(xc_inte - return -errno; - } - --int xc_wait_for_event(xc_interface *xch, xc_evtchn *xce) --{ -- return xc_wait_for_event_or_timeout(xch, xce, -1); --} - - - -Index: xen-4.1.2-testing/tools/xenpaging/xc.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.h -+++ xen-4.1.2-testing/tools/xenpaging/xc.h -@@ -38,7 +38,6 @@ - - - int xc_mem_paging_flush_ioemu_cache(domid_t domain_id); --int xc_wait_for_event(xc_interface *xch, xc_evtchn *xce); - int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms); - - diff --git a/23582-xenpaging_drop_xc.c_move_xc_mem_paging_flush_ioemu_cache.patch b/23582-xenpaging_drop_xc.c_move_xc_mem_paging_flush_ioemu_cache.patch deleted file mode 100644 index 8f274a6..0000000 --- a/23582-xenpaging_drop_xc.c_move_xc_mem_paging_flush_ioemu_cache.patch +++ /dev/null @@ -1,96 +0,0 @@ -changeset: 23582:480e548fe76b -user: Olaf Hering -date: Fri Jun 10 10:47:10 2011 +0200 -files: tools/xenpaging/xc.c tools/xenpaging/xc.h tools/xenpaging/xenpaging.c -description: -xenpaging: drop xc.c, move xc_mem_paging_flush_ioemu_cache - -Move xc_mem_paging_flush_ioemu_cache() into xenpaging and massage it a bit to -use the required members from xenpaging_t. -Also update type of rc to match xs_write() return value. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xc.c | 18 ------------------ - tools/xenpaging/xc.h | 1 - - tools/xenpaging/xenpaging.c | 16 +++++++++++++++- - 3 files changed, 15 insertions(+), 20 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xc.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.c -+++ xen-4.1.2-testing/tools/xenpaging/xc.c -@@ -31,24 +31,6 @@ - - - --int xc_mem_paging_flush_ioemu_cache(domid_t domain_id) --{ -- struct xs_handle *xsh = NULL; -- char path[80]; -- int rc; -- -- sprintf(path, "/local/domain/0/device-model/%u/command", domain_id); -- -- xsh = xs_daemon_open(); -- if ( xsh == NULL ) -- return -EIO; -- -- rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); -- -- xs_daemon_close(xsh); -- -- return rc ? 0 : -1; --} - - int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms) - { -Index: xen-4.1.2-testing/tools/xenpaging/xc.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.h -+++ xen-4.1.2-testing/tools/xenpaging/xc.h -@@ -37,7 +37,6 @@ - - - --int xc_mem_paging_flush_ioemu_cache(domid_t domain_id); - int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms); - - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -48,6 +48,20 @@ static void close_handler(int sig) - unlink(filename); - } - -+static int xenpaging_mem_paging_flush_ioemu_cache(xenpaging_t *paging) -+{ -+ struct xs_handle *xsh = paging->xs_handle; -+ domid_t domain_id = paging->mem_event.domain_id; -+ char path[80]; -+ bool rc; -+ -+ sprintf(path, "/local/domain/0/device-model/%u/command", domain_id); -+ -+ rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); -+ -+ return rc == true ? 0 : -1; -+} -+ - static void *init_page(void) - { - void *buffer; -@@ -484,7 +498,7 @@ static int evict_victim(xenpaging_t *pag - else - { - if ( j++ % 1000 == 0 ) -- if ( xc_mem_paging_flush_ioemu_cache(paging->mem_event.domain_id) ) -+ if ( xenpaging_mem_paging_flush_ioemu_cache(paging) ) - ERROR("Error flushing ioemu cache"); - } - } diff --git a/23583-xenpaging_drop_xc.c_move_xc_wait_for_event_or_timeout.patch b/23583-xenpaging_drop_xc.c_move_xc_wait_for_event_or_timeout.patch deleted file mode 100644 index b45d236..0000000 --- a/23583-xenpaging_drop_xc.c_move_xc_wait_for_event_or_timeout.patch +++ /dev/null @@ -1,161 +0,0 @@ -changeset: 23583:235d8fdcb3a9 -user: Olaf Hering -date: Fri Jun 10 10:47:11 2011 +0200 -files: tools/xenpaging/xc.c tools/xenpaging/xc.h tools/xenpaging/xenpaging.c -description: -xenpaging: drop xc.c, move xc_wait_for_event_or_timeout - -Move xc_wait_for_event_or_timeout() into xenpaging and massage it a bit for -further changes in subsequent patches. -Include poll.h instead of sys/poll.h. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xc.c | 40 ------------------------------------ - tools/xenpaging/xc.h | 1 - tools/xenpaging/xenpaging.c | 48 +++++++++++++++++++++++++++++++++++++++++--- - 3 files changed, 45 insertions(+), 44 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xc.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.c -+++ xen-4.1.2-testing/tools/xenpaging/xc.c -@@ -32,46 +32,6 @@ - - - --int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms) --{ -- struct pollfd fd = { .fd = xc_evtchn_fd(xce), .events = POLLIN | POLLERR }; -- int port; -- int rc; -- -- rc = poll(&fd, 1, ms); -- if ( rc == -1 ) -- { -- if (errno == EINTR) -- return 0; -- -- ERROR("Poll exited with an error"); -- goto err; -- } -- -- if ( rc == 1 ) -- { -- port = xc_evtchn_pending(xce); -- if ( port == -1 ) -- { -- ERROR("Failed to read port from event channel"); -- goto err; -- } -- -- rc = xc_evtchn_unmask(xce, port); -- if ( rc != 0 ) -- { -- ERROR("Failed to unmask event channel port"); -- goto err; -- } -- } -- else -- port = -1; -- -- return port; -- -- err: -- return -errno; --} - - - -Index: xen-4.1.2-testing/tools/xenpaging/xc.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.h -+++ xen-4.1.2-testing/tools/xenpaging/xc.h -@@ -37,7 +37,6 @@ - - - --int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms); - - - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -62,6 +63,47 @@ static int xenpaging_mem_paging_flush_io - return rc == true ? 0 : -1; - } - -+static int xenpaging_wait_for_event_or_timeout(xenpaging_t *paging) -+{ -+ xc_interface *xch = paging->xc_handle; -+ xc_evtchn *xce = paging->mem_event.xce_handle; -+ struct pollfd fd[1]; -+ int port; -+ int rc; -+ -+ fd[0].fd = xc_evtchn_fd(xce); -+ fd[0].events = POLLIN | POLLERR; -+ rc = poll(fd, 1, 100); -+ if ( rc < 0 ) -+ { -+ if (errno == EINTR) -+ return 0; -+ -+ ERROR("Poll exited with an error"); -+ return -errno; -+ } -+ -+ if ( rc && fd[0].revents & POLLIN ) -+ { -+ DPRINTF("Got event from evtchn\n"); -+ port = xc_evtchn_pending(xce); -+ if ( port == -1 ) -+ { -+ ERROR("Failed to read port from event channel"); -+ rc = -1; -+ goto err; -+ } -+ -+ rc = xc_evtchn_unmask(xce, port); -+ if ( rc < 0 ) -+ { -+ ERROR("Failed to unmask event channel port"); -+ } -+ } -+err: -+ return rc; -+} -+ - static void *init_page(void) - { - void *buffer; -@@ -598,13 +640,13 @@ int main(int argc, char *argv[]) - while ( !interrupted ) - { - /* Wait for Xen to signal that a page needs paged in */ -- rc = xc_wait_for_event_or_timeout(xch, paging->mem_event.xce_handle, 100); -- if ( rc < -1 ) -+ rc = xenpaging_wait_for_event_or_timeout(paging); -+ if ( rc < 0 ) - { - ERROR("Error getting event"); - goto out; - } -- else if ( rc != -1 ) -+ else if ( rc != 0 ) - { - DPRINTF("Got event from Xen\n"); - } diff --git a/23584-xenpaging_drop_xc.c_remove_xc_files.patch b/23584-xenpaging_drop_xc.c_remove_xc_files.patch deleted file mode 100644 index 7023465..0000000 --- a/23584-xenpaging_drop_xc.c_remove_xc_files.patch +++ /dev/null @@ -1,182 +0,0 @@ -changeset: 23584:e30cff57b146 -user: Olaf Hering -date: Fri Jun 10 10:47:12 2011 +0200 -files: tools/xenpaging/Makefile tools/xenpaging/mem_event.h tools/xenpaging/xc.c tools/xenpaging/xc.h tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: drop xc.c, remove xc files - -Finally remove xc.c/xc.h and its references since both are empty now. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/Makefile | 2 - - tools/xenpaging/mem_event.h | 1 - tools/xenpaging/xc.c | 47 -------------------------------------- - tools/xenpaging/xc.h | 54 -------------------------------------------- - tools/xenpaging/xenpaging.c | 1 - tools/xenpaging/xenpaging.h | 1 - 6 files changed, 1 insertion(+), 105 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/Makefile -+++ xen-4.1.2-testing/tools/xenpaging/Makefile -@@ -9,7 +9,7 @@ LDLIBS += $(LDLIBS_libxenctrl) $(LDLIBS - POLICY = default - - SRC := --SRCS += file_ops.c xc.c xenpaging.c policy_$(POLICY).c -+SRCS += file_ops.c xenpaging.c policy_$(POLICY).c - - CFLAGS += -Werror - CFLAGS += -Wno-unused -Index: xen-4.1.2-testing/tools/xenpaging/mem_event.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/mem_event.h -+++ xen-4.1.2-testing/tools/xenpaging/mem_event.h -@@ -25,7 +25,6 @@ - #define __XEN_MEM_EVENT_H__ - - --#include "xc.h" - #include - - #include -Index: xen-4.1.2-testing/tools/xenpaging/xc.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.c -+++ /dev/null -@@ -1,47 +0,0 @@ --/****************************************************************************** -- * tools/xenpaging/lib/xc.c -- * -- * libxc-type add-ons for paging support. -- * -- * Copyright (c) 2009 Citrix Systems, Inc. (Patrick Colp) -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- */ -- -- --#include --#include --#include --#include --#include --#include --#include "xc.h" -- -- -- -- -- -- -- -- --/* -- * Local variables: -- * mode: C -- * c-set-style: "BSD" -- * c-basic-offset: 4 -- * tab-width: 4 -- * indent-tabs-mode: nil -- * End: -- */ -Index: xen-4.1.2-testing/tools/xenpaging/xc.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xc.h -+++ /dev/null -@@ -1,54 +0,0 @@ --/****************************************************************************** -- * tools/xenpaging/lib/xc.h -- * -- * libxc add-ons. -- * -- * Copyright (c) 2009 Citrix Systems, Inc. (Patrick Colp) -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- */ -- -- --#ifndef __XC_H__ --#define __XC_H__ -- -- --#include --#include --#include -- -- -- -- -- -- -- -- -- -- -- -- --#endif // __XC_H__ -- -- --/* -- * Local variables: -- * mode: C -- * c-set-style: "BSD" -- * c-basic-offset: 4 -- * tab-width: 4 -- * indent-tabs-mode: nil -- * End: -- */ -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -35,7 +35,6 @@ - - #include "xc_bitops.h" - #include "file_ops.h" --#include "xc.h" - - #include "policy.h" - #include "xenpaging.h" -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -25,7 +25,6 @@ - #define __XEN_PAGING2_H__ - - --#include "xc.h" - #include - - #include diff --git a/23585-xenpaging_correct_dropping_of_pages_to_avoid_full_ring_buffer.patch b/23585-xenpaging_correct_dropping_of_pages_to_avoid_full_ring_buffer.patch deleted file mode 100644 index 8ef1d81..0000000 --- a/23585-xenpaging_correct_dropping_of_pages_to_avoid_full_ring_buffer.patch +++ /dev/null @@ -1,59 +0,0 @@ -changeset: 23585:b4d18ac00a46 -user: Olaf Hering -date: Fri Jun 10 10:47:14 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: correct dropping of pages to avoid full ring buffer - -Doing a one-way channel from Xen to xenpaging is not possible with the -current ring buffer implementation. xenpaging uses the mem_event ring -buffer, which expects request/response pairs to make progress. The -previous patch, which tried to establish a one-way communication from -Xen to xenpaging, stalled the guest once the buffer was filled up with -requests. Correct page-dropping by taking the slow path and let -p2m_mem_paging_resume() consume the response from xenpaging. This makes -room for yet another request/response pair and avoids hanging guests. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -690,19 +690,19 @@ int main(int argc, char *argv[]) - ERROR("Error populating page"); - goto out; - } -+ } - -- /* Prepare the response */ -- rsp.gfn = req.gfn; -- rsp.p2mt = req.p2mt; -- rsp.vcpu_id = req.vcpu_id; -- rsp.flags = req.flags; -+ /* Prepare the response */ -+ rsp.gfn = req.gfn; -+ rsp.p2mt = req.p2mt; -+ rsp.vcpu_id = req.vcpu_id; -+ rsp.flags = req.flags; - -- rc = xenpaging_resume_page(paging, &rsp, 1); -- if ( rc != 0 ) -- { -- ERROR("Error resuming page"); -- goto out; -- } -+ rc = xenpaging_resume_page(paging, &rsp, 1); -+ if ( rc != 0 ) -+ { -+ ERROR("Error resuming page"); -+ goto out; - } - - /* Evict a new page to replace the one we just paged in */ diff --git a/23586-xenpaging_do_not_bounce_p2mt_back_to_the_hypervisor.patch b/23586-xenpaging_do_not_bounce_p2mt_back_to_the_hypervisor.patch deleted file mode 100644 index c720335..0000000 --- a/23586-xenpaging_do_not_bounce_p2mt_back_to_the_hypervisor.patch +++ /dev/null @@ -1,49 +0,0 @@ -changeset: 23586:bbdd7413a50a -user: Olaf Hering -date: Wed Jun 22 14:47:13 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: do not bounce p2mt back to the hypervisor - -do not bounce p2mt back to the hypervisor because p2m_mem_paging_populate() -and p2m_mem_paging_resume() dont make use of p2mt. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 4 ---- - 1 file changed, 4 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -694,7 +694,6 @@ int main(int argc, char *argv[]) - - /* Prepare the response */ - rsp.gfn = req.gfn; -- rsp.p2mt = req.p2mt; - rsp.vcpu_id = req.vcpu_id; - rsp.flags = req.flags; - -@@ -711,10 +710,8 @@ int main(int argc, char *argv[]) - else - { - DPRINTF("page already populated (domain = %d; vcpu = %d;" -- " p2mt = %x;" - " gfn = %"PRIx64"; paused = %d)\n", - paging->mem_event.domain_id, req.vcpu_id, -- req.p2mt, - req.gfn, req.flags & MEM_EVENT_FLAG_VCPU_PAUSED); - - /* Tell Xen to resume the vcpu */ -@@ -723,7 +720,6 @@ int main(int argc, char *argv[]) - { - /* Prepare the response */ - rsp.gfn = req.gfn; -- rsp.p2mt = req.p2mt; - rsp.vcpu_id = req.vcpu_id; - rsp.flags = req.flags; - diff --git a/23587-xenpaging_remove_srand_call.patch b/23587-xenpaging_remove_srand_call.patch deleted file mode 100644 index efdef00..0000000 --- a/23587-xenpaging_remove_srand_call.patch +++ /dev/null @@ -1,32 +0,0 @@ -changeset: 23587:926febc8bd98 -user: Olaf Hering -date: Fri Jun 10 10:47:16 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: remove srand call - -The policy uses now a linear algorithm instead of a random one. -Remove the call to srand(). - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 3 --- - 1 file changed, 3 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -581,9 +581,6 @@ int main(int argc, char *argv[]) - domain_id = atoi(argv[1]); - num_pages = atoi(argv[2]); - -- /* Seed random-number generator */ -- srand(time(NULL)); -- - /* Initialise domain paging */ - paging = xenpaging_init(domain_id); - if ( paging == NULL ) diff --git a/23588-xenpaging_remove_return_values_from_functions_that_can_not_fail.patch b/23588-xenpaging_remove_return_values_from_functions_that_can_not_fail.patch deleted file mode 100644 index 08fc6ae..0000000 --- a/23588-xenpaging_remove_return_values_from_functions_that_can_not_fail.patch +++ /dev/null @@ -1,78 +0,0 @@ -changeset: 23588:e48535e70145 -user: Olaf Hering -date: Fri Jun 10 10:47:18 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: remove return values from functions that can not fail - -get_request() and put_response() can not fail, remove return value -and update calling functions. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 19 ++++--------------- - 1 file changed, 4 insertions(+), 15 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -342,7 +342,7 @@ static int xenpaging_teardown(xenpaging_ - return -1; - } - --static int get_request(mem_event_t *mem_event, mem_event_request_t *req) -+static void get_request(mem_event_t *mem_event, mem_event_request_t *req) - { - mem_event_back_ring_t *back_ring; - RING_IDX req_cons; -@@ -357,11 +357,9 @@ static int get_request(mem_event_t *mem_ - /* Update ring */ - back_ring->req_cons = req_cons; - back_ring->sring->req_event = req_cons + 1; -- -- return 0; - } - --static int put_response(mem_event_t *mem_event, mem_event_response_t *rsp) -+static void put_response(mem_event_t *mem_event, mem_event_response_t *rsp) - { - mem_event_back_ring_t *back_ring; - RING_IDX rsp_prod; -@@ -376,8 +374,6 @@ static int put_response(mem_event_t *mem - /* Update ring */ - back_ring->rsp_prod_pvt = rsp_prod; - RING_PUSH_RESPONSES(back_ring); -- -- return 0; - } - - static int xenpaging_evict_page(xenpaging_t *paging, -@@ -437,9 +433,7 @@ static int xenpaging_resume_page(xenpagi - int ret; - - /* Put the page info on the ring */ -- ret = put_response(&paging->mem_event, rsp); -- if ( ret != 0 ) -- goto out; -+ put_response(&paging->mem_event, rsp); - - /* Notify policy of page being paged in */ - if ( notify_policy ) -@@ -649,12 +643,7 @@ int main(int argc, char *argv[]) - - while ( RING_HAS_UNCONSUMED_REQUESTS(&paging->mem_event.back_ring) ) - { -- rc = get_request(&paging->mem_event, &req); -- if ( rc != 0 ) -- { -- ERROR("Error getting request"); -- goto out; -- } -+ get_request(&paging->mem_event, &req); - - /* Check if the page has already been paged in */ - if ( test_and_clear_bit(req.gfn, paging->bitmap) ) diff --git a/23589-xenpaging_catch_xc_mem_paging_resume_errors.patch b/23589-xenpaging_catch_xc_mem_paging_resume_errors.patch deleted file mode 100644 index 4ad1474..0000000 --- a/23589-xenpaging_catch_xc_mem_paging_resume_errors.patch +++ /dev/null @@ -1,34 +0,0 @@ -changeset: 23589:49cb290ede16 -user: Olaf Hering -date: Fri Jun 10 10:47:19 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: catch xc_mem_paging_resume errors - -In the unlikely event that xc_mem_paging_resume() fails, do not overwrite the -error with the return value from xc_evtchn_notify() - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -442,8 +442,9 @@ static int xenpaging_resume_page(xenpagi - /* Tell Xen page is ready */ - ret = xc_mem_paging_resume(paging->xc_handle, paging->mem_event.domain_id, - rsp->gfn); -- ret = xc_evtchn_notify(paging->mem_event.xce_handle, -- paging->mem_event.port); -+ if ( ret == 0 ) -+ ret = xc_evtchn_notify(paging->mem_event.xce_handle, -+ paging->mem_event.port); - - out: - return ret; diff --git a/23590-xenpaging_remove_local_domain_id_variable.patch b/23590-xenpaging_remove_local_domain_id_variable.patch deleted file mode 100644 index 719dc2f..0000000 --- a/23590-xenpaging_remove_local_domain_id_variable.patch +++ /dev/null @@ -1,57 +0,0 @@ -changeset: 23590:d957acb8bee6 -user: Olaf Hering -date: Fri Jun 10 10:47:20 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: remove local domain_id variable - -Remove the local domain_id variable, it is already fetched from -paging->mem_event in other places. -Update the sprintf format string to use unsigned argument. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -552,7 +552,6 @@ static int evict_victim(xenpaging_t *pag - int main(int argc, char *argv[]) - { - struct sigaction act; -- domid_t domain_id; - int num_pages; - xenpaging_t *paging; - xenpaging_victim_t *victims; -@@ -573,11 +572,10 @@ int main(int argc, char *argv[]) - return -1; - } - -- domain_id = atoi(argv[1]); - num_pages = atoi(argv[2]); - - /* Initialise domain paging */ -- paging = xenpaging_init(domain_id); -+ paging = xenpaging_init(atoi(argv[1])); - if ( paging == NULL ) - { - fprintf(stderr, "Error initialising paging"); -@@ -585,10 +583,10 @@ int main(int argc, char *argv[]) - } - xch = paging->xc_handle; - -- DPRINTF("starting %s %u %d\n", argv[0], domain_id, num_pages); -+ DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, num_pages); - - /* Open file */ -- sprintf(filename, "page_cache_%d", domain_id); -+ sprintf(filename, "page_cache_%u", paging->mem_event.domain_id); - fd = open(filename, open_flags, open_mode); - if ( fd < 0 ) - { diff --git a/23591-xenpaging_move_num_pages_into_xenpaging_struct.patch b/23591-xenpaging_move_num_pages_into_xenpaging_struct.patch deleted file mode 100644 index 8901463..0000000 --- a/23591-xenpaging_move_num_pages_into_xenpaging_struct.patch +++ /dev/null @@ -1,129 +0,0 @@ -changeset: 23591:4aaa90c1db42 -user: Olaf Hering -date: Fri Jun 10 10:47:22 2011 +0200 -files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: move num_pages into xenpaging struct - -Move num_pages into struct xenpaging. -num_pages will be used by the policy in a subsequent patch. - -Also remove a memset, the victims array is allocated with calloc. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 30 ++++++++++++++---------------- - tools/xenpaging/xenpaging.h | 1 + - 2 files changed, 15 insertions(+), 16 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -128,7 +128,7 @@ static void *init_page(void) - return NULL; - } - --static xenpaging_t *xenpaging_init(domid_t domain_id) -+static xenpaging_t *xenpaging_init(domid_t domain_id, int num_pages) - { - xenpaging_t *paging; - xc_interface *xch; -@@ -256,6 +256,13 @@ static xenpaging_t *xenpaging_init(domid - } - DPRINTF("max_pages = %"PRIx64"\n", paging->domain_info->max_pages); - -+ if ( num_pages < 0 || num_pages > paging->domain_info->max_pages ) -+ { -+ num_pages = paging->domain_info->max_pages; -+ DPRINTF("setting num_pages to %d\n", num_pages); -+ } -+ paging->num_pages = num_pages; -+ - /* Initialise policy */ - rc = policy_init(paging); - if ( rc != 0 ) -@@ -552,7 +559,6 @@ static int evict_victim(xenpaging_t *pag - int main(int argc, char *argv[]) - { - struct sigaction act; -- int num_pages; - xenpaging_t *paging; - xenpaging_victim_t *victims; - mem_event_request_t req; -@@ -572,10 +578,8 @@ int main(int argc, char *argv[]) - return -1; - } - -- num_pages = atoi(argv[2]); -- - /* Initialise domain paging */ -- paging = xenpaging_init(atoi(argv[1])); -+ paging = xenpaging_init(atoi(argv[1]), atoi(argv[2])); - if ( paging == NULL ) - { - fprintf(stderr, "Error initialising paging"); -@@ -583,7 +587,7 @@ int main(int argc, char *argv[]) - } - xch = paging->xc_handle; - -- DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, num_pages); -+ DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, paging->num_pages); - - /* Open file */ - sprintf(filename, "page_cache_%u", paging->mem_event.domain_id); -@@ -594,12 +598,7 @@ int main(int argc, char *argv[]) - return 2; - } - -- if ( num_pages < 0 || num_pages > paging->domain_info->max_pages ) -- { -- num_pages = paging->domain_info->max_pages; -- DPRINTF("setting num_pages to %d\n", num_pages); -- } -- victims = calloc(num_pages, sizeof(xenpaging_victim_t)); -+ victims = calloc(paging->num_pages, sizeof(xenpaging_victim_t)); - - /* ensure that if we get a signal, we'll do cleanup, then exit */ - act.sa_handler = close_handler; -@@ -611,8 +610,7 @@ int main(int argc, char *argv[]) - sigaction(SIGALRM, &act, NULL); - - /* Evict pages */ -- memset(victims, 0, sizeof(xenpaging_victim_t) * num_pages); -- for ( i = 0; i < num_pages; i++ ) -+ for ( i = 0; i < paging->num_pages; i++ ) - { - rc = evict_victim(paging, &victims[i], fd, i); - if ( rc == -ENOSPC ) -@@ -648,13 +646,13 @@ int main(int argc, char *argv[]) - if ( test_and_clear_bit(req.gfn, paging->bitmap) ) - { - /* Find where in the paging file to read from */ -- for ( i = 0; i < num_pages; i++ ) -+ for ( i = 0; i < paging->num_pages; i++ ) - { - if ( victims[i].gfn == req.gfn ) - break; - } - -- if ( i >= num_pages ) -+ if ( i >= paging->num_pages ) - { - DPRINTF("Couldn't find page %"PRIx64"\n", req.gfn); - goto out; -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -42,6 +42,7 @@ typedef struct xenpaging { - unsigned long *bitmap; - - mem_event_t mem_event; -+ int num_pages; - int policy_mru_size; - } xenpaging_t; - diff --git a/23592-xenpaging_start_paging_in_the_middle_of_gfn_range.patch b/23592-xenpaging_start_paging_in_the_middle_of_gfn_range.patch deleted file mode 100644 index 294b699..0000000 --- a/23592-xenpaging_start_paging_in_the_middle_of_gfn_range.patch +++ /dev/null @@ -1,33 +0,0 @@ -changeset: 23592:1e44e75d889c -user: Olaf Hering -date: Fri Jun 10 10:47:23 2011 +0200 -files: tools/xenpaging/policy_default.c -description: -xenpaging: start paging in the middle of gfn range - -Set the starting gfn to somewhere in the middle of the gfn range to -avoid paging during BIOS startup. This can speedup booting of a guest. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/policy_default.c | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -69,6 +69,10 @@ int policy_init(xenpaging_t *paging) - /* Don't page out page 0 */ - set_bit(0, bitmap); - -+ /* Start in the middle to avoid paging during BIOS startup */ -+ current_gfn = max_pages / 2; -+ current_gfn -= paging->num_pages / 2; -+ - rc = 0; - out: - return rc; diff --git a/23593-xenpaging_pass_integer_to_xenpaging_populate_page.patch b/23593-xenpaging_pass_integer_to_xenpaging_populate_page.patch deleted file mode 100644 index 39cc5e6..0000000 --- a/23593-xenpaging_pass_integer_to_xenpaging_populate_page.patch +++ /dev/null @@ -1,74 +0,0 @@ -changeset: 23593:7d72475641fa -user: Olaf Hering -date: Fri Jun 10 10:47:24 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: pass integer to xenpaging_populate_page - -Pass gfn as integer to xenpaging_populate_page(). xc_map_foreign_pages() -takes a pointer to a list of gfns, but its a const pointer. So writing -the value back to the caller is not needed. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 16 ++++++---------- - 1 file changed, 6 insertions(+), 10 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -458,27 +458,24 @@ static int xenpaging_resume_page(xenpagi - } - - static int xenpaging_populate_page(xenpaging_t *paging, -- uint64_t *gfn, int fd, int i) -+ xen_pfn_t gfn, int fd, int i) - { - xc_interface *xch = paging->xc_handle; -- unsigned long _gfn; - void *page; - int ret; - unsigned char oom = 0; - -- _gfn = *gfn; -- DPRINTF("populate_page < gfn %lx pageslot %d\n", _gfn, i); -+ DPRINTF("populate_page < gfn %"PRI_xen_pfn" pageslot %d\n", gfn, i); - do - { - /* Tell Xen to allocate a page for the domain */ -- ret = xc_mem_paging_prep(xch, paging->mem_event.domain_id, -- _gfn); -+ ret = xc_mem_paging_prep(xch, paging->mem_event.domain_id, gfn); - if ( ret != 0 ) - { - if ( errno == ENOMEM ) - { - if ( oom++ == 0 ) -- DPRINTF("ENOMEM while preparing gfn %lx\n", _gfn); -+ DPRINTF("ENOMEM while preparing gfn %"PRI_xen_pfn"\n", gfn); - sleep(1); - continue; - } -@@ -491,8 +488,7 @@ static int xenpaging_populate_page(xenpa - /* Map page */ - ret = -EFAULT; - page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, -- PROT_READ | PROT_WRITE, &_gfn, 1); -- *gfn = _gfn; -+ PROT_READ | PROT_WRITE, &gfn, 1); - if ( page == NULL ) - { - ERROR("Error mapping page: page is null"); -@@ -667,7 +663,7 @@ int main(int argc, char *argv[]) - else - { - /* Populate the page */ -- rc = xenpaging_populate_page(paging, &req.gfn, fd, i); -+ rc = xenpaging_populate_page(paging, req.gfn, fd, i); - if ( rc != 0 ) - { - ERROR("Error populating page"); diff --git a/23594-xenpaging_add_helper_function_for_unlinking_pagefile.patch b/23594-xenpaging_add_helper_function_for_unlinking_pagefile.patch deleted file mode 100644 index 94cde26..0000000 --- a/23594-xenpaging_add_helper_function_for_unlinking_pagefile.patch +++ /dev/null @@ -1,53 +0,0 @@ -changeset: 23594:2fe46305a00d -user: Olaf Hering -date: Fri Jun 10 10:47:25 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: add helper function for unlinking pagefile - -Unlink pagefile in the signal handler and also in the exit path. -This does not leave a stale pagefile if an error occoured. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -41,11 +41,20 @@ - - static char filename[80]; - static int interrupted; --static void close_handler(int sig) -+ -+static void unlink_pagefile(void) - { -- interrupted = sig; - if ( filename[0] ) -+ { - unlink(filename); -+ filename[0] = '\0'; -+ } -+} -+ -+static void close_handler(int sig) -+{ -+ interrupted = sig; -+ unlink_pagefile(); - } - - static int xenpaging_mem_paging_flush_ioemu_cache(xenpaging_t *paging) -@@ -716,6 +725,7 @@ int main(int argc, char *argv[]) - - out: - close(fd); -+ unlink_pagefile(); - free(victims); - - /* Tear down domain paging */ diff --git a/23595-xenpaging_add_watch_thread_to_catch_guest_shutdown.patch b/23595-xenpaging_add_watch_thread_to_catch_guest_shutdown.patch deleted file mode 100644 index 3e9e5af..0000000 --- a/23595-xenpaging_add_watch_thread_to_catch_guest_shutdown.patch +++ /dev/null @@ -1,96 +0,0 @@ -changeset: 23595:389c8bf31688 -user: Olaf Hering -date: Fri Jun 10 10:47:27 2011 +0200 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: add watch thread to catch guest shutdown - -If xenpaging is started manually then no event is sent to xenpaging when -the guest is shutdown or rebooted. Add a watch on the @releaseDomain -node to leave the loop and gracefully shutdown the pager. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 40 ++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 38 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -39,6 +39,7 @@ - #include "policy.h" - #include "xenpaging.h" - -+static char watch_token[16]; - static char filename[80]; - static int interrupted; - -@@ -75,13 +76,19 @@ static int xenpaging_wait_for_event_or_t - { - xc_interface *xch = paging->xc_handle; - xc_evtchn *xce = paging->mem_event.xce_handle; -- struct pollfd fd[1]; -+ char **vec; -+ unsigned int num; -+ struct pollfd fd[2]; - int port; - int rc; - -+ /* Wait for event channel and xenstore */ - fd[0].fd = xc_evtchn_fd(xce); - fd[0].events = POLLIN | POLLERR; -- rc = poll(fd, 1, 100); -+ fd[1].fd = xs_fileno(paging->xs_handle); -+ fd[1].events = POLLIN | POLLERR; -+ -+ rc = poll(fd, 2, 100); - if ( rc < 0 ) - { - if (errno == EINTR) -@@ -91,6 +98,27 @@ static int xenpaging_wait_for_event_or_t - return -errno; - } - -+ /* First check for guest shutdown */ -+ if ( rc && fd[1].revents & POLLIN ) -+ { -+ DPRINTF("Got event from xenstore\n"); -+ vec = xs_read_watch(paging->xs_handle, &num); -+ if ( vec ) -+ { -+ if ( strcmp(vec[XS_WATCH_TOKEN], watch_token) == 0 ) -+ { -+ /* If our guest disappeared, set interrupt flag and fall through */ -+ if ( xs_is_domain_introduced(paging->xs_handle, paging->mem_event.domain_id) == false ) -+ { -+ xs_unwatch(paging->xs_handle, "@releaseDomain", watch_token); -+ interrupted = SIGQUIT; -+ rc = 0; -+ } -+ } -+ free(vec); -+ } -+ } -+ - if ( rc && fd[0].revents & POLLIN ) - { - DPRINTF("Got event from evtchn\n"); -@@ -165,6 +193,14 @@ static xenpaging_t *xenpaging_init(domid - goto err; - } - -+ /* write domain ID to watch so we can ignore other domain shutdowns */ -+ snprintf(watch_token, sizeof(watch_token), "%u", domain_id); -+ if ( xs_watch(paging->xs_handle, "@releaseDomain", watch_token) == false ) -+ { -+ ERROR("Could not bind to shutdown watch\n"); -+ goto err; -+ } -+ - p = getenv("XENPAGING_POLICY_MRU_SIZE"); - if ( p && *p ) - { diff --git a/23596-xenpaging_implement_stopping_of_pager_by_sending_SIGTERM-SIGINT.patch b/23596-xenpaging_implement_stopping_of_pager_by_sending_SIGTERM-SIGINT.patch deleted file mode 100644 index bb1cef8..0000000 --- a/23596-xenpaging_implement_stopping_of_pager_by_sending_SIGTERM-SIGINT.patch +++ /dev/null @@ -1,187 +0,0 @@ -changeset: 23596:c49e22648d0e -user: Olaf Hering -date: Fri Jun 10 10:47:28 2011 +0200 -files: tools/xenpaging/Makefile tools/xenpaging/pagein.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: implement stopping of pager by sending SIGTERM/SIGINT - -Write all paged-out pages back into the guest if the pager is -interrupted by ctrl-c or if it receives SIGTERM. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/Makefile | 1 - tools/xenpaging/pagein.c | 68 ++++++++++++++++++++++++++++++++++++++++++++ - tools/xenpaging/xenpaging.c | 35 ++++++++++++++++++++-- - tools/xenpaging/xenpaging.h | 3 + - 4 files changed, 104 insertions(+), 3 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/Makefile -+++ xen-4.1.2-testing/tools/xenpaging/Makefile -@@ -10,6 +10,7 @@ POLICY = default - - SRC := - SRCS += file_ops.c xenpaging.c policy_$(POLICY).c -+SRCS += pagein.c - - CFLAGS += -Werror - CFLAGS += -Wno-unused -Index: xen-4.1.2-testing/tools/xenpaging/pagein.c -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/tools/xenpaging/pagein.c -@@ -0,0 +1,68 @@ -+/* Trigger a page-in in a separate thread-of-execution to avoid deadlock */ -+#include -+#include "xc_private.h" -+ -+struct page_in_args { -+ domid_t dom; -+ xc_interface *xch; -+}; -+ -+static struct page_in_args page_in_args; -+static unsigned long page_in_gfn; -+static unsigned int page_in_possible; -+ -+static pthread_t page_in_thread; -+static pthread_cond_t page_in_cond = PTHREAD_COND_INITIALIZER; -+static pthread_mutex_t page_in_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+static void *page_in(void *arg) -+{ -+ struct page_in_args *pia = arg; -+ void *page; -+ xen_pfn_t gfn; -+ -+ while (1) -+ { -+ pthread_mutex_lock(&page_in_mutex); -+ while (!page_in_gfn) -+ pthread_cond_wait(&page_in_cond, &page_in_mutex); -+ gfn = page_in_gfn; -+ page_in_gfn = 0; -+ pthread_mutex_unlock(&page_in_mutex); -+ -+ /* Ignore errors */ -+ page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, &gfn, 1); -+ if (page) -+ munmap(page, PAGE_SIZE); -+ } -+ page_in_possible = 0; -+ pthread_exit(NULL); -+} -+ -+void page_in_trigger(unsigned long gfn) -+{ -+ if (!page_in_possible) -+ return; -+ -+ pthread_mutex_lock(&page_in_mutex); -+ page_in_gfn = gfn; -+ pthread_mutex_unlock(&page_in_mutex); -+ pthread_cond_signal(&page_in_cond); -+} -+ -+void create_page_in_thread(domid_t domain_id, xc_interface *xch) -+{ -+ page_in_args.dom = domain_id; -+ page_in_args.xch = xch; -+ if (pthread_create(&page_in_thread, NULL, page_in, &page_in_args) == 0) -+ page_in_possible = 1; -+} -+ -+/* -+ * Local variables: -+ * mode: C -+ * c-set-style: "BSD" -+ * c-basic-offset: 4 -+ * indent-tabs-mode: nil -+ * End: -+ */ -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -650,6 +650,9 @@ int main(int argc, char *argv[]) - sigaction(SIGINT, &act, NULL); - sigaction(SIGALRM, &act, NULL); - -+ /* listen for page-in events to stop pager */ -+ create_page_in_thread(paging->mem_event.domain_id, xch); -+ - /* Evict pages */ - for ( i = 0; i < paging->num_pages; i++ ) - { -@@ -665,7 +668,7 @@ int main(int argc, char *argv[]) - DPRINTF("%d pages evicted. Done.\n", i); - - /* Swap pages in and out */ -- while ( !interrupted ) -+ while ( 1 ) - { - /* Wait for Xen to signal that a page needs paged in */ - rc = xenpaging_wait_for_event_or_timeout(paging); -@@ -728,8 +731,12 @@ int main(int argc, char *argv[]) - goto out; - } - -- /* Evict a new page to replace the one we just paged in */ -- evict_victim(paging, &victims[i], fd, i); -+ /* Evict a new page to replace the one we just paged in, -+ * or clear this pagefile slot on exit */ -+ if ( interrupted ) -+ victims[i].gfn = INVALID_MFN; -+ else -+ evict_victim(paging, &victims[i], fd, i); - } - else - { -@@ -756,6 +763,28 @@ int main(int argc, char *argv[]) - } - } - } -+ -+ /* Write all pages back into the guest */ -+ if ( interrupted == SIGTERM || interrupted == SIGINT ) -+ { -+ for ( i = 0; i < paging->domain_info->max_pages; i++ ) -+ { -+ if ( test_bit(i, paging->bitmap) ) -+ { -+ page_in_trigger(i); -+ break; -+ } -+ } -+ /* If no more pages to process, exit loop */ -+ if ( i == paging->domain_info->max_pages ) -+ break; -+ } -+ else -+ { -+ /* Exit on any other signal */ -+ if ( interrupted ) -+ break; -+ } - } - DPRINTF("xenpaging got signal %d\n", interrupted); - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -53,6 +53,9 @@ typedef struct xenpaging_victim { - } xenpaging_victim_t; - - -+extern void create_page_in_thread(domid_t domain_id, xc_interface *xch); -+extern void page_in_trigger(unsigned long gfn); -+ - #endif // __XEN_PAGING_H__ - - diff --git a/23597-xenpaging_remove_private_mem_event.h.patch b/23597-xenpaging_remove_private_mem_event.h.patch deleted file mode 100644 index 4106dc9..0000000 --- a/23597-xenpaging_remove_private_mem_event.h.patch +++ /dev/null @@ -1,123 +0,0 @@ -changeset: 23597:3dcb553f3ba9 -user: Olaf Hering -date: Fri Jun 10 10:47:29 2011 +0200 -files: tools/xenpaging/mem_event.h tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: remove private mem_event.h - -tools/xenpaging/mem_event.h is only included in xenpaging.h. -Add the contents into that file and remove mem_event.h. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/mem_event.h | 57 -------------------------------------------- - tools/xenpaging/xenpaging.c | 3 -- - tools/xenpaging/xenpaging.h | 11 ++++++-- - 3 files changed, 8 insertions(+), 63 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/mem_event.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/mem_event.h -+++ /dev/null -@@ -1,57 +0,0 @@ --/****************************************************************************** -- * tools/xenpaging/mem_event.h -- * -- * Memory event structures. -- * -- * Copyright (c) 2009 Citrix Systems, Inc. (Patrick Colp) -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- */ -- -- --#ifndef __XEN_MEM_EVENT_H__ --#define __XEN_MEM_EVENT_H__ -- -- --#include -- --#include --#include -- -- -- -- --typedef struct mem_event { -- domid_t domain_id; -- xc_evtchn *xce_handle; -- int port; -- mem_event_back_ring_t back_ring; -- mem_event_shared_page_t *shared_page; -- void *ring_page; --} mem_event_t; -- -- --#endif // __XEN_MEM_EVENT_H__ -- -- --/* -- * Local variables: -- * mode: C -- * c-set-style: "BSD" -- * c-basic-offset: 4 -- * tab-width: 4 -- * indent-tabs-mode: nil -- * End: -- */ -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -31,11 +31,8 @@ - #include - #include - --#include -- - #include "xc_bitops.h" - #include "file_ops.h" -- - #include "policy.h" - #include "xenpaging.h" - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -26,12 +26,17 @@ - - - #include -- - #include - #include - --#include "mem_event.h" -- -+typedef struct mem_event { -+ domid_t domain_id; -+ xc_evtchn *xce_handle; -+ int port; -+ mem_event_back_ring_t back_ring; -+ mem_event_shared_page_t *shared_page; -+ void *ring_page; -+} mem_event_t; - - typedef struct xenpaging { - xc_interface *xc_handle; diff --git a/23599-tools_fix_build_after_recent_xenpaging_changes.patch b/23599-tools_fix_build_after_recent_xenpaging_changes.patch deleted file mode 100644 index 604e313..0000000 --- a/23599-tools_fix_build_after_recent_xenpaging_changes.patch +++ /dev/null @@ -1,30 +0,0 @@ -changeset: 23599:d3027374a8c0 -user: Tim Deegan -date: Mon Jun 27 14:48:57 2011 +0100 -files: tools/xenpaging/Makefile -description: -tools: fix build after recent xenpaging changes - -xenpaging now uses pthreads, so must link appropriately. - -Signed-off-by: Tim Deegan -Committed-by: Ian Jackson - - ---- - tools/xenpaging/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: xen-4.1.2-testing/tools/xenpaging/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/Makefile -+++ xen-4.1.2-testing/tools/xenpaging/Makefile -@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk - CFLAGS += -I $(XEN_XC) - CFLAGS += -I ./ - CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) --LDLIBS += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -+LDLIBS += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -pthread - - POLICY = default - diff --git a/23613-EFI-headers.patch b/23613-EFI-headers.patch deleted file mode 100644 index 37f5694..0000000 --- a/23613-EFI-headers.patch +++ /dev/null @@ -1,2741 +0,0 @@ -References: fate#311376, fate#311529, bnc#578927, bnc#628554 - -# HG changeset patch -# User Jan Beulich -# Date 1309249070 -3600 -# Node ID b8d22c658bd213bf9da0a9d05312b63524652daf -# Parent 6c7a23e08a041a1943b60ed0c4473112aa15c91f -x86-64: EFI header files - -Taken from gnu-efi-3.0k (slightly edited). - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/include/asm-x86/efibind.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/asm-x86/efibind.h -@@ -0,0 +1,6 @@ -+#include -+#if defined(__i386__) -+# include -+#elif defined(__x86_64__) -+# include -+#endif -Index: xen-4.1.3-testing/xen/include/asm-x86/x86_64/efibind.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/asm-x86/x86_64/efibind.h -@@ -0,0 +1,276 @@ -+/*++ -+ -+Copyright (c) 1998 Intel Corporation -+ -+Module Name: -+ -+ efefind.h -+ -+Abstract: -+ -+ EFI to compile bindings -+ -+ -+ -+ -+Revision History -+ -+--*/ -+ -+#ifndef __GNUC__ -+#pragma pack() -+#endif -+ -+// -+// Basic int types of various widths -+// -+ -+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) -+ -+ // No ANSI C 1999/2000 stdint.h integer width declarations -+ -+ #if defined(_MSC_EXTENSIONS) -+ -+ // Use Microsoft C compiler integer width declarations -+ -+ typedef unsigned __int64 uint64_t; -+ typedef __int64 int64_t; -+ typedef unsigned __int32 uint32_t; -+ typedef __int32 int32_t; -+ typedef unsigned short uint16_t; -+ typedef short int16_t; -+ typedef unsigned char uint8_t; -+ typedef char int8_t; -+ #elif defined(__GNUC__) -+ typedef unsigned long long uint64_t __attribute__((aligned (8))); -+ typedef long long int64_t __attribute__((aligned (8))); -+ typedef unsigned int uint32_t; -+ typedef int int32_t; -+ typedef unsigned short uint16_t; -+ typedef short int16_t; -+ typedef unsigned char uint8_t; -+ typedef char int8_t; -+ #elif defined(UNIX_LP64) -+ -+ /* Use LP64 programming model from C_FLAGS for integer width declarations */ -+ -+ typedef unsigned long uint64_t; -+ typedef long int64_t; -+ typedef unsigned int uint32_t; -+ typedef int int32_t; -+ typedef unsigned short uint16_t; -+ typedef short int16_t; -+ typedef unsigned char uint8_t; -+ typedef char int8_t; -+ #else -+ -+ /* Assume P64 programming model from C_FLAGS for integer width declarations */ -+ -+ typedef unsigned long long uint64_t __attribute__((aligned (8))); -+ typedef long long int64_t __attribute__((aligned (8))); -+ typedef unsigned int uint32_t; -+ typedef int int32_t; -+ typedef unsigned short uint16_t; -+ typedef short int16_t; -+ typedef unsigned char uint8_t; -+ typedef char int8_t; -+ #endif -+#endif -+ -+// -+// Basic EFI types of various widths -+// -+ -+#ifndef __WCHAR_TYPE__ -+# define __WCHAR_TYPE__ short -+#endif -+ -+typedef uint64_t UINT64; -+typedef int64_t INT64; -+ -+#ifndef _BASETSD_H_ -+ typedef uint32_t UINT32; -+ typedef int32_t INT32; -+#endif -+ -+typedef uint16_t UINT16; -+typedef int16_t INT16; -+typedef uint8_t UINT8; -+typedef int8_t INT8; -+typedef __WCHAR_TYPE__ WCHAR; -+ -+#undef VOID -+#define VOID void -+ -+ -+typedef int64_t INTN; -+typedef uint64_t UINTN; -+ -+#ifdef EFI_NT_EMULATOR -+ #define POST_CODE(_Data) -+#else -+ #ifdef EFI_DEBUG -+#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al -+ #else -+ #define POST_CODE(_Data) -+ #endif -+#endif -+ -+#define EFIERR(a) (0x8000000000000000 | a) -+#define EFI_ERROR_MASK 0x8000000000000000 -+#define EFIERR_OEM(a) (0xc000000000000000 | a) -+ -+ -+#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -+#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF -+ -+#ifdef EFI_NT_EMULATOR -+ #define BREAKPOINT() __asm { int 3 } -+#else -+ #define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32 -+#endif -+ -+// -+// Pointers must be aligned to these address to function -+// -+ -+#define MIN_ALIGNMENT_SIZE 4 -+ -+#define ALIGN_VARIABLE(Value ,Adjustment) \ -+ (UINTN)Adjustment = 0; \ -+ if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ -+ (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ -+ Value = (UINTN)Value + (UINTN)Adjustment -+ -+ -+// -+// Define macros to build data structure signatures from characters. -+// -+ -+#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) -+#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) -+#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) -+// -+// To export & import functions in the EFI emulator environment -+// -+ -+#ifdef EFI_NT_EMULATOR -+ #define EXPORTAPI __declspec( dllexport ) -+#else -+ #define EXPORTAPI -+#endif -+ -+ -+// -+// EFIAPI - prototype calling convention for EFI function pointers -+// BOOTSERVICE - prototype for implementation of a boot service interface -+// RUNTIMESERVICE - prototype for implementation of a runtime service interface -+// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -+// RUNTIME_CODE - pragma macro for declaring runtime code -+// -+ -+#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options -+ #ifdef _MSC_EXTENSIONS -+ #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler -+ #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -+ #define EFIAPI __attribute__((__ms_abi__)) // Force Microsoft ABI -+ #else -+ #define EFIAPI // Substitute expresion to force C calling convention -+ #endif -+#endif -+ -+#define BOOTSERVICE -+//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a -+//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a -+#define RUNTIMESERVICE -+#define RUNTIMEFUNCTION -+ -+ -+#define RUNTIME_CODE(a) alloc_text("rtcode", a) -+#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -+#define END_RUNTIME_DATA() data_seg("") -+ -+#define VOLATILE volatile -+ -+#define MEMORY_FENCE() -+ -+#ifdef EFI_NT_EMULATOR -+ -+// -+// To help ensure proper coding of integrated drivers, they are -+// compiled as DLLs. In NT they require a dll init entry pointer. -+// The macro puts a stub entry point into the DLL so it will load. -+// -+ -+#define EFI_DRIVER_ENTRY_POINT(InitFunction) \ -+ UINTN \ -+ __stdcall \ -+ _DllMainCRTStartup ( \ -+ UINTN Inst, \ -+ UINTN reason_for_call, \ -+ VOID *rserved \ -+ ) \ -+ { \ -+ return 1; \ -+ } \ -+ \ -+ int \ -+ EXPORTAPI \ -+ __cdecl \ -+ InitializeDriver ( \ -+ void *ImageHandle, \ -+ void *SystemTable \ -+ ) \ -+ { \ -+ return InitFunction(ImageHandle, SystemTable); \ -+ } -+ -+ -+ #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ -+ (_if)->LoadInternal(type, name, NULL) -+ -+#else // EFI_NT_EMULATOR -+ -+// -+// When build similiar to FW, then link everything together as -+// one big module. -+// -+ -+ #define EFI_DRIVER_ENTRY_POINT(InitFunction) -+ -+ #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ -+ (_if)->LoadInternal(type, name, entry) -+ -+#endif // EFI_FW_NT -+ -+// -+// Some compilers don't support the forward reference construct: -+// typedef struct XXXXX -+// -+// The following macro provide a workaround for such cases. -+// -+#ifdef NO_INTERFACE_DECL -+#define INTERFACE_DECL(x) -+#else -+#ifdef __GNUC__ -+#define INTERFACE_DECL(x) struct x -+#else -+#define INTERFACE_DECL(x) typedef struct x -+#endif -+#endif -+ -+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -+#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) -+#else -+/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */ -+#ifdef EFI_FUNCTION_WRAPPER -+UINTN uefi_call_wrapper(void *func, unsigned long va_num, ...); -+#else -+#error "EFI_FUNCTION_WRAPPER must be defined for x86_64 architecture" -+#endif -+#endif -+ -+#ifdef _MSC_EXTENSIONS -+#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP -+#endif -+ -Index: xen-4.1.3-testing/xen/include/efi/efiapi.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/efi/efiapi.h -@@ -0,0 +1,718 @@ -+#ifndef _EFI_API_H -+#define _EFI_API_H -+ -+/*++ -+ -+Copyright (c) 1998 Intel Corporation -+ -+Module Name: -+ -+ efiapi.h -+ -+Abstract: -+ -+ Global EFI runtime & boot service interfaces -+ -+ -+ -+ -+Revision History -+ -+--*/ -+ -+// -+// EFI Specification Revision -+// -+ -+#define EFI_SPECIFICATION_MAJOR_REVISION 1 -+#define EFI_SPECIFICATION_MINOR_REVISION 02 -+ -+// -+// Declare forward referenced data structures -+// -+ -+INTERFACE_DECL(_EFI_SYSTEM_TABLE); -+ -+// -+// EFI Memory -+// -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_ALLOCATE_PAGES) ( -+ IN EFI_ALLOCATE_TYPE Type, -+ IN EFI_MEMORY_TYPE MemoryType, -+ IN UINTN NoPages, -+ OUT EFI_PHYSICAL_ADDRESS *Memory -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FREE_PAGES) ( -+ IN EFI_PHYSICAL_ADDRESS Memory, -+ IN UINTN NoPages -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GET_MEMORY_MAP) ( -+ IN OUT UINTN *MemoryMapSize, -+ IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, -+ OUT UINTN *MapKey, -+ OUT UINTN *DescriptorSize, -+ OUT UINT32 *DescriptorVersion -+ ); -+ -+#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_ALLOCATE_POOL) ( -+ IN EFI_MEMORY_TYPE PoolType, -+ IN UINTN Size, -+ OUT VOID **Buffer -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FREE_POOL) ( -+ IN VOID *Buffer -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) ( -+ IN UINTN MemoryMapSize, -+ IN UINTN DescriptorSize, -+ IN UINT32 DescriptorVersion, -+ IN EFI_MEMORY_DESCRIPTOR *VirtualMap -+ ); -+ -+ -+#define EFI_OPTIONAL_PTR 0x00000001 -+#define EFI_INTERNAL_FNC 0x00000002 // Pointer to internal runtime fnc -+#define EFI_INTERNAL_PTR 0x00000004 // Pointer to internal runtime data -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_CONVERT_POINTER) ( -+ IN UINTN DebugDisposition, -+ IN OUT VOID **Address -+ ); -+ -+ -+// -+// EFI Events -+// -+ -+ -+ -+#define EVT_TIMER 0x80000000 -+#define EVT_RUNTIME 0x40000000 -+#define EVT_RUNTIME_CONTEXT 0x20000000 -+ -+#define EVT_NOTIFY_WAIT 0x00000100 -+#define EVT_NOTIFY_SIGNAL 0x00000200 -+ -+#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201 -+#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202 -+ -+#define EVT_EFI_SIGNAL_MASK 0x000000FF -+#define EVT_EFI_SIGNAL_MAX 2 -+ -+typedef -+VOID -+(EFIAPI *EFI_EVENT_NOTIFY) ( -+ IN EFI_EVENT Event, -+ IN VOID *Context -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_CREATE_EVENT) ( -+ IN UINT32 Type, -+ IN EFI_TPL NotifyTpl, -+ IN EFI_EVENT_NOTIFY NotifyFunction, -+ IN VOID *NotifyContext, -+ OUT EFI_EVENT *Event -+ ); -+ -+typedef enum { -+ TimerCancel, -+ TimerPeriodic, -+ TimerRelative, -+ TimerTypeMax -+} EFI_TIMER_DELAY; -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_SET_TIMER) ( -+ IN EFI_EVENT Event, -+ IN EFI_TIMER_DELAY Type, -+ IN UINT64 TriggerTime -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_SIGNAL_EVENT) ( -+ IN EFI_EVENT Event -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_WAIT_FOR_EVENT) ( -+ IN UINTN NumberOfEvents, -+ IN EFI_EVENT *Event, -+ OUT UINTN *Index -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_CLOSE_EVENT) ( -+ IN EFI_EVENT Event -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_CHECK_EVENT) ( -+ IN EFI_EVENT Event -+ ); -+ -+// -+// Task priority level -+// -+ -+#define TPL_APPLICATION 4 -+#define TPL_CALLBACK 8 -+#define TPL_NOTIFY 16 -+#define TPL_HIGH_LEVEL 31 -+ -+typedef -+EFI_TPL -+(EFIAPI *EFI_RAISE_TPL) ( -+ IN EFI_TPL NewTpl -+ ); -+ -+typedef -+VOID -+(EFIAPI *EFI_RESTORE_TPL) ( -+ IN EFI_TPL OldTpl -+ ); -+ -+ -+// -+// EFI platform varibles -+// -+ -+#define EFI_GLOBAL_VARIABLE \ -+ { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } -+ -+// Variable attributes -+#define EFI_VARIABLE_NON_VOLATILE 0x00000001 -+#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 -+#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 -+ -+// Variable size limitation -+#define EFI_MAXIMUM_VARIABLE_SIZE 1024 -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GET_VARIABLE) ( -+ IN CHAR16 *VariableName, -+ IN EFI_GUID *VendorGuid, -+ OUT UINT32 *Attributes OPTIONAL, -+ IN OUT UINTN *DataSize, -+ OUT VOID *Data -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) ( -+ IN OUT UINTN *VariableNameSize, -+ IN OUT CHAR16 *VariableName, -+ IN OUT EFI_GUID *VendorGuid -+ ); -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_SET_VARIABLE) ( -+ IN CHAR16 *VariableName, -+ IN EFI_GUID *VendorGuid, -+ IN UINT32 Attributes, -+ IN UINTN DataSize, -+ IN VOID *Data -+ ); -+ -+ -+// -+// EFI Time -+// -+ -+typedef struct { -+ UINT32 Resolution; // 1e-6 parts per million -+ UINT32 Accuracy; // hertz -+ BOOLEAN SetsToZero; // Set clears sub-second time -+} EFI_TIME_CAPABILITIES; -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GET_TIME) ( -+ OUT EFI_TIME *Time, -+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_SET_TIME) ( -+ IN EFI_TIME *Time -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GET_WAKEUP_TIME) ( -+ OUT BOOLEAN *Enabled, -+ OUT BOOLEAN *Pending, -+ OUT EFI_TIME *Time -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_SET_WAKEUP_TIME) ( -+ IN BOOLEAN Enable, -+ IN EFI_TIME *Time OPTIONAL -+ ); -+ -+ -+// -+// Image functions -+// -+ -+ -+// PE32+ Subsystem type for EFI images -+ -+#if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION) -+#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 -+#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 -+#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 -+#endif -+ -+// PE32+ Machine type for EFI images -+ -+#if !defined(EFI_IMAGE_MACHINE_IA32) -+#define EFI_IMAGE_MACHINE_IA32 0x014c -+#endif -+ -+#if !defined(EFI_IMAGE_MACHINE_IA64) -+#define EFI_IMAGE_MACHINE_IA64 0x0200 -+#endif -+ -+// Image Entry prototype -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IMAGE_ENTRY_POINT) ( -+ IN EFI_HANDLE ImageHandle, -+ IN struct _EFI_SYSTEM_TABLE *SystemTable -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IMAGE_LOAD) ( -+ IN BOOLEAN BootPolicy, -+ IN EFI_HANDLE ParentImageHandle, -+ IN EFI_DEVICE_PATH *FilePath, -+ IN VOID *SourceBuffer OPTIONAL, -+ IN UINTN SourceSize, -+ OUT EFI_HANDLE *ImageHandle -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IMAGE_START) ( -+ IN EFI_HANDLE ImageHandle, -+ OUT UINTN *ExitDataSize, -+ OUT CHAR16 **ExitData OPTIONAL -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_EXIT) ( -+ IN EFI_HANDLE ImageHandle, -+ IN EFI_STATUS ExitStatus, -+ IN UINTN ExitDataSize, -+ IN CHAR16 *ExitData OPTIONAL -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IMAGE_UNLOAD) ( -+ IN EFI_HANDLE ImageHandle -+ ); -+ -+ -+// Image handle -+#define LOADED_IMAGE_PROTOCOL \ -+ { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } -+ -+#define EFI_IMAGE_INFORMATION_REVISION 0x1000 -+typedef struct { -+ UINT32 Revision; -+ EFI_HANDLE ParentHandle; -+ struct _EFI_SYSTEM_TABLE *SystemTable; -+ -+ // Source location of image -+ EFI_HANDLE DeviceHandle; -+ EFI_DEVICE_PATH *FilePath; -+ VOID *Reserved; -+ -+ // Images load options -+ UINT32 LoadOptionsSize; -+ VOID *LoadOptions; -+ -+ // Location of where image was loaded -+ VOID *ImageBase; -+ UINT64 ImageSize; -+ EFI_MEMORY_TYPE ImageCodeType; -+ EFI_MEMORY_TYPE ImageDataType; -+ -+ // If the driver image supports a dynamic unload request -+ EFI_IMAGE_UNLOAD Unload; -+ -+} EFI_LOADED_IMAGE; -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_EXIT_BOOT_SERVICES) ( -+ IN EFI_HANDLE ImageHandle, -+ IN UINTN MapKey -+ ); -+ -+// -+// Misc -+// -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_STALL) ( -+ IN UINTN Microseconds -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_SET_WATCHDOG_TIMER) ( -+ IN UINTN Timeout, -+ IN UINT64 WatchdogCode, -+ IN UINTN DataSize, -+ IN CHAR16 *WatchdogData OPTIONAL -+ ); -+ -+ -+typedef enum { -+ EfiResetCold, -+ EfiResetWarm, -+ EfiResetShutdown -+} EFI_RESET_TYPE; -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_RESET_SYSTEM) ( -+ IN EFI_RESET_TYPE ResetType, -+ IN EFI_STATUS ResetStatus, -+ IN UINTN DataSize, -+ IN CHAR16 *ResetData OPTIONAL -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) ( -+ OUT UINT64 *Count -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) ( -+ OUT UINT32 *HighCount -+ ); -+ -+// -+// Protocol handler functions -+// -+ -+typedef enum { -+ EFI_NATIVE_INTERFACE, -+ EFI_PCODE_INTERFACE -+} EFI_INTERFACE_TYPE; -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) ( -+ IN OUT EFI_HANDLE *Handle, -+ IN EFI_GUID *Protocol, -+ IN EFI_INTERFACE_TYPE InterfaceType, -+ IN VOID *Interface -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) ( -+ IN EFI_HANDLE Handle, -+ IN EFI_GUID *Protocol, -+ IN VOID *OldInterface, -+ IN VOID *NewInterface -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) ( -+ IN EFI_HANDLE Handle, -+ IN EFI_GUID *Protocol, -+ IN VOID *Interface -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_HANDLE_PROTOCOL) ( -+ IN EFI_HANDLE Handle, -+ IN EFI_GUID *Protocol, -+ OUT VOID **Interface -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) ( -+ IN EFI_GUID *Protocol, -+ IN EFI_EVENT Event, -+ OUT VOID **Registration -+ ); -+ -+typedef enum { -+ AllHandles, -+ ByRegisterNotify, -+ ByProtocol -+} EFI_LOCATE_SEARCH_TYPE; -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_LOCATE_HANDLE) ( -+ IN EFI_LOCATE_SEARCH_TYPE SearchType, -+ IN EFI_GUID *Protocol OPTIONAL, -+ IN VOID *SearchKey OPTIONAL, -+ IN OUT UINTN *BufferSize, -+ OUT EFI_HANDLE *Buffer -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_LOCATE_DEVICE_PATH) ( -+ IN EFI_GUID *Protocol, -+ IN OUT EFI_DEVICE_PATH **DevicePath, -+ OUT EFI_HANDLE *Device -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) ( -+ IN EFI_GUID *Guid, -+ IN VOID *Table -+ ); -+ -+typedef VOID *EFI_RESERVED_SERVICE; -+ -+// -+// Standard EFI table header -+// -+ -+typedef struct _EFI_TABLE_HEARDER { -+ UINT64 Signature; -+ UINT32 Revision; -+ UINT32 HeaderSize; -+ UINT32 CRC32; -+ UINT32 Reserved; -+} EFI_TABLE_HEADER; -+ -+ -+// -+// EFI Runtime Serivces Table -+// -+ -+#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 -+#define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) -+ -+typedef struct { -+ EFI_TABLE_HEADER Hdr; -+ -+ // -+ // Time services -+ // -+ -+ EFI_GET_TIME GetTime; -+ EFI_SET_TIME SetTime; -+ EFI_GET_WAKEUP_TIME GetWakeupTime; -+ EFI_SET_WAKEUP_TIME SetWakeupTime; -+ -+ // -+ // Virtual memory services -+ // -+ -+ EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap; -+ EFI_CONVERT_POINTER ConvertPointer; -+ -+ // -+ // Variable serviers -+ // -+ -+ EFI_GET_VARIABLE GetVariable; -+ EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; -+ EFI_SET_VARIABLE SetVariable; -+ -+ // -+ // Misc -+ // -+ -+ EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; -+ EFI_RESET_SYSTEM ResetSystem; -+ -+} EFI_RUNTIME_SERVICES; -+ -+ -+// -+// EFI Boot Services Table -+// -+ -+#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 -+#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) -+ -+typedef struct _EFI_BOOT_SERVICES { -+ -+ EFI_TABLE_HEADER Hdr; -+ -+ // -+ // Task priority functions -+ // -+ -+ EFI_RAISE_TPL RaiseTPL; -+ EFI_RESTORE_TPL RestoreTPL; -+ -+ // -+ // Memory functions -+ // -+ -+ EFI_ALLOCATE_PAGES AllocatePages; -+ EFI_FREE_PAGES FreePages; -+ EFI_GET_MEMORY_MAP GetMemoryMap; -+ EFI_ALLOCATE_POOL AllocatePool; -+ EFI_FREE_POOL FreePool; -+ -+ // -+ // Event & timer functions -+ // -+ -+ EFI_CREATE_EVENT CreateEvent; -+ EFI_SET_TIMER SetTimer; -+ EFI_WAIT_FOR_EVENT WaitForEvent; -+ EFI_SIGNAL_EVENT SignalEvent; -+ EFI_CLOSE_EVENT CloseEvent; -+ EFI_CHECK_EVENT CheckEvent; -+ -+ // -+ // Protocol handler functions -+ // -+ -+ EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; -+ EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; -+ EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; -+ EFI_HANDLE_PROTOCOL HandleProtocol; -+ EFI_HANDLE_PROTOCOL PCHandleProtocol; -+ EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; -+ EFI_LOCATE_HANDLE LocateHandle; -+ EFI_LOCATE_DEVICE_PATH LocateDevicePath; -+ EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; -+ -+ // -+ // Image functions -+ // -+ -+ EFI_IMAGE_LOAD LoadImage; -+ EFI_IMAGE_START StartImage; -+ EFI_EXIT Exit; -+ EFI_IMAGE_UNLOAD UnloadImage; -+ EFI_EXIT_BOOT_SERVICES ExitBootServices; -+ -+ // -+ // Misc functions -+ // -+ -+ EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; -+ EFI_STALL Stall; -+ EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; -+ -+} EFI_BOOT_SERVICES; -+ -+ -+// -+// EFI Configuration Table and GUID definitions -+// -+ -+#define MPS_TABLE_GUID \ -+ { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+#define ACPI_TABLE_GUID \ -+ { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+#define ACPI_20_TABLE_GUID \ -+ { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } -+ -+#define SMBIOS_TABLE_GUID \ -+ { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+#define SAL_SYSTEM_TABLE_GUID \ -+ { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+ -+typedef struct _EFI_CONFIGURATION_TABLE { -+ EFI_GUID VendorGuid; -+ VOID *VendorTable; -+} EFI_CONFIGURATION_TABLE; -+ -+ -+// -+// EFI System Table -+// -+ -+ -+ -+ -+#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 -+#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) -+ -+typedef struct _EFI_SYSTEM_TABLE { -+ EFI_TABLE_HEADER Hdr; -+ -+ CHAR16 *FirmwareVendor; -+ UINT32 FirmwareRevision; -+ -+ EFI_HANDLE ConsoleInHandle; -+ SIMPLE_INPUT_INTERFACE *ConIn; -+ -+ EFI_HANDLE ConsoleOutHandle; -+ SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; -+ -+ EFI_HANDLE StandardErrorHandle; -+ SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; -+ -+ EFI_RUNTIME_SERVICES *RuntimeServices; -+ EFI_BOOT_SERVICES *BootServices; -+ -+ UINTN NumberOfTableEntries; -+ EFI_CONFIGURATION_TABLE *ConfigurationTable; -+ -+} EFI_SYSTEM_TABLE; -+ -+#endif -+ -Index: xen-4.1.3-testing/xen/include/efi/eficon.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/efi/eficon.h -@@ -0,0 +1,302 @@ -+#ifndef _EFI_CON_H -+#define _EFI_CON_H -+ -+/*++ -+ -+Copyright (c) 1998 Intel Corporation -+ -+Module Name: -+ -+ eficon.h -+ -+Abstract: -+ -+ EFI console protocols -+ -+ -+ -+Revision History -+ -+--*/ -+ -+// -+// Text output protocol -+// -+ -+#define SIMPLE_TEXT_OUTPUT_PROTOCOL \ -+ { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+ -+INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_RESET) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN BOOLEAN ExtendedVerification -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_OUTPUT_STRING) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN CHAR16 *String -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_TEST_STRING) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN CHAR16 *String -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_QUERY_MODE) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN UINTN ModeNumber, -+ OUT UINTN *Columns, -+ OUT UINTN *Rows -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_SET_MODE) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN UINTN ModeNumber -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN UINTN Attribute -+ ); -+ -+#define EFI_BLACK 0x00 -+#define EFI_BLUE 0x01 -+#define EFI_GREEN 0x02 -+#define EFI_CYAN (EFI_BLUE | EFI_GREEN) -+#define EFI_RED 0x04 -+#define EFI_MAGENTA (EFI_BLUE | EFI_RED) -+#define EFI_BROWN (EFI_GREEN | EFI_RED) -+#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED) -+#define EFI_BRIGHT 0x08 -+#define EFI_DARKGRAY (EFI_BRIGHT) -+#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT) -+#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT) -+#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT) -+#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT) -+#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT) -+#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT) -+#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT) -+ -+#define EFI_TEXT_ATTR(f,b) ((f) | ((b) << 4)) -+ -+#define EFI_BACKGROUND_BLACK 0x00 -+#define EFI_BACKGROUND_BLUE 0x10 -+#define EFI_BACKGROUND_GREEN 0x20 -+#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN) -+#define EFI_BACKGROUND_RED 0x40 -+#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED) -+#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED) -+#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED) -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_CLEAR_SCREEN) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN UINTN Column, -+ IN UINTN Row -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_TEXT_ENABLE_CURSOR) ( -+ IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, -+ IN BOOLEAN Enable -+ ); -+ -+typedef struct { -+ INT32 MaxMode; -+ // current settings -+ INT32 Mode; -+ INT32 Attribute; -+ INT32 CursorColumn; -+ INT32 CursorRow; -+ BOOLEAN CursorVisible; -+} SIMPLE_TEXT_OUTPUT_MODE; -+ -+typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { -+ EFI_TEXT_RESET Reset; -+ -+ EFI_TEXT_OUTPUT_STRING OutputString; -+ EFI_TEXT_TEST_STRING TestString; -+ -+ EFI_TEXT_QUERY_MODE QueryMode; -+ EFI_TEXT_SET_MODE SetMode; -+ EFI_TEXT_SET_ATTRIBUTE SetAttribute; -+ -+ EFI_TEXT_CLEAR_SCREEN ClearScreen; -+ EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; -+ EFI_TEXT_ENABLE_CURSOR EnableCursor; -+ -+ // Current mode -+ SIMPLE_TEXT_OUTPUT_MODE *Mode; -+} SIMPLE_TEXT_OUTPUT_INTERFACE; -+ -+// -+// Define's for required EFI Unicode Box Draw character -+// -+ -+#define BOXDRAW_HORIZONTAL 0x2500 -+#define BOXDRAW_VERTICAL 0x2502 -+#define BOXDRAW_DOWN_RIGHT 0x250c -+#define BOXDRAW_DOWN_LEFT 0x2510 -+#define BOXDRAW_UP_RIGHT 0x2514 -+#define BOXDRAW_UP_LEFT 0x2518 -+#define BOXDRAW_VERTICAL_RIGHT 0x251c -+#define BOXDRAW_VERTICAL_LEFT 0x2524 -+#define BOXDRAW_DOWN_HORIZONTAL 0x252c -+#define BOXDRAW_UP_HORIZONTAL 0x2534 -+#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c -+ -+#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550 -+#define BOXDRAW_DOUBLE_VERTICAL 0x2551 -+#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552 -+#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553 -+#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554 -+ -+#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555 -+#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556 -+#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557 -+ -+#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558 -+#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559 -+#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a -+ -+#define BOXDRAW_UP_LEFT_DOUBLE 0x255b -+#define BOXDRAW_UP_DOUBLE_LEFT 0x255c -+#define BOXDRAW_DOUBLE_UP_LEFT 0x255d -+ -+#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e -+#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f -+#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560 -+ -+#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561 -+#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562 -+#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563 -+ -+#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564 -+#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565 -+#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566 -+ -+#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567 -+#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568 -+#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569 -+ -+#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a -+#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b -+#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c -+ -+// -+// EFI Required Block Elements Code Chart -+// -+ -+#define BLOCKELEMENT_FULL_BLOCK 0x2588 -+#define BLOCKELEMENT_LIGHT_SHADE 0x2591 -+// -+// EFI Required Geometric Shapes Code Chart -+// -+ -+#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2 -+#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba -+#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc -+#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4 -+ -+// -+// EFI Required Arrow shapes -+// -+ -+#define ARROW_UP 0x2191 -+#define ARROW_DOWN 0x2193 -+ -+// -+// Text input protocol -+// -+ -+#define SIMPLE_TEXT_INPUT_PROTOCOL \ -+ { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+ -+INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE); -+ -+typedef struct { -+ UINT16 ScanCode; -+ CHAR16 UnicodeChar; -+} EFI_INPUT_KEY; -+ -+// -+// Baseline unicode control chars -+// -+ -+#define CHAR_NULL 0x0000 -+#define CHAR_BACKSPACE 0x0008 -+#define CHAR_TAB 0x0009 -+#define CHAR_LINEFEED 0x000A -+#define CHAR_CARRIAGE_RETURN 0x000D -+ -+// -+// Scan codes for base line keys -+// -+ -+#define SCAN_NULL 0x0000 -+#define SCAN_UP 0x0001 -+#define SCAN_DOWN 0x0002 -+#define SCAN_RIGHT 0x0003 -+#define SCAN_LEFT 0x0004 -+#define SCAN_HOME 0x0005 -+#define SCAN_END 0x0006 -+#define SCAN_INSERT 0x0007 -+#define SCAN_DELETE 0x0008 -+#define SCAN_PAGE_UP 0x0009 -+#define SCAN_PAGE_DOWN 0x000A -+#define SCAN_F1 0x000B -+#define SCAN_F2 0x000C -+#define SCAN_F3 0x000D -+#define SCAN_F4 0x000E -+#define SCAN_F5 0x000F -+#define SCAN_F6 0x0010 -+#define SCAN_F7 0x0011 -+#define SCAN_F8 0x0012 -+#define SCAN_F9 0x0013 -+#define SCAN_F10 0x0014 -+#define SCAN_ESC 0x0017 -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_INPUT_RESET) ( -+ IN struct _SIMPLE_INPUT_INTERFACE *This, -+ IN BOOLEAN ExtendedVerification -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_INPUT_READ_KEY) ( -+ IN struct _SIMPLE_INPUT_INTERFACE *This, -+ OUT EFI_INPUT_KEY *Key -+ ); -+ -+typedef struct _SIMPLE_INPUT_INTERFACE { -+ EFI_INPUT_RESET Reset; -+ EFI_INPUT_READ_KEY ReadKeyStroke; -+ EFI_EVENT WaitForKey; -+} SIMPLE_INPUT_INTERFACE; -+ -+#endif -+ -Index: xen-4.1.3-testing/xen/include/efi/efidef.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/efi/efidef.h -@@ -0,0 +1,196 @@ -+#ifndef _EFI_DEF_H -+#define _EFI_DEF_H -+ -+/*++ -+ -+Copyright (c) 1998 Intel Corporation -+ -+Module Name: -+ -+ efidef.h -+ -+Abstract: -+ -+ EFI definitions -+ -+ -+ -+ -+Revision History -+ -+--*/ -+ -+typedef UINT16 CHAR16; -+typedef UINT8 CHAR8; -+typedef UINT8 BOOLEAN; -+ -+#ifndef TRUE -+ #define TRUE ((BOOLEAN) 1) -+ #define FALSE ((BOOLEAN) 0) -+#endif -+ -+#ifndef NULL -+ #define NULL ((VOID *) 0) -+#endif -+ -+typedef UINTN EFI_STATUS; -+typedef UINT64 EFI_LBA; -+typedef UINTN EFI_TPL; -+typedef VOID *EFI_HANDLE; -+typedef VOID *EFI_EVENT; -+ -+ -+// -+// Prototype argument decoration for EFI parameters to indicate -+// their direction -+// -+// IN - argument is passed into the function -+// OUT - argument (pointer) is returned from the function -+// OPTIONAL - argument is optional -+// -+ -+#ifndef IN -+ #define IN -+ #define OUT -+ #define OPTIONAL -+#endif -+ -+ -+// -+// A GUID -+// -+ -+typedef struct { -+ UINT32 Data1; -+ UINT16 Data2; -+ UINT16 Data3; -+ UINT8 Data4[8]; -+} EFI_GUID; -+ -+ -+// -+// Time -+// -+ -+typedef struct { -+ UINT16 Year; // 1998 - 20XX -+ UINT8 Month; // 1 - 12 -+ UINT8 Day; // 1 - 31 -+ UINT8 Hour; // 0 - 23 -+ UINT8 Minute; // 0 - 59 -+ UINT8 Second; // 0 - 59 -+ UINT8 Pad1; -+ UINT32 Nanosecond; // 0 - 999,999,999 -+ INT16 TimeZone; // -1440 to 1440 or 2047 -+ UINT8 Daylight; -+ UINT8 Pad2; -+} EFI_TIME; -+ -+// Bit definitions for EFI_TIME.Daylight -+#define EFI_TIME_ADJUST_DAYLIGHT 0x01 -+#define EFI_TIME_IN_DAYLIGHT 0x02 -+ -+// Value definition for EFI_TIME.TimeZone -+#define EFI_UNSPECIFIED_TIMEZONE 0x07FF -+ -+ -+ -+// -+// Networking -+// -+ -+typedef struct { -+ UINT8 Addr[4]; -+} EFI_IPv4_ADDRESS; -+ -+typedef struct { -+ UINT8 Addr[16]; -+} EFI_IPv6_ADDRESS; -+ -+typedef struct { -+ UINT8 Addr[32]; -+} EFI_MAC_ADDRESS; -+ -+// -+// Memory -+// -+ -+typedef UINT64 EFI_PHYSICAL_ADDRESS; -+typedef UINT64 EFI_VIRTUAL_ADDRESS; -+ -+typedef enum { -+ AllocateAnyPages, -+ AllocateMaxAddress, -+ AllocateAddress, -+ MaxAllocateType -+} EFI_ALLOCATE_TYPE; -+ -+//Preseve the attr on any range supplied. -+//ConventialMemory must have WB,SR,SW when supplied. -+//When allocating from ConventialMemory always make it WB,SR,SW -+//When returning to ConventialMemory always make it WB,SR,SW -+//When getting the memory map, or on RT for runtime types -+ -+ -+typedef enum { -+ EfiReservedMemoryType, -+ EfiLoaderCode, -+ EfiLoaderData, -+ EfiBootServicesCode, -+ EfiBootServicesData, -+ EfiRuntimeServicesCode, -+ EfiRuntimeServicesData, -+ EfiConventionalMemory, -+ EfiUnusableMemory, -+ EfiACPIReclaimMemory, -+ EfiACPIMemoryNVS, -+ EfiMemoryMappedIO, -+ EfiMemoryMappedIOPortSpace, -+ EfiPalCode, -+ EfiMaxMemoryType -+} EFI_MEMORY_TYPE; -+ -+// possible caching types for the memory range -+#define EFI_MEMORY_UC 0x0000000000000001 -+#define EFI_MEMORY_WC 0x0000000000000002 -+#define EFI_MEMORY_WT 0x0000000000000004 -+#define EFI_MEMORY_WB 0x0000000000000008 -+#define EFI_MEMORY_UCE 0x0000000000000010 -+ -+// physical memory protection on range -+#define EFI_MEMORY_WP 0x0000000000001000 -+#define EFI_MEMORY_RP 0x0000000000002000 -+#define EFI_MEMORY_XP 0x0000000000004000 -+ -+// range requires a runtime mapping -+#define EFI_MEMORY_RUNTIME 0x8000000000000000 -+ -+#define EFI_MEMORY_DESCRIPTOR_VERSION 1 -+typedef struct { -+ UINT32 Type; // Field size is 32 bits followed by 32 bit pad -+ UINT32 Pad; -+ EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits -+ EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits -+ UINT64 NumberOfPages; // Field size is 64 bits -+ UINT64 Attribute; // Field size is 64 bits -+} EFI_MEMORY_DESCRIPTOR; -+ -+// -+// International Language -+// -+ -+typedef UINT8 ISO_639_2; -+#define ISO_639_2_ENTRY_SIZE 3 -+ -+// -+// -+// -+ -+#define EFI_PAGE_SIZE 4096 -+#define EFI_PAGE_MASK 0xFFF -+#define EFI_PAGE_SHIFT 12 -+ -+#define EFI_SIZE_TO_PAGES(a) \ -+ ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) ) -+ -+#endif -Index: xen-4.1.3-testing/xen/include/efi/efidevp.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/efi/efidevp.h -@@ -0,0 +1,402 @@ -+#ifndef _DEVPATH_H -+#define _DEVPATH_H -+ -+/*++ -+ -+Copyright (c) 1998 Intel Corporation -+ -+Module Name: -+ -+ devpath.h -+ -+Abstract: -+ -+ Defines for parsing the EFI Device Path structures -+ -+ -+ -+Revision History -+ -+--*/ -+ -+// -+// Device Path structures - Section C -+// -+ -+typedef struct _EFI_DEVICE_PATH { -+ UINT8 Type; -+ UINT8 SubType; -+ UINT8 Length[2]; -+} EFI_DEVICE_PATH; -+ -+#define EFI_DP_TYPE_MASK 0x7F -+#define EFI_DP_TYPE_UNPACKED 0x80 -+ -+//#define END_DEVICE_PATH_TYPE 0xff -+#define END_DEVICE_PATH_TYPE 0x7f -+//#define END_DEVICE_PATH_TYPE_UNPACKED 0x7f -+ -+#define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff -+#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 -+#define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH)) -+ -+ -+#define DP_IS_END_TYPE(a) -+#define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) -+ -+#define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK ) -+#define DevicePathSubType(a) ( (a)->SubType ) -+#define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) ) -+#define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) -+//#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED ) -+#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE ) -+#define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) -+#define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) ) -+#define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED ) -+ -+ -+#define SetDevicePathNodeLength(a,l) { \ -+ (a)->Length[0] = (UINT8) (l); \ -+ (a)->Length[1] = (UINT8) ((l) >> 8); \ -+ } -+ -+#define SetDevicePathEndNode(a) { \ -+ (a)->Type = END_DEVICE_PATH_TYPE; \ -+ (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ -+ (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \ -+ (a)->Length[1] = 0; \ -+ } -+ -+ -+ -+/* -+ * -+ */ -+#define HARDWARE_DEVICE_PATH 0x01 -+ -+#define HW_PCI_DP 0x01 -+typedef struct _PCI_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT8 Function; -+ UINT8 Device; -+} PCI_DEVICE_PATH; -+ -+#define HW_PCCARD_DP 0x02 -+typedef struct _PCCARD_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT8 SocketNumber; -+} PCCARD_DEVICE_PATH; -+ -+#define HW_MEMMAP_DP 0x03 -+typedef struct _MEMMAP_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 MemoryType; -+ EFI_PHYSICAL_ADDRESS StartingAddress; -+ EFI_PHYSICAL_ADDRESS EndingAddress; -+} MEMMAP_DEVICE_PATH; -+ -+#define HW_VENDOR_DP 0x04 -+typedef struct _VENDOR_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ EFI_GUID Guid; -+} VENDOR_DEVICE_PATH; -+ -+#define UNKNOWN_DEVICE_GUID \ -+ { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } -+ -+typedef struct _UKNOWN_DEVICE_VENDOR_DP { -+ VENDOR_DEVICE_PATH DevicePath; -+ UINT8 LegacyDriveLetter; -+} UNKNOWN_DEVICE_VENDOR_DEVICE_PATH; -+ -+#define HW_CONTROLLER_DP 0x05 -+typedef struct _CONTROLLER_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 Controller; -+} CONTROLLER_DEVICE_PATH; -+ -+/* -+ * -+ */ -+#define ACPI_DEVICE_PATH 0x02 -+ -+#define ACPI_DP 0x01 -+typedef struct _ACPI_HID_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 HID; -+ UINT32 UID; -+} ACPI_HID_DEVICE_PATH; -+ -+#define EXPANDED_ACPI_DP 0x02 -+typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 HID; -+ UINT32 UID; -+ UINT32 CID; -+ UINT8 HidStr[1]; -+} EXPANDED_ACPI_HID_DEVICE_PATH; -+ -+// -+// EISA ID Macro -+// EISA ID Definition 32-bits -+// bits[15:0] - three character compressed ASCII EISA ID. -+// bits[31:16] - binary number -+// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' -+// -+#define PNP_EISA_ID_CONST 0x41d0 -+#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16)) -+#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) -+ -+#define PNP_EISA_ID_MASK 0xffff -+#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) -+/* -+ * -+ */ -+#define MESSAGING_DEVICE_PATH 0x03 -+ -+#define MSG_ATAPI_DP 0x01 -+typedef struct _ATAPI_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT8 PrimarySecondary; -+ UINT8 SlaveMaster; -+ UINT16 Lun; -+} ATAPI_DEVICE_PATH; -+ -+#define MSG_SCSI_DP 0x02 -+typedef struct _SCSI_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT16 Pun; -+ UINT16 Lun; -+} SCSI_DEVICE_PATH; -+ -+#define MSG_FIBRECHANNEL_DP 0x03 -+typedef struct _FIBRECHANNEL_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 Reserved; -+ UINT64 WWN; -+ UINT64 Lun; -+} FIBRECHANNEL_DEVICE_PATH; -+ -+#define MSG_1394_DP 0x04 -+typedef struct _F1394_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 Reserved; -+ UINT64 Guid; -+} F1394_DEVICE_PATH; -+ -+#define MSG_USB_DP 0x05 -+typedef struct _USB_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT8 Port; -+ UINT8 Endpoint; -+} USB_DEVICE_PATH; -+ -+#define MSG_USB_CLASS_DP 0x0F -+typedef struct _USB_CLASS_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT16 VendorId; -+ UINT16 ProductId; -+ UINT8 DeviceClass; -+ UINT8 DeviceSubclass; -+ UINT8 DeviceProtocol; -+} USB_CLASS_DEVICE_PATH; -+ -+#define MSG_I2O_DP 0x06 -+typedef struct _I2O_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 Tid; -+} I2O_DEVICE_PATH; -+ -+#define MSG_MAC_ADDR_DP 0x0b -+typedef struct _MAC_ADDR_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ EFI_MAC_ADDRESS MacAddress; -+ UINT8 IfType; -+} MAC_ADDR_DEVICE_PATH; -+ -+#define MSG_IPv4_DP 0x0c -+typedef struct _IPv4_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ EFI_IPv4_ADDRESS LocalIpAddress; -+ EFI_IPv4_ADDRESS RemoteIpAddress; -+ UINT16 LocalPort; -+ UINT16 RemotePort; -+ UINT16 Protocol; -+ BOOLEAN StaticIpAddress; -+} IPv4_DEVICE_PATH; -+ -+#define MSG_IPv6_DP 0x0d -+typedef struct _IPv6_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ EFI_IPv6_ADDRESS LocalIpAddress; -+ EFI_IPv6_ADDRESS RemoteIpAddress; -+ UINT16 LocalPort; -+ UINT16 RemotePort; -+ UINT16 Protocol; -+ BOOLEAN StaticIpAddress; -+} IPv6_DEVICE_PATH; -+ -+#define MSG_INFINIBAND_DP 0x09 -+typedef struct _INFINIBAND_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 Reserved; -+ UINT64 NodeGuid; -+ UINT64 IocGuid; -+ UINT64 DeviceId; -+} INFINIBAND_DEVICE_PATH; -+ -+#define MSG_UART_DP 0x0e -+typedef struct _UART_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 Reserved; -+ UINT64 BaudRate; -+ UINT8 DataBits; -+ UINT8 Parity; -+ UINT8 StopBits; -+} UART_DEVICE_PATH; -+ -+#define MSG_VENDOR_DP 0x0A -+/* Use VENDOR_DEVICE_PATH struct */ -+ -+#define DEVICE_PATH_MESSAGING_PC_ANSI \ -+ { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+#define DEVICE_PATH_MESSAGING_VT_100 \ -+ { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+ -+ -+#define MEDIA_DEVICE_PATH 0x04 -+ -+#define MEDIA_HARDDRIVE_DP 0x01 -+typedef struct _HARDDRIVE_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 PartitionNumber; -+ UINT64 PartitionStart; -+ UINT64 PartitionSize; -+ UINT8 Signature[16]; -+ UINT8 MBRType; -+ UINT8 SignatureType; -+} HARDDRIVE_DEVICE_PATH; -+ -+#define MBR_TYPE_PCAT 0x01 -+#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02 -+ -+#define SIGNATURE_TYPE_MBR 0x01 -+#define SIGNATURE_TYPE_GUID 0x02 -+ -+#define MEDIA_CDROM_DP 0x02 -+typedef struct _CDROM_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT32 BootEntry; -+ UINT64 PartitionStart; -+ UINT64 PartitionSize; -+} CDROM_DEVICE_PATH; -+ -+#define MEDIA_VENDOR_DP 0x03 -+/* Use VENDOR_DEVICE_PATH struct */ -+ -+#define MEDIA_FILEPATH_DP 0x04 -+typedef struct _FILEPATH_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ CHAR16 PathName[1]; -+} FILEPATH_DEVICE_PATH; -+ -+#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName) -+ -+#define MEDIA_PROTOCOL_DP 0x05 -+typedef struct _MEDIA_PROTOCOL_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ EFI_GUID Protocol; -+} MEDIA_PROTOCOL_DEVICE_PATH; -+ -+ -+#define BBS_DEVICE_PATH 0x05 -+#define BBS_BBS_DP 0x01 -+typedef struct _BBS_BBS_DEVICE_PATH { -+ EFI_DEVICE_PATH Header; -+ UINT16 DeviceType; -+ UINT16 StatusFlag; -+ CHAR8 String[1]; -+} BBS_BBS_DEVICE_PATH; -+ -+/* DeviceType definitions - from BBS specification */ -+#define BBS_TYPE_FLOPPY 0x01 -+#define BBS_TYPE_HARDDRIVE 0x02 -+#define BBS_TYPE_CDROM 0x03 -+#define BBS_TYPE_PCMCIA 0x04 -+#define BBS_TYPE_USB 0x05 -+#define BBS_TYPE_EMBEDDED_NETWORK 0x06 -+#define BBS_TYPE_DEV 0x80 -+#define BBS_TYPE_UNKNOWN 0xFF -+ -+typedef union { -+ EFI_DEVICE_PATH DevPath; -+ PCI_DEVICE_PATH Pci; -+ PCCARD_DEVICE_PATH PcCard; -+ MEMMAP_DEVICE_PATH MemMap; -+ VENDOR_DEVICE_PATH Vendor; -+ UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor; -+ CONTROLLER_DEVICE_PATH Controller; -+ ACPI_HID_DEVICE_PATH Acpi; -+ -+ ATAPI_DEVICE_PATH Atapi; -+ SCSI_DEVICE_PATH Scsi; -+ FIBRECHANNEL_DEVICE_PATH FibreChannel; -+ -+ F1394_DEVICE_PATH F1394; -+ USB_DEVICE_PATH Usb; -+ USB_CLASS_DEVICE_PATH UsbClass; -+ I2O_DEVICE_PATH I2O; -+ MAC_ADDR_DEVICE_PATH MacAddr; -+ IPv4_DEVICE_PATH Ipv4; -+ IPv6_DEVICE_PATH Ipv6; -+ INFINIBAND_DEVICE_PATH InfiniBand; -+ UART_DEVICE_PATH Uart; -+ -+ HARDDRIVE_DEVICE_PATH HardDrive; -+ CDROM_DEVICE_PATH CD; -+ -+ FILEPATH_DEVICE_PATH FilePath; -+ MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol; -+ -+ BBS_BBS_DEVICE_PATH Bbs; -+ -+} EFI_DEV_PATH; -+ -+typedef union { -+ EFI_DEVICE_PATH *DevPath; -+ PCI_DEVICE_PATH *Pci; -+ PCCARD_DEVICE_PATH *PcCard; -+ MEMMAP_DEVICE_PATH *MemMap; -+ VENDOR_DEVICE_PATH *Vendor; -+ UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor; -+ CONTROLLER_DEVICE_PATH *Controller; -+ ACPI_HID_DEVICE_PATH *Acpi; -+ -+ ATAPI_DEVICE_PATH *Atapi; -+ SCSI_DEVICE_PATH *Scsi; -+ FIBRECHANNEL_DEVICE_PATH *FibreChannel; -+ -+ F1394_DEVICE_PATH *F1394; -+ USB_DEVICE_PATH *Usb; -+ USB_CLASS_DEVICE_PATH *UsbClass; -+ I2O_DEVICE_PATH *I2O; -+ MAC_ADDR_DEVICE_PATH *MacAddr; -+ IPv4_DEVICE_PATH *Ipv4; -+ IPv6_DEVICE_PATH *Ipv6; -+ INFINIBAND_DEVICE_PATH *InfiniBand; -+ UART_DEVICE_PATH *Uart; -+ -+ HARDDRIVE_DEVICE_PATH *HardDrive; -+ -+ FILEPATH_DEVICE_PATH *FilePath; -+ MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol; -+ -+ CDROM_DEVICE_PATH *CD; -+ BBS_BBS_DEVICE_PATH *Bbs; -+ -+} EFI_DEV_PATH_PTR; -+ -+ -+#endif -Index: xen-4.1.3-testing/xen/include/efi/efierr.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/efi/efierr.h -@@ -0,0 +1,60 @@ -+#ifndef _EFI_ERR_H -+#define _EFI_ERR_H -+ -+/*++ -+ -+Copyright (c) 1998 Intel Corporation -+ -+Module Name: -+ -+ efierr.h -+ -+Abstract: -+ -+ EFI error codes -+ -+ -+ -+ -+Revision History -+ -+--*/ -+ -+ -+#define EFIWARN(a) (a) -+#define EFI_ERROR(a) (((INTN) a) < 0) -+ -+ -+#define EFI_SUCCESS 0 -+#define EFI_LOAD_ERROR EFIERR(1) -+#define EFI_INVALID_PARAMETER EFIERR(2) -+#define EFI_UNSUPPORTED EFIERR(3) -+#define EFI_BAD_BUFFER_SIZE EFIERR(4) -+#define EFI_BUFFER_TOO_SMALL EFIERR(5) -+#define EFI_NOT_READY EFIERR(6) -+#define EFI_DEVICE_ERROR EFIERR(7) -+#define EFI_WRITE_PROTECTED EFIERR(8) -+#define EFI_OUT_OF_RESOURCES EFIERR(9) -+#define EFI_VOLUME_CORRUPTED EFIERR(10) -+#define EFI_VOLUME_FULL EFIERR(11) -+#define EFI_NO_MEDIA EFIERR(12) -+#define EFI_MEDIA_CHANGED EFIERR(13) -+#define EFI_NOT_FOUND EFIERR(14) -+#define EFI_ACCESS_DENIED EFIERR(15) -+#define EFI_NO_RESPONSE EFIERR(16) -+#define EFI_NO_MAPPING EFIERR(17) -+#define EFI_TIMEOUT EFIERR(18) -+#define EFI_NOT_STARTED EFIERR(19) -+#define EFI_ALREADY_STARTED EFIERR(20) -+#define EFI_ABORTED EFIERR(21) -+#define EFI_ICMP_ERROR EFIERR(22) -+#define EFI_TFTP_ERROR EFIERR(23) -+#define EFI_PROTOCOL_ERROR EFIERR(24) -+ -+#define EFI_WARN_UNKOWN_GLYPH EFIWARN(1) -+#define EFI_WARN_DELETE_FAILURE EFIWARN(2) -+#define EFI_WARN_WRITE_FAILURE EFIWARN(3) -+#define EFI_WARN_BUFFER_TOO_SMALL EFIWARN(4) -+ -+#endif -+ -Index: xen-4.1.3-testing/xen/include/efi/efiprot.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/efi/efiprot.h -@@ -0,0 +1,728 @@ -+#ifndef _EFI_PROT_H -+#define _EFI_PROT_H -+ -+/*++ -+ -+Copyright (c) 1998 Intel Corporation -+ -+Module Name: -+ -+ efiprot.h -+ -+Abstract: -+ -+ EFI Protocols -+ -+ -+ -+Revision History -+ -+--*/ -+ -+// -+// FPSWA library protocol -+// -+#define FPSWA_PROTOCOL \ -+ { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+// -+// Device Path protocol -+// -+ -+#define DEVICE_PATH_PROTOCOL \ -+ { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+ -+ -+// -+// Block IO protocol -+// -+ -+#define BLOCK_IO_PROTOCOL \ -+ { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+#define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000 -+ -+INTERFACE_DECL(_EFI_BLOCK_IO); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_BLOCK_RESET) ( -+ IN struct _EFI_BLOCK_IO *This, -+ IN BOOLEAN ExtendedVerification -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_BLOCK_READ) ( -+ IN struct _EFI_BLOCK_IO *This, -+ IN UINT32 MediaId, -+ IN EFI_LBA LBA, -+ IN UINTN BufferSize, -+ OUT VOID *Buffer -+ ); -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_BLOCK_WRITE) ( -+ IN struct _EFI_BLOCK_IO *This, -+ IN UINT32 MediaId, -+ IN EFI_LBA LBA, -+ IN UINTN BufferSize, -+ IN VOID *Buffer -+ ); -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_BLOCK_FLUSH) ( -+ IN struct _EFI_BLOCK_IO *This -+ ); -+ -+ -+ -+typedef struct { -+ UINT32 MediaId; -+ BOOLEAN RemovableMedia; -+ BOOLEAN MediaPresent; -+ -+ BOOLEAN LogicalPartition; -+ BOOLEAN ReadOnly; -+ BOOLEAN WriteCaching; -+ -+ UINT32 BlockSize; -+ UINT32 IoAlign; -+ -+ EFI_LBA LastBlock; -+} EFI_BLOCK_IO_MEDIA; -+ -+typedef struct _EFI_BLOCK_IO { -+ UINT64 Revision; -+ -+ EFI_BLOCK_IO_MEDIA *Media; -+ -+ EFI_BLOCK_RESET Reset; -+ EFI_BLOCK_READ ReadBlocks; -+ EFI_BLOCK_WRITE WriteBlocks; -+ EFI_BLOCK_FLUSH FlushBlocks; -+ -+} EFI_BLOCK_IO; -+ -+ -+ -+// -+// Disk Block IO protocol -+// -+ -+#define DISK_IO_PROTOCOL \ -+ { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+#define EFI_DISK_IO_INTERFACE_REVISION 0x00010000 -+ -+INTERFACE_DECL(_EFI_DISK_IO); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_DISK_READ) ( -+ IN struct _EFI_DISK_IO *This, -+ IN UINT32 MediaId, -+ IN UINT64 Offset, -+ IN UINTN BufferSize, -+ OUT VOID *Buffer -+ ); -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_DISK_WRITE) ( -+ IN struct _EFI_DISK_IO *This, -+ IN UINT32 MediaId, -+ IN UINT64 Offset, -+ IN UINTN BufferSize, -+ IN VOID *Buffer -+ ); -+ -+ -+typedef struct _EFI_DISK_IO { -+ UINT64 Revision; -+ EFI_DISK_READ ReadDisk; -+ EFI_DISK_WRITE WriteDisk; -+} EFI_DISK_IO; -+ -+ -+// -+// Simple file system protocol -+// -+ -+#define SIMPLE_FILE_SYSTEM_PROTOCOL \ -+ { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+ -+INTERFACE_DECL(_EFI_FILE_IO_INTERFACE); -+INTERFACE_DECL(_EFI_FILE_HANDLE); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_VOLUME_OPEN) ( -+ IN struct _EFI_FILE_IO_INTERFACE *This, -+ OUT struct _EFI_FILE_HANDLE **Root -+ ); -+ -+#define EFI_FILE_IO_INTERFACE_REVISION 0x00010000 -+ -+typedef struct _EFI_FILE_IO_INTERFACE { -+ UINT64 Revision; -+ EFI_VOLUME_OPEN OpenVolume; -+} EFI_FILE_IO_INTERFACE; -+ -+// -+// -+// -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_OPEN) ( -+ IN struct _EFI_FILE_HANDLE *File, -+ OUT struct _EFI_FILE_HANDLE **NewHandle, -+ IN CHAR16 *FileName, -+ IN UINT64 OpenMode, -+ IN UINT64 Attributes -+ ); -+ -+// Open modes -+#define EFI_FILE_MODE_READ 0x0000000000000001 -+#define EFI_FILE_MODE_WRITE 0x0000000000000002 -+#define EFI_FILE_MODE_CREATE 0x8000000000000000 -+ -+// File attributes -+#define EFI_FILE_READ_ONLY 0x0000000000000001 -+#define EFI_FILE_HIDDEN 0x0000000000000002 -+#define EFI_FILE_SYSTEM 0x0000000000000004 -+#define EFI_FILE_RESERVIED 0x0000000000000008 -+#define EFI_FILE_DIRECTORY 0x0000000000000010 -+#define EFI_FILE_ARCHIVE 0x0000000000000020 -+#define EFI_FILE_VALID_ATTR 0x0000000000000037 -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_CLOSE) ( -+ IN struct _EFI_FILE_HANDLE *File -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_DELETE) ( -+ IN struct _EFI_FILE_HANDLE *File -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_READ) ( -+ IN struct _EFI_FILE_HANDLE *File, -+ IN OUT UINTN *BufferSize, -+ OUT VOID *Buffer -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_WRITE) ( -+ IN struct _EFI_FILE_HANDLE *File, -+ IN OUT UINTN *BufferSize, -+ IN VOID *Buffer -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_SET_POSITION) ( -+ IN struct _EFI_FILE_HANDLE *File, -+ IN UINT64 Position -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_GET_POSITION) ( -+ IN struct _EFI_FILE_HANDLE *File, -+ OUT UINT64 *Position -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_GET_INFO) ( -+ IN struct _EFI_FILE_HANDLE *File, -+ IN EFI_GUID *InformationType, -+ IN OUT UINTN *BufferSize, -+ OUT VOID *Buffer -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_SET_INFO) ( -+ IN struct _EFI_FILE_HANDLE *File, -+ IN EFI_GUID *InformationType, -+ IN UINTN BufferSize, -+ IN VOID *Buffer -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_FILE_FLUSH) ( -+ IN struct _EFI_FILE_HANDLE *File -+ ); -+ -+ -+ -+#define EFI_FILE_HANDLE_REVISION 0x00010000 -+typedef struct _EFI_FILE_HANDLE { -+ UINT64 Revision; -+ EFI_FILE_OPEN Open; -+ EFI_FILE_CLOSE Close; -+ EFI_FILE_DELETE Delete; -+ EFI_FILE_READ Read; -+ EFI_FILE_WRITE Write; -+ EFI_FILE_GET_POSITION GetPosition; -+ EFI_FILE_SET_POSITION SetPosition; -+ EFI_FILE_GET_INFO GetInfo; -+ EFI_FILE_SET_INFO SetInfo; -+ EFI_FILE_FLUSH Flush; -+} EFI_FILE, *EFI_FILE_HANDLE; -+ -+ -+// -+// File information types -+// -+ -+#define EFI_FILE_INFO_ID \ -+ { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+ -+typedef struct { -+ UINT64 Size; -+ UINT64 FileSize; -+ UINT64 PhysicalSize; -+ EFI_TIME CreateTime; -+ EFI_TIME LastAccessTime; -+ EFI_TIME ModificationTime; -+ UINT64 Attribute; -+ CHAR16 FileName[1]; -+} EFI_FILE_INFO; -+ -+// -+// The FileName field of the EFI_FILE_INFO data structure is variable length. -+// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to -+// be the size of the data structure without the FileName field. The following macro -+// computes this size correctly no matter how big the FileName array is declared. -+// This is required to make the EFI_FILE_INFO data structure ANSI compilant. -+// -+ -+#define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName) -+ -+#define EFI_FILE_SYSTEM_INFO_ID \ -+ { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+ -+typedef struct { -+ UINT64 Size; -+ BOOLEAN ReadOnly; -+ UINT64 VolumeSize; -+ UINT64 FreeSpace; -+ UINT32 BlockSize; -+ CHAR16 VolumeLabel[1]; -+} EFI_FILE_SYSTEM_INFO; -+ -+// -+// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length. -+// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs -+// to be the size of the data structure without the VolumeLable field. The following macro -+// computes this size correctly no matter how big the VolumeLable array is declared. -+// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. -+// -+ -+#define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel) -+ -+#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \ -+ { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} } -+ -+typedef struct { -+ CHAR16 VolumeLabel[1]; -+} EFI_FILE_SYSTEM_VOLUME_LABEL_INFO; -+ -+#define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel) -+ -+// -+// Load file protocol -+// -+ -+ -+#define LOAD_FILE_PROTOCOL \ -+ { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } -+ -+INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_LOAD_FILE) ( -+ IN struct _EFI_LOAD_FILE_INTERFACE *This, -+ IN EFI_DEVICE_PATH *FilePath, -+ IN BOOLEAN BootPolicy, -+ IN OUT UINTN *BufferSize, -+ IN VOID *Buffer OPTIONAL -+ ); -+ -+typedef struct _EFI_LOAD_FILE_INTERFACE { -+ EFI_LOAD_FILE LoadFile; -+} EFI_LOAD_FILE_INTERFACE; -+ -+ -+// -+// Device IO protocol -+// -+ -+#define DEVICE_IO_PROTOCOL \ -+ { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -+ -+INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE); -+ -+typedef enum { -+ IO_UINT8, -+ IO_UINT16, -+ IO_UINT32, -+ IO_UINT64, -+// -+// Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO -+// -+ MMIO_COPY_UINT8, -+ MMIO_COPY_UINT16, -+ MMIO_COPY_UINT32, -+ MMIO_COPY_UINT64 -+} EFI_IO_WIDTH; -+ -+#define EFI_PCI_ADDRESS(_bus,_dev,_func) \ -+ ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) ) -+ -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_DEVICE_IO) ( -+ IN struct _EFI_DEVICE_IO_INTERFACE *This, -+ IN EFI_IO_WIDTH Width, -+ IN UINT64 Address, -+ IN UINTN Count, -+ IN OUT VOID *Buffer -+ ); -+ -+typedef struct { -+ EFI_DEVICE_IO Read; -+ EFI_DEVICE_IO Write; -+} EFI_IO_ACCESS; -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_PCI_DEVICE_PATH) ( -+ IN struct _EFI_DEVICE_IO_INTERFACE *This, -+ IN UINT64 Address, -+ IN OUT EFI_DEVICE_PATH **PciDevicePath -+ ); -+ -+typedef enum { -+ EfiBusMasterRead, -+ EfiBusMasterWrite, -+ EfiBusMasterCommonBuffer -+} EFI_IO_OPERATION_TYPE; -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IO_MAP) ( -+ IN struct _EFI_DEVICE_IO_INTERFACE *This, -+ IN EFI_IO_OPERATION_TYPE Operation, -+ IN EFI_PHYSICAL_ADDRESS *HostAddress, -+ IN OUT UINTN *NumberOfBytes, -+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, -+ OUT VOID **Mapping -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IO_UNMAP) ( -+ IN struct _EFI_DEVICE_IO_INTERFACE *This, -+ IN VOID *Mapping -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IO_ALLOCATE_BUFFER) ( -+ IN struct _EFI_DEVICE_IO_INTERFACE *This, -+ IN EFI_ALLOCATE_TYPE Type, -+ IN EFI_MEMORY_TYPE MemoryType, -+ IN UINTN Pages, -+ IN OUT EFI_PHYSICAL_ADDRESS *HostAddress -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IO_FLUSH) ( -+ IN struct _EFI_DEVICE_IO_INTERFACE *This -+ ); -+ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_IO_FREE_BUFFER) ( -+ IN struct _EFI_DEVICE_IO_INTERFACE *This, -+ IN UINTN Pages, -+ IN EFI_PHYSICAL_ADDRESS HostAddress -+ ); -+ -+typedef struct _EFI_DEVICE_IO_INTERFACE { -+ EFI_IO_ACCESS Mem; -+ EFI_IO_ACCESS Io; -+ EFI_IO_ACCESS Pci; -+ EFI_IO_MAP Map; -+ EFI_PCI_DEVICE_PATH PciDevicePath; -+ EFI_IO_UNMAP Unmap; -+ EFI_IO_ALLOCATE_BUFFER AllocateBuffer; -+ EFI_IO_FLUSH Flush; -+ EFI_IO_FREE_BUFFER FreeBuffer; -+} EFI_DEVICE_IO_INTERFACE; -+ -+ -+// -+// Unicode Collation protocol -+// -+ -+#define UNICODE_COLLATION_PROTOCOL \ -+ { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -+ -+#define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff) -+ -+INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE); -+ -+typedef -+INTN -+(EFIAPI *EFI_UNICODE_STRICOLL) ( -+ IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, -+ IN CHAR16 *s1, -+ IN CHAR16 *s2 -+ ); -+ -+typedef -+BOOLEAN -+(EFIAPI *EFI_UNICODE_METAIMATCH) ( -+ IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, -+ IN CHAR16 *String, -+ IN CHAR16 *Pattern -+ ); -+ -+typedef -+VOID -+(EFIAPI *EFI_UNICODE_STRLWR) ( -+ IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, -+ IN OUT CHAR16 *Str -+ ); -+ -+typedef -+VOID -+(EFIAPI *EFI_UNICODE_STRUPR) ( -+ IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, -+ IN OUT CHAR16 *Str -+ ); -+ -+typedef -+VOID -+(EFIAPI *EFI_UNICODE_FATTOSTR) ( -+ IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, -+ IN UINTN FatSize, -+ IN CHAR8 *Fat, -+ OUT CHAR16 *String -+ ); -+ -+typedef -+BOOLEAN -+(EFIAPI *EFI_UNICODE_STRTOFAT) ( -+ IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, -+ IN CHAR16 *String, -+ IN UINTN FatSize, -+ OUT CHAR8 *Fat -+ ); -+ -+ -+typedef struct _EFI_UNICODE_COLLATION_INTERFACE { -+ -+ // general -+ EFI_UNICODE_STRICOLL StriColl; -+ EFI_UNICODE_METAIMATCH MetaiMatch; -+ EFI_UNICODE_STRLWR StrLwr; -+ EFI_UNICODE_STRUPR StrUpr; -+ -+ // for supporting fat volumes -+ EFI_UNICODE_FATTOSTR FatToStr; -+ EFI_UNICODE_STRTOFAT StrToFat; -+ -+ CHAR8 *SupportedLanguages; -+} EFI_UNICODE_COLLATION_INTERFACE; -+ -+/* Graphics output protocol */ -+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ -+ { \ -+ 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \ -+ } -+ -+typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL; -+ -+typedef struct { -+ UINT32 RedMask; -+ UINT32 GreenMask; -+ UINT32 BlueMask; -+ UINT32 ReservedMask; -+} EFI_PIXEL_BITMASK; -+ -+typedef enum { -+ PixelRedGreenBlueReserved8BitPerColor, -+ PixelBlueGreenRedReserved8BitPerColor, -+ PixelBitMask, -+ PixelBltOnly, -+ PixelFormatMax -+} EFI_GRAPHICS_PIXEL_FORMAT; -+ -+typedef struct { -+ UINT32 Version; -+ UINT32 HorizontalResolution; -+ UINT32 VerticalResolution; -+ EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; -+ EFI_PIXEL_BITMASK PixelInformation; -+ UINT32 PixelsPerScanLine; -+} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION; -+ -+/** -+ Return the current video mode information. -+ -+ @param This Protocol instance pointer. -+ @param ModeNumber The mode number to return information on. -+ @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer. -+ @param Info A pointer to callee allocated buffer that returns information about ModeNumber. -+ -+ @retval EFI_SUCCESS Mode information returned. -+ @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small. -+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode. -+ @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () -+ @retval EFI_INVALID_PARAMETER One of the input args was NULL. -+ -+**/ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) ( -+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, -+ IN UINT32 ModeNumber, -+ OUT UINTN *SizeOfInfo, -+ OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info -+ ) -+; -+ -+/** -+ Return the current video mode information. -+ -+ @param This Protocol instance pointer. -+ @param ModeNumber The mode number to be set. -+ -+ @retval EFI_SUCCESS Graphics mode was changed. -+ @retval EFI_DEVICE_ERROR The device had an error and could not complete the request. -+ @retval EFI_UNSUPPORTED ModeNumber is not supported by this device. -+ -+**/ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) ( -+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, -+ IN UINT32 ModeNumber -+ ) -+; -+ -+typedef struct { -+ UINT8 Blue; -+ UINT8 Green; -+ UINT8 Red; -+ UINT8 Reserved; -+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL; -+ -+typedef union { -+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel; -+ UINT32 Raw; -+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION; -+ -+typedef enum { -+ EfiBltVideoFill, -+ EfiBltVideoToBltBuffer, -+ EfiBltBufferToVideo, -+ EfiBltVideoToVideo, -+ EfiGraphicsOutputBltOperationMax -+} EFI_GRAPHICS_OUTPUT_BLT_OPERATION; -+ -+/** -+ The following table defines actions for BltOperations: -+ -+ EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) -+ directly to every pixel of the video display rectangle -+ (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). -+ Only one pixel will be used from the BltBuffer. Delta is NOT used. -+ -+ EfiBltVideoToBltBuffer - Read data from the video display rectangle -+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in -+ the BltBuffer rectangle (DestinationX, DestinationY ) -+ (DestinationX + Width, DestinationY + Height). If DestinationX or -+ DestinationY is not zero then Delta must be set to the length in bytes -+ of a row in the BltBuffer. -+ -+ EfiBltBufferToVideo - Write data from the BltBuffer rectangle -+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the -+ video display rectangle (DestinationX, DestinationY) -+ (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is -+ not zero then Delta must be set to the length in bytes of a row in the -+ BltBuffer. -+ -+ EfiBltVideoToVideo - Copy from the video display rectangle (SourceX, SourceY) -+ (SourceX + Width, SourceY + Height) .to the video display rectangle -+ (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). -+ The BltBuffer and Delta are not used in this mode. -+ -+ @param This Protocol instance pointer. -+ @param BltBuffer Buffer containing data to blit into video buffer. This -+ buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) -+ @param BltOperation Operation to perform on BlitBuffer and video memory -+ @param SourceX X coordinate of source for the BltBuffer. -+ @param SourceY Y coordinate of source for the BltBuffer. -+ @param DestinationX X coordinate of destination for the BltBuffer. -+ @param DestinationY Y coordinate of destination for the BltBuffer. -+ @param Width Width of rectangle in BltBuffer in pixels. -+ @param Height Hight of rectangle in BltBuffer in pixels. -+ @param Delta OPTIONAL -+ -+ @retval EFI_SUCCESS The Blt operation completed. -+ @retval EFI_INVALID_PARAMETER BltOperation is not valid. -+ @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer. -+ -+**/ -+typedef -+EFI_STATUS -+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) ( -+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, -+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL -+ IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, -+ IN UINTN SourceX, -+ IN UINTN SourceY, -+ IN UINTN DestinationX, -+ IN UINTN DestinationY, -+ IN UINTN Width, -+ IN UINTN Height, -+ IN UINTN Delta OPTIONAL -+ ); -+ -+typedef struct { -+ UINT32 MaxMode; -+ UINT32 Mode; -+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; -+ UINTN SizeOfInfo; -+ EFI_PHYSICAL_ADDRESS FrameBufferBase; -+ UINTN FrameBufferSize; -+} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE; -+ -+struct _EFI_GRAPHICS_OUTPUT_PROTOCOL { -+ EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode; -+ EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode; -+ EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt; -+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; -+}; -+#endif -+ diff --git a/23614-x86_64-EFI-boot.patch b/23614-x86_64-EFI-boot.patch deleted file mode 100644 index fc1447e..0000000 --- a/23614-x86_64-EFI-boot.patch +++ /dev/null @@ -1,2579 +0,0 @@ -References: fate#311376, fate#311529, bnc#578927, bnc#628554 - -# HG changeset patch -# User Jan Beulich -# Date 1309249175 -3600 -# Node ID 8b7d00f2abb21b504f6f8e1a6cc235cee8eb0858 -# Parent b8d22c658bd213bf9da0a9d05312b63524652daf -x86-64: EFI boot code - -Besides introducing the relevant code paralleling parts of what is -under xen/arch/x86/boot/, this adjusts the build logic so that with a -single compilation two images (gzip-compressed ELF and EFI -application) -can get created. The EFI part of this depends on a new enough compiler -(supposedly gcc 4.4.x and above, but so far only tested to work with -4.5.x) and a properly configured linker (must support the i386pep -emulation). If either functionality is found to not be available, the -EFI part of the build will simply be skipped. - -The patch adds all code to allow Xen and the (accordingly enabled) -Dom0 kernel to boot, but doesn't allow Dom0 to make use of EFI -runtime calls (this will be the subject of the next patch). - -Parts of the code were lifted from an earlier never published OS -project of ours - whether respective license information needs to be -added to the respective source file is unclear to me (I was told -internally that adding a GPLv2 license header can be done if needed by -the community). - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1309549342 -3600 -# Node ID 638f31a30b6ccb3fe26f79b991bed4cd03995809 -# Parent 7631c461132000979f05759705c055eb3c975c0b -x86/EFI: adjust installation logic - -We should always install xen.efi into /usr/lib64/efi/; installation -into /boot/efi/efi/$(EFI_VENDOR) remains dependent upon specifying -EFI_VENDOR. - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1310127785 -3600 -# Node ID 88823213a4780ebced6d7adcb1ffd2dda6a339ca -# Parent d1a2861b9caa1a428a531c0d68b372df872d5b0d -x86-64/EFI: discard .comment.* sections - -The SuSE version of gcc produces a non-standard section named -.comment.SUSE.OPTs, but the PE32+ handling in binutils can't really -deal with any section to be placed at virtual address zero (and not -needing to be loaded). Even if binutils did, at least the UEFI -implementation in EDK 1.06 doesn't look at the section characteristics -at all, and hence would attempt to load such a section, and fail or -corrupt other data. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/Makefile -=================================================================== ---- xen-4.1.3-testing.orig/xen/Makefile -+++ xen-4.1.3-testing/xen/Makefile -@@ -12,6 +12,8 @@ export XEN_DOMAIN ?= $(shell ([ -x /bin/ - export BASEDIR := $(CURDIR) - export XEN_ROOT := $(BASEDIR)/.. - -+EFI_MOUNTPOINT ?= /boot/efi -+ - .PHONY: default - default: build - -@@ -33,6 +35,18 @@ _install: $(TARGET).gz - ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_VERSION).gz - ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET)).gz - $(INSTALL_DATA) $(TARGET)-syms $(DESTDIR)/boot/$(notdir $(TARGET))-syms-$(XEN_FULLVERSION) -+ if [ -r $(TARGET).efi ]; then \ -+ [ -d $(DESTDIR)$(LIBDIR)/efi ] || $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/efi; \ -+ $(INSTALL_DATA) $(TARGET).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_FULLVERSION).efi; \ -+ ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_VERSION).$(XEN_SUBVERSION).efi; \ -+ ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_VERSION).efi; \ -+ ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET)).efi; \ -+ if [ -n '$(EFI_MOUNTPOINT)' -a -n '$(EFI_VENDOR)' ]; then \ -+ $(INSTALL_DATA) $(TARGET).efi $(DESTDIR)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(notdir $(TARGET))-$(XEN_FULLVERSION).efi; \ -+ elif [ "$(DESTDIR)" = "$(patsubst $(shell cd $(XEN_ROOT) && pwd)/%,%,$(DESTDIR))" ]; then \ -+ echo 'EFI installation only partially done (EFI_VENDOR not set)' >&2; \ -+ fi; \ -+ fi - - .PHONY: _debug - _debug: -Index: xen-4.1.3-testing/xen/arch/x86/Makefile -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/Makefile -+++ xen-4.1.3-testing/xen/arch/x86/Makefile -@@ -61,14 +61,21 @@ obj-$(crash_debug) += gdbstub.o - - x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h - --$(TARGET): $(TARGET)-syms boot/mkelf32 -+efi-$(x86_64) := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \ -+ -O $(BASEDIR)/include/xen/compile.h ]; then \ -+ echo '$(TARGET).efi'; fi) -+ -+$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 - ./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000 \ - `$(NM) -nr $(TARGET)-syms | head -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'` - --ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(ALL_OBJS) -+ALL_EFI_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o efi/boot.o efi/runtime.o efi/compat.o $(ALL_OBJS) -+ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS) -+ -+$(BASEDIR)/common/symbols-dummy.o: -+ $(MAKE) -f $(BASEDIR)/Rules.mk -C $(BASEDIR)/common symbols-dummy.o - --$(TARGET)-syms: $(ALL_OBJS) xen.lds -- $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o -+$(TARGET)-syms: $(ALL_OBJS) xen.lds $(BASEDIR)/common/symbols-dummy.o - $(LD) $(LDFLAGS) -T xen.lds -N $(ALL_OBJS) \ - $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 - $(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S -@@ -81,6 +88,39 @@ $(TARGET)-syms: $(ALL_OBJS) xen.lds - $(@D)/.$(@F).1.o -o $@ - rm -f $(@D)/.$(@F).[0-9]* - -+EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10 -+EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 --strip-debug -+EFI_LDFLAGS += --section-alignment=0x200000 --file-alignment=0x20 -+EFI_LDFLAGS += --major-image-version=$(XEN_VERSION) -+EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION) -+EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0 -+EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0 -+ -+$(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p') -+$(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p') -+# Don't use $(wildcard ...) here - at least make 3.80 expands this too early! -+$(TARGET).efi: guard = $(if $(shell echo efi/dis* | grep disabled),:) -+$(TARGET).efi: $(ALL_EFI_OBJS) efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc -+ $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ -+ $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $(ALL_EFI_OBJS) efi/relocs-dummy.o \ -+ $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).$(base).0 &&) : -+ $(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S -+ $(guard) $(NM) -n $(@D)/.$(@F).$(VIRT_BASE).0 | $(guard) $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0s.S -+ $(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o -+ $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ -+ $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $(ALL_EFI_OBJS) \ -+ $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o -o $(@D)/.$(@F).$(base).1 &&) : -+ $(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S -+ $(guard) $(NM) -n $(@D)/.$(@F).$(VIRT_BASE).1 | $(guard) $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1s.S -+ $(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o -+ $(guard) $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $(ALL_EFI_OBJS) \ -+ $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o -o $@ -+ if $(guard) false; then rm -f $@; echo 'EFI support disabled'; fi -+ rm -f $(@D)/.$(@F).[0-9]* -+ -+efi/boot.o efi/runtime.o efi/compat.o: $(BASEDIR)/arch/x86/efi/built_in.o -+efi/boot.o efi/runtime.o efi/compat.o: ; -+ - asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c - $(CC) $(CFLAGS) -S -o $@ $< - -@@ -89,11 +129,20 @@ xen.lds: xen.lds.S - sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new - mv -f .xen.lds.d.new .xen.lds.d - -+efi.lds: xen.lds.S -+ $(CC) -P -E -Ui386 -DEFI $(AFLAGS) -o $@ $< -+ sed -e 's/efi\.lds\.o:/efi\.lds:/g' <.$(@F).d >.$(@F).d.new -+ mv -f .$(@F).d.new .$(@F).d -+ - boot/mkelf32: boot/mkelf32.c - $(HOSTCC) $(HOSTCFLAGS) -o $@ $< - -+efi/mkreloc: efi/mkreloc.c -+ $(HOSTCC) $(HOSTCFLAGS) -g -o $@ $< -+ - .PHONY: clean - clean:: - rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32 - rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d -+ rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc - rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin -Index: xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/boot/trampoline.S -+++ xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S -@@ -38,6 +38,7 @@ trampoline_gdt: - .long 0x0000ffff | ((BOOT_TRAMPOLINE & 0x00ffff) << 16) - .long 0x00009200 | ((BOOT_TRAMPOLINE & 0xff0000) >> 16) - -+ .globl cpuid_ext_features - cpuid_ext_features: - .long 0 - -Index: xen-4.1.3-testing/xen/arch/x86/boot/x86_64.S -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/boot/x86_64.S -+++ xen-4.1.3-testing/xen/arch/x86/boot/x86_64.S -@@ -84,11 +84,13 @@ multiboot_ptr: - .long 0 - - .word 0 -+ .globl gdt_descr - gdt_descr: - .word LAST_RESERVED_GDT_BYTE - .quad boot_cpu_gdt_table - FIRST_RESERVED_GDT_BYTE - - .word 0,0,0 -+ .globl idt_descr - idt_descr: - .word 256*16-1 - .quad idt_table -Index: xen-4.1.3-testing/xen/arch/x86/dmi_scan.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/dmi_scan.c -+++ xen-4.1.3-testing/xen/arch/x86/dmi_scan.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - #define bt_ioremap(b,l) ((void *)__acpi_map_table(b,l)) - #define bt_iounmap(b,l) ((void)0) -@@ -124,11 +125,39 @@ static inline bool_t __init dmi_checksum - return sum == 0; - } - -+static u32 __initdata efi_dmi_address; -+static u32 __initdata efi_dmi_size; -+ -+/* -+ * Important: This function gets called while still in EFI -+ * (pseudo-)physical mode. -+ */ -+void __init dmi_efi_get_table(void *smbios) -+{ -+ struct smbios_eps *eps = smbios; -+ -+ if (memcmp(eps->anchor, "_SM_", 4) && -+ dmi_checksum(eps, eps->length) && -+ memcmp(eps->dmi.anchor, "_DMI_", 5) == 0 && -+ dmi_checksum(&eps->dmi, sizeof(eps->dmi))) { -+ efi_dmi_address = eps->dmi.address; -+ efi_dmi_size = eps->dmi.size; -+ } -+} -+ - int __init dmi_get_table(u32 *base, u32 *len) - { - struct dmi_eps eps; - char __iomem *p, *q; - -+ if (efi_enabled) { -+ if (!efi_dmi_size) -+ return -1; -+ *base = efi_dmi_address; -+ *len = efi_dmi_size; -+ return 0; -+ } -+ - p = maddr_to_virt(0xF0000); - for (q = p; q < p + 0x10000; q += 16) { - memcpy_fromio(&eps, q, 15); -@@ -180,6 +209,39 @@ static int __init dmi_iterate(void (*dec - return -1; - } - -+static int __init dmi_efi_iterate(void (*decode)(struct dmi_header *)) -+{ -+ struct smbios_eps eps; -+ const struct smbios_eps __iomem *p; -+ int ret = -1; -+ -+ if (efi.smbios == EFI_INVALID_TABLE_ADDR) -+ return -1; -+ -+ p = bt_ioremap(efi.smbios, sizeof(eps)); -+ if (!p) -+ return -1; -+ memcpy_fromio(&eps, p, sizeof(eps)); -+ bt_iounmap(p, sizeof(eps)); -+ -+ if (memcmp(eps.anchor, "_SM_", 4)) -+ return -1; -+ -+ p = bt_ioremap(efi.smbios, eps.length); -+ if (!p) -+ return -1; -+ if (dmi_checksum(p, eps.length) && -+ memcmp(eps.dmi.anchor, "_DMI_", 5) == 0 && -+ dmi_checksum(&eps.dmi, sizeof(eps.dmi))) { -+ printk(KERN_INFO "SMBIOS %d.%d present.\n", -+ eps.major, eps.minor); -+ ret = _dmi_iterate(&eps.dmi, p, decode); -+ } -+ bt_iounmap(p, eps.length); -+ -+ return ret; -+} -+ - static char *dmi_ident[DMI_STRING_MAX]; - - /* -@@ -504,8 +566,8 @@ static void __init dmi_decode(struct dmi - - void __init dmi_scan_machine(void) - { -- int err = dmi_iterate(dmi_decode); -- if(err == 0) -+ if ((!efi_enabled ? dmi_iterate(dmi_decode) : -+ dmi_efi_iterate(dmi_decode)) == 0) - dmi_check_system(dmi_blacklist); - else - printk(KERN_INFO "DMI not present.\n"); -Index: xen-4.1.3-testing/xen/arch/x86/efi/Makefile -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/Makefile -@@ -0,0 +1,17 @@ -+CFLAGS += -fshort-wchar -mno-sse -+ -+obj-y += stub.o -+ -+create = test -e $(1) || touch -t 199901010000 $(1) -+ -+efi := $(filter y,$(x86_64)$(shell rm -f disabled)) -+efi := $(if $(efi),$(shell $(CC) -c -Werror check.c 2>disabled && echo y)) -+efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y)) -+efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.o); $(call create,runtime.o))) -+ -+extra-$(efi) += boot.o relocs-dummy.o runtime.o compat.o -+ -+stub.o: $(extra-y) -+ -+clean:: -+ rm -f disabled *.efi -Index: xen-4.1.3-testing/xen/arch/x86/efi/boot.c -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/boot.c -@@ -0,0 +1,1221 @@ -+#include "efi.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#if EFI_PAGE_SIZE != PAGE_SIZE -+# error Cannot use xen/pfn.h here! -+#endif -+#include -+#include -+#include -+#include -+#include -+#include -+ -+extern char start[]; -+extern u32 cpuid_ext_features; -+ -+union string { -+ CHAR16 *w; -+ char *s; -+ const char *cs; -+}; -+ -+struct file { -+ UINTN size; -+ union { -+ EFI_PHYSICAL_ADDRESS addr; -+ void *ptr; -+ }; -+}; -+ -+static EFI_BOOT_SERVICES *__initdata efi_bs; -+static EFI_HANDLE __initdata efi_ih; -+ -+static SIMPLE_TEXT_OUTPUT_INTERFACE __initdata *StdOut; -+static SIMPLE_TEXT_OUTPUT_INTERFACE __initdata *StdErr; -+ -+static UINT32 __initdata mdesc_ver; -+ -+static struct file __initdata cfg; -+static struct file __initdata kernel; -+static struct file __initdata ramdisk; -+static struct file __initdata xsm; -+ -+static multiboot_info_t __initdata mbi = { -+ .flags = MBI_MODULES | MBI_LOADERNAME -+}; -+static module_t __initdata mb_modules[3]; -+ -+static CHAR16 __initdata newline[] = L"\r\n"; -+ -+#define PrintStr(s) StdOut->OutputString(StdOut, s) -+#define PrintErr(s) StdErr->OutputString(StdErr, s) -+ -+static CHAR16 *__init FormatDec(UINT64 Val, CHAR16 *Buffer) -+{ -+ if ( Val >= 10 ) -+ Buffer = FormatDec(Val / 10, Buffer); -+ *Buffer = (CHAR16)(L'0' + Val % 10); -+ return Buffer + 1; -+} -+ -+static CHAR16 *__init FormatHex(UINT64 Val, UINTN Width, CHAR16 *Buffer) -+{ -+ if ( Width > 1 || Val >= 0x10 ) -+ Buffer = FormatHex(Val >> 4, Width ? Width - 1 : 0, Buffer); -+ *Buffer = (CHAR16)((Val &= 0xf) < 10 ? L'0' + Val : L'a' + Val - 10); -+ return Buffer + 1; -+} -+ -+static void __init DisplayUint(UINT64 Val, INTN Width) -+{ -+ CHAR16 PrintString[32], *end; -+ -+ if (Width < 0) -+ end = FormatDec(Val, PrintString); -+ else -+ { -+ PrintStr(L"0x"); -+ end = FormatHex(Val, Width, PrintString); -+ } -+ *end = 0; -+ PrintStr(PrintString); -+} -+ -+static CHAR16 *__init wstrcpy(CHAR16 *d, const CHAR16 *s) -+{ -+ CHAR16 *r = d; -+ -+ while ( (*d++ = *s++) != 0 ) -+ ; -+ return r; -+} -+ -+static int __init wstrcmp(const CHAR16 *s1, const CHAR16 *s2) -+{ -+ while ( *s1 && *s1 == *s2 ) -+ { -+ ++s1; -+ ++s2; -+ } -+ return *s1 - *s2; -+} -+ -+static int __init wstrncmp(const CHAR16 *s1, const CHAR16 *s2, UINTN n) -+{ -+ while ( n && *s1 && *s1 == *s2 ) -+ { -+ --n; -+ ++s1; -+ ++s2; -+ } -+ return n ? *s1 - *s2 : 0; -+} -+ -+static CHAR16 *__init s2w(union string *str) -+{ -+ const char *s = str->s; -+ CHAR16 *w; -+ void *ptr; -+ -+ if ( efi_bs->AllocatePool(EfiLoaderData, (strlen(s) + 1) * sizeof(*w), -+ &ptr) != EFI_SUCCESS ) -+ return NULL; -+ -+ w = str->w = ptr; -+ do { -+ *w = *s++; -+ } while ( *w++ ); -+ -+ return str->w; -+} -+ -+static char *__init w2s(const union string *str) -+{ -+ const CHAR16 *w = str->w; -+ char *s = str->s; -+ -+ do { -+ if ( *w > 0x007f ) -+ return NULL; -+ *s = *w++; -+ } while ( *s++ ); -+ -+ return str->s; -+} -+ -+static bool_t __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2) -+{ -+ return guid1->Data1 == guid2->Data1 && -+ guid1->Data2 == guid2->Data2 && -+ guid1->Data3 == guid2->Data3 && -+ !memcmp(guid1->Data4, guid2->Data4, sizeof(guid1->Data4)); -+} -+ -+static void __init __attribute__((__noreturn__)) blexit(const CHAR16 *str) -+{ -+ if ( str ) -+ PrintStr((CHAR16 *)str); -+ PrintStr(newline); -+ -+ if ( cfg.addr ) -+ efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size)); -+ if ( kernel.addr ) -+ efi_bs->FreePages(kernel.addr, PFN_UP(kernel.size)); -+ if ( ramdisk.addr ) -+ efi_bs->FreePages(ramdisk.addr, PFN_UP(ramdisk.size)); -+ if ( xsm.addr ) -+ efi_bs->FreePages(xsm.addr, PFN_UP(xsm.size)); -+ -+ efi_bs->Exit(efi_ih, EFI_SUCCESS, 0, NULL); -+ for( ; ; ); /* not reached */ -+} -+ -+/* generic routine for printing error messages */ -+static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode) -+{ -+ StdOut = StdErr; -+ PrintErr((CHAR16 *)mesg); -+ PrintErr(L": "); -+ -+ switch (ErrCode) -+ { -+ case EFI_NOT_FOUND: -+ mesg = L"Not found"; -+ break; -+ case EFI_NO_MEDIA: -+ mesg = L"The device has no media"; -+ break; -+ case EFI_MEDIA_CHANGED: -+ mesg = L"Media changed"; -+ break; -+ case EFI_DEVICE_ERROR: -+ mesg = L"Device error"; -+ break; -+ case EFI_VOLUME_CORRUPTED: -+ mesg = L"Volume corrupted"; -+ break; -+ case EFI_ACCESS_DENIED: -+ mesg = L"Access denied"; -+ break; -+ case EFI_OUT_OF_RESOURCES: -+ mesg = L"Out of resources"; -+ break; -+ case EFI_VOLUME_FULL: -+ mesg = L"Volume is full"; -+ break; -+ default: -+ PrintErr(L"ErrCode: "); -+ DisplayUint(ErrCode, 0); -+ mesg = NULL; -+ break; -+ } -+ blexit(mesg); -+} -+ -+static void __init place_string(u32 *addr, const char *s) -+{ -+ static char *__initdata alloc = start; -+ -+ if ( s && *s ) -+ { -+ size_t len1 = strlen(s) + 1; -+ const char *old = (char *)(long)*addr; -+ size_t len2 = *addr ? strlen(old) + 1 : 0; -+ -+ alloc -= len1 + len2; -+ /* -+ * Insert new string before already existing one. This is needed -+ * for options passed on the command line to override options from -+ * the configuration file. -+ */ -+ memcpy(alloc, s, len1); -+ if ( *addr ) -+ { -+ alloc[len1 - 1] = ' '; -+ memcpy(alloc + len1, old, len2); -+ } -+ } -+ *addr = (long)alloc; -+} -+ -+static unsigned int __init get_argv(unsigned int argc, CHAR16 **argv, -+ CHAR16 *cmdline, UINTN cmdsize) -+{ -+ CHAR16 *ptr = (CHAR16 *)(argv + argc + 1), *prev = NULL; -+ bool_t prev_sep = TRUE; -+ -+ for ( ; cmdsize > sizeof(*cmdline) && *cmdline; -+ cmdsize -= sizeof(*cmdline), ++cmdline ) -+ { -+ bool_t cur_sep = *cmdline == L' ' || *cmdline == L'\t'; -+ -+ if ( !prev_sep ) -+ { -+ if ( cur_sep ) -+ ++ptr; -+ else if ( argv ) -+ { -+ *ptr = *cmdline; -+ *++ptr = 0; -+ } -+ } -+ else if ( !cur_sep ) -+ { -+ if ( !argv ) -+ ++argc; -+ else if ( prev && wstrcmp(prev, L"--") == 0 ) -+ { -+ union string rest = { .w = cmdline }; -+ -+ --argv; -+ place_string(&mbi.cmdline, w2s(&rest)); -+ break; -+ } -+ else -+ { -+ *argv++ = prev = ptr; -+ *ptr = *cmdline; -+ *++ptr = 0; -+ } -+ } -+ prev_sep = cur_sep; -+ } -+ if ( argv ) -+ *argv = NULL; -+ return argc; -+} -+ -+static EFI_FILE_HANDLE __init get_parent_handle(EFI_LOADED_IMAGE *loaded_image, -+ CHAR16 **leaf) -+{ -+ static EFI_GUID __initdata fs_protocol = SIMPLE_FILE_SYSTEM_PROTOCOL; -+ EFI_FILE_HANDLE dir_handle; -+ EFI_DEVICE_PATH *dp; -+ CHAR16 *pathend, *ptr; -+ EFI_STATUS ret; -+ -+ do { -+ EFI_FILE_IO_INTERFACE *fio; -+ -+ /* Get the file system interface. */ -+ ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle, -+ &fs_protocol, (void **)&fio); -+ if ( EFI_ERROR(ret) ) -+ blexit(L"Couldn't obtain the File System Protocol Interface"); -+ ret = fio->OpenVolume(fio, &dir_handle); -+ } while ( ret == EFI_MEDIA_CHANGED ); -+ if ( ret != EFI_SUCCESS ) -+ blexit(L"OpenVolume failure"); -+ -+#define buffer ((CHAR16 *)keyhandler_scratch) -+#define BUFFERSIZE sizeof(keyhandler_scratch) -+ for ( dp = loaded_image->FilePath, *buffer = 0; -+ DevicePathType(dp) != END_DEVICE_PATH_TYPE; -+ dp = (void *)dp + DevicePathNodeLength(dp) ) -+ { -+ FILEPATH_DEVICE_PATH *fp; -+ -+ if ( DevicePathType(dp) != MEDIA_DEVICE_PATH || -+ DevicePathSubType(dp) != MEDIA_FILEPATH_DP ) -+ blexit(L"Unsupported device path component"); -+ -+ if ( *buffer ) -+ { -+ EFI_FILE_HANDLE new_handle; -+ -+ ret = dir_handle->Open(dir_handle, &new_handle, buffer, -+ EFI_FILE_MODE_READ, 0); -+ if ( ret != EFI_SUCCESS ) -+ { -+ PrintErr(L"Open failed for "); -+ PrintErrMesg(buffer, ret); -+ } -+ dir_handle->Close(dir_handle); -+ dir_handle = new_handle; -+ } -+ fp = (void *)dp; -+ if ( BUFFERSIZE < DevicePathNodeLength(dp) - -+ sizeof(*dp) + sizeof(*buffer) ) -+ blexit(L"Increase BUFFERSIZE"); -+ memcpy(buffer, fp->PathName, DevicePathNodeLength(dp) - sizeof(*dp)); -+ buffer[(DevicePathNodeLength(dp) - sizeof(*dp)) / sizeof(*buffer)] = 0; -+ } -+ for ( ptr = buffer, pathend = NULL; *ptr; ++ptr ) -+ if ( *ptr == L'\\' ) -+ pathend = ptr; -+ if ( pathend ) -+ { -+ *pathend = 0; -+ *leaf = pathend + 1; -+ if ( *buffer ) -+ { -+ EFI_FILE_HANDLE new_handle; -+ -+ ret = dir_handle->Open(dir_handle, &new_handle, buffer, -+ EFI_FILE_MODE_READ, 0); -+ if ( ret != EFI_SUCCESS ) { -+ PrintErr(L"Open failed for "); -+ PrintErrMesg(buffer, ret); -+ } -+ dir_handle->Close(dir_handle); -+ dir_handle = new_handle; -+ } -+ } -+ else -+ *leaf = buffer; -+#undef BUFFERSIZE -+#undef buffer -+ -+ return dir_handle; -+} -+ -+static CHAR16 *__init point_tail(CHAR16 *fn) -+{ -+ CHAR16 *tail = NULL; -+ -+ for ( ; ; ++fn ) -+ switch ( *fn ) -+ { -+ case 0: -+ return tail; -+ case L'.': -+ case L'-': -+ case L'_': -+ tail = fn; -+ break; -+ } -+} -+ -+static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, -+ struct file *file) -+{ -+ EFI_FILE_HANDLE FileHandle = NULL; -+ UINT64 size; -+ EFI_STATUS ret; -+ CHAR16 *what = NULL; -+ -+ if ( !name ) -+ PrintErrMesg(L"No filename", EFI_OUT_OF_RESOURCES); -+ ret = dir_handle->Open(dir_handle, &FileHandle, name, -+ EFI_FILE_MODE_READ, 0); -+ if ( file == &cfg && ret == EFI_NOT_FOUND ) -+ return 0; -+ if ( EFI_ERROR(ret) ) -+ what = L"Open"; -+ else -+ ret = FileHandle->SetPosition(FileHandle, -1); -+ if ( EFI_ERROR(ret) ) -+ what = what ?: L"Seek"; -+ else -+ ret = FileHandle->GetPosition(FileHandle, &size); -+ if ( EFI_ERROR(ret) ) -+ what = what ?: L"Get size"; -+ else -+ ret = FileHandle->SetPosition(FileHandle, 0); -+ if ( EFI_ERROR(ret) ) -+ what = what ?: L"Seek"; -+ else -+ { -+ file->addr = (EFI_PHYSICAL_ADDRESS)1 << (32 + PAGE_SHIFT); -+ ret = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData, -+ PFN_UP(size), &file->addr); -+ } -+ if ( EFI_ERROR(ret) ) -+ { -+ file->addr = 0; -+ what = what ?: L"Allocation"; -+ } -+ else -+ { -+ if ( file != &cfg ) -+ { -+ PrintStr(name); -+ PrintStr(L": "); -+ DisplayUint(file->addr, 2 * sizeof(file->addr)); -+ PrintStr(L"-"); -+ DisplayUint(file->addr + size, 2 * sizeof(file->addr)); -+ PrintStr(newline); -+ mb_modules[mbi.mods_count].mod_start = file->addr >> PAGE_SHIFT; -+ mb_modules[mbi.mods_count].mod_end = size; -+ ++mbi.mods_count; -+ } -+ -+ file->size = size; -+ ret = FileHandle->Read(FileHandle, &file->size, file->ptr); -+ if ( !EFI_ERROR(ret) && file->size != size ) -+ ret = EFI_ABORTED; -+ if ( EFI_ERROR(ret) ) -+ what = L"Read"; -+ } -+ -+ if ( FileHandle ) -+ FileHandle->Close(FileHandle); -+ -+ if ( what ) -+ { -+ PrintErr(what); -+ PrintErr(L" failed for "); -+ PrintErrMesg(name, ret); -+ } -+ -+ return 1; -+} -+ -+static void __init pre_parse(const struct file *cfg) -+{ -+ char *ptr = cfg->ptr, *end = ptr + cfg->size; -+ bool_t start = 1, comment = 0; -+ -+ for ( ; ptr < end; ++ptr ) -+ { -+ if ( iscntrl(*ptr) ) -+ { -+ comment = 0; -+ start = 1; -+ *ptr = 0; -+ } -+ else if ( comment || (start && isspace(*ptr)) ) -+ *ptr = 0; -+ else if ( *ptr == '#' || (start && *ptr == ';') ) -+ { -+ comment = 1; -+ *ptr = 0; -+ } -+ else -+ start = 0; -+ } -+ if ( cfg->size && end[-1] ) -+ PrintStr(L"No newline at end of config file," -+ " last line will be ignored.\r\n"); -+} -+ -+static char *__init get_value(const struct file *cfg, const char *section, -+ const char *item) -+{ -+ char *ptr = cfg->ptr, *end = ptr + cfg->size; -+ size_t slen = section ? strlen(section) : 0, ilen = strlen(item); -+ bool_t match = !slen; -+ -+ for ( ; ptr < end; ++ptr ) -+ { -+ switch ( *ptr ) -+ { -+ case 0: -+ continue; -+ case '[': -+ if ( !slen ) -+ break; -+ if ( match ) -+ return NULL; -+ match = strncmp(++ptr, section, slen) == 0 && ptr[slen] == ']'; -+ break; -+ default: -+ if ( match && strncmp(ptr, item, ilen) == 0 && ptr[ilen] == '=' ) -+ return ptr + ilen + 1; -+ break; -+ } -+ ptr += strlen(ptr); -+ } -+ return NULL; -+} -+ -+static void __init split_value(char *s) -+{ -+ while ( *s && isspace(*s) ) -+ ++s; -+ place_string(&mb_modules[mbi.mods_count].string, s); -+ while ( *s && !isspace(*s) ) -+ ++s; -+ *s = 0; -+} -+ -+static int __init set_color(u32 mask, int bpp, u8 *pos, u8 *sz) -+{ -+ if ( bpp < 0 ) -+ return bpp; -+ if ( !mask ) -+ return -EINVAL; -+ for ( *pos = 0; !(mask & 1); ++*pos ) -+ mask >>= 1; -+ for ( *sz = 0; mask & 1; ++sz) -+ mask >>= 1; -+ if ( mask ) -+ return -EINVAL; -+ return max(*pos + *sz, bpp); -+} -+ -+#define PE_BASE_RELOC_ABS 0 -+#define PE_BASE_RELOC_HIGHLOW 3 -+#define PE_BASE_RELOC_DIR64 10 -+ -+extern const struct pe_base_relocs { -+ u32 rva; -+ u32 size; -+ u16 entries[]; -+} __base_relocs_start[], __base_relocs_end[]; -+ -+static void __init relocate_image(unsigned long delta) -+{ -+ const struct pe_base_relocs *base_relocs; -+ -+ for ( base_relocs = __base_relocs_start; base_relocs < __base_relocs_end; ) -+ { -+ unsigned int i, n; -+ -+ n = (base_relocs->size - sizeof(*base_relocs)) / -+ sizeof(*base_relocs->entries); -+ for ( i = 0; i < n; ++i ) -+ { -+ unsigned long addr = xen_phys_start + base_relocs->rva + -+ (base_relocs->entries[i] & 0xfff); -+ -+ switch ( base_relocs->entries[i] >> 12 ) -+ { -+ case PE_BASE_RELOC_ABS: -+ break; -+ case PE_BASE_RELOC_HIGHLOW: -+ if ( delta ) -+ *(u32 *)addr += delta; -+ break; -+ case PE_BASE_RELOC_DIR64: -+ if ( delta ) -+ *(u64 *)addr += delta; -+ break; -+ default: -+ blexit(L"Unsupported relocation type\r\n"); -+ } -+ } -+ base_relocs = (const void *)(base_relocs->entries + i + (i & 1)); -+ } -+} -+ -+void EFIAPI __init __attribute__((__noreturn__)) -+efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) -+{ -+ static EFI_GUID __initdata loaded_image_guid = LOADED_IMAGE_PROTOCOL; -+ static EFI_GUID __initdata gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; -+ EFI_LOADED_IMAGE *loaded_image; -+ EFI_STATUS status; -+ unsigned int i, argc; -+ CHAR16 **argv, *file_name, *cfg_file_name = NULL; -+ UINTN cols, rows, depth, size, map_key, info_size, gop_mode = ~0; -+ EFI_HANDLE *handles = NULL; -+ EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL; -+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info; -+ EFI_FILE_HANDLE dir_handle; -+ union string section = { NULL }, name; -+ struct e820entry *e; -+ u64 efer; -+ bool_t base_video = 0, trampoline_okay = 0; -+ -+ efi_ih = ImageHandle; -+ efi_bs = SystemTable->BootServices; -+ efi_rs = SystemTable->RuntimeServices; -+ efi_ct = SystemTable->ConfigurationTable; -+ efi_num_ct = SystemTable->NumberOfTableEntries; -+ efi_version = SystemTable->Hdr.Revision; -+ efi_fw_vendor = SystemTable->FirmwareVendor; -+ efi_fw_revision = SystemTable->FirmwareRevision; -+ -+ StdOut = SystemTable->ConOut; -+ StdErr = SystemTable->StdErr ?: StdOut; -+ -+ status = efi_bs->HandleProtocol(ImageHandle, &loaded_image_guid, -+ (void **)&loaded_image); -+ if ( status != EFI_SUCCESS ) -+ PrintErrMesg(L"No Loaded Image Protocol", status); -+ -+ xen_phys_start = (UINTN)loaded_image->ImageBase; -+ if ( (xen_phys_start + loaded_image->ImageSize - 1) >> 32 ) -+ blexit(L"Xen must be loaded below 4Gb.\r\n"); -+ if ( xen_phys_start & ((1 << L2_PAGETABLE_SHIFT) - 1) ) -+ blexit(L"Xen must be loaded at a 2Mb boundary.\r\n"); -+ trampoline_xen_phys_start = xen_phys_start; -+ -+ /* Get the file system interface. */ -+ dir_handle = get_parent_handle(loaded_image, &file_name); -+ -+ argc = get_argv(0, NULL, loaded_image->LoadOptions, -+ loaded_image->LoadOptionsSize); -+ if ( argc > 0 && -+ efi_bs->AllocatePool(EfiLoaderData, -+ (argc + 1) * sizeof(*argv) + -+ loaded_image->LoadOptionsSize, -+ (void **)&argv) == EFI_SUCCESS ) -+ get_argv(argc, argv, loaded_image->LoadOptions, -+ loaded_image->LoadOptionsSize); -+ else -+ argc = 0; -+ for ( i = 1; i < argc; ++i ) -+ { -+ CHAR16 *ptr = argv[i]; -+ -+ if ( !ptr ) -+ break; -+ if ( *ptr == L'/' || *ptr == L'-' ) -+ { -+ if ( wstrcmp(ptr + 1, L"basevideo") == 0 ) -+ base_video = 1; -+ else if ( wstrncmp(ptr + 1, L"cfg=", 4) == 0 ) -+ cfg_file_name = ptr + 5; -+ else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") == 0 ) -+ cfg_file_name = argv[++i]; -+ else if ( wstrcmp(ptr + 1, L"help") == 0 || -+ (ptr[1] == L'?' && !ptr[2]) ) -+ { -+ PrintStr(L"Xen EFI Loader options:\r\n"); -+ PrintStr(L"-basevideo retain current video mode\r\n"); -+ PrintStr(L"-cfg= specify configuration file\r\n"); -+ PrintStr(L"-help, -? display this help\r\n"); -+ blexit(NULL); -+ } -+ else -+ { -+ PrintStr(L"WARNING: Unknown command line option '"); -+ PrintStr(ptr); -+ PrintStr(L"' ignored\r\n"); -+ } -+ } -+ else -+ section.w = ptr; -+ } -+ -+ if ( !base_video ) -+ { -+ unsigned int best; -+ -+ for ( i = 0, size = 0, best = StdOut->Mode->Mode; -+ i < StdOut->Mode->MaxMode; ++i ) -+ { -+ if ( StdOut->QueryMode(StdOut, i, &cols, &rows) == EFI_SUCCESS && -+ cols * rows > size ) -+ { -+ size = cols * rows; -+ best = i; -+ } -+ } -+ if ( best != StdOut->Mode->Mode ) -+ StdOut->SetMode(StdOut, best); -+ } -+ -+ PrintStr(L"Xen " __stringify(XEN_VERSION) "." __stringify(XEN_SUBVERSION) -+ XEN_EXTRAVERSION " (c/s " XEN_CHANGESET ") EFI loader\r\n"); -+ -+ relocate_image(0); -+ -+ if ( StdOut->QueryMode(StdOut, StdOut->Mode->Mode, -+ &cols, &rows) == EFI_SUCCESS ) -+ { -+ vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3; -+ vga_console_info.u.text_mode_3.columns = cols; -+ vga_console_info.u.text_mode_3.rows = rows; -+ vga_console_info.u.text_mode_3.font_height = 16; -+ } -+ -+ size = 0; -+ status = efi_bs->LocateHandle(ByProtocol, &gop_guid, NULL, &size, NULL); -+ if ( status == EFI_BUFFER_TOO_SMALL ) -+ status = efi_bs->AllocatePool(EfiLoaderData, size, (void **)&handles); -+ if ( !EFI_ERROR(status) ) -+ status = efi_bs->LocateHandle(ByProtocol, &gop_guid, NULL, &size, -+ handles); -+ if ( EFI_ERROR(status) ) -+ size = 0; -+ for ( i = 0; i < size / sizeof(*handles); ++i ) -+ { -+ status = efi_bs->HandleProtocol(handles[i], &gop_guid, (void **)&gop); -+ if ( EFI_ERROR(status) ) -+ continue; -+ status = gop->QueryMode(gop, gop->Mode->Mode, &info_size, &mode_info); -+ if ( !EFI_ERROR(status) ) -+ break; -+ } -+ if ( handles ) -+ efi_bs->FreePool(handles); -+ if ( EFI_ERROR(status) ) -+ gop = NULL; -+ -+ /* Read and parse the config file. */ -+ if ( !cfg_file_name ) -+ { -+ CHAR16 *tail; -+ -+ while ( (tail = point_tail(file_name)) != NULL ) -+ { -+ wstrcpy(tail, L".cfg"); -+ if ( read_file(dir_handle, file_name, &cfg) ) -+ break; -+ *tail = 0; -+ } -+ if ( !tail ) -+ blexit(L"No configuration file found\r\n"); -+ PrintStr(L"Using configuration file '"); -+ PrintStr(file_name); -+ PrintStr(L"'\r\n"); -+ } -+ else if ( !read_file(dir_handle, cfg_file_name, &cfg) ) -+ blexit(L"Configuration file not found\r\n"); -+ pre_parse(&cfg); -+ -+ if ( section.w ) -+ w2s(§ion); -+ else -+ section.s = get_value(&cfg, "global", "default"); -+ -+ name.s = get_value(&cfg, section.s, "kernel"); -+ if ( !name.s ) -+ blexit(L"No Dom0 kernel image specified\r\n"); -+ split_value(name.s); -+ read_file(dir_handle, s2w(&name), &kernel); -+ efi_bs->FreePool(name.w); -+ -+ name.s = get_value(&cfg, section.s, "ramdisk"); -+ if ( name.s ) -+ { -+ split_value(name.s); -+ read_file(dir_handle, s2w(&name), &ramdisk); -+ efi_bs->FreePool(name.w); -+ } -+ -+ name.s = get_value(&cfg, section.s, "xsm"); -+ if ( name.s ) -+ { -+ split_value(name.s); -+ read_file(dir_handle, s2w(&name), &xsm); -+ efi_bs->FreePool(name.w); -+ } -+ -+ name.s = get_value(&cfg, section.s, "options"); -+ if ( name.s ) -+ place_string(&mbi.cmdline, name.s); -+ /* Insert image name last, as it gets prefixed to the other options. */ -+ if ( argc ) -+ { -+ name.w = *argv; -+ w2s(&name); -+ } -+ else -+ name.s = "xen"; -+ place_string(&mbi.cmdline, name.s); -+ -+ cols = rows = depth = 0; -+ if ( !base_video ) -+ { -+ name.cs = get_value(&cfg, section.s, "video"); -+ if ( !name.cs ) -+ name.cs = get_value(&cfg, "global", "video"); -+ if ( name.cs && !strncmp(name.cs, "gfx-", 4) ) -+ { -+ cols = simple_strtoul(name.cs + 4, &name.cs, 10); -+ if ( *name.cs == 'x' ) -+ rows = simple_strtoul(name.cs + 1, &name.cs, 10); -+ if ( *name.cs == 'x' ) -+ depth = simple_strtoul(name.cs + 1, &name.cs, 10); -+ if ( *name.cs ) -+ cols = rows = depth = 0; -+ } -+ } -+ -+ efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size)); -+ cfg.addr = 0; -+ -+ dir_handle->Close(dir_handle); -+ -+ if ( gop && !base_video ) -+ { -+ for ( i = size = 0; i < gop->Mode->MaxMode; ++i ) -+ { -+ unsigned int bpp = 0; -+ -+ status = gop->QueryMode(gop, i, &info_size, &mode_info); -+ if ( EFI_ERROR(status) ) -+ continue; -+ switch ( mode_info->PixelFormat ) -+ { -+ case PixelBitMask: -+ bpp = hweight32(mode_info->PixelInformation.RedMask | -+ mode_info->PixelInformation.GreenMask | -+ mode_info->PixelInformation.BlueMask); -+ break; -+ case PixelRedGreenBlueReserved8BitPerColor: -+ case PixelBlueGreenRedReserved8BitPerColor: -+ bpp = 24; -+ break; -+ default: -+ continue; -+ } -+ if ( cols == mode_info->HorizontalResolution && -+ rows == mode_info->VerticalResolution && -+ (!depth || bpp == depth) ) -+ { -+ gop_mode = i; -+ break; -+ } -+ if ( !cols && !rows && -+ mode_info->HorizontalResolution * -+ mode_info->VerticalResolution > size ) -+ { -+ size = mode_info->HorizontalResolution * -+ mode_info->VerticalResolution; -+ gop_mode = i; -+ } -+ } -+ } -+ -+ if ( mbi.cmdline ) -+ mbi.flags |= MBI_CMDLINE; -+ /* -+ * These must not be initialized statically, since the value must -+ * not get relocated when processing base relocations below. -+ */ -+ mbi.boot_loader_name = (long)"EFI"; -+ mbi.mods_addr = (long)mb_modules; -+ -+ place_string(&mbi.mem_upper, NULL); -+ -+ /* XXX Collect EDD info. */ -+ /* XXX Collect EDID info. */ -+ -+ if ( cpuid_eax(0x80000000) > 0x80000000 ) -+ { -+ cpuid_ext_features = cpuid_edx(0x80000001); -+ boot_cpu_data.x86_capability[1] = cpuid_ext_features; -+ } -+ -+ /* Obtain basic table pointers. */ -+ for ( i = 0; i < efi_num_ct; ++i ) -+ { -+ static EFI_GUID __initdata acpi2_guid = ACPI_20_TABLE_GUID; -+ static EFI_GUID __initdata acpi_guid = ACPI_TABLE_GUID; -+ static EFI_GUID __initdata smbios_guid = SMBIOS_TABLE_GUID; -+ -+ if ( match_guid(&acpi2_guid, &efi_ct[i].VendorGuid) ) -+ efi.acpi20 = (long)efi_ct[i].VendorTable; -+ if ( match_guid(&acpi_guid, &efi_ct[i].VendorGuid) ) -+ efi.acpi = (long)efi_ct[i].VendorTable; -+ if ( match_guid(&smbios_guid, &efi_ct[i].VendorGuid) ) -+ efi.smbios = (long)efi_ct[i].VendorTable; -+ } -+ -+ if (efi.smbios != EFI_INVALID_TABLE_ADDR) -+ dmi_efi_get_table((void *)(long)efi.smbios); -+ -+ /* Allocate space for trampoline (in first Mb). */ -+ cfg.addr = BOOT_TRAMPOLINE; -+ cfg.size = trampoline_end - trampoline_start; -+ status = efi_bs->AllocatePages(AllocateAddress, EfiLoaderData, -+ PFN_UP(cfg.size), &cfg.addr); -+ if ( EFI_ERROR(status) ) -+ { -+ cfg.addr = 0; -+ PrintErr(L"Note: Trampoline area is in use\r\n"); -+ } -+ -+ /* Initialise L2 identity-map and xen page table entries (16MB). */ -+ for ( i = 0; i < 8; ++i ) -+ { -+ unsigned int slot = (xen_phys_start >> L2_PAGETABLE_SHIFT) + i; -+ paddr_t addr = slot << L2_PAGETABLE_SHIFT; -+ -+ l2_identmap[i] = l2e_from_paddr(i << L2_PAGETABLE_SHIFT, -+ PAGE_HYPERVISOR|_PAGE_PSE); -+ l2_identmap[slot] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE); -+ l2_xenmap[i] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE); -+ slot &= L2_PAGETABLE_ENTRIES - 1; -+ l2_bootmap[slot] = l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_PSE); -+ } -+ /* Initialise L3 identity-map page directory entries. */ -+ for ( i = 0; i < ARRAY_SIZE(l2_identmap) / L2_PAGETABLE_ENTRIES; ++i ) -+ l3_identmap[i] = l3e_from_paddr((UINTN)(l2_identmap + -+ i * L2_PAGETABLE_ENTRIES), -+ __PAGE_HYPERVISOR); -+ /* Initialise L3 xen-map page directory entry. */ -+ l3_xenmap[l3_table_offset(XEN_VIRT_START)] = -+ l3e_from_paddr((UINTN)l2_xenmap, __PAGE_HYPERVISOR); -+ /* Initialise L3 boot-map page directory entries. */ -+ l3_bootmap[l3_table_offset(xen_phys_start)] = -+ l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); -+ l3_bootmap[l3_table_offset(xen_phys_start + (8 << L2_PAGETABLE_SHIFT) - 1)] = -+ l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); -+ /* Hook identity-map, xen-map, and boot-map L3 tables into PML4. */ -+ idle_pg_table[0] = l4e_from_paddr((UINTN)l3_bootmap, __PAGE_HYPERVISOR); -+ idle_pg_table[l4_table_offset(DIRECTMAP_VIRT_START)] = -+ l4e_from_paddr((UINTN)l3_identmap, __PAGE_HYPERVISOR); -+ idle_pg_table[l4_table_offset(XEN_VIRT_START)] = -+ l4e_from_paddr((UINTN)l3_xenmap, __PAGE_HYPERVISOR); -+ /* Initialize 4kB mappings of first 2MB of memory. */ -+ for ( i = 0; i < L1_PAGETABLE_ENTRIES; ++i ) -+ { -+ unsigned int attr = PAGE_HYPERVISOR|MAP_SMALL_PAGES; -+ -+ /* VGA hole (0xa0000-0xc0000) should be mapped UC. */ -+ if ( i >= 0xa0 && i < 0xc0 ) -+ attr |= _PAGE_PCD; -+ l1_identmap[i] = l1e_from_pfn(i, attr); -+ } -+ l2_identmap[0] = l2e_from_paddr((UINTN)l1_identmap, __PAGE_HYPERVISOR); -+ -+ if ( gop ) -+ { -+ int bpp = 0; -+ -+ /* Set graphics mode. */ -+ if ( gop_mode < gop->Mode->MaxMode && gop_mode != gop->Mode->Mode ) -+ gop->SetMode(gop, gop_mode); -+ -+ /* Get graphics and frame buffer info. */ -+ status = gop->QueryMode(gop, gop->Mode->Mode, &info_size, &mode_info); -+ if ( !EFI_ERROR(status) ) -+ switch ( mode_info->PixelFormat ) -+ { -+ case PixelRedGreenBlueReserved8BitPerColor: -+ vga_console_info.u.vesa_lfb.red_pos = 0; -+ vga_console_info.u.vesa_lfb.red_size = 8; -+ vga_console_info.u.vesa_lfb.green_pos = 8; -+ vga_console_info.u.vesa_lfb.green_size = 8; -+ vga_console_info.u.vesa_lfb.blue_pos = 16; -+ vga_console_info.u.vesa_lfb.blue_size = 8; -+ vga_console_info.u.vesa_lfb.rsvd_pos = 24; -+ vga_console_info.u.vesa_lfb.rsvd_size = 8; -+ bpp = 32; -+ break; -+ case PixelBlueGreenRedReserved8BitPerColor: -+ vga_console_info.u.vesa_lfb.red_pos = 16; -+ vga_console_info.u.vesa_lfb.red_size = 8; -+ vga_console_info.u.vesa_lfb.green_pos = 8; -+ vga_console_info.u.vesa_lfb.green_size = 8; -+ vga_console_info.u.vesa_lfb.blue_pos = 0; -+ vga_console_info.u.vesa_lfb.blue_size = 8; -+ vga_console_info.u.vesa_lfb.rsvd_pos = 24; -+ vga_console_info.u.vesa_lfb.rsvd_size = 8; -+ bpp = 32; -+ break; -+ case PixelBitMask: -+ bpp = set_color(mode_info->PixelInformation.RedMask, bpp, -+ &vga_console_info.u.vesa_lfb.red_pos, -+ &vga_console_info.u.vesa_lfb.red_size); -+ bpp = set_color(mode_info->PixelInformation.GreenMask, bpp, -+ &vga_console_info.u.vesa_lfb.green_pos, -+ &vga_console_info.u.vesa_lfb.green_size); -+ bpp = set_color(mode_info->PixelInformation.BlueMask, bpp, -+ &vga_console_info.u.vesa_lfb.blue_pos, -+ &vga_console_info.u.vesa_lfb.blue_size); -+ bpp = set_color(mode_info->PixelInformation.ReservedMask, bpp, -+ &vga_console_info.u.vesa_lfb.rsvd_pos, -+ &vga_console_info.u.vesa_lfb.rsvd_size); -+ if ( bpp > 0 ) -+ break; -+ /* fall through */ -+ default: -+ PrintErr(L"Current graphics mode is unsupported!"); -+ status = EFI_UNSUPPORTED; -+ break; -+ } -+ if ( !EFI_ERROR(status) ) -+ { -+ vga_console_info.video_type = XEN_VGATYPE_EFI_LFB; -+ vga_console_info.u.vesa_lfb.gbl_caps = 2; /* possibly non-VGA */ -+ vga_console_info.u.vesa_lfb.width = -+ mode_info->HorizontalResolution; -+ vga_console_info.u.vesa_lfb.height = mode_info->VerticalResolution; -+ vga_console_info.u.vesa_lfb.bits_per_pixel = bpp; -+ vga_console_info.u.vesa_lfb.bytes_per_line = -+ (mode_info->PixelsPerScanLine * bpp + 7) >> 3; -+ vga_console_info.u.vesa_lfb.lfb_base = gop->Mode->FrameBufferBase; -+ vga_console_info.u.vesa_lfb.lfb_size = -+ (gop->Mode->FrameBufferSize + 0xffff) >> 16; -+ } -+ } -+ -+ status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key, -+ &efi_mdesc_size, &mdesc_ver); -+ mbi.mem_upper -= efi_memmap_size; -+ mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR); -+ if ( mbi.mem_upper < xen_phys_start ) -+ blexit(L"Out of static memory\r\n"); -+ efi_memmap = (void *)(long)mbi.mem_upper; -+ status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key, -+ &efi_mdesc_size, &mdesc_ver); -+ if ( EFI_ERROR(status) ) -+ blexit(L"Cannot obtain memory map\r\n"); -+ -+ /* Populate E820 table and check trampoline area availability. */ -+ e = e820map - 1; -+ for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size ) -+ { -+ EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; -+ u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT; -+ u32 type; -+ -+ switch ( desc->Type ) -+ { -+ default: -+ type = E820_RESERVED; -+ break; -+ case EfiConventionalMemory: -+ case EfiLoaderCode: -+ case EfiLoaderData: -+ case EfiBootServicesCode: -+ case EfiBootServicesData: -+ if ( desc->Attribute & EFI_MEMORY_WB ) -+ type = E820_RAM; -+ else -+ case EfiUnusableMemory: -+ type = E820_UNUSABLE; -+ break; -+ case EfiACPIReclaimMemory: -+ type = E820_ACPI; -+ break; -+ case EfiACPIMemoryNVS: -+ type = E820_NVS; -+ break; -+ } -+ if ( e820nr && type == e->type && -+ desc->PhysicalStart == e->addr + e->size ) -+ e->size += len; -+ else if ( !len || e820nr >= E820MAX ) -+ continue; -+ else -+ { -+ ++e; -+ e->addr = desc->PhysicalStart; -+ e->size = len; -+ e->type = type; -+ ++e820nr; -+ } -+ if ( type == E820_RAM && e->addr <= BOOT_TRAMPOLINE && -+ e->addr + e->size >= BOOT_TRAMPOLINE + cfg.size ) -+ trampoline_okay = 1; -+ } -+ -+ if ( !trampoline_okay ) -+ blexit(L"Trampoline area unavailable\r\n"); -+ -+ status = efi_bs->ExitBootServices(ImageHandle, map_key); -+ if ( EFI_ERROR(status) ) -+ PrintErrMesg(L"Cannot exit boot services", status); -+ -+ /* Adjust pointers into EFI. */ -+ efi_ct = (void *)efi_ct + DIRECTMAP_VIRT_START; -+#if 0 /* Only needed when using virtual mode (see efi_init_memory()). */ -+ efi_rs = (void *)efi_rs + DIRECTMAP_VIRT_START; -+#endif -+ efi_memmap = (void *)efi_memmap + DIRECTMAP_VIRT_START; -+ efi_fw_vendor = (void *)efi_fw_vendor + DIRECTMAP_VIRT_START; -+ -+ relocate_image(__XEN_VIRT_START - xen_phys_start); -+ memcpy((void *)(long)BOOT_TRAMPOLINE, trampoline_start, cfg.size); -+ -+ /* Set system registers and transfer control. */ -+ asm volatile("pushq $0\n\tpopfq"); -+ rdmsrl(MSR_EFER, efer); -+ efer |= EFER_SCE; -+ if ( cpuid_ext_features & (1 << (X86_FEATURE_NX & 0x1f)) ) -+ efer |= EFER_NX; -+ wrmsrl(MSR_EFER, efer); -+ write_cr0(X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | -+ X86_CR0_AM | X86_CR0_PG); -+ asm volatile ( "mov %[cr4], %%cr4\n\t" -+ "mov %[cr3], %%cr3\n\t" -+ "movabs $__start_xen, %[rip]\n\t" -+ "lidt idt_descr(%%rip)\n\t" -+ "lgdt gdt_descr(%%rip)\n\t" -+ "mov stack_start(%%rip), %%rsp\n\t" -+ "mov %[ds], %%ss\n\t" -+ "mov %[ds], %%ds\n\t" -+ "mov %[ds], %%es\n\t" -+ "mov %[ds], %%fs\n\t" -+ "mov %[ds], %%gs\n\t" -+ "movl %[cs], 8(%%rsp)\n\t" -+ "mov %[rip], (%%rsp)\n\t" -+ "lretq %[stkoff]-16" -+ : [rip] "=&r" (efer/* any dead 64-bit variable */) -+ : [cr3] "r" (idle_pg_table), -+ [cr4] "r" (mmu_cr4_features), -+ [cs] "ir" (__HYPERVISOR_CS), -+ [ds] "r" (__HYPERVISOR_DS), -+ [stkoff] "i" (STACK_SIZE - sizeof(struct cpu_info)), -+ "D" (&mbi) -+ : "memory" ); -+ for( ; ; ); /* not reached */ -+} -+ -+void __init efi_init_memory(void) -+{ -+ unsigned int i; -+ -+ printk(XENLOG_INFO "EFI memory map:\n"); -+ for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size ) -+ { -+ EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; -+ u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT; -+ unsigned long smfn, emfn; -+ unsigned int prot = PAGE_HYPERVISOR; -+ -+ printk(XENLOG_INFO " %013" PRIx64 "-%013" PRIx64 -+ " type=%u attr=%016" PRIx64 "\n", -+ desc->PhysicalStart, desc->PhysicalStart + len - 1, -+ desc->Type, desc->Attribute); -+ -+ if ( !(desc->Attribute & EFI_MEMORY_RUNTIME) ) -+ continue; -+ -+ smfn = PFN_DOWN(desc->PhysicalStart); -+ emfn = PFN_UP(desc->PhysicalStart + len); -+ -+ desc->VirtualStart = 0xBAAADUL << (EFI_PAGE_SHIFT + BITS_PER_LONG - 32); -+ -+ if ( desc->Attribute & EFI_MEMORY_WB ) -+ /* nothing */; -+ else if ( desc->Attribute & EFI_MEMORY_WT ) -+ prot |= _PAGE_PWT | MAP_SMALL_PAGES; -+ else if ( desc->Attribute & EFI_MEMORY_WC ) -+ prot |= _PAGE_PAT | MAP_SMALL_PAGES; -+ else if ( desc->Attribute & (EFI_MEMORY_UC | EFI_MEMORY_UCE) ) -+ prot |= _PAGE_PWT | _PAGE_PCD | MAP_SMALL_PAGES; -+ else -+ { -+ printk(XENLOG_ERR "Unknown cachability for MFNs %#lx-%#lx\n", -+ smfn, emfn - 1); -+ continue; -+ } -+ -+ if ( desc->Attribute & EFI_MEMORY_WP ) -+ prot &= _PAGE_RW; -+ if ( desc->Attribute & EFI_MEMORY_XP ) -+ prot |= _PAGE_NX_BIT; -+ -+ if ( pfn_to_pdx(emfn - 1) < (DIRECTMAP_SIZE >> PAGE_SHIFT) && -+ !(smfn & pfn_hole_mask) && -+ !((smfn ^ (emfn - 1)) & ~pfn_pdx_bottom_mask) ) -+ { -+ if ( map_pages_to_xen((unsigned long)mfn_to_virt(smfn), -+ smfn, emfn - smfn, prot) == 0 ) -+ desc->VirtualStart = -+ (unsigned long)maddr_to_virt(desc->PhysicalStart); -+ else -+ printk(XENLOG_ERR "Could not map MFNs %#lx-%#lx\n", -+ smfn, emfn - 1); -+ } -+ else -+ { -+ /* XXX allocate e.g. down from FIXADDR_START */ -+ printk(XENLOG_ERR "No mapping for MFNs %#lx-%#lx\n", -+ smfn, emfn - 1); -+ } -+ } -+ -+#if 0 /* Incompatible with kexec. */ -+ efi_rs->SetVirtualAddressMap(efi_memmap_size, efi_mdesc_size, -+ mdesc_ver, efi_memmap); -+#endif -+} -Index: xen-4.1.3-testing/xen/arch/x86/efi/check.c -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/check.c -@@ -0,0 +1,4 @@ -+int __attribute__((__ms_abi__)) test(int i) -+{ -+ return i; -+} -Index: xen-4.1.3-testing/xen/arch/x86/efi/compat.c -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/compat.c -@@ -0,0 +1,16 @@ -+#include -+#include -+ -+#define efi_get_info efi_compat_get_info -+#define xenpf_efi_info compat_pf_efi_info -+ -+#define COMPAT -+#undef DEFINE_XEN_GUEST_HANDLE -+#define DEFINE_XEN_GUEST_HANDLE DEFINE_COMPAT_HANDLE -+#undef guest_handle_okay -+#define guest_handle_okay compat_handle_okay -+#undef guest_handle_cast -+#define guest_handle_cast compat_handle_cast -+#undef __copy_to_guest_offset -+#define __copy_to_guest_offset __copy_to_compat_offset -+#include "runtime.c" -Index: xen-4.1.3-testing/xen/arch/x86/efi/efi.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/efi.h -@@ -0,0 +1,18 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+extern unsigned int efi_num_ct; -+extern EFI_CONFIGURATION_TABLE *efi_ct; -+ -+extern unsigned int efi_version, efi_fw_revision; -+extern const CHAR16 *efi_fw_vendor; -+ -+extern EFI_RUNTIME_SERVICES *efi_rs; -+ -+extern UINTN efi_memmap_size, efi_mdesc_size; -+extern void *efi_memmap; -Index: xen-4.1.3-testing/xen/arch/x86/efi/mkreloc.c -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/mkreloc.c -@@ -0,0 +1,377 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct mz_hdr { -+ uint16_t signature; -+#define MZ_SIGNATURE 0x5a4d -+ uint16_t last_page_size; -+ uint16_t page_count; -+ uint16_t relocation_count; -+ uint16_t header_paras; -+ uint16_t min_paras; -+ uint16_t max_paras; -+ uint16_t entry_ss; -+ uint16_t entry_sp; -+ uint16_t checksum; -+ uint16_t entry_ip; -+ uint16_t entry_cs; -+ uint16_t relocations; -+ uint16_t overlay; -+ uint8_t reserved[32]; -+ uint32_t extended_header_base; -+}; -+ -+struct pe_hdr { -+ uint32_t signature; -+#define PE_SIGNATURE 0x00004550 -+ uint16_t cpu; -+ uint16_t section_count; -+ int32_t timestamp; -+ uint32_t symbols_file_offset; -+ uint32_t symbol_count; -+ uint16_t opt_hdr_size; -+ uint16_t flags; -+ struct { -+ uint16_t magic; -+#define PE_MAGIC_EXE32 0x010b -+#define PE_MAGIC_EXE32PLUS 0x020b -+ uint8_t linker_major, linker_minor; -+ uint32_t code_size, data_size, bss_size; -+ uint32_t entry_rva, code_rva, data_rva; -+ } opt_hdr; -+}; -+ -+#define PE_PAGE_SIZE 0x1000 -+ -+#define PE_BASE_RELOC_ABS 0 -+#define PE_BASE_RELOC_HIGHLOW 3 -+#define PE_BASE_RELOC_DIR64 10 -+ -+struct coff_section { -+ char name[8]; -+ uint32_t size; -+ uint32_t rva; -+ uint32_t file_size; -+ uint32_t file_offset; -+ uint32_t relocation_file_offset; -+ uint32_t line_number_file_offset; -+ uint16_t relocation_count; -+ uint16_t line_number_count; -+ uint32_t flags; -+#define COFF_SECTION_BSS 0x00000080 -+#define COFF_SECTION_DISCARDABLE 0x02000000 -+}; -+ -+static void usage(const char *cmd, int rc) -+{ -+ fprintf(rc ? stderr : stdout, -+ "Usage: %s \n", -+ cmd); -+ exit(rc); -+} -+ -+static unsigned int load(const char *name, int *handle, -+ struct coff_section **sections, -+ uint_fast64_t *image_base, -+ uint32_t *image_size, -+ unsigned int *width) -+{ -+ int in = open(name, O_RDONLY); -+ struct mz_hdr mz_hdr; -+ struct pe_hdr pe_hdr; -+ uint32_t base; -+ -+ if ( in < 0 || -+ read(in, &mz_hdr, sizeof(mz_hdr)) != sizeof(mz_hdr) ) -+ { -+ perror(name); -+ exit(2); -+ } -+ if ( mz_hdr.signature != MZ_SIGNATURE || -+ mz_hdr.relocations < sizeof(mz_hdr) || -+ !mz_hdr.extended_header_base ) -+ { -+ fprintf(stderr, "%s: Wrong DOS file format\n", name); -+ exit(2); -+ } -+ -+ if ( lseek(in, mz_hdr.extended_header_base, SEEK_SET) < 0 || -+ read(in, &pe_hdr, sizeof(pe_hdr)) != sizeof(pe_hdr) || -+ read(in, &base, sizeof(base)) != sizeof(base) || -+ /* -+ * Luckily the image size field lives at the -+ * same offset for both formats. -+ */ -+ lseek(in, 24, SEEK_CUR) < 0 || -+ read(in, image_size, sizeof(*image_size)) != sizeof(*image_size) ) -+ { -+ perror(name); -+ exit(3); -+ } -+ switch ( (pe_hdr.signature == PE_SIGNATURE && -+ pe_hdr.opt_hdr_size > sizeof(pe_hdr.opt_hdr)) * -+ pe_hdr.opt_hdr.magic ) -+ { -+ case PE_MAGIC_EXE32: -+ *width = 32; -+ *image_base = base; -+ break; -+ case PE_MAGIC_EXE32PLUS: -+ *width = 64; -+ *image_base = ((uint64_t)base << 32) | pe_hdr.opt_hdr.data_rva; -+ break; -+ default: -+ fprintf(stderr, "%s: Wrong PE file format\n", name); -+ exit(3); -+ } -+ -+ *sections = malloc(pe_hdr.section_count * sizeof(**sections)); -+ if ( !*sections ) -+ { -+ perror(NULL); -+ exit(4); -+ } -+ if ( lseek(in, -+ mz_hdr.extended_header_base + offsetof(struct pe_hdr, opt_hdr) + -+ pe_hdr.opt_hdr_size, -+ SEEK_SET) < 0 || -+ read(in, *sections, pe_hdr.section_count * sizeof(**sections)) != -+ pe_hdr.section_count * sizeof(**sections) ) -+ { -+ perror(name); -+ exit(4); -+ } -+ -+ *handle = in; -+ -+ return pe_hdr.section_count; -+} -+ -+static long page_size; -+ -+static const void *map_section(const struct coff_section *sec, int in, -+ const char *name) -+{ -+ const char *ptr; -+ unsigned long offs; -+ -+ if ( !page_size ) -+ page_size = sysconf(_SC_PAGESIZE); -+ offs = sec->file_offset & (page_size - 1); -+ -+ ptr = mmap(0, offs + sec->file_size, PROT_READ, MAP_PRIVATE, in, -+ sec->file_offset - offs); -+ if ( ptr == MAP_FAILED ) -+ { -+ perror(name); -+ exit(6); -+ } -+ -+ return ptr + offs; -+} -+ -+static void unmap_section(const void *ptr, const struct coff_section *sec) -+{ -+ unsigned long offs = sec->file_offset & (page_size - 1); -+ -+ munmap((char *)ptr - offs, offs + sec->file_size); -+} -+ -+static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2, -+ const struct coff_section *sec, -+ int_fast64_t diff, unsigned int width, -+ uint_fast64_t base, uint_fast64_t end) -+{ -+ static uint_fast32_t cur_rva, reloc_size; -+ unsigned int disp = 0; -+ uint_fast32_t i; -+ -+ if ( !sec ) -+ { -+ reloc_size += reloc_size & 2; -+ if ( reloc_size ) -+ printf("\t.balign 4\n" -+ "\t.equ rva_%08" PRIxFAST32 "_relocs, %#08" PRIxFAST32 "\n", -+ cur_rva, reloc_size); -+ return; -+ } -+ -+ while ( !(diff & (((int_fast64_t)1 << ((disp + 1) * CHAR_BIT)) - 1)) ) -+ ++disp; -+ -+ for ( i = 0; i < sec->file_size; ++i ) -+ { -+ uint_fast32_t rva; -+ union { -+ uint32_t u32; -+ uint64_t u64; -+ } val1, val2; -+ int_fast64_t delta; -+ unsigned int reloc = (width == 4 ? PE_BASE_RELOC_HIGHLOW : -+ PE_BASE_RELOC_DIR64); -+ -+ if ( ptr1[i] == ptr2[i] ) -+ continue; -+ -+ if ( i < disp || i + width - disp > sec->file_size ) -+ { -+ fprintf(stderr, -+ "Bogus difference at %s:%08" PRIxFAST32 "\n", -+ sec->name, i); -+ exit(3); -+ } -+ -+ memcpy(&val1, ptr1 + i - disp, width); -+ memcpy(&val2, ptr2 + i - disp, width); -+ delta = width == 4 ? val2.u32 - val1.u32 : val2.u64 - val1.u64; -+ if ( delta != diff ) -+ { -+ fprintf(stderr, -+ "Difference at %s:%08" PRIxFAST32 " is %#" PRIxFAST64 -+ " (expected %#" PRIxFAST64 ")\n", -+ sec->name, i, delta, diff); -+ continue; -+ } -+ if ( width == 8 && (val1.u64 < base || val1.u64 > end) ) -+ reloc = PE_BASE_RELOC_HIGHLOW; -+ -+ rva = (sec->rva + i - disp) & ~(PE_PAGE_SIZE - 1); -+ if ( rva > cur_rva ) -+ { -+ reloc_size += reloc_size & 2; -+ if ( reloc_size ) -+ printf("\t.equ rva_%08" PRIxFAST32 "_relocs," -+ " %#08" PRIxFAST32 "\n", -+ cur_rva, reloc_size); -+ printf("\t.balign 4\n" -+ "\t.long %#08" PRIxFAST32 "," -+ " rva_%08" PRIxFAST32 "_relocs\n", -+ rva, rva); -+ cur_rva = rva; -+ reloc_size = 8; -+ } -+ else if ( rva != cur_rva ) -+ { -+ fprintf(stderr, -+ "Cannot handle decreasing RVA (at %s:%08" PRIxFAST32 ")\n", -+ sec->name, i); -+ exit(3); -+ } -+ -+ printf("\t.word (%u << 12) | 0x%03" PRIxFAST32 "\n", -+ reloc, sec->rva + i - disp - rva); -+ reloc_size += 2; -+ i += width - disp - 1; -+ } -+} -+ -+int main(int argc, char *argv[]) -+{ -+ int in1, in2; -+ unsigned int i, nsec, width1, width2; -+ uint_fast64_t base1, base2; -+ uint32_t size1, size2; -+ struct coff_section *sec1, *sec2; -+ -+ if ( argc == 1 || -+ !strcmp(argv[1], "-?") || -+ !strcmp(argv[1], "-h") || -+ !strcmp(argv[1], "--help") ) -+ usage(*argv, argc == 1); -+ -+ if ( argc != 3 ) -+ usage(*argv, 1); -+ -+ nsec = load(argv[1], &in1, &sec1, &base1, &size1, &width1); -+ if ( nsec != load(argv[2], &in2, &sec2, &base2, &size2, &width2) ) -+ { -+ fputs("Mismatched section counts\n", stderr); -+ return 5; -+ } -+ if ( width1 != width2 ) -+ { -+ fputs("Mismatched image types\n", stderr); -+ return 5; -+ } -+ width1 >>= 3; -+ if ( base1 == base2 ) -+ { -+ fputs("Images must have different base addresses\n", stderr); -+ return 5; -+ } -+ if ( size1 != size2 ) -+ { -+ fputs("Images must have identical sizes\n", stderr); -+ return 5; -+ } -+ -+ puts("\t.section .reloc, \"a\", @progbits\n" -+ "\t.balign 4\n" -+ "\t.globl __base_relocs_start, __base_relocs_end\n" -+ "__base_relocs_start:"); -+ -+ for ( i = 0; i < nsec; ++i ) -+ { -+ const void *ptr1, *ptr2; -+ -+ if ( memcmp(sec1[i].name, sec2[i].name, sizeof(sec1[i].name)) || -+ sec1[i].rva != sec2[i].rva || -+ sec1[i].size != sec2[i].size || -+ sec1[i].file_size != sec2[i].file_size || -+ sec1[i].flags != sec2[i].flags ) -+ { -+ fprintf(stderr, "Mismatched section %u parameters\n", i); -+ return 5; -+ } -+ -+ if ( !sec1[i].size || -+ (sec1[i].flags & (COFF_SECTION_DISCARDABLE|COFF_SECTION_BSS)) ) -+ continue; -+ -+ /* -+ * Don't generate relocations for sections that definitely -+ * aren't used by the boot loader code. -+ */ -+ if ( memcmp(sec1[i].name, ".initcal", sizeof(sec1[i].name)) == 0 || -+ memcmp(sec1[i].name, ".init.se", sizeof(sec1[i].name)) == 0 || -+ memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 ) -+ continue; -+ -+ if ( !sec1[i].rva ) -+ { -+ fprintf(stderr, "Can't handle section %u with zero RVA\n", i); -+ return 3; -+ } -+ -+ if ( sec1[i].file_size > sec1[i].size ) -+ { -+ sec1[i].file_size = sec1[i].size; -+ sec2[i].file_size = sec2[i].size; -+ } -+ ptr1 = map_section(sec1 + i, in1, argv[1]); -+ ptr2 = map_section(sec2 + i, in2, argv[2]); -+ -+ diff_sections(ptr1, ptr2, sec1 + i, base2 - base1, width1, -+ base1, base1 + size1); -+ -+ unmap_section(ptr1, sec1 + i); -+ unmap_section(ptr2, sec2 + i); -+ } -+ -+ diff_sections(NULL, NULL, NULL, 0, 0, 0, 0); -+ -+ puts("__base_relocs_end:"); -+ -+ close(in1); -+ close(in2); -+ -+ return 0; -+} -Index: xen-4.1.3-testing/xen/arch/x86/efi/relocs-dummy.S -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/relocs-dummy.S -@@ -0,0 +1,13 @@ -+#include -+ -+ .section .reloc, "a", @progbits -+ .balign 4 -+ .globl __base_relocs_start, __base_relocs_end -+__base_relocs_start: -+ .long 0 -+ .long 8 -+__base_relocs_end: -+ -+ .globl VIRT_START, ALT_START -+ .equ VIRT_START, XEN_VIRT_START -+ .equ ALT_START, XEN_VIRT_END -Index: xen-4.1.3-testing/xen/arch/x86/efi/runtime.c -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/runtime.c -@@ -0,0 +1,88 @@ -+#include "efi.h" -+#include -+#include -+#include -+ -+DEFINE_XEN_GUEST_HANDLE(CHAR16); -+ -+#ifndef COMPAT -+ -+# include -+ -+const bool_t efi_enabled = 1; -+ -+unsigned int __read_mostly efi_num_ct; -+EFI_CONFIGURATION_TABLE *__read_mostly efi_ct; -+ -+unsigned int __read_mostly efi_version; -+unsigned int __read_mostly efi_fw_revision; -+const CHAR16 *__read_mostly efi_fw_vendor; -+ -+EFI_RUNTIME_SERVICES *__read_mostly efi_rs; -+ -+UINTN __read_mostly efi_memmap_size; -+UINTN __read_mostly efi_mdesc_size; -+void *__read_mostly efi_memmap; -+ -+struct efi __read_mostly efi = { -+ .acpi = EFI_INVALID_TABLE_ADDR, -+ .acpi20 = EFI_INVALID_TABLE_ADDR, -+ .smbios = EFI_INVALID_TABLE_ADDR, -+}; -+ -+#endif -+ -+int efi_get_info(uint32_t idx, union xenpf_efi_info *info) -+{ -+ unsigned int i, n; -+ -+ switch ( idx ) -+ { -+ case XEN_FW_EFI_VERSION: -+ info->version = efi_version; -+ break; -+ case XEN_FW_EFI_CONFIG_TABLE: -+ info->cfg.addr = __pa(efi_ct); -+ info->cfg.nent = efi_num_ct; -+ break; -+ case XEN_FW_EFI_VENDOR: -+ info->vendor.revision = efi_fw_revision; -+ n = info->vendor.bufsz / sizeof(*efi_fw_vendor); -+ if ( !guest_handle_okay(guest_handle_cast(info->vendor.name, -+ CHAR16), n) ) -+ return -EFAULT; -+ for ( i = 0; i < n; ++i ) -+ { -+ if ( __copy_to_guest_offset(info->vendor.name, i, -+ efi_fw_vendor + i, 1) ) -+ return -EFAULT; -+ if ( !efi_fw_vendor[i] ) -+ break; -+ } -+ break; -+ case XEN_FW_EFI_MEM_INFO: -+ for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size ) -+ { -+ EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; -+ u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT; -+ -+ if ( info->mem.addr >= desc->PhysicalStart && -+ info->mem.addr < desc->PhysicalStart + len ) -+ { -+ info->mem.type = desc->Type; -+ info->mem.attr = desc->Attribute; -+ if ( info->mem.addr + info->mem.size < info->mem.addr || -+ info->mem.addr + info->mem.size > -+ desc->PhysicalStart + len ) -+ info->mem.size = desc->PhysicalStart + len - -+ info->mem.addr; -+ return 0; -+ } -+ } -+ return -ESRCH; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -Index: xen-4.1.3-testing/xen/arch/x86/efi/stub.c -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/arch/x86/efi/stub.c -@@ -0,0 +1,17 @@ -+#include -+#include -+#include -+ -+#ifndef efi_enabled -+const bool_t efi_enabled = 0; -+#endif -+ -+void __init efi_init_memory(void) { } -+ -+int efi_get_info(uint32_t idx, union xenpf_efi_info *info) -+{ -+ return -ENOSYS; -+} -+ -+int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *) -+ __attribute__((__alias__("efi_get_info"))); -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -101,6 +101,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -356,6 +357,8 @@ void __init arch_init_memory(void) - - subarch_init_memory(); - -+ efi_init_memory(); -+ - mem_sharing_init(); - } - -Index: xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/platform_hypercall.c -+++ xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -294,6 +295,14 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe - bootsym(boot_edid_info), 128) ) - ret = -EFAULT; - break; -+ case XEN_FW_EFI_INFO: -+ ret = efi_get_info(op->u.firmware_info.index, -+ &op->u.firmware_info.u.efi_info); -+ if ( ret == 0 && -+ copy_field_to_guest(u_xenpf_op, op, -+ u.firmware_info.u.efi_info) ) -+ ret = -EFAULT; -+ break; - default: - ret = -EINVAL; - break; -Index: xen-4.1.3-testing/xen/arch/x86/setup.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/setup.c -+++ xen-4.1.3-testing/xen/arch/x86/setup.c -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -446,6 +447,10 @@ static void __init parse_video_info(void - { - struct boot_video_info *bvi = &bootsym(boot_vid_info); - -+ /* The EFI loader fills vga_console_info directly. */ -+ if ( efi_enabled ) -+ return; -+ - if ( (bvi->orig_video_isVGA == 1) && (bvi->orig_video_mode == 3) ) - { - vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3; -@@ -617,6 +622,7 @@ void __init __start_xen(unsigned long mb - vga_console_info.u.text_mode_3.font_height); - break; - case XEN_VGATYPE_VESA_LFB: -+ case XEN_VGATYPE_EFI_LFB: - printk(" VGA is graphics mode %dx%d, %d bpp\n", - vga_console_info.u.vesa_lfb.width, - vga_console_info.u.vesa_lfb.height, -@@ -662,7 +668,24 @@ void __init __start_xen(unsigned long mb - if ( ((unsigned long)cpu0_stack & (STACK_SIZE-1)) != 0 ) - EARLY_FAIL("Misaligned CPU0 stack.\n"); - -- if ( e820_raw_nr != 0 ) -+ if ( efi_enabled ) -+ { -+ set_pdx_range(xen_phys_start >> PAGE_SHIFT, -+ (xen_phys_start + BOOTSTRAP_MAP_BASE) >> PAGE_SHIFT); -+ -+ /* Clean up boot loader identity mappings. */ -+ destroy_xen_mappings(xen_phys_start, -+ xen_phys_start + BOOTSTRAP_MAP_BASE); -+ -+#ifdef CONFIG_X86_64 -+ /* Make boot page tables match non-EFI boot. */ -+ l3_bootmap[l3_table_offset(BOOTSTRAP_MAP_BASE)] = -+ l3e_from_paddr(__pa(l2_bootmap), __PAGE_HYPERVISOR); -+#endif -+ -+ memmap_type = loader; -+ } -+ else if ( e820_raw_nr != 0 ) - { - memmap_type = "Xen-e820"; - } -@@ -760,7 +783,7 @@ void __init __start_xen(unsigned long mb - * we can relocate the dom0 kernel and other multiboot modules. Also, on - * x86/64, we relocate Xen to higher memory. - */ -- for ( i = 0; i < mbi->mods_count; i++ ) -+ for ( i = 0; !efi_enabled && i < mbi->mods_count; i++ ) - { - if ( mod[i].mod_start & (PAGE_SIZE - 1) ) - EARLY_FAIL("Bootloader didn't honor module alignment request.\n"); -@@ -809,7 +832,6 @@ void __init __start_xen(unsigned long mb - end = 0; - if ( end > s ) - { -- extern l2_pgentry_t l2_xenmap[]; - l4_pgentry_t *pl4e; - l3_pgentry_t *pl3e; - l2_pgentry_t *pl2e; -@@ -949,7 +971,8 @@ void __init __start_xen(unsigned long mb - #else - if ( !xen_phys_start ) - EARLY_FAIL("Not enough memory to relocate Xen.\n"); -- reserve_e820_ram(&boot_e820, __pa(&_start), __pa(&_end)); -+ reserve_e820_ram(&boot_e820, efi_enabled ? mbi->mem_upper : __pa(&_start), -+ __pa(&_end)); - #endif - - /* Late kexec reservation (dynamic start address). */ -Index: xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c -@@ -34,8 +34,6 @@ - l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) - idle_pg_table_l2[4 * L2_PAGETABLE_ENTRIES]; - --extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES]; -- - unsigned int __read_mostly PAGE_HYPERVISOR = __PAGE_HYPERVISOR; - unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE; - -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -830,7 +831,8 @@ void __init zap_low_mappings(void) - - /* Replace with mapping of the boot trampoline only. */ - map_pages_to_xen(BOOT_TRAMPOLINE, BOOT_TRAMPOLINE >> PAGE_SHIFT, -- 0x10, __PAGE_HYPERVISOR); -+ PFN_UP(trampoline_end - trampoline_start), -+ __PAGE_HYPERVISOR); - } - - void *compat_arg_xlat_virt_base(void) -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/platform_hypercall.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/platform_hypercall.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/platform_hypercall.c -@@ -11,6 +11,8 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_ - #define xen_platform_op_t compat_platform_op_t - #define do_platform_op(x) compat_platform_op(_##x) - -+#define efi_get_info efi_compat_get_info -+ - #define xen_processor_px compat_processor_px - #define xen_processor_px_t compat_processor_px_t - #define xen_processor_performance compat_processor_performance -Index: xen-4.1.3-testing/xen/arch/x86/xen.lds.S -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/xen.lds.S -+++ xen-4.1.3-testing/xen/arch/x86/xen.lds.S -@@ -8,15 +8,34 @@ - #undef ENTRY - #undef ALIGN - -+#ifdef EFI -+ -+#define FORMAT "pei-x86-64" -+#undef __XEN_VIRT_START -+#define __XEN_VIRT_START __image_base__ -+ -+ENTRY(efi_start) -+ -+#else /* !EFI */ -+ -+#ifdef __x86_64__ -+#define FORMAT "elf64-x86-64" -+#else -+#define FORMAT "elf32-i386" -+#endif -+ -+ENTRY(start) -+ -+#endif /* EFI */ -+ -+OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT) -+ - #ifdef __x86_64__ --OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") - OUTPUT_ARCH(i386:x86-64) - #else --OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") - OUTPUT_ARCH(i386) - #endif - --ENTRY(start) - PHDRS - { - text PT_LOAD ; -@@ -122,12 +141,30 @@ SECTIONS - } :text - _end = . ; - -+#ifdef EFI -+ . = ALIGN(4); -+ .reloc : { -+ *(.reloc) -+ } :text -+ /* Trick the linker into setting the image size to exactly 16Mb. */ -+ . = ALIGN(__section_alignment__); -+ .pad : { -+ . = ALIGN(0x1000000); -+ } :text -+#else -+ efi = .; -+#endif -+ - /* Sections to be discarded */ - /DISCARD/ : { - *(.exit.text) - *(.exit.data) - *(.exitcall.exit) - *(.eh_frame) -+#ifdef EFI -+ *(.comment) -+ *(.comment.*) -+#endif - } - - /* Stabs debugging sections. */ -Index: xen-4.1.3-testing/xen/drivers/acpi/osl.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/acpi/osl.c -+++ xen-4.1.3-testing/xen/drivers/acpi/osl.c -@@ -37,9 +37,7 @@ - #include - #include - #include --#ifdef __ia64__ --#include --#endif -+#include - - #define _COMPONENT ACPI_OS_SERVICES - ACPI_MODULE_NAME("osl") -@@ -82,7 +80,6 @@ void acpi_os_vprintf(const char *fmt, va - - acpi_physical_address __init acpi_os_get_root_pointer(void) - { --#ifdef __ia64__ - if (efi_enabled) { - if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) - return efi.acpi20; -@@ -93,9 +90,7 @@ acpi_physical_address __init acpi_os_get - "System description tables not found\n"); - return 0; - } -- } else --#endif -- { -+ } else { - acpi_physical_address pa = 0; - - acpi_find_root_pointer(&pa); -Index: xen-4.1.3-testing/xen/drivers/video/vga.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/video/vga.c -+++ xen-4.1.3-testing/xen/drivers/video/vga.c -@@ -89,6 +89,7 @@ void __init vga_init(void) - vga_puts = vga_text_puts; - break; - case XEN_VGATYPE_VESA_LFB: -+ case XEN_VGATYPE_EFI_LFB: - vesa_early_init(); - break; - default: -@@ -115,6 +116,7 @@ void __init vga_endboot(void) - memset(video, 0, columns * lines * 2); - break; - case XEN_VGATYPE_VESA_LFB: -+ case XEN_VGATYPE_EFI_LFB: - vesa_endboot(vgacon_keep); - break; - default: -Index: xen-4.1.3-testing/xen/include/asm-x86/page.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/page.h -+++ xen-4.1.3-testing/xen/include/asm-x86/page.h -@@ -301,8 +301,14 @@ extern l2_pgentry_t idle_pg_table_l2[ - #elif CONFIG_PAGING_LEVELS == 4 - extern l2_pgentry_t *compat_idle_pg_table_l2; - extern unsigned int m2p_compat_vstart; -+extern l2_pgentry_t l2_xenmap[L2_PAGETABLE_ENTRIES], -+ l2_bootmap[L2_PAGETABLE_ENTRIES]; -+extern l3_pgentry_t l3_xenmap[L3_PAGETABLE_ENTRIES], -+ l3_identmap[L3_PAGETABLE_ENTRIES], -+ l3_bootmap[L3_PAGETABLE_ENTRIES]; - #endif - extern l2_pgentry_t l2_identmap[4*L2_PAGETABLE_ENTRIES]; -+extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES]; - void paging_init(void); - void setup_idle_pagetable(void); - #endif /* !defined(__ASSEMBLY__) */ -Index: xen-4.1.3-testing/xen/include/public/platform.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/platform.h -+++ xen-4.1.3-testing/xen/include/public/platform.h -@@ -118,6 +118,11 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_platform_q - #define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ - #define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ - #define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */ -+#define XEN_FW_EFI_INFO 4 /* from EFI */ -+#define XEN_FW_EFI_VERSION 0 -+#define XEN_FW_EFI_CONFIG_TABLE 1 -+#define XEN_FW_EFI_VENDOR 2 -+#define XEN_FW_EFI_MEM_INFO 3 - struct xenpf_firmware_info { - /* IN variables. */ - uint32_t type; -@@ -148,6 +153,24 @@ struct xenpf_firmware_info { - /* must refer to 128-byte buffer */ - XEN_GUEST_HANDLE(uint8) edid; - } vbeddc_info; /* XEN_FW_VBEDDC_INFO */ -+ union xenpf_efi_info { -+ uint32_t version; -+ struct { -+ uint64_t addr; /* EFI_CONFIGURATION_TABLE */ -+ uint32_t nent; -+ } cfg; -+ struct { -+ uint32_t revision; -+ uint32_t bufsz; /* input, in bytes */ -+ XEN_GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */ -+ } vendor; -+ struct { -+ uint64_t addr; -+ uint64_t size; -+ uint64_t attr; -+ uint32_t type; -+ } mem; -+ } efi_info; /* XEN_FW_EFI_INFO */ - } u; - }; - typedef struct xenpf_firmware_info xenpf_firmware_info_t; -Index: xen-4.1.3-testing/xen/include/public/xen.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/xen.h -+++ xen-4.1.3-testing/xen/include/public/xen.h -@@ -638,6 +638,7 @@ typedef struct dom0_vga_console_info { - uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */ - #define XEN_VGATYPE_TEXT_MODE_3 0x03 - #define XEN_VGATYPE_VESA_LFB 0x23 -+#define XEN_VGATYPE_EFI_LFB 0x70 - - union { - struct { -Index: xen-4.1.3-testing/xen/include/xen/compat.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/compat.h -+++ xen-4.1.3-testing/xen/include/xen/compat.h -@@ -34,7 +34,7 @@ - /* Cast a compat handle to the specified type of handle. */ - #define compat_handle_cast(chnd, type) ({ \ - type *_x = (__typeof__(**(chnd)._) *)(full_ptr_t)(chnd).c; \ -- (XEN_GUEST_HANDLE(type)) { _x }; \ -+ (COMPAT_HANDLE(type)) { (full_ptr_t)_x }; \ - }) - - #define guest_from_compat_handle(ghnd, chnd) \ -Index: xen-4.1.3-testing/xen/include/xen/dmi.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/dmi.h -+++ xen-4.1.3-testing/xen/include/xen/dmi.h -@@ -36,5 +36,6 @@ extern int dmi_check_system(struct dmi_s - extern char * dmi_get_system_info(int field); - extern void dmi_scan_machine(void); - extern int dmi_get_table(u32 *base, u32 *len); -+extern void dmi_efi_get_table(void *); - - #endif /* __DMI_H__ */ -Index: xen-4.1.3-testing/xen/include/xen/efi.h -=================================================================== ---- /dev/null -+++ xen-4.1.3-testing/xen/include/xen/efi.h -@@ -0,0 +1,38 @@ -+#ifndef __XEN_EFI_H__ -+#define __XEN_EFI_H__ -+ -+#include -+ -+#if defined(__ia64__) -+# #include -+#else -+ -+# if defined(__i386__) -+# define efi_enabled 0 -+# else -+extern const bool_t efi_enabled; -+# endif -+ -+#define EFI_INVALID_TABLE_ADDR (~0UL) -+ -+/* Add fields here only if they need to be referenced from non-EFI code. */ -+struct efi { -+ unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ -+ unsigned long acpi20; /* ACPI table (ACPI 2.0) */ -+ unsigned long smbios; /* SM BIOS table */ -+}; -+ -+extern struct efi efi; -+ -+#endif -+ -+union xenpf_efi_info; -+union compat_pf_efi_info; -+ -+void efi_init_memory(void); -+#ifndef COMPAT -+int efi_get_info(uint32_t idx, union xenpf_efi_info *); -+#endif -+int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *); -+ -+#endif /* __XEN_EFI_H__ */ diff --git a/23615-x86_64-EFI-runtime.patch b/23615-x86_64-EFI-runtime.patch deleted file mode 100644 index 171adb6..0000000 --- a/23615-x86_64-EFI-runtime.patch +++ /dev/null @@ -1,850 +0,0 @@ -References: fate#311376, fate#311529, bnc#578927, bnc#628554 - -# HG changeset patch -# User Jan Beulich -# Date 1309249249 -3600 -# Node ID d19e778442673050bba8ea8cf61585902ff81162 -# Parent 8b7d00f2abb21b504f6f8e1a6cc235cee8eb0858 -x86-64: EFI runtime code - -This allows Dom0 access to all suitable EFI runtime services. The -actual calls into EFI are done in "physical" mode, as entering virtual -mode has been determined to be incompatible with kexec (EFI's -SetVirtualAddressMap() can be called only once, and hence the -secondary kernel can't establish its mappings). ("Physical" mode here -being quoted because this is a mode with paging enabled [otherwise -64-bit mode wouldn't work] but all mappings being 1:1.) - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1309549303 -3600 -# Node ID 7631c461132000979f05759705c055eb3c975c0b -# Parent 335e96664589dd14dfce7ef72e3fee71ad9c39e3 -x86/EFI: fix interrupt and fault handling during runtime services calls - -The missing piece was the setting up of an accessible GDT prior to -switching page tables (and reverting to the original setting after -having established the normal page tables again afterwards). - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1311081015 -3600 -# Node ID 7bc5825e471db5a3a989f47d21334ef63a6b5610 -# Parent 0ccb94d533d6feaece5d48eb1bbfb9ae1b6174c1 -x86-64/EFI: don't call EfiResetSystem() from machine_halt() - -c/s 23615:d19e77844267 was a little too eager in adding calls to EFI -runtime services: machine_halt() doesn't really want to power off the -machine, but that's what EfiResetSystem(EfiResetShutdown, ...) (called -through efi_halt_system()) does. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.2-testing/xen/arch/x86/efi/boot.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/boot.c -+++ xen-4.1.2-testing/xen/arch/x86/efi/boot.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -1149,6 +1150,53 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - for( ; ; ); /* not reached */ - } - -+static __init void copy_mapping(unsigned long mfn, unsigned long end, -+ bool_t (*is_valid)(unsigned long smfn, -+ unsigned long emfn)) -+{ -+ unsigned long next; -+ -+ for ( ; mfn < end; mfn = next ) -+ { -+ l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)]; -+ l3_pgentry_t *l3src, *l3dst; -+ unsigned long va = (unsigned long)mfn_to_virt(mfn); -+ -+ next = mfn + (1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT)); -+ if ( !is_valid(mfn, min(next, end)) ) -+ continue; -+ if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) ) -+ { -+ l3dst = alloc_xen_pagetable(); -+ BUG_ON(!l3dst); -+ clear_page(l3dst); -+ efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)] = -+ l4e_from_paddr(virt_to_maddr(l3dst), __PAGE_HYPERVISOR); -+ } -+ else -+ l3dst = l4e_to_l3e(l4e); -+ l3src = l4e_to_l3e(idle_pg_table[l4_table_offset(va)]); -+ l3dst[l3_table_offset(mfn << PAGE_SHIFT)] = l3src[l3_table_offset(va)]; -+ } -+} -+ -+static bool_t __init ram_range_valid(unsigned long smfn, unsigned long emfn) -+{ -+ unsigned long sz = pfn_to_pdx(emfn - 1) / PDX_GROUP_COUNT + 1; -+ -+ return !(smfn & pfn_hole_mask) && -+ find_next_bit(pdx_group_valid, sz, -+ pfn_to_pdx(smfn) / PDX_GROUP_COUNT) < sz; -+} -+ -+static bool_t __init rt_range_valid(unsigned long smfn, unsigned long emfn) -+{ -+ return 1; -+} -+ -+#define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \ -+ (EFI_PAGE_SHIFT + BITS_PER_LONG - 32)) -+ - void __init efi_init_memory(void) - { - unsigned int i; -@@ -1169,11 +1217,11 @@ void __init efi_init_memory(void) - if ( !(desc->Attribute & EFI_MEMORY_RUNTIME) ) - continue; - -+ desc->VirtualStart = INVALID_VIRTUAL_ADDRESS; -+ - smfn = PFN_DOWN(desc->PhysicalStart); - emfn = PFN_UP(desc->PhysicalStart + len); - -- desc->VirtualStart = 0xBAAADUL << (EFI_PAGE_SHIFT + BITS_PER_LONG - 32); -- - if ( desc->Attribute & EFI_MEMORY_WB ) - /* nothing */; - else if ( desc->Attribute & EFI_MEMORY_WT ) -@@ -1217,5 +1265,34 @@ void __init efi_init_memory(void) - #if 0 /* Incompatible with kexec. */ - efi_rs->SetVirtualAddressMap(efi_memmap_size, efi_mdesc_size, - mdesc_ver, efi_memmap); -+#else -+ /* Set up 1:1 page tables to do runtime calls in "physical" mode. */ -+ efi_l4_pgtable = alloc_xen_pagetable(); -+ BUG_ON(!efi_l4_pgtable); -+ clear_page(efi_l4_pgtable); -+ -+ copy_mapping(0, max_page, ram_range_valid); -+ -+ /* Insert non-RAM runtime mappings. */ -+ for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size ) -+ { -+ const EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; -+ -+ if ( desc->Attribute & EFI_MEMORY_RUNTIME ) -+ { -+ if ( desc->VirtualStart != INVALID_VIRTUAL_ADDRESS ) -+ copy_mapping(PFN_DOWN(desc->PhysicalStart), -+ PFN_UP(desc->PhysicalStart + -+ (desc->NumberOfPages << EFI_PAGE_SHIFT)), -+ rt_range_valid); -+ else -+ /* XXX */; -+ } -+ } -+ -+ /* Insert Xen mappings. */ -+ for ( i = l4_table_offset(HYPERVISOR_VIRT_START); -+ i < l4_table_offset(HYPERVISOR_VIRT_END); ++i ) -+ efi_l4_pgtable[i] = idle_pg_table[i]; - #endif - } -Index: xen-4.1.2-testing/xen/arch/x86/efi/compat.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/compat.c -+++ xen-4.1.2-testing/xen/arch/x86/efi/compat.c -@@ -4,13 +4,27 @@ - #define efi_get_info efi_compat_get_info - #define xenpf_efi_info compat_pf_efi_info - -+#define efi_runtime_call efi_compat_runtime_call -+#define xenpf_efi_runtime_call compat_pf_efi_runtime_call -+ -+#define xenpf_efi_guid compat_pf_efi_guid -+#define xenpf_efi_time compat_pf_efi_time -+ - #define COMPAT - #undef DEFINE_XEN_GUEST_HANDLE - #define DEFINE_XEN_GUEST_HANDLE DEFINE_COMPAT_HANDLE -+#undef XEN_GUEST_HANDLE -+#define XEN_GUEST_HANDLE COMPAT_HANDLE - #undef guest_handle_okay - #define guest_handle_okay compat_handle_okay - #undef guest_handle_cast - #define guest_handle_cast compat_handle_cast -+#undef __copy_from_guest -+#define __copy_from_guest __copy_from_compat -+#undef copy_from_guest_offset -+#define copy_from_guest_offset copy_from_compat_offset -+#undef copy_to_guest -+#define copy_to_guest copy_to_compat - #undef __copy_to_guest_offset - #define __copy_to_guest_offset __copy_to_compat_offset - #include "runtime.c" -Index: xen-4.1.2-testing/xen/arch/x86/efi/efi.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/efi.h -+++ xen-4.1.2-testing/xen/arch/x86/efi/efi.h -@@ -5,6 +5,8 @@ - #include - #include - #include -+#include -+#include - - extern unsigned int efi_num_ct; - extern EFI_CONFIGURATION_TABLE *efi_ct; -@@ -16,3 +18,8 @@ extern EFI_RUNTIME_SERVICES *efi_rs; - - extern UINTN efi_memmap_size, efi_mdesc_size; - extern void *efi_memmap; -+ -+extern l4_pgentry_t *efi_l4_pgtable; -+ -+unsigned long efi_rs_enter(void); -+void efi_rs_leave(unsigned long); -Index: xen-4.1.2-testing/xen/arch/x86/efi/runtime.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/runtime.c -+++ xen-4.1.2-testing/xen/arch/x86/efi/runtime.c -@@ -2,6 +2,7 @@ - #include - #include - #include -+#include - - DEFINE_XEN_GUEST_HANDLE(CHAR16); - -@@ -19,6 +20,7 @@ unsigned int __read_mostly efi_fw_revisi - const CHAR16 *__read_mostly efi_fw_vendor; - - EFI_RUNTIME_SERVICES *__read_mostly efi_rs; -+static DEFINE_SPINLOCK(efi_rs_lock); - - UINTN __read_mostly efi_memmap_size; - UINTN __read_mostly efi_mdesc_size; -@@ -30,6 +32,88 @@ struct efi __read_mostly efi = { - .smbios = EFI_INVALID_TABLE_ADDR, - }; - -+l4_pgentry_t *__read_mostly efi_l4_pgtable; -+ -+unsigned long efi_rs_enter(void) -+{ -+ unsigned long cr3 = read_cr3(); -+ -+ spin_lock(&efi_rs_lock); -+ -+ /* prevent fixup_page_fault() from doing anything */ -+ irq_enter(); -+ -+ if ( !is_hvm_vcpu(current) && !is_idle_vcpu(current) ) -+ { -+ struct desc_ptr gdt_desc = { -+ .limit = LAST_RESERVED_GDT_BYTE, -+ .base = (unsigned long)(per_cpu(gdt_table, smp_processor_id()) - -+ FIRST_RESERVED_GDT_ENTRY) -+ }; -+ -+ asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); -+ } -+ -+ write_cr3(virt_to_maddr(efi_l4_pgtable)); -+ -+ return cr3; -+} -+ -+void efi_rs_leave(unsigned long cr3) -+{ -+ write_cr3(cr3); -+ if ( !is_hvm_vcpu(current) && !is_idle_vcpu(current) ) -+ { -+ struct desc_ptr gdt_desc = { -+ .limit = LAST_RESERVED_GDT_BYTE, -+ .base = GDT_VIRT_START(current) -+ }; -+ -+ asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); -+ } -+ irq_exit(); -+ spin_unlock(&efi_rs_lock); -+} -+ -+unsigned long efi_get_time(void) -+{ -+ EFI_TIME time; -+ EFI_STATUS status; -+ unsigned long cr3 = efi_rs_enter(); -+ -+ status = efi_rs->GetTime(&time, NULL); -+ efi_rs_leave(cr3); -+ -+ if ( EFI_ERROR(status) ) -+ return 0; -+ -+ return mktime(time.Year, time.Month, time.Day, -+ time.Hour, time.Minute, time.Second); -+} -+ -+void efi_halt_system(void) -+{ -+ EFI_STATUS status; -+ unsigned long cr3 = efi_rs_enter(); -+ -+ status = efi_rs->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); -+ efi_rs_leave(cr3); -+ -+ printk(XENLOG_WARNING "EFI: could not halt system (%#lx)\n", status); -+} -+ -+void efi_reset_system(bool_t warm) -+{ -+ EFI_STATUS status; -+ unsigned long cr3 = efi_rs_enter(); -+ -+ status = efi_rs->ResetSystem(warm ? EfiResetWarm : EfiResetCold, -+ EFI_SUCCESS, 0, NULL); -+ efi_rs_leave(cr3); -+ -+ printk(XENLOG_WARNING "EFI: could not reset system (%#lx)\n", status); -+} -+ - #endif - - int efi_get_info(uint32_t idx, union xenpf_efi_info *info) -@@ -86,3 +170,267 @@ int efi_get_info(uint32_t idx, union xen - - return 0; - } -+ -+static long gwstrlen(XEN_GUEST_HANDLE(CHAR16) str) -+{ -+ unsigned long len; -+ -+ for ( len = 0; ; ++len ) -+ { -+ CHAR16 c; -+ -+ if ( copy_from_guest_offset(&c, str, len, 1) ) -+ return -EFAULT; -+ if ( !c ) -+ break; -+ } -+ -+ return len; -+} -+ -+static inline EFI_TIME *cast_time(struct xenpf_efi_time *time) -+{ -+#define chk_fld(F, f) \ -+ BUILD_BUG_ON(sizeof(cast_time(NULL)->F) != sizeof(time->f) || \ -+ offsetof(EFI_TIME, F) != offsetof(struct xenpf_efi_time, f)) -+ chk_fld(Year, year); -+ chk_fld(Month, month); -+ chk_fld(Day, day); -+ chk_fld(Hour, hour); -+ chk_fld(Minute, min); -+ chk_fld(Second, sec); -+ chk_fld(Nanosecond, ns); -+ chk_fld(TimeZone, tz); -+ chk_fld(Daylight, daylight); -+#undef chk_fld -+ return (void *)time; -+} -+ -+static inline EFI_GUID *cast_guid(struct xenpf_efi_guid *guid) -+{ -+#define chk_fld(n) \ -+ BUILD_BUG_ON(sizeof(cast_guid(NULL)->Data##n) != sizeof(guid->data##n) || \ -+ offsetof(EFI_GUID, Data##n) != \ -+ offsetof(struct xenpf_efi_guid, data##n)) -+ chk_fld(1); -+ chk_fld(2); -+ chk_fld(3); -+ chk_fld(4); -+#undef chk_fld -+ return (void *)guid; -+} -+ -+int efi_runtime_call(struct xenpf_efi_runtime_call *op) -+{ -+ unsigned long cr3; -+ EFI_STATUS status = EFI_NOT_STARTED; -+ int rc = 0; -+ -+ switch ( op->function ) -+ { -+ case XEN_EFI_get_time: -+ { -+ EFI_TIME_CAPABILITIES caps; -+ -+ if ( op->misc ) -+ return -EINVAL; -+ -+ cr3 = efi_rs_enter(); -+ status = efi_rs->GetTime(cast_time(&op->u.get_time.time), &caps); -+ efi_rs_leave(cr3); -+ -+ if ( !EFI_ERROR(status) ) -+ { -+ op->u.get_time.resolution = caps.Resolution; -+ op->u.get_time.accuracy = caps.Accuracy; -+ if ( caps.SetsToZero ) -+ op->misc = XEN_EFI_GET_TIME_SET_CLEARS_NS; -+ } -+ } -+ break; -+ -+ case XEN_EFI_set_time: -+ if ( op->misc ) -+ return -EINVAL; -+ -+ cr3 = efi_rs_enter(); -+ status = efi_rs->SetTime(cast_time(&op->u.set_time)); -+ efi_rs_leave(cr3); -+ break; -+ -+ case XEN_EFI_get_wakeup_time: -+ { -+ BOOLEAN enabled, pending; -+ -+ if ( op->misc ) -+ return -EINVAL; -+ -+ cr3 = efi_rs_enter(); -+ status = efi_rs->GetWakeupTime(&enabled, &pending, -+ cast_time(&op->u.get_wakeup_time)); -+ efi_rs_leave(cr3); -+ -+ if ( !EFI_ERROR(status) ) -+ { -+ if ( enabled ) -+ op->misc |= XEN_EFI_GET_WAKEUP_TIME_ENABLED; -+ if ( pending ) -+ op->misc |= XEN_EFI_GET_WAKEUP_TIME_PENDING; -+ } -+ } -+ break; -+ -+ case XEN_EFI_set_wakeup_time: -+ if ( op->misc & ~(XEN_EFI_SET_WAKEUP_TIME_ENABLE | -+ XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY) ) -+ return -EINVAL; -+ -+ cr3 = efi_rs_enter(); -+ status = efi_rs->SetWakeupTime(!!(op->misc & -+ XEN_EFI_SET_WAKEUP_TIME_ENABLE), -+ (op->misc & -+ XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY) ? -+ NULL : -+ cast_time(&op->u.set_wakeup_time)); -+ efi_rs_leave(cr3); -+ -+ op->misc = 0; -+ break; -+ -+ case XEN_EFI_get_next_high_monotonic_count: -+ if ( op->misc ) -+ return -EINVAL; -+ -+ cr3 = efi_rs_enter(); -+ status = efi_rs->GetNextHighMonotonicCount(&op->misc); -+ efi_rs_leave(cr3); -+ break; -+ -+ case XEN_EFI_get_variable: -+ { -+ CHAR16 *name; -+ long len; -+ unsigned char *data; -+ UINTN size; -+ -+ if ( op->misc ) -+ return -EINVAL; -+ -+ len = gwstrlen(guest_handle_cast(op->u.get_variable.name, CHAR16)); -+ if ( len < 0 ) -+ return len; -+ name = xmalloc_array(CHAR16, ++len); -+ if ( !name ) -+ return -ENOMEM; -+ __copy_from_guest(name, op->u.get_variable.name, len); -+ -+ size = op->u.get_variable.size; -+ if ( size ) -+ { -+ data = xmalloc_bytes(size); -+ if ( !data ) -+ { -+ xfree(name); -+ return -ENOMEM; -+ } -+ } -+ else -+ data = NULL; -+ -+ cr3 = efi_rs_enter(); -+ status = efi_rs->GetVariable( -+ name, cast_guid(&op->u.get_variable.vendor_guid), -+ &op->misc, &size, data); -+ efi_rs_leave(cr3); -+ -+ if ( !EFI_ERROR(status) && -+ copy_to_guest(op->u.get_variable.data, data, size) ) -+ rc = -EFAULT; -+ op->u.get_variable.size = size; -+ -+ xfree(data); -+ xfree(name); -+ } -+ break; -+ -+ case XEN_EFI_set_variable: -+ { -+ CHAR16 *name; -+ long len; -+ unsigned char *data; -+ -+ if ( op->misc ) -+ return -EINVAL; -+ -+ len = gwstrlen(guest_handle_cast(op->u.set_variable.name, CHAR16)); -+ if ( len < 0 ) -+ return len; -+ name = xmalloc_array(CHAR16, ++len); -+ if ( !name ) -+ return -ENOMEM; -+ __copy_from_guest(name, op->u.set_variable.name, len); -+ -+ data = xmalloc_bytes(op->u.set_variable.size); -+ if ( !data ) -+ rc = -ENOMEM; -+ else if ( copy_from_guest(data, op->u.set_variable.data, -+ op->u.set_variable.size) ) -+ rc = -EFAULT; -+ else -+ { -+ cr3 = efi_rs_enter(); -+ status = efi_rs->SetVariable( -+ name, cast_guid(&op->u.set_variable.vendor_guid), -+ op->misc, op->u.set_variable.size, data); -+ efi_rs_leave(cr3); -+ } -+ -+ xfree(data); -+ xfree(name); -+ } -+ break; -+ -+ case XEN_EFI_get_next_variable_name: -+ { -+ union { -+ CHAR16 *str; -+ unsigned char *raw; -+ } name; -+ UINTN size; -+ -+ if ( op->misc ) -+ return -EINVAL; -+ -+ size = op->u.get_next_variable_name.size; -+ name.raw = xmalloc_bytes(size); -+ if ( !name.raw ) -+ return -ENOMEM; -+ copy_from_guest(name.raw, op->u.get_next_variable_name.name, size); -+ -+ cr3 = efi_rs_enter(); -+ status = efi_rs->GetNextVariableName( -+ &size, name.str, -+ cast_guid(&op->u.get_next_variable_name.vendor_guid)); -+ efi_rs_leave(cr3); -+ -+ if ( !EFI_ERROR(status) && -+ copy_to_guest(op->u.get_next_variable_name.name, name.raw, size) ) -+ rc = -EFAULT; -+ op->u.get_next_variable_name.size = size; -+ -+ xfree(name.raw); -+ } -+ break; -+ -+ default: -+ return -ENOSYS; -+ } -+ -+#ifndef COMPAT -+ op->status = status; -+#else -+ op->status = (status & 0x3fffffff) | (status >> 62); -+#endif -+ -+ return rc; -+} -Index: xen-4.1.2-testing/xen/arch/x86/efi/stub.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/stub.c -+++ xen-4.1.2-testing/xen/arch/x86/efi/stub.c -@@ -1,6 +1,7 @@ - #include - #include - #include -+#include - - #ifndef efi_enabled - const bool_t efi_enabled = 0; -@@ -8,6 +9,15 @@ const bool_t efi_enabled = 0; - - void __init efi_init_memory(void) { } - -+unsigned long efi_get_time(void) -+{ -+ BUG(); -+ return 0; -+} -+ -+void efi_halt_system(void) { } -+void efi_reset_system(bool_t warm) { } -+ - int efi_get_info(uint32_t idx, union xenpf_efi_info *info) - { - return -ENOSYS; -@@ -15,3 +25,11 @@ int efi_get_info(uint32_t idx, union xen - - int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *) - __attribute__((__alias__("efi_get_info"))); -+ -+int efi_runtime_call(struct xenpf_efi_runtime_call *op) -+{ -+ return -ENOSYS; -+} -+ -+int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *) -+ __attribute__((__alias__("efi_runtime_call"))); -Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/platform_hypercall.c -+++ xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c -@@ -309,6 +309,17 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe - } - break; - -+ case XENPF_efi_runtime_call: -+ ret = xsm_efi_runtime_call(); -+ if ( ret ) -+ break; -+ -+ ret = efi_runtime_call(&op->u.efi_runtime_call); -+ if ( ret == 0 && -+ copy_field_to_guest(u_xenpf_op, op, u.efi_runtime_call) ) -+ ret = -EFAULT; -+ break; -+ - case XENPF_enter_acpi_sleep: - ret = xsm_acpi_sleep(); - if ( ret ) -Index: xen-4.1.2-testing/xen/arch/x86/shutdown.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/shutdown.c -+++ xen-4.1.2-testing/xen/arch/x86/shutdown.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -337,6 +338,8 @@ void machine_restart(unsigned int delay_ - if ( tboot_in_measured_env() ) - tboot_shutdown(TB_SHUTDOWN_REBOOT); - -+ efi_reset_system(reboot_mode != 0); -+ - /* Rebooting needs to touch the page at absolute address 0. */ - *((unsigned short *)__va(0x472)) = reboot_mode; - -Index: xen-4.1.2-testing/xen/arch/x86/time.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/time.c -+++ xen-4.1.2-testing/xen/arch/x86/time.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -756,6 +757,13 @@ static unsigned long get_cmos_time(void) - unsigned long res, flags; - int i; - -+ if ( efi_enabled ) -+ { -+ res = efi_get_time(); -+ if ( res ) -+ return res; -+ } -+ - spin_lock_irqsave(&rtc_lock, flags); - - /* read RTC exactly on falling edge of update flag */ -Index: xen-4.1.2-testing/xen/arch/x86/x86_64/platform_hypercall.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/platform_hypercall.c -+++ xen-4.1.2-testing/xen/arch/x86/x86_64/platform_hypercall.c -@@ -12,6 +12,7 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_ - #define do_platform_op(x) compat_platform_op(_##x) - - #define efi_get_info efi_compat_get_info -+#define efi_runtime_call(x) efi_compat_runtime_call(x) - - #define xen_processor_px compat_processor_px - #define xen_processor_px_t compat_processor_px_t -Index: xen-4.1.2-testing/xen/include/public/platform.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/public/platform.h -+++ xen-4.1.2-testing/xen/include/public/platform.h -@@ -114,6 +114,77 @@ struct xenpf_platform_quirk { - typedef struct xenpf_platform_quirk xenpf_platform_quirk_t; - DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t); - -+#define XENPF_efi_runtime_call 49 -+#define XEN_EFI_get_time 1 -+#define XEN_EFI_set_time 2 -+#define XEN_EFI_get_wakeup_time 3 -+#define XEN_EFI_set_wakeup_time 4 -+#define XEN_EFI_get_next_high_monotonic_count 5 -+#define XEN_EFI_get_variable 6 -+#define XEN_EFI_set_variable 7 -+#define XEN_EFI_get_next_variable_name 8 -+struct xenpf_efi_runtime_call { -+ uint32_t function; -+ /* -+ * This field is generally used for per sub-function flags (defined -+ * below), except for the XEN_EFI_get_next_high_monotonic_count case, -+ * where it holds the single returned value. -+ */ -+ uint32_t misc; -+ unsigned long status; -+ union { -+#define XEN_EFI_GET_TIME_SET_CLEARS_NS 0x00000001 -+ struct { -+ struct xenpf_efi_time { -+ uint16_t year; -+ uint8_t month; -+ uint8_t day; -+ uint8_t hour; -+ uint8_t min; -+ uint8_t sec; -+ uint32_t ns; -+ int16_t tz; -+ uint8_t daylight; -+ } time; -+ uint32_t resolution; -+ uint32_t accuracy; -+ } get_time; -+ -+ struct xenpf_efi_time set_time; -+ -+#define XEN_EFI_GET_WAKEUP_TIME_ENABLED 0x00000001 -+#define XEN_EFI_GET_WAKEUP_TIME_PENDING 0x00000002 -+ struct xenpf_efi_time get_wakeup_time; -+ -+#define XEN_EFI_SET_WAKEUP_TIME_ENABLE 0x00000001 -+#define XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY 0x00000002 -+ struct xenpf_efi_time set_wakeup_time; -+ -+#define XEN_EFI_VARIABLE_NON_VOLATILE 0x00000001 -+#define XEN_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 -+#define XEN_EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 -+ struct { -+ XEN_GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */ -+ unsigned long size; -+ XEN_GUEST_HANDLE(void) data; -+ struct xenpf_efi_guid { -+ uint32_t data1; -+ uint16_t data2; -+ uint16_t data3; -+ uint8_t data4[8]; -+ } vendor_guid; -+ } get_variable, set_variable; -+ -+ struct { -+ unsigned long size; -+ XEN_GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */ -+ struct xenpf_efi_guid vendor_guid; -+ } get_next_variable_name; -+ } u; -+}; -+typedef struct xenpf_efi_runtime_call xenpf_efi_runtime_call_t; -+DEFINE_XEN_GUEST_HANDLE(xenpf_efi_runtime_call_t); -+ - #define XENPF_firmware_info 50 - #define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ - #define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ -@@ -388,6 +459,7 @@ struct xen_platform_op { - struct xenpf_read_memtype read_memtype; - struct xenpf_microcode_update microcode; - struct xenpf_platform_quirk platform_quirk; -+ struct xenpf_efi_runtime_call efi_runtime_call; - struct xenpf_firmware_info firmware_info; - struct xenpf_enter_acpi_sleep enter_acpi_sleep; - struct xenpf_change_freq change_freq; -Index: xen-4.1.2-testing/xen/include/xen/efi.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/xen/efi.h -+++ xen-4.1.2-testing/xen/include/xen/efi.h -@@ -29,10 +29,18 @@ extern struct efi efi; - union xenpf_efi_info; - union compat_pf_efi_info; - -+struct xenpf_efi_runtime_call; -+struct compat_pf_efi_runtime_call; -+ - void efi_init_memory(void); -+unsigned long efi_get_time(void); -+void efi_halt_system(void); -+void efi_reset_system(bool_t warm); - #ifndef COMPAT - int efi_get_info(uint32_t idx, union xenpf_efi_info *); -+int efi_runtime_call(struct xenpf_efi_runtime_call *); - #endif - int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *); -+int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *); - - #endif /* __XEN_EFI_H__ */ -Index: xen-4.1.2-testing/xen/include/xsm/xsm.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/xsm/xsm.h -+++ xen-4.1.2-testing/xen/include/xsm/xsm.h -@@ -131,6 +131,7 @@ struct xsm_operations { - int (*physinfo) (void); - int (*platform_quirk) (uint32_t); - int (*firmware_info) (void); -+ int (*efi_runtime_call) (void); - int (*acpi_sleep) (void); - int (*change_freq) (void); - int (*getidletime) (void); -@@ -546,6 +547,11 @@ static inline int xsm_firmware_info (voi - return xsm_call(firmware_info()); - } - -+static inline int xsm_efi_runtime_call (void) -+{ -+ return xsm_call(efi_runtime_call()); -+} -+ - static inline int xsm_acpi_sleep (void) - { - return xsm_call(acpi_sleep()); diff --git a/23616-x86_64-EFI-MPS.patch b/23616-x86_64-EFI-MPS.patch deleted file mode 100644 index 7c61f49..0000000 --- a/23616-x86_64-EFI-MPS.patch +++ /dev/null @@ -1,158 +0,0 @@ -References: fate#311376, fate#311529, bnc#578927, bnc#628554 - -# HG changeset patch -# User Jan Beulich -# Date 1309249288 -3600 -# Node ID dffcd8b4c197b58d2acb914d0e07a100e340f7ae -# Parent d19e778442673050bba8ea8cf61585902ff81162 -x86-64: EFI MPS support - -It's not clear this is needed - Linux doesn't use the MPS table even -if available, and no system having one was seen so far. - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Keir Fraser -# Date 1309268736 -3600 -# Node ID d22b64ccf088db8bfce1d6c4830f08e3e834ec84 -# Parent 6d404796a8e587eb648a66f2859991d385b65eb6 -x86_32: Fix build after EFI MPS patch. - -Signed-off-by: Keir Fraser - -Index: xen-4.1.2-testing/xen/arch/x86/efi/boot.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/boot.c -+++ xen-4.1.2-testing/xen/arch/x86/efi/boot.c -@@ -897,12 +897,15 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - { - static EFI_GUID __initdata acpi2_guid = ACPI_20_TABLE_GUID; - static EFI_GUID __initdata acpi_guid = ACPI_TABLE_GUID; -+ static EFI_GUID __initdata mps_guid = MPS_TABLE_GUID; - static EFI_GUID __initdata smbios_guid = SMBIOS_TABLE_GUID; - - if ( match_guid(&acpi2_guid, &efi_ct[i].VendorGuid) ) - efi.acpi20 = (long)efi_ct[i].VendorTable; - if ( match_guid(&acpi_guid, &efi_ct[i].VendorGuid) ) - efi.acpi = (long)efi_ct[i].VendorTable; -+ if ( match_guid(&mps_guid, &efi_ct[i].VendorGuid) ) -+ efi.mps = (long)efi_ct[i].VendorTable; - if ( match_guid(&smbios_guid, &efi_ct[i].VendorGuid) ) - efi.smbios = (long)efi_ct[i].VendorTable; - } -Index: xen-4.1.2-testing/xen/arch/x86/efi/runtime.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/runtime.c -+++ xen-4.1.2-testing/xen/arch/x86/efi/runtime.c -@@ -29,6 +29,7 @@ void *__read_mostly efi_memmap; - struct efi __read_mostly efi = { - .acpi = EFI_INVALID_TABLE_ADDR, - .acpi20 = EFI_INVALID_TABLE_ADDR, -+ .mps = EFI_INVALID_TABLE_ADDR, - .smbios = EFI_INVALID_TABLE_ADDR, - }; - -Index: xen-4.1.2-testing/xen/arch/x86/mpparse.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/mpparse.c -+++ xen-4.1.2-testing/xen/arch/x86/mpparse.c -@@ -19,6 +19,8 @@ - #include - #include - #include -+#include -+#include - #include - - #include -@@ -655,6 +657,14 @@ static inline void __init construct_defa - } - } - -+#define FIX_EFI_MPF FIX_KEXEC_BASE_0 -+ -+static __init void efi_unmap_mpf(void) -+{ -+ if (efi_enabled) -+ __set_fixmap(FIX_EFI_MPF, 0, 0); -+} -+ - static struct intel_mp_floating *mpf_found; - - /* -@@ -669,6 +679,7 @@ void __init get_smp_config (void) - * processors, where MPS only supports physical. - */ - if (acpi_lapic && acpi_ioapic) { -+ efi_unmap_mpf(); - printk(KERN_INFO "Using ACPI (MADT) for SMP configuration information\n"); - return; - } -@@ -699,6 +710,7 @@ void __init get_smp_config (void) - * override the defaults. - */ - if (!smp_read_mpc((void *)(unsigned long)mpf->mpf_physptr)) { -+ efi_unmap_mpf(); - smp_found_config = 0; - printk(KERN_ERR "BIOS bug, MP table errors detected!...\n"); - printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n"); -@@ -725,6 +737,8 @@ void __init get_smp_config (void) - } else - BUG(); - -+ efi_unmap_mpf(); -+ - printk(KERN_INFO "Processors: %d\n", num_processors); - /* - * Only use the first configuration found. -@@ -779,10 +793,37 @@ static int __init smp_scan_config (unsig - return 0; - } - -+static void __init efi_check_config(void) -+{ -+ struct intel_mp_floating *mpf; -+ -+ if (efi.mps == EFI_INVALID_TABLE_ADDR) -+ return; -+ -+ __set_fixmap(FIX_EFI_MPF, PFN_DOWN(efi.mps), __PAGE_HYPERVISOR); -+ mpf = (void *)fix_to_virt(FIX_EFI_MPF) + ((long)efi.mps & (PAGE_SIZE-1)); -+ -+ if (memcmp(mpf->mpf_signature, "_MP_", 4) == 0 && -+ mpf->mpf_length == 1 && -+ mpf_checksum((void *)mpf, 16) && -+ (mpf->mpf_specification == 1 || mpf->mpf_specification == 4)) { -+ smp_found_config = 1; -+ printk(KERN_INFO "SMP MP-table at %08lx\n", efi.mps); -+ mpf_found = mpf; -+ } -+ else -+ efi_unmap_mpf(); -+} -+ - void __init find_smp_config (void) - { - unsigned int address; - -+ if (efi_enabled) { -+ efi_check_config(); -+ return; -+ } -+ - /* - * FIXME: Linux assumes you have 640K of base ram.. - * this continues the error... -Index: xen-4.1.2-testing/xen/include/xen/efi.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/xen/efi.h -+++ xen-4.1.2-testing/xen/include/xen/efi.h -@@ -17,6 +17,7 @@ extern const bool_t efi_enabled; - - /* Add fields here only if they need to be referenced from non-EFI code. */ - struct efi { -+ unsigned long mps; /* MPS table */ - unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ - unsigned long acpi20; /* ACPI table (ACPI 2.0) */ - unsigned long smbios; /* SM BIOS table */ diff --git a/23643-xentrace_Allow_tracing_to_be_enabled_at_boot.patch b/23643-xentrace_Allow_tracing_to_be_enabled_at_boot.patch deleted file mode 100644 index 4368bc2..0000000 --- a/23643-xentrace_Allow_tracing_to_be_enabled_at_boot.patch +++ /dev/null @@ -1,58 +0,0 @@ -changeset: 23643:335e96664589 -user: George Dunlap -date: Fri Jul 01 20:31:18 2011 +0100 -files: xen/common/trace.c -description: -xentrace: Allow tracing to be enabled at boot - -Add a "tevt_mask" parameter to the xen command-line, allowing -trace records to be gathered early in boot. They will be placed -into the trace buffers, and read when the user runs "xentrace". - -Signed-off-by: George Dunlap - - ---- - xen/common/trace.c | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -45,7 +45,9 @@ CHECK_t_buf; - - /* opt_tbuf_size: trace buffer size (in pages) for each cpu */ - static unsigned int opt_tbuf_size; -+static unsigned int opt_tevt_mask; - integer_param("tbuf_size", opt_tbuf_size); -+integer_param("tevt_mask", opt_tevt_mask); - - /* Pointers to the meta-data objects for all system trace buffers */ - static struct t_info *t_info; -@@ -338,11 +340,21 @@ void __init init_trace_bufs(void) - { - register_cpu_notifier(&cpu_nfb); - -- if ( opt_tbuf_size && alloc_trace_bufs(opt_tbuf_size) ) -+ if ( opt_tbuf_size ) - { -- printk(XENLOG_INFO "xentrace: allocation size %d failed, disabling\n", -- opt_tbuf_size); -- opt_tbuf_size = 0; -+ if ( alloc_trace_bufs(opt_tbuf_size) ) -+ { -+ printk("xentrace: allocation size %d failed, disabling\n", -+ opt_tbuf_size); -+ opt_tbuf_size = 0; -+ } -+ else if ( opt_tevt_mask ) -+ { -+ printk("xentrace: Starting tracing, enabling mask %x\n", -+ opt_tevt_mask); -+ tb_event_mask = opt_tevt_mask; -+ tb_init_done=1; -+ } - } - } - diff --git a/23676-x86_64-image-map-bounds.patch b/23676-x86_64-image-map-bounds.patch deleted file mode 100644 index 12c3114..0000000 --- a/23676-x86_64-image-map-bounds.patch +++ /dev/null @@ -1,65 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1310631973 -3600 -# Node ID 80c9db90bba96e443a22d268c06948fdef9c6a75 -# Parent 88823213a4780ebced6d7adcb1ffd2dda6a339ca -x86-64: properly handle alias mappings beyond _end - -Changeset 19632:b0966b6f5180 wasn't really complete: The Xen image -mapping doesn't end at _end, but a full 16Mb gets mapped during boot -(and never got unmapped so far), hence all of this space was subject -to alias mappings when it comes to cache attribute changes. Unmap all -full large pages between _end and the 16Mb boundary, and include all -other pages beyond _end when checking for aliases. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -779,7 +779,7 @@ static int update_xen_mappings(unsigned - int err = 0; - #ifdef __x86_64__ - bool_t alias = mfn >= PFN_DOWN(xen_phys_start) && -- mfn < PFN_UP(xen_phys_start + (unsigned long)_end - XEN_VIRT_START); -+ mfn < PFN_UP(xen_phys_start + xen_virt_end - XEN_VIRT_START); - unsigned long xen_va = - XEN_VIRT_START + ((mfn - PFN_DOWN(xen_phys_start)) << PAGE_SHIFT); - -Index: xen-4.1.3-testing/xen/arch/x86/setup.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/setup.c -+++ xen-4.1.3-testing/xen/arch/x86/setup.c -@@ -97,6 +97,8 @@ unsigned long __read_mostly xen_phys_sta - /* Limits of Xen heap, used to initialise the allocator. */ - unsigned long __initdata xenheap_initial_phys_start; - unsigned long __read_mostly xenheap_phys_end; -+#else -+unsigned long __read_mostly xen_virt_end; - #endif - - DEFINE_PER_CPU(struct tss_struct, init_tss); -@@ -1096,6 +1098,9 @@ void __init __start_xen(unsigned long mb - map_pages_to_xen((unsigned long)__va(kexec_crash_area.start), - kexec_crash_area.start >> PAGE_SHIFT, - PFN_UP(kexec_crash_area.size), PAGE_HYPERVISOR); -+ xen_virt_end = ((unsigned long)_end + (1UL << L2_PAGETABLE_SHIFT) - 1) & -+ ~((1UL << L2_PAGETABLE_SHIFT) - 1); -+ destroy_xen_mappings(xen_virt_end, XEN_VIRT_START + BOOTSTRAP_MAP_BASE); - #endif - - memguard_init(); -Index: xen-4.1.3-testing/xen/include/asm-x86/x86_64/page.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/x86_64/page.h -+++ xen-4.1.3-testing/xen/include/asm-x86/x86_64/page.h -@@ -34,6 +34,8 @@ - #include - #include - -+extern unsigned long xen_virt_end; -+ - extern unsigned long max_pdx; - extern unsigned long pfn_pdx_bottom_mask, ma_va_bottom_mask; - extern unsigned int pfn_pdx_hole_shift; diff --git a/23697-pygrub-grub2.patch b/23697-pygrub-grub2.patch deleted file mode 100644 index d40c9ac..0000000 --- a/23697-pygrub-grub2.patch +++ /dev/null @@ -1,39 +0,0 @@ -# HG changeset patch -# User Ian Campbell -# Date 1310749975 -3600 -# Node ID 5e1032229546c2d5640dc05205303d91d78a92c3 -# Parent c1d7fa123dae73708da7306c0ec611d6fa6a6140 -pygrub: prefer Grub2 to Grub1 - -If a VM image has grub2 installed it is likely the one we need to be using. - -Signed-off-by: Ian Campbell -Acked-by: Ian Jackson -Committed-by: Ian Jackson - -Index: xen-4.1.3-testing/tools/pygrub/src/pygrub -=================================================================== ---- xen-4.1.3-testing.orig/tools/pygrub/src/pygrub -+++ xen-4.1.3-testing/tools/pygrub/src/pygrub -@@ -394,15 +394,14 @@ class Grub: - # fallbacks - ["/efi/boot/elilo.conf", "/elilo.conf",]) - else: -- cfg_list = map(lambda x: (x,grub.GrubConf.GrubConfigFile), -- ["/boot/grub/menu.lst", "/boot/grub/grub.conf", -- "/grub/menu.lst", "/grub/grub.conf"]) + \ -- map(lambda x: (x,grub.GrubConf.Grub2ConfigFile), -- ["/boot/grub/grub.cfg", "/grub/grub.cfg", -- "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]) + \ -+ cfg_list = map(lambda x: (x,grub.GrubConf.Grub2ConfigFile), -+ ["/boot/grub/grub.cfg", "/grub/grub.cfg"]) + \ - map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile), - ["/boot/isolinux/isolinux.cfg", -- "/boot/extlinux.conf"]) -+ "/boot/extlinux.conf"]) + \ -+ map(lambda x: (x,grub.GrubConf.GrubConfigFile), -+ ["/boot/grub/menu.lst", "/boot/grub/grub.conf", -+ "/grub/menu.lst", "/grub/grub.conf"]) - - if not fs: - # set the config file and parse it diff --git a/23719-xentrace_update___trace_var_comment.patch b/23719-xentrace_update___trace_var_comment.patch deleted file mode 100644 index 93d8d34..0000000 --- a/23719-xentrace_update___trace_var_comment.patch +++ /dev/null @@ -1,37 +0,0 @@ -changeset: 23719:c2888876abd3 -user: Olaf Hering -date: Tue Jul 19 08:22:19 2011 +0100 -files: xen/common/trace.c -description: -xentrace: update __trace_var comment - -Signed-off-by: Olaf Hering - - ---- - xen/common/trace.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -Index: xen-4.1.2-testing/xen/common/trace.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/trace.c -+++ xen-4.1.2-testing/xen/common/trace.c -@@ -657,13 +657,13 @@ static DECLARE_SOFTIRQ_TASKLET(trace_not - trace_notify_dom0, 0); - - /** -- * trace - Enters a trace tuple into the trace buffer for the current CPU. -+ * __trace_var - Enters a trace tuple into the trace buffer for the current CPU. - * @event: the event type being logged -- * @d1...d5: the data items for the event being logged -+ * @cycles: include tsc timestamp into trace record -+ * @extra: size of additional trace data in bytes -+ * @extra_data: pointer to additional trace data - * -- * Logs a trace record into the appropriate buffer. Returns nonzero on -- * failure, otherwise 0. Failure occurs only if the trace buffers are not yet -- * initialised. -+ * Logs a trace record into the appropriate buffer. - */ - void __trace_var(u32 event, bool_t cycles, unsigned int extra, - const void *extra_data) diff --git a/23723-x86-CMOS-lock.patch b/23723-x86-CMOS-lock.patch deleted file mode 100644 index 232410a..0000000 --- a/23723-x86-CMOS-lock.patch +++ /dev/null @@ -1,283 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1311081053 -3600 -# Node ID 18653a163b1e8e10b4353272bcb9e8302bfd2e19 -# Parent 7bc5825e471db5a3a989f47d21334ef63a6b5610 -x86: consistently serialize CMOS/RTC accesses on rtc_lock - -Since RTC/CMOS accesses aren't atomic, there are possible races -between code paths setting the index register and subsequently -reading/writing the data register. This is supposed to be dealt with -by acquiring rtc_lock, but two places up to now lacked respective -synchronization: Accesses to the EFI time functions and -smpboot_{setup,restore}_warm_reset_vector(). - -This in turn requires no longer directly passing through guest writes -to the index register, but instead using a machanism similar to that -for PCI config space method 1 accesses. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/efi/runtime.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/efi/runtime.c -+++ xen-4.1.3-testing/xen/arch/x86/efi/runtime.c -@@ -3,6 +3,7 @@ - #include - #include - #include -+#include - - DEFINE_XEN_GUEST_HANDLE(CHAR16); - -@@ -80,9 +81,11 @@ unsigned long efi_get_time(void) - { - EFI_TIME time; - EFI_STATUS status; -- unsigned long cr3 = efi_rs_enter(); -+ unsigned long cr3 = efi_rs_enter(), flags; - -+ spin_lock_irqsave(&rtc_lock, flags); - status = efi_rs->GetTime(&time, NULL); -+ spin_unlock_irqrestore(&rtc_lock, flags); - efi_rs_leave(cr3); - - if ( EFI_ERROR(status) ) -@@ -223,7 +226,7 @@ static inline EFI_GUID *cast_guid(struct - - int efi_runtime_call(struct xenpf_efi_runtime_call *op) - { -- unsigned long cr3; -+ unsigned long cr3, flags; - EFI_STATUS status = EFI_NOT_STARTED; - int rc = 0; - -@@ -237,7 +240,9 @@ int efi_runtime_call(struct xenpf_efi_ru - return -EINVAL; - - cr3 = efi_rs_enter(); -+ spin_lock_irqsave(&rtc_lock, flags); - status = efi_rs->GetTime(cast_time(&op->u.get_time.time), &caps); -+ spin_unlock_irqrestore(&rtc_lock, flags); - efi_rs_leave(cr3); - - if ( !EFI_ERROR(status) ) -@@ -255,7 +260,9 @@ int efi_runtime_call(struct xenpf_efi_ru - return -EINVAL; - - cr3 = efi_rs_enter(); -+ spin_lock_irqsave(&rtc_lock, flags); - status = efi_rs->SetTime(cast_time(&op->u.set_time)); -+ spin_unlock_irqrestore(&rtc_lock, flags); - efi_rs_leave(cr3); - break; - -@@ -267,8 +274,10 @@ int efi_runtime_call(struct xenpf_efi_ru - return -EINVAL; - - cr3 = efi_rs_enter(); -+ spin_lock_irqsave(&rtc_lock, flags); - status = efi_rs->GetWakeupTime(&enabled, &pending, - cast_time(&op->u.get_wakeup_time)); -+ spin_unlock_irqrestore(&rtc_lock, flags); - efi_rs_leave(cr3); - - if ( !EFI_ERROR(status) ) -@@ -287,12 +296,14 @@ int efi_runtime_call(struct xenpf_efi_ru - return -EINVAL; - - cr3 = efi_rs_enter(); -+ spin_lock_irqsave(&rtc_lock, flags); - status = efi_rs->SetWakeupTime(!!(op->misc & - XEN_EFI_SET_WAKEUP_TIME_ENABLE), - (op->misc & - XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY) ? - NULL : - cast_time(&op->u.set_wakeup_time)); -+ spin_unlock_irqrestore(&rtc_lock, flags); - efi_rs_leave(cr3); - - op->misc = 0; -Index: xen-4.1.3-testing/xen/arch/x86/hpet.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hpet.c -+++ xen-4.1.3-testing/xen/arch/x86/hpet.c -@@ -525,18 +525,10 @@ static void hpet_detach_channel(int cpu, - - #include - --void (*pv_rtc_handler)(unsigned int port, uint8_t value); -+void (*__read_mostly pv_rtc_handler)(uint8_t index, uint8_t value); - --static void handle_rtc_once(unsigned int port, uint8_t value) -+static void handle_rtc_once(uint8_t index, uint8_t value) - { -- static int index; -- -- if ( port == 0x70 ) -- { -- index = value; -- return; -- } -- - if ( index != RTC_REG_B ) - return; - -Index: xen-4.1.3-testing/xen/arch/x86/traps.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/traps.c -+++ xen-4.1.3-testing/xen/arch/x86/traps.c -@@ -67,6 +67,8 @@ - #include - #include - #include -+#include -+#include - #include - - /* -@@ -1656,6 +1658,10 @@ static int admin_io_okay( - if ( (port == 0xcf8) && (bytes == 4) ) - return 0; - -+ /* We also never permit direct access to the RTC/CMOS registers. */ -+ if ( ((port & ~1) == RTC_PORT(0)) ) -+ return 0; -+ - return ioports_access_permitted(v->domain, port, port + bytes - 1); - } - -@@ -1685,6 +1691,21 @@ static uint32_t guest_io_read( - { - sub_data = pv_pit_handler(port, 0, 0); - } -+ else if ( (port == RTC_PORT(0)) ) -+ { -+ sub_data = v->domain->arch.cmos_idx; -+ } -+ else if ( (port == RTC_PORT(1)) && -+ ioports_access_permitted(v->domain, RTC_PORT(0), -+ RTC_PORT(1)) ) -+ { -+ unsigned long flags; -+ -+ spin_lock_irqsave(&rtc_lock, flags); -+ outb(v->domain->arch.cmos_idx & 0x7f, RTC_PORT(0)); -+ sub_data = inb(RTC_PORT(1)); -+ spin_unlock_irqrestore(&rtc_lock, flags); -+ } - else if ( (port == 0xcf8) && (bytes == 4) ) - { - size = 4; -@@ -1710,8 +1731,6 @@ static uint32_t guest_io_read( - return data; - } - --extern void (*pv_rtc_handler)(unsigned int port, uint8_t value); -- - static void guest_io_write( - unsigned int port, unsigned int bytes, uint32_t data, - struct vcpu *v, struct cpu_user_regs *regs) -@@ -1720,8 +1739,6 @@ static void guest_io_write( - { - switch ( bytes ) { - case 1: -- if ( ((port == 0x70) || (port == 0x71)) && pv_rtc_handler ) -- pv_rtc_handler(port, (uint8_t)data); - outb((uint8_t)data, port); - if ( pv_post_outb_hook ) - pv_post_outb_hook(port, (uint8_t)data); -@@ -1744,6 +1761,23 @@ static void guest_io_write( - { - pv_pit_handler(port, (uint8_t)data, 1); - } -+ else if ( (port == RTC_PORT(0)) ) -+ { -+ v->domain->arch.cmos_idx = data; -+ } -+ else if ( (port == RTC_PORT(1)) && -+ ioports_access_permitted(v->domain, RTC_PORT(0), -+ RTC_PORT(1)) ) -+ { -+ unsigned long flags; -+ -+ if ( pv_rtc_handler ) -+ pv_rtc_handler(v->domain->arch.cmos_idx & 0x7f, data); -+ spin_lock_irqsave(&rtc_lock, flags); -+ outb(v->domain->arch.cmos_idx & 0x7f, RTC_PORT(0)); -+ outb(data, RTC_PORT(1)); -+ spin_unlock_irqrestore(&rtc_lock, flags); -+ } - else if ( (port == 0xcf8) && (bytes == 4) ) - { - size = 4; -@@ -2109,10 +2143,6 @@ static int emulate_privileged_op(struct - goto fail; - if ( admin_io_okay(port, op_bytes, v, regs) ) - { -- if ( (op_bytes == 1) && -- ((port == 0x71) || (port == 0x70)) && -- pv_rtc_handler ) -- pv_rtc_handler(port, regs->eax); - io_emul(regs); - if ( (op_bytes == 1) && pv_post_outb_hook ) - pv_post_outb_hook(port, regs->eax); -Index: xen-4.1.3-testing/xen/include/asm-x86/domain.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/domain.h -+++ xen-4.1.3-testing/xen/include/asm-x86/domain.h -@@ -251,6 +251,7 @@ struct arch_domain - /* I/O-port admin-specified access capabilities. */ - struct rangeset *ioport_caps; - uint32_t pci_cf8; -+ uint8_t cmos_idx; - - struct list_head pdev_list; - struct hvm_domain hvm_domain; -Index: xen-4.1.3-testing/xen/include/asm-x86/hpet.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hpet.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hpet.h -@@ -52,6 +52,7 @@ - #define HPET_TN_FSB_CAP 0x8000 - #define HPET_TN_ROUTE_SHIFT 9 - -+extern void (*pv_rtc_handler)(uint8_t reg, uint8_t value); - - #define hpet_read32(x) \ - (*(volatile u32 *)(fix_to_virt(FIX_HPET_BASE) + (x))) -Index: xen-4.1.3-testing/xen/include/asm-x86/mach-default/smpboot_hooks.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/mach-default/smpboot_hooks.h -+++ xen-4.1.3-testing/xen/include/asm-x86/mach-default/smpboot_hooks.h -@@ -3,7 +3,11 @@ - - static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) - { -+ unsigned long flags; -+ -+ spin_lock_irqsave(&rtc_lock, flags); - CMOS_WRITE(0xa, 0xf); -+ spin_unlock_irqrestore(&rtc_lock, flags); - flush_tlb_local(); - Dprintk("1.\n"); - *((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4; -@@ -14,6 +18,8 @@ static inline void smpboot_setup_warm_re - - static inline void smpboot_restore_warm_reset_vector(void) - { -+ unsigned long flags; -+ - /* - * Install writable page 0 entry to set BIOS data area. - */ -@@ -23,7 +29,9 @@ static inline void smpboot_restore_warm_ - * Paranoid: Set warm reset code and vector here back - * to default values. - */ -+ spin_lock_irqsave(&rtc_lock, flags); - CMOS_WRITE(0, 0xf); -+ spin_unlock_irqrestore(&rtc_lock, flags); - - *((volatile int *) maddr_to_virt(0x467)) = 0; - } diff --git a/23735-guest-dom0-cap.patch b/23735-guest-dom0-cap.patch deleted file mode 100644 index 7cd0d13..0000000 --- a/23735-guest-dom0-cap.patch +++ /dev/null @@ -1,252 +0,0 @@ -References: bnc#702407 - -# HG changeset patch -# User Jan Beulich -# Date 1311407355 -3600 -# Node ID 537918f518eec3d8e2e2dad403fce40303321523 -# Parent 42edf1481c5704c8ce1eb171a713b5411df0551a -add privileged (dom0) kernel feature indication - -With our switching away from supporting 32-bit Dom0 operation, users -complained that attempts (perhaps due to lack of knowledge of that -change) to boot the no longer privileged kernel in Dom0 resulted in -apparently silent failure. To make the mismatch explicit and visible, -add dom0 feature flag that the kernel can set to indicate operation as -dom0 is supported. - -Due to the way elf_xen_parse_features() worked up to now (getting -fixed here), adding features indications to the old, string based ELF -note would make the respective kernel unusable on older hypervisors. -For that reason, a new ELF Note is being introduced that allows -specifying supported features as a bit array instead (with features -unknown to the hypervisor simply ignored, as now also done by -elf_xen_parse_features(), whereas here unknown kernel-required -features still keep the kernel [and hence VM] from booting). - -Introduce and use elf_note_numeric_array() to be forward -compatible (or else an old hypervisor wouldn't be able to parse kernel -specified features occupying more than 64 bits - thanks, Ian!). - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1311598088 -3600 -# Node ID 50ddc200a60cad3929a79a992f09145fd39af49d -# Parent d8725d9fb8657874011d2f2772f5e970b24dfe9b -fix regression from c/s 23735:537918f518ee - -This was checking presence of the wrong (old) ELF note. I don't really -understand how this failed consistently only for one of the xen-boot -tests... - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/tools/libxc/xc_dom_elfloader.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_dom_elfloader.c -+++ xen-4.1.3-testing/tools/libxc/xc_dom_elfloader.c -@@ -286,6 +286,13 @@ static int xc_dom_parse_elf_kernel(struc - if ( (rc = elf_xen_parse(elf, &dom->parms)) != 0 ) - return rc; - -+ if ( elf_xen_feature_get(XENFEAT_dom0, dom->parms.f_required) ) -+ { -+ xc_dom_panic(dom->xch, XC_INVALID_KERNEL, "%s: Kernel does not" -+ " support unprivileged (DomU) operation", __FUNCTION__); -+ return -EINVAL; -+ } -+ - /* find kernel segment */ - dom->kernel_seg.vstart = dom->parms.virt_kstart; - dom->kernel_seg.vend = dom->parms.virt_kend; -Index: xen-4.1.3-testing/xen/arch/ia64/xen/domain.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/ia64/xen/domain.c -+++ xen-4.1.3-testing/xen/arch/ia64/xen/domain.c -@@ -2165,6 +2165,13 @@ int __init construct_dom0(struct domain - return -1; - } - -+ if (parms.elf_notes[XEN_ELFNOTE_SUPPORTED_FEATURES].type != XEN_ENT_NONE && -+ !test_bit(XENFEAT_dom0, parms.f_supported)) -+ { -+ printk("Kernel does not support Dom0 operation\n"); -+ return -1; -+ } -+ - p_start = parms.virt_base; - pkern_start = parms.virt_kstart; - pkern_end = parms.virt_kend; -Index: xen-4.1.3-testing/xen/arch/x86/domain_build.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/domain_build.c -+++ xen-4.1.3-testing/xen/arch/x86/domain_build.c -@@ -417,6 +417,13 @@ int __init construct_dom0( - return -EINVAL; - } - -+ if ( parms.elf_notes[XEN_ELFNOTE_SUPPORTED_FEATURES].type != XEN_ENT_NONE && -+ !test_bit(XENFEAT_dom0, parms.f_supported) ) -+ { -+ printk("Kernel does not support Dom0 operation\n"); -+ return -EINVAL; -+ } -+ - #if defined(__x86_64__) - if ( compat32 ) - { -Index: xen-4.1.3-testing/xen/common/kernel.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/kernel.c -+++ xen-4.1.3-testing/xen/common/kernel.c -@@ -289,6 +289,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL - (1U << XENFEAT_auto_translated_physmap); - if ( supervisor_mode_kernel ) - fi.submap |= 1U << XENFEAT_supervisor_mode_kernel; -+ if ( current->domain == dom0 ) -+ fi.submap |= 1U << XENFEAT_dom0; - #ifdef CONFIG_X86 - if ( !is_hvm_vcpu(current) ) - fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) | -Index: xen-4.1.3-testing/xen/common/libelf/libelf-dominfo.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/libelf/libelf-dominfo.c -+++ xen-4.1.3-testing/xen/common/libelf/libelf-dominfo.c -@@ -26,7 +26,8 @@ static const char *const elf_xen_feature - [XENFEAT_writable_descriptor_tables] = "writable_descriptor_tables", - [XENFEAT_auto_translated_physmap] = "auto_translated_physmap", - [XENFEAT_supervisor_mode_kernel] = "supervisor_mode_kernel", -- [XENFEAT_pae_pgdir_above_4gb] = "pae_pgdir_above_4gb" -+ [XENFEAT_pae_pgdir_above_4gb] = "pae_pgdir_above_4gb", -+ [XENFEAT_dom0] = "dom0" - }; - static const int elf_xen_features = - sizeof(elf_xen_feature_names) / sizeof(elf_xen_feature_names[0]); -@@ -82,7 +83,7 @@ int elf_xen_parse_features(const char *f - } - } - } -- if ( i == elf_xen_features ) -+ if ( i == elf_xen_features && required && feature[0] == '!' ) - return -1; - } - -@@ -113,6 +114,7 @@ int elf_xen_parse_note(struct elf_binary - [XEN_ELFNOTE_LOADER] = { "LOADER", 1}, - [XEN_ELFNOTE_PAE_MODE] = { "PAE_MODE", 1}, - [XEN_ELFNOTE_FEATURES] = { "FEATURES", 1}, -+ [XEN_ELFNOTE_SUPPORTED_FEATURES] = { "SUPPORTED_FEATURES", 0}, - [XEN_ELFNOTE_BSD_SYMTAB] = { "BSD_SYMTAB", 1}, - [XEN_ELFNOTE_SUSPEND_CANCEL] = { "SUSPEND_CANCEL", 0 }, - [XEN_ELFNOTE_MOD_START_PFN] = { "MOD_START_PFN", 0 }, -@@ -121,6 +123,7 @@ int elf_xen_parse_note(struct elf_binary - - const char *str = NULL; - uint64_t val = 0; -+ unsigned int i; - int type = elf_uval(elf, note, type); - - if ( (type >= sizeof(note_desc) / sizeof(note_desc[0])) || -@@ -199,6 +202,12 @@ int elf_xen_parse_note(struct elf_binary - return -1; - break; - -+ case XEN_ELFNOTE_SUPPORTED_FEATURES: -+ for ( i = 0; i < XENFEAT_NR_SUBMAPS; ++i ) -+ parms->f_supported[i] |= elf_note_numeric_array( -+ elf, note, sizeof(*parms->f_supported), i); -+ break; -+ - } - return 0; - } -Index: xen-4.1.3-testing/xen/common/libelf/libelf-tools.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/libelf/libelf-tools.c -+++ xen-4.1.3-testing/xen/common/libelf/libelf-tools.c -@@ -227,6 +227,27 @@ uint64_t elf_note_numeric(struct elf_bin - return 0; - } - } -+ -+uint64_t elf_note_numeric_array(struct elf_binary *elf, const elf_note *note, -+ unsigned int unitsz, unsigned int idx) -+{ -+ const void *desc = elf_note_desc(elf, note); -+ int descsz = elf_uval(elf, note, descsz); -+ -+ if ( descsz % unitsz || idx >= descsz / unitsz ) -+ return 0; -+ switch (unitsz) -+ { -+ case 1: -+ case 2: -+ case 4: -+ case 8: -+ return elf_access_unsigned(elf, desc, idx * unitsz, unitsz); -+ default: -+ return 0; -+ } -+} -+ - const elf_note *elf_note_next(struct elf_binary *elf, const elf_note * note) - { - int namesz = (elf_uval(elf, note, namesz) + 3) & ~3; -Index: xen-4.1.3-testing/xen/include/public/elfnote.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/elfnote.h -+++ xen-4.1.3-testing/xen/include/public/elfnote.h -@@ -179,9 +179,22 @@ - #define XEN_ELFNOTE_MOD_START_PFN 16 - - /* -+ * The features supported by this kernel (numeric). -+ * -+ * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a -+ * kernel to specify support for features that older hypervisors don't -+ * know about. The set of features 4.2 and newer hypervisors will -+ * consider supported by the kernel is the combination of the sets -+ * specified through this and the string note. -+ * -+ * LEGACY: FEATURES -+ */ -+#define XEN_ELFNOTE_SUPPORTED_FEATURES 17 -+ -+/* - * The number of the highest elfnote defined. - */ --#define XEN_ELFNOTE_MAX XEN_ELFNOTE_MOD_START_PFN -+#define XEN_ELFNOTE_MAX XEN_ELFNOTE_SUPPORTED_FEATURES - - /* - * System information exported through crash notes. -Index: xen-4.1.3-testing/xen/include/public/features.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/features.h -+++ xen-4.1.3-testing/xen/include/public/features.h -@@ -75,7 +75,10 @@ - #define XENFEAT_hvm_safe_pvclock 9 - - /* x86: pirq can be used by HVM guests */ --#define XENFEAT_hvm_pirqs 10 -+#define XENFEAT_hvm_pirqs 10 -+ -+/* operation as Dom0 is supported */ -+#define XENFEAT_dom0 11 - - #define XENFEAT_NR_SUBMAPS 1 - -Index: xen-4.1.3-testing/xen/include/xen/libelf.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/libelf.h -+++ xen-4.1.3-testing/xen/include/xen/libelf.h -@@ -179,6 +179,8 @@ const elf_sym *elf_sym_by_index(struct e - const char *elf_note_name(struct elf_binary *elf, const elf_note * note); - const void *elf_note_desc(struct elf_binary *elf, const elf_note * note); - uint64_t elf_note_numeric(struct elf_binary *elf, const elf_note * note); -+uint64_t elf_note_numeric_array(struct elf_binary *, const elf_note *, -+ unsigned int unitsz, unsigned int idx); - const elf_note *elf_note_next(struct elf_binary *elf, const elf_note * note); - - int elf_is_elfbinary(const void *image); diff --git a/23747-mmcfg-base-address.patch b/23747-mmcfg-base-address.patch deleted file mode 100644 index 5e23e5f..0000000 --- a/23747-mmcfg-base-address.patch +++ /dev/null @@ -1,66 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1311608539 -3600 -# Node ID b07b6fa766562c990b1d1e59af032feda15c2edb -# Parent aa54b8175954bd6ffeb3bcf72e782e133896b388 -x86-64/MMCFG: correct base address computation for regions not starting at bus 0 - -As per the specification, the base address reported by ACPI is the one -that would be used if the region started at bus 0. Hence the -start_bus_number offset needs to be added not only to the virtual -address, but also the physical one when establishing the mapping, and -it then needs to be subtracted when obtaining the virtual address for -doing accesses. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig_64.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mmconfig_64.c -+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig_64.c -@@ -25,7 +25,7 @@ struct mmcfg_virt { - static struct mmcfg_virt *pci_mmcfg_virt; - static int __initdata mmcfg_pci_segment_shift; - --static char __iomem *get_virt(unsigned int seg, unsigned bus) -+static char __iomem *get_virt(unsigned int seg, unsigned int *bus) - { - struct acpi_mcfg_allocation *cfg; - int cfg_num; -@@ -33,9 +33,11 @@ static char __iomem *get_virt(unsigned i - for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) { - cfg = pci_mmcfg_virt[cfg_num].cfg; - if (cfg->pci_segment == seg && -- (cfg->start_bus_number <= bus) && -- (cfg->end_bus_number >= bus)) -+ (cfg->start_bus_number <= *bus) && -+ (cfg->end_bus_number >= *bus)) { -+ *bus -= cfg->start_bus_number; - return pci_mmcfg_virt[cfg_num].virt; -+ } - } - - /* Fall back to type 0 */ -@@ -46,7 +48,7 @@ static char __iomem *pci_dev_base(unsign - { - char __iomem *addr; - -- addr = get_virt(seg, bus); -+ addr = get_virt(seg, &bus); - if (!addr) - return NULL; - return addr + ((bus << 20) | (devfn << 12)); -@@ -121,8 +123,11 @@ static void __iomem * __init mcfg_iorema - if (virt + size < virt || virt + size > PCI_MCFG_VIRT_END) - return NULL; - -- map_pages_to_xen(virt, cfg->address >> PAGE_SHIFT, -- size >> PAGE_SHIFT, PAGE_HYPERVISOR_NOCACHE); -+ if (map_pages_to_xen(virt, -+ (cfg->address >> PAGE_SHIFT) + -+ (cfg->start_bus_number << (20 - PAGE_SHIFT)), -+ size >> PAGE_SHIFT, PAGE_HYPERVISOR_NOCACHE)) -+ return NULL; - - return (void __iomem *) virt; - } diff --git a/23749-mmcfg-reservation.patch b/23749-mmcfg-reservation.patch deleted file mode 100644 index b690d96..0000000 --- a/23749-mmcfg-reservation.patch +++ /dev/null @@ -1,421 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1311608606 -3600 -# Node ID e8d1c8f074babcb0e4511393106e80a918a38204 -# Parent e1717d180897e6e7a04d83a41d86b35ac16912b9 -x86-64/MMCFG: pass down firmware (ACPI) reservation status of used memory space - -Reserving the MMCFG address range(s) in E820 is specified to only be -optional for the firmware to do. The requirement is to have them -reserved in ACPI resources. Those, however, aren't directly visible to -Xen as they require the ACPI interpreter to be active. Thus, if a -range isn't reserved in E820, we should not completely disable use of -MMCFG on the respective bus range, but rather keep it disabled until -Dom0 can pass down information on the ACPI reservation status (though -a new physdevop hypercall). - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1322813126 -3600 -# Node ID 60d4e257d04ba0bd663bbef5e93a97b6d8b66e54 -# Parent 3f815406feb25a9348d8be9bc49fdc8c93ccb7c2 -x86-64/mmcfg: remove __initdata annotation overlooked in 23749:e8d1c8f074ba - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/physdev.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/physdev.c -+++ xen-4.1.3-testing/xen/arch/x86/physdev.c -@@ -16,6 +16,10 @@ - #include - #include - -+#ifdef CONFIG_X86_64 -+#include "x86_64/mmconfig.h" -+#endif -+ - #ifndef COMPAT - typedef long ret_t; - #endif -@@ -540,6 +544,24 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H - break; - } - -+#ifdef __x86_64__ -+ case PHYSDEVOP_pci_mmcfg_reserved: { -+ struct physdev_pci_mmcfg_reserved info; -+ -+ ret = -EPERM; -+ if ( !IS_PRIV(current->domain) ) -+ break; -+ -+ ret = -EFAULT; -+ if ( copy_from_guest(&info, arg, 1) ) -+ break; -+ -+ ret = pci_mmcfg_reserved(info.address, info.segment, -+ info.start_bus, info.end_bus, info.flags); -+ break; -+ } -+#endif -+ - case PHYSDEVOP_restore_msi: { - struct physdev_restore_msi restore_msi; - struct pci_dev *pdev; -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mmconfig.h -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig.h -@@ -84,6 +84,11 @@ extern int pci_mmcfg_config_num; - extern struct acpi_mcfg_allocation *pci_mmcfg_config; - - /* function prototypes */ -+struct acpi_table_header; - int acpi_parse_mcfg(struct acpi_table_header *header); -+int pci_mmcfg_reserved(uint64_t address, unsigned int segment, -+ unsigned int start_bus, unsigned int end_bus, -+ unsigned int flags); - int pci_mmcfg_arch_init(void); --void pci_mmcfg_arch_free(void); -+int pci_mmcfg_arch_enable(unsigned int); -+void pci_mmcfg_arch_disable(unsigned int); -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig-shared.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mmconfig-shared.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig-shared.c -@@ -22,10 +22,10 @@ - #include - #include - #include -+#include - - #include "mmconfig.h" - --static int __initdata known_bridge; - unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF; - - static void __init parse_mmcfg(char *s) -@@ -316,26 +316,21 @@ static int __init pci_mmcfg_check_hostbr - return name != NULL; - } - --typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type); -- - static int __init is_mmconf_reserved( -- check_reserved_t is_reserved, - u64 addr, u64 size, int i, -- typeof(pci_mmcfg_config[0]) *cfg, int with_e820) -+ typeof(pci_mmcfg_config[0]) *cfg) - { - u64 old_size = size; - int valid = 0; - -- while (!is_reserved(addr, addr + size - 1, E820_RESERVED)) { -+ while (!e820_all_mapped(addr, addr + size - 1, E820_RESERVED)) { - size >>= 1; - if (size < (16UL<<20)) - break; - } - - if (size >= (16UL<<20) || size == old_size) { -- printk(KERN_NOTICE -- "PCI: MCFG area at %lx reserved in %s\n", -- addr, with_e820?"E820":"ACPI motherboard resources"); -+ printk(KERN_NOTICE "PCI: MCFG area at %lx reserved in E820\n", addr); - valid = 1; - - if (old_size != size) { -@@ -352,15 +347,16 @@ static int __init is_mmconf_reserved( - return valid; - } - --static void __init pci_mmcfg_reject_broken(void) -+static bool_t __init pci_mmcfg_reject_broken(void) - { - typeof(pci_mmcfg_config[0]) *cfg; - int i; -+ bool_t valid = 1; - - if ((pci_mmcfg_config_num == 0) || - (pci_mmcfg_config == NULL) || - (pci_mmcfg_config[0].address == 0)) -- return; -+ return 0; - - cfg = &pci_mmcfg_config[0]; - -@@ -374,27 +370,25 @@ static void __init pci_mmcfg_reject_brok - size = cfg->end_bus_number + 1 - cfg->start_bus_number; - size <<= 20; - printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " -- "segment %hu buses %u - %u\n", -+ "segment %04x buses %02x - %02x\n", - i, (unsigned long)cfg->address, cfg->pci_segment, - (unsigned int)cfg->start_bus_number, - (unsigned int)cfg->end_bus_number); - -- if (!is_mmconf_reserved(e820_all_mapped, addr, size, i, cfg, 1)) -- goto reject; -+ if (!is_mmconf_reserved(addr, size, i, cfg) || -+ pci_mmcfg_arch_enable(i)) { -+ pci_mmcfg_arch_disable(i); -+ valid = 0; -+ } - } - -- return; -- --reject: -- printk(KERN_INFO "PCI: Not using MMCONFIG.\n"); -- pci_mmcfg_arch_free(); -- xfree(pci_mmcfg_config); -- pci_mmcfg_config = NULL; -- pci_mmcfg_config_num = 0; -+ return valid; - } - - void __init acpi_mmcfg_init(void) - { -+ bool_t valid = 1; -+ - /* MMCONFIG disabled */ - if ((pci_probe & PCI_PROBE_MMCONF) == 0) - return; -@@ -403,16 +397,17 @@ void __init acpi_mmcfg_init(void) - if (!(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) - return; - -- /* for late to exit */ -- if (known_bridge) -- return; -+ if (pci_mmcfg_check_hostbridge()) { -+ unsigned int i; - -- if (pci_mmcfg_check_hostbridge()) -- known_bridge = 1; -- -- if (!known_bridge) { -+ pci_mmcfg_arch_init(); -+ for (i = 0; i < pci_mmcfg_config_num; ++i) -+ if (pci_mmcfg_arch_enable(i)) -+ valid = 0; -+ } else { - acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg); -- pci_mmcfg_reject_broken(); -+ pci_mmcfg_arch_init(); -+ valid = pci_mmcfg_reject_broken(); - } - - if ((pci_mmcfg_config_num == 0) || -@@ -420,9 +415,41 @@ void __init acpi_mmcfg_init(void) - (pci_mmcfg_config[0].address == 0)) - return; - -- if (pci_mmcfg_arch_init()) { -+ if (valid) - pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; -+} -+ -+int pci_mmcfg_reserved(uint64_t address, unsigned int segment, -+ unsigned int start_bus, unsigned int end_bus, -+ unsigned int flags) -+{ -+ unsigned int i; -+ -+ if (flags & ~XEN_PCI_MMCFG_RESERVED) -+ return -EINVAL; -+ -+ for (i = 0; i < pci_mmcfg_config_num; ++i) { -+ const typeof(pci_mmcfg_config[0]) *cfg = &pci_mmcfg_config[i]; -+ -+ if (cfg->pci_segment == segment && -+ cfg->start_bus_number == start_bus && -+ cfg->end_bus_number == end_bus) { -+ if (cfg->address != address) { -+ printk(KERN_WARNING -+ "Base address presented for segment %04x bus %02x-%02x" -+ " (%08" PRIx64 ") does not match previously obtained" -+ " one (%08" PRIx64 ")\n", -+ segment, start_bus, end_bus, address, cfg->address); -+ return -EIO; -+ } -+ if (flags & XEN_PCI_MMCFG_RESERVED) -+ return pci_mmcfg_arch_enable(i); -+ pci_mmcfg_arch_disable(i); -+ return 0; -+ } - } -+ -+ return -ENODEV; - } - - /** -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig_64.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mmconfig_64.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig_64.c -@@ -23,7 +23,7 @@ struct mmcfg_virt { - char __iomem *virt; - }; - static struct mmcfg_virt *pci_mmcfg_virt; --static int __initdata mmcfg_pci_segment_shift; -+static unsigned int mmcfg_pci_segment_shift; - - static char __iomem *get_virt(unsigned int seg, unsigned int *bus) - { -@@ -112,7 +112,8 @@ int pci_mmcfg_write(unsigned int seg, un - return 0; - } - --static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg) -+static void __iomem *mcfg_ioremap(const struct acpi_mcfg_allocation *cfg, -+ unsigned int prot) - { - unsigned long virt, size; - -@@ -126,19 +127,55 @@ static void __iomem * __init mcfg_iorema - if (map_pages_to_xen(virt, - (cfg->address >> PAGE_SHIFT) + - (cfg->start_bus_number << (20 - PAGE_SHIFT)), -- size >> PAGE_SHIFT, PAGE_HYPERVISOR_NOCACHE)) -+ size >> PAGE_SHIFT, prot)) - return NULL; - - return (void __iomem *) virt; - } - -+int pci_mmcfg_arch_enable(unsigned int idx) -+{ -+ const typeof(pci_mmcfg_config[0]) *cfg = pci_mmcfg_virt[idx].cfg; -+ -+ if (pci_mmcfg_virt[idx].virt) -+ return 0; -+ pci_mmcfg_virt[idx].virt = mcfg_ioremap(cfg, PAGE_HYPERVISOR_NOCACHE); -+ if (!pci_mmcfg_virt[idx].virt) { -+ printk(KERN_ERR "PCI: Cannot map MCFG aperture for segment %04x\n", -+ cfg->pci_segment); -+ return -ENOMEM; -+ } -+ printk(KERN_INFO "PCI: Using MCFG for segment %04x bus %02x-%02x\n", -+ cfg->pci_segment, cfg->start_bus_number, cfg->end_bus_number); -+ return 0; -+} -+ -+void pci_mmcfg_arch_disable(unsigned int idx) -+{ -+ const typeof(pci_mmcfg_config[0]) *cfg = pci_mmcfg_virt[idx].cfg; -+ -+ pci_mmcfg_virt[idx].virt = NULL; -+ /* -+ * Don't use destroy_xen_mappings() here, or make sure that at least -+ * the necessary L4 entries get populated (so that they get properly -+ * propagated to guest domains' page tables). -+ */ -+ mcfg_ioremap(cfg, 0); -+ printk(KERN_WARNING "PCI: Not using MCFG for segment %04x bus %02x-%02x\n", -+ cfg->pci_segment, cfg->start_bus_number, cfg->end_bus_number); -+} -+ - int __init pci_mmcfg_arch_init(void) - { - int i; - -+ if (pci_mmcfg_virt) -+ return 0; -+ - pci_mmcfg_virt = xmalloc_array(struct mmcfg_virt, pci_mmcfg_config_num); - if (pci_mmcfg_virt == NULL) { - printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n"); -+ pci_mmcfg_config_num = 0; - return 0; - } - memset(pci_mmcfg_virt, 0, sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num); -@@ -149,34 +186,5 @@ int __init pci_mmcfg_arch_init(void) - ++mmcfg_pci_segment_shift; - } - mmcfg_pci_segment_shift += 20; -- for (i = 0; i < pci_mmcfg_config_num; ++i) { -- pci_mmcfg_virt[i].virt = mcfg_ioremap(&pci_mmcfg_config[i]); -- if (!pci_mmcfg_virt[i].virt) { -- printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " -- "segment %d\n", -- pci_mmcfg_config[i].pci_segment); -- pci_mmcfg_arch_free(); -- return 0; -- } -- } - return 1; - } -- --void __init pci_mmcfg_arch_free(void) --{ -- int i; -- -- if (pci_mmcfg_virt == NULL) -- return; -- -- for (i = 0; i < pci_mmcfg_config_num; ++i) { -- if (pci_mmcfg_virt[i].virt) { -- iounmap(pci_mmcfg_virt[i].virt); -- pci_mmcfg_virt[i].virt = NULL; -- pci_mmcfg_virt[i].cfg = NULL; -- } -- } -- -- xfree(pci_mmcfg_virt); -- pci_mmcfg_virt = NULL; --} -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/physdev.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/physdev.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/physdev.c -@@ -54,6 +54,10 @@ - #define physdev_get_free_pirq compat_physdev_get_free_pirq - #define physdev_get_free_pirq_t physdev_get_free_pirq_compat_t - -+#define xen_physdev_pci_mmcfg_reserved physdev_pci_mmcfg_reserved -+CHECK_physdev_pci_mmcfg_reserved; -+#undef xen_physdev_pci_mmcfg_reserved -+ - #define COMPAT - #undef guest_handle_okay - #define guest_handle_okay compat_handle_okay -Index: xen-4.1.3-testing/xen/include/public/physdev.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/physdev.h -+++ xen-4.1.3-testing/xen/include/public/physdev.h -@@ -263,6 +263,19 @@ struct physdev_get_free_pirq { - typedef struct physdev_get_free_pirq physdev_get_free_pirq_t; - DEFINE_XEN_GUEST_HANDLE(physdev_get_free_pirq_t); - -+#define XEN_PCI_MMCFG_RESERVED 0x1 -+ -+#define PHYSDEVOP_pci_mmcfg_reserved 24 -+struct physdev_pci_mmcfg_reserved { -+ uint64_t address; -+ uint16_t segment; -+ uint8_t start_bus; -+ uint8_t end_bus; -+ uint32_t flags; -+}; -+typedef struct physdev_pci_mmcfg_reserved physdev_pci_mmcfg_reserved_t; -+DEFINE_XEN_GUEST_HANDLE(physdev_pci_mmcfg_reserved_t); -+ - /* - * Notify that some PIRQ-bound event channels have been unmasked. - * ** This command is obsolete since interface version 0x00030202 and is ** -Index: xen-4.1.3-testing/xen/include/xlat.lst -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xlat.lst -+++ xen-4.1.3-testing/xen/include/xlat.lst -@@ -60,6 +60,7 @@ - ! memory_map memory.h - ! memory_reservation memory.h - ! pod_target memory.h -+? physdev_pci_mmcfg_reserved physdev.h - ! sched_poll sched.h - ? sched_remote_shutdown sched.h - ? sched_shutdown sched.h diff --git a/23771-x86-ioapic-clear-pin.patch b/23771-x86-ioapic-clear-pin.patch deleted file mode 100644 index cfd9d94..0000000 --- a/23771-x86-ioapic-clear-pin.patch +++ /dev/null @@ -1,63 +0,0 @@ -References: bnc#701686 - -# HG changeset patch -# User Jan Beulich -# Date 1313503555 -3600 -# Node ID fc2be6cb89ad49efd90fe1b650f7efaab72f61b2 -# Parent 5c1ebc117f9901bc155d2b92ae902a4144767dfb -x86: simplify (and fix) clear_IO_APIC{,_pin}() - -These are used during bootup and (emergency) shutdown only, and their -only purpose is to get the actual IO-APIC's RTE(s) cleared. -Consequently, only the "raw" accessors should be used (and the ones -going through interrupt remapping code can be skipped), with the -exception of determining the delivery mode: This one must always go -through the interrupt remapping path, as in the VT-d case the actual -IO-APIC's RTE will have the delivery mode always set to zero (which -before possibly could have resulted in such an entry getting cleared -in the "raw" pass, though I haven't observed this case in practice). - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/io_apic.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/io_apic.c -+++ xen-4.1.3-testing/xen/arch/x86/io_apic.c -@@ -458,14 +458,12 @@ static void eoi_IO_APIC_irq(unsigned int - spin_unlock_irqrestore(&ioapic_lock, flags); - } - --#define clear_IO_APIC_pin(a,p) __clear_IO_APIC_pin(a,p,0) --#define clear_IO_APIC_pin_raw(a,p) __clear_IO_APIC_pin(a,p,1) --static void __clear_IO_APIC_pin(unsigned int apic, unsigned int pin, int raw) -+static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) - { - struct IO_APIC_route_entry entry; - - /* Check delivery_mode to be sure we're not clearing an SMI pin */ -- entry = ioapic_read_entry(apic, pin, raw); -+ entry = __ioapic_read_entry(apic, pin, FALSE); - if (entry.delivery_mode == dest_SMI) - return; - -@@ -474,7 +472,7 @@ static void __clear_IO_APIC_pin(unsigned - */ - memset(&entry, 0, sizeof(entry)); - entry.mask = 1; -- ioapic_write_entry(apic, pin, raw, entry); -+ __ioapic_write_entry(apic, pin, TRUE, entry); - } - - static void clear_IO_APIC (void) -@@ -482,10 +480,8 @@ static void clear_IO_APIC (void) - int apic, pin; - - for (apic = 0; apic < nr_ioapics; apic++) { -- for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { -+ for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) - clear_IO_APIC_pin(apic, pin); -- clear_IO_APIC_pin_raw(apic, pin); -- } - } - } - diff --git a/23772-x86-trampoline.patch b/23772-x86-trampoline.patch deleted file mode 100644 index 25f86b9..0000000 --- a/23772-x86-trampoline.patch +++ /dev/null @@ -1,383 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1313744066 -3600 -# Node ID 29aeed4979a78f26519f5fde8a405f8438297ab9 -# Parent fc2be6cb89ad49efd90fe1b650f7efaab72f61b2 -x86: make run-time part of trampoline relocatable - -In order to eliminate an initial hack in the EFI boot code (where -memory for the trampoline was just "claimed" instead of properly -allocated), the trampoline code must no longer make assumption on the -address at which it would be located. For the time being, the fixed -address is being retained for the traditional multiboot path. - -As an additional benefit (at least from my pov) it allows confining -the visibility of the BOOT_TRAMPOLINE definition to just the boot -code. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/boot/Makefile -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/boot/Makefile -+++ xen-4.1.3-testing/xen/arch/x86/boot/Makefile -@@ -2,8 +2,8 @@ obj-y += head.o - - head.o: reloc.S - --BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\{1\,\}BOOT_TRAMPOLINE[[:space:]]\{1\,\},,p' $(BASEDIR)/include/asm-x86/config.h) -+BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\{1\,\}BOOT_TRAMPOLINE[[:space:]]\{1\,\},,p' head.S) - %.S: %.c - RELOC=$(BOOT_TRAMPOLINE) $(MAKE) -f build32.mk $@ - --reloc.S: $(BASEDIR)/include/asm-x86/config.h -+reloc.S: head.S -Index: xen-4.1.3-testing/xen/arch/x86/boot/head.S -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/boot/head.S -+++ xen-4.1.3-testing/xen/arch/x86/boot/head.S -@@ -9,7 +9,7 @@ - .text - .code32 - --#undef bootsym_phys -+#define BOOT_TRAMPOLINE 0x7c000 - #define sym_phys(sym) ((sym) - __XEN_VIRT_START) - #define bootsym_phys(sym) ((sym) - trampoline_start + BOOT_TRAMPOLINE) - -@@ -189,6 +189,17 @@ __start: - mov %edi,sym_phys(idle_pg_table_l2) + (__PAGE_OFFSET>>18) - #endif - -+ /* Apply relocations to bootstrap trampoline. */ -+ mov $BOOT_TRAMPOLINE,%edx -+ mov $sym_phys(__trampoline_rel_start),%edi -+ mov %edx,sym_phys(trampoline_phys) -+1: -+ mov (%edi),%eax -+ add %edx,(%edi,%eax) -+ add $4,%edi -+ cmp $sym_phys(__trampoline_rel_stop),%edi -+ jb 1b -+ - /* Copy bootstrap trampoline to low memory, below 1MB. */ - mov $sym_phys(trampoline_start),%esi - mov $bootsym_phys(trampoline_start),%edi -Index: xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/boot/trampoline.S -+++ xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S -@@ -4,6 +4,13 @@ - #undef bootsym - #define bootsym(s) ((s)-trampoline_start) - -+#define bootsym_rel(sym, off, opnd...) \ -+ bootsym(sym),##opnd; \ -+111:; \ -+ .pushsection .trampoline_rel, "a"; \ -+ .long 111b - (off) - .; \ -+ .popsection -+ - .globl trampoline_realmode_entry - trampoline_realmode_entry: - mov %cs,%ax -@@ -17,11 +24,11 @@ trampoline_realmode_entry: - xor %ax, %ax - inc %ax - lmsw %ax # CR0.PE = 1 (enter protected mode) -- ljmpl $BOOT_CS32,$bootsym_phys(trampoline_protmode_entry) -+ ljmpl $BOOT_CS32,$bootsym_rel(trampoline_protmode_entry,6) - - idt_48: .word 0, 0, 0 # base = limit = 0 - gdt_48: .word 6*8-1 -- .long bootsym_phys(trampoline_gdt) -+ .long bootsym_rel(trampoline_gdt,4) - trampoline_gdt: - /* 0x0000: unused */ - .quad 0x0000000000000000 -@@ -32,11 +39,16 @@ trampoline_gdt: - /* 0x0018: ring 0 data */ - .quad 0x00cf92000000ffff - /* 0x0020: real-mode code @ BOOT_TRAMPOLINE */ -- .long 0x0000ffff | ((BOOT_TRAMPOLINE & 0x00ffff) << 16) -- .long 0x00009a00 | ((BOOT_TRAMPOLINE & 0xff0000) >> 16) -+ .long 0x0000ffff -+ .long 0x00009a00 - /* 0x0028: real-mode data @ BOOT_TRAMPOLINE */ -- .long 0x0000ffff | ((BOOT_TRAMPOLINE & 0x00ffff) << 16) -- .long 0x00009200 | ((BOOT_TRAMPOLINE & 0xff0000) >> 16) -+ .long 0x0000ffff -+ .long 0x00009200 -+ -+ .pushsection .trampoline_rel, "a" -+ .long trampoline_gdt + BOOT_PSEUDORM_CS + 2 - . -+ .long trampoline_gdt + BOOT_PSEUDORM_DS + 2 - . -+ .popsection - - .globl cpuid_ext_features - cpuid_ext_features: -@@ -66,11 +78,11 @@ trampoline_protmode_entry: - - /* Load pagetable base register. */ - mov $sym_phys(idle_pg_table),%eax -- add bootsym_phys(trampoline_xen_phys_start),%eax -+ add bootsym_rel(trampoline_xen_phys_start,4,%eax) - mov %eax,%cr3 - - /* Set up EFER (Extended Feature Enable Register). */ -- mov bootsym_phys(cpuid_ext_features),%edi -+ mov bootsym_rel(cpuid_ext_features,4,%edi) - test $0x20100800,%edi /* SYSCALL/SYSRET, No Execute, Long Mode? */ - jz .Lskip_efer - movl $MSR_EFER,%ecx -@@ -93,7 +105,7 @@ trampoline_protmode_entry: - #if defined(__x86_64__) - - /* Now in compatibility mode. Long-jump into 64-bit mode. */ -- ljmp $BOOT_CS64,$bootsym_phys(start64) -+ ljmp $BOOT_CS64,$bootsym_rel(start64,6) - - .code64 - start64: -Index: xen-4.1.3-testing/xen/arch/x86/boot/wakeup.S -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/boot/wakeup.S -+++ xen-4.1.3-testing/xen/arch/x86/boot/wakeup.S -@@ -42,15 +42,13 @@ ENTRY(wakeup_start) - - # boot trampoline is under 1M, and shift its start into - # %fs to reference symbols in that area -- movl $BOOT_TRAMPOLINE, %eax -- shrl $4, %eax -- movl %eax, %fs -+ mov wakesym(trampoline_seg), %fs - lidt %fs:bootsym(idt_48) - lgdt %fs:bootsym(gdt_48) - - movw $1, %ax - lmsw %ax # Turn on CR0.PE -- ljmpl $BOOT_CS32, $bootsym_phys(wakeup_32) -+ ljmpl $BOOT_CS32, $bootsym_rel(wakeup_32, 6) - - /* This code uses an extended set of video mode numbers. These include: - * Aliases for standard modes -@@ -103,6 +101,10 @@ real_magic: .long 0x12345678 - .globl video_mode, video_flags - video_mode: .long 0 - video_flags: .long 0 -+trampoline_seg: .word BOOT_TRAMPOLINE >> 4 -+ .pushsection .trampoline_seg, "a" -+ .long trampoline_seg - . -+ .popsection - - .code32 - -@@ -114,11 +116,11 @@ wakeup_32: - mov $BOOT_DS, %eax - mov %eax, %ds - mov %eax, %ss -- mov $bootsym_phys(early_stack), %esp -+ mov $bootsym_rel(early_stack, 4, %esp) - - # check saved magic again - mov $sym_phys(saved_magic), %eax -- add bootsym_phys(trampoline_xen_phys_start), %eax -+ add bootsym_rel(trampoline_xen_phys_start, 4, %eax) - mov (%eax), %eax - cmp $0x9abcdef0, %eax - jne bogus_saved_magic -@@ -131,12 +133,12 @@ wakeup_32: - - /* Load pagetable base register */ - mov $sym_phys(idle_pg_table),%eax -- add bootsym_phys(trampoline_xen_phys_start),%eax -+ add bootsym_rel(trampoline_xen_phys_start,4,%eax) - mov %eax,%cr3 - - /* Will cpuid feature change after resume? */ - /* Set up EFER (Extended Feature Enable Register). */ -- mov bootsym_phys(cpuid_ext_features),%edi -+ mov bootsym_rel(cpuid_ext_features,4,%edi) - test $0x20100800,%edi /* SYSCALL/SYSRET, No Execute, Long Mode? */ - jz .Lskip_eferw - movl $MSR_EFER,%ecx -@@ -162,7 +164,7 @@ wakeup_32: - #if defined(__x86_64__) - - /* Now in compatibility mode. Long-jump to 64-bit mode */ -- ljmp $BOOT_CS64, $bootsym_phys(wakeup_64) -+ ljmp $BOOT_CS64, $bootsym_rel(wakeup_64,6) - - .code64 - wakeup_64: -Index: xen-4.1.3-testing/xen/arch/x86/efi/boot.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/efi/boot.c -+++ xen-4.1.3-testing/xen/arch/x86/efi/boot.c -@@ -599,6 +599,9 @@ static void __init relocate_image(unsign - } - } - -+extern const s32 __trampoline_rel_start[], __trampoline_rel_stop[]; -+extern const s32 __trampoline_seg_start[], __trampoline_seg_stop[]; -+ - void EFIAPI __init __attribute__((__noreturn__)) - efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) - { -@@ -614,9 +617,10 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info; - EFI_FILE_HANDLE dir_handle; - union string section = { NULL }, name; -+ const s32 *trampoline_ptr; - struct e820entry *e; - u64 efer; -- bool_t base_video = 0, trampoline_okay = 0; -+ bool_t base_video = 0; - - efi_ih = ImageHandle; - efi_bs = SystemTable->BootServices; -@@ -914,15 +918,27 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - dmi_efi_get_table((void *)(long)efi.smbios); - - /* Allocate space for trampoline (in first Mb). */ -- cfg.addr = BOOT_TRAMPOLINE; -+ cfg.addr = 0x100000; - cfg.size = trampoline_end - trampoline_start; -- status = efi_bs->AllocatePages(AllocateAddress, EfiLoaderData, -+ status = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData, - PFN_UP(cfg.size), &cfg.addr); - if ( EFI_ERROR(status) ) - { - cfg.addr = 0; -- PrintErr(L"Note: Trampoline area is in use\r\n"); -+ blexit(L"No memory for trampoline\r\n"); - } -+ trampoline_phys = cfg.addr; -+ /* Apply relocations to trampoline. */ -+ for ( trampoline_ptr = __trampoline_rel_start; -+ trampoline_ptr < __trampoline_rel_stop; -+ ++trampoline_ptr ) -+ *(u32 *)(*trampoline_ptr + (long)trampoline_ptr) += -+ trampoline_phys; -+ for ( trampoline_ptr = __trampoline_seg_start; -+ trampoline_ptr < __trampoline_seg_stop; -+ ++trampoline_ptr ) -+ *(u16 *)(*trampoline_ptr + (long)trampoline_ptr) = -+ trampoline_phys >> 4; - - /* Initialise L2 identity-map and xen page table entries (16MB). */ - for ( i = 0; i < 8; ++i ) -@@ -1096,14 +1112,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - e->type = type; - ++e820nr; - } -- if ( type == E820_RAM && e->addr <= BOOT_TRAMPOLINE && -- e->addr + e->size >= BOOT_TRAMPOLINE + cfg.size ) -- trampoline_okay = 1; - } - -- if ( !trampoline_okay ) -- blexit(L"Trampoline area unavailable\r\n"); -- - status = efi_bs->ExitBootServices(ImageHandle, map_key); - if ( EFI_ERROR(status) ) - PrintErrMesg(L"Cannot exit boot services", status); -@@ -1117,7 +1127,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - efi_fw_vendor = (void *)efi_fw_vendor + DIRECTMAP_VIRT_START; - - relocate_image(__XEN_VIRT_START - xen_phys_start); -- memcpy((void *)(long)BOOT_TRAMPOLINE, trampoline_start, cfg.size); -+ memcpy((void *)trampoline_phys, trampoline_start, cfg.size); - - /* Set system registers and transfer control. */ - asm volatile("pushq $0\n\tpopfq"); -Index: xen-4.1.3-testing/xen/arch/x86/smpboot.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/smpboot.c -+++ xen-4.1.3-testing/xen/arch/x86/smpboot.c -@@ -49,6 +49,8 @@ - - #define setup_trampoline() (bootsym_phys(trampoline_realmode_entry)) - -+unsigned long __read_mostly trampoline_phys; -+ - /* Set if we find a B stepping CPU */ - static int smp_b_stepping; - -Index: xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -166,8 +167,9 @@ void __init zap_low_mappings(l2_pgentry_ - flush_all(FLUSH_TLB_GLOBAL); - - /* Replace with mapping of the boot trampoline only. */ -- map_pages_to_xen(BOOT_TRAMPOLINE, BOOT_TRAMPOLINE >> PAGE_SHIFT, -- 0x10, __PAGE_HYPERVISOR); -+ map_pages_to_xen(trampoline_phys, trampoline_phys >> PAGE_SHIFT, -+ PFN_UP(trampoline_end - trampoline_start), -+ __PAGE_HYPERVISOR); - } - - void __init subarch_init_memory(void) -Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c -@@ -830,7 +830,7 @@ void __init zap_low_mappings(void) - flush_local(FLUSH_TLB_GLOBAL); - - /* Replace with mapping of the boot trampoline only. */ -- map_pages_to_xen(BOOT_TRAMPOLINE, BOOT_TRAMPOLINE >> PAGE_SHIFT, -+ map_pages_to_xen(trampoline_phys, trampoline_phys >> PAGE_SHIFT, - PFN_UP(trampoline_end - trampoline_start), - __PAGE_HYPERVISOR); - } -Index: xen-4.1.3-testing/xen/arch/x86/xen.lds.S -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/xen.lds.S -+++ xen-4.1.3-testing/xen/arch/x86/xen.lds.S -@@ -103,6 +103,13 @@ SECTIONS - *(.init.data) - *(.init.data.rel) - *(.init.data.rel.*) -+ . = ALIGN(4); -+ __trampoline_rel_start = .; -+ *(.trampoline_rel) -+ __trampoline_rel_stop = .; -+ __trampoline_seg_start = .; -+ *(.trampoline_seg) -+ __trampoline_seg_stop = .; - } :text - . = ALIGN(32); - .init.setup : { -Index: xen-4.1.3-testing/xen/include/asm-x86/config.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/config.h -+++ xen-4.1.3-testing/xen/include/asm-x86/config.h -@@ -95,13 +95,13 @@ - /* Primary stack is restricted to 8kB by guard pages. */ - #define PRIMARY_STACK_SIZE 8192 - --#define BOOT_TRAMPOLINE 0x7c000 -+#ifndef __ASSEMBLY__ -+extern unsigned long trampoline_phys; - #define bootsym_phys(sym) \ -- (((unsigned long)&(sym)-(unsigned long)&trampoline_start)+BOOT_TRAMPOLINE) -+ (((unsigned long)&(sym)-(unsigned long)&trampoline_start)+trampoline_phys) - #define bootsym(sym) \ - (*RELOC_HIDE((typeof(&(sym)))__va(__pa(&(sym))), \ -- BOOT_TRAMPOLINE-__pa(trampoline_start))) --#ifndef __ASSEMBLY__ -+ trampoline_phys-__pa(trampoline_start))) - extern char trampoline_start[], trampoline_end[]; - extern char trampoline_realmode_entry[]; - extern unsigned int trampoline_xen_phys_start; diff --git a/23774-x86_64-EFI-EDD.patch b/23774-x86_64-EFI-EDD.patch deleted file mode 100644 index 44ba7ff..0000000 --- a/23774-x86_64-EFI-EDD.patch +++ /dev/null @@ -1,370 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1313744120 -3600 -# Node ID e35c5202625ef5534561f84352833ad9467d986c -# Parent dd90b59cb11c60c48e174c899190e2967341fe32 -x86-64/EFI: construct EDD data from device path protocol information - -In the absence of a BIOS to handle INT13 requests, this information -must be constructed artificially instead when booted from EFI. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.2-testing/xen/arch/x86/boot/edd.S -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/boot/edd.S -+++ xen-4.1.2-testing/xen/arch/x86/boot/edd.S -@@ -16,21 +16,13 @@ - * Updated and ported for Xen by Keir Fraser June 2007 - */ - -+#include -+ - .code16 - - /* Offset of disc signature in the MBR. */ - #define EDD_MBR_SIG_OFFSET 0x1B8 - --/* Maximum number of EDD information structures at boot_edd_info. */ --#define EDD_INFO_MAX 6 -- --/* Maximum number of MBR signatures at boot_mbr_signature. */ --#define EDD_MBR_SIG_MAX 16 -- --/* Size of components of EDD information structure. */ --#define EDDEXTSIZE 8 --#define EDDPARMSIZE 74 -- - get_edd: - cmpb $2, bootsym(opt_edd) # edd=off ? - je edd_done -Index: xen-4.1.2-testing/xen/arch/x86/efi/boot.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/efi/boot.c -+++ xen-4.1.2-testing/xen/arch/x86/efi/boot.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -539,6 +540,18 @@ static void __init split_value(char *s) - *s = 0; - } - -+static void __init edd_put_string(u8 *dst, size_t n, const char *src) -+{ -+ while ( n-- && *src ) -+ *dst++ = *src++; -+ if ( *src ) -+ PrintErrMesg(L"Internal error populating EDD info", -+ EFI_BUFFER_TOO_SMALL); -+ while ( n-- ) -+ *dst++ = ' '; -+} -+#define edd_put_string(d, s) edd_put_string(d, ARRAY_SIZE(d), s) -+ - static int __init set_color(u32 mask, int bpp, u8 *pos, u8 *sz) - { - if ( bpp < 0 ) -@@ -607,6 +620,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - { - static EFI_GUID __initdata loaded_image_guid = LOADED_IMAGE_PROTOCOL; - static EFI_GUID __initdata gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; -+ static EFI_GUID __initdata bio_guid = BLOCK_IO_PROTOCOL; -+ static EFI_GUID __initdata devp_guid = DEVICE_PATH_PROTOCOL; - EFI_LOADED_IMAGE *loaded_image; - EFI_STATUS status; - unsigned int i, argc; -@@ -887,7 +902,148 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY - - place_string(&mbi.mem_upper, NULL); - -- /* XXX Collect EDD info. */ -+ /* Collect EDD info. */ -+ BUILD_BUG_ON(offsetof(struct edd_info, edd_device_params) != EDDEXTSIZE); -+ BUILD_BUG_ON(sizeof(struct edd_device_params) != EDDPARMSIZE); -+ size = 0; -+ status = efi_bs->LocateHandle(ByProtocol, &bio_guid, NULL, &size, NULL); -+ if ( status == EFI_BUFFER_TOO_SMALL ) -+ status = efi_bs->AllocatePool(EfiLoaderData, size, (void **)&handles); -+ if ( !EFI_ERROR(status) ) -+ status = efi_bs->LocateHandle(ByProtocol, &bio_guid, NULL, &size, -+ handles); -+ if ( EFI_ERROR(status) ) -+ size = 0; -+ for ( i = 0; i < size / sizeof(*handles); ++i ) -+ { -+ EFI_BLOCK_IO *bio; -+ EFI_DEV_PATH_PTR devp; -+ struct edd_info *info = boot_edd_info + boot_edd_info_nr; -+ struct edd_device_params *params = &info->edd_device_params; -+ enum { root, acpi, pci, ctrlr } state = root; -+ -+ status = efi_bs->HandleProtocol(handles[i], &bio_guid, (void **)&bio); -+ if ( EFI_ERROR(status) || -+ bio->Media->RemovableMedia || -+ bio->Media->LogicalPartition ) -+ continue; -+ if ( boot_edd_info_nr < EDD_INFO_MAX ) -+ { -+ info->device = 0x80 + boot_edd_info_nr; /* fake */ -+ info->version = 0x11; -+ params->length = offsetof(struct edd_device_params, dpte_ptr); -+ params->number_of_sectors = bio->Media->LastBlock + 1; -+ params->bytes_per_sector = bio->Media->BlockSize; -+ params->dpte_ptr = ~0; -+ } -+ ++boot_edd_info_nr; -+ status = efi_bs->HandleProtocol(handles[i], &devp_guid, -+ (void **)&devp); -+ if ( EFI_ERROR(status) ) -+ continue; -+ for ( ; !IsDevicePathEnd(devp.DevPath); -+ devp.DevPath = NextDevicePathNode(devp.DevPath) ) -+ { -+ switch ( DevicePathType(devp.DevPath) ) -+ { -+ const u8 *p; -+ -+ case ACPI_DEVICE_PATH: -+ if ( state != root || boot_edd_info_nr > EDD_INFO_MAX ) -+ break; -+ switch ( DevicePathSubType(devp.DevPath) ) -+ { -+ case ACPI_DP: -+ if ( devp.Acpi->HID != EISA_PNP_ID(0xA03) && -+ devp.Acpi->HID != EISA_PNP_ID(0xA08) ) -+ break; -+ params->interface_path.pci.bus = devp.Acpi->UID; -+ state = acpi; -+ break; -+ case EXPANDED_ACPI_DP: -+ /* XXX */ -+ break; -+ } -+ break; -+ case HARDWARE_DEVICE_PATH: -+ if ( state != acpi || -+ DevicePathSubType(devp.DevPath) != HW_PCI_DP || -+ boot_edd_info_nr > EDD_INFO_MAX ) -+ break; -+ state = pci; -+ edd_put_string(params->host_bus_type, "PCI"); -+ params->interface_path.pci.slot = devp.Pci->Device; -+ params->interface_path.pci.function = devp.Pci->Function; -+ break; -+ case MESSAGING_DEVICE_PATH: -+ if ( state != pci || boot_edd_info_nr > EDD_INFO_MAX ) -+ break; -+ state = ctrlr; -+ switch ( DevicePathSubType(devp.DevPath) ) -+ { -+ case MSG_ATAPI_DP: -+ edd_put_string(params->interface_type, "ATAPI"); -+ params->interface_path.pci.channel = -+ devp.Atapi->PrimarySecondary; -+ params->device_path.atapi.device = devp.Atapi->SlaveMaster; -+ params->device_path.atapi.lun = devp.Atapi->Lun; -+ break; -+ case MSG_SCSI_DP: -+ edd_put_string(params->interface_type, "SCSI"); -+ params->device_path.scsi.id = devp.Scsi->Pun; -+ params->device_path.scsi.lun = devp.Scsi->Lun; -+ break; -+ case MSG_FIBRECHANNEL_DP: -+ edd_put_string(params->interface_type, "FIBRE"); -+ params->device_path.fibre.wwid = devp.FibreChannel->WWN; -+ params->device_path.fibre.lun = devp.FibreChannel->Lun; -+ break; -+ case MSG_1394_DP: -+ edd_put_string(params->interface_type, "1394"); -+ params->device_path.i1394.eui = devp.F1394->Guid; -+ break; -+ case MSG_USB_DP: -+ case MSG_USB_CLASS_DP: -+ edd_put_string(params->interface_type, "USB"); -+ break; -+ case MSG_I2O_DP: -+ edd_put_string(params->interface_type, "I2O"); -+ params->device_path.i2o.identity_tag = devp.I2O->Tid; -+ break; -+ default: -+ continue; -+ } -+ info->version = 0x30; -+ params->length = sizeof(struct edd_device_params); -+ params->key = 0xbedd; -+ params->device_path_info_length = -+ sizeof(struct edd_device_params) - -+ offsetof(struct edd_device_params, key); -+ for ( p = (const u8 *)¶ms->key; p < ¶ms->checksum; ++p ) -+ params->checksum -= *p; -+ break; -+ case MEDIA_DEVICE_PATH: -+ if ( DevicePathSubType(devp.DevPath) == MEDIA_HARDDRIVE_DP && -+ devp.HardDrive->MBRType == MBR_TYPE_PCAT && -+ boot_mbr_signature_nr < EDD_MBR_SIG_MAX ) -+ { -+ struct mbr_signature *sig = boot_mbr_signature + -+ boot_mbr_signature_nr; -+ -+ sig->device = 0x80 + boot_edd_info_nr; /* fake */ -+ memcpy(&sig->signature, devp.HardDrive->Signature, -+ sizeof(sig->signature)); -+ ++boot_mbr_signature_nr; -+ } -+ break; -+ } -+ } -+ } -+ if ( handles ) -+ efi_bs->FreePool(handles); -+ if ( boot_edd_info_nr > EDD_INFO_MAX ) -+ boot_edd_info_nr = EDD_INFO_MAX; -+ - /* XXX Collect EDID info. */ - - if ( cpuid_eax(0x80000000) > 0x80000000 ) -Index: xen-4.1.2-testing/xen/include/asm-x86/edd.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/asm-x86/edd.h -+++ xen-4.1.2-testing/xen/include/asm-x86/edd.h -@@ -23,6 +23,8 @@ - #ifndef __XEN_EDD_H__ - #define __XEN_EDD_H__ - -+#ifndef __ASSEMBLY__ -+ - struct edd_info { - /* Int13, Fn48: Check Extensions Present. */ - u8 device; /* %dl: device */ -@@ -33,10 +35,106 @@ struct edd_info { - u8 legacy_max_head; /* %dh: maximum head number */ - u8 legacy_sectors_per_track; /* %cl[5:0]: maximum sector number */ - /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */ -- struct { -+ struct edd_device_params { - u16 length; -- u8 data[72]; -- } edd_device_params; -+ u16 info_flags; -+ u32 num_default_cylinders; -+ u32 num_default_heads; -+ u32 sectors_per_track; -+ u64 number_of_sectors; -+ u16 bytes_per_sector; -+ u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ -+ u16 key; /* = 0xBEDD */ -+ u8 device_path_info_length; -+ u8 reserved2; -+ u16 reserved3; -+ u8 host_bus_type[4]; -+ u8 interface_type[8]; -+ union { -+ struct { -+ u16 base_address; -+ u16 reserved1; -+ u32 reserved2; -+ } __attribute__ ((packed)) isa; -+ struct { -+ u8 bus; -+ u8 slot; -+ u8 function; -+ u8 channel; -+ u32 reserved; -+ } __attribute__ ((packed)) pci; -+ /* pcix is same as pci */ -+ struct { -+ u64 reserved; -+ } __attribute__ ((packed)) ibnd; -+ struct { -+ u64 reserved; -+ } __attribute__ ((packed)) xprs; -+ struct { -+ u64 reserved; -+ } __attribute__ ((packed)) htpt; -+ struct { -+ u64 reserved; -+ } __attribute__ ((packed)) unknown; -+ } interface_path; -+ union { -+ struct { -+ u8 device; -+ u8 reserved1; -+ u16 reserved2; -+ u32 reserved3; -+ u64 reserved4; -+ } __attribute__ ((packed)) ata; -+ struct { -+ u8 device; -+ u8 lun; -+ u8 reserved1; -+ u8 reserved2; -+ u32 reserved3; -+ u64 reserved4; -+ } __attribute__ ((packed)) atapi; -+ struct { -+ u16 id; -+ u64 lun; -+ u16 reserved1; -+ u32 reserved2; -+ } __attribute__ ((packed)) scsi; -+ struct { -+ u64 serial_number; -+ u64 reserved; -+ } __attribute__ ((packed)) usb; -+ struct { -+ u64 eui; -+ u64 reserved; -+ } __attribute__ ((packed)) i1394; -+ struct { -+ u64 wwid; -+ u64 lun; -+ } __attribute__ ((packed)) fibre; -+ struct { -+ u64 identity_tag; -+ u64 reserved; -+ } __attribute__ ((packed)) i2o; -+ struct { -+ u32 array_number; -+ u32 reserved1; -+ u64 reserved2; -+ } __attribute__ ((packed)) raid; -+ struct { -+ u8 device; -+ u8 reserved1; -+ u16 reserved2; -+ u32 reserved3; -+ u64 reserved4; -+ } __attribute__ ((packed)) sata; -+ struct { -+ u64 reserved1; -+ u64 reserved2; -+ } __attribute__ ((packed)) unknown; -+ } device_path; -+ u8 reserved4; -+ u8 checksum; -+ } __attribute__ ((packed)) edd_device_params; - } __attribute__ ((packed)); - - struct mbr_signature { -@@ -51,4 +149,16 @@ extern u8 boot_mbr_signature_nr; - extern struct edd_info boot_edd_info[]; - extern u8 boot_edd_info_nr; - -+#endif /* __ASSEMBLY__ */ -+ -+/* Maximum number of EDD information structures at boot_edd_info. */ -+#define EDD_INFO_MAX 6 -+ -+/* Maximum number of MBR signatures at boot_mbr_signature. */ -+#define EDD_MBR_SIG_MAX 16 -+ -+/* Size of components of EDD information structure. */ -+#define EDDEXTSIZE 8 -+#define EDDPARMSIZE 74 -+ - #endif /* __XEN_EDD_H__ */ diff --git a/23782-x86-ioapic-clear-irr.patch b/23782-x86-ioapic-clear-irr.patch deleted file mode 100644 index 1f1047e..0000000 --- a/23782-x86-ioapic-clear-irr.patch +++ /dev/null @@ -1,62 +0,0 @@ -References: bnc#701686 - -# HG changeset patch -# User Jan Beulich -# Date 1314004270 -3600 -# Node ID 25dfe53bb1898b3967ceb71a7eb60a8b760c25fb -# Parent 0849b0e59e2418e8215616df147f955b01b07577 -x86/IO-APIC: clear remoteIRR in clear_IO_APIC_pin() - -It was found that in a crash scenario, the remoteIRR bit in an IO-APIC -RTE could be left set, causing problems when bringing up a kdump -kernel. While this generally is most important to be taken care of in -the new kernel (which usually would be a native one), it still seems -desirable to also address this problem in Xen so that (a) the problem -doesn't bite Xen when used as a secondary emergency kernel and (b) an -attempt is being made to save un-fixed secondary kernels from running -into said problem. - -Based on a Linux patch from suresh.b.siddha@intel.com. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/io_apic.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/io_apic.c -+++ xen-4.1.3-testing/xen/arch/x86/io_apic.c -@@ -468,11 +468,35 @@ static void clear_IO_APIC_pin(unsigned i - return; - - /* -+ * Make sure the entry is masked and re-read the contents to check -+ * if it is a level triggered pin and if the remoteIRR is set. -+ */ -+ if (!entry.mask) { -+ entry.mask = 1; -+ __ioapic_write_entry(apic, pin, FALSE, entry); -+ } -+ entry = __ioapic_read_entry(apic, pin, TRUE); -+ -+ if (entry.irr) { -+ /* Make sure the trigger mode is set to level. */ -+ if (!entry.trigger) { -+ entry.trigger = 1; -+ __ioapic_write_entry(apic, pin, TRUE, entry); -+ } -+ __io_apic_eoi(apic, entry.vector, pin); -+ } -+ -+ /* - * Disable it in the IO-APIC irq-routing table: - */ - memset(&entry, 0, sizeof(entry)); - entry.mask = 1; - __ioapic_write_entry(apic, pin, TRUE, entry); -+ -+ entry = __ioapic_read_entry(apic, pin, TRUE); -+ if (entry.irr) -+ printk(KERN_ERR "IO-APIC%02x-%u: Unable to reset IRR\n", -+ IO_APIC_ID(apic), pin); - } - - static void clear_IO_APIC (void) diff --git a/23783-ACPI-set-_PDC-bits.patch b/23783-ACPI-set-_PDC-bits.patch deleted file mode 100644 index 81b24c4..0000000 --- a/23783-ACPI-set-_PDC-bits.patch +++ /dev/null @@ -1,286 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1314004356 -3600 -# Node ID 2029263c501c315fa4d94845e5cfa6a9b0b395d5 -# Parent 25dfe53bb1898b3967ceb71a7eb60a8b760c25fb -ACPI: add _PDC input override mechanism - -In order to have Dom0 call _PDC with input fully representing Xen's -capabilities, and in order to avoid building knowledge of Xen -implementation details into Dom0, this provides a mechanism by which -the Dom0 kernel can, once it filled the _PDC input buffer according to -its own knowledge, present the buffer to Xen to apply overrides for -the parts of the C-, P-, and T-state management that it controls. This -is particularly to address the dependency of Xen using MWAIT to enter -certain C-states on the availability of the break-on-interrupt -extension (which the Dom0 kernel should have no need to know about). - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/ia64/linux-xen/acpi.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/ia64/linux-xen/acpi.c -+++ xen-4.1.3-testing/xen/arch/ia64/linux-xen/acpi.c -@@ -243,6 +243,13 @@ int get_cpu_id(u32 acpi_id) - - return -1; - } -+ -+int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *pdc, u32 mask) -+{ -+ pdc[2] |= ACPI_PDC_EST_CAPABILITY_SMP & mask; -+ return 0; -+} -+ - #endif - - static int __init -Index: xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/acpi/cpu_idle.c -+++ xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c -@@ -644,12 +644,6 @@ static int cpuidle_init_cpu(int cpu) - return 0; - } - --#define CPUID_MWAIT_LEAF (5) --#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1) --#define CPUID5_ECX_INTERRUPT_BREAK (0x2) -- --#define MWAIT_ECX_INTERRUPT_BREAK (0x1) -- - #define MWAIT_SUBSTATE_MASK (0xf) - #define MWAIT_SUBSTATE_SIZE (4) - -Index: xen-4.1.3-testing/xen/arch/x86/acpi/boot.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/acpi/boot.c -+++ xen-4.1.3-testing/xen/arch/x86/acpi/boot.c -@@ -1006,3 +1006,47 @@ unsigned int acpi_get_processor_id(unsig - - return INVALID_ACPIID; - } -+ -+static void get_mwait_ecx(void *info) -+{ -+ *(u32 *)info = cpuid_ecx(CPUID_MWAIT_LEAF); -+} -+ -+int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *pdc, u32 mask) -+{ -+ unsigned int cpu = get_cpu_id(acpi_id); -+ struct cpuinfo_x86 *c; -+ u32 ecx; -+ -+ if (!(acpi_id + 1)) -+ c = &boot_cpu_data; -+ else if (cpu >= NR_CPUS || !cpu_online(cpu)) -+ return -EINVAL; -+ else -+ c = cpu_data + cpu; -+ -+ pdc[2] |= ACPI_PDC_C_CAPABILITY_SMP & mask; -+ -+ if (cpu_has(c, X86_FEATURE_EST)) -+ pdc[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP & mask; -+ -+ if (cpu_has(c, X86_FEATURE_ACPI)) -+ pdc[2] |= ACPI_PDC_T_FFH & mask; -+ -+ /* -+ * If mwait/monitor or its break-on-interrupt extension are -+ * unsupported, Cx_FFH will be disabled. -+ */ -+ if (!cpu_has(c, X86_FEATURE_MWAIT) || -+ c->cpuid_level < CPUID_MWAIT_LEAF) -+ ecx = 0; -+ else if (c == &boot_cpu_data || cpu == smp_processor_id()) -+ ecx = cpuid_ecx(CPUID_MWAIT_LEAF); -+ else -+ on_selected_cpus(cpumask_of(cpu), get_mwait_ecx, &ecx, 1); -+ if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || -+ !(ecx & CPUID5_ECX_INTERRUPT_BREAK)) -+ pdc[2] &= ~(ACPI_PDC_C_C1_FFH | ACPI_PDC_C_C2C3_FFH); -+ -+ return 0; -+} -Index: xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/platform_hypercall.c -+++ xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c -@@ -419,6 +419,15 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe - ret = -EINVAL; - break; - -+ case XEN_PM_PDC: -+ { -+ XEN_GUEST_HANDLE(uint32) pdc; -+ -+ guest_from_compat_handle(pdc, op->u.set_pminfo.u.pdc); -+ ret = acpi_set_pdc_bits(op->u.set_pminfo.id, pdc); -+ } -+ break; -+ - default: - ret = -EINVAL; - break; -Index: xen-4.1.3-testing/xen/drivers/acpi/pmstat.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/drivers/acpi/pmstat.c -+++ xen-4.1.3-testing/xen/drivers/acpi/pmstat.c -@@ -521,3 +521,34 @@ int do_pm_op(struct xen_sysctl_pm_op *op - - return ret; - } -+ -+int acpi_set_pdc_bits(u32 acpi_id, XEN_GUEST_HANDLE(uint32) pdc) -+{ -+ u32 bits[3]; -+ int ret; -+ -+ if ( copy_from_guest(bits, pdc, 2) ) -+ ret = -EFAULT; -+ else if ( bits[0] != ACPI_PDC_REVISION_ID || !bits[1] ) -+ ret = -EINVAL; -+ else if ( copy_from_guest_offset(bits + 2, pdc, 2, 1) ) -+ ret = -EFAULT; -+ else -+ { -+ u32 mask = 0; -+ -+ if ( xen_processor_pmbits & XEN_PROCESSOR_PM_CX ) -+ mask |= ACPI_PDC_C_MASK | ACPI_PDC_SMP_C1PT; -+ if ( xen_processor_pmbits & XEN_PROCESSOR_PM_PX ) -+ mask |= ACPI_PDC_P_MASK | ACPI_PDC_SMP_C1PT; -+ if ( xen_processor_pmbits & XEN_PROCESSOR_PM_TX ) -+ mask |= ACPI_PDC_T_MASK | ACPI_PDC_SMP_C1PT; -+ bits[2] &= (ACPI_PDC_C_MASK | ACPI_PDC_P_MASK | ACPI_PDC_T_MASK | -+ ACPI_PDC_SMP_C1PT) & ~mask; -+ ret = arch_acpi_set_pdc_bits(acpi_id, bits, mask); -+ } -+ if ( !ret ) -+ ret = copy_to_guest_offset(pdc, 2, bits + 2, 1); -+ -+ return ret; -+} -Index: xen-4.1.3-testing/xen/include/acpi/cpufreq/processor_perf.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/acpi/cpufreq/processor_perf.h -+++ xen-4.1.3-testing/xen/include/acpi/cpufreq/processor_perf.h -@@ -3,10 +3,10 @@ - - #include - #include -+#include - - #define XEN_PX_INIT 0x80000000 - --int get_cpu_id(u32); - int powernow_cpufreq_init(void); - unsigned int powernow_register_driver(void); - unsigned int get_measured_perf(unsigned int cpu, unsigned int flag); -Index: xen-4.1.3-testing/xen/include/acpi/pdc_intel.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/acpi/pdc_intel.h -+++ xen-4.1.3-testing/xen/include/acpi/pdc_intel.h -@@ -4,6 +4,8 @@ - #ifndef __PDC_INTEL_H__ - #define __PDC_INTEL_H__ - -+#define ACPI_PDC_REVISION_ID 1 -+ - #define ACPI_PDC_P_FFH (0x0001) - #define ACPI_PDC_C_C1_HALT (0x0002) - #define ACPI_PDC_T_FFH (0x0004) -@@ -14,6 +16,7 @@ - #define ACPI_PDC_SMP_T_SWCOORD (0x0080) - #define ACPI_PDC_C_C1_FFH (0x0100) - #define ACPI_PDC_C_C2C3_FFH (0x0200) -+#define ACPI_PDC_SMP_P_HWCOORD (0x0800) - - #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ - ACPI_PDC_C_C1_HALT | \ -@@ -22,6 +25,7 @@ - #define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \ - ACPI_PDC_C_C1_HALT | \ - ACPI_PDC_SMP_P_SWCOORD | \ -+ ACPI_PDC_SMP_P_HWCOORD | \ - ACPI_PDC_P_FFH) - - #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ -@@ -30,4 +34,17 @@ - ACPI_PDC_C_C1_FFH | \ - ACPI_PDC_C_C2C3_FFH) - -+#define ACPI_PDC_C_MASK (ACPI_PDC_C_C1_HALT | \ -+ ACPI_PDC_C_C1_FFH | \ -+ ACPI_PDC_SMP_C2C3 | \ -+ ACPI_PDC_SMP_C_SWCOORD | \ -+ ACPI_PDC_C_C2C3_FFH) -+ -+#define ACPI_PDC_P_MASK (ACPI_PDC_P_FFH | \ -+ ACPI_PDC_SMP_P_SWCOORD | \ -+ ACPI_PDC_SMP_P_HWCOORD) -+ -+#define ACPI_PDC_T_MASK (ACPI_PDC_T_FFH | \ -+ ACPI_PDC_SMP_T_SWCOORD) -+ - #endif /* __PDC_INTEL_H__ */ -Index: xen-4.1.3-testing/xen/include/asm-x86/cpufeature.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/cpufeature.h -+++ xen-4.1.3-testing/xen/include/asm-x86/cpufeature.h -@@ -151,6 +151,10 @@ - #define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) - #define cpufeat_mask(idx) (1u << ((idx) & 31)) - -+#define CPUID_MWAIT_LEAF 5 -+#define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1 -+#define CPUID5_ECX_INTERRUPT_BREAK 0x2 -+ - #ifdef __i386__ - #define cpu_has_vme boot_cpu_has(X86_FEATURE_VME) - #define cpu_has_de boot_cpu_has(X86_FEATURE_DE) -Index: xen-4.1.3-testing/xen/include/public/platform.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/platform.h -+++ xen-4.1.3-testing/xen/include/public/platform.h -@@ -304,6 +304,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletim - #define XEN_PM_CX 0 - #define XEN_PM_PX 1 - #define XEN_PM_TX 2 -+#define XEN_PM_PDC 3 - - /* Px sub info type */ - #define XEN_PX_PCT 1 -@@ -401,6 +402,7 @@ struct xenpf_set_processor_pminfo { - union { - struct xen_processor_power power;/* Cx: _CST/_CSD */ - struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ -+ XEN_GUEST_HANDLE(uint32) pdc; /* _PDC */ - } u; - }; - typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; -Index: xen-4.1.3-testing/xen/include/xen/acpi.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/acpi.h -+++ xen-4.1.3-testing/xen/include/xen/acpi.h -@@ -334,6 +334,8 @@ static inline int acpi_boot_table_init(v - - #endif /*!CONFIG_ACPI_BOOT*/ - -+int get_cpu_id(u32 acpi_id); -+ - unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); - int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); - -@@ -431,6 +433,9 @@ static inline unsigned int acpi_get_csta - static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; } - #endif - -+int acpi_set_pdc_bits(u32 acpi_id, XEN_GUEST_HANDLE(uint32)); -+int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *, u32 mask); -+ - #ifdef CONFIG_ACPI_NUMA - int acpi_get_pxm(acpi_handle handle); - #else diff --git a/23800-x86_64-guest-addr-range.patch b/23800-x86_64-guest-addr-range.patch deleted file mode 100644 index 9503c26..0000000 --- a/23800-x86_64-guest-addr-range.patch +++ /dev/null @@ -1,23 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1314800089 -3600 -# Node ID 72edc40e2942a3cf0ee8e0d3a330d2e5c2bdfb53 -# Parent ac9aa65050e9abc8f1c12c8603acf3b99e22cddc -x86-64: Fix off-by-one error in __addr_ok() macro - -Signed-off-by: Laszlo Ersek -Signed-off-by: Keir Fraser - -Index: xen-4.1.2-testing/xen/include/asm-x86/x86_64/uaccess.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/asm-x86/x86_64/uaccess.h -+++ xen-4.1.2-testing/xen/include/asm-x86/x86_64/uaccess.h -@@ -21,7 +21,7 @@ void free_compat_arg_xlat(struct vcpu *v - * non-canonical address (and thus fault) before ever reaching VIRT_START. - */ - #define __addr_ok(addr) \ -- (((unsigned long)(addr) < (1UL<<48)) || \ -+ (((unsigned long)(addr) < (1UL<<47)) || \ - ((unsigned long)(addr) >= HYPERVISOR_VIRT_END)) - - #define access_ok(addr, size) \ diff --git a/23804-x86-IPI-counts.patch b/23804-x86-IPI-counts.patch deleted file mode 100644 index 2ba983f..0000000 --- a/23804-x86-IPI-counts.patch +++ /dev/null @@ -1,109 +0,0 @@ -# HG changeset patch -# User Kevin Tian -# Date 1314800303 -3600 -# Node ID 42d76c68b2bfbedee3e5f79d32344e14bce48b0f -# Parent 51983821efa4db4040ae1c5063a4404791597699 -x86: add irq count for IPIs - -such count is useful to assist decision make in cpuidle governor, -while w/o this patch only device interrupts through do_IRQ is -currently counted. - -Signed-off-by: Kevin Tian - -Index: xen-4.1.3-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/apic.c -+++ xen-4.1.3-testing/xen/arch/x86/apic.c -@@ -1378,6 +1378,7 @@ fastcall void smp_apic_timer_interrupt(s - struct cpu_user_regs *old_regs = set_irq_regs(regs); - ack_APIC_irq(); - perfc_incr(apic_timer); -+ this_cpu(irq_count)++; - raise_softirq(TIMER_SOFTIRQ); - set_irq_regs(old_regs); - } -@@ -1399,6 +1400,7 @@ fastcall void smp_spurious_interrupt(str - unsigned long v; - struct cpu_user_regs *old_regs = set_irq_regs(regs); - -+ this_cpu(irq_count)++; - irq_enter(); - - /* -@@ -1434,6 +1436,7 @@ fastcall void smp_error_interrupt(struct - unsigned long v, v1; - struct cpu_user_regs *old_regs = set_irq_regs(regs); - -+ this_cpu(irq_count)++; - irq_enter(); - /* First tickle the hardware, only then report what went on. -- REW */ - v = apic_read(APIC_ESR); -@@ -1465,6 +1468,7 @@ fastcall void smp_pmu_apic_interrupt(str - { - struct cpu_user_regs *old_regs = set_irq_regs(regs); - ack_APIC_irq(); -+ this_cpu(irq_count)++; - hvm_do_pmu_interrupt(regs); - set_irq_regs(old_regs); - } -Index: xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce_intel.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/cpu/mcheck/mce_intel.c -+++ xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce_intel.c -@@ -66,6 +66,7 @@ static void (*vendor_thermal_interrupt)( - fastcall void smp_thermal_interrupt(struct cpu_user_regs *regs) - { - struct cpu_user_regs *old_regs = set_irq_regs(regs); -+ this_cpu(irq_count)++; - irq_enter(); - vendor_thermal_interrupt(regs); - irq_exit(); -@@ -1094,6 +1095,7 @@ fastcall void smp_cmci_interrupt(struct - struct cpu_user_regs *old_regs = set_irq_regs(regs); - - ack_APIC_irq(); -+ this_cpu(irq_count)++; - irq_enter(); - - mctc = mcheck_mca_logout( -Index: xen-4.1.3-testing/xen/arch/x86/io_apic.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/io_apic.c -+++ xen-4.1.3-testing/xen/arch/x86/io_apic.c -@@ -516,6 +516,7 @@ fastcall void smp_irq_move_cleanup_inter - struct cpu_user_regs *old_regs = set_irq_regs(regs); - - ack_APIC_irq(); -+ this_cpu(irq_count)++; - irq_enter(); - - me = smp_processor_id(); -Index: xen-4.1.3-testing/xen/arch/x86/smp.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/smp.c -+++ xen-4.1.3-testing/xen/arch/x86/smp.c -@@ -222,6 +222,7 @@ fastcall void smp_invalidate_interrupt(v - { - ack_APIC_irq(); - perfc_incr(ipis); -+ this_cpu(irq_count)++; - irq_enter(); - if ( !__sync_local_execstate() || - (flush_flags & (FLUSH_TLB_GLOBAL | FLUSH_CACHE)) ) -@@ -387,6 +388,7 @@ fastcall void smp_event_check_interrupt( - struct cpu_user_regs *old_regs = set_irq_regs(regs); - ack_APIC_irq(); - perfc_incr(ipis); -+ this_cpu(irq_count)++; - set_irq_regs(old_regs); - } - -@@ -423,6 +425,7 @@ fastcall void smp_call_function_interrup - - ack_APIC_irq(); - perfc_incr(ipis); -+ this_cpu(irq_count)++; - __smp_call_function_interrupt(); - set_irq_regs(old_regs); - } diff --git a/23817-mem_event_add_ref_counting_for_free_requestslots.patch b/23817-mem_event_add_ref_counting_for_free_requestslots.patch deleted file mode 100644 index 71145a2..0000000 --- a/23817-mem_event_add_ref_counting_for_free_requestslots.patch +++ /dev/null @@ -1,144 +0,0 @@ -changeset: 23817:083f10851dd8 -user: Olaf Hering -date: Mon Sep 05 15:10:09 2011 +0100 -files: xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_sharing.c xen/arch/x86/mm/p2m.c xen/include/asm-x86/mem_event.h xen/include/xen/sched.h -description: -mem_event: add ref counting for free requestslots - -If mem_event_check_ring() is called by many vcpus at the same time -before any of them called also mem_event_put_request(), all of the -callers must assume there are enough free slots available in the ring. - -Record the number of request producers in mem_event_check_ring() to -keep track of available free slots. - -Add a new mem_event_put_req_producers() function to release a request -attempt made in mem_event_check_ring(). Its required for -p2m_mem_paging_populate() because that function can only modify the -p2m type if there are free request slots. But in some cases -p2m_mem_paging_populate() does not actually have to produce another -request when it is known that the same request was already made -earlier by a different vcpu. - - -mem_event_check_ring() can not return a reference to a free request -slot because there could be multiple references for different vcpus -and the order of mem_event_put_request() calls is not known. As a -result, incomplete requests could be consumed by the ring user. - -Signed-off-by: Olaf Hering - - ---- - xen/arch/x86/mm/mem_event.c | 19 ++++++++++++------- - xen/arch/x86/mm/mem_sharing.c | 1 - - xen/arch/x86/mm/p2m.c | 1 + - xen/include/asm-x86/mem_event.h | 1 + - xen/include/xen/sched.h | 1 + - 5 files changed, 15 insertions(+), 8 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -@@ -37,8 +37,6 @@ - #define mem_event_ring_lock(_d) spin_lock(&(_d)->mem_event.ring_lock) - #define mem_event_ring_unlock(_d) spin_unlock(&(_d)->mem_event.ring_lock) - --#define MEM_EVENT_RING_THRESHOLD 4 -- - static int mem_event_enable(struct domain *d, mfn_t ring_mfn, mfn_t shared_mfn) - { - int rc; -@@ -109,6 +107,7 @@ void mem_event_put_request(struct domain - req_prod++; - - /* Update ring */ -+ d->mem_event.req_producers--; - front_ring->req_prod_pvt = req_prod; - RING_PUSH_REQUESTS(front_ring); - -@@ -153,11 +152,18 @@ void mem_event_mark_and_pause(struct vcp - vcpu_sleep_nosync(v); - } - -+void mem_event_put_req_producers(struct domain *d) -+{ -+ mem_event_ring_lock(d); -+ d->mem_event.req_producers--; -+ mem_event_ring_unlock(d); -+} -+ - int mem_event_check_ring(struct domain *d) - { - struct vcpu *curr = current; - int free_requests; -- int ring_full; -+ int ring_full = 1; - - if ( !d->mem_event.ring_page ) - return -1; -@@ -165,12 +171,11 @@ int mem_event_check_ring(struct domain * - mem_event_ring_lock(d); - - free_requests = RING_FREE_REQUESTS(&d->mem_event.front_ring); -- if ( unlikely(free_requests < 2) ) -+ if ( d->mem_event.req_producers < free_requests ) - { -- gdprintk(XENLOG_INFO, "free request slots: %d\n", free_requests); -- WARN_ON(free_requests == 0); -+ d->mem_event.req_producers++; -+ ring_full = 0; - } -- ring_full = free_requests < MEM_EVENT_RING_THRESHOLD ? 1 : 0; - - if ( (curr->domain->domain_id == d->domain_id) && ring_full ) - { -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -@@ -322,7 +322,6 @@ static struct page_info* mem_sharing_all - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; - } - -- /* XXX: Need to reserve a request, not just check the ring! */ - if(mem_event_check_ring(d)) return page; - - req.gfn = gfn; -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2976,6 +2976,7 @@ void p2m_mem_paging_populate(struct p2m_ - else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) - { - /* gfn is already on its way back and vcpu is not paused */ -+ mem_event_put_req_producers(d); - return; - } - -Index: xen-4.1.3-testing/xen/include/asm-x86/mem_event.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/mem_event.h -+++ xen-4.1.3-testing/xen/include/asm-x86/mem_event.h -@@ -27,6 +27,7 @@ - /* Pauses VCPU while marking pause flag for mem event */ - void mem_event_mark_and_pause(struct vcpu *v); - int mem_event_check_ring(struct domain *d); -+void mem_event_put_req_producers(struct domain *d); - void mem_event_put_request(struct domain *d, mem_event_request_t *req); - void mem_event_get_response(struct domain *d, mem_event_response_t *rsp); - void mem_event_unpause_vcpus(struct domain *d); -Index: xen-4.1.3-testing/xen/include/xen/sched.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/sched.h -+++ xen-4.1.3-testing/xen/include/xen/sched.h -@@ -190,6 +190,7 @@ struct mem_event_domain - { - /* ring lock */ - spinlock_t ring_lock; -+ unsigned int req_producers; - /* shared page */ - mem_event_shared_page_t *shared_page; - /* shared ring page */ diff --git a/23818-mem_event_use_mem_event_mark_and_pause_in_mem_event_check_ring.patch b/23818-mem_event_use_mem_event_mark_and_pause_in_mem_event_check_ring.patch deleted file mode 100644 index 0237ec1..0000000 --- a/23818-mem_event_use_mem_event_mark_and_pause_in_mem_event_check_ring.patch +++ /dev/null @@ -1,30 +0,0 @@ -changeset: 23818:0268e7380953 -user: Olaf Hering -date: Mon Sep 05 15:10:28 2011 +0100 -files: xen/arch/x86/mm/mem_event.c -description: -mem_event: use mem_event_mark_and_pause() in mem_event_check_ring() - -Signed-off-by: Olaf Hering - - ---- - xen/arch/x86/mm/mem_event.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -@@ -178,10 +178,7 @@ int mem_event_check_ring(struct domain * - } - - if ( (curr->domain->domain_id == d->domain_id) && ring_full ) -- { -- set_bit(_VPF_mem_event, &curr->pause_flags); -- vcpu_sleep_nosync(curr); -- } -+ mem_event_mark_and_pause(curr); - - mem_event_ring_unlock(d); - diff --git a/23827-xenpaging_use_batch_of_pages_during_final_page-in.patch b/23827-xenpaging_use_batch_of_pages_during_final_page-in.patch deleted file mode 100644 index 0ea6592..0000000 --- a/23827-xenpaging_use_batch_of_pages_during_final_page-in.patch +++ /dev/null @@ -1,178 +0,0 @@ -changeset: 23827:d1d6abc1db20 -user: Olaf Hering -date: Tue Sep 13 10:25:32 2011 +0100 -files: tools/xenpaging/pagein.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: use batch of pages during final page-in - -Map up to RING_SIZE pages in exit path to fill the ring instead of -populating one page at a time. - -Signed-off-by: Olaf Hering - - ---- - tools/xenpaging/pagein.c | 36 ++++++++++++++++++++++++------------ - tools/xenpaging/xenpaging.c | 18 +++++++++++++----- - tools/xenpaging/xenpaging.h | 7 +++++-- - 3 files changed, 42 insertions(+), 19 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/pagein.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/pagein.c -+++ xen-4.1.2-testing/tools/xenpaging/pagein.c -@@ -1,14 +1,16 @@ - /* Trigger a page-in in a separate thread-of-execution to avoid deadlock */ - #include --#include "xc_private.h" -+#include -+#include "xenpaging.h" - - struct page_in_args { - domid_t dom; -+ unsigned long *pagein_queue; - xc_interface *xch; - }; - - static struct page_in_args page_in_args; --static unsigned long page_in_gfn; -+static unsigned long page_in_request; - static unsigned int page_in_possible; - - static pthread_t page_in_thread; -@@ -19,19 +21,28 @@ static void *page_in(void *arg) - { - struct page_in_args *pia = arg; - void *page; -- xen_pfn_t gfn; -+ int i, num; -+ xen_pfn_t gfns[XENPAGING_PAGEIN_QUEUE_SIZE]; - - while (1) - { - pthread_mutex_lock(&page_in_mutex); -- while (!page_in_gfn) -+ while (!page_in_request) - pthread_cond_wait(&page_in_cond, &page_in_mutex); -- gfn = page_in_gfn; -- page_in_gfn = 0; -+ num = 0; -+ for (i = 0; i < XENPAGING_PAGEIN_QUEUE_SIZE; i++) -+ { -+ if (!pia->pagein_queue[i]) -+ continue; -+ gfns[num] = pia->pagein_queue[i]; -+ pia->pagein_queue[i] = 0; -+ num++; -+ } -+ page_in_request = 0; - pthread_mutex_unlock(&page_in_mutex); - - /* Ignore errors */ -- page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, &gfn, 1); -+ page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, gfns, num); - if (page) - munmap(page, PAGE_SIZE); - } -@@ -39,21 +50,22 @@ static void *page_in(void *arg) - pthread_exit(NULL); - } - --void page_in_trigger(unsigned long gfn) -+void page_in_trigger(void) - { - if (!page_in_possible) - return; - - pthread_mutex_lock(&page_in_mutex); -- page_in_gfn = gfn; -+ page_in_request = 1; - pthread_mutex_unlock(&page_in_mutex); - pthread_cond_signal(&page_in_cond); - } - --void create_page_in_thread(domid_t domain_id, xc_interface *xch) -+void create_page_in_thread(xenpaging_t *paging) - { -- page_in_args.dom = domain_id; -- page_in_args.xch = xch; -+ page_in_args.dom = paging->mem_event.domain_id; -+ page_in_args.pagein_queue = paging->pagein_queue; -+ page_in_args.xch = paging->xc_handle; - if (pthread_create(&page_in_thread, NULL, page_in, &page_in_args) == 0) - page_in_possible = 1; - } -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -648,7 +648,7 @@ int main(int argc, char *argv[]) - sigaction(SIGALRM, &act, NULL); - - /* listen for page-in events to stop pager */ -- create_page_in_thread(paging->mem_event.domain_id, xch); -+ create_page_in_thread(paging); - - /* Evict pages */ - for ( i = 0; i < paging->num_pages; i++ ) -@@ -764,16 +764,24 @@ int main(int argc, char *argv[]) - /* Write all pages back into the guest */ - if ( interrupted == SIGTERM || interrupted == SIGINT ) - { -+ int num = 0; - for ( i = 0; i < paging->domain_info->max_pages; i++ ) - { - if ( test_bit(i, paging->bitmap) ) - { -- page_in_trigger(i); -- break; -+ paging->pagein_queue[num] = i; -+ num++; -+ if ( num == XENPAGING_PAGEIN_QUEUE_SIZE ) -+ break; - } - } -- /* If no more pages to process, exit loop */ -- if ( i == paging->domain_info->max_pages ) -+ /* -+ * One more round if there are still pages to process. -+ * If no more pages to process, exit loop. -+ */ -+ if ( num ) -+ page_in_trigger(); -+ else if ( i == paging->domain_info->max_pages ) - break; - } - else -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -29,6 +29,8 @@ - #include - #include - -+#define XENPAGING_PAGEIN_QUEUE_SIZE 64 -+ - typedef struct mem_event { - domid_t domain_id; - xc_evtchn *xce_handle; -@@ -49,6 +51,7 @@ typedef struct xenpaging { - mem_event_t mem_event; - int num_pages; - int policy_mru_size; -+ unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE]; - } xenpaging_t; - - -@@ -58,8 +61,8 @@ typedef struct xenpaging_victim { - } xenpaging_victim_t; - - --extern void create_page_in_thread(domid_t domain_id, xc_interface *xch); --extern void page_in_trigger(unsigned long gfn); -+extern void create_page_in_thread(xenpaging_t *paging); -+extern void page_in_trigger(void); - - #endif // __XEN_PAGING_H__ - diff --git a/23841-mem_event_pass_mem_event_domain_pointer_to_mem_event_functions.patch b/23841-mem_event_pass_mem_event_domain_pointer_to_mem_event_functions.patch deleted file mode 100644 index 55100b1..0000000 --- a/23841-mem_event_pass_mem_event_domain_pointer_to_mem_event_functions.patch +++ /dev/null @@ -1,405 +0,0 @@ -changeset: 23841:ed7586b1d515 -user: Olaf Hering -date: Fri Sep 16 12:13:31 2011 +0100 -files: xen/arch/x86/hvm/hvm.c xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_sharing.c xen/arch/x86/mm/p2m.c xen/include/asm-x86/mem_event.h -description: -mem_event: pass mem_event_domain pointer to mem_event functions - -Pass a struct mem_event_domain pointer to the various mem_event -functions. This will be used in a subsequent patch which creates -different ring buffers for the memshare, xenpaging and memaccess -functionality. - -Remove the struct domain argument from some functions. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/hvm/hvm.c | 4 - - xen/arch/x86/mm/mem_event.c | 95 ++++++++++++++++++++-------------------- - xen/arch/x86/mm/mem_sharing.c | 6 +- - xen/arch/x86/mm/p2m.c | 18 +++---- - xen/include/asm-x86/mem_event.h | 8 +-- - 5 files changed, 66 insertions(+), 65 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -3920,7 +3920,7 @@ static int hvm_memory_event_traps(long p - if ( (p & HVMPME_onchangeonly) && (value == old) ) - return 1; - -- rc = mem_event_check_ring(d); -+ rc = mem_event_check_ring(d, &d->mem_event); - if ( rc ) - return rc; - -@@ -3943,7 +3943,7 @@ static int hvm_memory_event_traps(long p - req.gla_valid = 1; - } - -- mem_event_put_request(d, &req); -+ mem_event_put_request(d, &d->mem_event, &req); - - return 1; - } -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -@@ -33,21 +33,21 @@ - #define xen_rmb() rmb() - #define xen_wmb() wmb() - --#define mem_event_ring_lock_init(_d) spin_lock_init(&(_d)->mem_event.ring_lock) --#define mem_event_ring_lock(_d) spin_lock(&(_d)->mem_event.ring_lock) --#define mem_event_ring_unlock(_d) spin_unlock(&(_d)->mem_event.ring_lock) -+#define mem_event_ring_lock_init(_med) spin_lock_init(&(_med)->ring_lock) -+#define mem_event_ring_lock(_med) spin_lock(&(_med)->ring_lock) -+#define mem_event_ring_unlock(_med) spin_unlock(&(_med)->ring_lock) - --static int mem_event_enable(struct domain *d, mfn_t ring_mfn, mfn_t shared_mfn) -+static int mem_event_enable(struct domain *d, struct mem_event_domain *med, mfn_t ring_mfn, mfn_t shared_mfn) - { - int rc; - - /* Map ring and shared pages */ -- d->mem_event.ring_page = map_domain_page(mfn_x(ring_mfn)); -- if ( d->mem_event.ring_page == NULL ) -+ med->ring_page = map_domain_page(mfn_x(ring_mfn)); -+ if ( med->ring_page == NULL ) - goto err; - -- d->mem_event.shared_page = map_domain_page(mfn_x(shared_mfn)); -- if ( d->mem_event.shared_page == NULL ) -+ med->shared_page = map_domain_page(mfn_x(shared_mfn)); -+ if ( med->shared_page == NULL ) - goto err_ring; - - /* Allocate event channel */ -@@ -56,15 +56,15 @@ static int mem_event_enable(struct domai - if ( rc < 0 ) - goto err_shared; - -- ((mem_event_shared_page_t *)d->mem_event.shared_page)->port = rc; -- d->mem_event.xen_port = rc; -+ ((mem_event_shared_page_t *)med->shared_page)->port = rc; -+ med->xen_port = rc; - - /* Prepare ring buffer */ -- FRONT_RING_INIT(&d->mem_event.front_ring, -- (mem_event_sring_t *)d->mem_event.ring_page, -+ FRONT_RING_INIT(&med->front_ring, -+ (mem_event_sring_t *)med->ring_page, - PAGE_SIZE); - -- mem_event_ring_lock_init(d); -+ mem_event_ring_lock_init(med); - - /* Wake any VCPUs paused for memory events */ - mem_event_unpause_vcpus(d); -@@ -72,34 +72,34 @@ static int mem_event_enable(struct domai - return 0; - - err_shared: -- unmap_domain_page(d->mem_event.shared_page); -- d->mem_event.shared_page = NULL; -+ unmap_domain_page(med->shared_page); -+ med->shared_page = NULL; - err_ring: -- unmap_domain_page(d->mem_event.ring_page); -- d->mem_event.ring_page = NULL; -+ unmap_domain_page(med->ring_page); -+ med->ring_page = NULL; - err: - return 1; - } - --static int mem_event_disable(struct domain *d) -+static int mem_event_disable(struct mem_event_domain *med) - { -- unmap_domain_page(d->mem_event.ring_page); -- d->mem_event.ring_page = NULL; -+ unmap_domain_page(med->ring_page); -+ med->ring_page = NULL; - -- unmap_domain_page(d->mem_event.shared_page); -- d->mem_event.shared_page = NULL; -+ unmap_domain_page(med->shared_page); -+ med->shared_page = NULL; - - return 0; - } - --void mem_event_put_request(struct domain *d, mem_event_request_t *req) -+void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req) - { - mem_event_front_ring_t *front_ring; - RING_IDX req_prod; - -- mem_event_ring_lock(d); -+ mem_event_ring_lock(med); - -- front_ring = &d->mem_event.front_ring; -+ front_ring = &med->front_ring; - req_prod = front_ring->req_prod_pvt; - - /* Copy request */ -@@ -107,23 +107,23 @@ void mem_event_put_request(struct domain - req_prod++; - - /* Update ring */ -- d->mem_event.req_producers--; -+ med->req_producers--; - front_ring->req_prod_pvt = req_prod; - RING_PUSH_REQUESTS(front_ring); - -- mem_event_ring_unlock(d); -+ mem_event_ring_unlock(med); - -- notify_via_xen_event_channel(d, d->mem_event.xen_port); -+ notify_via_xen_event_channel(d, med->xen_port); - } - --void mem_event_get_response(struct domain *d, mem_event_response_t *rsp) -+void mem_event_get_response(struct mem_event_domain *med, mem_event_response_t *rsp) - { - mem_event_front_ring_t *front_ring; - RING_IDX rsp_cons; - -- mem_event_ring_lock(d); -+ mem_event_ring_lock(med); - -- front_ring = &d->mem_event.front_ring; -+ front_ring = &med->front_ring; - rsp_cons = front_ring->rsp_cons; - - /* Copy response */ -@@ -134,7 +134,7 @@ void mem_event_get_response(struct domai - front_ring->rsp_cons = rsp_cons; - front_ring->sring->rsp_event = rsp_cons + 1; - -- mem_event_ring_unlock(d); -+ mem_event_ring_unlock(med); - } - - void mem_event_unpause_vcpus(struct domain *d) -@@ -152,35 +152,35 @@ void mem_event_mark_and_pause(struct vcp - vcpu_sleep_nosync(v); - } - --void mem_event_put_req_producers(struct domain *d) -+void mem_event_put_req_producers(struct mem_event_domain *med) - { -- mem_event_ring_lock(d); -- d->mem_event.req_producers--; -- mem_event_ring_unlock(d); -+ mem_event_ring_lock(med); -+ med->req_producers--; -+ mem_event_ring_unlock(med); - } - --int mem_event_check_ring(struct domain *d) -+int mem_event_check_ring(struct domain *d, struct mem_event_domain *med) - { - struct vcpu *curr = current; - int free_requests; - int ring_full = 1; - -- if ( !d->mem_event.ring_page ) -+ if ( !med->ring_page ) - return -1; - -- mem_event_ring_lock(d); -+ mem_event_ring_lock(med); - -- free_requests = RING_FREE_REQUESTS(&d->mem_event.front_ring); -- if ( d->mem_event.req_producers < free_requests ) -+ free_requests = RING_FREE_REQUESTS(&med->front_ring); -+ if ( med->req_producers < free_requests ) - { -- d->mem_event.req_producers++; -+ med->req_producers++; - ring_full = 0; - } - -- if ( (curr->domain->domain_id == d->domain_id) && ring_full ) -+ if ( ring_full && (curr->domain == d) ) - mem_event_mark_and_pause(curr); - -- mem_event_ring_unlock(d); -+ mem_event_ring_unlock(med); - - return ring_full; - } -@@ -230,6 +230,7 @@ int mem_event_domctl(struct domain *d, x - { - struct domain *dom_mem_event = current->domain; - struct vcpu *v = current; -+ struct mem_event_domain *med = &d->mem_event; - unsigned long ring_addr = mec->ring_addr; - unsigned long shared_addr = mec->shared_addr; - l1_pgentry_t l1e; -@@ -242,7 +243,7 @@ int mem_event_domctl(struct domain *d, x - * the cache is in an undefined state and so is the guest - */ - rc = -EBUSY; -- if ( d->mem_event.ring_page ) -+ if ( med->ring_page ) - break; - - /* Currently only EPT is supported */ -@@ -270,7 +271,7 @@ int mem_event_domctl(struct domain *d, x - break; - - rc = -EINVAL; -- if ( mem_event_enable(d, ring_mfn, shared_mfn) != 0 ) -+ if ( mem_event_enable(d, med, ring_mfn, shared_mfn) != 0 ) - break; - - rc = 0; -@@ -279,7 +280,7 @@ int mem_event_domctl(struct domain *d, x - - case XEN_DOMCTL_MEM_EVENT_OP_DISABLE: - { -- rc = mem_event_disable(d); -+ rc = mem_event_disable(&d->mem_event); - } - break; - -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; - } - -- if(mem_event_check_ring(d)) return page; -+ if(mem_event_check_ring(d, &d->mem_event)) return page; - - req.gfn = gfn; - req.p2mt = p2m_ram_shared; - req.vcpu_id = v->vcpu_id; -- mem_event_put_request(d, &req); -+ mem_event_put_request(d, &d->mem_event, &req); - - return page; - } -@@ -342,7 +342,7 @@ int mem_sharing_sharing_resume(struct do - mem_event_response_t rsp; - - /* Get request off the ring */ -- mem_event_get_response(d, &rsp); -+ mem_event_get_response(&d->mem_event, &rsp); - - /* Unpause domain/vcpu */ - if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2929,7 +2929,7 @@ void p2m_mem_paging_drop_page(struct p2m - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d) == 0) -+ if ( mem_event_check_ring(d, &d->mem_event) == 0) - { - /* Send release notification to pager */ - memset(&req, 0, sizeof(req)); -@@ -2937,7 +2937,7 @@ void p2m_mem_paging_drop_page(struct p2m - req.gfn = gfn; - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &req); -+ mem_event_put_request(d, &d->mem_event, &req); - } - } - -@@ -2949,7 +2949,7 @@ void p2m_mem_paging_populate(struct p2m_ - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d) ) -+ if ( mem_event_check_ring(d, &d->mem_event) ) - return; - - memset(&req, 0, sizeof(req)); -@@ -2976,7 +2976,7 @@ void p2m_mem_paging_populate(struct p2m_ - else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) - { - /* gfn is already on its way back and vcpu is not paused */ -- mem_event_put_req_producers(d); -+ mem_event_put_req_producers(&d->mem_event); - return; - } - -@@ -2985,7 +2985,7 @@ void p2m_mem_paging_populate(struct p2m_ - req.p2mt = p2mt; - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &req); -+ mem_event_put_request(d, &d->mem_event, &req); - } - - int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) -@@ -3014,7 +3014,7 @@ void p2m_mem_paging_resume(struct p2m_do - mfn_t mfn; - - /* Pull the response off the ring */ -- mem_event_get_response(d, &rsp); -+ mem_event_get_response(&d->mem_event, &rsp); - - /* Fix p2m entry if the page was not dropped */ - if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) -@@ -3061,7 +3061,7 @@ void p2m_mem_access_check(paddr_t gpa, b - p2m_unlock(p2m); - - /* Otherwise, check if there is a memory event listener, and send the message along */ -- res = mem_event_check_ring(d); -+ res = mem_event_check_ring(d, &d->mem_event); - if ( res < 0 ) - { - /* No listener */ -@@ -3105,7 +3105,7 @@ void p2m_mem_access_check(paddr_t gpa, b - - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &req); -+ mem_event_put_request(d, &d->mem_event, &req); - - /* VCPU paused, mem event request sent */ - } -@@ -3115,7 +3115,7 @@ void p2m_mem_access_resume(struct p2m_do - struct domain *d = p2m->domain; - mem_event_response_t rsp; - -- mem_event_get_response(d, &rsp); -+ mem_event_get_response(&d->mem_event, &rsp); - - /* Unpause domain */ - if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) -Index: xen-4.1.3-testing/xen/include/asm-x86/mem_event.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/mem_event.h -+++ xen-4.1.3-testing/xen/include/asm-x86/mem_event.h -@@ -26,10 +26,10 @@ - - /* Pauses VCPU while marking pause flag for mem event */ - void mem_event_mark_and_pause(struct vcpu *v); --int mem_event_check_ring(struct domain *d); --void mem_event_put_req_producers(struct domain *d); --void mem_event_put_request(struct domain *d, mem_event_request_t *req); --void mem_event_get_response(struct domain *d, mem_event_response_t *rsp); -+int mem_event_check_ring(struct domain *d, struct mem_event_domain *med); -+void mem_event_put_req_producers(struct mem_event_domain *med); -+void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req); -+void mem_event_get_response(struct mem_event_domain *med, mem_event_response_t *rsp); - void mem_event_unpause_vcpus(struct domain *d); - - int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec, diff --git a/23842-mem_event_use_different_ringbuffers_for_share_paging_and_access.patch b/23842-mem_event_use_different_ringbuffers_for_share_paging_and_access.patch deleted file mode 100644 index 22bb845..0000000 --- a/23842-mem_event_use_different_ringbuffers_for_share_paging_and_access.patch +++ /dev/null @@ -1,868 +0,0 @@ -changeset: 23842:483c5f8319ad -user: Olaf Hering -date: Fri Sep 16 12:19:26 2011 +0100 -files: tools/libxc/Makefile tools/libxc/xc_mem_access.c tools/libxc/xc_mem_event.c tools/libxc/xc_mem_paging.c tools/libxc/xc_memshr.c tools/libxc/xenctrl.h tools/tests/xen-access/xen-access.c tools/xenpaging/xenpaging.c xen/arch/ia64/xen/dom0_ops.c xen/arch/x86/hvm/hvm.c xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_paging.c xen/arch/x86/mm/mem_sharing.c xen/arch/x86/mm/p2m.c xen/include/public/domctl.h xen/include/xen/sched.h -description: -mem_event: use different ringbuffers for share, paging and access - -Up to now a single ring buffer was used for mem_share, xenpaging and -xen-access. Each helper would have to cooperate and pull only its own -requests from the ring. Unfortunately this was not implemented. And -even if it was, it would make the whole concept fragile because a crash -or early exit of one helper would stall the others. - -What happend up to now is that active xenpaging + memory_sharing would -push memsharing requests in the buffer. xenpaging is not prepared for -such requests. - -This patch creates an independet ring buffer for mem_share, xenpaging -and xen-access and adds also new functions to enable xenpaging and -xen-access. The xc_mem_event_enable/xc_mem_event_disable functions will -be removed. The various XEN_DOMCTL_MEM_EVENT_* macros were cleaned up. -Due to the removal the API changed, so the SONAME will be changed too. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Acked-by: Ian Jackson -Committed-by: Tim Deegan - - ---- - tools/libxc/Makefile | 2 - tools/libxc/xc_mem_access.c | 21 ++++ - tools/libxc/xc_mem_event.c | 15 --- - tools/libxc/xc_mem_paging.c | 33 +++++-- - tools/libxc/xc_memshr.c | 16 +-- - tools/libxc/xenctrl.h | 9 + - tools/tests/xen-access/xen-access.c | 4 - tools/xenpaging/xenpaging.c | 4 - xen/arch/ia64/xen/dom0_ops.c | 2 - xen/arch/x86/hvm/hvm.c | 4 - xen/arch/x86/mm/mem_event.c | 163 ++++++++++++++++++++---------------- - xen/arch/x86/mm/mem_sharing.c | 22 ++-- - xen/arch/x86/mm/p2m.c | 18 +-- - xen/include/public/domctl.h | 43 +++++---- - xen/include/xen/sched.h | 6 + - 15 files changed, 206 insertions(+), 156 deletions(-) - -Index: xen-4.1.3-testing/tools/libxc/Makefile -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/Makefile -+++ xen-4.1.3-testing/tools/libxc/Makefile -@@ -1,7 +1,7 @@ - XEN_ROOT = $(CURDIR)/../.. - include $(XEN_ROOT)/tools/Rules.mk - --MAJOR = 4.0 -+MAJOR = 4.2 - MINOR = 0 - - CTRL_SRCS-y := -Index: xen-4.1.3-testing/tools/libxc/xc_mem_access.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_mem_access.c -+++ xen-4.1.3-testing/tools/libxc/xc_mem_access.c -@@ -24,12 +24,29 @@ - #include "xc_private.h" - - -+int xc_mem_access_enable(xc_interface *xch, domid_t domain_id, -+ void *shared_page, void *ring_page) -+{ -+ return xc_mem_event_control(xch, domain_id, -+ XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE, -+ XEN_DOMCTL_MEM_EVENT_OP_ACCESS, -+ shared_page, ring_page, INVALID_MFN); -+} -+ -+int xc_mem_access_disable(xc_interface *xch, domid_t domain_id) -+{ -+ return xc_mem_event_control(xch, domain_id, -+ XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE, -+ XEN_DOMCTL_MEM_EVENT_OP_ACCESS, -+ NULL, NULL, INVALID_MFN); -+} -+ - int xc_mem_access_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn) - { - return xc_mem_event_control(xch, domain_id, - XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME, -- XEN_DOMCTL_MEM_EVENT_OP_ACCESS, NULL, NULL, -- gfn); -+ XEN_DOMCTL_MEM_EVENT_OP_ACCESS, -+ NULL, NULL, gfn); - } - - /* -Index: xen-4.1.3-testing/tools/libxc/xc_mem_event.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_mem_event.c -+++ xen-4.1.3-testing/tools/libxc/xc_mem_event.c -@@ -42,18 +42,3 @@ int xc_mem_event_control(xc_interface *x - return do_domctl(xch, &domctl); - } - --int xc_mem_event_enable(xc_interface *xch, domid_t domain_id, -- void *shared_page, void *ring_page) --{ -- return xc_mem_event_control(xch, domain_id, -- XEN_DOMCTL_MEM_EVENT_OP_ENABLE, 0, -- shared_page, ring_page, INVALID_MFN); --} -- --int xc_mem_event_disable(xc_interface *xch, domid_t domain_id) --{ -- return xc_mem_event_control(xch, domain_id, -- XEN_DOMCTL_MEM_EVENT_OP_DISABLE, 0, -- NULL, NULL, INVALID_MFN); --} -- -Index: xen-4.1.3-testing/tools/libxc/xc_mem_paging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_mem_paging.c -+++ xen-4.1.3-testing/tools/libxc/xc_mem_paging.c -@@ -24,36 +24,53 @@ - #include "xc_private.h" - - -+int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id, -+ void *shared_page, void *ring_page) -+{ -+ return xc_mem_event_control(xch, domain_id, -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE, -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING, -+ shared_page, ring_page, INVALID_MFN); -+} -+ -+int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id) -+{ -+ return xc_mem_event_control(xch, domain_id, -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE, -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING, -+ NULL, NULL, INVALID_MFN); -+} -+ - int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, unsigned long gfn) - { - return xc_mem_event_control(xch, domain_id, - XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE, -- XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL, -- gfn); -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING, -+ NULL, NULL, gfn); - } - - int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn) - { - return xc_mem_event_control(xch, domain_id, - XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT, -- XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL, -- gfn); -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING, -+ NULL, NULL, gfn); - } - - int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn) - { - return xc_mem_event_control(xch, domain_id, - XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP, -- XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL, -- gfn); -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING, -+ NULL, NULL, gfn); - } - - int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn) - { - return xc_mem_event_control(xch, domain_id, - XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME, -- XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL, -- gfn); -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING, -+ NULL, NULL, gfn); - } - - -Index: xen-4.1.3-testing/tools/libxc/xc_memshr.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_memshr.c -+++ xen-4.1.3-testing/tools/libxc/xc_memshr.c -@@ -36,7 +36,7 @@ int xc_memshr_control(xc_interface *xch, - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = (domid_t)domid; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_CONTROL; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL; - op->u.enable = enable; - - return do_domctl(xch, &domctl); -@@ -55,7 +55,7 @@ int xc_memshr_nominate_gfn(xc_interface - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = (domid_t)domid; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN; - op->u.nominate.u.gfn = gfn; - - ret = do_domctl(xch, &domctl); -@@ -77,7 +77,7 @@ int xc_memshr_nominate_gref(xc_interface - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = (domid_t)domid; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF; - op->u.nominate.u.grant_ref = gref; - - ret = do_domctl(xch, &domctl); -@@ -97,7 +97,7 @@ int xc_memshr_share(xc_interface *xch, - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = 0; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_SHARE; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE; - op->u.share.source_handle = source_handle; - op->u.share.client_handle = client_handle; - -@@ -114,7 +114,7 @@ int xc_memshr_domain_resume(xc_interface - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = (domid_t)domid; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_RESUME; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME; - - return do_domctl(xch, &domctl); - } -@@ -130,7 +130,7 @@ int xc_memshr_debug_gfn(xc_interface *xc - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = (domid_t)domid; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN; - op->u.debug.u.gfn = gfn; - - return do_domctl(xch, &domctl); -@@ -147,7 +147,7 @@ int xc_memshr_debug_mfn(xc_interface *xc - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = (domid_t)domid; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN; - op->u.debug.u.mfn = mfn; - - return do_domctl(xch, &domctl); -@@ -164,7 +164,7 @@ int xc_memshr_debug_gref(xc_interface *x - domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; - domctl.domain = (domid_t)domid; - op = &(domctl.u.mem_sharing_op); -- op->op = XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF; -+ op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF; - op->u.debug.u.gref = gref; - - return do_domctl(xch, &domctl); -Index: xen-4.1.3-testing/tools/libxc/xenctrl.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xenctrl.h -+++ xen-4.1.3-testing/tools/libxc/xenctrl.h -@@ -1734,16 +1734,19 @@ int xc_mem_event_control(xc_interface *x - unsigned int mode, void *shared_page, - void *ring_page, unsigned long gfn); - --int xc_mem_event_enable(xc_interface *xch, domid_t domain_id, -+int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id, - void *shared_page, void *ring_page); --int xc_mem_event_disable(xc_interface *xch, domid_t domain_id); -- -+int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id); - int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, - unsigned long gfn); - int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn); - int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn); - int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, - unsigned long gfn); -+ -+int xc_mem_access_enable(xc_interface *xch, domid_t domain_id, -+ void *shared_page, void *ring_page); -+int xc_mem_access_disable(xc_interface *xch, domid_t domain_id); - int xc_mem_access_resume(xc_interface *xch, domid_t domain_id, - unsigned long gfn); - -Index: xen-4.1.3-testing/tools/tests/xen-access/xen-access.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/tests/xen-access/xen-access.c -+++ xen-4.1.3-testing/tools/tests/xen-access/xen-access.c -@@ -241,7 +241,7 @@ xenaccess_t *xenaccess_init(xc_interface - mem_event_ring_lock_init(&xenaccess->mem_event); - - /* Initialise Xen */ -- rc = xc_mem_event_enable(xenaccess->xc_handle, xenaccess->mem_event.domain_id, -+ rc = xc_mem_access_enable(xenaccess->xc_handle, xenaccess->mem_event.domain_id, - xenaccess->mem_event.shared_page, - xenaccess->mem_event.ring_page); - if ( rc != 0 ) -@@ -351,7 +351,7 @@ int xenaccess_teardown(xc_interface *xch - return 0; - - /* Tear down domain xenaccess in Xen */ -- rc = xc_mem_event_disable(xenaccess->xc_handle, xenaccess->mem_event.domain_id); -+ rc = xc_mem_access_disable(xenaccess->xc_handle, xenaccess->mem_event.domain_id); - if ( rc != 0 ) - { - ERROR("Error tearing down domain xenaccess in xen"); -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c -@@ -234,7 +234,7 @@ static xenpaging_t *xenpaging_init(domid - PAGE_SIZE); - - /* Initialise Xen */ -- rc = xc_mem_event_enable(xch, paging->mem_event.domain_id, -+ rc = xc_mem_paging_enable(xch, paging->mem_event.domain_id, - paging->mem_event.shared_page, - paging->mem_event.ring_page); - if ( rc != 0 ) -@@ -353,7 +353,7 @@ static int xenpaging_teardown(xenpaging_ - xch = paging->xc_handle; - paging->xc_handle = NULL; - /* Tear down domain paging in Xen */ -- rc = xc_mem_event_disable(xch, paging->mem_event.domain_id); -+ rc = xc_mem_paging_disable(xch, paging->mem_event.domain_id); - if ( rc != 0 ) - { - ERROR("Error tearing down domain paging in xen"); -Index: xen-4.1.3-testing/xen/arch/ia64/xen/dom0_ops.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/ia64/xen/dom0_ops.c -+++ xen-4.1.3-testing/xen/arch/ia64/xen/dom0_ops.c -@@ -688,7 +688,7 @@ long arch_do_domctl(xen_domctl_t *op, XE - - switch(mec->op) - { -- case XEN_DOMCTL_MEM_SHARING_OP_CONTROL: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL: - { - if (mec->u.enable) { - ret = -EINVAL; /* not implemented */ -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -3920,7 +3920,7 @@ static int hvm_memory_event_traps(long p - if ( (p & HVMPME_onchangeonly) && (value == old) ) - return 1; - -- rc = mem_event_check_ring(d, &d->mem_event); -+ rc = mem_event_check_ring(d, &d->mem_access); - if ( rc ) - return rc; - -@@ -3943,7 +3943,7 @@ static int hvm_memory_event_traps(long p - req.gla_valid = 1; - } - -- mem_event_put_request(d, &d->mem_event, &req); -+ mem_event_put_request(d, &d->mem_access, &req); - - return 1; - } -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -@@ -37,24 +37,52 @@ - #define mem_event_ring_lock(_med) spin_lock(&(_med)->ring_lock) - #define mem_event_ring_unlock(_med) spin_unlock(&(_med)->ring_lock) - --static int mem_event_enable(struct domain *d, struct mem_event_domain *med, mfn_t ring_mfn, mfn_t shared_mfn) -+static int mem_event_enable(struct domain *d, -+ xen_domctl_mem_event_op_t *mec, -+ struct mem_event_domain *med) - { - int rc; -+ struct domain *dom_mem_event = current->domain; -+ struct vcpu *v = current; -+ unsigned long ring_addr = mec->ring_addr; -+ unsigned long shared_addr = mec->shared_addr; -+ l1_pgentry_t l1e; -+ unsigned long gfn; -+ p2m_type_t p2mt; -+ mfn_t ring_mfn; -+ mfn_t shared_mfn; -+ -+ /* Only one helper at a time. If the helper crashed, -+ * the ring is in an undefined state and so is the guest. -+ */ -+ if ( med->ring_page ) -+ return -EBUSY; -+ -+ /* Get MFN of ring page */ -+ guest_get_eff_l1e(v, ring_addr, &l1e); -+ gfn = l1e_get_pfn(l1e); -+ ring_mfn = gfn_to_mfn(p2m_get_hostp2m(dom_mem_event), gfn, &p2mt); -+ -+ if ( unlikely(!mfn_valid(mfn_x(ring_mfn))) ) -+ return -EINVAL; -+ -+ /* Get MFN of shared page */ -+ guest_get_eff_l1e(v, shared_addr, &l1e); -+ gfn = l1e_get_pfn(l1e); -+ shared_mfn = gfn_to_mfn(p2m_get_hostp2m(dom_mem_event), gfn, &p2mt); -+ -+ if ( unlikely(!mfn_valid(mfn_x(shared_mfn))) ) -+ return -EINVAL; - - /* Map ring and shared pages */ - med->ring_page = map_domain_page(mfn_x(ring_mfn)); -- if ( med->ring_page == NULL ) -- goto err; -- - med->shared_page = map_domain_page(mfn_x(shared_mfn)); -- if ( med->shared_page == NULL ) -- goto err_ring; - - /* Allocate event channel */ - rc = alloc_unbound_xen_event_channel(d->vcpu[0], - current->domain->domain_id); - if ( rc < 0 ) -- goto err_shared; -+ goto err; - - ((mem_event_shared_page_t *)med->shared_page)->port = rc; - med->xen_port = rc; -@@ -71,14 +99,14 @@ static int mem_event_enable(struct domai - - return 0; - -- err_shared: -+ err: - unmap_domain_page(med->shared_page); - med->shared_page = NULL; -- err_ring: -+ - unmap_domain_page(med->ring_page); - med->ring_page = NULL; -- err: -- return 1; -+ -+ return rc; - } - - static int mem_event_disable(struct mem_event_domain *med) -@@ -220,86 +248,79 @@ int mem_event_domctl(struct domain *d, x - - rc = -ENOSYS; - -- switch ( mec-> mode ) -+ switch ( mec->mode ) - { -- case 0: -+ case XEN_DOMCTL_MEM_EVENT_OP_PAGING: - { -+ struct mem_event_domain *med = &d->mem_paging; -+ rc = -ENODEV; -+ /* Only HAP is supported */ -+ if ( !hap_enabled(d) ) -+ break; -+ -+ /* Currently only EPT is supported */ -+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) -+ break; -+ - switch( mec->op ) - { -- case XEN_DOMCTL_MEM_EVENT_OP_ENABLE: -+ case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE: - { -- struct domain *dom_mem_event = current->domain; -- struct vcpu *v = current; -- struct mem_event_domain *med = &d->mem_event; -- unsigned long ring_addr = mec->ring_addr; -- unsigned long shared_addr = mec->shared_addr; -- l1_pgentry_t l1e; -- unsigned long gfn; -- p2m_type_t p2mt; -- mfn_t ring_mfn; -- mfn_t shared_mfn; -- -- /* Only one xenpaging at a time. If xenpaging crashed, -- * the cache is in an undefined state and so is the guest -- */ -- rc = -EBUSY; -- if ( med->ring_page ) -- break; -- -- /* Currently only EPT is supported */ -- rc = -ENODEV; -- if ( !(hap_enabled(d) && -- (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) ) -- break; -- -- /* Get MFN of ring page */ -- guest_get_eff_l1e(v, ring_addr, &l1e); -- gfn = l1e_get_pfn(l1e); -- ring_mfn = gfn_to_mfn(p2m_get_hostp2m(dom_mem_event), gfn, &p2mt); -- -- rc = -EINVAL; -- if ( unlikely(!mfn_valid(mfn_x(ring_mfn))) ) -- break; -- -- /* Get MFN of shared page */ -- guest_get_eff_l1e(v, shared_addr, &l1e); -- gfn = l1e_get_pfn(l1e); -- shared_mfn = gfn_to_mfn(p2m_get_hostp2m(dom_mem_event), gfn, &p2mt); -- -- rc = -EINVAL; -- if ( unlikely(!mfn_valid(mfn_x(shared_mfn))) ) -- break; -- -- rc = -EINVAL; -- if ( mem_event_enable(d, med, ring_mfn, shared_mfn) != 0 ) -- break; -- -- rc = 0; -+ rc = mem_event_enable(d, mec, med); - } - break; - -- case XEN_DOMCTL_MEM_EVENT_OP_DISABLE: -+ case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE: - { -- rc = mem_event_disable(&d->mem_event); -+ rc = mem_event_disable(med); - } - break; - - default: -- rc = -ENOSYS; -- break; -+ { -+ if ( med->ring_page ) -+ rc = mem_paging_domctl(d, mec, u_domctl); - } - break; -+ } - } -- case XEN_DOMCTL_MEM_EVENT_OP_PAGING: -- { -- rc = mem_paging_domctl(d, mec, u_domctl); -- break; -- } -+ break; -+ - case XEN_DOMCTL_MEM_EVENT_OP_ACCESS: - { -- rc = mem_access_domctl(d, mec, u_domctl); -+ struct mem_event_domain *med = &d->mem_access; -+ rc = -ENODEV; -+ /* Only HAP is supported */ -+ if ( !hap_enabled(d) ) -+ break; -+ -+ /* Currently only EPT is supported */ -+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) -+ break; -+ -+ switch( mec->op ) -+ { -+ case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE: -+ { -+ rc = mem_event_enable(d, mec, med); -+ } -+ break; -+ -+ case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE: -+ { -+ rc = mem_event_disable(&d->mem_access); -+ } -+ break; -+ -+ default: -+ { -+ if ( med->ring_page ) -+ rc = mem_access_domctl(d, mec, u_domctl); -+ } - break; -+ } - } -+ break; - } - - return rc; -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; - } - -- if(mem_event_check_ring(d, &d->mem_event)) return page; -+ if(mem_event_check_ring(d, &d->mem_share)) return page; - - req.gfn = gfn; - req.p2mt = p2m_ram_shared; - req.vcpu_id = v->vcpu_id; -- mem_event_put_request(d, &d->mem_event, &req); -+ mem_event_put_request(d, &d->mem_share, &req); - - return page; - } -@@ -342,7 +342,7 @@ int mem_sharing_sharing_resume(struct do - mem_event_response_t rsp; - - /* Get request off the ring */ -- mem_event_get_response(&d->mem_event, &rsp); -+ mem_event_get_response(&d->mem_share, &rsp); - - /* Unpause domain/vcpu */ - if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) -@@ -739,7 +739,7 @@ int mem_sharing_domctl(struct domain *d, - - switch(mec->op) - { -- case XEN_DOMCTL_MEM_SHARING_OP_CONTROL: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL: - { - d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable; - mem_sharing_audit(); -@@ -747,7 +747,7 @@ int mem_sharing_domctl(struct domain *d, - } - break; - -- case XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN: - { - unsigned long gfn = mec->u.nominate.u.gfn; - shr_handle_t handle; -@@ -759,7 +759,7 @@ int mem_sharing_domctl(struct domain *d, - } - break; - -- case XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF: - { - grant_ref_t gref = mec->u.nominate.u.grant_ref; - unsigned long gfn; -@@ -776,7 +776,7 @@ int mem_sharing_domctl(struct domain *d, - } - break; - -- case XEN_DOMCTL_MEM_SHARING_OP_SHARE: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE: - { - shr_handle_t sh = mec->u.share.source_handle; - shr_handle_t ch = mec->u.share.client_handle; -@@ -785,7 +785,7 @@ int mem_sharing_domctl(struct domain *d, - } - break; - -- case XEN_DOMCTL_MEM_SHARING_OP_RESUME: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME: - { - if(!mem_sharing_enabled(d)) - return -EINVAL; -@@ -794,7 +794,7 @@ int mem_sharing_domctl(struct domain *d, - } - break; - -- case XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN: - { - unsigned long gfn = mec->u.debug.u.gfn; - rc = mem_sharing_debug_gfn(d, gfn); -@@ -802,7 +802,7 @@ int mem_sharing_domctl(struct domain *d, - } - break; - -- case XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN: - { - unsigned long mfn = mec->u.debug.u.mfn; - rc = mem_sharing_debug_mfn(mfn); -@@ -810,7 +810,7 @@ int mem_sharing_domctl(struct domain *d, - } - break; - -- case XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF: -+ case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF: - { - grant_ref_t gref = mec->u.debug.u.gref; - rc = mem_sharing_debug_gref(d, gref); -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2929,7 +2929,7 @@ void p2m_mem_paging_drop_page(struct p2m - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d, &d->mem_event) == 0) -+ if ( mem_event_check_ring(d, &d->mem_paging) == 0) - { - /* Send release notification to pager */ - memset(&req, 0, sizeof(req)); -@@ -2937,7 +2937,7 @@ void p2m_mem_paging_drop_page(struct p2m - req.gfn = gfn; - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &d->mem_event, &req); -+ mem_event_put_request(d, &d->mem_paging, &req); - } - } - -@@ -2949,7 +2949,7 @@ void p2m_mem_paging_populate(struct p2m_ - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d, &d->mem_event) ) -+ if ( mem_event_check_ring(d, &d->mem_paging) ) - return; - - memset(&req, 0, sizeof(req)); -@@ -2976,7 +2976,7 @@ void p2m_mem_paging_populate(struct p2m_ - else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) - { - /* gfn is already on its way back and vcpu is not paused */ -- mem_event_put_req_producers(&d->mem_event); -+ mem_event_put_req_producers(&d->mem_paging); - return; - } - -@@ -2985,7 +2985,7 @@ void p2m_mem_paging_populate(struct p2m_ - req.p2mt = p2mt; - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &d->mem_event, &req); -+ mem_event_put_request(d, &d->mem_paging, &req); - } - - int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) -@@ -3014,7 +3014,7 @@ void p2m_mem_paging_resume(struct p2m_do - mfn_t mfn; - - /* Pull the response off the ring */ -- mem_event_get_response(&d->mem_event, &rsp); -+ mem_event_get_response(&d->mem_paging, &rsp); - - /* Fix p2m entry if the page was not dropped */ - if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) -@@ -3061,7 +3061,7 @@ void p2m_mem_access_check(paddr_t gpa, b - p2m_unlock(p2m); - - /* Otherwise, check if there is a memory event listener, and send the message along */ -- res = mem_event_check_ring(d, &d->mem_event); -+ res = mem_event_check_ring(d, &d->mem_access); - if ( res < 0 ) - { - /* No listener */ -@@ -3105,7 +3105,7 @@ void p2m_mem_access_check(paddr_t gpa, b - - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &d->mem_event, &req); -+ mem_event_put_request(d, &d->mem_access, &req); - - /* VCPU paused, mem event request sent */ - } -@@ -3115,7 +3115,7 @@ void p2m_mem_access_resume(struct p2m_do - struct domain *d = p2m->domain; - mem_event_response_t rsp; - -- mem_event_get_response(&d->mem_event, &rsp); -+ mem_event_get_response(&d->mem_access, &rsp); - - /* Unpause domain */ - if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) -Index: xen-4.1.3-testing/xen/include/public/domctl.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/domctl.h -+++ xen-4.1.3-testing/xen/include/public/domctl.h -@@ -707,20 +707,18 @@ struct xen_domctl_gdbsx_domstatus { - - /* XEN_DOMCTL_mem_event_op */ - --/* Add and remove memory handlers */ --#define XEN_DOMCTL_MEM_EVENT_OP_ENABLE 0 --#define XEN_DOMCTL_MEM_EVENT_OP_DISABLE 1 -- - /* -+* Domain memory paging - * Page memory in and out. - */ - #define XEN_DOMCTL_MEM_EVENT_OP_PAGING 1 - --/* Domain memory paging */ --#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE 0 --#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT 1 --#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP 2 --#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME 3 -+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE 0 -+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE 1 -+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE 2 -+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT 3 -+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP 4 -+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME 5 - - /* - * Access permissions. -@@ -733,11 +731,14 @@ struct xen_domctl_gdbsx_domstatus { - * ACCESS_RESUME mode for the following domctl. - */ - #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS 2 --#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME 0 -+ -+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE 0 -+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE 1 -+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME 2 - - struct xen_domctl_mem_event_op { -- uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */ -- uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_ENABLE_* */ -+ uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_*_* */ -+ uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_OP_* */ - - /* OP_ENABLE */ - uint64_aligned_t shared_addr; /* IN: Virtual address of shared page */ -@@ -754,14 +755,16 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_e - */ - /* XEN_DOMCTL_mem_sharing_op */ - --#define XEN_DOMCTL_MEM_SHARING_OP_CONTROL 0 --#define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN 1 --#define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF 2 --#define XEN_DOMCTL_MEM_SHARING_OP_SHARE 3 --#define XEN_DOMCTL_MEM_SHARING_OP_RESUME 4 --#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN 5 --#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN 6 --#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF 7 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING 3 -+ -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL 0 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN 1 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF 2 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE 3 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME 4 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN 5 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN 6 -+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF 7 - - #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID (-10) - #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID (-9) -Index: xen-4.1.3-testing/xen/include/xen/sched.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/sched.h -+++ xen-4.1.3-testing/xen/include/xen/sched.h -@@ -326,8 +326,12 @@ struct domain - /* Non-migratable and non-restoreable? */ - bool_t disable_migrate; - -+ /* Memory sharing support */ -+ struct mem_event_domain mem_share; - /* Memory paging support */ -- struct mem_event_domain mem_event; -+ struct mem_event_domain mem_paging; -+ /* Memory access support */ -+ struct mem_event_domain mem_access; - - /* Currently computed from union of all vcpu cpu-affinity masks. */ - nodemask_t node_affinity; diff --git a/23874-xenpaging_track_number_of_paged_pages_in_struct_domain.patch b/23874-xenpaging_track_number_of_paged_pages_in_struct_domain.patch deleted file mode 100644 index 3c860b6..0000000 --- a/23874-xenpaging_track_number_of_paged_pages_in_struct_domain.patch +++ /dev/null @@ -1,122 +0,0 @@ -changeset: 23874:651aed73b39c -user: Olaf Hering -date: Mon Sep 26 22:19:42 2011 +0100 -files: tools/libxc/xc_domain.c tools/libxc/xenctrl.h xen/arch/x86/mm/p2m.c xen/common/domctl.c xen/include/public/domctl.h xen/include/xen/sched.h -description: -xenpaging: track number of paged pages in struct domain - -The toolstack should know how many pages are paged-out at a given point -in time so it could make smarter decisions about how many pages should -be paged or ballooned. - -Add a new member to xen_domctl_getdomaininfo and bump interface version. -Use the new member in xc_dominfo_t. -The SONAME of libxc should be changed if this patch gets applied. - -Signed-off-by: Olaf Hering -Acked-by: Ian Campbell -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - tools/libxc/xc_domain.c | 1 + - tools/libxc/xenctrl.h | 1 + - xen/arch/x86/mm/p2m.c | 5 +++++ - xen/common/domctl.c | 1 + - xen/include/public/domctl.h | 3 ++- - xen/include/xen/sched.h | 1 + - 6 files changed, 11 insertions(+), 1 deletion(-) - -Index: xen-4.1.3-testing/tools/libxc/xc_domain.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_domain.c -+++ xen-4.1.3-testing/tools/libxc/xc_domain.c -@@ -235,6 +235,7 @@ int xc_domain_getinfo(xc_interface *xch, - info->ssidref = domctl.u.getdomaininfo.ssidref; - info->nr_pages = domctl.u.getdomaininfo.tot_pages; - info->nr_shared_pages = domctl.u.getdomaininfo.shr_pages; -+ info->nr_paged_pages = domctl.u.getdomaininfo.paged_pages; - info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT-10); - info->shared_info_frame = domctl.u.getdomaininfo.shared_info_frame; - info->cpu_time = domctl.u.getdomaininfo.cpu_time; -Index: xen-4.1.3-testing/tools/libxc/xenctrl.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xenctrl.h -+++ xen-4.1.3-testing/tools/libxc/xenctrl.h -@@ -353,6 +353,7 @@ typedef struct xc_dominfo { - unsigned int shutdown_reason; /* only meaningful if shutdown==1 */ - unsigned long nr_pages; /* current number, not maximum */ - unsigned long nr_shared_pages; -+ unsigned long nr_paged_pages; - unsigned long shared_info_frame; - uint64_t cpu_time; - unsigned long max_memkb; -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2919,6 +2919,9 @@ int p2m_mem_paging_evict(struct p2m_doma - /* Put the page back so it gets freed */ - put_page(page); - -+ /* Track number of paged gfns */ -+ atomic_inc(&p2m->domain->paged_pages); -+ - return 0; - } - -@@ -3003,6 +3006,8 @@ int p2m_mem_paging_prep(struct p2m_domai - audit_p2m(p2m, 1); - p2m_unlock(p2m); - -+ atomic_dec(&p2m->domain->paged_pages); -+ - return 0; - } - -Index: xen-4.1.3-testing/xen/common/domctl.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/domctl.c -+++ xen-4.1.3-testing/xen/common/domctl.c -@@ -139,6 +139,7 @@ void getdomaininfo(struct domain *d, str - info->tot_pages = d->tot_pages; - info->max_pages = d->max_pages; - info->shr_pages = atomic_read(&d->shr_pages); -+ info->paged_pages = atomic_read(&d->paged_pages); - info->shared_info_frame = mfn_to_gmfn(d, __pa(d->shared_info)>>PAGE_SHIFT); - BUG_ON(SHARED_M2P(info->shared_info_frame)); - -Index: xen-4.1.3-testing/xen/include/public/domctl.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/domctl.h -+++ xen-4.1.3-testing/xen/include/public/domctl.h -@@ -35,7 +35,7 @@ - #include "xen.h" - #include "grant_table.h" - --#define XEN_DOMCTL_INTERFACE_VERSION 0x00000007 -+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000008 - - /* - * NB. xen_domctl.domain is an IN/OUT parameter for this operation. -@@ -95,6 +95,7 @@ struct xen_domctl_getdomaininfo { - uint64_aligned_t tot_pages; - uint64_aligned_t max_pages; - uint64_aligned_t shr_pages; -+ uint64_aligned_t paged_pages; - uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */ - uint64_aligned_t cpu_time; - uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ -Index: xen-4.1.3-testing/xen/include/xen/sched.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/sched.h -+++ xen-4.1.3-testing/xen/include/xen/sched.h -@@ -215,6 +215,7 @@ struct domain - unsigned int tot_pages; /* number of pages currently possesed */ - unsigned int max_pages; /* maximum value for tot_pages */ - atomic_t shr_pages; /* number of shared pages */ -+ atomic_t paged_pages; /* number of paged-out pages */ - unsigned int xenheap_pages; /* # pages allocated from Xen heap */ - - unsigned int max_vcpus; diff --git a/23897-x86-mce-offline-again.patch b/23897-x86-mce-offline-again.patch deleted file mode 100644 index 2d4bd63..0000000 --- a/23897-x86-mce-offline-again.patch +++ /dev/null @@ -1,69 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1317413803 -3600 -# Node ID 2215d7d7382617adbe97831fe35752a027917d1d -# Parent d568e2313fd6f055b66a6c3cb2bca6372b77692e -X86 MCE: Prevent malicious guest access broken page again - -To avoid recursive mce. - -Signed-off-by: Liu, Jinsong -Committed-by: Keir Fraser - -Index: xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/mce_intel.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/cpu/mcheck/mce_intel.c -+++ xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/mce_intel.c -@@ -639,6 +639,8 @@ static void intel_memerr_dhandler(int bn - /* This is free page */ - if (status & PG_OFFLINE_OFFLINED) - result->result = MCA_RECOVERED; -+ else if (status & PG_OFFLINE_AGAIN) -+ result->result = MCA_NO_ACTION; - else if (status & PG_OFFLINE_PENDING) { - /* This page has owner */ - if (status & PG_OFFLINE_OWNED) { -Index: xen-4.1.2-testing/xen/common/page_alloc.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/page_alloc.c -+++ xen-4.1.2-testing/xen/common/page_alloc.c -@@ -38,6 +38,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -708,6 +709,19 @@ int offline_page(unsigned long mfn, int - return -EINVAL; - } - -+ /* -+ * NB. When broken page belong to guest, usually hypervisor will -+ * notify the guest to handle the broken page. However, hypervisor -+ * need to prevent malicious guest access the broken page again. -+ * Under such case, hypervisor shutdown guest, preventing recursive mce. -+ */ -+ if ( (pg->count_info & PGC_broken) && (owner = page_get_owner(pg)) ) -+ { -+ *status = PG_OFFLINE_AGAIN; -+ domain_shutdown(owner, SHUTDOWN_crash); -+ return 0; -+ } -+ - spin_lock(&heap_lock); - - old_info = mark_page_offline(pg, broken); -Index: xen-4.1.2-testing/xen/include/public/sysctl.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/public/sysctl.h -+++ xen-4.1.2-testing/xen/include/public/sysctl.h -@@ -399,6 +399,7 @@ struct xen_sysctl_page_offline_op { - #define PG_OFFLINE_OFFLINED (0x1UL << 1) - #define PG_OFFLINE_PENDING (0x1UL << 2) - #define PG_OFFLINE_FAILED (0x1UL << 3) -+#define PG_OFFLINE_AGAIN (0x1UL << 4) - - #define PG_ONLINE_FAILED PG_OFFLINE_FAILED - #define PG_ONLINE_ONLINED PG_OFFLINE_OFFLINED diff --git a/23904-xenpaging_use_p2m-get_entry_in_p2m_mem_paging_functions.patch b/23904-xenpaging_use_p2m-get_entry_in_p2m_mem_paging_functions.patch deleted file mode 100644 index c7fdaf1..0000000 --- a/23904-xenpaging_use_p2m-get_entry_in_p2m_mem_paging_functions.patch +++ /dev/null @@ -1,131 +0,0 @@ -changeset: 23904:ecab267b85ef -user: Olaf Hering -date: Thu Oct 06 12:33:17 2011 +0100 -files: xen/arch/x86/mm/p2m.c -description: -xenpaging: use p2m->get_entry() in p2m_mem_paging functions - -Use p2m->get_entry() in the p2m_mem_paging functions. This preserves the -p2m_access type when gfn is updated with set_p2m_entry(). -Its also a preparation for locking fixes in a subsequent patch. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm/p2m.c | 25 ++++++++++++++++--------- - 1 file changed, 16 insertions(+), 9 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2845,10 +2845,11 @@ int p2m_mem_paging_nominate(struct p2m_d - { - struct page_info *page; - p2m_type_t p2mt; -+ p2m_access_t a; - mfn_t mfn; - int ret; - -- mfn = gfn_to_mfn(p2m, gfn, &p2mt); -+ mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - - /* Check if mfn is valid */ - ret = -EINVAL; -@@ -2875,7 +2876,7 @@ int p2m_mem_paging_nominate(struct p2m_d - - /* Fix p2m entry */ - p2m_lock(p2m); -- set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_out, p2m->default_access); -+ set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_out, a); - audit_p2m(p2m, 1); - p2m_unlock(p2m); - -@@ -2889,11 +2890,12 @@ int p2m_mem_paging_evict(struct p2m_doma - { - struct page_info *page; - p2m_type_t p2mt; -+ p2m_access_t a; - mfn_t mfn; - struct domain *d = p2m->domain; - - /* Get mfn */ -- mfn = gfn_to_mfn(p2m, gfn, &p2mt); -+ mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - if ( unlikely(!mfn_valid(mfn)) ) - return -EINVAL; - -@@ -2912,7 +2914,7 @@ int p2m_mem_paging_evict(struct p2m_doma - - /* Remove mapping from p2m table */ - p2m_lock(p2m); -- set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paged, p2m->default_access); -+ set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paged, a); - audit_p2m(p2m, 1); - p2m_unlock(p2m); - -@@ -2949,6 +2951,7 @@ void p2m_mem_paging_populate(struct p2m_ - struct vcpu *v = current; - mem_event_request_t req; - p2m_type_t p2mt; -+ p2m_access_t a; - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -@@ -2961,11 +2964,11 @@ void p2m_mem_paging_populate(struct p2m_ - /* Fix p2m mapping */ - /* XXX: It seems inefficient to have this here, as it's only needed - * in one case (ept guest accessing paging out page) */ -- gfn_to_mfn(p2m, gfn, &p2mt); -+ p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - if ( p2mt == p2m_ram_paged ) - { - p2m_lock(p2m); -- set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paging_in_start, p2m->default_access); -+ set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paging_in_start, a); - audit_p2m(p2m, 1); - p2m_unlock(p2m); - } -@@ -2994,7 +2997,10 @@ void p2m_mem_paging_populate(struct p2m_ - int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) - { - struct page_info *page; -+ p2m_type_t p2mt; -+ p2m_access_t a; - -+ p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - /* Get a free page */ - page = alloc_domheap_page(p2m->domain, 0); - if ( unlikely(page == NULL) ) -@@ -3002,7 +3008,7 @@ int p2m_mem_paging_prep(struct p2m_domai - - /* Fix p2m mapping */ - p2m_lock(p2m); -- set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, p2m->default_access); -+ set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, a); - audit_p2m(p2m, 1); - p2m_unlock(p2m); - -@@ -3016,6 +3022,7 @@ void p2m_mem_paging_resume(struct p2m_do - struct domain *d = p2m->domain; - mem_event_response_t rsp; - p2m_type_t p2mt; -+ p2m_access_t a; - mfn_t mfn; - - /* Pull the response off the ring */ -@@ -3024,9 +3031,9 @@ void p2m_mem_paging_resume(struct p2m_do - /* Fix p2m entry if the page was not dropped */ - if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) - { -- mfn = gfn_to_mfn(p2m, rsp.gfn, &p2mt); -+ mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query); - p2m_lock(p2m); -- set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, p2m->default_access); -+ set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a); - set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn); - audit_p2m(p2m, 1); - p2m_unlock(p2m); diff --git a/23905-xenpaging_fix_locking_in_p2m_mem_paging_functions.patch b/23905-xenpaging_fix_locking_in_p2m_mem_paging_functions.patch deleted file mode 100644 index 566ce42..0000000 --- a/23905-xenpaging_fix_locking_in_p2m_mem_paging_functions.patch +++ /dev/null @@ -1,157 +0,0 @@ -changeset: 23905:50ee6be56460 -user: Olaf Hering -date: Thu Oct 06 12:33:17 2011 +0100 -files: xen/arch/x86/mm/p2m.c -description: -xenpaging: fix locking in p2m_mem_paging functions - -As suggested by , query and adjust the p2mt -under the p2m_lock to prevent races with PoD. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm/p2m.c | 42 ++++++++++++++++++++++++++---------------- - 1 file changed, 26 insertions(+), 16 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2849,6 +2849,8 @@ int p2m_mem_paging_nominate(struct p2m_d - mfn_t mfn; - int ret; - -+ p2m_lock(p2m); -+ - mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - - /* Check if mfn is valid */ -@@ -2875,14 +2877,12 @@ int p2m_mem_paging_nominate(struct p2m_d - goto out; - - /* Fix p2m entry */ -- p2m_lock(p2m); - set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_out, a); - audit_p2m(p2m, 1); -- p2m_unlock(p2m); -- - ret = 0; - - out: -+ p2m_unlock(p2m); - return ret; - } - -@@ -2893,30 +2893,31 @@ int p2m_mem_paging_evict(struct p2m_doma - p2m_access_t a; - mfn_t mfn; - struct domain *d = p2m->domain; -+ int ret = -EINVAL; -+ -+ p2m_lock(p2m); - - /* Get mfn */ - mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - if ( unlikely(!mfn_valid(mfn)) ) -- return -EINVAL; -+ goto out; - - if ( (p2mt == p2m_ram_paged) || (p2mt == p2m_ram_paging_in) || - (p2mt == p2m_ram_paging_in_start) ) -- return -EINVAL; -+ goto out; - - /* Get the page so it doesn't get modified under Xen's feet */ - page = mfn_to_page(mfn); - if ( unlikely(!get_page(page, d)) ) -- return -EINVAL; -+ goto out; - - /* Decrement guest domain's ref count of the page */ - if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) - put_page(page); - - /* Remove mapping from p2m table */ -- p2m_lock(p2m); - set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paged, a); - audit_p2m(p2m, 1); -- p2m_unlock(p2m); - - /* Put the page back so it gets freed */ - put_page(page); -@@ -2924,7 +2925,11 @@ int p2m_mem_paging_evict(struct p2m_doma - /* Track number of paged gfns */ - atomic_inc(&p2m->domain->paged_pages); - -- return 0; -+ ret = 0; -+ -+ out: -+ p2m_unlock(p2m); -+ return ret; - } - - void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn) -@@ -2964,14 +2969,14 @@ void p2m_mem_paging_populate(struct p2m_ - /* Fix p2m mapping */ - /* XXX: It seems inefficient to have this here, as it's only needed - * in one case (ept guest accessing paging out page) */ -+ p2m_lock(p2m); - p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - if ( p2mt == p2m_ram_paged ) - { -- p2m_lock(p2m); - set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paging_in_start, a); - audit_p2m(p2m, 1); -- p2m_unlock(p2m); - } -+ p2m_unlock(p2m); - - /* Pause domain */ - if ( v->domain->domain_id == d->domain_id ) -@@ -2999,22 +3004,27 @@ int p2m_mem_paging_prep(struct p2m_domai - struct page_info *page; - p2m_type_t p2mt; - p2m_access_t a; -+ int ret = -ENOMEM; -+ -+ p2m_lock(p2m); - - p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); -+ - /* Get a free page */ - page = alloc_domheap_page(p2m->domain, 0); - if ( unlikely(page == NULL) ) -- return -ENOMEM; -+ goto out; - - /* Fix p2m mapping */ -- p2m_lock(p2m); - set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, a); - audit_p2m(p2m, 1); -- p2m_unlock(p2m); - - atomic_dec(&p2m->domain->paged_pages); - -- return 0; -+ ret = 0; -+ out: -+ p2m_unlock(p2m); -+ return ret; - } - - void p2m_mem_paging_resume(struct p2m_domain *p2m) -@@ -3031,8 +3041,8 @@ void p2m_mem_paging_resume(struct p2m_do - /* Fix p2m entry if the page was not dropped */ - if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) - { -- mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query); - p2m_lock(p2m); -+ mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query); - set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a); - set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn); - audit_p2m(p2m, 1); diff --git a/23906-xenpaging_remove_confusing_comment_from_p2m_mem_paging_populate.patch b/23906-xenpaging_remove_confusing_comment_from_p2m_mem_paging_populate.patch deleted file mode 100644 index 47af775..0000000 --- a/23906-xenpaging_remove_confusing_comment_from_p2m_mem_paging_populate.patch +++ /dev/null @@ -1,35 +0,0 @@ -changeset: 23906:7bf85c3fd9f0 -user: Olaf Hering -date: Thu Oct 06 12:33:17 2011 +0100 -files: xen/arch/x86/mm/p2m.c -description: -xenpaging: remove confusing comment from p2m_mem_paging_populate - -Currently there is no way to avoid the double check of the p2mt -because p2m_mem_paging_populate() is called from many places without -the p2m_lock held. Upcoming changes will move the function into -gfn_to_mfn(), so its interface could be changed and the extra -p2m_lock/get_entry can be removed. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm/p2m.c | 2 -- - 1 file changed, 2 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2967,8 +2967,6 @@ void p2m_mem_paging_populate(struct p2m_ - req.type = MEM_EVENT_TYPE_PAGING; - - /* Fix p2m mapping */ -- /* XXX: It seems inefficient to have this here, as it's only needed -- * in one case (ept guest accessing paging out page) */ - p2m_lock(p2m); - p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - if ( p2mt == p2m_ram_paged ) diff --git a/23933-pt-bus2bridge-update.patch b/23933-pt-bus2bridge-update.patch deleted file mode 100644 index 28dc248..0000000 --- a/23933-pt-bus2bridge-update.patch +++ /dev/null @@ -1,138 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1318231292 -7200 -# Node ID 0b81515b8e982e8012c28e5f8d9e965c63b6503d -# Parent 0c2bfd1f9c6822fbd23af0043f83d93be976323c -passthrough: update bus2bridge mapping as PCI devices get added/removed - -This deals with two limitations at once: On device removal, the -mapping did not get updated so far at all, and hotplugged devices as -well as such not discoverable by Xen's initial bus scan (including the -case where a non-zero PCI segment wasn't accessible during Xen boot, -but became accessible after Dom0 validated access information against -ACPI data) wouldn't cause updates to the mapping either. - -Signed-off-by: Jan Beulich -Acked-by: "Kay, Allen M" - ---- a/xen/drivers/passthrough/pci.c -+++ b/xen/drivers/passthrough/pci.c -@@ -63,11 +63,67 @@ static struct pci_dev *alloc_pdev(u8 bus - list_add(&pdev->alldevs_list, &alldevs_list); - spin_lock_init(&pdev->msix_table_lock); - -+ /* update bus2bridge */ -+ switch ( pdev_type(bus, devfn) ) -+ { -+ u8 sec_bus, sub_bus; -+ -+ case DEV_TYPE_PCIe_BRIDGE: -+ break; -+ -+ case DEV_TYPE_PCIe2PCI_BRIDGE: -+ case DEV_TYPE_LEGACY_PCI_BRIDGE: -+ sec_bus = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), -+ PCI_SECONDARY_BUS); -+ sub_bus = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), -+ PCI_SUBORDINATE_BUS); -+ -+ spin_lock(&bus2bridge_lock); -+ for ( ; sec_bus <= sub_bus; sec_bus++ ) -+ { -+ bus2bridge[sec_bus].map = 1; -+ bus2bridge[sec_bus].bus = bus; -+ bus2bridge[sec_bus].devfn = devfn; -+ } -+ spin_unlock(&bus2bridge_lock); -+ break; -+ -+ case DEV_TYPE_PCIe_ENDPOINT: -+ case DEV_TYPE_PCI: -+ break; -+ -+ default: -+ printk(XENLOG_WARNING "%s: unknown type: %02x:%02x.%u\n", -+ __func__, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); -+ break; -+ } -+ - return pdev; - } - - static void free_pdev(struct pci_dev *pdev) - { -+ /* update bus2bridge */ -+ switch ( pdev_type(pdev->bus, pdev->devfn) ) -+ { -+ u8 dev, func, sec_bus, sub_bus; -+ -+ case DEV_TYPE_PCIe2PCI_BRIDGE: -+ case DEV_TYPE_LEGACY_PCI_BRIDGE: -+ dev = PCI_SLOT(pdev->devfn); -+ func = PCI_FUNC(pdev->devfn); -+ sec_bus = pci_conf_read8(pdev->bus, dev, func, -+ PCI_SECONDARY_BUS); -+ sub_bus = pci_conf_read8(pdev->bus, dev, func, -+ PCI_SUBORDINATE_BUS); -+ -+ spin_lock(&bus2bridge_lock); -+ for ( ; sec_bus <= sub_bus; sec_bus++ ) -+ bus2bridge[sec_bus] = bus2bridge[pdev->bus]; -+ spin_unlock(&bus2bridge_lock); -+ break; -+ } -+ - list_del(&pdev->alldevs_list); - xfree(pdev); - } -@@ -432,8 +488,6 @@ int __init scan_pci_devices(void) - { - struct pci_dev *pdev; - int bus, dev, func; -- u8 sec_bus, sub_bus; -- int type; - - spin_lock(&pcidevs_lock); - for ( bus = 0; bus < 256; bus++ ) -@@ -453,41 +507,6 @@ int __init scan_pci_devices(void) - return -ENOMEM; - } - -- /* build bus2bridge */ -- type = pdev_type(bus, PCI_DEVFN(dev, func)); -- switch ( type ) -- { -- case DEV_TYPE_PCIe_BRIDGE: -- break; -- -- case DEV_TYPE_PCIe2PCI_BRIDGE: -- case DEV_TYPE_LEGACY_PCI_BRIDGE: -- sec_bus = pci_conf_read8(bus, dev, func, -- PCI_SECONDARY_BUS); -- sub_bus = pci_conf_read8(bus, dev, func, -- PCI_SUBORDINATE_BUS); -- -- spin_lock(&bus2bridge_lock); -- for ( sub_bus &= 0xff; sec_bus <= sub_bus; sec_bus++ ) -- { -- bus2bridge[sec_bus].map = 1; -- bus2bridge[sec_bus].bus = bus; -- bus2bridge[sec_bus].devfn = PCI_DEVFN(dev, func); -- } -- spin_unlock(&bus2bridge_lock); -- break; -- -- case DEV_TYPE_PCIe_ENDPOINT: -- case DEV_TYPE_PCI: -- break; -- -- default: -- printk("%s: unknown type: bdf = %x:%x.%x\n", -- __func__, bus, dev, func); -- spin_unlock(&pcidevs_lock); -- return -EINVAL; -- } -- - if ( !func && !(pci_conf_read8(bus, dev, func, - PCI_HEADER_TYPE) & 0x80) ) - break; diff --git a/23943-xenpaging_clear_page_content_after_evict.patch b/23943-xenpaging_clear_page_content_after_evict.patch deleted file mode 100644 index ebe6d3f..0000000 --- a/23943-xenpaging_clear_page_content_after_evict.patch +++ /dev/null @@ -1,53 +0,0 @@ -changeset: 23943:1185ae04b5aa -user: Olaf Hering -date: Tue Oct 11 10:46:28 2011 +0100 -files: tools/xenpaging/xenpaging.c xen/arch/x86/mm/p2m.c -description: -xenpaging: clear page content after evict - -If the guest happens to read from the gfn while xenpaging is in the process of -evicting the page, the guest may read zeros instead of actual data. -Also if eviction fails the page content will be corrupted and xenpaging wont -attempt to restore the page. - -Remove page scrubbing from pager and do it after successful eviction. - -Signed-off-by: Olaf Hering -Acked-by: Ian Jackson -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - tools/xenpaging/xenpaging.c | 3 --- - xen/arch/x86/mm/p2m.c | 3 +++ - 2 files changed, 3 insertions(+), 3 deletions(-) - -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c -@@ -455,9 +455,6 @@ static int xenpaging_evict_page(xenpagin - goto out; - } - -- /* Clear page */ -- memset(page, 0, PAGE_SIZE); -- - munmap(page, PAGE_SIZE); - - /* Tell Xen to evict page */ -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2919,6 +2919,9 @@ int p2m_mem_paging_evict(struct p2m_doma - set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paged, a); - audit_p2m(p2m, 1); - -+ /* Clear content before returning the page to Xen */ -+ scrub_one_page(page); -+ - /* Put the page back so it gets freed */ - put_page(page); - diff --git a/23944-pygrub-debug.patch b/23944-pygrub-debug.patch deleted file mode 100644 index ebfe8bb..0000000 --- a/23944-pygrub-debug.patch +++ /dev/null @@ -1,73 +0,0 @@ -# HG changeset patch -# User Guido Gunther -# Date 1318330978 -3600 -# Node ID 4b0907c6a08c348962bd976c2976257b412408be -# Parent 1185ae04b5aad429fd68d1872f404791df627965 -pygrub: add debug flag - -Debugging config file errors is tedious so help a bit by not silently -dropping parsing exceptions when --debug is given. Also intialize the -logging API at debug level in this case. - -Signed-off-by: Guido Gunther -Acked-by: Ian Campbell -Committed-by: Ian Jackson - -Index: xen-4.1.3-testing/tools/pygrub/src/pygrub -=================================================================== ---- xen-4.1.3-testing.orig/tools/pygrub/src/pygrub -+++ xen-4.1.3-testing/tools/pygrub/src/pygrub -@@ -13,7 +13,7 @@ - # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - # - --import os, sys, string, struct, tempfile, re -+import os, sys, string, struct, tempfile, re, traceback - import copy - import logging - import platform -@@ -674,7 +674,7 @@ if __name__ == "__main__": - ["quiet", "interactive", "not-really", "help", - "output=", "output-format=", "output-directory=", - "entry=", "kernel=", -- "ramdisk=", "args=", "isconfig"]) -+ "ramdisk=", "args=", "isconfig", "debug"]) - except getopt.GetoptError: - usage() - sys.exit(1) -@@ -688,6 +688,7 @@ if __name__ == "__main__": - entry = None - interactive = True - isconfig = False -+ debug = False - not_really = False - output_format = "sxp" - output_directory = "/var/run/xend/boot" -@@ -723,6 +724,8 @@ if __name__ == "__main__": - interactive = False - elif o in ("--isconfig",): - isconfig = True -+ elif o in ("--debug",): -+ debug = True - elif o in ("--output-format",): - if a not in ["sxp", "simple", "simple0"]: - print "unkonwn output format %s" % a -@@ -732,6 +735,9 @@ if __name__ == "__main__": - elif o in ("--output-directory",): - output_directory = a - -+ if debug: -+ logging.basicConfig(level=logging.DEBUG) -+ - if output is None or output == "-": - fd = sys.stdout.fileno() - else: -@@ -778,6 +784,8 @@ if __name__ == "__main__": - except: - # IOErrors raised by fsimage.open - # RuntimeErrors raised by run_grub if no menu.lst present -+ if debug: -+ traceback.print_exc() - fs = None - continue - diff --git a/23949-constify_vcpu_set_affinitys_second_parameter.patch b/23949-constify_vcpu_set_affinitys_second_parameter.patch deleted file mode 100644 index 1e7eed6..0000000 --- a/23949-constify_vcpu_set_affinitys_second_parameter.patch +++ /dev/null @@ -1,127 +0,0 @@ -changeset: 23949:39df16923958 -user: Jan Beulich -date: Thu Oct 13 10:00:13 2011 +0200 -files: xen/arch/x86/cpu/mcheck/vmce.c xen/arch/x86/traps.c xen/common/schedule.c xen/include/xen/sched.h -description: -constify vcpu_set_affinity()'s second parameter - -None of the callers actually make use of the function's returning of -the old affinity through its second parameter, and eliminating this -capability allows some callers to no longer use a local variable here, -reducing their stack footprint significantly when building with large -NR_CPUS. - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - - ---- - xen/arch/x86/cpu/mcheck/vmce.c | 5 +---- - xen/arch/x86/traps.c | 10 ++-------- - xen/common/schedule.c | 6 ++---- - xen/include/xen/sched.h | 2 +- - 4 files changed, 6 insertions(+), 17 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/vmce.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/cpu/mcheck/vmce.c -+++ xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/vmce.c -@@ -304,7 +304,6 @@ int vmce_wrmsr(u32 msr, u64 val) - int inject_vmce(struct domain *d) - { - int cpu = smp_processor_id(); -- cpumask_t affinity; - - /* PV guest and HVM guest have different vMCE# injection methods. */ - if ( !test_and_set_bool(d->vcpu[0]->mce_pending) ) -@@ -323,11 +322,9 @@ int inject_vmce(struct domain *d) - { - d->vcpu[0]->cpu_affinity_tmp = - d->vcpu[0]->cpu_affinity; -- cpus_clear(affinity); -- cpu_set(cpu, affinity); - mce_printk(MCE_VERBOSE, "MCE: CPU%d set affinity, old %d\n", - cpu, d->vcpu[0]->processor); -- vcpu_set_affinity(d->vcpu[0], &affinity); -+ vcpu_set_affinity(d->vcpu[0], cpumask_of(cpu)); - vcpu_kick(d->vcpu[0]); - } - else -Index: xen-4.1.3-testing/xen/arch/x86/traps.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/traps.c -+++ xen-4.1.3-testing/xen/arch/x86/traps.c -@@ -3106,7 +3106,6 @@ static void nmi_mce_softirq(void) - { - int cpu = smp_processor_id(); - struct softirq_trap *st = &per_cpu(softirq_trap, cpu); -- cpumask_t affinity; - - BUG_ON(st == NULL); - BUG_ON(st->vcpu == NULL); -@@ -3122,9 +3121,7 @@ static void nmi_mce_softirq(void) - * Make sure to wakeup the vcpu on the - * specified processor. - */ -- cpus_clear(affinity); -- cpu_set(st->processor, affinity); -- vcpu_set_affinity(st->vcpu, &affinity); -+ vcpu_set_affinity(st->vcpu, cpumask_of(st->processor)); - - /* Affinity is restored in the iret hypercall. */ - } -@@ -3199,14 +3196,11 @@ void async_exception_cleanup(struct vcpu - !test_and_set_bool(curr->mce_pending) ) - { - int cpu = smp_processor_id(); -- cpumask_t affinity; - - curr->cpu_affinity_tmp = curr->cpu_affinity; -- cpus_clear(affinity); -- cpu_set(cpu, affinity); - printk(XENLOG_DEBUG "MCE: CPU%d set affinity, old %d\n", - cpu, curr->processor); -- vcpu_set_affinity(curr, &affinity); -+ vcpu_set_affinity(curr, cpumask_of(cpu)); - } - } - } -Index: xen-4.1.3-testing/xen/common/schedule.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/schedule.c -+++ xen-4.1.3-testing/xen/common/schedule.c -@@ -598,9 +598,9 @@ int cpu_disable_scheduler(unsigned int c - return ret; - } - --int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity) -+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity) - { -- cpumask_t online_affinity, old_affinity; -+ cpumask_t online_affinity; - cpumask_t *online; - - if ( v->domain->is_pinned ) -@@ -612,9 +612,7 @@ int vcpu_set_affinity(struct vcpu *v, cp - - vcpu_schedule_lock_irq(v); - -- old_affinity = v->cpu_affinity; - v->cpu_affinity = *affinity; -- *affinity = old_affinity; - if ( !cpu_isset(v->processor, v->cpu_affinity) ) - set_bit(_VPF_migrating, &v->pause_flags); - -Index: xen-4.1.3-testing/xen/include/xen/sched.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/sched.h -+++ xen-4.1.3-testing/xen/include/xen/sched.h -@@ -624,7 +624,7 @@ void scheduler_free(struct scheduler *sc - int schedule_cpu_switch(unsigned int cpu, struct cpupool *c); - void vcpu_force_reschedule(struct vcpu *v); - int cpu_disable_scheduler(unsigned int cpu); --int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity); -+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity); - - void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate); - uint64_t get_cpu_idle_time(unsigned int cpu); diff --git a/23953-xenpaging_handle_evict_failures.patch b/23953-xenpaging_handle_evict_failures.patch deleted file mode 100644 index a0e2148..0000000 --- a/23953-xenpaging_handle_evict_failures.patch +++ /dev/null @@ -1,232 +0,0 @@ -changeset: 23953:eda18b27de6e -user: Olaf Hering -date: Thu Oct 13 12:21:10 2011 +0100 -files: tools/xenpaging/xenpaging.c xen/arch/x86/mm.c xen/arch/x86/mm/p2m.c xen/include/public/mem_event.h -description: -xenpaging: handle evict failures - -Evict of a nominated gfn must fail if some other process mapped the -page without checking the p2mt of that gfn first. -Add a check to cancel eviction if the page usage count is not 1. - -Handle the possible eviction failure in the page-in paths. -After nominate and before evict, something may check the p2mt and call -populate. Handle this case and let the gfn enter the page-in path. The -gfn may still be connected to a mfn, so there is no need to allocate a -new page in prep. - -Adjust do_mmu_update to return -ENOENT only if the gfn has entered the -page-in path and if it is not yet connected to a mfn. Otherwise -linux_privcmd_map_foreign_bulk() may loop forever. - -Add MEM_EVENT_FLAG_EVICT_FAIL to inform pager that a page-in request for -a possible not-evicted page was sent. xenpaging does currently not need -that flag because failure to evict a gfn will be caught. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - tools/xenpaging/xenpaging.c | 10 ++++--- - xen/arch/x86/mm.c | 8 ++--- - xen/arch/x86/mm/p2m.c | 55 +++++++++++++++++++++++++++++------------ - xen/include/public/mem_event.h | 1 - 4 files changed, 50 insertions(+), 24 deletions(-) - -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c -@@ -734,10 +734,12 @@ int main(int argc, char *argv[]) - } - else - { -- DPRINTF("page already populated (domain = %d; vcpu = %d;" -- " gfn = %"PRIx64"; paused = %d)\n", -- paging->mem_event.domain_id, req.vcpu_id, -- req.gfn, req.flags & MEM_EVENT_FLAG_VCPU_PAUSED); -+ DPRINTF("page %s populated (domain = %d; vcpu = %d;" -+ " gfn = %"PRIx64"; paused = %d; evict_fail = %d)\n", -+ req.flags & MEM_EVENT_FLAG_EVICT_FAIL ? "not" : "already", -+ paging->mem_event.domain_id, req.vcpu_id, req.gfn, -+ !!(req.flags & MEM_EVENT_FLAG_VCPU_PAUSED) , -+ !!(req.flags & MEM_EVENT_FLAG_EVICT_FAIL) ); - - /* Tell Xen to resume the vcpu */ - /* XXX: Maybe just check if the vcpu was paused? */ -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -3504,7 +3504,7 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l1e_p2mt ) -+ else if ( p2m_ram_paging_in_start == l1e_p2mt && !mfn_valid(mfn) ) - { - rc = -ENOENT; - break; -@@ -3545,7 +3545,7 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l2e_p2mt ) -+ else if ( p2m_ram_paging_in_start == l2e_p2mt && !mfn_valid(mfn) ) - { - rc = -ENOENT; - break; -@@ -3574,7 +3574,7 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l3e_p2mt ) -+ else if ( p2m_ram_paging_in_start == l3e_p2mt && !mfn_valid(mfn) ) - { - rc = -ENOENT; - break; -@@ -3604,7 +3604,7 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l4e_p2mt ) -+ else if ( p2m_ram_paging_in_start == l4e_p2mt && !mfn_valid(mfn) ) - { - rc = -ENOENT; - break; -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2902,15 +2902,24 @@ int p2m_mem_paging_evict(struct p2m_doma - if ( unlikely(!mfn_valid(mfn)) ) - goto out; - -- if ( (p2mt == p2m_ram_paged) || (p2mt == p2m_ram_paging_in) || -- (p2mt == p2m_ram_paging_in_start) ) -+ /* Allow only nominated pages */ -+ if ( p2mt != p2m_ram_paging_out ) - goto out; - -+ ret = -EBUSY; - /* Get the page so it doesn't get modified under Xen's feet */ - page = mfn_to_page(mfn); - if ( unlikely(!get_page(page, d)) ) - goto out; - -+ /* Check page count and type once more */ -+ if ( (page->count_info & (PGC_count_mask | PGC_allocated)) != -+ (2 | PGC_allocated) ) -+ goto out_put; -+ -+ if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none ) -+ goto out_put; -+ - /* Decrement guest domain's ref count of the page */ - if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) - put_page(page); -@@ -2922,14 +2931,15 @@ int p2m_mem_paging_evict(struct p2m_doma - /* Clear content before returning the page to Xen */ - scrub_one_page(page); - -- /* Put the page back so it gets freed */ -- put_page(page); -- - /* Track number of paged gfns */ - atomic_inc(&p2m->domain->paged_pages); - - ret = 0; - -+ out_put: -+ /* Put the page back so it gets freed */ -+ put_page(page); -+ - out: - p2m_unlock(p2m); - return ret; -@@ -2960,6 +2970,7 @@ void p2m_mem_paging_populate(struct p2m_ - mem_event_request_t req; - p2m_type_t p2mt; - p2m_access_t a; -+ mfn_t mfn; - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -@@ -2971,20 +2982,26 @@ void p2m_mem_paging_populate(struct p2m_ - - /* Fix p2m mapping */ - p2m_lock(p2m); -- p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); -- if ( p2mt == p2m_ram_paged ) -+ mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); -+ /* Allow only nominated or evicted pages to enter page-in path */ -+ if ( p2mt == p2m_ram_paging_out || p2mt == p2m_ram_paged ) - { -- set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paging_in_start, a); -+ /* Evict will fail now, tag this request for pager */ -+ if ( p2mt == p2m_ram_paging_out ) -+ req.flags |= MEM_EVENT_FLAG_EVICT_FAIL; -+ -+ set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in_start, a); - audit_p2m(p2m, 1); - } - p2m_unlock(p2m); - -- /* Pause domain */ -- if ( v->domain->domain_id == d->domain_id ) -+ /* Pause domain if request came from guest and gfn has paging type */ -+ if ( p2m_is_paging(p2mt) && v->domain->domain_id == d->domain_id ) - { - vcpu_pause_nosync(v); - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; - } -+ /* No need to inform pager if the gfn is not in the page-out path */ - else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) - { - /* gfn is already on its way back and vcpu is not paused */ -@@ -3005,19 +3022,25 @@ int p2m_mem_paging_prep(struct p2m_domai - struct page_info *page; - p2m_type_t p2mt; - p2m_access_t a; -+ mfn_t mfn; - int ret = -ENOMEM; - - p2m_lock(p2m); - -- p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); -+ mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - -- /* Get a free page */ -- page = alloc_domheap_page(p2m->domain, 0); -- if ( unlikely(page == NULL) ) -- goto out; -+ /* Allocate a page if the gfn does not have one yet */ -+ if ( !mfn_valid(mfn) ) -+ { -+ /* Get a free page */ -+ page = alloc_domheap_page(p2m->domain, 0); -+ if ( unlikely(page == NULL) ) -+ goto out; -+ mfn = page_to_mfn(page); -+ } - - /* Fix p2m mapping */ -- set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, a); -+ set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in, a); - audit_p2m(p2m, 1); - - atomic_dec(&p2m->domain->paged_pages); -Index: xen-4.1.3-testing/xen/include/public/mem_event.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/mem_event.h -+++ xen-4.1.3-testing/xen/include/public/mem_event.h -@@ -38,6 +38,7 @@ - /* Memory event flags */ - #define MEM_EVENT_FLAG_VCPU_PAUSED (1 << 0) - #define MEM_EVENT_FLAG_DROP_PAGE (1 << 1) -+#define MEM_EVENT_FLAG_EVICT_FAIL (1 << 2) - - /* Reasons for the memory event request */ - #define MEM_EVENT_REASON_UNKNOWN 0 /* typical reason */ diff --git a/23957-cpufreq-error-paths.patch b/23957-cpufreq-error-paths.patch deleted file mode 100644 index dd2cfa4..0000000 --- a/23957-cpufreq-error-paths.patch +++ /dev/null @@ -1,62 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1318580154 -7200 -# Node ID de316831471a8e0f11f615e7bf336dee2ba811e7 -# Parent a65693f9fb1250ff4819774a70284693705db9e7 -cpufreq: error path fixes - -This fixes an actual bug (failure to exit from a function after an -allocation failure), an inconsistency (not removing the cpufreq_dom -list member upon failure), and a latent bug (not clearing the current -governor upon governor initialization failure when there was no old -one; latent because the only current code path leading to this -situation frees the policy upon failure and hence the governor not -getting cleared is benign). - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/drivers/cpufreq/cpufreq.c -+++ b/xen/drivers/cpufreq/cpufreq.c -@@ -195,8 +195,10 @@ int cpufreq_add_cpu(unsigned int cpu) - - if (!domexist || hw_all) { - policy = xmalloc(struct cpufreq_policy); -- if (!policy) -+ if (!policy) { - ret = -ENOMEM; -+ goto err0; -+ } - - memset(policy, 0, sizeof(struct cpufreq_policy)); - policy->cpu = cpu; -@@ -206,7 +208,7 @@ int cpufreq_add_cpu(unsigned int cpu) - if (ret) { - xfree(policy); - per_cpu(cpufreq_cpu_policy, cpu) = NULL; -- return ret; -+ goto err0; - } - if (cpufreq_verbose) - printk("CPU %u initialization completed\n", cpu); -@@ -263,7 +265,7 @@ err1: - cpufreq_driver->exit(policy); - xfree(policy); - } -- -+err0: - if (cpus_empty(cpufreq_dom->map)) { - list_del(&cpufreq_dom->node); - xfree(cpufreq_dom); ---- a/xen/drivers/cpufreq/utility.c -+++ b/xen/drivers/cpufreq/utility.c -@@ -462,8 +462,8 @@ int __cpufreq_set_policy(struct cpufreq_ - data->governor->name); - - /* new governor failed, so re-start old one */ -+ data->governor = old_gov; - if (old_gov) { -- data->governor = old_gov; - __cpufreq_governor(data, CPUFREQ_GOV_START); - printk(KERN_WARNING "Still stay at %s governor\n", - data->governor->name); diff --git a/23978-xenpaging_check_p2mt_in_p2m_mem_paging_functions.patch b/23978-xenpaging_check_p2mt_in_p2m_mem_paging_functions.patch deleted file mode 100644 index 6786dde..0000000 --- a/23978-xenpaging_check_p2mt_in_p2m_mem_paging_functions.patch +++ /dev/null @@ -1,68 +0,0 @@ -changeset: 23978:fd3fa0a85020 -user: Olaf Hering -date: Thu Oct 20 11:25:55 2011 +0100 -files: xen/arch/x86/mm/p2m.c -description: -xenpaging: check p2mt in p2m_mem_paging functions - -Add checks to forward the p2m_ram_paging* state properly during page-in. - -Resume can be called several times if several vcpus called populate for -the gfn. Finish resume only once. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm/p2m.c | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -3023,16 +3023,22 @@ int p2m_mem_paging_prep(struct p2m_domai - p2m_type_t p2mt; - p2m_access_t a; - mfn_t mfn; -- int ret = -ENOMEM; -+ int ret; - - p2m_lock(p2m); - - mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - -+ ret = -ENOENT; -+ /* Allow only missing pages */ -+ if ( p2mt != p2m_ram_paging_in_start ) -+ goto out; -+ - /* Allocate a page if the gfn does not have one yet */ - if ( !mfn_valid(mfn) ) - { - /* Get a free page */ -+ ret = -ENOMEM; - page = alloc_domheap_page(p2m->domain, 0); - if ( unlikely(page == NULL) ) - goto out; -@@ -3067,9 +3073,15 @@ void p2m_mem_paging_resume(struct p2m_do - { - p2m_lock(p2m); - mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query); -- set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a); -- set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn); -- audit_p2m(p2m, 1); -+ /* Allow only pages which were prepared properly, or pages which -+ * were nominated but not evicted */ -+ if ( mfn_valid(mfn) && -+ (p2mt == p2m_ram_paging_in || p2mt == p2m_ram_paging_in_start) ) -+ { -+ set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a); -+ set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn); -+ audit_p2m(p2m, 1); -+ } - p2m_unlock(p2m); - } - diff --git a/23979-xenpaging_document_p2m_mem_paging_functions.patch b/23979-xenpaging_document_p2m_mem_paging_functions.patch deleted file mode 100644 index 3fbf333..0000000 --- a/23979-xenpaging_document_p2m_mem_paging_functions.patch +++ /dev/null @@ -1,158 +0,0 @@ -changeset: 23979:18306b054799 -user: Olaf Hering -date: Thu Oct 20 11:25:58 2011 +0100 -files: xen/arch/x86/mm/p2m.c -description: -xenpaging: document p2m_mem_paging functions - -Add some documentation for each of the p2m_mem_paging functions to describe -what they ought to do. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm/p2m.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 93 insertions(+) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2841,6 +2841,24 @@ set_shared_p2m_entry(struct p2m_domain * - } - - #ifdef __x86_64__ -+/** -+ * p2m_mem_paging_nominate - Mark a guest page as to-be-paged-out -+ * @d: guest domain -+ * @gfn: guest page to nominate -+ * -+ * Returns 0 for success or negative errno values if gfn is not pageable. -+ * -+ * p2m_mem_paging_nominate() is called by the pager and checks if a guest page -+ * can be paged out. If the following conditions are met the p2mt will be -+ * changed: -+ * - the gfn is backed by a mfn -+ * - the p2mt of the gfn is pageable -+ * - the mfn is not used for IO -+ * - the mfn has exactly one user and has no special meaning -+ * -+ * Once the p2mt is changed the page is readonly for the guest. On success the -+ * pager can write the page contents to disk and later evict the page. -+ */ - int p2m_mem_paging_nominate(struct p2m_domain *p2m, unsigned long gfn) - { - struct page_info *page; -@@ -2886,6 +2904,25 @@ int p2m_mem_paging_nominate(struct p2m_d - return ret; - } - -+/** -+ * p2m_mem_paging_evict - Mark a guest page as paged-out -+ * @d: guest domain -+ * @gfn: guest page to evict -+ * -+ * Returns 0 for success or negative errno values if eviction is not possible. -+ * -+ * p2m_mem_paging_evict() is called by the pager and will free a guest page and -+ * release it back to Xen. If the following conditions are met the page can be -+ * freed: -+ * - the gfn is backed by a mfn -+ * - the gfn was nominated -+ * - the mfn has still exactly one user and has no special meaning -+ * -+ * After successful nomination some other process could have mapped the page. In -+ * this case eviction can not be done. If the gfn was populated before the pager -+ * could evict it, eviction can not be done either. In this case the gfn is -+ * still backed by a mfn. -+ */ - int p2m_mem_paging_evict(struct p2m_domain *p2m, unsigned long gfn) - { - struct page_info *page; -@@ -2945,6 +2982,15 @@ int p2m_mem_paging_evict(struct p2m_doma - return ret; - } - -+/** -+ * p2m_mem_paging_drop_page - Tell pager to drop its reference to a paged page -+ * @d: guest domain -+ * @gfn: guest page to drop -+ * -+ * p2m_mem_paging_drop_page() will notify the pager that a paged-out gfn was -+ * released by the guest. The pager is supposed to drop its reference of the -+ * gfn. -+ */ - void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn) - { - struct vcpu *v = current; -@@ -2964,6 +3010,27 @@ void p2m_mem_paging_drop_page(struct p2m - } - } - -+/** -+ * p2m_mem_paging_populate - Tell pager to populete a paged page -+ * @d: guest domain -+ * @gfn: guest page in paging state -+ * -+ * p2m_mem_paging_populate() will notify the pager that a page in any of the -+ * paging states needs to be written back into the guest. -+ * This function needs to be called whenever gfn_to_mfn() returns any of the p2m -+ * paging types because the gfn may not be backed by a mfn. -+ * -+ * The gfn can be in any of the paging states, but the pager needs only be -+ * notified when the gfn is in the paging-out path (paging_out or paged). This -+ * function may be called more than once from several vcpus. If the vcpu belongs -+ * to the guest, the vcpu must be stopped and the pager notified that the vcpu -+ * was stopped. The pager needs to handle several requests for the same gfn. -+ * -+ * If the gfn is not in the paging-out path and the vcpu does not belong to the -+ * guest, nothing needs to be done and the function assumes that a request was -+ * already sent to the pager. In this case the caller has to try again until the -+ * gfn is fully paged in again. -+ */ - void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn) - { - struct vcpu *v = current; -@@ -3017,6 +3084,17 @@ void p2m_mem_paging_populate(struct p2m_ - mem_event_put_request(d, &d->mem_paging, &req); - } - -+/** -+ * p2m_mem_paging_prep - Allocate a new page for the guest -+ * @d: guest domain -+ * @gfn: guest page in paging state -+ * -+ * p2m_mem_paging_prep() will allocate a new page for the guest if the gfn is -+ * not backed by a mfn. It is called by the pager. -+ * It is required that the gfn was already populated. The gfn may already have a -+ * mfn if populate was called for gfn which was nominated but not evicted. In -+ * this case only the p2mt needs to be forwarded. -+ */ - int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) - { - struct page_info *page; -@@ -3057,6 +3135,21 @@ int p2m_mem_paging_prep(struct p2m_domai - return ret; - } - -+/** -+ * p2m_mem_paging_resume - Resume guest gfn and vcpus -+ * @d: guest domain -+ * @gfn: guest page in paging state -+ * -+ * p2m_mem_paging_resume() will forward the p2mt of a gfn to ram_rw and all -+ * waiting vcpus will be unpaused again. It is called by the pager. -+ * -+ * The gfn was previously either evicted and populated, or nominated and -+ * populated. If the page was evicted the p2mt will be p2m_ram_paging_in. If -+ * the page was just nominated the p2mt will be p2m_ram_paging_in_start because -+ * the pager did not call p2m_mem_paging_prep(). -+ * -+ * If the gfn was dropped the vcpu needs to be unpaused. -+ */ - void p2m_mem_paging_resume(struct p2m_domain *p2m) - { - struct domain *d = p2m->domain; diff --git a/23980-xenpaging_disallow_paging_in_a_PoD_guest.patch b/23980-xenpaging_disallow_paging_in_a_PoD_guest.patch deleted file mode 100644 index 4e49a34..0000000 --- a/23980-xenpaging_disallow_paging_in_a_PoD_guest.patch +++ /dev/null @@ -1,58 +0,0 @@ -changeset: 23980:a06609840ff1 -user: Olaf Hering -date: Thu Oct 20 11:25:58 2011 +0100 -files: tools/xenpaging/xenpaging.c xen/arch/x86/mm/mem_event.c -description: -xenpaging: disallow paging in a PoD guest - -Disallow xenpaging in a PoD guest until coexistance between the two features -is properly implemented. - -Signed-off-by: Olaf Hering -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - tools/xenpaging/xenpaging.c | 3 +++ - xen/arch/x86/mm/mem_event.c | 6 ++++++ - 2 files changed, 9 insertions(+) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -246,6 +246,9 @@ static xenpaging_t *xenpaging_init(domid - case ENODEV: - ERROR("EPT not supported for this guest"); - break; -+ case EXDEV: -+ ERROR("xenpaging not supported in a PoD guest"); -+ break; - default: - ERROR("Error initialising shared page: %s", strerror(errno)); - break; -Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -@@ -253,6 +253,7 @@ int mem_event_domctl(struct domain *d, x - case XEN_DOMCTL_MEM_EVENT_OP_PAGING: - { - struct mem_event_domain *med = &d->mem_paging; -+ struct p2m_domain *p2m = p2m_get_hostp2m(d); - rc = -ENODEV; - /* Only HAP is supported */ - if ( !hap_enabled(d) ) -@@ -262,6 +263,11 @@ int mem_event_domctl(struct domain *d, x - if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) - break; - -+ rc = -EXDEV; -+ /* Disallow paging in a PoD guest */ -+ if ( p2m->pod.entry_count ) -+ break; -+ - switch( mec->op ) - { - case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE: diff --git a/23993-x86-microcode-amd-fix-23871.patch b/23993-x86-microcode-amd-fix-23871.patch deleted file mode 100644 index e5fd7c7..0000000 --- a/23993-x86-microcode-amd-fix-23871.patch +++ /dev/null @@ -1,53 +0,0 @@ -References: bnc#725169 - -# HG changeset patch -# User Jan Beulich -# Date 1319475620 -3600 -# Node ID e458dfc35b8d3be04a9b72c30ff97163e27a7314 -# Parent ffe861c1d5dfa8f4485052e5600e06124105033f -x86/ucode-amd: fix regression from c/s 23871:503ee256fecf - -microcode_fits() must return distinct values for the success and -no-fit-but-no-error cases, so the caller can react accordingly. Make -it return 1 in the success case, and adjust its single caller. - -Also remove an impossible code path - install_equiv_cpu_table(), which -gets called prior to microcode_fits(), never leaves equiv_cpu_table -being NULL without also returning an error. - -Note that this is still awaiting testing on a system where the -regression was actually observed (which also requires a new enough -microcode_ctl package). Note also that this will need to be -backported to 4.0 and 4.1 (or the broken c/s that got backported -there reverted). - -Signed-off-by: Jan Beulich -Committed-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/microcode_amd.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/microcode_amd.c -+++ xen-4.1.3-testing/xen/arch/x86/microcode_amd.c -@@ -76,14 +76,6 @@ static int microcode_fits(const struct m - /* We should bind the task to the CPU */ - BUG_ON(cpu != raw_smp_processor_id()); - -- if ( equiv_cpu_table == NULL ) -- { -- printk(KERN_INFO "microcode: CPU%d microcode update with " -- "version 0x%x (current=0x%x)\n", -- cpu, mc_header->patch_id, uci->cpu_sig.rev); -- goto out; -- } -- - current_cpu_id = cpuid_eax(0x00000001); - - for ( i = 0; equiv_cpu_table[i].installed_cpu != 0; i++ ) -@@ -117,7 +109,6 @@ static int microcode_fits(const struct m - "update with version 0x%x (current=0x%x)\n", - cpu, mc_header->patch_id, uci->cpu_sig.rev); - --out: - return 1; - } - diff --git a/23999-pygrub-grub2.patch b/23999-pygrub-grub2.patch deleted file mode 100644 index 8229a0a..0000000 --- a/23999-pygrub-grub2.patch +++ /dev/null @@ -1,26 +0,0 @@ -# HG changeset patch -# User Michael Young -# Date 1319566729 -3600 -# Node ID 138f707fa598340749a70a79748b01dff850b8f2 -# Parent 85d7b207fabcd1cbda8f93e3937c5990f42a2cf9 -pygrub: look in /boot/grub2 (for eg Fedora 16) - -Fedora 16 puts grub configuration files in /boot/grub2/grub.cfg so -pygrub should look there as well - -Signed-off-by: Michael Young -Acked-by: Ian Campbell - -diff -r 85d7b207fabc -r 138f707fa598 tools/pygrub/src/pygrub ---- a/tools/pygrub/src/pygrub Tue Oct 25 19:15:54 2011 +0100 -+++ b/tools/pygrub/src/pygrub Tue Oct 25 19:18:49 2011 +0100 -@@ -395,7 +395,8 @@ - ["/efi/boot/elilo.conf", "/elilo.conf",]) - else: - cfg_list = map(lambda x: (x,grub.GrubConf.Grub2ConfigFile), -- ["/boot/grub/grub.cfg", "/grub/grub.cfg"]) + \ -+ ["/boot/grub/grub.cfg", "/grub/grub.cfg", -+ "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]) + \ - map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile), - ["/boot/isolinux/isolinux.cfg", - "/boot/extlinux.conf"]) + \ diff --git a/24064-pygrub-HybridISO.patch b/24064-pygrub-HybridISO.patch deleted file mode 100644 index 90ccaf5..0000000 --- a/24064-pygrub-HybridISO.patch +++ /dev/null @@ -1,72 +0,0 @@ -# HG changeset patch -# User Philipp Hahn -# Date 1320251337 0 -# Node ID 2d741388060df5bd2545f38a25278fb9a7fbb127 -# Parent 6868855b6651639f02004a7e313fe7aaba522821 -pygrub: Add HybridISO support for PyGrub2 - -grub-mkrescue internally uses xorriso, which generates a so-called -"Hybrid ISO": The ISO images also contains a DOS partition table, -which allows the identical ISO file to be stored on an USB stick for -booting from it. This breaks PyGrub, since it (wrongly) detects only -the DOS partition table and uses the first partition instead of the -complete ISO file. - -Add a check to detect HybridISO files and use offset 0 in addition to -partition table parsing. - -Signed-off-by: Philipp Hahn -Acked-by: Ian Campbell -Committed-by: Ian Jackson - -diff -r 6868855b6651 -r 2d741388060d tools/pygrub/src/pygrub ---- a/tools/pygrub/src/pygrub Wed Nov 02 16:25:18 2011 +0000 -+++ b/tools/pygrub/src/pygrub Wed Nov 02 16:28:57 2011 +0000 -@@ -40,15 +40,20 @@ - except _curses.error: - pass - --def is_disk_image(file): -+DISK_TYPE_RAW, DISK_TYPE_HYBRIDISO, DISK_TYPE_DOS = range(3) -+def identify_disk_image(file): -+ """Detect DOS partition table or HybridISO format.""" - fd = os.open(file, os.O_RDONLY) -- buf = os.read(fd, 512) -+ buf = os.read(fd, 0x8006) - os.close(fd) - - if len(buf) >= 512 and \ - struct.unpack("H", buf[0x1fe: 0x200]) == (0xaa55,): -- return True -- return False -+ # HybridISO contains a DOS partition table for booting from USB devices, but really is an ISO image -+ if len(buf) >= 0x8006 and buf[0x8001:0x8006] == 'CD001': -+ return DISK_TYPE_HYBRIDISO -+ return DISK_TYPE_DOS -+ return DISK_TYPE_RAW - - SECTOR_SIZE=512 - DK_LABEL_LOC=1 -@@ -94,12 +99,19 @@ - FDISK_PART_GPT=0xee - - def get_partition_offsets(file): -- if not is_disk_image(file): -+ image_type = identify_disk_image(file) -+ if image_type == DISK_TYPE_RAW: - # No MBR: assume whole disk filesystem, which is like a - # single partition starting at 0 - return [0] -- -- part_offs = [] -+ elif image_type == DISK_TYPE_HYBRIDISO: -+ # A HybridISO contains an ISO filesystem at 0 in addition -+ # to the DOS partition table -+ part_offs = [0] -+ elif image_type == DISK_TYPE_DOS: -+ part_offs = [] -+ else: -+ raise ValueError('Unhandled image type returnd by identify_disk_image(): %d' % (image_type,)) - - fd = os.open(file, os.O_RDONLY) - buf = os.read(fd, 512) diff --git a/24104-waitqueue_Double_size_of_x86_shadow_stack..patch b/24104-waitqueue_Double_size_of_x86_shadow_stack..patch deleted file mode 100644 index 1d933b0..0000000 --- a/24104-waitqueue_Double_size_of_x86_shadow_stack..patch +++ /dev/null @@ -1,27 +0,0 @@ -changeset: 24104:4daa4ad90f12 -user: Keir Fraser -date: Tue Nov 08 19:33:46 2011 +0000 -files: xen/common/wait.c -description: -waitqueue: Double size of x86 shadow stack. - -Signed-off-by: Keir Fraser - - ---- - xen/common/wait.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: xen-4.1.2-testing/xen/common/wait.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/wait.c -+++ xen-4.1.2-testing/xen/common/wait.c -@@ -33,7 +33,7 @@ struct waitqueue_vcpu { - * hypervisor context before sleeping (descheduling), setjmp/longjmp-style. - */ - void *esp; -- char stack[1500]; -+ char stack[3000]; - #endif - }; - diff --git a/24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch b/24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch deleted file mode 100644 index ec43f2c..0000000 --- a/24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch +++ /dev/null @@ -1,30 +0,0 @@ -changeset: 24105:89efd82620ec -user: Olaf Hering -date: Tue Nov 08 19:35:01 2011 +0000 -files: xen/arch/x86/mm/p2m.c -description: -xenpaging: compare domain pointer in p2m_mem_paging_populate - -Compare just the domain pointer instead of the domain_id number. - -Signed-off-by: Olaf Hering -Committed-by: Keir Fraser - - ---- - xen/arch/x86/mm/p2m.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -3063,7 +3063,7 @@ void p2m_mem_paging_populate(struct p2m_ - p2m_unlock(p2m); - - /* Pause domain if request came from guest and gfn has paging type */ -- if ( p2m_is_paging(p2mt) && v->domain->domain_id == d->domain_id ) -+ if ( p2m_is_paging(p2mt) && v->domain == d ) - { - vcpu_pause_nosync(v); - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; diff --git a/24106-mem_event_check_capabilities_only_once.patch b/24106-mem_event_check_capabilities_only_once.patch deleted file mode 100644 index ad232bd..0000000 --- a/24106-mem_event_check_capabilities_only_once.patch +++ /dev/null @@ -1,112 +0,0 @@ -changeset: 24106:2af5bfbc9fde -user: Olaf Hering -date: Tue Nov 08 19:35:42 2011 +0000 -files: xen/arch/x86/mm/mem_event.c -description: -mem_event: check capabilities only once - -It is not required to check the system capabilities during every domctl. -Rearrange the code to check them only once. - -Signed-off-by: Olaf Hering -Committed-by: Keir Fraser - - ---- - xen/arch/x86/mm/mem_event.c | 54 ++++++++++++++++++++++++-------------------- - 1 file changed, 30 insertions(+), 24 deletions(-) - -Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -@@ -253,32 +253,35 @@ int mem_event_domctl(struct domain *d, x - case XEN_DOMCTL_MEM_EVENT_OP_PAGING: - { - struct mem_event_domain *med = &d->mem_paging; -- struct p2m_domain *p2m = p2m_get_hostp2m(d); -- rc = -ENODEV; -- /* Only HAP is supported */ -- if ( !hap_enabled(d) ) -- break; -- -- /* Currently only EPT is supported */ -- if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) -- break; -- -- rc = -EXDEV; -- /* Disallow paging in a PoD guest */ -- if ( p2m->pod.entry_count ) -- break; -+ rc = -EINVAL; - - switch( mec->op ) - { - case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE: - { -+ struct p2m_domain *p2m = p2m_get_hostp2m(d); -+ rc = -ENODEV; -+ /* Only HAP is supported */ -+ if ( !hap_enabled(d) ) -+ break; -+ -+ /* Currently only EPT is supported */ -+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) -+ break; -+ -+ rc = -EXDEV; -+ /* Disallow paging in a PoD guest */ -+ if ( p2m->pod.entry_count ) -+ break; -+ - rc = mem_event_enable(d, mec, med); - } - break; - - case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE: - { -- rc = mem_event_disable(med); -+ if ( med->ring_page ) -+ rc = mem_event_disable(med); - } - break; - -@@ -295,26 +298,29 @@ int mem_event_domctl(struct domain *d, x - case XEN_DOMCTL_MEM_EVENT_OP_ACCESS: - { - struct mem_event_domain *med = &d->mem_access; -- rc = -ENODEV; -- /* Only HAP is supported */ -- if ( !hap_enabled(d) ) -- break; -- -- /* Currently only EPT is supported */ -- if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) -- break; -+ rc = -EINVAL; - - switch( mec->op ) - { - case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE: - { -+ rc = -ENODEV; -+ /* Only HAP is supported */ -+ if ( !hap_enabled(d) ) -+ break; -+ -+ /* Currently only EPT is supported */ -+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) -+ break; -+ - rc = mem_event_enable(d, mec, med); - } - break; - - case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE: - { -- rc = mem_event_disable(&d->mem_access); -+ if ( med->ring_page ) -+ rc = mem_event_disable(&d->mem_access); - } - break; - diff --git a/24123-x86-cpuidle-quiesce.patch b/24123-x86-cpuidle-quiesce.patch deleted file mode 100644 index e9b219f..0000000 --- a/24123-x86-cpuidle-quiesce.patch +++ /dev/null @@ -1,66 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1321017916 -3600 -# Node ID 8b08b2166aa82e7df0b1fa620ed57078810f8c12 -# Parent 4699decb8424a00447c466205be3cb4d0fb95a76 -x86: quiesce cpuidle code - -So far these messages got pointlessly (as the code in other places -assumes symmetric configuration) emitted once per CPU. Hide the debug -one behind opt_cpu_info, and issue the info one just once (if the code -gets adjusted to support assymtric configurations, this would need to -be revisited, but ideally without producing per-CPU messages again). - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/acpi/cpu_idle.c -+++ xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c -@@ -654,6 +654,8 @@ static int acpi_processor_ffh_cstate_pro - unsigned int edx_part; - unsigned int cstate_type; /* C-state type and not ACPI C-state type */ - unsigned int num_cstate_subtype; -+ int ret = 0; -+ static unsigned long printed; - - if ( c->cpuid_level < CPUID_MWAIT_LEAF ) - { -@@ -662,8 +664,9 @@ static int acpi_processor_ffh_cstate_pro - } - - cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); -- printk(XENLOG_DEBUG "cpuid.MWAIT[.eax=%x, .ebx=%x, .ecx=%x, .edx=%x]\n", -- eax, ebx, ecx, edx); -+ if ( opt_cpu_info ) -+ printk(XENLOG_DEBUG "cpuid.MWAIT[eax=%x ebx=%x ecx=%x edx=%x]\n", -+ eax, ebx, ecx, edx); - - /* Check whether this particular cx_type (in CST) is supported or not */ - cstate_type = (cx->reg.address >> MWAIT_SUBSTATE_SIZE) + 1; -@@ -671,15 +674,16 @@ static int acpi_processor_ffh_cstate_pro - num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; - - if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) ) -- return -EFAULT; -- -+ ret = -ERANGE; - /* mwait ecx extensions INTERRUPT_BREAK should be supported for C2/C3 */ -- if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || -- !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ) -- return -EFAULT; -- -- printk(XENLOG_INFO "Monitor-Mwait will be used to enter C-%d state\n", cx->type); -- return 0; -+ else if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || -+ !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ) -+ ret = -ENODEV; -+ else if ( opt_cpu_info || cx->type >= BITS_PER_LONG || -+ !test_and_set_bit(cx->type, &printed) ) -+ printk(XENLOG_INFO "Monitor-Mwait will be used to enter C%d state\n", -+ cx->type); -+ return ret; - } - - /* diff --git a/24124-x86-microcode-amd-quiesce.patch b/24124-x86-microcode-amd-quiesce.patch deleted file mode 100644 index c338fef..0000000 --- a/24124-x86-microcode-amd-quiesce.patch +++ /dev/null @@ -1,63 +0,0 @@ -References: bnc#719700 - -# HG changeset patch -# User Jan Beulich -# Date 1321018008 -3600 -# Node ID 69f8b6f4c29cb2fb2d11e27c391090f543e6b393 -# Parent 8b08b2166aa82e7df0b1fa620ed57078810f8c12 -x86/amd-ucode: further turn down verbosity - -Turn up the log level on various (mostly debug-only) messages. - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/microcode_amd.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/microcode_amd.c -+++ xen-4.1.3-testing/xen/arch/x86/microcode_amd.c -@@ -59,7 +59,7 @@ static int collect_cpu_info(int cpu, str - - rdmsrl(MSR_AMD_PATCHLEVEL, csig->rev); - -- printk(KERN_INFO "microcode: collect_cpu_info: patch_id=0x%x\n", -+ printk(KERN_DEBUG "microcode: collect_cpu_info: patch_id=0x%x\n", - csig->rev); - - return 0; -@@ -96,7 +96,7 @@ static int microcode_fits(const struct m - - if ( (mc_header->processor_rev_id) != equiv_cpu_id ) - { -- printk(KERN_INFO "microcode: CPU%d patch does not match " -+ printk(KERN_DEBUG "microcode: CPU%d patch does not match " - "(patch is %x, cpu base id is %x) \n", - cpu, mc_header->processor_rev_id, equiv_cpu_id); - return -EINVAL; -@@ -105,7 +105,7 @@ static int microcode_fits(const struct m - if ( mc_header->patch_id <= uci->cpu_sig.rev ) - return 0; - -- printk(KERN_INFO "microcode: CPU%d found a matching microcode " -+ printk(KERN_DEBUG "microcode: CPU%d found a matching microcode " - "update with version 0x%x (current=0x%x)\n", - cpu, mc_header->patch_id, uci->cpu_sig.rev); - -@@ -148,7 +148,7 @@ static int apply_microcode(int cpu) - return -EIO; - } - -- printk("microcode: CPU%d updated from revision " -+ printk(KERN_INFO "microcode: CPU%d updated from revision " - "0x%x to 0x%x \n", - cpu, uci->cpu_sig.rev, hdr->patch_id); - -@@ -179,7 +179,7 @@ static int get_next_ucode_from_buffer_am - return -EINVAL; - } - -- printk(KERN_INFO "microcode: size %lu, total_size %u, offset %ld\n", -+ printk(KERN_DEBUG "microcode: size %lu, total_size %u, offset %ld\n", - bufsize, mpbuf->len, off); - - if ( (off + mpbuf->len) > bufsize ) diff --git a/24138-xenpaging_munmap_all_pages_after_page-in.patch b/24138-xenpaging_munmap_all_pages_after_page-in.patch deleted file mode 100644 index a341657..0000000 --- a/24138-xenpaging_munmap_all_pages_after_page-in.patch +++ /dev/null @@ -1,33 +0,0 @@ -changeset: 24138:e2cc58b85b6e -user: Olaf Hering -date: Mon Nov 14 17:49:14 2011 +0000 -files: tools/xenpaging/pagein.c -description: -xenpaging: munmap all pages after page-in - -Do munmap() on all mapped pages, not just the first one. Without this -change the gfns backing the remaining pages can not be paged out again -because the page count does not go down to 1. This change was missing -from changeset 23827:d1d6abc1db20. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/pagein.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: xen-4.1.2-testing/tools/xenpaging/pagein.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/pagein.c -+++ xen-4.1.2-testing/tools/xenpaging/pagein.c -@@ -44,7 +44,7 @@ static void *page_in(void *arg) - /* Ignore errors */ - page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, gfns, num); - if (page) -- munmap(page, PAGE_SIZE); -+ munmap(page, PAGE_SIZE * num); - } - page_in_possible = 0; - pthread_exit(NULL); diff --git a/24153-x86-emul-feature-checks.patch b/24153-x86-emul-feature-checks.patch deleted file mode 100644 index 6bf0b9a..0000000 --- a/24153-x86-emul-feature-checks.patch +++ /dev/null @@ -1,109 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1321459471 0 -# Node ID 644ca5d3ec435f3372ce88a4de86909bd4033819 -# Parent 1cbb3c1dfb3203f5344a6c1c52507b9e75af6742 -x86/emulator: add feature checks for newer instructions - -Certain instructions were introduced only after the i686 or original -x86-64 architecture, so we should not try to emulate them if the guest -is not seeing the respective feature enabled (or, worse, if the -underlying hardware doesn't support them). This affects fisttp, -movnti, and cmpxchg16b. - -Signed-off-by: Jan Beulich -Signed-off-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_emulate/x86_emulate.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c -@@ -955,6 +955,47 @@ in_protmode( - return !(in_realmode(ctxt, ops) || (ctxt->regs->eflags & EFLG_VM)); - } - -+#define EAX 0 -+#define ECX 1 -+#define EDX 2 -+#define EBX 3 -+ -+static bool_t vcpu_has( -+ unsigned int eax, -+ unsigned int reg, -+ unsigned int bit, -+ struct x86_emulate_ctxt *ctxt, -+ const struct x86_emulate_ops *ops) -+{ -+ unsigned int ebx = 0, ecx = 0, edx = 0; -+ int rc; -+ -+ fail_if(!ops->cpuid); -+ rc = ops->cpuid(&eax, &ebx, &ecx, &edx, ctxt); -+ if ( rc == X86EMUL_OKAY ) -+ { -+ switch ( reg ) -+ { -+ case EAX: reg = eax; break; -+ case EBX: reg = ebx; break; -+ case ECX: reg = ecx; break; -+ case EDX: reg = edx; break; -+ default: BUG(); -+ } -+ if ( !(reg & (1U << bit)) ) -+ rc = ~X86EMUL_OKAY; -+ } -+ -+ done: -+ return rc == X86EMUL_OKAY; -+} -+ -+#define vcpu_must_have(leaf, reg, bit) \ -+ generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1) -+#define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26) -+#define vcpu_must_have_sse3() vcpu_must_have(0x00000001, ECX, 0) -+#define vcpu_must_have_cx16() vcpu_must_have(0x00000001, ECX, 13) -+ - static int - in_longmode( - struct x86_emulate_ctxt *ctxt, -@@ -2741,6 +2782,7 @@ x86_emulate( - emulate_fpu_insn_memsrc("fildl", src.val); - break; - case 1: /* fisttp m32i */ -+ vcpu_must_have_sse3(); - ea.bytes = 4; - dst = ea; - dst.type = OP_MEM; -@@ -2849,6 +2891,7 @@ x86_emulate( - emulate_fpu_insn_memsrc("fldl", src.val); - break; - case 1: /* fisttp m64i */ -+ vcpu_must_have_sse3(); - ea.bytes = 8; - dst = ea; - dst.type = OP_MEM; -@@ -2956,6 +2999,7 @@ x86_emulate( - emulate_fpu_insn_memsrc("fild", src.val); - break; - case 1: /* fisttp m16i */ -+ vcpu_must_have_sse3(); - ea.bytes = 2; - dst = ea; - dst.type = OP_MEM; -@@ -4144,6 +4188,7 @@ x86_emulate( - - case 0xc3: /* movnti */ - /* Ignore the non-temporal hint for now. */ -+ vcpu_must_have_sse2(); - generate_exception_if(dst.bytes <= 2, EXC_UD, -1); - dst.val = src.val; - break; -@@ -4154,6 +4199,8 @@ x86_emulate( - - generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1); - generate_exception_if(ea.type != OP_MEM, EXC_UD, -1); -+ if ( op_bytes == 8 ) -+ vcpu_must_have_cx16(); - op_bytes *= 2; - - /* Get actual old value. */ diff --git a/24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch b/24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch deleted file mode 100644 index 3b57079..0000000 --- a/24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch +++ /dev/null @@ -1,68 +0,0 @@ -changeset: 24171:fe80909663c1 -user: Keir Fraser -date: Tue Nov 22 13:00:21 2011 +0000 -files: xen/common/wait.c -description: -x86,waitqueue: Allocate whole page for shadow stack. - -Signed-off-by: Keir Fraser - - ---- - xen/common/wait.c | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/common/wait.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/wait.c -+++ xen-4.1.2-testing/xen/common/wait.c -@@ -33,7 +33,7 @@ struct waitqueue_vcpu { - * hypervisor context before sleeping (descheduling), setjmp/longjmp-style. - */ - void *esp; -- char stack[3000]; -+ char *stack; - #endif - }; - -@@ -41,11 +41,19 @@ int init_waitqueue_vcpu(struct vcpu *v) - { - struct waitqueue_vcpu *wqv; - -- wqv = xmalloc(struct waitqueue_vcpu); -+ wqv = xzalloc(struct waitqueue_vcpu); - if ( wqv == NULL ) - return -ENOMEM; - -- memset(wqv, 0, sizeof(*wqv)); -+#ifdef CONFIG_X86 -+ wqv->stack = alloc_xenheap_page(); -+ if ( wqv->stack == NULL ) -+ { -+ xfree(wqv); -+ return -ENOMEM; -+ } -+#endif -+ - INIT_LIST_HEAD(&wqv->list); - wqv->vcpu = v; - -@@ -63,6 +71,9 @@ void destroy_waitqueue_vcpu(struct vcpu - return; - - BUG_ON(!list_empty(&wqv->list)); -+#ifdef CONFIG_X86 -+ free_xenheap_page(wqv->stack); -+#endif - xfree(wqv); - - v->waitqueue_vcpu = NULL; -@@ -115,7 +126,7 @@ static void __prepare_to_wait(struct wai - : "=S" (wqv->esp) - : "c" (cpu_info), "D" (wqv->stack) - : "memory" ); -- BUG_ON((cpu_info - (char *)wqv->esp) > sizeof(wqv->stack)); -+ BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE); - } - - static void __finish_wait(struct waitqueue_vcpu *wqv) diff --git a/24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch b/24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch deleted file mode 100644 index f368990..0000000 --- a/24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch +++ /dev/null @@ -1,53 +0,0 @@ -changeset: 24178:1f2a06dbbb69 -user: Keir Fraser -date: Tue Nov 22 15:35:26 2011 +0000 -files: xen/common/keyhandler.c -description: -debug: Add domain/vcpu pause_count info to 'd' key. - -Signed-off-by: Keir Fraser - - ---- - xen/common/keyhandler.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -Index: xen-4.1.2-testing/xen/common/keyhandler.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/keyhandler.c -+++ xen-4.1.2-testing/xen/common/keyhandler.c -@@ -244,9 +244,10 @@ static void dump_domains(unsigned char k - unsigned int i; - printk("General information for domain %u:\n", d->domain_id); - cpuset_print(tmpstr, sizeof(tmpstr), d->domain_dirty_cpumask); -- printk(" refcnt=%d dying=%d nr_pages=%d xenheap_pages=%d " -- "dirty_cpus=%s max_pages=%u\n", -+ printk(" refcnt=%d dying=%d pause_count=%d\n", - atomic_read(&d->refcnt), d->is_dying, -+ atomic_read(&d->pause_count)); -+ printk(" nr_pages=%d xenheap_pages=%d dirty_cpus=%s max_pages=%u\n", - d->tot_pages, d->xenheap_pages, tmpstr, d->max_pages); - printk(" handle=%02x%02x%02x%02x-%02x%02x-%02x%02x-" - "%02x%02x-%02x%02x%02x%02x%02x%02x vm_assist=%08lx\n", -@@ -270,17 +271,18 @@ static void dump_domains(unsigned char k - d->domain_id); - for_each_vcpu ( d, v ) - { -- printk(" VCPU%d: CPU%d [has=%c] flags=%lx poll=%d " -+ printk(" VCPU%d: CPU%d [has=%c] poll=%d " - "upcall_pend = %02x, upcall_mask = %02x ", - v->vcpu_id, v->processor, -- v->is_running ? 'T':'F', -- v->pause_flags, v->poll_evtchn, -+ v->is_running ? 'T':'F', v->poll_evtchn, - vcpu_info(v, evtchn_upcall_pending), - vcpu_info(v, evtchn_upcall_mask)); - cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask); - printk("dirty_cpus=%s ", tmpstr); - cpuset_print(tmpstr, sizeof(tmpstr), v->cpu_affinity); - printk("cpu_affinity=%s\n", tmpstr); -+ printk(" pause_count=%d pause_flags=%lx\n", -+ atomic_read(&v->pause_count), v->pause_flags); - arch_dump_vcpu_info(v); - periodic_timer_print(tmpstr, sizeof(tmpstr), v->periodic_period); - printk(" %s\n", tmpstr); diff --git a/24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch b/24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch deleted file mode 100644 index 4a9eca1..0000000 --- a/24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch +++ /dev/null @@ -1,68 +0,0 @@ -changeset: 24195:9b65336f688f -user: Keir Fraser -date: Thu Nov 24 15:48:10 2011 +0000 -files: xen/common/wait.c -description: -waitqueue: Detect saved-stack overflow and crash the guest. - -Signed-off-by: Keir Fraser - - ---- - xen/common/wait.c | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/common/wait.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/wait.c -+++ xen-4.1.2-testing/xen/common/wait.c -@@ -106,13 +106,16 @@ void wake_up(struct waitqueue_head *wq) - static void __prepare_to_wait(struct waitqueue_vcpu *wqv) - { - char *cpu_info = (char *)get_cpu_info(); -+ - asm volatile ( - #ifdef CONFIG_X86_64 - "push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; " - "push %%rbp; push %%r8; push %%r9; push %%r10; push %%r11; " - "push %%r12; push %%r13; push %%r14; push %%r15; call 1f; " - "1: mov 80(%%rsp),%%rdi; mov 96(%%rsp),%%rcx; mov %%rsp,%%rsi; " -- "sub %%rsi,%%rcx; rep movsb; mov %%rsp,%%rsi; pop %%rax; " -+ "sub %%rsi,%%rcx; cmp %3,%%rcx; jbe 2f; " -+ "xor %%esi,%%esi; jmp 3f; " -+ "2: rep movsb; mov %%rsp,%%rsi; 3: pop %%rax; " - "pop %%r15; pop %%r14; pop %%r13; pop %%r12; " - "pop %%r11; pop %%r10; pop %%r9; pop %%r8; " - "pop %%rbp; pop %%rdi; pop %%rdx; pop %%rcx; pop %%rbx; pop %%rax" -@@ -120,13 +123,20 @@ static void __prepare_to_wait(struct wai - "push %%eax; push %%ebx; push %%ecx; push %%edx; push %%edi; " - "push %%ebp; call 1f; " - "1: mov 8(%%esp),%%edi; mov 16(%%esp),%%ecx; mov %%esp,%%esi; " -- "sub %%esi,%%ecx; rep movsb; mov %%esp,%%esi; pop %%eax; " -+ "sub %%esi,%%ecx; cmp %3,%%ecx; jbe 2f; " -+ "xor %%esi,%%esi; jmp 3f; " -+ "2: rep movsb; mov %%esp,%%esi; 3: pop %%eax; " - "pop %%ebp; pop %%edi; pop %%edx; pop %%ecx; pop %%ebx; pop %%eax" - #endif - : "=S" (wqv->esp) -- : "c" (cpu_info), "D" (wqv->stack) -+ : "c" (cpu_info), "D" (wqv->stack), "i" (PAGE_SIZE) - : "memory" ); -- BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE); -+ -+ if ( unlikely(wqv->esp == 0) ) -+ { -+ gdprintk(XENLOG_ERR, "Stack too large in %s\n", __FUNCTION__); -+ domain_crash_synchronous(); -+ } - } - - static void __finish_wait(struct waitqueue_vcpu *wqv) -@@ -162,6 +172,7 @@ void prepare_to_wait(struct waitqueue_he - struct vcpu *curr = current; - struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu; - -+ ASSERT(!in_atomic()); - ASSERT(list_empty(&wqv->list)); - - spin_lock(&wq->lock); diff --git a/24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch b/24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch deleted file mode 100644 index 26ce7d9..0000000 --- a/24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch +++ /dev/null @@ -1,49 +0,0 @@ -changeset: 24196:de4fe05fe887 -user: Keir Fraser -date: Thu Nov 24 15:49:25 2011 +0000 -files: xen/common/wait.c -description: -waitqueue: Reorder prepare_to_wait() so that vcpu is definitely on the -queue on exit, even after a wakeup. - -Otherwise, when we go round the loop in wait_event(), we may not -actually sleep after the first iteration, as we do not put ourselves -back on the queue on wakeup. - -Signed-off-by: Keir Fraser - - ---- - xen/common/wait.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -Index: xen-4.1.2-testing/xen/common/wait.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/wait.c -+++ xen-4.1.2-testing/xen/common/wait.c -@@ -107,6 +107,8 @@ static void __prepare_to_wait(struct wai - { - char *cpu_info = (char *)get_cpu_info(); - -+ ASSERT(wqv->esp == 0); -+ - asm volatile ( - #ifdef CONFIG_X86_64 - "push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; " -@@ -173,14 +175,13 @@ void prepare_to_wait(struct waitqueue_he - struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu; - - ASSERT(!in_atomic()); -- ASSERT(list_empty(&wqv->list)); -+ __prepare_to_wait(wqv); - -+ ASSERT(list_empty(&wqv->list)); - spin_lock(&wq->lock); - list_add_tail(&wqv->list, &wq->list); - vcpu_pause_nosync(curr); - spin_unlock(&wq->lock); -- -- __prepare_to_wait(wqv); - } - - void finish_wait(struct waitqueue_head *wq) diff --git a/24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch b/24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch deleted file mode 100644 index 7639099..0000000 --- a/24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch +++ /dev/null @@ -1,78 +0,0 @@ -changeset: 24197:ca92c4a8b31f -user: Keir Fraser -date: Thu Nov 24 15:50:08 2011 +0000 -files: xen/common/wait.c -description: -x86/waitqueue: Because we have per-cpu stacks, we must wake up on teh -same cpu that we slept on. Otherwise stack references are bogus on -wakeup. - -Signed-off-by: Keir Fraser - - ---- - xen/common/wait.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -Index: xen-4.1.2-testing/xen/common/wait.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/wait.c -+++ xen-4.1.2-testing/xen/common/wait.c -@@ -34,6 +34,8 @@ struct waitqueue_vcpu { - */ - void *esp; - char *stack; -+ cpumask_t saved_affinity; -+ unsigned int wakeup_cpu; - #endif - }; - -@@ -106,9 +108,19 @@ void wake_up(struct waitqueue_head *wq) - static void __prepare_to_wait(struct waitqueue_vcpu *wqv) - { - char *cpu_info = (char *)get_cpu_info(); -+ struct vcpu *curr = current; - - ASSERT(wqv->esp == 0); - -+ /* Save current VCPU affinity; force wakeup on *this* CPU only. */ -+ wqv->wakeup_cpu = smp_processor_id(); -+ wqv->saved_affinity = curr->cpu_affinity; -+ if ( vcpu_set_affinity(curr, cpumask_of(wqv->wakeup_cpu)) ) -+ { -+ gdprintk(XENLOG_ERR, "Unable to set vcpu affinity\n"); -+ domain_crash_synchronous(); -+ } -+ - asm volatile ( - #ifdef CONFIG_X86_64 - "push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; " -@@ -144,6 +156,7 @@ static void __prepare_to_wait(struct wai - static void __finish_wait(struct waitqueue_vcpu *wqv) - { - wqv->esp = NULL; -+ (void)vcpu_set_affinity(current, &wqv->saved_affinity); - } - - void check_wakeup_from_wait(void) -@@ -155,6 +168,20 @@ void check_wakeup_from_wait(void) - if ( likely(wqv->esp == NULL) ) - return; - -+ /* Check if we woke up on the wrong CPU. */ -+ if ( unlikely(smp_processor_id() != wqv->wakeup_cpu) ) -+ { -+ /* Re-set VCPU affinity and re-enter the scheduler. */ -+ struct vcpu *curr = current; -+ wqv->saved_affinity = curr->cpu_affinity; -+ if ( vcpu_set_affinity(curr, cpumask_of(wqv->wakeup_cpu)) ) -+ { -+ gdprintk(XENLOG_ERR, "Unable to set vcpu affinity\n"); -+ domain_crash_synchronous(); -+ } -+ wait(); /* takes us back into the scheduler */ -+ } -+ - asm volatile ( - "mov %1,%%"__OP"sp; rep movsb; jmp *(%%"__OP"sp)" - : : "S" (wqv->stack), "D" (wqv->esp), diff --git a/24208-xenpaging_remove_filename_from_comment.patch b/24208-xenpaging_remove_filename_from_comment.patch deleted file mode 100644 index edf66a2..0000000 --- a/24208-xenpaging_remove_filename_from_comment.patch +++ /dev/null @@ -1,47 +0,0 @@ -changeset: 24208:31fce41fc2b2 -user: Olaf Hering -date: Sun Nov 20 17:01:15 2011 +0100 -files: tools/xenpaging/file_ops.c tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c -description: -xenpaging: remove filename from comment - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/file_ops.c | 1 - - tools/xenpaging/policy_default.c | 1 - - tools/xenpaging/xenpaging.c | 1 - - 3 files changed, 3 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/file_ops.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/file_ops.c -+++ xen-4.1.2-testing/tools/xenpaging/file_ops.c -@@ -1,5 +1,4 @@ - /****************************************************************************** -- * tools/xenpaging/file_ops.c - * - * Common file operations. - * -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -1,5 +1,4 @@ - /****************************************************************************** -- * tools/xenpaging/policy.c - * - * Xen domain paging default policy. - * -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -1,5 +1,4 @@ - /****************************************************************************** -- * tools/xenpaging/xenpaging.c - * - * Domain paging. - * Copyright (c) 2009 by Citrix Systems, Inc. (Patrick Colp) diff --git a/24209-xenpaging_remove_obsolete_comment_in_resume_path.patch b/24209-xenpaging_remove_obsolete_comment_in_resume_path.patch deleted file mode 100644 index 2d7d717..0000000 --- a/24209-xenpaging_remove_obsolete_comment_in_resume_path.patch +++ /dev/null @@ -1,31 +0,0 @@ -changeset: 24209:fe8946916512 -user: Olaf Hering -date: Sun Nov 20 17:01:20 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: remove obsolete comment in resume path - -Remove stale comment. -If a page was populated several times the vcpu is paused and -xenpaging has to unpause it again. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 1 - - 1 file changed, 1 deletion(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -744,7 +744,6 @@ int main(int argc, char *argv[]) - !!(req.flags & MEM_EVENT_FLAG_EVICT_FAIL) ); - - /* Tell Xen to resume the vcpu */ -- /* XXX: Maybe just check if the vcpu was paused? */ - if ( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) - { - /* Prepare the response */ diff --git a/24210-xenpaging_use_PERROR_to_print_errno.patch b/24210-xenpaging_use_PERROR_to_print_errno.patch deleted file mode 100644 index 2141066..0000000 --- a/24210-xenpaging_use_PERROR_to_print_errno.patch +++ /dev/null @@ -1,285 +0,0 @@ -changeset: 24210:d1d54cdc4a7b -user: Olaf Hering -date: Sun Nov 20 17:01:32 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: use PERROR to print errno - -v3: - - adjust arguments for xc_mem_paging_enable() failures -v2: - - move changes to file_op() to different patch - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 58 ++++++++++++++++++++++---------------------- - 1 file changed, 29 insertions(+), 29 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -90,7 +90,7 @@ static int xenpaging_wait_for_event_or_t - if (errno == EINTR) - return 0; - -- ERROR("Poll exited with an error"); -+ PERROR("Poll exited with an error"); - return -errno; - } - -@@ -121,7 +121,7 @@ static int xenpaging_wait_for_event_or_t - port = xc_evtchn_pending(xce); - if ( port == -1 ) - { -- ERROR("Failed to read port from event channel"); -+ PERROR("Failed to read port from event channel"); - rc = -1; - goto err; - } -@@ -129,7 +129,7 @@ static int xenpaging_wait_for_event_or_t - rc = xc_evtchn_unmask(xce, port); - if ( rc < 0 ) - { -- ERROR("Failed to unmask event channel port"); -+ PERROR("Failed to unmask event channel port"); - } - } - err: -@@ -185,7 +185,7 @@ static xenpaging_t *xenpaging_init(domid - paging->xs_handle = xs_open(0); - if ( paging->xs_handle == NULL ) - { -- ERROR("Error initialising xenstore connection"); -+ PERROR("Error initialising xenstore connection"); - goto err; - } - -@@ -193,7 +193,7 @@ static xenpaging_t *xenpaging_init(domid - snprintf(watch_token, sizeof(watch_token), "%u", domain_id); - if ( xs_watch(paging->xs_handle, "@releaseDomain", watch_token) == false ) - { -- ERROR("Could not bind to shutdown watch\n"); -+ PERROR("Could not bind to shutdown watch\n"); - goto err; - } - -@@ -214,7 +214,7 @@ static xenpaging_t *xenpaging_init(domid - paging->mem_event.shared_page = init_page(); - if ( paging->mem_event.shared_page == NULL ) - { -- ERROR("Error initialising shared page"); -+ PERROR("Error initialising shared page"); - goto err; - } - -@@ -222,7 +222,7 @@ static xenpaging_t *xenpaging_init(domid - paging->mem_event.ring_page = init_page(); - if ( paging->mem_event.ring_page == NULL ) - { -- ERROR("Error initialising ring page"); -+ PERROR("Error initialising ring page"); - goto err; - } - -@@ -249,7 +249,7 @@ static xenpaging_t *xenpaging_init(domid - ERROR("xenpaging not supported in a PoD guest"); - break; - default: -- ERROR("Error initialising shared page: %s", strerror(errno)); -+ PERROR("Error initialising shared page"); - break; - } - goto err; -@@ -259,7 +259,7 @@ static xenpaging_t *xenpaging_init(domid - paging->mem_event.xce_handle = xc_evtchn_open(NULL, 0); - if ( paging->mem_event.xce_handle == NULL ) - { -- ERROR("Failed to open event channel"); -+ PERROR("Failed to open event channel"); - goto err; - } - -@@ -269,7 +269,7 @@ static xenpaging_t *xenpaging_init(domid - paging->mem_event.shared_page->port); - if ( rc < 0 ) - { -- ERROR("Failed to bind event channel"); -+ PERROR("Failed to bind event channel"); - goto err; - } - -@@ -279,7 +279,7 @@ static xenpaging_t *xenpaging_init(domid - paging->domain_info = malloc(sizeof(xc_domaininfo_t)); - if ( paging->domain_info == NULL ) - { -- ERROR("Error allocating memory for domain info"); -+ PERROR("Error allocating memory for domain info"); - goto err; - } - -@@ -287,7 +287,7 @@ static xenpaging_t *xenpaging_init(domid - paging->domain_info); - if ( rc != 1 ) - { -- ERROR("Error getting domain info"); -+ PERROR("Error getting domain info"); - goto err; - } - -@@ -295,7 +295,7 @@ static xenpaging_t *xenpaging_init(domid - paging->bitmap = bitmap_alloc(paging->domain_info->max_pages); - if ( !paging->bitmap ) - { -- ERROR("Error allocating bitmap"); -+ PERROR("Error allocating bitmap"); - goto err; - } - DPRINTF("max_pages = %"PRIx64"\n", paging->domain_info->max_pages); -@@ -311,7 +311,7 @@ static xenpaging_t *xenpaging_init(domid - rc = policy_init(paging); - if ( rc != 0 ) - { -- ERROR("Error initialising policy"); -+ PERROR("Error initialising policy"); - goto err; - } - -@@ -358,14 +358,14 @@ static int xenpaging_teardown(xenpaging_ - rc = xc_mem_paging_disable(xch, paging->mem_event.domain_id); - if ( rc != 0 ) - { -- ERROR("Error tearing down domain paging in xen"); -+ PERROR("Error tearing down domain paging in xen"); - } - - /* Unbind VIRQ */ - rc = xc_evtchn_unbind(paging->mem_event.xce_handle, paging->mem_event.port); - if ( rc != 0 ) - { -- ERROR("Error unbinding event port"); -+ PERROR("Error unbinding event port"); - } - paging->mem_event.port = -1; - -@@ -373,7 +373,7 @@ static int xenpaging_teardown(xenpaging_ - rc = xc_evtchn_close(paging->mem_event.xce_handle); - if ( rc != 0 ) - { -- ERROR("Error closing event channel"); -+ PERROR("Error closing event channel"); - } - paging->mem_event.xce_handle = NULL; - -@@ -384,7 +384,7 @@ static int xenpaging_teardown(xenpaging_ - rc = xc_interface_close(xch); - if ( rc != 0 ) - { -- ERROR("Error closing connection to xen"); -+ PERROR("Error closing connection to xen"); - } - - return 0; -@@ -444,7 +444,7 @@ static int xenpaging_evict_page(xenpagin - PROT_READ | PROT_WRITE, &gfn, 1); - if ( page == NULL ) - { -- ERROR("Error mapping page"); -+ PERROR("Error mapping page"); - goto out; - } - -@@ -452,8 +452,8 @@ static int xenpaging_evict_page(xenpagin - ret = write_page(fd, page, i); - if ( ret != 0 ) - { -+ PERROR("Error copying page"); - munmap(page, PAGE_SIZE); -- ERROR("Error copying page"); - goto out; - } - -@@ -464,7 +464,7 @@ static int xenpaging_evict_page(xenpagin - victim->gfn); - if ( ret != 0 ) - { -- ERROR("Error evicting page"); -+ PERROR("Error evicting page"); - goto out; - } - -@@ -520,7 +520,7 @@ static int xenpaging_populate_page(xenpa - sleep(1); - continue; - } -- ERROR("Error preparing for page in"); -+ PERROR("Error preparing for page in"); - goto out_map; - } - } -@@ -532,7 +532,7 @@ static int xenpaging_populate_page(xenpa - PROT_READ | PROT_WRITE, &gfn, 1); - if ( page == NULL ) - { -- ERROR("Error mapping page: page is null"); -+ PERROR("Error mapping page: page is null"); - goto out_map; - } - -@@ -540,7 +540,7 @@ static int xenpaging_populate_page(xenpa - ret = read_page(fd, page, i); - if ( ret != 0 ) - { -- ERROR("Error reading page"); -+ PERROR("Error reading page"); - goto out; - } - -@@ -579,7 +579,7 @@ static int evict_victim(xenpaging_t *pag - { - if ( j++ % 1000 == 0 ) - if ( xenpaging_mem_paging_flush_ioemu_cache(paging) ) -- ERROR("Error flushing ioemu cache"); -+ PERROR("Error flushing ioemu cache"); - } - } - while ( ret ); -@@ -670,7 +670,7 @@ int main(int argc, char *argv[]) - rc = xenpaging_wait_for_event_or_timeout(paging); - if ( rc < 0 ) - { -- ERROR("Error getting event"); -+ PERROR("Error getting event"); - goto out; - } - else if ( rc != 0 ) -@@ -710,7 +710,7 @@ int main(int argc, char *argv[]) - rc = xenpaging_populate_page(paging, req.gfn, fd, i); - if ( rc != 0 ) - { -- ERROR("Error populating page"); -+ PERROR("Error populating page"); - goto out; - } - } -@@ -723,7 +723,7 @@ int main(int argc, char *argv[]) - rc = xenpaging_resume_page(paging, &rsp, 1); - if ( rc != 0 ) - { -- ERROR("Error resuming page"); -+ PERROR("Error resuming page"); - goto out; - } - -@@ -754,7 +754,7 @@ int main(int argc, char *argv[]) - rc = xenpaging_resume_page(paging, &rsp, 0); - if ( rc != 0 ) - { -- ERROR("Error resuming"); -+ PERROR("Error resuming"); - goto out; - } - } diff --git a/24211-xenpaging_simplify_file_op.patch b/24211-xenpaging_simplify_file_op.patch deleted file mode 100644 index ce6eaf6..0000000 --- a/24211-xenpaging_simplify_file_op.patch +++ /dev/null @@ -1,91 +0,0 @@ -changeset: 24211:8ddac056a89e -user: Olaf Hering -date: Sun Nov 20 17:01:39 2011 +0100 -files: tools/xenpaging/file_ops.c -description: -xenpaging: simplify file_op - -Catch lseek() errors. -Use -1 as return value and let caller read errno. -Remove const casts from buffer pointers, the page is writeable. -Use wrapper for write() which matches the read() prototype. -Remove unused stdarg.h inclusion. -Remove unused macro. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/file_ops.c | 29 +++++++++-------------------- - 1 file changed, 9 insertions(+), 20 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/file_ops.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/file_ops.c -+++ xen-4.1.2-testing/tools/xenpaging/file_ops.c -@@ -21,55 +21,44 @@ - - - #include --#include - #include - -- --#define page_offset(_pfn) (((off_t)(_pfn)) << PAGE_SHIFT) -- -- - static int file_op(int fd, void *page, int i, -- ssize_t (*fn)(int, const void *, size_t)) -+ ssize_t (*fn)(int, void *, size_t)) - { - off_t seek_ret; -- int total; -+ int total = 0; - int bytes; -- int ret; - - seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET); -+ if ( seek_ret == (off_t)-1 ) -+ return -1; - -- total = 0; - while ( total < PAGE_SIZE ) - { - bytes = fn(fd, page + total, PAGE_SIZE - total); - if ( bytes <= 0 ) -- { -- ret = -errno; -- goto err; -- } -+ return -1; - - total += bytes; - } - - return 0; -- -- err: -- return ret; - } - --static ssize_t my_read(int fd, const void *buf, size_t count) -+static ssize_t my_write(int fd, void *buf, size_t count) - { -- return read(fd, (void *)buf, count); -+ return write(fd, buf, count); - } - - int read_page(int fd, void *page, int i) - { -- return file_op(fd, page, i, &my_read); -+ return file_op(fd, page, i, &read); - } - - int write_page(int fd, void *page, int i) - { -- return file_op(fd, page, i, &write); -+ return file_op(fd, page, i, &my_write); - } - - diff --git a/24212-xenpaging_print_gfn_in_failure_case.patch b/24212-xenpaging_print_gfn_in_failure_case.patch deleted file mode 100644 index 2a3bad8..0000000 --- a/24212-xenpaging_print_gfn_in_failure_case.patch +++ /dev/null @@ -1,100 +0,0 @@ -changeset: 24212:fbc31627adde -user: Olaf Hering -date: Sun Nov 20 17:01:41 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: print gfn in failure case - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -444,7 +444,7 @@ static int xenpaging_evict_page(xenpagin - PROT_READ | PROT_WRITE, &gfn, 1); - if ( page == NULL ) - { -- PERROR("Error mapping page"); -+ PERROR("Error mapping page %lx", victim->gfn); - goto out; - } - -@@ -452,7 +452,7 @@ static int xenpaging_evict_page(xenpagin - ret = write_page(fd, page, i); - if ( ret != 0 ) - { -- PERROR("Error copying page"); -+ PERROR("Error copying page %lx", victim->gfn); - munmap(page, PAGE_SIZE); - goto out; - } -@@ -464,7 +464,7 @@ static int xenpaging_evict_page(xenpagin - victim->gfn); - if ( ret != 0 ) - { -- PERROR("Error evicting page"); -+ PERROR("Error evicting page %lx", victim->gfn); - goto out; - } - -@@ -520,7 +520,7 @@ static int xenpaging_populate_page(xenpa - sleep(1); - continue; - } -- PERROR("Error preparing for page in"); -+ PERROR("Error preparing %"PRI_xen_pfn" for page-in", gfn); - goto out_map; - } - } -@@ -532,7 +532,7 @@ static int xenpaging_populate_page(xenpa - PROT_READ | PROT_WRITE, &gfn, 1); - if ( page == NULL ) - { -- PERROR("Error mapping page: page is null"); -+ PERROR("Error mapping page %"PRI_xen_pfn": page is null", gfn); - goto out_map; - } - -@@ -540,7 +540,7 @@ static int xenpaging_populate_page(xenpa - ret = read_page(fd, page, i); - if ( ret != 0 ) - { -- PERROR("Error reading page"); -+ PERROR("Error reading page %"PRI_xen_pfn"", gfn); - goto out; - } - -@@ -710,7 +710,7 @@ int main(int argc, char *argv[]) - rc = xenpaging_populate_page(paging, req.gfn, fd, i); - if ( rc != 0 ) - { -- PERROR("Error populating page"); -+ PERROR("Error populating page %"PRIx64"", req.gfn); - goto out; - } - } -@@ -723,7 +723,7 @@ int main(int argc, char *argv[]) - rc = xenpaging_resume_page(paging, &rsp, 1); - if ( rc != 0 ) - { -- PERROR("Error resuming page"); -+ PERROR("Error resuming page %"PRIx64"", req.gfn); - goto out; - } - -@@ -754,7 +754,7 @@ int main(int argc, char *argv[]) - rc = xenpaging_resume_page(paging, &rsp, 0); - if ( rc != 0 ) - { -- PERROR("Error resuming"); -+ PERROR("Error resuming page %"PRIx64"", req.gfn); - goto out; - } - } diff --git a/24213-xenpaging_update_xenpaging_init.patch b/24213-xenpaging_update_xenpaging_init.patch deleted file mode 100644 index 9b744f5..0000000 --- a/24213-xenpaging_update_xenpaging_init.patch +++ /dev/null @@ -1,78 +0,0 @@ -changeset: 24213:e3cbbad72382 -user: Olaf Hering -date: Sun Nov 20 17:02:22 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: update xenpaging_init - -Move comment about xc_handle to the right place. -Allocate paging early and use calloc. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -169,18 +169,21 @@ static xenpaging_t *xenpaging_init(domid - char *p; - int rc; - -+ /* Allocate memory */ -+ paging = calloc(1, sizeof(xenpaging_t)); -+ if ( !paging ) -+ goto err; -+ - if ( getenv("XENPAGING_DEBUG") ) - dbg = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, XTL_DEBUG, 0); -- xch = xc_interface_open(dbg, NULL, 0); -+ -+ /* Open connection to xen */ -+ paging->xc_handle = xch = xc_interface_open(dbg, NULL, 0); - if ( !xch ) -- goto err_iface; -+ goto err; - - DPRINTF("xenpaging init\n"); - -- /* Allocate memory */ -- paging = malloc(sizeof(xenpaging_t)); -- memset(paging, 0, sizeof(xenpaging_t)); -- - /* Open connection to xenstore */ - paging->xs_handle = xs_open(0); - if ( paging->xs_handle == NULL ) -@@ -204,9 +207,6 @@ static xenpaging_t *xenpaging_init(domid - DPRINTF("Setting policy mru_size to %d\n", paging->policy_mru_size); - } - -- /* Open connection to xen */ -- paging->xc_handle = xch; -- - /* Set domain id */ - paging->mem_event.domain_id = domain_id; - -@@ -322,7 +322,8 @@ static xenpaging_t *xenpaging_init(domid - { - if ( paging->xs_handle ) - xs_close(paging->xs_handle); -- xc_interface_close(xch); -+ if ( xch ) -+ xc_interface_close(xch); - if ( paging->mem_event.shared_page ) - { - munlock(paging->mem_event.shared_page, PAGE_SIZE); -@@ -340,7 +341,6 @@ static xenpaging_t *xenpaging_init(domid - free(paging); - } - -- err_iface: - return NULL; - } - diff --git a/24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch b/24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch deleted file mode 100644 index 7b7ed93..0000000 --- a/24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch +++ /dev/null @@ -1,145 +0,0 @@ -changeset: 24214:f06595abfa88 -user: Olaf Hering -date: Sun Nov 20 17:02:36 2011 +0100 -files: tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: remove xc_dominfo_t from paging_t - -Remove xc_dominfo_t from paging_t, record only max_pages. -This value is used to setup internal data structures. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/policy_default.c | 8 ++++---- - tools/xenpaging/xenpaging.c | 27 +++++++++++---------------- - tools/xenpaging/xenpaging.h | 4 ++-- - 3 files changed, 17 insertions(+), 22 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -41,17 +41,17 @@ int policy_init(xenpaging_t *paging) - int i; - int rc = -ENOMEM; - -+ max_pages = paging->max_pages; -+ - /* Allocate bitmap for pages not to page out */ -- bitmap = bitmap_alloc(paging->domain_info->max_pages); -+ bitmap = bitmap_alloc(max_pages); - if ( !bitmap ) - goto out; - /* Allocate bitmap to track unusable pages */ -- unconsumed = bitmap_alloc(paging->domain_info->max_pages); -+ unconsumed = bitmap_alloc(max_pages); - if ( !unconsumed ) - goto out; - -- max_pages = paging->domain_info->max_pages; -- - /* Initialise MRU list of paged in pages */ - if ( paging->policy_mru_size > 0 ) - mru_size = paging->policy_mru_size; -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -164,6 +164,7 @@ static void *init_page(void) - static xenpaging_t *xenpaging_init(domid_t domain_id, int num_pages) - { - xenpaging_t *paging; -+ xc_domaininfo_t domain_info; - xc_interface *xch; - xentoollog_logger *dbg = NULL; - char *p; -@@ -275,34 +276,29 @@ static xenpaging_t *xenpaging_init(domid - - paging->mem_event.port = rc; - -- /* Get domaininfo */ -- paging->domain_info = malloc(sizeof(xc_domaininfo_t)); -- if ( paging->domain_info == NULL ) -- { -- PERROR("Error allocating memory for domain info"); -- goto err; -- } -- - rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1, -- paging->domain_info); -+ &domain_info); - if ( rc != 1 ) - { - PERROR("Error getting domain info"); - goto err; - } - -+ /* Record number of max_pages */ -+ paging->max_pages = domain_info.max_pages; -+ - /* Allocate bitmap for tracking pages that have been paged out */ -- paging->bitmap = bitmap_alloc(paging->domain_info->max_pages); -+ paging->bitmap = bitmap_alloc(paging->max_pages); - if ( !paging->bitmap ) - { - PERROR("Error allocating bitmap"); - goto err; - } -- DPRINTF("max_pages = %"PRIx64"\n", paging->domain_info->max_pages); -+ DPRINTF("max_pages = %d\n", paging->max_pages); - -- if ( num_pages < 0 || num_pages > paging->domain_info->max_pages ) -+ if ( num_pages < 0 || num_pages > paging->max_pages ) - { -- num_pages = paging->domain_info->max_pages; -+ num_pages = paging->max_pages; - DPRINTF("setting num_pages to %d\n", num_pages); - } - paging->num_pages = num_pages; -@@ -337,7 +333,6 @@ static xenpaging_t *xenpaging_init(domid - } - - free(paging->bitmap); -- free(paging->domain_info); - free(paging); - } - -@@ -765,7 +760,7 @@ int main(int argc, char *argv[]) - if ( interrupted == SIGTERM || interrupted == SIGINT ) - { - int num = 0; -- for ( i = 0; i < paging->domain_info->max_pages; i++ ) -+ for ( i = 0; i < paging->max_pages; i++ ) - { - if ( test_bit(i, paging->bitmap) ) - { -@@ -781,7 +776,7 @@ int main(int argc, char *argv[]) - */ - if ( num ) - page_in_trigger(); -- else if ( i == paging->domain_info->max_pages ) -+ else if ( i == paging->max_pages ) - break; - } - else -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -44,11 +44,11 @@ typedef struct xenpaging { - xc_interface *xc_handle; - struct xs_handle *xs_handle; - -- xc_domaininfo_t *domain_info; -- - unsigned long *bitmap; - - mem_event_t mem_event; -+ /* number of pages for which data structures were allocated */ -+ int max_pages; - int num_pages; - int policy_mru_size; - unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE]; diff --git a/24215-xenpaging_track_the_number_of_paged-out_pages.patch b/24215-xenpaging_track_the_number_of_paged-out_pages.patch deleted file mode 100644 index 94dd1cc..0000000 --- a/24215-xenpaging_track_the_number_of_paged-out_pages.patch +++ /dev/null @@ -1,58 +0,0 @@ -changeset: 24215:dc7dabe2fe99 -user: Olaf Hering -date: Sun Nov 20 17:02:38 2011 +0100 -files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: track the number of paged-out pages - -This change is required by subsequent changes. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 8 ++++++++ - tools/xenpaging/xenpaging.h | 1 + - 2 files changed, 9 insertions(+) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -467,6 +467,9 @@ static int xenpaging_evict_page(xenpagin - /* Notify policy of page being paged out */ - policy_notify_paged_out(victim->gfn); - -+ /* Record number of evicted pages */ -+ paging->num_paged_out++; -+ - out: - return ret; - } -@@ -480,8 +483,13 @@ static int xenpaging_resume_page(xenpagi - - /* Notify policy of page being paged in */ - if ( notify_policy ) -+ { - policy_notify_paged_in(rsp->gfn); - -+ /* Record number of resumed pages */ -+ paging->num_paged_out--; -+ } -+ - /* Tell Xen page is ready */ - ret = xc_mem_paging_resume(paging->xc_handle, paging->mem_event.domain_id, - rsp->gfn); -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -49,6 +49,7 @@ typedef struct xenpaging { - mem_event_t mem_event; - /* number of pages for which data structures were allocated */ - int max_pages; -+ int num_paged_out; - int num_pages; - int policy_mru_size; - unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE]; diff --git a/24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch b/24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch deleted file mode 100644 index d2ee384..0000000 --- a/24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch +++ /dev/null @@ -1,172 +0,0 @@ -changeset: 24216:4fe585c2a3e5 -user: Olaf Hering -date: Sun Nov 20 17:02:39 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: move page add/resume loops into its own function. - -Move page resume loop into its own function. -Move page eviction loop into its own function. -Allocate all possible slots in a paging file to allow growing and -shrinking of the number of paged-out pages. Adjust other places to -iterate over all slots. - -This change is required by subsequent patches. - -v2: - - check if victims allocation succeeded - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 94 ++++++++++++++++++++++++++++---------------- - 1 file changed, 61 insertions(+), 33 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -553,6 +553,27 @@ static int xenpaging_populate_page(xenpa - return ret; - } - -+/* Trigger a page-in for a batch of pages */ -+static void resume_pages(xenpaging_t *paging, int num_pages) -+{ -+ xc_interface *xch = paging->xc_handle; -+ int i, num = 0; -+ -+ for ( i = 0; i < paging->max_pages && num < num_pages; i++ ) -+ { -+ if ( test_bit(i, paging->bitmap) ) -+ { -+ paging->pagein_queue[num] = i; -+ num++; -+ if ( num == XENPAGING_PAGEIN_QUEUE_SIZE ) -+ break; -+ } -+ } -+ /* num may be less than num_pages, caller has to try again */ -+ if ( num ) -+ page_in_trigger(); -+} -+ - static int evict_victim(xenpaging_t *paging, - xenpaging_victim_t *victim, int fd, int i) - { -@@ -596,6 +617,30 @@ static int evict_victim(xenpaging_t *pag - return ret; - } - -+/* Evict a batch of pages and write them to a free slot in the paging file */ -+static int evict_pages(xenpaging_t *paging, int fd, xenpaging_victim_t *victims, int num_pages) -+{ -+ xc_interface *xch = paging->xc_handle; -+ int rc, slot, num = 0; -+ -+ for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ ) -+ { -+ /* Slot is allocated */ -+ if ( victims[slot].gfn != INVALID_MFN ) -+ continue; -+ -+ rc = evict_victim(paging, &victims[slot], fd, slot); -+ if ( rc == -ENOSPC ) -+ break; -+ if ( rc == -EINTR ) -+ break; -+ if ( num && num % 100 == 0 ) -+ DPRINTF("%d pages evicted\n", num); -+ num++; -+ } -+ return num; -+} -+ - int main(int argc, char *argv[]) - { - struct sigaction act; -@@ -638,7 +683,14 @@ int main(int argc, char *argv[]) - return 2; - } - -- victims = calloc(paging->num_pages, sizeof(xenpaging_victim_t)); -+ /* Allocate upper limit of pages to allow growing and shrinking */ -+ victims = calloc(paging->max_pages, sizeof(xenpaging_victim_t)); -+ if ( !victims ) -+ goto out; -+ -+ /* Mark all slots as unallocated */ -+ for ( i = 0; i < paging->max_pages; i++ ) -+ victims[i].gfn = INVALID_MFN; - - /* ensure that if we get a signal, we'll do cleanup, then exit */ - act.sa_handler = close_handler; -@@ -652,18 +704,7 @@ int main(int argc, char *argv[]) - /* listen for page-in events to stop pager */ - create_page_in_thread(paging); - -- /* Evict pages */ -- for ( i = 0; i < paging->num_pages; i++ ) -- { -- rc = evict_victim(paging, &victims[i], fd, i); -- if ( rc == -ENOSPC ) -- break; -- if ( rc == -EINTR ) -- break; -- if ( i % 100 == 0 ) -- DPRINTF("%d pages evicted\n", i); -- } -- -+ i = evict_pages(paging, fd, victims, paging->num_pages); - DPRINTF("%d pages evicted. Done.\n", i); - - /* Swap pages in and out */ -@@ -689,13 +730,13 @@ int main(int argc, char *argv[]) - if ( test_and_clear_bit(req.gfn, paging->bitmap) ) - { - /* Find where in the paging file to read from */ -- for ( i = 0; i < paging->num_pages; i++ ) -+ for ( i = 0; i < paging->max_pages; i++ ) - { - if ( victims[i].gfn == req.gfn ) - break; - } - -- if ( i >= paging->num_pages ) -+ if ( i >= paging->max_pages ) - { - DPRINTF("Couldn't find page %"PRIx64"\n", req.gfn); - goto out; -@@ -767,25 +808,12 @@ int main(int argc, char *argv[]) - /* Write all pages back into the guest */ - if ( interrupted == SIGTERM || interrupted == SIGINT ) - { -- int num = 0; -- for ( i = 0; i < paging->max_pages; i++ ) -- { -- if ( test_bit(i, paging->bitmap) ) -- { -- paging->pagein_queue[num] = i; -- num++; -- if ( num == XENPAGING_PAGEIN_QUEUE_SIZE ) -- break; -- } -- } -- /* -- * One more round if there are still pages to process. -- * If no more pages to process, exit loop. -- */ -- if ( num ) -- page_in_trigger(); -- else if ( i == paging->max_pages ) -+ /* If no more pages to process, exit loop. */ -+ if ( !paging->num_paged_out ) - break; -+ -+ /* One more round if there are still pages to process. */ -+ resume_pages(paging, paging->num_paged_out); - } - else - { diff --git a/24217-xenpaging_improve_mainloop_exit_handling.patch b/24217-xenpaging_improve_mainloop_exit_handling.patch deleted file mode 100644 index 6328867..0000000 --- a/24217-xenpaging_improve_mainloop_exit_handling.patch +++ /dev/null @@ -1,53 +0,0 @@ -changeset: 24217:b531f5ceddf0 -user: Olaf Hering -date: Sun Nov 20 17:02:39 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: improve mainloop exit handling - -Remove the if/else logic to exit from the in case a signal arrives. -Update comments. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 16 +++++++++------- - 1 file changed, 9 insertions(+), 7 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -805,7 +805,7 @@ int main(int argc, char *argv[]) - } - } - -- /* Write all pages back into the guest */ -+ /* If interrupted, write all pages back into the guest */ - if ( interrupted == SIGTERM || interrupted == SIGINT ) - { - /* If no more pages to process, exit loop. */ -@@ -814,13 +814,15 @@ int main(int argc, char *argv[]) - - /* One more round if there are still pages to process. */ - resume_pages(paging, paging->num_paged_out); -+ -+ /* Resume main loop */ -+ continue; - } -- else -- { -- /* Exit on any other signal */ -- if ( interrupted ) -- break; -- } -+ -+ /* Exit main loop on any other signal */ -+ if ( interrupted ) -+ break; -+ - } - DPRINTF("xenpaging got signal %d\n", interrupted); - diff --git a/24218-libxc_add_bitmap_clear_function.patch b/24218-libxc_add_bitmap_clear_function.patch deleted file mode 100644 index 7ca79e8..0000000 --- a/24218-libxc_add_bitmap_clear_function.patch +++ /dev/null @@ -1,39 +0,0 @@ -changeset: 24218:a2b4ae2becdf -user: Olaf Hering -date: Sun Nov 20 17:02:40 2011 +0100 -files: tools/libxc/xc_bitops.h -description: -libxc: add bitmap_clear function - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/libxc/xc_bitops.h | 6 ++++++ - 1 file changed, 6 insertions(+) - -Index: xen-4.1.2-testing/tools/libxc/xc_bitops.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_bitops.h -+++ xen-4.1.2-testing/tools/libxc/xc_bitops.h -@@ -4,6 +4,7 @@ - /* bitmap operations for single threaded access */ - - #include -+#include - - #define BITS_PER_LONG (sizeof(unsigned long) * 8) - #define ORDER_LONG (sizeof(unsigned long) == 4 ? 5 : 6) -@@ -25,6 +26,11 @@ static inline unsigned long *bitmap_allo - return calloc(1, bitmap_size(nr_bits)); - } - -+static inline void bitmap_clear(unsigned long *addr, int nr_bits) -+{ -+ memset(addr, 0, bitmap_size(nr_bits)); -+} -+ - static inline int test_bit(int nr, volatile unsigned long *addr) - { - return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1; diff --git a/24219-xenpaging_retry_unpageable_gfns.patch b/24219-xenpaging_retry_unpageable_gfns.patch deleted file mode 100644 index b83f013..0000000 --- a/24219-xenpaging_retry_unpageable_gfns.patch +++ /dev/null @@ -1,55 +0,0 @@ -changeset: 24219:8eba32b9598c -user: Olaf Hering -date: Sun Nov 20 17:02:41 2011 +0100 -files: tools/xenpaging/policy_default.c -description: -xenpaging: retry unpageable gfns - -Nomination of gfns can fail, but may succeed later. -Thats the case for a guest that starts ballooned. - -v2: - - print debug when clearing uncosumed happens - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/policy_default.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -32,6 +32,7 @@ static unsigned int i_mru; - static unsigned int mru_size; - static unsigned long *bitmap; - static unsigned long *unconsumed; -+static unsigned int unconsumed_cleared; - static unsigned long current_gfn; - static unsigned long max_pages; - -@@ -87,8 +88,21 @@ int policy_choose_victim(xenpaging_t *pa - current_gfn++; - if ( current_gfn >= max_pages ) - current_gfn = 0; -+ /* Could not nominate any gfn */ - if ( wrap == current_gfn ) - { -+ /* Count wrap arounds */ -+ unconsumed_cleared++; -+ /* Force retry every few seconds (depends on poll() timeout) */ -+ if ( unconsumed_cleared > 123) -+ { -+ /* Force retry of unconsumed gfns */ -+ bitmap_clear(unconsumed, max_pages); -+ unconsumed_cleared = 0; -+ DPRINTF("clearing unconsumed, wrap %lx", wrap); -+ /* One more round before returning ENOSPC */ -+ continue; -+ } - victim->gfn = INVALID_MFN; - return -ENOSPC; - } diff --git a/24220-xenpaging_install_into_LIBEXEC_dir.patch b/24220-xenpaging_install_into_LIBEXEC_dir.patch deleted file mode 100644 index d983b5e..0000000 --- a/24220-xenpaging_install_into_LIBEXEC_dir.patch +++ /dev/null @@ -1,33 +0,0 @@ -changeset: 24220:2087f21befc2 -user: Olaf Hering -date: Sun Nov 20 17:02:42 2011 +0100 -files: tools/xenpaging/Makefile -description: -xenpaging: install into LIBEXEC dir - -In preparation of upcoming libxl integration, -move xenpaging binary from /usr/sbin/ to /usr/lib/xen/bin/ - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/Makefile -+++ xen-4.1.2-testing/tools/xenpaging/Makefile -@@ -29,8 +29,8 @@ xenpaging: $(OBJS) - - install: all - $(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging -- $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) -- $(INSTALL_PROG) $(IBINS) $(DESTDIR)$(SBINDIR) -+ $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC) -+ $(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC) - - clean: - rm -f *.o *~ $(DEPS) xen TAGS $(IBINS) $(LIB) diff --git a/24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch b/24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch deleted file mode 100644 index 96c08b9..0000000 --- a/24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch +++ /dev/null @@ -1,58 +0,0 @@ -changeset: 24221:cd5948592b10 -user: Olaf Hering -date: Sun Nov 20 17:02:43 2011 +0100 -files: Config.mk config/StdGNU.mk tools/libxl/libxl.h tools/libxl/libxl_paths.c tools/xenpaging/Makefile -description: -xenpaging: add XEN_PAGING_DIR / libxl_xenpaging_dir_path() - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - Config.mk | 1 + - config/StdGNU.mk | 2 ++ - tools/xenpaging/Makefile | 2 +- - 3 files changed, 4 insertions(+), 1 deletion(-) - -Index: xen-4.1.2-testing/Config.mk -=================================================================== ---- xen-4.1.2-testing.orig/Config.mk -+++ xen-4.1.2-testing/Config.mk -@@ -124,6 +124,7 @@ define buildmakevars2file-closure - echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1).tmp; \ - echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1).tmp; \ - echo "XEN_LOCK_DIR=\"$(XEN_LOCK_DIR)\"" >> $(1).tmp; \ -+ echo "XEN_PAGING_DIR=\"$(XEN_PAGING_DIR)\"" >> $(1).tmp; \ - if ! cmp $(1).tmp $(1); then mv -f $(1).tmp $(1); fi - endef - -Index: xen-4.1.2-testing/config/StdGNU.mk -=================================================================== ---- xen-4.1.2-testing.orig/config/StdGNU.mk -+++ xen-4.1.2-testing/config/StdGNU.mk -@@ -46,9 +46,11 @@ PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin - ifeq ($(PREFIX),/usr) - CONFIG_DIR = /etc - XEN_LOCK_DIR = /var/lock -+XEN_PAGING_DIR = /var/lib/xen/xenpaging - else - CONFIG_DIR = $(PREFIX)/etc - XEN_LOCK_DIR = $(PREFIX)/var/lock -+XEN_PAGING_DIR = $(PREFIX)/var/lib/xen/xenpaging - endif - - SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR) -Index: xen-4.1.2-testing/tools/xenpaging/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/Makefile -+++ xen-4.1.2-testing/tools/xenpaging/Makefile -@@ -28,7 +28,7 @@ xenpaging: $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) - - install: all -- $(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging -+ $(INSTALL_DIR) $(DESTDIR)$(XEN_PAGING_DIR) - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC) - $(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC) - diff --git a/24222-xenpaging_use_guests_tot_pages_as_working_target.patch b/24222-xenpaging_use_guests_tot_pages_as_working_target.patch deleted file mode 100644 index aba5952..0000000 --- a/24222-xenpaging_use_guests_tot_pages_as_working_target.patch +++ /dev/null @@ -1,192 +0,0 @@ -changeset: 24222:286a741b4d86 -user: Olaf Hering -date: Sun Nov 20 17:02:45 2011 +0100 -files: tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: use guests tot_pages as working target - -This change reverses the task of xenpaging. Before this change a fixed number -of pages was paged out. With this change the guest will not have access to -more than the given number of pages at the same time. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/policy_default.c | 1 - tools/xenpaging/xenpaging.c | 78 ++++++++++++++++++++++++++++++--------- - tools/xenpaging/xenpaging.h | 2 - - 3 files changed, 61 insertions(+), 20 deletions(-) - -Index: xen-4.1.3-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.3-testing/tools/xenpaging/policy_default.c -@@ -71,7 +71,6 @@ int policy_init(xenpaging_t *paging) - - /* Start in the middle to avoid paging during BIOS startup */ - current_gfn = max_pages / 2; -- current_gfn -= paging->num_pages / 2; - - rc = 0; - out: -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c -@@ -136,6 +136,21 @@ err: - return rc; - } - -+static int xenpaging_get_tot_pages(xenpaging_t *paging) -+{ -+ xc_interface *xch = paging->xc_handle; -+ xc_domaininfo_t domain_info; -+ int rc; -+ -+ rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1, &domain_info); -+ if ( rc != 1 ) -+ { -+ PERROR("Error getting domain info"); -+ return -1; -+ } -+ return domain_info.tot_pages; -+} -+ - static void *init_page(void) - { - void *buffer; -@@ -161,7 +176,7 @@ static void *init_page(void) - return NULL; - } - --static xenpaging_t *xenpaging_init(domid_t domain_id, int num_pages) -+static xenpaging_t *xenpaging_init(domid_t domain_id, int target_tot_pages) - { - xenpaging_t *paging; - xc_domaininfo_t domain_info; -@@ -296,12 +311,7 @@ static xenpaging_t *xenpaging_init(domid - } - DPRINTF("max_pages = %d\n", paging->max_pages); - -- if ( num_pages < 0 || num_pages > paging->max_pages ) -- { -- num_pages = paging->max_pages; -- DPRINTF("setting num_pages to %d\n", num_pages); -- } -- paging->num_pages = num_pages; -+ paging->target_tot_pages = target_tot_pages; - - /* Initialise policy */ - rc = policy_init(paging); -@@ -648,7 +658,9 @@ int main(int argc, char *argv[]) - xenpaging_victim_t *victims; - mem_event_request_t req; - mem_event_response_t rsp; -+ int num, prev_num = 0; - int i; -+ int tot_pages; - int rc = -1; - int rc1; - xc_interface *xch; -@@ -659,7 +671,7 @@ int main(int argc, char *argv[]) - - if ( argc != 3 ) - { -- fprintf(stderr, "Usage: %s \n", argv[0]); -+ fprintf(stderr, "Usage: %s \n", argv[0]); - return -1; - } - -@@ -672,7 +684,7 @@ int main(int argc, char *argv[]) - } - xch = paging->xc_handle; - -- DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, paging->num_pages); -+ DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, paging->target_tot_pages); - - /* Open file */ - sprintf(filename, "page_cache_%u", paging->mem_event.domain_id); -@@ -704,9 +716,6 @@ int main(int argc, char *argv[]) - /* listen for page-in events to stop pager */ - create_page_in_thread(paging); - -- i = evict_pages(paging, fd, victims, paging->num_pages); -- DPRINTF("%d pages evicted. Done.\n", i); -- - /* Swap pages in and out */ - while ( 1 ) - { -@@ -771,12 +780,8 @@ int main(int argc, char *argv[]) - goto out; - } - -- /* Evict a new page to replace the one we just paged in, -- * or clear this pagefile slot on exit */ -- if ( interrupted ) -- victims[i].gfn = INVALID_MFN; -- else -- evict_victim(paging, &victims[i], fd, i); -+ /* Clear this pagefile slot */ -+ victims[i].gfn = INVALID_MFN; - } - else - { -@@ -823,6 +828,43 @@ int main(int argc, char *argv[]) - if ( interrupted ) - break; - -+ /* Check if the target has been reached already */ -+ tot_pages = xenpaging_get_tot_pages(paging); -+ if ( tot_pages < 0 ) -+ goto out; -+ -+ /* Resume all pages if paging is disabled or no target was set */ -+ if ( paging->target_tot_pages == 0 ) -+ { -+ if ( paging->num_paged_out ) -+ resume_pages(paging, paging->num_paged_out); -+ } -+ /* Evict more pages if target not reached */ -+ else if ( tot_pages > paging->target_tot_pages ) -+ { -+ num = tot_pages - paging->target_tot_pages; -+ if ( num != prev_num ) -+ { -+ DPRINTF("Need to evict %d pages to reach %d target_tot_pages\n", num, paging->target_tot_pages); -+ prev_num = num; -+ } -+ /* Limit the number of evicts to be able to process page-in requests */ -+ if ( num > 42 ) -+ num = 42; -+ evict_pages(paging, fd, victims, num); -+ } -+ /* Resume some pages if target not reached */ -+ else if ( tot_pages < paging->target_tot_pages && paging->num_paged_out ) -+ { -+ num = paging->target_tot_pages - tot_pages; -+ if ( num != prev_num ) -+ { -+ DPRINTF("Need to resume %d pages to reach %d target_tot_pages\n", num, paging->target_tot_pages); -+ prev_num = num; -+ } -+ resume_pages(paging, num); -+ } -+ - } - DPRINTF("xenpaging got signal %d\n", interrupted); - -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.h -@@ -50,7 +50,7 @@ typedef struct xenpaging { - /* number of pages for which data structures were allocated */ - int max_pages; - int num_paged_out; -- int num_pages; -+ int target_tot_pages; - int policy_mru_size; - unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE]; - } xenpaging_t; diff --git a/24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch b/24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch deleted file mode 100644 index 5980d37..0000000 --- a/24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch +++ /dev/null @@ -1,125 +0,0 @@ -changeset: 24223:9e3c2ef70c8a -user: Olaf Hering -date: Sun Nov 20 17:02:47 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: watch the guests memory/target-tot_pages xenstore value - -Subsequent patches will use xenstored to store the numbers of pages -xenpaging is suppose to page-out. -Remove num_pages and use target_pages instead. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 51 +++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 50 insertions(+), 1 deletion(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -19,8 +19,10 @@ - */ - - #define _XOPEN_SOURCE 600 -+#define _GNU_SOURCE - - #include -+#include - #include - #include - #include -@@ -35,6 +37,10 @@ - #include "policy.h" - #include "xenpaging.h" - -+/* Defines number of mfns a guest should use at a time, in KiB */ -+#define WATCH_TARGETPAGES "memory/target-tot_pages" -+static char *watch_target_tot_pages; -+static char *dom_path; - static char watch_token[16]; - static char filename[80]; - static int interrupted; -@@ -72,7 +78,7 @@ static int xenpaging_wait_for_event_or_t - { - xc_interface *xch = paging->xc_handle; - xc_evtchn *xce = paging->mem_event.xce_handle; -- char **vec; -+ char **vec, *val; - unsigned int num; - struct pollfd fd[2]; - int port; -@@ -111,6 +117,25 @@ static int xenpaging_wait_for_event_or_t - rc = 0; - } - } -+ else if ( strcmp(vec[XS_WATCH_PATH], watch_target_tot_pages) == 0 ) -+ { -+ int ret, target_tot_pages; -+ val = xs_read(paging->xs_handle, XBT_NULL, vec[XS_WATCH_PATH], NULL); -+ if ( val ) -+ { -+ ret = sscanf(val, "%d", &target_tot_pages); -+ if ( ret > 0 ) -+ { -+ /* KiB to pages */ -+ target_tot_pages >>= 2; -+ if ( target_tot_pages < 0 || target_tot_pages > paging->max_pages ) -+ target_tot_pages = paging->max_pages; -+ paging->target_tot_pages = target_tot_pages; -+ DPRINTF("new target_tot_pages %d\n", target_tot_pages); -+ } -+ free(val); -+ } -+ } - free(vec); - } - } -@@ -216,6 +241,25 @@ static xenpaging_t *xenpaging_init(domid - goto err; - } - -+ /* Watch xenpagings working target */ -+ dom_path = xs_get_domain_path(paging->xs_handle, domain_id); -+ if ( !dom_path ) -+ { -+ PERROR("Could not find domain path\n"); -+ goto err; -+ } -+ if ( asprintf(&watch_target_tot_pages, "%s/%s", dom_path, WATCH_TARGETPAGES) < 0 ) -+ { -+ PERROR("Could not alloc watch path\n"); -+ goto err; -+ } -+ DPRINTF("watching '%s'\n", watch_target_tot_pages); -+ if ( xs_watch(paging->xs_handle, watch_target_tot_pages, "") == false ) -+ { -+ PERROR("Could not bind to xenpaging watch\n"); -+ goto err; -+ } -+ - p = getenv("XENPAGING_POLICY_MRU_SIZE"); - if ( p && *p ) - { -@@ -342,6 +386,8 @@ static xenpaging_t *xenpaging_init(domid - free(paging->mem_event.ring_page); - } - -+ free(dom_path); -+ free(watch_target_tot_pages); - free(paging->bitmap); - free(paging); - } -@@ -357,6 +403,9 @@ static int xenpaging_teardown(xenpaging_ - if ( paging == NULL ) - return 0; - -+ xs_unwatch(paging->xs_handle, watch_target_tot_pages, ""); -+ xs_unwatch(paging->xs_handle, "@releaseDomain", watch_token); -+ - xch = paging->xc_handle; - paging->xc_handle = NULL; - /* Tear down domain paging in Xen */ diff --git a/24224-xenpaging_add_cmdline_interface_for_pager.patch b/24224-xenpaging_add_cmdline_interface_for_pager.patch deleted file mode 100644 index 1c0af57..0000000 --- a/24224-xenpaging_add_cmdline_interface_for_pager.patch +++ /dev/null @@ -1,273 +0,0 @@ -changeset: 24224:7243fd87410e -user: Olaf Hering -date: Sun Nov 20 17:02:48 2011 +0100 -files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h -description: -xenpaging: add cmdline interface for pager - -Introduce a cmdline handling for the pager. This simplifies libxl support, -debug and mru_size are not passed via the environment anymore. -The new interface looks like this: - -xenpaging [options] -f -d -options: - -d --domain= numerical domain_id of guest. This option is required. - -f --pagefile= pagefile to use. This option is required. - -m --max_memkb= maximum amount of memory to handle. - -r --mru_size= number of paged-in pages to keep in memory. - -d --debug enable debug output. - -h --help this output. - - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 139 ++++++++++++++++++++++++++++++++------------ - tools/xenpaging/xenpaging.h | 1 - 2 files changed, 103 insertions(+), 37 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - - #include "xc_bitops.h" - #include "file_ops.h" -@@ -42,12 +43,12 @@ - static char *watch_target_tot_pages; - static char *dom_path; - static char watch_token[16]; --static char filename[80]; -+static char *filename; - static int interrupted; - - static void unlink_pagefile(void) - { -- if ( filename[0] ) -+ if ( filename && filename[0] ) - { - unlink(filename); - filename[0] = '\0'; -@@ -201,11 +202,85 @@ static void *init_page(void) - return NULL; - } - --static xenpaging_t *xenpaging_init(domid_t domain_id, int target_tot_pages) -+static void usage(void) -+{ -+ printf("usage:\n\n"); -+ -+ printf(" xenpaging [options] -f -d \n\n"); -+ -+ printf("options:\n"); -+ printf(" -d --domain= numerical domain_id of guest. This option is required.\n"); -+ printf(" -f --pagefile= pagefile to use. This option is required.\n"); -+ printf(" -m --max_memkb= maximum amount of memory to handle.\n"); -+ printf(" -r --mru_size= number of paged-in pages to keep in memory.\n"); -+ printf(" -v --verbose enable debug output.\n"); -+ printf(" -h --help this output.\n"); -+} -+ -+static int xenpaging_getopts(xenpaging_t *paging, int argc, char *argv[]) -+{ -+ int ch; -+ static const char sopts[] = "hvd:f:m:r:"; -+ static const struct option lopts[] = { -+ {"help", 0, NULL, 'h'}, -+ {"verbose", 0, NULL, 'v'}, -+ {"domain", 1, NULL, 'd'}, -+ {"pagefile", 1, NULL, 'f'}, -+ {"mru_size", 1, NULL, 'm'}, -+ { } -+ }; -+ -+ while ((ch = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) -+ { -+ switch(ch) { -+ case 'd': -+ paging->mem_event.domain_id = atoi(optarg); -+ break; -+ case 'f': -+ filename = strdup(optarg); -+ break; -+ case 'm': -+ /* KiB to pages */ -+ paging->max_pages = atoi(optarg) >> 2; -+ break; -+ case 'r': -+ paging->policy_mru_size = atoi(optarg); -+ break; -+ case 'v': -+ paging->debug = 1; -+ break; -+ case 'h': -+ case '?': -+ usage(); -+ return 1; -+ } -+ } -+ -+ argv += optind; argc -= optind; -+ -+ /* Path to pagefile is required */ -+ if ( !filename ) -+ { -+ printf("Filename for pagefile missing!\n"); -+ usage(); -+ return 1; -+ } -+ -+ /* Set domain id */ -+ if ( !paging->mem_event.domain_id ) -+ { -+ printf("Numerical missing!\n"); -+ return 1; -+ } -+ -+ return 0; -+} -+ -+static xenpaging_t *xenpaging_init(int argc, char *argv[]) - { - xenpaging_t *paging; - xc_domaininfo_t domain_info; -- xc_interface *xch; -+ xc_interface *xch = NULL; - xentoollog_logger *dbg = NULL; - char *p; - int rc; -@@ -215,7 +290,12 @@ static xenpaging_t *xenpaging_init(domid - if ( !paging ) - goto err; - -- if ( getenv("XENPAGING_DEBUG") ) -+ /* Get cmdline options and domain_id */ -+ if ( xenpaging_getopts(paging, argc, argv) ) -+ goto err; -+ -+ /* Enable debug output */ -+ if ( paging->debug ) - dbg = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, XTL_DEBUG, 0); - - /* Open connection to xen */ -@@ -234,7 +314,7 @@ static xenpaging_t *xenpaging_init(domid - } - - /* write domain ID to watch so we can ignore other domain shutdowns */ -- snprintf(watch_token, sizeof(watch_token), "%u", domain_id); -+ snprintf(watch_token, sizeof(watch_token), "%u", paging->mem_event.domain_id); - if ( xs_watch(paging->xs_handle, "@releaseDomain", watch_token) == false ) - { - PERROR("Could not bind to shutdown watch\n"); -@@ -242,7 +322,7 @@ static xenpaging_t *xenpaging_init(domid - } - - /* Watch xenpagings working target */ -- dom_path = xs_get_domain_path(paging->xs_handle, domain_id); -+ dom_path = xs_get_domain_path(paging->xs_handle, paging->mem_event.domain_id); - if ( !dom_path ) - { - PERROR("Could not find domain path\n"); -@@ -260,16 +340,6 @@ static xenpaging_t *xenpaging_init(domid - goto err; - } - -- p = getenv("XENPAGING_POLICY_MRU_SIZE"); -- if ( p && *p ) -- { -- paging->policy_mru_size = atoi(p); -- DPRINTF("Setting policy mru_size to %d\n", paging->policy_mru_size); -- } -- -- /* Set domain id */ -- paging->mem_event.domain_id = domain_id; -- - /* Initialise shared page */ - paging->mem_event.shared_page = init_page(); - if ( paging->mem_event.shared_page == NULL ) -@@ -335,16 +405,20 @@ static xenpaging_t *xenpaging_init(domid - - paging->mem_event.port = rc; - -- rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1, -- &domain_info); -- if ( rc != 1 ) -+ /* Get max_pages from guest if not provided via cmdline */ -+ if ( !paging->max_pages ) - { -- PERROR("Error getting domain info"); -- goto err; -- } -+ rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1, -+ &domain_info); -+ if ( rc != 1 ) -+ { -+ PERROR("Error getting domain info"); -+ goto err; -+ } - -- /* Record number of max_pages */ -- paging->max_pages = domain_info.max_pages; -+ /* Record number of max_pages */ -+ paging->max_pages = domain_info.max_pages; -+ } - - /* Allocate bitmap for tracking pages that have been paged out */ - paging->bitmap = bitmap_alloc(paging->max_pages); -@@ -355,8 +429,6 @@ static xenpaging_t *xenpaging_init(domid - } - DPRINTF("max_pages = %d\n", paging->max_pages); - -- paging->target_tot_pages = target_tot_pages; -- - /* Initialise policy */ - rc = policy_init(paging); - if ( rc != 0 ) -@@ -718,25 +790,18 @@ int main(int argc, char *argv[]) - mode_t open_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH; - int fd; - -- if ( argc != 3 ) -- { -- fprintf(stderr, "Usage: %s \n", argv[0]); -- return -1; -- } -- - /* Initialise domain paging */ -- paging = xenpaging_init(atoi(argv[1]), atoi(argv[2])); -+ paging = xenpaging_init(argc, argv); - if ( paging == NULL ) - { -- fprintf(stderr, "Error initialising paging"); -+ fprintf(stderr, "Error initialising paging\n"); - return 1; - } - xch = paging->xc_handle; - -- DPRINTF("starting %s %u %d\n", argv[0], paging->mem_event.domain_id, paging->target_tot_pages); -+ DPRINTF("starting %s for domain_id %u with pagefile %s\n", argv[0], paging->mem_event.domain_id, filename); - - /* Open file */ -- sprintf(filename, "page_cache_%u", paging->mem_event.domain_id); - fd = open(filename, open_flags, open_mode); - if ( fd < 0 ) - { -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -52,6 +52,7 @@ typedef struct xenpaging { - int num_paged_out; - int target_tot_pages; - int policy_mru_size; -+ int debug; - unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE]; - } xenpaging_t; - diff --git a/24225-xenpaging_improve_policy_mru_list_handling.patch b/24225-xenpaging_improve_policy_mru_list_handling.patch deleted file mode 100644 index f53f716..0000000 --- a/24225-xenpaging_improve_policy_mru_list_handling.patch +++ /dev/null @@ -1,127 +0,0 @@ -changeset: 24225:d47d1ad56366 -user: Olaf Hering -date: Sun Nov 20 17:02:50 2011 +0100 -files: tools/xenpaging/policy.h tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c -description: -xenpaging: improve policy mru list handling - -Without this change it is not possible to page-out all guest pages, then -trigger a page-in for all pages, and then page-out everything once -again. All pages in the mru list can not be paged out because they -remain active in the internal bitmap of paged pages. - -Use the mru list only if the number of paged-out pages is larger than -the mru list. If the number is smaller, start to clear the mru list. In -case the number of paged-out pages drops to zero the mru list and the -internal bitmap will be empty as well. - -Also add a new interface for dropped pages. If a gfn was dropped there -is no need to adjust the mru list because dropping a page is not usage -of a page. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/policy.h | 2 ++ - tools/xenpaging/policy_default.c | 27 ++++++++++++++++++++++++--- - tools/xenpaging/xenpaging.c | 11 +++++++++-- - 3 files changed, 35 insertions(+), 5 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/policy.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy.h -+++ xen-4.1.2-testing/tools/xenpaging/policy.h -@@ -32,6 +32,8 @@ int policy_init(xenpaging_t *paging); - int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim); - void policy_notify_paged_out(unsigned long gfn); - void policy_notify_paged_in(unsigned long gfn); -+void policy_notify_paged_in_nomru(unsigned long gfn); -+void policy_notify_dropped(unsigned long gfn); - - #endif // __XEN_PAGING_POLICY_H__ - -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -57,7 +57,7 @@ int policy_init(xenpaging_t *paging) - if ( paging->policy_mru_size > 0 ) - mru_size = paging->policy_mru_size; - else -- mru_size = DEFAULT_MRU_SIZE; -+ mru_size = paging->policy_mru_size = DEFAULT_MRU_SIZE; - - mru = malloc(sizeof(*mru) * mru_size); - if ( mru == NULL ) -@@ -120,17 +120,38 @@ void policy_notify_paged_out(unsigned lo - clear_bit(gfn, unconsumed); - } - --void policy_notify_paged_in(unsigned long gfn) -+static void policy_handle_paged_in(unsigned long gfn, int do_mru) - { - unsigned long old_gfn = mru[i_mru & (mru_size - 1)]; - - if ( old_gfn != INVALID_MFN ) - clear_bit(old_gfn, bitmap); - -- mru[i_mru & (mru_size - 1)] = gfn; -+ if (do_mru) { -+ mru[i_mru & (mru_size - 1)] = gfn; -+ } else { -+ clear_bit(gfn, bitmap); -+ mru[i_mru & (mru_size - 1)] = INVALID_MFN; -+ } -+ - i_mru++; - } - -+void policy_notify_paged_in(unsigned long gfn) -+{ -+ policy_handle_paged_in(gfn, 1); -+} -+ -+void policy_notify_paged_in_nomru(unsigned long gfn) -+{ -+ policy_handle_paged_in(gfn, 0); -+} -+ -+void policy_notify_dropped(unsigned long gfn) -+{ -+ clear_bit(gfn, bitmap); -+} -+ - - /* - * Local variables: -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -615,7 +615,14 @@ static int xenpaging_resume_page(xenpagi - /* Notify policy of page being paged in */ - if ( notify_policy ) - { -- policy_notify_paged_in(rsp->gfn); -+ /* -+ * Do not add gfn to mru list if the target is lower than mru size. -+ * This allows page-out of these gfns if the target grows again. -+ */ -+ if (paging->num_paged_out > paging->policy_mru_size) -+ policy_notify_paged_in(rsp->gfn); -+ else -+ policy_notify_paged_in_nomru(rsp->gfn); - - /* Record number of resumed pages */ - paging->num_paged_out--; -@@ -869,7 +876,7 @@ int main(int argc, char *argv[]) - { - DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, i); - /* Notify policy of page being dropped */ -- policy_notify_paged_in(req.gfn); -+ policy_notify_dropped(req.gfn); - } - else - { diff --git a/24226-xenpaging_add_debug_to_show_received_watch_event..patch b/24226-xenpaging_add_debug_to_show_received_watch_event..patch deleted file mode 100644 index b40448b..0000000 --- a/24226-xenpaging_add_debug_to_show_received_watch_event..patch +++ /dev/null @@ -1,27 +0,0 @@ -changeset: 24226:c9b75ccd3ebf -user: Olaf Hering -date: Sun Nov 20 18:26:15 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: add debug to show received watch event. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 1 + - 1 file changed, 1 insertion(+) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -108,6 +108,7 @@ static int xenpaging_wait_for_event_or_t - vec = xs_read_watch(paging->xs_handle, &num); - if ( vec ) - { -+ DPRINTF("path '%s' token '%s'\n", vec[XS_WATCH_PATH], vec[XS_WATCH_TOKEN]); - if ( strcmp(vec[XS_WATCH_TOKEN], watch_token) == 0 ) - { - /* If our guest disappeared, set interrupt flag and fall through */ diff --git a/24227-xenpaging_restrict_pagefile_permissions.patch b/24227-xenpaging_restrict_pagefile_permissions.patch deleted file mode 100644 index 9ee6baa..0000000 --- a/24227-xenpaging_restrict_pagefile_permissions.patch +++ /dev/null @@ -1,28 +0,0 @@ -changeset: 24227:1027e7d13d02 -user: Olaf Hering -date: Sun Nov 20 18:26:16 2011 +0100 -files: tools/xenpaging/xenpaging.c -description: -xenpaging: restrict pagefile permissions - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/xenpaging.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -795,7 +795,7 @@ int main(int argc, char *argv[]) - xc_interface *xch; - - int open_flags = O_CREAT | O_TRUNC | O_RDWR; -- mode_t open_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH; -+ mode_t open_mode = S_IRUSR | S_IWUSR; - int fd; - - /* Initialise domain paging */ diff --git a/24231-waitqueue_Implement_wake_up_nroneall..patch b/24231-waitqueue_Implement_wake_up_nroneall..patch deleted file mode 100644 index 817d90d..0000000 --- a/24231-waitqueue_Implement_wake_up_nroneall..patch +++ /dev/null @@ -1,69 +0,0 @@ -changeset: 24231:2a81ce2b2b93 -user: Keir Fraser -date: Fri Nov 25 20:27:11 2011 +0000 -files: xen/common/wait.c xen/include/xen/wait.h -description: -waitqueue: Implement wake_up_{nr,one,all}. - -Signed-off-by: Keir Fraser - - ---- - xen/common/wait.c | 14 ++++++++++++-- - xen/include/xen/wait.h | 6 ++++-- - 2 files changed, 16 insertions(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/common/wait.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/wait.c -+++ xen-4.1.2-testing/xen/common/wait.c -@@ -87,13 +87,13 @@ void init_waitqueue_head(struct waitqueu - INIT_LIST_HEAD(&wq->list); - } - --void wake_up(struct waitqueue_head *wq) -+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr) - { - struct waitqueue_vcpu *wqv; - - spin_lock(&wq->lock); - -- while ( !list_empty(&wq->list) ) -+ while ( !list_empty(&wq->list) && nr-- ) - { - wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list); - list_del_init(&wqv->list); -@@ -103,6 +103,16 @@ void wake_up(struct waitqueue_head *wq) - spin_unlock(&wq->lock); - } - -+void wake_up_one(struct waitqueue_head *wq) -+{ -+ wake_up_nr(wq, 1); -+} -+ -+void wake_up_all(struct waitqueue_head *wq) -+{ -+ wake_up_nr(wq, UINT_MAX); -+} -+ - #ifdef CONFIG_X86 - - static void __prepare_to_wait(struct waitqueue_vcpu *wqv) -Index: xen-4.1.2-testing/xen/include/xen/wait.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/xen/wait.h -+++ xen-4.1.2-testing/xen/include/xen/wait.h -@@ -28,8 +28,10 @@ struct waitqueue_head { - /* Dynamically initialise a waitqueue. */ - void init_waitqueue_head(struct waitqueue_head *wq); - --/* Wake all VCPUs waiting on specified waitqueue. */ --void wake_up(struct waitqueue_head *wq); -+/* Wake VCPU(s) waiting on specified waitqueue. */ -+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr); -+void wake_up_one(struct waitqueue_head *wq); -+void wake_up_all(struct waitqueue_head *wq); - - /* Wait on specified waitqueue until @condition is true. */ - #define wait_event(wq, condition) \ diff --git a/24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch b/24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch deleted file mode 100644 index b233e98..0000000 --- a/24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch +++ /dev/null @@ -1,72 +0,0 @@ -changeset: 24232:95d4e2e0bed3 -user: Keir Fraser -date: Fri Nov 25 20:32:05 2011 +0000 -files: xen/common/wait.c xen/include/xen/wait.h -description: -waitqueue: Hold a reference to a domain on a waitqueue. - -Also allow waitqueues to be dynamically destroyed. - -Signed-off-by: Keir Fraser - - ---- - xen/common/wait.c | 8 ++++++++ - xen/include/xen/wait.h | 3 ++- - 2 files changed, 10 insertions(+), 1 deletion(-) - -Index: xen-4.1.2-testing/xen/common/wait.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/wait.c -+++ xen-4.1.2-testing/xen/common/wait.c -@@ -87,6 +87,11 @@ void init_waitqueue_head(struct waitqueu - INIT_LIST_HEAD(&wq->list); - } - -+void destroy_waitqueue_head(struct waitqueue_head *wq) -+{ -+ wake_up_all(wq); -+} -+ - void wake_up_nr(struct waitqueue_head *wq, unsigned int nr) - { - struct waitqueue_vcpu *wqv; -@@ -98,6 +103,7 @@ void wake_up_nr(struct waitqueue_head *w - wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list); - list_del_init(&wqv->list); - vcpu_unpause(wqv->vcpu); -+ put_domain(wqv->vcpu->domain); - } - - spin_unlock(&wq->lock); -@@ -218,6 +224,7 @@ void prepare_to_wait(struct waitqueue_he - spin_lock(&wq->lock); - list_add_tail(&wqv->list, &wq->list); - vcpu_pause_nosync(curr); -+ get_knownalive_domain(curr->domain); - spin_unlock(&wq->lock); - } - -@@ -236,6 +243,7 @@ void finish_wait(struct waitqueue_head * - { - list_del_init(&wqv->list); - vcpu_unpause(curr); -+ put_domain(curr->domain); - } - spin_unlock(&wq->lock); - } -Index: xen-4.1.2-testing/xen/include/xen/wait.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/xen/wait.h -+++ xen-4.1.2-testing/xen/include/xen/wait.h -@@ -25,8 +25,9 @@ struct waitqueue_head { - .list = LIST_HEAD_INIT((name).list) \ - } - --/* Dynamically initialise a waitqueue. */ -+/* Dynamically initialise/destroy a waitqueue. */ - void init_waitqueue_head(struct waitqueue_head *wq); -+void destroy_waitqueue_head(struct waitqueue_head *wq); - - /* Wake VCPU(s) waiting on specified waitqueue. */ - void wake_up_nr(struct waitqueue_head *wq, unsigned int nr); diff --git a/24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch b/24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch deleted file mode 100644 index d3e9e43..0000000 --- a/24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch +++ /dev/null @@ -1,252 +0,0 @@ -changeset: 24269:2cbc53a24683 -user: Olaf Hering -date: Wed Nov 30 07:08:53 2011 -0800 -files: xen/arch/x86/hvm/hvm.c xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_sharing.c xen/arch/x86/mm/p2m.c xen/common/domain.c xen/include/xen/sched.h -description: -mem_event: move mem_event_domain out of struct domain - -An upcoming change may increase the size of mem_event_domain. The result -is a build failure because struct domain gets larger than a page. -Allocate the room for the three mem_event_domain members at runtime. - -v2: - - remove mem_ prefix from members of new struct - -Signed-off-by: Olaf Hering -Committed-by: Keir Fraser - - ---- - xen/arch/x86/hvm/hvm.c | 4 ++-- - xen/arch/x86/mm/mem_event.c | 6 +++--- - xen/arch/x86/mm/mem_sharing.c | 6 +++--- - xen/arch/x86/mm/p2m.c | 18 +++++++++--------- - xen/common/domain.c | 5 +++++ - xen/include/xen/sched.h | 18 ++++++++++++------ - 6 files changed, 34 insertions(+), 23 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -3920,7 +3920,7 @@ static int hvm_memory_event_traps(long p - if ( (p & HVMPME_onchangeonly) && (value == old) ) - return 1; - -- rc = mem_event_check_ring(d, &d->mem_access); -+ rc = mem_event_check_ring(d, &d->mem_event->access); - if ( rc ) - return rc; - -@@ -3943,7 +3943,7 @@ static int hvm_memory_event_traps(long p - req.gla_valid = 1; - } - -- mem_event_put_request(d, &d->mem_access, &req); -+ mem_event_put_request(d, &d->mem_event->access, &req); - - return 1; - } -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -@@ -252,7 +252,7 @@ int mem_event_domctl(struct domain *d, x - { - case XEN_DOMCTL_MEM_EVENT_OP_PAGING: - { -- struct mem_event_domain *med = &d->mem_paging; -+ struct mem_event_domain *med = &d->mem_event->paging; - rc = -EINVAL; - - switch( mec->op ) -@@ -297,7 +297,7 @@ int mem_event_domctl(struct domain *d, x - - case XEN_DOMCTL_MEM_EVENT_OP_ACCESS: - { -- struct mem_event_domain *med = &d->mem_access; -+ struct mem_event_domain *med = &d->mem_event->access; - rc = -EINVAL; - - switch( mec->op ) -@@ -320,7 +320,7 @@ int mem_event_domctl(struct domain *d, x - case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE: - { - if ( med->ring_page ) -- rc = mem_event_disable(&d->mem_access); -+ rc = mem_event_disable(med); - } - break; - -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; - } - -- if(mem_event_check_ring(d, &d->mem_share)) return page; -+ if(mem_event_check_ring(d, &d->mem_event->share)) return page; - - req.gfn = gfn; - req.p2mt = p2m_ram_shared; - req.vcpu_id = v->vcpu_id; -- mem_event_put_request(d, &d->mem_share, &req); -+ mem_event_put_request(d, &d->mem_event->share, &req); - - return page; - } -@@ -342,7 +342,7 @@ int mem_sharing_sharing_resume(struct do - mem_event_response_t rsp; - - /* Get request off the ring */ -- mem_event_get_response(&d->mem_share, &rsp); -+ mem_event_get_response(&d->mem_event->share, &rsp); - - /* Unpause domain/vcpu */ - if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2998,7 +2998,7 @@ void p2m_mem_paging_drop_page(struct p2m - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d, &d->mem_paging) == 0) -+ if ( mem_event_check_ring(d, &d->mem_event->paging) == 0) - { - /* Send release notification to pager */ - memset(&req, 0, sizeof(req)); -@@ -3006,7 +3006,7 @@ void p2m_mem_paging_drop_page(struct p2m - req.gfn = gfn; - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &d->mem_paging, &req); -+ mem_event_put_request(d, &d->mem_event->paging, &req); - } - } - -@@ -3041,7 +3041,7 @@ void p2m_mem_paging_populate(struct p2m_ - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d, &d->mem_paging) ) -+ if ( mem_event_check_ring(d, &d->mem_event->paging) ) - return; - - memset(&req, 0, sizeof(req)); -@@ -3072,7 +3072,7 @@ void p2m_mem_paging_populate(struct p2m_ - else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) - { - /* gfn is already on its way back and vcpu is not paused */ -- mem_event_put_req_producers(&d->mem_paging); -+ mem_event_put_req_producers(&d->mem_event->paging); - return; - } - -@@ -3081,7 +3081,7 @@ void p2m_mem_paging_populate(struct p2m_ - req.p2mt = p2mt; - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &d->mem_paging, &req); -+ mem_event_put_request(d, &d->mem_event->paging, &req); - } - - /** -@@ -3159,7 +3159,7 @@ void p2m_mem_paging_resume(struct p2m_do - mfn_t mfn; - - /* Pull the response off the ring */ -- mem_event_get_response(&d->mem_paging, &rsp); -+ mem_event_get_response(&d->mem_event->paging, &rsp); - - /* Fix p2m entry if the page was not dropped */ - if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) -@@ -3212,7 +3212,7 @@ void p2m_mem_access_check(paddr_t gpa, b - p2m_unlock(p2m); - - /* Otherwise, check if there is a memory event listener, and send the message along */ -- res = mem_event_check_ring(d, &d->mem_access); -+ res = mem_event_check_ring(d, &d->mem_event->access); - if ( res < 0 ) - { - /* No listener */ -@@ -3256,7 +3256,7 @@ void p2m_mem_access_check(paddr_t gpa, b - - req.vcpu_id = v->vcpu_id; - -- mem_event_put_request(d, &d->mem_access, &req); -+ mem_event_put_request(d, &d->mem_event->access, &req); - - /* VCPU paused, mem event request sent */ - } -@@ -3266,7 +3266,7 @@ void p2m_mem_access_resume(struct p2m_do - struct domain *d = p2m->domain; - mem_event_response_t rsp; - -- mem_event_get_response(&d->mem_access, &rsp); -+ mem_event_get_response(&d->mem_event->access, &rsp); - - /* Unpause domain */ - if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) -Index: xen-4.1.3-testing/xen/common/domain.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/domain.c -+++ xen-4.1.3-testing/xen/common/domain.c -@@ -298,6 +298,10 @@ struct domain *domain_create( - init_status |= INIT_gnttab; - - poolid = 0; -+ -+ d->mem_event = xzalloc(struct mem_event_per_domain); -+ if ( !d->mem_event ) -+ goto fail; - } - - if ( arch_domain_create(d, domcr_flags) != 0 ) -@@ -329,6 +333,7 @@ struct domain *domain_create( - fail: - d->is_dying = DOMDYING_dead; - atomic_set(&d->refcnt, DOMAIN_DESTROYED); -+ xfree(d->mem_event); - if ( init_status & INIT_arch ) - arch_domain_destroy(d); - if ( init_status & INIT_gnttab ) -Index: xen-4.1.3-testing/xen/include/xen/sched.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/sched.h -+++ xen-4.1.3-testing/xen/include/xen/sched.h -@@ -201,6 +201,16 @@ struct mem_event_domain - int xen_port; - }; - -+struct mem_event_per_domain -+{ -+ /* Memory sharing support */ -+ struct mem_event_domain share; -+ /* Memory paging support */ -+ struct mem_event_domain paging; -+ /* Memory access support */ -+ struct mem_event_domain access; -+}; -+ - struct domain - { - domid_t domain_id; -@@ -327,12 +337,8 @@ struct domain - /* Non-migratable and non-restoreable? */ - bool_t disable_migrate; - -- /* Memory sharing support */ -- struct mem_event_domain mem_share; -- /* Memory paging support */ -- struct mem_event_domain mem_paging; -- /* Memory access support */ -- struct mem_event_domain mem_access; -+ /* Various mem_events */ -+ struct mem_event_per_domain *mem_event; - - /* Currently computed from union of all vcpu cpu-affinity masks. */ - nodemask_t node_affinity; diff --git a/24270-Free_d-mem_event_on_domain_destruction..patch b/24270-Free_d-mem_event_on_domain_destruction..patch deleted file mode 100644 index a79d74f..0000000 --- a/24270-Free_d-mem_event_on_domain_destruction..patch +++ /dev/null @@ -1,27 +0,0 @@ -changeset: 24270:08716a7f1b74 -user: Keir Fraser -date: Wed Nov 30 07:12:41 2011 -0800 -files: xen/common/domain.c -description: -Free d->mem_event on domain destruction. - -Signed-off-by: Keir Fraser - - ---- - xen/common/domain.c | 2 ++ - 1 file changed, 2 insertions(+) - -Index: xen-4.1.2-testing/xen/common/domain.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/domain.c -+++ xen-4.1.2-testing/xen/common/domain.c -@@ -661,6 +661,8 @@ static void complete_domain_destroy(stru - /* Free page used by xen oprofile buffer. */ - free_xenoprof_pages(d); - -+ xfree(d->mem_event); -+ - for ( i = d->max_vcpus - 1; i >= 0; i-- ) - if ( (v = d->vcpu[i]) != NULL ) - free_vcpu_struct(v); diff --git a/24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch b/24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch deleted file mode 100644 index 21c2245..0000000 --- a/24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch +++ /dev/null @@ -1,50 +0,0 @@ -changeset: 24272:62ff6a318c5d -user: Keir Fraser -date: Wed Nov 30 16:59:58 2011 -0800 -files: xen/common/page_alloc.c -description: -xenpaging: Fix c/s 23507:0a29c8c3ddf7 ("update machine_to_phys_mapping[] during page deallocation") - -This patch clobbers page owner in free_heap_pages() before we are -finished using it. This means that a subsequent test to determine -whether it is safe to avoid safety TLB flushes incorrectly always -determines that it is safe to do so. - -The fix is simple: we can defer the original patch's work until after -we are done with the page-owner field. - -Thanks to Christian Limpach for spotting this one. - -Signed-off-by: Keir Fraser - - ---- - xen/common/page_alloc.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -Index: xen-4.1.2-testing/xen/common/page_alloc.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/common/page_alloc.c -+++ xen-4.1.2-testing/xen/common/page_alloc.c -@@ -540,10 +540,6 @@ static void free_heap_pages( - - for ( i = 0; i < (1 << order); i++ ) - { -- /* This page is not a guest frame any more. */ -- page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */ -- set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY); -- - /* - * Cannot assume that count_info == 0, as there are some corner cases - * where it isn't the case and yet it isn't a bug: -@@ -567,6 +563,10 @@ static void free_heap_pages( - pg[i].u.free.need_tlbflush = (page_get_owner(&pg[i]) != NULL); - if ( pg[i].u.free.need_tlbflush ) - pg[i].tlbflush_timestamp = tlbflush_current_time(); -+ -+ /* This page is not a guest frame any more. */ -+ page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */ -+ set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY); - } - - avail[node][zone] += 1 << order; diff --git a/24275-x86-emul-lzcnt.patch b/24275-x86-emul-lzcnt.patch deleted file mode 100644 index ce7c8af..0000000 --- a/24275-x86-emul-lzcnt.patch +++ /dev/null @@ -1,90 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1322725849 -3600 -# Node ID 76ea126f21724b72c120aff59460f7bbe9e6960d -# Parent 07cf778d517fdf661a34027af653a489489bf222 -x86/emulator: properly handle lzcnt and tzcnt - -These instructions are prefix selected flavors of bsf and bsr -respectively, and hence the presences of the F3 prefix must be handled -in the emulation code in order to avoid running into problems on newer -CPUs. - -Signed-off-by: Jan Beulich - -Index: xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/x86_emulate/x86_emulate.c -+++ xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c -@@ -990,6 +990,9 @@ static bool_t vcpu_has( - return rc == X86EMUL_OKAY; - } - -+#define vcpu_has_lzcnt() vcpu_has(0x80000001, ECX, 5, ctxt, ops) -+#define vcpu_has_bmi1() vcpu_has(0x00000007, EBX, 3, ctxt, ops) -+ - #define vcpu_must_have(leaf, reg, bit) \ - generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1) - #define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26) -@@ -4117,13 +4120,24 @@ x86_emulate( - dst.val = (uint8_t)src.val; - break; - -- case 0xbc: /* bsf */ { -- int zf; -+ case 0xbc: /* bsf or tzcnt */ { -+ bool_t zf; - asm ( "bsf %2,%0; setz %b1" - : "=r" (dst.val), "=q" (zf) -- : "r" (src.val), "1" (0) ); -+ : "r" (src.val) ); - _regs.eflags &= ~EFLG_ZF; -- if ( zf ) -+ if ( (rep_prefix == REPE_PREFIX) && vcpu_has_bmi1() ) -+ { -+ _regs.eflags &= ~EFLG_CF; -+ if ( zf ) -+ { -+ _regs.eflags |= EFLG_CF; -+ dst.val = op_bytes * 8; -+ } -+ else if ( !dst.val ) -+ _regs.eflags |= EFLG_ZF; -+ } -+ else if ( zf ) - { - _regs.eflags |= EFLG_ZF; - dst.type = OP_NONE; -@@ -4131,13 +4145,28 @@ x86_emulate( - break; - } - -- case 0xbd: /* bsr */ { -- int zf; -+ case 0xbd: /* bsr or lzcnt */ { -+ bool_t zf; - asm ( "bsr %2,%0; setz %b1" - : "=r" (dst.val), "=q" (zf) -- : "r" (src.val), "1" (0) ); -+ : "r" (src.val) ); - _regs.eflags &= ~EFLG_ZF; -- if ( zf ) -+ if ( (rep_prefix == REPE_PREFIX) && vcpu_has_lzcnt() ) -+ { -+ _regs.eflags &= ~EFLG_CF; -+ if ( zf ) -+ { -+ _regs.eflags |= EFLG_CF; -+ dst.val = op_bytes * 8; -+ } -+ else -+ { -+ dst.val = op_bytes * 8 - 1 - dst.val; -+ if ( !dst.val ) -+ _regs.eflags |= EFLG_ZF; -+ } -+ } -+ else if ( zf ) - { - _regs.eflags |= EFLG_ZF; - dst.type = OP_NONE; diff --git a/24277-x86-dom0-features.patch b/24277-x86-dom0-features.patch deleted file mode 100644 index 0c8cd2a..0000000 --- a/24277-x86-dom0-features.patch +++ /dev/null @@ -1,58 +0,0 @@ -# HG changeset patch -# User Liu, Jinsong -# Date 1322738484 -3600 -# Node ID 1f6b58c8e1ba8d27dfb97f0da96d18d3ad163317 -# Parent 89f7273681696022cc44db4f2ec5b22560482869 -X86: expose Intel new features to dom0 - -This patch expose Intel new features to dom0, including -FMA/AVX2/BMI1/BMI2/LZCNT/MOVBE. - -Signed-off-by: Liu, Jinsong -Committed-by: Jan Beulich - ---- a/xen/arch/x86/traps.c -+++ b/xen/arch/x86/traps.c -@@ -848,8 +848,11 @@ static void pv_cpuid(struct cpu_user_reg - break; - case 7: - if ( regs->ecx == 0 ) -- b &= (cpufeat_mask(X86_FEATURE_FSGSBASE) | -- cpufeat_mask(X86_FEATURE_ERMS)); -+ b &= (cpufeat_mask(X86_FEATURE_BMI1) | -+ cpufeat_mask(X86_FEATURE_AVX2) | -+ cpufeat_mask(X86_FEATURE_BMI2) | -+ cpufeat_mask(X86_FEATURE_ERMS) | -+ cpufeat_mask(X86_FEATURE_FSGSBASE)); - else - b = 0; - a = c = d = 0; ---- a/xen/include/asm-x86/cpufeature.h -+++ b/xen/include/asm-x86/cpufeature.h -@@ -93,6 +93,7 @@ - #define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */ - #define X86_FEATURE_SSSE3 (4*32+ 9) /* Supplemental Streaming SIMD Extensions-3 */ - #define X86_FEATURE_CID (4*32+10) /* Context ID */ -+#define X86_FEATURE_FMA (4*32+12) /* Fused Multiply Add */ - #define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ - #define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ - #define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */ -@@ -100,6 +101,7 @@ - #define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */ - #define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ - #define X86_FEATURE_X2APIC (4*32+21) /* Extended xAPIC */ -+#define X86_FEATURE_MOVBE (4*32+22) /* movbe instruction */ - #define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ - #define X86_FEATURE_TSC_DEADLINE (4*32+24) /* "tdt" TSC Deadline Timer */ - #define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */ -@@ -144,7 +146,10 @@ - - /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 7 */ - #define X86_FEATURE_FSGSBASE (7*32+ 0) /* {RD,WR}{FS,GS}BASE instructions */ -+#define X86_FEATURE_BMI1 (7*32+ 3) /* 1st bit manipulation extensions */ -+#define X86_FEATURE_AVX2 (7*32+ 5) /* AVX2 instructions */ - #define X86_FEATURE_SMEP (7*32+ 7) /* Supervisor Mode Execution Protection */ -+#define X86_FEATURE_BMI2 (7*32+ 8) /* 2nd bit manipulation extensions */ - #define X86_FEATURE_ERMS (7*32+ 9) /* Enhanced REP MOVSB/STOSB */ - - #define cpu_has(c, bit) test_bit(bit, (c)->x86_capability) diff --git a/24278-x86-dom0-no-PCID.patch b/24278-x86-dom0-no-PCID.patch deleted file mode 100644 index e3ff165..0000000 --- a/24278-x86-dom0-no-PCID.patch +++ /dev/null @@ -1,49 +0,0 @@ -# HG changeset patch -# User Liu, Jinsong -# Date 1322738563 -3600 -# Node ID d9cb04ed55398ea4043c85573460afaf023aa1e9 -# Parent 1f6b58c8e1ba8d27dfb97f0da96d18d3ad163317 -X86: Disable PCID/INVPCID for dom0 - -PCID (Process-context identifier) is a facility by which a logical -processor may cache information for multiple linear-address spaces. -INVPCID is an new instruction to invalidate TLB. Refer latest Intel SDM -http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html - -We disable PCID/INVPCID for dom0 and pv. Exposing them into dom0 and pv -may result in performance regression, and it would trigger GP or UD -depending on whether platform suppport INVPCID or not. - -This patch disables PCID/INVPCID for dom0. - -Signed-off-by: Liu, Jinsong -Committed-by: Jan Beulich - ---- a/xen/arch/x86/traps.c -+++ b/xen/arch/x86/traps.c -@@ -836,6 +836,7 @@ static void pv_cpuid(struct cpu_user_reg - __clear_bit(X86_FEATURE_CX16 % 32, &c); - __clear_bit(X86_FEATURE_XTPR % 32, &c); - __clear_bit(X86_FEATURE_PDCM % 32, &c); -+ __clear_bit(X86_FEATURE_PCID % 32, &c); - __clear_bit(X86_FEATURE_DCA % 32, &c); - if ( !xsave_enabled(current) ) - { ---- a/xen/include/asm-x86/cpufeature.h -+++ b/xen/include/asm-x86/cpufeature.h -@@ -97,6 +97,7 @@ - #define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ - #define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ - #define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */ -+#define X86_FEATURE_PCID (4*32+17) /* Process Context ID */ - #define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */ - #define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */ - #define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ -@@ -151,6 +152,7 @@ - #define X86_FEATURE_SMEP (7*32+ 7) /* Supervisor Mode Execution Protection */ - #define X86_FEATURE_BMI2 (7*32+ 8) /* 2nd bit manipulation extensions */ - #define X86_FEATURE_ERMS (7*32+ 9) /* Enhanced REP MOVSB/STOSB */ -+#define X86_FEATURE_INVPCID (7*32+10) /* Invalidate Process Context ID */ - - #define cpu_has(c, bit) test_bit(bit, (c)->x86_capability) - #define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) diff --git a/24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch b/24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch deleted file mode 100644 index 2c6371d..0000000 --- a/24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch +++ /dev/null @@ -1,105 +0,0 @@ -changeset: 24318:f25a004a6de8 -user: Andres Lagar-Cavilla -date: Thu Dec 01 17:21:24 2011 +0000 -files: xen/arch/x86/mm.c -description: -x86/mm: Fix checks during foreign mapping of paged pages - -Check that the valid mfn is the one we are mapping, not the -mfn of the page table of the foreign domain. - -Signed-off-by: Andres Lagar-Cavilla -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm.c | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -3494,8 +3494,9 @@ int do_mmu_update( - { - l1_pgentry_t l1e = l1e_from_intpte(req.val); - p2m_type_t l1e_p2mt; -+ unsigned long l1emfn = mfn_x( - gfn_to_mfn(p2m_get_hostp2m(pg_owner), -- l1e_get_pfn(l1e), &l1e_p2mt); -+ l1e_get_pfn(l1e), &l1e_p2mt)); - - if ( p2m_is_paged(l1e_p2mt) ) - { -@@ -3504,7 +3505,8 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l1e_p2mt && !mfn_valid(mfn) ) -+ else if ( p2m_ram_paging_in_start == l1e_p2mt && -+ !mfn_valid(l1emfn) ) - { - rc = -ENOENT; - break; -@@ -3536,7 +3538,8 @@ int do_mmu_update( - { - l2_pgentry_t l2e = l2e_from_intpte(req.val); - p2m_type_t l2e_p2mt; -- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt); -+ unsigned long l2emfn = mfn_x( -+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt)); - - if ( p2m_is_paged(l2e_p2mt) ) - { -@@ -3545,7 +3548,8 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l2e_p2mt && !mfn_valid(mfn) ) -+ else if ( p2m_ram_paging_in_start == l2e_p2mt && -+ !mfn_valid(l2emfn) ) - { - rc = -ENOENT; - break; -@@ -3565,7 +3569,8 @@ int do_mmu_update( - { - l3_pgentry_t l3e = l3e_from_intpte(req.val); - p2m_type_t l3e_p2mt; -- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt); -+ unsigned long l3emfn = mfn_x( -+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt)); - - if ( p2m_is_paged(l3e_p2mt) ) - { -@@ -3574,7 +3579,8 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l3e_p2mt && !mfn_valid(mfn) ) -+ else if ( p2m_ram_paging_in_start == l3e_p2mt && -+ !mfn_valid(l3emfn) ) - { - rc = -ENOENT; - break; -@@ -3594,8 +3600,9 @@ int do_mmu_update( - { - l4_pgentry_t l4e = l4e_from_intpte(req.val); - p2m_type_t l4e_p2mt; -+ unsigned long l4emfn = mfn_x( - gfn_to_mfn(p2m_get_hostp2m(pg_owner), -- l4e_get_pfn(l4e), &l4e_p2mt); -+ l4e_get_pfn(l4e), &l4e_p2mt)); - - if ( p2m_is_paged(l4e_p2mt) ) - { -@@ -3604,7 +3611,8 @@ int do_mmu_update( - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l4e_p2mt && !mfn_valid(mfn) ) -+ else if ( p2m_ram_paging_in_start == l4e_p2mt && -+ !mfn_valid(l4emfn) ) - { - rc = -ENOENT; - break; diff --git a/24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch b/24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch deleted file mode 100644 index 0844ca2..0000000 --- a/24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch +++ /dev/null @@ -1,149 +0,0 @@ -changeset: 24327:8529bca7a3f0 -parent: 24322:6bac46816504 -user: Andres Lagar-Cavilla -date: Thu Dec 01 18:14:24 2011 +0000 -files: xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_paging.c xen/arch/x86/mm/p2m.c xen/include/asm-x86/p2m.h xen/include/public/domctl.h -description: -After preparing a page for page-in, allow immediate fill-in of the page contents - -p2m_mem_paging_prep ensures that an mfn is backing the paged-out gfn, and -transitions to the next state in the paging state machine for that page. -Foreign mappings of the gfn will now succeed. This is the key idea, as -it allows the pager to now map the gfn and fill in its contents. - -Unfortunately, it also allows any other foreign mapper to map the gfn and read -its contents. This is particularly dangerous when the populate is launched -by a foreign mapper in the first place, which will be actively retrying the -map operation and might race with the pager. Qemu-dm being a prime example. - -Fix the race by allowing a buffer to be optionally passed in the prep -operation, and having the hypervisor memcpy from that buffer into the newly -prepped page before promoting the gfn type. - -Signed-off-by: Andres Lagar-Cavilla -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm/mem_event.c | 2 +- - xen/arch/x86/mm/mem_paging.c | 2 +- - xen/arch/x86/mm/p2m.c | 32 ++++++++++++++++++++++++++++++-- - xen/include/asm-x86/p2m.h | 2 +- - xen/include/public/domctl.h | 8 ++++++-- - 5 files changed, 39 insertions(+), 7 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -@@ -45,7 +45,7 @@ static int mem_event_enable(struct domai - struct domain *dom_mem_event = current->domain; - struct vcpu *v = current; - unsigned long ring_addr = mec->ring_addr; -- unsigned long shared_addr = mec->shared_addr; -+ unsigned long shared_addr = mec->u.shared_addr; - l1_pgentry_t l1e; - unsigned long gfn; - p2m_type_t p2mt; -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_paging.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_paging.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_paging.c -@@ -50,7 +50,7 @@ int mem_paging_domctl(struct domain *d, - case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP: - { - unsigned long gfn = mec->gfn; -- rc = p2m_mem_paging_prep(p2m, gfn); -+ rc = p2m_mem_paging_prep(p2m, gfn, mec->u.buffer); - } - break; - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -3095,13 +3095,20 @@ void p2m_mem_paging_populate(struct p2m_ - * mfn if populate was called for gfn which was nominated but not evicted. In - * this case only the p2mt needs to be forwarded. - */ --int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) -+int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn, uint64_t buffer) - { - struct page_info *page; - p2m_type_t p2mt; - p2m_access_t a; - mfn_t mfn; -- int ret; -+ int ret, page_extant = 1; -+ const void *user_ptr = (const void *) buffer; -+ -+ if ( user_ptr ) -+ /* Sanity check the buffer and bail out early if trouble */ -+ if ( (buffer & (PAGE_SIZE - 1)) || -+ (!access_ok(user_ptr, PAGE_SIZE)) ) -+ return -EINVAL; - - p2m_lock(p2m); - -@@ -3121,6 +3128,28 @@ int p2m_mem_paging_prep(struct p2m_domai - if ( unlikely(page == NULL) ) - goto out; - mfn = page_to_mfn(page); -+ page_extant = 0; -+ } -+ -+ /* If we were given a buffer, now is the time to use it */ -+ if ( !page_extant && user_ptr ) -+ { -+ void *guest_map; -+ int rc; -+ -+ ASSERT( mfn_valid(mfn) ); -+ guest_map = map_domain_page(mfn_x(mfn)); -+ rc = copy_from_user(guest_map, user_ptr, PAGE_SIZE); -+ unmap_domain_page(guest_map); -+ if ( rc ) -+ { -+ gdprintk(XENLOG_ERR, "Failed to load paging-in gfn %lx domain %u " -+ "bytes left %d\n", -+ gfn, p2m->domain->domain_id, rc); -+ ret = -EFAULT; -+ put_page(page); /* Don't leak pages */ -+ goto out; -+ } - } - - /* Fix p2m mapping */ -Index: xen-4.1.3-testing/xen/include/asm-x86/p2m.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/p2m.h -+++ xen-4.1.3-testing/xen/include/asm-x86/p2m.h -@@ -526,7 +526,7 @@ void p2m_mem_paging_drop_page(struct p2m - /* Start populating a paged out frame */ - void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn); - /* Prepare the p2m for paging a frame in */ --int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn); -+int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn, uint64_t buffer); - /* Resume normal operation (in case a domain was paused) */ - void p2m_mem_paging_resume(struct p2m_domain *p2m); - #else -Index: xen-4.1.3-testing/xen/include/public/domctl.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/domctl.h -+++ xen-4.1.3-testing/xen/include/public/domctl.h -@@ -741,8 +741,12 @@ struct xen_domctl_mem_event_op { - uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_*_* */ - uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_OP_* */ - -- /* OP_ENABLE */ -- uint64_aligned_t shared_addr; /* IN: Virtual address of shared page */ -+ union { -+ /* OP_ENABLE IN: Virtual address of shared page */ -+ uint64_aligned_t shared_addr; -+ /* PAGING_PREP IN: buffer to immediately fill page in */ -+ uint64_aligned_t buffer; -+ } u; - uint64_aligned_t ring_addr; /* IN: Virtual address of ring page */ - - /* Other OPs */ diff --git a/24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch b/24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch deleted file mode 100644 index b4f6ede..0000000 --- a/24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch +++ /dev/null @@ -1,86 +0,0 @@ -changeset: 24328:8ad47b48047d -user: Andres Lagar-Cavilla -date: Thu Dec 01 18:14:24 2011 +0000 -files: tools/libxc/xc_mem_event.c tools/libxc/xc_mem_paging.c tools/libxc/xenctrl.h -description: -Tools: Libxc wrappers to automatically fill in page oud page contents on prepare -Signed-off-by: Andres Lagar-Cavilla -Acked-by: Ian Jackson -Committed-by: Tim Deegan - - ---- - tools/libxc/xc_mem_event.c | 4 ++-- - tools/libxc/xc_mem_paging.c | 23 +++++++++++++++++++++++ - tools/libxc/xenctrl.h | 2 ++ - 3 files changed, 27 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/libxc/xc_mem_event.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_mem_event.c -+++ xen-4.1.2-testing/tools/libxc/xc_mem_event.c -@@ -24,7 +24,7 @@ - #include "xc_private.h" - - int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op, -- unsigned int mode, void *shared_page, -+ unsigned int mode, void *page, - void *ring_page, unsigned long gfn) - { - DECLARE_DOMCTL; -@@ -34,7 +34,7 @@ int xc_mem_event_control(xc_interface *x - domctl.u.mem_event_op.op = op; - domctl.u.mem_event_op.mode = mode; - -- domctl.u.mem_event_op.shared_addr = (unsigned long)shared_page; -+ domctl.u.mem_event_op.u.shared_addr = (unsigned long)page; - domctl.u.mem_event_op.ring_addr = (unsigned long)ring_page; - - domctl.u.mem_event_op.gfn = gfn; -Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_mem_paging.c -+++ xen-4.1.2-testing/tools/libxc/xc_mem_paging.c -@@ -65,6 +65,29 @@ int xc_mem_paging_prep(xc_interface *xch - NULL, NULL, gfn); - } - -+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id, -+ unsigned long gfn, void *buffer) -+{ -+ int rc; -+ -+ if ( !buffer ) -+ return -EINVAL; -+ -+ if ( ((unsigned long) buffer) & (XC_PAGE_SIZE - 1) ) -+ return -EINVAL; -+ -+ if ( mlock(buffer, XC_PAGE_SIZE) ) -+ return -errno; -+ -+ rc = xc_mem_event_control(xch, domain_id, -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP, -+ XEN_DOMCTL_MEM_EVENT_OP_PAGING, -+ buffer, NULL, gfn); -+ -+ (void)munlock(buffer, XC_PAGE_SIZE); -+ return rc; -+} -+ - int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn) - { - return xc_mem_event_control(xch, domain_id, -Index: xen-4.1.2-testing/tools/libxc/xenctrl.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xenctrl.h -+++ xen-4.1.2-testing/tools/libxc/xenctrl.h -@@ -1742,6 +1742,8 @@ int xc_mem_paging_nominate(xc_interface - unsigned long gfn); - int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn); - int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn); -+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id, -+ unsigned long gfn, void *buffer); - int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, - unsigned long gfn); - diff --git a/24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch b/24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch deleted file mode 100644 index d314934..0000000 --- a/24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch +++ /dev/null @@ -1,100 +0,0 @@ -changeset: 24329:a8f5faa127c4 -user: Andres Lagar-Cavilla -date: Thu Dec 01 18:14:24 2011 +0000 -files: tools/xenpaging/xenpaging.c -description: -Teach xenpaging to use the new and non-racy xc_mem_paging_load interface - -Signed-off-by: Andres Lagar-Cavilla -Acked-by: Olaf Hering -Committed-by: Tim Deegan - - ---- - tools/xenpaging/xenpaging.c | 43 +++++++++++++++++++++---------------------- - 1 file changed, 21 insertions(+), 22 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -45,6 +45,7 @@ static char *dom_path; - static char watch_token[16]; - static char *filename; - static int interrupted; -+static void *paging_buffer = NULL; - - static void unlink_pagefile(void) - { -@@ -438,6 +439,13 @@ static xenpaging_t *xenpaging_init(int a - goto err; - } - -+ paging_buffer = init_page(); -+ if ( !paging_buffer ) -+ { -+ ERROR("Creating page aligned load buffer"); -+ goto err; -+ } -+ - return paging; - - err: -@@ -649,10 +657,20 @@ static int xenpaging_populate_page(xenpa - unsigned char oom = 0; - - DPRINTF("populate_page < gfn %"PRI_xen_pfn" pageslot %d\n", gfn, i); -+ -+ /* Read page */ -+ ret = read_page(fd, paging_buffer, i); -+ if ( ret != 0 ) -+ { -+ ERROR("Error reading page"); -+ goto out; -+ } -+ - do - { - /* Tell Xen to allocate a page for the domain */ -- ret = xc_mem_paging_prep(xch, paging->mem_event.domain_id, gfn); -+ ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn, -+ paging_buffer); - if ( ret != 0 ) - { - if ( errno == ENOMEM ) -@@ -662,33 +680,14 @@ static int xenpaging_populate_page(xenpa - sleep(1); - continue; - } -- PERROR("Error preparing %"PRI_xen_pfn" for page-in", gfn); -- goto out_map; -+ PERROR("Error loading %"PRI_xen_pfn" during page-in", gfn); -+ goto out; - } - } - while ( ret && !interrupted ); - -- /* Map page */ -- ret = -EFAULT; -- page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, -- PROT_READ | PROT_WRITE, &gfn, 1); -- if ( page == NULL ) -- { -- PERROR("Error mapping page %"PRI_xen_pfn": page is null", gfn); -- goto out_map; -- } -- -- /* Read page */ -- ret = read_page(fd, page, i); -- if ( ret != 0 ) -- { -- PERROR("Error reading page %"PRI_xen_pfn"", gfn); -- goto out; -- } - - out: -- munmap(page, PAGE_SIZE); -- out_map: - return ret; - } - diff --git a/24359-x86-domU-features.patch b/24359-x86-domU-features.patch deleted file mode 100644 index 8ee24f2..0000000 --- a/24359-x86-domU-features.patch +++ /dev/null @@ -1,94 +0,0 @@ -# HG changeset patch -# User Liu, Jinsong -# Date 1323170838 0 -# Node ID a0befa32e927cc147aaee9bce42c51f53580a875 -# Parent 9961a6d5356a57685b06f65133c6ade5041e3356 -X86: expose Intel new features to pv/hvm - -Intel recently release some new features, including -FMA/AVX2/BMI1/BMI2/LZCNT/MOVBE. -Refer to http://software.intel.com/file/36945 -This patch expose these new features to pv and hvm. - -Signed-off-by: Liu, Jinsong -Committed-by: Keir Fraser - ---- a/tools/libxc/xc_cpufeature.h -+++ b/tools/libxc/xc_cpufeature.h -@@ -74,6 +74,7 @@ - #define X86_FEATURE_TM2 8 /* Thermal Monitor 2 */ - #define X86_FEATURE_SSSE3 9 /* Supplemental Streaming SIMD Exts-3 */ - #define X86_FEATURE_CID 10 /* Context ID */ -+#define X86_FEATURE_FMA 12 /* Fused Multiply Add */ - #define X86_FEATURE_CX16 13 /* CMPXCHG16B */ - #define X86_FEATURE_XTPR 14 /* Send Task Priority Messages */ - #define X86_FEATURE_PDCM 15 /* Perf/Debug Capability MSR */ -@@ -81,6 +82,7 @@ - #define X86_FEATURE_SSE4_1 19 /* Streaming SIMD Extensions 4.1 */ - #define X86_FEATURE_SSE4_2 20 /* Streaming SIMD Extensions 4.2 */ - #define X86_FEATURE_X2APIC 21 /* x2APIC */ -+#define X86_FEATURE_MOVBE 22 /* movbe instruction */ - #define X86_FEATURE_POPCNT 23 /* POPCNT instruction */ - #define X86_FEATURE_TSC_DEADLINE 24 /* "tdt" TSC Deadline Timer */ - #define X86_FEATURE_AES 25 /* AES acceleration instructions */ -@@ -125,7 +127,10 @@ - - /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx) */ - #define X86_FEATURE_FSGSBASE 0 /* {RD,WR}{FS,GS}BASE instructions */ -+#define X86_FEATURE_BMI1 3 /* 1st group bit manipulation extensions */ -+#define X86_FEATURE_AVX2 5 /* AVX2 instructions */ - #define X86_FEATURE_SMEP 7 /* Supervisor Mode Execution Protection */ -+#define X86_FEATURE_BMI2 8 /* 2nd group bit manipulation extensions */ - #define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */ - - #endif /* __LIBXC_CPUFEATURE_H */ ---- a/tools/libxc/xc_cpuid_x86.c -+++ b/tools/libxc/xc_cpuid_x86.c -@@ -148,7 +148,8 @@ static void intel_xc_cpuid_policy( - int is_64bit = hypervisor_is_64bit(xch) && is_pae; - - /* Only a few features are advertised in Intel's 0x80000001. */ -- regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0); -+ regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) | -+ bitmaskof(X86_FEATURE_ABM); - regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | - (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | - (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) | -@@ -256,9 +257,11 @@ static void xc_cpuid_hvm_policy( - regs[2] &= (bitmaskof(X86_FEATURE_XMM3) | - bitmaskof(X86_FEATURE_PCLMULQDQ) | - bitmaskof(X86_FEATURE_SSSE3) | -+ bitmaskof(X86_FEATURE_FMA) | - bitmaskof(X86_FEATURE_CX16) | - bitmaskof(X86_FEATURE_SSE4_1) | - bitmaskof(X86_FEATURE_SSE4_2) | -+ bitmaskof(X86_FEATURE_MOVBE) | - bitmaskof(X86_FEATURE_POPCNT) | - bitmaskof(X86_FEATURE_AES) | - bitmaskof(X86_FEATURE_F16C) | -@@ -303,7 +306,10 @@ static void xc_cpuid_hvm_policy( - - case 0x00000007: /* Intel-defined CPU features */ - if ( input[1] == 0 ) { -- regs[1] &= (bitmaskof(X86_FEATURE_SMEP) | -+ regs[1] &= (bitmaskof(X86_FEATURE_BMI1) | -+ bitmaskof(X86_FEATURE_AVX2) | -+ bitmaskof(X86_FEATURE_SMEP) | -+ bitmaskof(X86_FEATURE_BMI2) | - bitmaskof(X86_FEATURE_ERMS) | - bitmaskof(X86_FEATURE_FSGSBASE)); - } else -@@ -427,8 +433,11 @@ static void xc_cpuid_pv_policy( - - case 7: - if ( input[1] == 0 ) -- regs[1] &= (bitmaskof(X86_FEATURE_FSGSBASE) | -- bitmaskof(X86_FEATURE_ERMS)); -+ regs[1] &= (bitmaskof(X86_FEATURE_BMI1) | -+ bitmaskof(X86_FEATURE_AVX2) | -+ bitmaskof(X86_FEATURE_BMI2) | -+ bitmaskof(X86_FEATURE_ERMS) | -+ bitmaskof(X86_FEATURE_FSGSBASE)); - else - regs[1] = 0; - regs[0] = regs[2] = regs[3] = 0; diff --git a/24360-x86-pv-domU-no-PCID.patch b/24360-x86-pv-domU-no-PCID.patch deleted file mode 100644 index 401b41e..0000000 --- a/24360-x86-pv-domU-no-PCID.patch +++ /dev/null @@ -1,39 +0,0 @@ -# HG changeset patch -# User Liu, Jinsong -# Date 1323170884 0 -# Node ID d313582d4fa2157332f1d50e599aebca36c41b3b -# Parent a0befa32e927cc147aaee9bce42c51f53580a875 -X86: Disable PCID/INVPCID for pv - -This patch disable PCID/INVPCID for pv. - -Signed-off-by: Liu, Jinsong -Committed-by: Keir Fraser - ---- a/tools/libxc/xc_cpufeature.h -+++ b/tools/libxc/xc_cpufeature.h -@@ -78,6 +78,7 @@ - #define X86_FEATURE_CX16 13 /* CMPXCHG16B */ - #define X86_FEATURE_XTPR 14 /* Send Task Priority Messages */ - #define X86_FEATURE_PDCM 15 /* Perf/Debug Capability MSR */ -+#define X86_FEATURE_PCID 17 /* Process Context ID */ - #define X86_FEATURE_DCA 18 /* Direct Cache Access */ - #define X86_FEATURE_SSE4_1 19 /* Streaming SIMD Extensions 4.1 */ - #define X86_FEATURE_SSE4_2 20 /* Streaming SIMD Extensions 4.2 */ -@@ -132,5 +133,6 @@ - #define X86_FEATURE_SMEP 7 /* Supervisor Mode Execution Protection */ - #define X86_FEATURE_BMI2 8 /* 2nd group bit manipulation extensions */ - #define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */ -+#define X86_FEATURE_INVPCID 10 /* Invalidate Process Context ID */ - - #endif /* __LIBXC_CPUFEATURE_H */ ---- a/tools/libxc/xc_cpuid_x86.c -+++ b/tools/libxc/xc_cpuid_x86.c -@@ -427,6 +427,7 @@ static void xc_cpuid_pv_policy( - } - clear_bit(X86_FEATURE_XTPR, regs[2]); - clear_bit(X86_FEATURE_PDCM, regs[2]); -+ clear_bit(X86_FEATURE_PCID, regs[2]); - clear_bit(X86_FEATURE_DCA, regs[2]); - set_bit(X86_FEATURE_HYPERVISOR, regs[2]); - break; diff --git a/24391-x86-pcpu-version.patch b/24391-x86-pcpu-version.patch deleted file mode 100644 index 519c57b..0000000 --- a/24391-x86-pcpu-version.patch +++ /dev/null @@ -1,155 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1323766131 -3600 -# Node ID 3f4ffde189f228d88e534865023fd795f77f0d05 -# Parent 77528dbced3ea74901be6b1aeddedda22bfdaf63 -x86: add platform hypercall to retrieve pCPU-s' family, model, and stepping - -With the recent hotplug changes to the Xen part of the microcode -loading, this allows the kernel driver to avoid unnecessary calls into -the hypervisor during pCPU hot-enabling: Knowing that the hypervisor -retains the data for already booted CPUs, only data for CPUs with a -different signature needs to be passed down. Since the microcode -loading code can be pretty verbose, avoiding to invoke it can make the -log much easier to look at in case of problems. - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/platform_hypercall.c -+++ b/xen/arch/x86/platform_hypercall.c -@@ -469,6 +469,42 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe - } - break; - -+ case XENPF_get_cpu_version: -+ { -+ struct xenpf_pcpu_version *ver = &op->u.pcpu_version; -+ -+ if ( !get_cpu_maps() ) -+ { -+ ret = -EBUSY; -+ break; -+ } -+ -+ if ( (ver->xen_cpuid >= NR_CPUS) || !cpu_online(ver->xen_cpuid) ) -+ { -+ memset(ver->vendor_id, 0, sizeof(ver->vendor_id)); -+ ver->family = 0; -+ ver->model = 0; -+ ver->stepping = 0; -+ } -+ else -+ { -+ const struct cpuinfo_x86 *c = &cpu_data[ver->xen_cpuid]; -+ -+ memcpy(ver->vendor_id, c->x86_vendor_id, sizeof(ver->vendor_id)); -+ ver->family = c->x86; -+ ver->model = c->x86_model; -+ ver->stepping = c->x86_mask; -+ } -+ -+ ver->max_present = cpumask_last(&cpu_present_map); -+ -+ put_cpu_maps(); -+ -+ if ( copy_field_to_guest(u_xenpf_op, op, u.pcpu_version) ) -+ ret = -EFAULT; -+ } -+ break; -+ - case XENPF_cpu_online: - { - int cpu = op->u.cpu_ol.cpuid; ---- a/xen/arch/x86/x86_64/platform_hypercall.c -+++ b/xen/arch/x86/x86_64/platform_hypercall.c -@@ -3,7 +3,7 @@ - */ - - #include --#include -+#include - #include - - DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t); -@@ -26,8 +26,13 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_ - #define xen_processor_power_t compat_processor_power_t - #define set_cx_pminfo compat_set_cx_pminfo - --#define xenpf_pcpuinfo compat_pf_pcpuinfo --#define xenpf_pcpuinfo_t compat_pf_pcpuinfo_t -+#define xen_pf_pcpuinfo xenpf_pcpuinfo -+CHECK_pf_pcpuinfo; -+#undef xen_pf_pcpuinfo -+ -+#define xen_pf_pcpu_version xenpf_pcpu_version -+CHECK_pf_pcpu_version; -+#undef xen_pf_pcpu_version - - #define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep - ---- a/xen/include/public/platform.h -+++ b/xen/include/public/platform.h -@@ -425,6 +425,21 @@ struct xenpf_pcpuinfo { - typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t; - DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t); - -+#define XENPF_get_cpu_version 48 -+struct xenpf_pcpu_version { -+ /* IN */ -+ uint32_t xen_cpuid; -+ /* OUT */ -+ /* The maxium cpu_id that is present */ -+ uint32_t max_present; -+ char vendor_id[12]; -+ uint32_t family; -+ uint32_t model; -+ uint32_t stepping; -+}; -+typedef struct xenpf_pcpu_version xenpf_pcpu_version_t; -+DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t); -+ - #define XENPF_cpu_online 56 - #define XENPF_cpu_offline 57 - struct xenpf_cpu_ol -@@ -468,6 +483,7 @@ struct xen_platform_op { - struct xenpf_getidletime getidletime; - struct xenpf_set_processor_pminfo set_pminfo; - struct xenpf_pcpuinfo pcpu_info; -+ struct xenpf_pcpu_version pcpu_version; - struct xenpf_cpu_ol cpu_ol; - struct xenpf_cpu_hotadd cpu_add; - struct xenpf_mem_hotadd mem_add; ---- a/xen/include/xlat.lst -+++ b/xen/include/xlat.lst -@@ -61,6 +61,17 @@ - ! memory_reservation memory.h - ! pod_target memory.h - ? physdev_pci_mmcfg_reserved physdev.h -+! pct_register platform.h -+! power_register platform.h -+? processor_csd platform.h -+! processor_cx platform.h -+! processor_flags platform.h -+! processor_performance platform.h -+! processor_power platform.h -+? processor_px platform.h -+! psd_package platform.h -+? xenpf_pcpuinfo platform.h -+? xenpf_pcpu_version platform.h - ! sched_poll sched.h - ? sched_remote_shutdown sched.h - ? sched_shutdown sched.h -@@ -73,12 +84,3 @@ - ! vcpu_set_singleshot_timer vcpu.h - ? xenoprof_init xenoprof.h - ? xenoprof_passive xenoprof.h --! power_register platform.h --? processor_csd platform.h --! processor_cx platform.h --! processor_flags platform.h --! processor_power platform.h --! pct_register platform.h --? processor_px platform.h --! psd_package platform.h --! processor_performance platform.h diff --git a/24401-pygrub-scrolling.patch b/24401-pygrub-scrolling.patch deleted file mode 100644 index f391a22..0000000 --- a/24401-pygrub-scrolling.patch +++ /dev/null @@ -1,87 +0,0 @@ -# HG changeset patch -# User Miroslav Rezanina -# Date 1323790700 0 -# Node ID c04ec56f4a6d381bfacd31fbcaefdaa206a914f1 -# Parent 63e5005d58ca5674e790ef627e7fb3c8c66c5374 -pygrub: Allow scrolling of the list of entries - -When user wants to change entry in grub2 menu in pygrub, there -may be crash of pygrub in case of editing item ('e' key). - -Crash on editing is caused longer entry list in case of grub2. As entry -window is 10 lines high, it can hold only 8 entries (2 lines for border). -Adding line outside of windows high causes crash. Patch add handling -for longer lists and scrolling through them. - -Signed-off-by: Miroslav Rezanina -Committed-by: Ian Jackson - -diff -r 63e5005d58ca -r c04ec56f4a6d tools/pygrub/src/pygrub ---- a/tools/pygrub/src/pygrub Tue Dec 13 15:31:12 2011 +0000 -+++ b/tools/pygrub/src/pygrub Tue Dec 13 15:38:20 2011 +0000 -@@ -221,6 +221,7 @@ - - - class Grub: -+ ENTRY_WIN_LINES = 8 - def __init__(self, file, fs = None): - self.screen = None - self.entry_win = None -@@ -238,7 +239,7 @@ - except: - pass # Not important if we can't use colour - enable_cursor(False) -- self.entry_win = curses.newwin(10, 74, 2, 1) -+ self.entry_win = curses.newwin(Grub.ENTRY_WIN_LINES + 2, 74, 2, 1) - self.text_win = curses.newwin(10, 70, 12, 5) - curses.def_prog_mode() - -@@ -287,12 +288,20 @@ - self.text_win.noutrefresh() - - curline = 0 -+ pos = 0 - img = copy.deepcopy(origimg) - while 1: - draw() - self.entry_win.erase() -- self.entry_win.box() -- for idx in range(0, len(img.lines)): -+ -+ rs = 0 -+ re = len(img.lines) -+ idp = 1 -+ if re > Grub.ENTRY_WIN_LINES: -+ rs = curline - pos -+ re = rs + Grub.ENTRY_WIN_LINES -+ -+ for idx in range(rs, re): - # current line should be highlighted - if idx == curline: - self.entry_win.attron(curses.A_REVERSE) -@@ -302,9 +311,11 @@ - if len(l) > 70: - l = l[:69] + ">" - -- self.entry_win.addstr(idx + 1, 2, l) -+ self.entry_win.addstr(idp, 2, l) - if idx == curline: - self.entry_win.attroff(curses.A_REVERSE) -+ idp += 1 -+ self.entry_win.box() - self.entry_win.noutrefresh() - curses.doupdate() - -@@ -313,8 +324,12 @@ - break - elif c == curses.KEY_UP: - curline -= 1 -+ if pos > 0: -+ pos -= 1 - elif c == curses.KEY_DOWN: - curline += 1 -+ if pos < Grub.ENTRY_WIN_LINES - 1: -+ pos += 1 - elif c == ord('b'): - self.isdone = True - break diff --git a/24402-pygrub-edit-fix.patch b/24402-pygrub-edit-fix.patch deleted file mode 100644 index 890d25b..0000000 --- a/24402-pygrub-edit-fix.patch +++ /dev/null @@ -1,29 +0,0 @@ -# HG changeset patch -# User Miroslav Rezanina -# Date 1323790768 0 -# Node ID 983b551e44077ace454a397181c93533e0a534b5 -# Parent c04ec56f4a6d381bfacd31fbcaefdaa206a914f1 -pygrub: Fix "a" entry editing in grub2 - -When user wants to change entry in grub2 menu in pygrub, there's no -response in case of appending command line arguments ('a' key). - -Append malfunction is caused by change of keyword used for kernel -record. Grub uses 'kernel' for line with linux kernel but grub2 uses -'linux' instead. This patch adds checking for both grub 1 and 2 keywords. - -Signed-off-by: Miroslav Rezanina -Committed-by: Ian Jackson - -diff -r c04ec56f4a6d -r 983b551e4407 tools/pygrub/src/pygrub ---- a/tools/pygrub/src/pygrub Tue Dec 13 15:38:20 2011 +0000 -+++ b/tools/pygrub/src/pygrub Tue Dec 13 15:39:28 2011 +0000 -@@ -522,7 +522,7 @@ - # find the kernel line, edit it and then boot - img = self.cf.images[self.selected_image] - for line in img.lines: -- if line.startswith("kernel"): -+ if line.startswith("kernel") or line.startswith("linux"): - l = self.edit_line(line) - if l is not None: - img.set_from_line(l, replace = True) diff --git a/24459-libxl-vifname.patch b/24459-libxl-vifname.patch deleted file mode 100644 index b776a78..0000000 --- a/24459-libxl-vifname.patch +++ /dev/null @@ -1,30 +0,0 @@ -# HG changeset patch -# User Wei Liu -# Date 1325783613 0 -# Node ID caf9753d4cc100183eeda26d00c8c38f14215651 -# Parent 19ac027a3c311159dc0f3696d6e571314f0bf0c3 -libxl: write vifname in xenstore if set. - -Simple fix to enable user to specify vif names. - -Signed-off-by: Wei Liu -Acked-by: Ian Campbell -Committed-by: Ian Jackson - -Index: xen-4.1.3-testing/tools/libxl/libxl.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxl/libxl.c -+++ xen-4.1.3-testing/tools/libxl/libxl.c -@@ -1239,6 +1239,12 @@ int libxl_device_nic_add(libxl_ctx *ctx, - flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x", - nic->mac[0], nic->mac[1], nic->mac[2], - nic->mac[3], nic->mac[4], nic->mac[5])); -+ -+ if (nic->ifname) { -+ flexarray_append(back, "vifname"); -+ flexarray_append(back, nic->ifname); -+ } -+ - if (nic->ip) { - flexarray_append(back, "ip"); - flexarray_append(back, libxl__strdup(&gc, nic->ip)); diff --git a/24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch b/24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch deleted file mode 100644 index 7ba9cee..0000000 --- a/24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch +++ /dev/null @@ -1,34 +0,0 @@ -changeset: 24466:fc78d16447b4 -user: Andres Lagar-Cavilla -date: Tue Jan 10 15:35:01 2012 +0000 -files: tools/libxc/xc_linux_osdep.c -description: -libxc: Only retry mapping pages when ENOENT is returned - -If the return value from the ioctl() is not ENOENT, it's possible that err[i] -will not be updated and libxc will just loop forever. Although it's unlikely -that err[i] would not be updated after the ioctl() gets through at least once, -it's better to be defensive. - -Signed-off-by: Adin Scannell -Signed-off-by: Andres Lagar-Cavilla -Committed-by: Ian Jackson - - ---- - tools/libxc/xc_linux_osdep.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_linux_osdep.c -+++ xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c -@@ -208,7 +208,7 @@ static void *linux_privcmd_map_foreign_b - do { - usleep(100); - rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx); -- } while ( rc < 0 && err[i] == -ENOENT ); -+ } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT ); - } - } - diff --git a/24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch b/24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch deleted file mode 100644 index 0406359..0000000 --- a/24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch +++ /dev/null @@ -1,45 +0,0 @@ -changeset: 24478:ef99b8571a6f -user: Olaf Hering -date: Thu Jan 05 19:40:40 2012 +0100 -files: tools/libxl/libxl_create.c tools/python/xen/xend/XendDomainInfo.py -description: -libxl: add feature flag to xenstore for XS_RESET_WATCHES - -Tell guest about availibilty of xenstoreds XS_RESET_WATCHES function. -Guests can not issue this command unconditionally because some buggy -toolstacks (such as EC2) do not ignore unknown commands properly. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson -Acked-by: Ian Jackson - - ---- - tools/libxl/libxl_create.c | 1 + - tools/python/xen/xend/XendDomainInfo.py | 1 + - 2 files changed, 2 insertions(+) - -Index: xen-4.1.2-testing/tools/libxl/libxl_create.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxl/libxl_create.c -+++ xen-4.1.2-testing/tools/libxl/libxl_create.c -@@ -382,6 +382,7 @@ retry_transaction: - libxl__xs_writev(&gc, t, libxl__sprintf(&gc, "%s/platform", dom_path), info->platformdata); - - xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/control/platform-feature-multiprocessor-suspend", dom_path), "1", 1); -+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/control/platform-feature-xs_reset_watches", dom_path), "1", 1); - if (!xs_transaction_end(ctx->xsh, t, 0)) { - if (errno == EAGAIN) { - t = 0; -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1770,6 +1770,7 @@ class XendDomainInfo: - f('store/port', self.store_port) - f('store/ring-ref', self.store_mfn) - -+ f('control/platform-feature-xs_reset_watches', True) - if arch.type == "x86": - f('control/platform-feature-multiprocessor-suspend', True) - diff --git a/24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch b/24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch deleted file mode 100644 index 6f35143..0000000 --- a/24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch +++ /dev/null @@ -1,62 +0,0 @@ -changeset: 24566:d5b706214616 -user: Olaf Hering -date: Thu Jan 26 11:04:59 2012 +0000 -files: tools/libxc/xc_mem_paging.c -description: -tools/libxc: fix error handling in xc_mem_paging_load - -xc_mem_paging_load() does not pass errors in errno and the actual -errno from xc_mem_event_control() is overwritten by munlock(). -xenpaging_populate_page() needs to check errno, but with the switch to -xc_mem_paging_load() it could not receive ENOMEM anymore. - -Update xc_mem_paging_load() to return -1 and preserve errno during -munlock(). - -Signed-off-by: Olaf Hering -Acked-by: Andres Lagar-Cavilla -Committed-by: Keir Fraser - - ---- - tools/libxc/xc_mem_paging.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_mem_paging.c -+++ xen-4.1.2-testing/tools/libxc/xc_mem_paging.c -@@ -68,23 +68,28 @@ int xc_mem_paging_prep(xc_interface *xch - int xc_mem_paging_load(xc_interface *xch, domid_t domain_id, - unsigned long gfn, void *buffer) - { -- int rc; -+ int rc, old_errno; -+ -+ errno = -EINVAL; - - if ( !buffer ) -- return -EINVAL; -+ return -1; - - if ( ((unsigned long) buffer) & (XC_PAGE_SIZE - 1) ) -- return -EINVAL; -+ return -1; - - if ( mlock(buffer, XC_PAGE_SIZE) ) -- return -errno; -+ return -1; - - rc = xc_mem_event_control(xch, domain_id, - XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP, - XEN_DOMCTL_MEM_EVENT_OP_PAGING, - buffer, NULL, gfn); - -- (void)munlock(buffer, XC_PAGE_SIZE); -+ old_errno = errno; -+ munlock(buffer, XC_PAGE_SIZE); -+ errno = old_errno; -+ - return rc; - } - diff --git a/24586-x86-mm_Properly_account_for_paged_out_pages.patch b/24586-x86-mm_Properly_account_for_paged_out_pages.patch deleted file mode 100644 index d37ca27..0000000 --- a/24586-x86-mm_Properly_account_for_paged_out_pages.patch +++ /dev/null @@ -1,33 +0,0 @@ -changeset: 24586:7a28b8b2d3ea -user: Andres Lagar-Cavilla -date: Thu Jan 26 13:21:27 2012 +0000 -files: xen/arch/x86/mm/p2m.c -description: -x86/mm: Properly account for paged out pages - -If we hit the page after nominate but before paging it out, don't decrement the -domain count of paged out pages. - -Signed-off-by: Andres Lagar-Cavilla -Acked-by: Tim Deegan -Committed-by: Tim Deegan - - ---- - xen/arch/x86/mm/p2m.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -3156,7 +3156,8 @@ int p2m_mem_paging_prep(struct p2m_domai - set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in, a); - audit_p2m(p2m, 1); - -- atomic_dec(&p2m->domain->paged_pages); -+ if ( !page_extant ) -+ atomic_dec(&p2m->domain->paged_pages); - - ret = 0; - out: diff --git a/24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch b/24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch deleted file mode 100644 index b465051..0000000 --- a/24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch +++ /dev/null @@ -1,44 +0,0 @@ -changeset: 24609:cdb1e4a38450 -user: Olaf Hering -date: Fri Jan 27 18:32:55 2012 +0000 -files: tools/libxc/xc_linux_osdep.c -description: -tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly - -If the first ioctl fails with ENOENT it means the command is known. If a -second attempt to map each gfn happens to fail then there is no need to -run the fallback code. Some gfns are paged and the fallback code would -not fix the failure. Instead return the EINVAL to the caller. - -Signed-off-by: Olaf Hering -Acked-by: Andres Lagar-Cavilla -Committed-by: Ian Jackson - - ---- - tools/libxc/xc_linux_osdep.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_linux_osdep.c -+++ xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c -@@ -193,6 +193,7 @@ static void *linux_privcmd_map_foreign_b - - rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx); - -+ /* Command was recognized, some gfn in arr are in paging state */ - if ( rc < 0 && errno == ENOENT ) - { - for ( i = rc = 0; rc == 0 && i < num; i++ ) -@@ -211,8 +212,8 @@ static void *linux_privcmd_map_foreign_b - } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT ); - } - } -- -- if ( rc < 0 && errno == EINVAL && (int)num > 0 ) -+ /* Command was not recognized, use fall back */ -+ else if ( rc < 0 && errno == EINVAL && (int)num > 0 ) - { - /* - * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to diff --git a/24610-xenpaging_make_file_op_largefile_aware.patch b/24610-xenpaging_make_file_op_largefile_aware.patch deleted file mode 100644 index 9442560..0000000 --- a/24610-xenpaging_make_file_op_largefile_aware.patch +++ /dev/null @@ -1,39 +0,0 @@ -changeset: 24610:255ae011567d -user: Olaf Hering -date: Fri Jan 27 19:03:37 2012 +0000 -files: tools/xenpaging/file_ops.c -description: -xenpaging: make file_op largefile aware - -lseek() takes an off_t, the used "int << shiftsize" does not automatically -convert the int into a larger type. This leads to write errors with pagefiles -larger than 2G. Fix this by shifting an off_t instead of an int. - -Signed-off-by: Olaf Hering -Committed-by: Ian Jackson - - ---- - tools/xenpaging/file_ops.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/file_ops.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/file_ops.c -+++ xen-4.1.2-testing/tools/xenpaging/file_ops.c -@@ -26,12 +26,12 @@ - static int file_op(int fd, void *page, int i, - ssize_t (*fn)(int, void *, size_t)) - { -- off_t seek_ret; -+ off_t offset = i; - int total = 0; - int bytes; - -- seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET); -- if ( seek_ret == (off_t)-1 ) -+ offset = lseek(fd, offset << PAGE_SHIFT, SEEK_SET); -+ if ( offset == (off_t)-1 ) - return -1; - - while ( total < PAGE_SIZE ) diff --git a/24706-pygrub-extlinux.patch b/24706-pygrub-extlinux.patch deleted file mode 100644 index c601c73..0000000 --- a/24706-pygrub-extlinux.patch +++ /dev/null @@ -1,29 +0,0 @@ -# HG changeset patch -# User Roger Pau Monne -# Date 1328635287 0 -# Node ID f84f34ec5fc7613d7a6dd53d18218656c11f0daa -# Parent 7a58296824c3bf7a15d563a7a140d20c369c96c8 -pygrub: extlinux parsing correctness - -The "in" operator should be used instead of the find method, since -we are only interested in knowing whether the line contains "initrd=", -but we don't care about it's position. Also fixes an error that -happens when initrd= it's at the start of the line, since find returns -0 and is evaluated as False. - -Signed-off-by: Roger Pau Monne -Acked-by: Ian Jackson -Committed-by: Ian Jackson - -diff -r 7a58296824c3 -r f84f34ec5fc7 tools/pygrub/src/ExtLinuxConf.py ---- a/tools/pygrub/src/ExtLinuxConf.py Tue Feb 07 17:18:10 2012 +0000 -+++ b/tools/pygrub/src/ExtLinuxConf.py Tue Feb 07 17:21:27 2012 +0000 -@@ -60,7 +60,7 @@ - - # Bypass regular self.commands handling - com = None -- elif arg.find("initrd="): -+ elif "initrd=" in arg: - # find initrd image in append line - args = arg.strip().split(" ") - for a in args: diff --git a/24780-x86-paging-use-clear_guest.patch b/24780-x86-paging-use-clear_guest.patch deleted file mode 100644 index cdfdb40..0000000 --- a/24780-x86-paging-use-clear_guest.patch +++ /dev/null @@ -1,396 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1329134942 -3600 -# Node ID e953d536d3c6e344cf310f63ead9feda87cc67b0 -# Parent 9ad1e42c341bc78463b6f6610a6300f75b535fbb -x86/paging: use clear_guest() for zero-filling guest buffers - -While static arrays of all zeros may be tolerable (but are simply -inefficient now that we have the necessary infrastructure), using on- -stack arrays for this purpose (particularly when their size doesn't -have an upper limit enforced) is calling for eventual problems (even -if the code can be reached via administrative interfaces only). - -Signed-off-by: Jan Beulich -Acked-by: Tim Deegan - -(Include necessary prerequisite bits from 24543:d6cdbc4fe078 -"Introduce clear_user and clear_guest".) - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -2171,6 +2171,86 @@ static enum hvm_copy_result __hvm_copy( - return HVMCOPY_okay; - } - -+static enum hvm_copy_result __hvm_clear(paddr_t addr, int size) -+{ -+ struct vcpu *curr = current; -+ struct p2m_domain *p2m = p2m_get_hostp2m(curr->domain); -+ unsigned long gfn, mfn; -+ p2m_type_t p2mt; -+ char *p; -+ int count, todo = size; -+ uint32_t pfec = PFEC_page_present | PFEC_write_access; -+ -+ /* -+ * XXX Disable for 4.1.0: PV-on-HVM drivers will do grant-table ops -+ * such as query_size. Grant-table code currently does copy_to/from_guest -+ * accesses under the big per-domain lock, which this test would disallow. -+ * The test is not needed until we implement sleeping-on-waitqueue when -+ * we access a paged-out frame, and that's post 4.1.0 now. -+ */ -+#if 0 -+ /* -+ * If the required guest memory is paged out, this function may sleep. -+ * Hence we bail immediately if called from atomic context. -+ */ -+ if ( in_atomic() ) -+ return HVMCOPY_unhandleable; -+#endif -+ -+ while ( todo > 0 ) -+ { -+ count = min_t(int, PAGE_SIZE - (addr & ~PAGE_MASK), todo); -+ -+ gfn = paging_gva_to_gfn(curr, addr, &pfec); -+ if ( gfn == INVALID_GFN ) -+ { -+ if ( pfec == PFEC_page_paged ) -+ return HVMCOPY_gfn_paged_out; -+ if ( pfec == PFEC_page_shared ) -+ return HVMCOPY_gfn_shared; -+ return HVMCOPY_bad_gva_to_gfn; -+ } -+ -+ mfn = mfn_x(gfn_to_mfn_unshare(p2m, gfn, &p2mt, 0)); -+ -+ if ( p2m_is_paging(p2mt) ) -+ { -+ p2m_mem_paging_populate(p2m, gfn); -+ return HVMCOPY_gfn_paged_out; -+ } -+ if ( p2m_is_shared(p2mt) ) -+ return HVMCOPY_gfn_shared; -+ if ( p2m_is_grant(p2mt) ) -+ return HVMCOPY_unhandleable; -+ if ( !p2m_is_ram(p2mt) ) -+ return HVMCOPY_bad_gfn_to_mfn; -+ ASSERT(mfn_valid(mfn)); -+ -+ p = (char *)map_domain_page(mfn) + (addr & ~PAGE_MASK); -+ -+ if ( p2mt == p2m_ram_ro ) -+ { -+ static unsigned long lastpage; -+ if ( xchg(&lastpage, gfn) != gfn ) -+ gdprintk(XENLOG_DEBUG, "guest attempted write to read-only" -+ " memory page. gfn=%#lx, mfn=%#lx\n", -+ gfn, mfn); -+ } -+ else -+ { -+ memset(p, 0x00, count); -+ paging_mark_dirty(curr->domain, mfn); -+ } -+ -+ unmap_domain_page(p); -+ -+ addr += count; -+ todo -= count; -+ } -+ -+ return HVMCOPY_okay; -+} -+ - enum hvm_copy_result hvm_copy_to_guest_phys( - paddr_t paddr, void *buf, int size) - { -@@ -2257,6 +2337,23 @@ unsigned long copy_to_user_hvm(void *to, - return rc ? len : 0; /* fake a copy_to_user() return code */ - } - -+unsigned long clear_user_hvm(void *to, unsigned int len) -+{ -+ int rc; -+ -+#ifdef __x86_64__ -+ if ( !current->arch.hvm_vcpu.hcall_64bit && -+ is_compat_arg_xlat_range(to, len) ) -+ { -+ memset(to, 0x00, len); -+ return 0; -+ } -+#endif -+ -+ rc = __hvm_clear((unsigned long)to, len); -+ return rc ? len : 0; /* fake a copy_to_user() return code */ -+} -+ - unsigned long copy_from_user_hvm(void *to, const void *from, unsigned len) - { - int rc; -Index: xen-4.1.3-testing/xen/arch/x86/mm/paging.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/paging.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/paging.c -@@ -21,11 +21,11 @@ - */ - - #include -+#include - #include - #include - #include - #include --#include - #include - #include - -@@ -450,26 +450,30 @@ int paging_log_dirty_op(struct domain *d - (pages < sc->pages) && (i2 < LOGDIRTY_NODE_ENTRIES); - i2++ ) - { -- static unsigned long zeroes[PAGE_SIZE/BYTES_PER_LONG]; - unsigned int bytes = PAGE_SIZE; - l1 = ((l2 && mfn_valid(l2[i2])) ? -- map_domain_page(mfn_x(l2[i2])) : zeroes); -+ map_domain_page(mfn_x(l2[i2])) : NULL); - if ( unlikely(((sc->pages - pages + 7) >> 3) < bytes) ) - bytes = (unsigned int)((sc->pages - pages + 7) >> 3); - if ( likely(peek) ) - { -- if ( copy_to_guest_offset(sc->dirty_bitmap, pages >> 3, -- (uint8_t *)l1, bytes) != 0 ) -+ if ( (l1 ? copy_to_guest_offset(sc->dirty_bitmap, -+ pages >> 3, (uint8_t *)l1, -+ bytes) -+ : clear_guest_offset(sc->dirty_bitmap, -+ pages >> 3, bytes)) != 0 ) - { - rv = -EFAULT; - goto out; - } - } -- if ( clean && l1 != zeroes ) -- clear_page(l1); - pages += bytes << 3; -- if ( l1 != zeroes ) -+ if ( l1 ) -+ { -+ if ( clean ) -+ clear_page(l1); - unmap_domain_page(l1); -+ } - } - if ( l2 ) - unmap_domain_page(l2); -@@ -529,12 +533,9 @@ int paging_log_dirty_range(struct domain - - if ( !d->arch.paging.log_dirty.fault_count && - !d->arch.paging.log_dirty.dirty_count ) { -- int size = (nr + BITS_PER_LONG - 1) / BITS_PER_LONG; -- unsigned long zeroes[size]; -- memset(zeroes, 0x00, size * BYTES_PER_LONG); -- rv = 0; -- if ( copy_to_guest_offset(dirty_bitmap, 0, (uint8_t *) zeroes, -- size * BYTES_PER_LONG) != 0 ) -+ unsigned int size = BITS_TO_LONGS(nr); -+ -+ if ( clear_guest(dirty_bitmap, size * BYTES_PER_LONG) != 0 ) - rv = -EFAULT; - goto out; - } -@@ -562,11 +563,10 @@ int paging_log_dirty_range(struct domain - (pages < nr) && (i2 < LOGDIRTY_NODE_ENTRIES); - i2++ ) - { -- static unsigned long zeroes[PAGE_SIZE/BYTES_PER_LONG]; - unsigned int bytes = PAGE_SIZE; - uint8_t *s; - l1 = ((l2 && mfn_valid(l2[i2])) ? -- map_domain_page(mfn_x(l2[i2])) : zeroes); -+ map_domain_page(mfn_x(l2[i2])) : NULL); - - s = ((uint8_t*)l1) + (b1 >> 3); - bytes -= b1 >> 3; -@@ -574,9 +574,18 @@ int paging_log_dirty_range(struct domain - if ( likely(((nr - pages + 7) >> 3) < bytes) ) - bytes = (unsigned int)((nr - pages + 7) >> 3); - -+ if ( !l1 ) -+ { -+ if ( clear_guest_offset(dirty_bitmap, pages >> 3, -+ bytes) != 0 ) -+ { -+ rv = -EFAULT; -+ goto out; -+ } -+ } - /* begin_pfn is not 32K aligned, hence we have to bit - * shift the bitmap */ -- if ( b1 & 0x7 ) -+ else if ( b1 & 0x7 ) - { - int i, j; - uint32_t *l = (uint32_t*) s; -@@ -620,11 +629,12 @@ int paging_log_dirty_range(struct domain - } - } - -- if ( l1 != zeroes ) -- clear_page(l1); - pages += bytes << 3; -- if ( l1 != zeroes ) -+ if ( l1 ) -+ { -+ clear_page(l1); - unmap_domain_page(l1); -+ } - b1 = b1 & 0x7; - } - b2 = 0; -Index: xen-4.1.3-testing/xen/arch/x86/usercopy.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/usercopy.c -+++ xen-4.1.3-testing/xen/arch/x86/usercopy.c -@@ -110,6 +110,42 @@ copy_to_user(void __user *to, const void - return n; - } - -+#define __do_clear_user(addr,size) \ -+do { \ -+ long __d0; \ -+ __asm__ __volatile__( \ -+ "0: rep; stosl\n" \ -+ " movl %2,%0\n" \ -+ "1: rep; stosb\n" \ -+ "2:\n" \ -+ ".section .fixup,\"ax\"\n" \ -+ "3: lea 0(%2,%0,4),%0\n" \ -+ " jmp 2b\n" \ -+ ".previous\n" \ -+ _ASM_EXTABLE(0b,3b) \ -+ _ASM_EXTABLE(1b,2b) \ -+ : "=&c"(size), "=&D" (__d0) \ -+ : "r"(size & 3), "0"(size / 4), "1"((long)addr), "a"(0)); \ -+} while (0) -+ -+/** -+ * clear_user: - Zero a block of memory in user space. -+ * @to: Destination address, in user space. -+ * @n: Number of bytes to zero. -+ * -+ * Zero a block of memory in user space. -+ * -+ * Returns number of bytes that could not be cleared. -+ * On success, this will be zero. -+ */ -+unsigned long -+clear_user(void __user *to, unsigned n) -+{ -+ if ( access_ok(to, n) ) -+ __do_clear_user(to, n); -+ return n; -+} -+ - /** - * copy_from_user: - Copy a block of data from user space. - * @to: Destination address, in kernel space. -Index: xen-4.1.3-testing/xen/include/asm-x86/guest_access.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/guest_access.h -+++ xen-4.1.3-testing/xen/include/asm-x86/guest_access.h -@@ -21,6 +21,10 @@ - (is_hvm_vcpu(current) ? \ - copy_from_user_hvm((dst), (src), (len)) : \ - copy_from_user((dst), (src), (len))) -+#define raw_clear_guest(dst, len) \ -+ (is_hvm_vcpu(current) ? \ -+ clear_user_hvm((dst), (len)) : \ -+ clear_user((dst), (len))) - #define __raw_copy_to_guest(dst, src, len) \ - (is_hvm_vcpu(current) ? \ - copy_to_user_hvm((dst), (src), (len)) : \ -@@ -29,6 +33,10 @@ - (is_hvm_vcpu(current) ? \ - copy_from_user_hvm((dst), (src), (len)) : \ - __copy_from_user((dst), (src), (len))) -+#define __raw_clear_guest(dst, len) \ -+ (is_hvm_vcpu(current) ? \ -+ clear_user_hvm((dst), (len)) : \ -+ clear_user((dst), (len))) - - /* Is the guest handle a NULL reference? */ - #define guest_handle_is_null(hnd) ((hnd).p == NULL) -@@ -69,6 +77,11 @@ - raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\ - }) - -+#define clear_guest_offset(hnd, off, nr) ({ \ -+ void *_d = (hnd).p; \ -+ raw_clear_guest(_d+(off), nr); \ -+}) -+ - /* Copy sub-field of a structure to guest context via a guest handle. */ - #define copy_field_to_guest(hnd, ptr, field) ({ \ - const typeof(&(ptr)->field) _s = &(ptr)->field; \ -@@ -110,6 +123,11 @@ - __raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\ - }) - -+#define __clear_guest_offset(hnd, off, nr) ({ \ -+ void *_d = (hnd).p; \ -+ __raw_clear_guest(_d+(off), nr); \ -+}) -+ - #define __copy_field_to_guest(hnd, ptr, field) ({ \ - const typeof(&(ptr)->field) _s = &(ptr)->field; \ - void *_d = &(hnd).p->field; \ -Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/guest_access.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/guest_access.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hvm/guest_access.h -@@ -2,6 +2,7 @@ - #define __ASM_X86_HVM_GUEST_ACCESS_H__ - - unsigned long copy_to_user_hvm(void *to, const void *from, unsigned len); -+unsigned long clear_user_hvm(void *to, unsigned int len); - unsigned long copy_from_user_hvm(void *to, const void *from, unsigned len); - - #endif /* __ASM_X86_HVM_GUEST_ACCESS_H__ */ -Index: xen-4.1.3-testing/xen/include/asm-x86/uaccess.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/uaccess.h -+++ xen-4.1.3-testing/xen/include/asm-x86/uaccess.h -@@ -16,6 +16,7 @@ - #endif - - unsigned long copy_to_user(void *to, const void *from, unsigned len); -+unsigned long clear_user(void *to, unsigned len); - unsigned long copy_from_user(void *to, const void *from, unsigned len); - /* Handles exceptions in both to and from, but doesn't do access_ok */ - unsigned long __copy_to_user_ll(void *to, const void *from, unsigned n); -Index: xen-4.1.3-testing/xen/include/xen/guest_access.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/guest_access.h -+++ xen-4.1.3-testing/xen/include/xen/guest_access.h -@@ -15,10 +15,16 @@ - #define copy_from_guest(ptr, hnd, nr) \ - copy_from_guest_offset(ptr, hnd, 0, nr) - -+#define clear_guest(hnd, nr) \ -+ clear_guest_offset(hnd, 0, nr) -+ - #define __copy_to_guest(hnd, ptr, nr) \ - __copy_to_guest_offset(hnd, 0, ptr, nr) - - #define __copy_from_guest(ptr, hnd, nr) \ - __copy_from_guest_offset(ptr, hnd, 0, nr) - -+#define __clear_guest(hnd, nr) \ -+ __clear_guest_offset(hnd, 0, nr) -+ - #endif /* __XEN_GUEST_ACCESS_H__ */ diff --git a/24781-x86-vmce-mcg_ctl.patch b/24781-x86-vmce-mcg_ctl.patch deleted file mode 100644 index 3560879..0000000 --- a/24781-x86-vmce-mcg_ctl.patch +++ /dev/null @@ -1,98 +0,0 @@ -References: bnc#745367 - -# HG changeset patch -# User Jan Beulich -# Date 1329135150 -3600 -# Node ID 6ae5506e49abbe07b3b84c56cda114f59beb7ebe -# Parent e953d536d3c6e344cf310f63ead9feda87cc67b0 -x86/vMCE: MC{G,i}_CTL handling adjustments - -- g_mcg_cap was read to determine whether MCG_CTL exists before it got - initialized -- h_mci_ctrl[] and dom_vmce()->mci_ctl[] both got initialized via - memset() with an inappropriate size (hence causing a [minor?] - information leak) - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/cpu/mcheck/mce.c -+++ b/xen/arch/x86/cpu/mcheck/mce.c -@@ -29,7 +29,7 @@ invbool_param("mce", mce_disabled); - bool_t __read_mostly mce_broadcast = 0; - bool_t is_mc_panic; - unsigned int __read_mostly nr_mce_banks; --int __read_mostly firstbank; -+unsigned int __read_mostly firstbank; - - static void intpose_init(void); - static void mcinfo_clear(struct mc_info *); -@@ -646,7 +646,7 @@ int mce_available(struct cpuinfo_x86 *c) - * Check if bank 0 is usable for MCE. It isn't for AMD K7, - * and Intel P6 family before model 0x1a. - */ --int mce_firstbank(struct cpuinfo_x86 *c) -+unsigned int mce_firstbank(struct cpuinfo_x86 *c) - { - if (c->x86 == 6) { - if (c->x86_vendor == X86_VENDOR_AMD) ---- a/xen/arch/x86/cpu/mcheck/mce.h -+++ b/xen/arch/x86/cpu/mcheck/mce.h -@@ -52,13 +52,13 @@ int is_vmce_ready(struct mcinfo_bank *ba - int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn); - - u64 mce_cap_init(void); --extern int firstbank; -+extern unsigned int firstbank; - - int intel_mce_rdmsr(uint32_t msr, uint64_t *val); - int intel_mce_wrmsr(uint32_t msr, uint64_t val); - - int mce_available(struct cpuinfo_x86 *c); --int mce_firstbank(struct cpuinfo_x86 *c); -+unsigned int mce_firstbank(struct cpuinfo_x86 *c); - /* Helper functions used for collecting error telemetry */ - struct mc_info *x86_mcinfo_getptr(void); - void mc_panic(char *s); ---- a/xen/arch/x86/cpu/mcheck/vmce.c -+++ b/xen/arch/x86/cpu/mcheck/vmce.c -@@ -39,7 +39,7 @@ int vmce_init_msr(struct domain *d) - return -ENOMEM; - } - memset(dom_vmce(d)->mci_ctl, ~0, -- sizeof(dom_vmce(d)->mci_ctl)); -+ nr_mce_banks * sizeof(*dom_vmce(d)->mci_ctl)); - - dom_vmce(d)->mcg_status = 0x0; - dom_vmce(d)->mcg_cap = g_mcg_cap; -@@ -437,7 +437,7 @@ int vmce_domain_inject( - int vmce_init(struct cpuinfo_x86 *c) - { - u64 value; -- int i; -+ unsigned int i; - - if ( !h_mci_ctrl ) - { -@@ -448,17 +448,17 @@ int vmce_init(struct cpuinfo_x86 *c) - return -ENOMEM; - } - /* Don't care banks before firstbank */ -- memset(h_mci_ctrl, 0xff, sizeof(h_mci_ctrl)); -+ memset(h_mci_ctrl, ~0, -+ min(firstbank, nr_mce_banks) * sizeof(*h_mci_ctrl)); - for (i = firstbank; i < nr_mce_banks; i++) - rdmsrl(MSR_IA32_MCx_CTL(i), h_mci_ctrl[i]); - } - -- if (g_mcg_cap & MCG_CTL_P) -- rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl); -- - rdmsrl(MSR_IA32_MCG_CAP, value); - /* For Guest vMCE usage */ - g_mcg_cap = value & ~MCG_CMCI_P; -+ if (value & MCG_CTL_P) -+ rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl); - - return 0; - } diff --git a/24805-x86-MSI-X-dom0-ro.patch b/24805-x86-MSI-X-dom0-ro.patch deleted file mode 100644 index d9f0d87..0000000 --- a/24805-x86-MSI-X-dom0-ro.patch +++ /dev/null @@ -1,32 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1329303884 -3600 -# Node ID 618cbd27bac06fe39b1c6f28ded6d4d7f444e7bd -# Parent 0ba87b95e80bae059fe70b4b117dcc409f2471ef -x86: don't allow Dom0 to map MSI-X table writably - -With the traditional qemu tree fixed to not use PROT_WRITE anymore in -the mmap() call for this region, and with the upstream qemu tree not -being capable of handling passthrough, yet, there's no need to treat -Dom specially here anymore. - -This continues to leave unaddressed the case where PV guests map the -MSI-X table page(s) before setting up the first MSI-X interrupt (see -the original c/s 22182:68cc3c514a0a description for options). - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -836,7 +836,7 @@ get_page_from_l1e( - return -EINVAL; - } - -- if ( !(l1f & _PAGE_RW) || IS_PRIV(pg_owner) || -+ if ( !(l1f & _PAGE_RW) || - !rangeset_contains_singleton(mmio_ro_ranges, mfn) ) - return 0; - dprintk(XENLOG_G_WARNING, diff --git a/24886-x86-vmce-mcg_ctl-default.patch b/24886-x86-vmce-mcg_ctl-default.patch deleted file mode 100644 index b44f28d..0000000 --- a/24886-x86-vmce-mcg_ctl-default.patch +++ /dev/null @@ -1,49 +0,0 @@ -References: bnc#745367 - -# HG changeset patch -# User Jan Beulich -# Date 1330070623 -3600 -# Node ID e80b0bb4470b944a5b52a91c0ec85a1d65d18c55 -# Parent 0c3d19f40ab145d101de84051c3e00eef17fa1cb -x86/vMCE: don't advertise features we don't support - -... or even know of. Apart from CMCI, which was masked off already, -this now also suppresses the advertising of extended state registers -(reading of which would likely be meaningless in a guest and represent -an information leak). - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/cpu/mcheck/vmce.c -+++ b/xen/arch/x86/cpu/mcheck/vmce.c -@@ -456,7 +456,7 @@ int vmce_init(struct cpuinfo_x86 *c) - - rdmsrl(MSR_IA32_MCG_CAP, value); - /* For Guest vMCE usage */ -- g_mcg_cap = value & ~MCG_CMCI_P; -+ g_mcg_cap = value & (MCG_CAP_COUNT | MCG_CTL_P | MCG_TES_P | MCG_SER_P); - if (value & MCG_CTL_P) - rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl); - ---- a/xen/arch/x86/cpu/mcheck/x86_mca.h -+++ b/xen/arch/x86/cpu/mcheck/x86_mca.h -@@ -30,12 +30,13 @@ - - - /* Bitfield of the MSR_IA32_MCG_CAP register */ --#define MCG_SER_P (1UL<<24) - #define MCG_CAP_COUNT 0x00000000000000ffULL --#define MCG_CTL_P 0x0000000000000100ULL --#define MCG_EXT_P (1UL<<9) --#define MCG_EXT_CNT (16) --#define MCG_CMCI_P (1UL<<10) -+#define MCG_CTL_P (1ULL<<8) -+#define MCG_EXT_P (1ULL<<9) -+#define MCG_CMCI_P (1ULL<<10) -+#define MCG_TES_P (1ULL<<11) -+#define MCG_EXT_CNT 16 -+#define MCG_SER_P (1ULL<<24) - /* Other bits are reserved */ - - /* Bitfield of the MSR_IA32_MCG_STATUS register */ diff --git a/24887-x86-vmce-sr.patch b/24887-x86-vmce-sr.patch deleted file mode 100644 index aea8754..0000000 --- a/24887-x86-vmce-sr.patch +++ /dev/null @@ -1,583 +0,0 @@ -References: bnc#745367 - -# HG changeset patch -# User Jan Beulich -# Date 1330070874 -3600 -# Node ID 35d855e520038bf5814f53d105dc4adf58a670f2 -# Parent e80b0bb4470b944a5b52a91c0ec85a1d65d18c55 -x86/vMCE: save/restore MCA capabilities - -This allows migration to a host with less MCA banks than the source -host had, while without this patch accesses to the excess banks' MSRs -caused #GP-s in the guest after migration (and it depended on the guest -kernel whether this would be fatal). - -A fundamental question is whether we should also save/restore MCG_CTL -and MCi_CTL, as the HVM save record would better be defined to the -complete state that needs saving from the beginning (I'm unsure whether -the save/restore logic allows for future extension of an existing -record). - -Of course, this change is expected to make migration from new to older -Xen impossible (again I'm unsure what the save/restore logic does with -records it doesn't even know about). - -The (trivial) tools side change may seem unrelated, but the code should -have been that way from the beginning to allow the hypervisor to look -at currently unused ext_vcpucontext fields without risking to read -garbage when those fields get a meaning assigned in the future. This -isn't being enforced here - should it be? (Obviously, for backwards -compatibility, the hypervisor must assume these fields to be clear only -when the extended context's size exceeds the old original one.) - -A future addition to this change might be to allow configuration of the -number of banks and other MCA capabilities for a guest before it starts -(i.e. to not inherits the values seen on the first host it runs on). - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - -Index: xen-4.1.3-testing/tools/libxc/xc_domain_save.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/xc_domain_save.c -+++ xen-4.1.3-testing/tools/libxc/xc_domain_save.c -@@ -1778,6 +1778,7 @@ int xc_domain_save(xc_interface *xch, in - - domctl.cmd = XEN_DOMCTL_get_ext_vcpucontext; - domctl.domain = dom; -+ memset(&domctl.u, 0, sizeof(domctl.u)); - domctl.u.ext_vcpucontext.vcpu = i; - if ( xc_domctl(xch, &domctl) < 0 ) - { -Index: xen-4.1.3-testing/tools/misc/xen-hvmctx.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/misc/xen-hvmctx.c -+++ xen-4.1.3-testing/tools/misc/xen-hvmctx.c -@@ -375,6 +375,13 @@ static void dump_viridian(void) - (unsigned long long) p.guest_os_id); - } - -+static void dump_vmce_vcpu(void) -+{ -+ HVM_SAVE_TYPE(VMCE_VCPU) p; -+ READ(p); -+ printf(" VMCE_VCPU: caps %" PRIx64 "\n", p.caps); -+} -+ - int main(int argc, char **argv) - { - int entry, domid; -@@ -440,6 +447,7 @@ int main(int argc, char **argv) - case HVM_SAVE_CODE(PMTIMER): dump_pmtimer(); break; - case HVM_SAVE_CODE(MTRR): dump_mtrr(); break; - case HVM_SAVE_CODE(VIRIDIAN): dump_viridian(); break; -+ case HVM_SAVE_CODE(VMCE_VCPU): dump_vmce_vcpu(); break; - case HVM_SAVE_CODE(END): break; - default: - printf(" ** Don't understand type %u: skipping\n", -Index: xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/cpu/mcheck/mce.h -+++ xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce.h -@@ -3,6 +3,7 @@ - #define _MCE_H - - #include -+#include - #include - #include - #include -@@ -54,8 +55,8 @@ int unmmap_broken_page(struct domain *d, - u64 mce_cap_init(void); - extern unsigned int firstbank; - --int intel_mce_rdmsr(uint32_t msr, uint64_t *val); --int intel_mce_wrmsr(uint32_t msr, uint64_t val); -+int intel_mce_rdmsr(const struct vcpu *, uint32_t msr, uint64_t *val); -+int intel_mce_wrmsr(struct vcpu *, uint32_t msr, uint64_t val); - - int mce_available(struct cpuinfo_x86 *c); - unsigned int mce_firstbank(struct cpuinfo_x86 *c); -@@ -169,18 +170,20 @@ int vmce_domain_inject(struct mcinfo_ban - - extern int vmce_init(struct cpuinfo_x86 *c); - --static inline int mce_vendor_bank_msr(uint32_t msr) -+static inline int mce_vendor_bank_msr(const struct vcpu *v, uint32_t msr) - { - if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && -- msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks) ) -+ msr >= MSR_IA32_MC0_CTL2 && -+ msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) ) - return 1; - return 0; - } - --static inline int mce_bank_msr(uint32_t msr) -+static inline int mce_bank_msr(const struct vcpu *v, uint32_t msr) - { -- if ( (msr >= MSR_IA32_MC0_CTL && msr < MSR_IA32_MCx_CTL(nr_mce_banks)) || -- mce_vendor_bank_msr(msr) ) -+ if ( (msr >= MSR_IA32_MC0_CTL && -+ msr < MSR_IA32_MCx_CTL(v->arch.mcg_cap & MCG_CAP_COUNT)) || -+ mce_vendor_bank_msr(v, msr) ) - return 1; - return 0; - } -Index: xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce_intel.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/cpu/mcheck/mce_intel.c -+++ xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce_intel.c -@@ -1322,11 +1322,12 @@ enum mcheck_type intel_mcheck_init(struc - } - - /* intel specific MCA MSR */ --int intel_mce_wrmsr(uint32_t msr, uint64_t val) -+int intel_mce_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) - { - int ret = 0; - -- if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks)) -+ if ( msr >= MSR_IA32_MC0_CTL2 && -+ msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) ) - { - mce_printk(MCE_QUIET, "We have disabled CMCI capability, " - "Guest should not write this MSR!\n"); -@@ -1336,11 +1337,12 @@ int intel_mce_wrmsr(uint32_t msr, uint64 - return ret; - } - --int intel_mce_rdmsr(uint32_t msr, uint64_t *val) -+int intel_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) - { - int ret = 0; - -- if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks)) -+ if ( msr >= MSR_IA32_MC0_CTL2 && -+ msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) ) - { - mce_printk(MCE_QUIET, "We have disabled CMCI capability, " - "Guest should not read this MSR!\n"); -Index: xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/vmce.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/cpu/mcheck/vmce.c -+++ xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/vmce.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -42,7 +43,6 @@ int vmce_init_msr(struct domain *d) - nr_mce_banks * sizeof(*dom_vmce(d)->mci_ctl)); - - dom_vmce(d)->mcg_status = 0x0; -- dom_vmce(d)->mcg_cap = g_mcg_cap; - dom_vmce(d)->mcg_ctl = ~(uint64_t)0x0; - dom_vmce(d)->nr_injection = 0; - -@@ -61,21 +61,41 @@ void vmce_destroy_msr(struct domain *d) - dom_vmce(d) = NULL; - } - --static int bank_mce_rdmsr(struct domain *d, uint32_t msr, uint64_t *val) -+void vmce_init_vcpu(struct vcpu *v) - { -- int bank, ret = 1; -- struct domain_mca_msrs *vmce = dom_vmce(d); -+ v->arch.mcg_cap = g_mcg_cap; -+} -+ -+int vmce_restore_vcpu(struct vcpu *v, uint64_t caps) -+{ -+ if ( caps & ~g_mcg_cap & ~MCG_CAP_COUNT & ~MCG_CTL_P ) -+ { -+ dprintk(XENLOG_G_ERR, "%s restore: unsupported MCA capabilities" -+ " %#" PRIx64 " for d%d:v%u (supported: %#Lx)\n", -+ is_hvm_vcpu(v) ? "HVM" : "PV", caps, v->domain->domain_id, -+ v->vcpu_id, g_mcg_cap & ~MCG_CAP_COUNT); -+ return -EPERM; -+ } -+ -+ v->arch.mcg_cap = caps; -+ return 0; -+} -+ -+static int bank_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val) -+{ -+ int ret = 1; -+ unsigned int bank = (msr - MSR_IA32_MC0_CTL) / 4; -+ struct domain_mca_msrs *vmce = dom_vmce(v->domain); - struct bank_entry *entry; - -- bank = (msr - MSR_IA32_MC0_CTL) / 4; -- if ( bank >= nr_mce_banks ) -- return -1; -+ *val = 0; - - switch ( msr & (MSR_IA32_MC0_CTL | 3) ) - { - case MSR_IA32_MC0_CTL: -- *val = vmce->mci_ctl[bank] & -- (h_mci_ctrl ? h_mci_ctrl[bank] : ~0UL); -+ if ( bank < nr_mce_banks ) -+ *val = vmce->mci_ctl[bank] & -+ (h_mci_ctrl ? h_mci_ctrl[bank] : ~0UL); - mce_printk(MCE_VERBOSE, "MCE: rdmsr MC%u_CTL 0x%"PRIx64"\n", - bank, *val); - break; -@@ -126,7 +146,7 @@ static int bank_mce_rdmsr(struct domain - switch ( boot_cpu_data.x86_vendor ) - { - case X86_VENDOR_INTEL: -- ret = intel_mce_rdmsr(msr, val); -+ ret = intel_mce_rdmsr(v, msr, val); - break; - default: - ret = 0; -@@ -145,13 +165,13 @@ static int bank_mce_rdmsr(struct domain - */ - int vmce_rdmsr(uint32_t msr, uint64_t *val) - { -- struct domain *d = current->domain; -- struct domain_mca_msrs *vmce = dom_vmce(d); -+ const struct vcpu *cur = current; -+ struct domain_mca_msrs *vmce = dom_vmce(cur->domain); - int ret = 1; - - *val = 0; - -- spin_lock(&dom_vmce(d)->lock); -+ spin_lock(&vmce->lock); - - switch ( msr ) - { -@@ -162,39 +182,38 @@ int vmce_rdmsr(uint32_t msr, uint64_t *v - "MCE: rdmsr MCG_STATUS 0x%"PRIx64"\n", *val); - break; - case MSR_IA32_MCG_CAP: -- *val = vmce->mcg_cap; -+ *val = cur->arch.mcg_cap; - mce_printk(MCE_VERBOSE, "MCE: rdmsr MCG_CAP 0x%"PRIx64"\n", - *val); - break; - case MSR_IA32_MCG_CTL: - /* Always 0 if no CTL support */ -- *val = vmce->mcg_ctl & h_mcg_ctl; -+ if ( cur->arch.mcg_cap & MCG_CTL_P ) -+ *val = vmce->mcg_ctl & h_mcg_ctl; - mce_printk(MCE_VERBOSE, "MCE: rdmsr MCG_CTL 0x%"PRIx64"\n", - *val); - break; - default: -- ret = mce_bank_msr(msr) ? bank_mce_rdmsr(d, msr, val) : 0; -+ ret = mce_bank_msr(cur, msr) ? bank_mce_rdmsr(cur, msr, val) : 0; - break; - } - -- spin_unlock(&dom_vmce(d)->lock); -+ spin_unlock(&vmce->lock); - return ret; - } - --static int bank_mce_wrmsr(struct domain *d, u32 msr, u64 val) -+static int bank_mce_wrmsr(struct vcpu *v, u32 msr, u64 val) - { -- int bank, ret = 1; -- struct domain_mca_msrs *vmce = dom_vmce(d); -+ int ret = 1; -+ unsigned int bank = (msr - MSR_IA32_MC0_CTL) / 4; -+ struct domain_mca_msrs *vmce = dom_vmce(v->domain); - struct bank_entry *entry = NULL; - -- bank = (msr - MSR_IA32_MC0_CTL) / 4; -- if ( bank >= nr_mce_banks ) -- return -EINVAL; -- - switch ( msr & (MSR_IA32_MC0_CTL | 3) ) - { - case MSR_IA32_MC0_CTL: -- vmce->mci_ctl[bank] = val; -+ if ( bank < nr_mce_banks ) -+ vmce->mci_ctl[bank] = val; - break; - case MSR_IA32_MC0_STATUS: - /* Give the first entry of the list, it corresponds to current -@@ -202,9 +221,9 @@ static int bank_mce_wrmsr(struct domain - * the guest, this node will be deleted. - * Only error bank is written. Non-error banks simply return. - */ -- if ( !list_empty(&dom_vmce(d)->impact_header) ) -+ if ( !list_empty(&vmce->impact_header) ) - { -- entry = list_entry(dom_vmce(d)->impact_header.next, -+ entry = list_entry(vmce->impact_header.next, - struct bank_entry, list); - if ( entry->bank == bank ) - entry->mci_status = val; -@@ -228,7 +247,7 @@ static int bank_mce_wrmsr(struct domain - switch ( boot_cpu_data.x86_vendor ) - { - case X86_VENDOR_INTEL: -- ret = intel_mce_wrmsr(msr, val); -+ ret = intel_mce_wrmsr(v, msr, val); - break; - default: - ret = 0; -@@ -247,9 +266,9 @@ static int bank_mce_wrmsr(struct domain - */ - int vmce_wrmsr(u32 msr, u64 val) - { -- struct domain *d = current->domain; -+ struct vcpu *cur = current; - struct bank_entry *entry = NULL; -- struct domain_mca_msrs *vmce = dom_vmce(d); -+ struct domain_mca_msrs *vmce = dom_vmce(cur->domain); - int ret = 1; - - if ( !g_mcg_cap ) -@@ -266,7 +285,7 @@ int vmce_wrmsr(u32 msr, u64 val) - vmce->mcg_status = val; - mce_printk(MCE_VERBOSE, "MCE: wrmsr MCG_STATUS %"PRIx64"\n", val); - /* For HVM guest, this is the point for deleting vMCE injection node */ -- if ( d->is_hvm && (vmce->nr_injection > 0) ) -+ if ( is_hvm_vcpu(cur) && (vmce->nr_injection > 0) ) - { - vmce->nr_injection--; /* Should be 0 */ - if ( !list_empty(&vmce->impact_header) ) -@@ -293,7 +312,7 @@ int vmce_wrmsr(u32 msr, u64 val) - ret = -1; - break; - default: -- ret = mce_bank_msr(msr) ? bank_mce_wrmsr(d, msr, val) : 0; -+ ret = mce_bank_msr(cur, msr) ? bank_mce_wrmsr(cur, msr, val) : 0; - break; - } - -@@ -301,6 +320,46 @@ int vmce_wrmsr(u32 msr, u64 val) - return ret; - } - -+static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h) -+{ -+ struct vcpu *v; -+ int err = 0; -+ -+ for_each_vcpu( d, v ) { -+ struct hvm_vmce_vcpu ctxt = { -+ .caps = v->arch.mcg_cap -+ }; -+ -+ err = hvm_save_entry(VMCE_VCPU, v->vcpu_id, h, &ctxt); -+ if ( err ) -+ break; -+ } -+ -+ return err; -+} -+ -+static int vmce_load_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h) -+{ -+ unsigned int vcpuid = hvm_load_instance(h); -+ struct vcpu *v; -+ struct hvm_vmce_vcpu ctxt; -+ int err; -+ -+ if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL ) -+ { -+ dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n", -+ d->domain_id, vcpuid); -+ err = -EINVAL; -+ } -+ else -+ err = hvm_load_entry(VMCE_VCPU, h, &ctxt); -+ -+ return err ?: vmce_restore_vcpu(v, ctxt.caps); -+} -+ -+HVM_REGISTER_SAVE_RESTORE(VMCE_VCPU, vmce_save_vcpu_ctxt, -+ vmce_load_vcpu_ctxt, 1, HVMSR_PER_VCPU); -+ - int inject_vmce(struct domain *d) - { - int cpu = smp_processor_id(); -Index: xen-4.1.3-testing/xen/arch/x86/domain.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/domain.c -+++ xen-4.1.3-testing/xen/arch/x86/domain.c -@@ -376,6 +376,8 @@ int vcpu_initialise(struct vcpu *v) - if ( (rc = xsave_alloc_save_area(v)) != 0 ) - return rc; - -+ vmce_init_vcpu(v); -+ - if ( is_hvm_domain(d) ) - { - if ( (rc = hvm_vcpu_initialise(v)) != 0 ) -Index: xen-4.1.3-testing/xen/arch/x86/domctl.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/domctl.c -+++ xen-4.1.3-testing/xen/arch/x86/domctl.c -@@ -1140,11 +1140,12 @@ long arch_do_domctl( - evc->syscall32_callback_eip = 0; - evc->syscall32_disables_events = 0; - #endif -+ evc->mcg_cap = v->arch.mcg_cap; - } - else - { - ret = -EINVAL; -- if ( evc->size != sizeof(*evc) ) -+ if ( evc->size < offsetof(typeof(*evc), mcg_cap) ) - goto ext_vcpucontext_out; - #ifdef __x86_64__ - fixup_guest_code_selector(d, evc->sysenter_callback_cs); -@@ -1163,6 +1164,9 @@ long arch_do_domctl( - evc->syscall32_callback_eip ) - goto ext_vcpucontext_out; - #endif -+ if ( evc->size >= offsetof(typeof(*evc), mcg_cap) + -+ sizeof(evc->mcg_cap) ) -+ ret = vmce_restore_vcpu(v, evc->mcg_cap); - } - - ret = 0; -Index: xen-4.1.3-testing/xen/include/asm-x86/domain.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/domain.h -+++ xen-4.1.3-testing/xen/include/asm-x86/domain.h -@@ -429,6 +429,8 @@ struct arch_vcpu - */ - uint64_t xcr0_accum; - -+ uint64_t mcg_cap; -+ - /* Current LDT details. */ - unsigned long shadow_ldt_mapcnt; - spinlock_t shadow_ldt_lock; -Index: xen-4.1.3-testing/xen/include/asm-x86/mce.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/mce.h -+++ xen-4.1.3-testing/xen/include/asm-x86/mce.h -@@ -16,7 +16,6 @@ struct bank_entry { - struct domain_mca_msrs - { - /* Guest should not change below values after DOM boot up */ -- uint64_t mcg_cap; - uint64_t mcg_ctl; - uint64_t mcg_status; - uint64_t *mci_ctl; -@@ -28,6 +27,8 @@ struct domain_mca_msrs - /* Guest vMCE MSRs virtualization */ - extern int vmce_init_msr(struct domain *d); - extern void vmce_destroy_msr(struct domain *d); -+extern void vmce_init_vcpu(struct vcpu *); -+extern int vmce_restore_vcpu(struct vcpu *, uint64_t caps); - extern int vmce_wrmsr(uint32_t msr, uint64_t val); - extern int vmce_rdmsr(uint32_t msr, uint64_t *val); - #endif -Index: xen-4.1.3-testing/xen/include/asm-x86/msr-index.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/msr-index.h -+++ xen-4.1.3-testing/xen/include/asm-x86/msr-index.h -@@ -101,48 +101,40 @@ - #define MSR_AMD64_MC0_MASK 0xc0010044 - - #define MSR_IA32_MC1_CTL 0x00000404 --#define MSR_IA32_MC1_CTL2 0x00000281 - #define MSR_IA32_MC1_STATUS 0x00000405 - #define MSR_IA32_MC1_ADDR 0x00000406 - #define MSR_IA32_MC1_MISC 0x00000407 - - #define MSR_IA32_MC2_CTL 0x00000408 --#define MSR_IA32_MC2_CTL2 0x00000282 - #define MSR_IA32_MC2_STATUS 0x00000409 - #define MSR_IA32_MC2_ADDR 0x0000040A - #define MSR_IA32_MC2_MISC 0x0000040B - --#define MSR_IA32_MC3_CTL2 0x00000283 - #define MSR_IA32_MC3_CTL 0x0000040C - #define MSR_IA32_MC3_STATUS 0x0000040D - #define MSR_IA32_MC3_ADDR 0x0000040E - #define MSR_IA32_MC3_MISC 0x0000040F - --#define MSR_IA32_MC4_CTL2 0x00000284 - #define MSR_IA32_MC4_CTL 0x00000410 - #define MSR_IA32_MC4_STATUS 0x00000411 - #define MSR_IA32_MC4_ADDR 0x00000412 - #define MSR_IA32_MC4_MISC 0x00000413 - --#define MSR_IA32_MC5_CTL2 0x00000285 - #define MSR_IA32_MC5_CTL 0x00000414 - #define MSR_IA32_MC5_STATUS 0x00000415 - #define MSR_IA32_MC5_ADDR 0x00000416 - #define MSR_IA32_MC5_MISC 0x00000417 - --#define MSR_IA32_MC6_CTL2 0x00000286 - #define MSR_IA32_MC6_CTL 0x00000418 - #define MSR_IA32_MC6_STATUS 0x00000419 - #define MSR_IA32_MC6_ADDR 0x0000041A - #define MSR_IA32_MC6_MISC 0x0000041B - --#define MSR_IA32_MC7_CTL2 0x00000287 - #define MSR_IA32_MC7_CTL 0x0000041C - #define MSR_IA32_MC7_STATUS 0x0000041D - #define MSR_IA32_MC7_ADDR 0x0000041E - #define MSR_IA32_MC7_MISC 0x0000041F - --#define MSR_IA32_MC8_CTL2 0x00000288 - #define MSR_IA32_MC8_CTL 0x00000420 - #define MSR_IA32_MC8_STATUS 0x00000421 - #define MSR_IA32_MC8_ADDR 0x00000422 -@@ -152,6 +144,7 @@ - #define MSR_IA32_MCx_STATUS(x) (MSR_IA32_MC0_STATUS + 4*(x)) - #define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4*(x)) - #define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4*(x)) -+#define MSR_IA32_MCx_CTL2(x) (MSR_IA32_MC0_CTL2 + (x)) - - #define MSR_AMD64_MCx_MASK(x) (MSR_AMD64_MC0_MASK + (x)) - -Index: xen-4.1.3-testing/xen/include/public/arch-x86/hvm/save.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/arch-x86/hvm/save.h -+++ xen-4.1.3-testing/xen/include/public/arch-x86/hvm/save.h -@@ -580,9 +580,15 @@ struct hvm_hw_cpu_xsave { - - #define CPU_XSAVE_CODE 16 - -+struct hvm_vmce_vcpu { -+ uint64_t caps; -+}; -+ -+DECLARE_HVM_SAVE_TYPE(VMCE_VCPU, 18, struct hvm_vmce_vcpu); -+ - /* - * Largest type-code in use - */ --#define HVM_SAVE_CODE_MAX 16 -+#define HVM_SAVE_CODE_MAX 18 - - #endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */ -Index: xen-4.1.3-testing/xen/include/public/domctl.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/domctl.h -+++ xen-4.1.3-testing/xen/include/public/domctl.h -@@ -558,7 +558,7 @@ struct xen_domctl_ext_vcpucontext { - uint32_t vcpu; - /* - * SET: Size of struct (IN) -- * GET: Size of struct (OUT) -+ * GET: Size of struct (OUT, up to 128 bytes) - */ - uint32_t size; - #if defined(__i386__) || defined(__x86_64__) -@@ -570,6 +570,7 @@ struct xen_domctl_ext_vcpucontext { - uint16_t sysenter_callback_cs; - uint8_t syscall32_disables_events; - uint8_t sysenter_disables_events; -+ uint64_aligned_t mcg_cap; - #endif - }; - typedef struct xen_domctl_ext_vcpucontext xen_domctl_ext_vcpucontext_t; diff --git a/25041-tapdisk2-create-init-name.patch b/25041-tapdisk2-create-init-name.patch deleted file mode 100644 index 6eb98f5..0000000 --- a/25041-tapdisk2-create-init-name.patch +++ /dev/null @@ -1,23 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1331725244 0 -# Node ID 20c8a7db63d160e95fcf5c8e2f9d31923d336316 -# Parent e8660d8cf4be332e53cf6e2765f21804e3bfe28e -tapdisk2: initialize 'name' parameter of BLKTAP2_IOCTL_CREATE_DEVICE - -This keeps the kernel driver from printing garbage. - -Signed-off-by: Jan Beulich -Acked-by: Ian Jackson -Committed-by: Ian Jackson - ---- a/tools/blktap2/drivers/tapdisk-control.c -+++ b/tools/blktap2/drivers/tapdisk-control.c -@@ -462,6 +462,7 @@ tapdisk_control_open_image(struct tapdis - - params.capacity = image.size; - params.sector_size = image.secsize; -+ strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN); - - err = ioctl(vbd->ring.fd, BLKTAP2_IOCTL_CREATE_DEVICE, ¶ms); - if (err && errno != EEXIST) { diff --git a/25196-x86-HAP-PAT-sr.patch b/25196-x86-HAP-PAT-sr.patch deleted file mode 100644 index 55ea4be..0000000 --- a/25196-x86-HAP-PAT-sr.patch +++ /dev/null @@ -1,236 +0,0 @@ -# HG changeset patch -# User Gianluca Guida -# Date 1334647766 -3600 -# Node ID 375fa55c7a6c88273bdd1f7f1105e5154da4eeba -# Parent a06e6cdeafe34964721df3ddb32774d4634fd7ad -Fix save/restore of guest PAT table in HAP paging mode. - -HAP paging mode guests use direct MSR read/write into the VMCS/VMCB -for the guest PAT table, while the current save/restore code was -accessing only the pat_cr field in hvm_vcpu, used when intercepting -the MSR mostly in shadow mode (the Intel scenario is a bit more -complicated). This patch fixes this issue creating a new couple of -hvm_funcs, get/set_guest_pat, that access the right PAT table based on -the paging mode and guest configuration. - -Signed-off-by: Gianluca Guida -Acked-by: Tim Deegan -Committed-by: Keir Fraser - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -217,6 +217,31 @@ void hvm_set_rdtsc_exiting(struct domain - hvm_funcs.set_rdtsc_exiting(v, enable); - } - -+void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat) -+{ -+ if ( !hvm_funcs.get_guest_pat(v, guest_pat) ) -+ *guest_pat = v->arch.hvm_vcpu.pat_cr; -+} -+ -+int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat) -+{ -+ int i; -+ uint8_t *value = (uint8_t *)&guest_pat; -+ -+ for ( i = 0; i < 8; i++ ) -+ if ( unlikely(!(value[i] == 0 || value[i] == 1 || -+ value[i] == 4 || value[i] == 5 || -+ value[i] == 6 || value[i] == 7)) ) { -+ HVM_DBG_LOG(DBG_LEVEL_MSR, "invalid guest PAT: %"PRIx64"\n", -+ guest_pat); -+ return 0; -+ } -+ -+ if ( !hvm_funcs.set_guest_pat(v, guest_pat) ) -+ v->arch.hvm_vcpu.pat_cr = guest_pat; -+ return 1; -+} -+ - void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc) - { - uint64_t tsc; -@@ -2491,7 +2516,7 @@ int hvm_msr_read_intercept(unsigned int - break; - - case MSR_IA32_CR_PAT: -- *msr_content = v->arch.hvm_vcpu.pat_cr; -+ hvm_get_guest_pat(v, msr_content); - break; - - case MSR_MTRRcap: -@@ -2607,7 +2632,7 @@ int hvm_msr_write_intercept(unsigned int - break; - - case MSR_IA32_CR_PAT: -- if ( !pat_msr_set(&v->arch.hvm_vcpu.pat_cr, msr_content) ) -+ if ( !hvm_set_guest_pat(v, msr_content) ) - goto gp_fault; - break; - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/mtrr.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/mtrr.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/mtrr.c -@@ -406,26 +406,6 @@ uint32_t get_pat_flags(struct vcpu *v, - return pat_type_2_pte_flags(pat_entry_value); - } - --/* Helper funtions for seting mtrr/pat */ --bool_t pat_msr_set(uint64_t *pat, uint64_t msr_content) --{ -- uint8_t *value = (uint8_t*)&msr_content; -- int32_t i; -- -- if ( *pat != msr_content ) -- { -- for ( i = 0; i < 8; i++ ) -- if ( unlikely(!(value[i] == 0 || value[i] == 1 || -- value[i] == 4 || value[i] == 5 || -- value[i] == 6 || value[i] == 7)) ) -- return 0; -- -- *pat = msr_content; -- } -- -- return 1; --} -- - bool_t mtrr_def_type_msr_set(struct mtrr_state *m, uint64_t msr_content) - { - uint8_t def_type = msr_content & 0xff; -@@ -636,7 +616,7 @@ static int hvm_save_mtrr_msr(struct doma - { - mtrr_state = &v->arch.hvm_vcpu.mtrr; - -- hw_mtrr.msr_pat_cr = v->arch.hvm_vcpu.pat_cr; -+ hvm_get_guest_pat(v, &hw_mtrr.msr_pat_cr); - - hw_mtrr.msr_mtrr_def_type = mtrr_state->def_type - | (mtrr_state->enabled << 10); -@@ -681,7 +661,7 @@ static int hvm_load_mtrr_msr(struct doma - - mtrr_state = &v->arch.hvm_vcpu.mtrr; - -- pat_msr_set(&v->arch.hvm_vcpu.pat_cr, hw_mtrr.msr_pat_cr); -+ hvm_set_guest_pat(v, hw_mtrr.msr_pat_cr); - - mtrr_state->mtrr_cap = hw_mtrr.msr_mtrr_cap; - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/svm/svm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/svm/svm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/svm/svm.c -@@ -585,6 +585,28 @@ static void svm_set_segment_register(str - svm_vmload(vmcb); - } - -+static int svm_set_guest_pat(struct vcpu *v, u64 gpat) -+{ -+ struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; -+ -+ if ( !paging_mode_hap(v->domain) ) -+ return 0; -+ -+ vmcb_set_g_pat(vmcb, gpat); -+ return 1; -+} -+ -+static int svm_get_guest_pat(struct vcpu *v, u64 *gpat) -+{ -+ struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; -+ -+ if ( !paging_mode_hap(v->domain) ) -+ return 0; -+ -+ *gpat = vmcb_get_g_pat(vmcb); -+ return 1; -+} -+ - static void svm_set_tsc_offset(struct vcpu *v, u64 offset) - { - struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; -@@ -1519,6 +1541,8 @@ static struct hvm_function_table __read_ - .update_host_cr3 = svm_update_host_cr3, - .update_guest_cr = svm_update_guest_cr, - .update_guest_efer = svm_update_guest_efer, -+ .set_guest_pat = svm_set_guest_pat, -+ .get_guest_pat = svm_get_guest_pat, - .set_tsc_offset = svm_set_tsc_offset, - .inject_exception = svm_inject_exception, - .init_hypercall_page = svm_init_hypercall_page, -Index: xen-4.1.3-testing/xen/arch/x86/hvm/vmx/vmx.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/vmx/vmx.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/vmx/vmx.c -@@ -921,6 +921,34 @@ static void vmx_set_segment_register(str - vmx_vmcs_exit(v); - } - -+static int vmx_set_guest_pat(struct vcpu *v, u64 gpat) -+{ -+ if ( !cpu_has_vmx_pat || !paging_mode_hap(v->domain) ) -+ return 0; -+ -+ vmx_vmcs_enter(v); -+ __vmwrite(GUEST_PAT, gpat); -+#ifdef __i386__ -+ __vmwrite(GUEST_PAT_HIGH, gpat >> 32); -+#endif -+ vmx_vmcs_exit(v); -+ return 1; -+} -+ -+static int vmx_get_guest_pat(struct vcpu *v, u64 *gpat) -+{ -+ if ( !cpu_has_vmx_pat || !paging_mode_hap(v->domain) ) -+ return 0; -+ -+ vmx_vmcs_enter(v); -+ *gpat = __vmread(GUEST_PAT); -+#ifdef __i386__ -+ *gpat |= (u64)__vmread(GUEST_PAT_HIGH) << 32; -+#endif -+ vmx_vmcs_exit(v); -+ return 1; -+} -+ - static void vmx_set_tsc_offset(struct vcpu *v, u64 offset) - { - vmx_vmcs_enter(v); -@@ -1384,6 +1412,8 @@ static struct hvm_function_table __read_ - .update_host_cr3 = vmx_update_host_cr3, - .update_guest_cr = vmx_update_guest_cr, - .update_guest_efer = vmx_update_guest_efer, -+ .set_guest_pat = vmx_set_guest_pat, -+ .get_guest_pat = vmx_get_guest_pat, - .set_tsc_offset = vmx_set_tsc_offset, - .inject_exception = vmx_inject_exception, - .init_hypercall_page = vmx_init_hypercall_page, -Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/hvm.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/hvm.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hvm/hvm.h -@@ -116,6 +116,9 @@ struct hvm_function_table { - void (*update_guest_cr)(struct vcpu *v, unsigned int cr); - void (*update_guest_efer)(struct vcpu *v); - -+ int (*get_guest_pat)(struct vcpu *v, u64 *); -+ int (*set_guest_pat)(struct vcpu *v, u64); -+ - void (*set_tsc_offset)(struct vcpu *v, u64 offset); - - void (*inject_exception)(unsigned int trapnr, int errcode, -@@ -166,6 +169,9 @@ void hvm_vcpu_reset_state(struct vcpu *v - - bool_t hvm_send_assist_req(struct vcpu *v); - -+void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat); -+int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat); -+ - void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc); - u64 hvm_get_guest_tsc(struct vcpu *v); - diff --git a/25247-SVM-no-rdtsc-intercept.patch b/25247-SVM-no-rdtsc-intercept.patch deleted file mode 100644 index 60f6325..0000000 --- a/25247-SVM-no-rdtsc-intercept.patch +++ /dev/null @@ -1,39 +0,0 @@ -# HG changeset patch -# User Boris Ostrovsky -# Date 1335358394 -3600 -# Node ID ed9c557f8a35a6deb7e6df0679f24a2121fd1172 -# Parent 7ba11d9b1d23633b5c42fadddad17b6dcb686141 -svm: Do not intercept RDTSC(P) when TSC scaling is supported by hardware - -When running in TSC_MODE_ALWAYS_EMULATE mode on processors that -support TSC scaling we don't need to intercept RDTSC/RDTSCP -instructions. - -Signed-off-by: Boris Ostrovsky -Acked-by: Wei Huang -Tested-by: Wei Huang -Committed-by: Keir Fraser - ---- a/xen/arch/x86/hvm/svm/svm.c -+++ b/xen/arch/x86/hvm/svm/svm.c -@@ -633,12 +633,19 @@ static void svm_set_rdtsc_exiting(struct - { - struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; - u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb); -+ u32 general2_intercepts = vmcb_get_general2_intercepts(vmcb); - - general1_intercepts &= ~GENERAL1_INTERCEPT_RDTSC; -- if ( enable ) -+ general2_intercepts &= ~GENERAL2_INTERCEPT_RDTSCP; -+ -+ if ( enable && !cpu_has_tsc_ratio ) -+ { - general1_intercepts |= GENERAL1_INTERCEPT_RDTSC; -+ general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP; -+ } - - vmcb_set_general1_intercepts(vmcb, general1_intercepts); -+ vmcb_set_general2_intercepts(vmcb, general2_intercepts); - } - - static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf) diff --git a/25267-x86-text-unlikely.patch b/25267-x86-text-unlikely.patch deleted file mode 100644 index 2da309c..0000000 --- a/25267-x86-text-unlikely.patch +++ /dev/null @@ -1,24 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1336476796 -7200 -# Node ID f3fd3136f7a04b8d4e9a6ef1e6787810bae198e9 -# Parent 8f1e0cc4a507a52a49a2eb7832a57ecc7e032dce -x86: merge .text.* into .text while linking - -For xen.efi, this eliminates a pointless gap between .text and -.text.unlikely of almost 2Mb size. - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/xen.lds.S -+++ b/xen/arch/x86/xen.lds.S -@@ -47,6 +47,8 @@ SECTIONS - .text : { - _stext = .; /* Text and read-only data */ - *(.text) -+ *(.text.cold) -+ *(.text.unlikely) - *(.fixup) - *(.gnu.warning) - _etext = .; /* End of text section */ diff --git a/25269-x86-vMCE-addr-misc-write.patch b/25269-x86-vMCE-addr-misc-write.patch deleted file mode 100644 index 3ee7aee..0000000 --- a/25269-x86-vMCE-addr-misc-write.patch +++ /dev/null @@ -1,101 +0,0 @@ -# HG changeset patch -# User Liu, Jinsong -# Date 1336476984 -7200 -# Node ID 8a86d841e6d42fbffc9e20d3028875dd4990882d -# Parent ea7c9cabd7ad9ccbdf0c2d1a71e479b69d24ea5b -fix vmce MCi_ADDR/MCi_MISC wrmsr bug - -This patch fixes a bug related to wrmsr vmce MCi_ADDR/MCi_MISC -registers, since they are not read-only. - -Intel SDM recommanded os mce driver clear MCi_ADDR/MCi_MISC, so guest -MCE driver may clear MCi_ADDR/MCi_MISC registers. In such case, old -vmce wrmsr logic would generate a #GP fault in guest MCE context, -causing the guest to crash. - -When wrmsr MCi_ADDR/MCi_MISC, writing all 1s will cause #GP. - -Signed-off-by: Liu, Jinsong -Signed-off-by: Jan Beulich -Committed-by: Jan Beulich - ---- a/xen/arch/x86/cpu/mcheck/vmce.c -+++ b/xen/arch/x86/cpu/mcheck/vmce.c -@@ -209,6 +209,14 @@ static int bank_mce_wrmsr(struct vcpu *v - struct domain_mca_msrs *vmce = dom_vmce(v->domain); - struct bank_entry *entry = NULL; - -+ /* Give the first entry of the list, it corresponds to current -+ * vMCE# injection. When vMCE# is finished processing by the -+ * the guest, this node will be deleted. -+ * Only error bank is written. Non-error banks simply return. -+ */ -+ if ( !list_empty(&vmce->impact_header) ) -+ entry = list_entry(vmce->impact_header.next, struct bank_entry, list); -+ - switch ( msr & (MSR_IA32_MC0_CTL | 3) ) - { - case MSR_IA32_MC0_CTL: -@@ -216,17 +224,9 @@ static int bank_mce_wrmsr(struct vcpu *v - vmce->mci_ctl[bank] = val; - break; - case MSR_IA32_MC0_STATUS: -- /* Give the first entry of the list, it corresponds to current -- * vMCE# injection. When vMCE# is finished processing by the -- * the guest, this node will be deleted. -- * Only error bank is written. Non-error banks simply return. -- */ -- if ( !list_empty(&vmce->impact_header) ) -+ if ( entry && (entry->bank == bank) ) - { -- entry = list_entry(vmce->impact_header.next, -- struct bank_entry, list); -- if ( entry->bank == bank ) -- entry->mci_status = val; -+ entry->mci_status = val; - mce_printk(MCE_VERBOSE, - "MCE: wr MC%u_STATUS %"PRIx64" in vMCE#\n", - bank, val); -@@ -236,12 +236,38 @@ static int bank_mce_wrmsr(struct vcpu *v - "MCE: wr MC%u_STATUS %"PRIx64"\n", bank, val); - break; - case MSR_IA32_MC0_ADDR: -- mce_printk(MCE_QUIET, "MCE: MC%u_ADDR is read-only\n", bank); -- ret = -1; -+ if ( !~val ) -+ { -+ mce_printk(MCE_QUIET, -+ "MCE: wr MC%u_ADDR with all 1s will cause #GP\n", bank); -+ ret = -1; -+ } -+ else if ( entry && (entry->bank == bank) ) -+ { -+ entry->mci_addr = val; -+ mce_printk(MCE_VERBOSE, -+ "MCE: wr MC%u_ADDR %"PRIx64" in vMCE#\n", bank, val); -+ } -+ else -+ mce_printk(MCE_VERBOSE, -+ "MCE: wr MC%u_ADDR %"PRIx64"\n", bank, val); - break; - case MSR_IA32_MC0_MISC: -- mce_printk(MCE_QUIET, "MCE: MC%u_MISC is read-only\n", bank); -- ret = -1; -+ if ( !~val ) -+ { -+ mce_printk(MCE_QUIET, -+ "MCE: wr MC%u_MISC with all 1s will cause #GP\n", bank); -+ ret = -1; -+ } -+ else if ( entry && (entry->bank == bank) ) -+ { -+ entry->mci_misc = val; -+ mce_printk(MCE_VERBOSE, -+ "MCE: wr MC%u_MISC %"PRIx64" in vMCE#\n", bank, val); -+ } -+ else -+ mce_printk(MCE_VERBOSE, -+ "MCE: wr MC%u_MISC %"PRIx64"\n", bank, val); - break; - default: - switch ( boot_cpu_data.x86_vendor ) diff --git a/25382-x86-masked-MCE-masking-NMI.patch b/25382-x86-masked-MCE-masking-NMI.patch deleted file mode 100644 index 4cd8260..0000000 --- a/25382-x86-masked-MCE-masking-NMI.patch +++ /dev/null @@ -1,73 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1337697011 -7200 -# Node ID 6dc80df50fa8a01da0494a6413d70573aeeef7a2 -# Parent d718706de1f0667c4a4ee137b9ba18e5c7d9817c -x86: don't hold off NMI delivery when MCE is masked - -Likely through copy'n'paste, all three instances of guest MCE -processing jumped to the wrong place (where NMI processing code -correctly jumps to) when MCE-s are temporarily masked (due to one -currently being processed by the guest). A nested, unmasked NMI should -get delivered immediately, however. - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/x86_32/entry.S -+++ b/xen/arch/x86/x86_32/entry.S -@@ -215,6 +215,7 @@ test_all_events: - jnz process_softirqs - testb $1,VCPU_mce_pending(%ebx) - jnz process_mce -+.Ltest_guest_nmi: - testb $1,VCPU_nmi_pending(%ebx) - jnz process_nmi - test_guest_events: -@@ -244,7 +245,7 @@ process_softirqs: - /* %ebx: struct vcpu */ - process_mce: - testb $1 << VCPU_TRAP_MCE,VCPU_async_exception_mask(%ebx) -- jnz test_guest_events -+ jnz .Ltest_guest_nmi - sti - movb $0,VCPU_mce_pending(%ebx) - call set_guest_machinecheck_trapbounce ---- a/xen/arch/x86/x86_64/compat/entry.S -+++ b/xen/arch/x86/x86_64/compat/entry.S -@@ -104,6 +104,7 @@ ENTRY(compat_test_all_events) - jnz compat_process_softirqs - testb $1,VCPU_mce_pending(%rbx) - jnz compat_process_mce -+.Lcompat_test_guest_nmi: - testb $1,VCPU_nmi_pending(%rbx) - jnz compat_process_nmi - compat_test_guest_events: -@@ -134,7 +135,7 @@ compat_process_softirqs: - /* %rbx: struct vcpu */ - compat_process_mce: - testb $1 << VCPU_TRAP_MCE,VCPU_async_exception_mask(%rbx) -- jnz compat_test_guest_events -+ jnz .Lcompat_test_guest_nmi - sti - movb $0,VCPU_mce_pending(%rbx) - call set_guest_machinecheck_trapbounce ---- a/xen/arch/x86/x86_64/entry.S -+++ b/xen/arch/x86/x86_64/entry.S -@@ -204,6 +204,7 @@ test_all_events: - jnz process_softirqs - testb $1,VCPU_mce_pending(%rbx) - jnz process_mce -+.Ltest_guest_nmi: - testb $1,VCPU_nmi_pending(%rbx) - jnz process_nmi - test_guest_events: -@@ -232,7 +233,7 @@ process_softirqs: - /* %rbx: struct vcpu */ - process_mce: - testb $1 << VCPU_TRAP_MCE,VCPU_async_exception_mask(%rbx) -- jnz test_guest_events -+ jnz .Ltest_guest_nmi - sti - movb $0,VCPU_mce_pending(%rbx) - call set_guest_machinecheck_trapbounce diff --git a/25387-amd-iommu-workaround-73x.patch b/25387-amd-iommu-workaround-73x.patch deleted file mode 100644 index e4e9ad2..0000000 --- a/25387-amd-iommu-workaround-73x.patch +++ /dev/null @@ -1,79 +0,0 @@ -# HG changeset patch -# User Wei Wang -# Date 1337786286 -7200 -# Node ID af559b5afbecba1048ad690347455ad54098f935 -# Parent 340062faf2988eeea94e37dbb3943c5a449bff10 -amd iommu: Add workaround for erratum 732 & 733 - -Signed-off-by: Wei Wang - -Add missing barriers. Fix early return from parse_ppr_log_entry(). -Slightly adjust comments. Strip trailing blanks. - -Signed-off-by: Jan Beulich -Committed-by: Jan Beulich - ---- a/xen/drivers/passthrough/amd/iommu_init.c -+++ b/xen/drivers/passthrough/amd/iommu_init.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - static struct amd_iommu **irq_to_iommu; - static int nr_amd_iommus; -@@ -467,6 +468,7 @@ static void parse_event_log_entry(u32 en - u16 domain_id, device_id, bdf, cword; - u32 code; - u64 *addr; -+ int count = 0; - char * event_str[] = {"ILLEGAL_DEV_TABLE_ENTRY", - "IO_PAGE_FAULT", - "DEV_TABLE_HW_ERROR", -@@ -479,6 +481,25 @@ static void parse_event_log_entry(u32 en - code = get_field_from_reg_u32(entry[1], IOMMU_EVENT_CODE_MASK, - IOMMU_EVENT_CODE_SHIFT); - -+ /* -+ * Workaround for erratum 732: -+ * It can happen that the tail pointer is updated before the actual entry -+ * got written. As suggested by RevGuide, we initialize the event log -+ * buffer to all zeros and clear event log entries after processing them. -+ */ -+ while ( code == 0 ) -+ { -+ if ( unlikely(++count == IOMMU_LOG_ENTRY_TIMEOUT) ) -+ { -+ AMD_IOMMU_DEBUG("AMD-Vi: No event written to log\n"); -+ return; -+ } -+ udelay(1); -+ rmb(); -+ code = get_field_from_reg_u32(entry[1], IOMMU_EVENT_CODE_MASK, -+ IOMMU_EVENT_CODE_SHIFT); -+ } -+ - if ( (code > IOMMU_EVENT_INVALID_DEV_REQUEST) || - (code < IOMMU_EVENT_ILLEGAL_DEV_TABLE_ENTRY) ) - { -@@ -517,6 +538,8 @@ static void parse_event_log_entry(u32 en - AMD_IOMMU_DEBUG("event 0x%08x 0x%08x 0x%08x 0x%08x\n", entry[0], - entry[1], entry[2], entry[3]); - } -+ -+ memset(entry, 0, IOMMU_EVENT_LOG_ENTRY_SIZE); - } - - static void do_amd_iommu_irq(unsigned long data) ---- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h -+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h -@@ -269,6 +269,8 @@ - #define IOMMU_EVENT_DEVICE_ID_MASK 0x0000FFFF - #define IOMMU_EVENT_DEVICE_ID_SHIFT 0 - -+#define IOMMU_LOG_ENTRY_TIMEOUT 1000 -+ - /* Control Register */ - #define IOMMU_CONTROL_MMIO_OFFSET 0x18 - #define IOMMU_CONTROL_TRANSLATION_ENABLE_MASK 0x00000001 diff --git a/25430-x86-AMD-Fam15-reenable-topoext.patch b/25430-x86-AMD-Fam15-reenable-topoext.patch deleted file mode 100644 index a4138be..0000000 --- a/25430-x86-AMD-Fam15-reenable-topoext.patch +++ /dev/null @@ -1,48 +0,0 @@ -# HG changeset patch -# User Andreas Herrmann -# Date 1338452142 -7200 -# Node ID d7ae665b03afb88a813c6f197612215697eaf8f6 -# Parent a120d24f90fb5e94244331e530aacf5b0ea86f25 -x86/amd: re-enable CPU topology extensions in case BIOS has disabled it - -BIOS will switch off the corresponding feature flag on family -15h models 10h-1fh non-desktop CPUs. - -The topology extension CPUID leafs are required to detect which -cores belong to the same compute unit. (thread siblings mask is -set accordingly and also correct information about L1i and L2 -cache sharing depends on this). - -W/o this patch we wouldn't see which cores belong to the same -compute unit and also cache sharing information for L1i and L2 -would be incorrect on such systems. - -Signed-off-by: Andreas Herrmann -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser -Committed-by: Jan Beulich - ---- a/xen/arch/x86/cpu/amd.c -+++ b/xen/arch/x86/cpu/amd.c -@@ -612,6 +612,21 @@ static void __devinit init_amd(struct cp - } - } - -+ /* re-enable TopologyExtensions if switched off by BIOS */ -+ if ((c->x86 == 0x15) && -+ (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) && -+ !cpu_has(c, X86_FEATURE_TOPOEXT) && -+ !rdmsr_safe(MSR_K8_EXT_FEATURE_MASK, value)) { -+ value |= 1ULL << 54; -+ wrmsr_safe(MSR_K8_EXT_FEATURE_MASK, value); -+ rdmsrl(MSR_K8_EXT_FEATURE_MASK, value); -+ if (value & (1ULL << 54)) { -+ set_bit(X86_FEATURE_TOPOEXT, c->x86_capability); -+ printk(KERN_INFO "CPU: Re-enabling disabled " -+ "Topology Extensions Support\n"); -+ } -+ } -+ - amd_get_topology(c); - - /* Pointless to use MWAIT on Family10 as it does not deep sleep. */ diff --git a/25431-x86-EDD-MBR-sig-check.patch b/25431-x86-EDD-MBR-sig-check.patch deleted file mode 100644 index 8120e06..0000000 --- a/25431-x86-EDD-MBR-sig-check.patch +++ /dev/null @@ -1,30 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1338452293 -7200 -# Node ID cdced279e79296f06ede71d92f5047235e4b6d55 -# Parent d7ae665b03afb88a813c6f197612215697eaf8f6 -x86/EDD: check MBR for BIOS magic before considering signature valid - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/boot/edd.S -+++ b/xen/arch/x86/boot/edd.S -@@ -53,12 +53,16 @@ edd_mbr_sig_read: - jc edd_mbr_sig_done # on failure, we're done. - cmpb $0, %ah # some BIOSes do not set CF - jne edd_mbr_sig_done # on failure, we're done. -+ cmpw $0xaa55, bootsym(boot_edd_info)+0x1fe -+ jne .Ledd_mbr_sig_next - movl bootsym(boot_edd_info)+EDD_MBR_SIG_OFFSET,%eax - movb %dl, (%bx) # store BIOS drive number - movl %eax, 4(%bx) # store signature from MBR - incb bootsym(boot_mbr_signature_nr) # note that we stored something -- incb %dl # increment to next device - addw $8, %bx # increment sig buffer ptr -+.Ledd_mbr_sig_next: -+ incb %dl # increment to next device -+ jz edd_mbr_sig_done - cmpb $EDD_MBR_SIG_MAX,bootsym(boot_mbr_signature_nr) - jb edd_mbr_sig_read - edd_mbr_sig_done: diff --git a/25459-page-list-splice.patch b/25459-page-list-splice.patch deleted file mode 100644 index 17716e9..0000000 --- a/25459-page-list-splice.patch +++ /dev/null @@ -1,33 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1338997025 -3600 -# Node ID f6bfaf9daa508c31b2bca0e461202db2759426fc -# Parent 8ec2c428f4dad55cf6d91b893a19c2218972db5e -xen: fix page_list_splice() - -Other than in __list_splice(), the first element's prev pointer -doesn't need adjustment here - it already is PAGE_LIST_NULL. Rather -than fixing the assignment (to formally match __list_splice()), simply -assert that this assignment is really unnecessary. - -Reported-by: Jisoo Yang -Signed-off-by: Jan Beulich - -Also assert that the prev pointers are both PAGE_LIST_NULL. - -Signed-off-by: Keir Fraser - -Committed-by: Keir Fraser - ---- a/xen/include/xen/mm.h -+++ b/xen/include/xen/mm.h -@@ -268,7 +268,8 @@ page_list_splice(struct page_list_head * - last = list->tail; - at = head->next; - -- first->list.prev = page_to_pdx(head->next); -+ ASSERT(first->list.prev == PAGE_LIST_NULL); -+ ASSERT(first->list.prev == at->list.prev); - head->next = first; - - last->list.next = page_to_pdx(at); diff --git a/25479-x86-boot-trampoline-remove.patch b/25479-x86-boot-trampoline-remove.patch deleted file mode 100644 index 76fff01..0000000 --- a/25479-x86-boot-trampoline-remove.patch +++ /dev/null @@ -1,463 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1313744093 -3600 -# Node ID dd90b59cb11c60c48e174c899190e2967341fe32 -# Parent 29aeed4979a78f26519f5fde8a405f8438297ab9 -x86: trampoline cleanup - -To make future changes less error prone, and to slightly simplify a -possible future conversion to a relocatable trampoline even for the -multiboot path (pretty desirable given that we had to change the -trampoline base a number of times to escape collisions with firmware -placed data), -- remove final uses of bootsym_phys() from trampoline.S, allowing the - symbol to be undefined before including this file (to make sure no - new references get added) -- replace two easy to deal with uses of bootsym_phys() in head.S -- remove an easy to replace reference to BOOT_TRAMPOLINE - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Jan Beulich -# Date 1339424128 -3600 -# Node ID 61dfb3da56b0a3ac86f81f4a8770e11e1dbc2aa9 -# Parent 6d1a30dc47e8dfcb826ff14c833d694fd4e6afb2 -x86: get rid of BOOT_TRAMPOLINE - -We recently saw a machine that has the EBDA extending as low as -0x7c000, so that Xen fails to boot after relocating the trampoline. -To fix this, I removed BOOT_TRAMPOLINE and bootsym_phys completely. - -Here are the parts: - -1) the trampoline segment is set to 64k below the EBDA. head.S grows -the ability to relocate the trampoline segment - -2) reloc.c is made position-independent. It allocates data below the -trampoline, whose address is passed in _eax. - -3) cmdline.S is called before relocating, so all bootsym_phys there -become sym_phys. - -Signed-off-by: Paolo Bonzini - -jb: - fall back to low memory size (instead of segment 0x7c00) if EBDA - value is out of range - - also add upper limit check on EBDA value - - fix and simplify inline assembly operands in reloc_mbi_struct() - - use lret instead of retf - - renamed early_stack to wakeup_stack, defined and used now only - in wakeup.S - - aligned reloc.bin's end of .text to 16 bytes, so that checking - __bss_start == end works reliably - -Signed-off-by: Jan Beulich - -Committed-by: Keir Fraser - ---- a/xen/arch/x86/boot/Makefile -+++ b/xen/arch/x86/boot/Makefile -@@ -2,8 +2,7 @@ obj-y += head.o - - head.o: reloc.S - --BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\{1\,\}BOOT_TRAMPOLINE[[:space:]]\{1\,\},,p' head.S) - %.S: %.c -- RELOC=$(BOOT_TRAMPOLINE) $(MAKE) -f build32.mk $@ -+ $(MAKE) -f build32.mk $@ - - reloc.S: head.S ---- a/xen/arch/x86/boot/build32.mk -+++ b/xen/arch/x86/boot/build32.mk -@@ -15,9 +15,10 @@ CFLAGS += -Werror -fno-builtin -msoft-fl - $(OBJCOPY) -O binary $< $@ - - %.lnk: %.o -- $(LD) $(LDFLAGS_DIRECT) -N -Ttext $(RELOC) -o $@ $< -+ $(LD) $(LDFLAGS_DIRECT) -N -Ttext 0 -o $@ $< - - %.o: %.c -- $(CC) $(CFLAGS) -c $< -o $@ -+ $(CC) $(CFLAGS) -c -fpic $< -o $@ - - reloc.o: $(BASEDIR)/include/asm-x86/config.h -+.PRECIOUS: %.bin %.lnk ---- a/xen/arch/x86/boot/cmdline.S -+++ b/xen/arch/x86/boot/cmdline.S -@@ -164,13 +164,13 @@ cmdline_parse_early: - pushl MB_cmdline(%ebx) - call .Lfind_option - test %eax,%eax -- setnz bootsym_phys(skip_realmode) -+ setnz sym_phys(skip_realmode) - - /* Check for 'tboot=' command-line option. */ - movl $sym_phys(.Ltboot_opt),4(%esp) - call .Lfind_option - test %eax,%eax -- setnz bootsym_phys(skip_realmode) /* tboot= implies no-real-mode */ -+ setnz sym_phys(skip_realmode) /* tboot= implies no-real-mode */ - - .Lparse_edd: - /* Check for 'edd=' command-line option. */ -@@ -181,13 +181,13 @@ cmdline_parse_early: - cmpb $'=',3(%eax) - jne .Lparse_edid - add $4,%eax -- movb $2,bootsym_phys(opt_edd) /* opt_edd=2: edd=off */ -+ movb $2,sym_phys(opt_edd) /* opt_edd=2: edd=off */ - cmpw $0x666f,(%eax) /* 0x666f == "of" */ - je .Lparse_edid -- decb bootsym_phys(opt_edd) /* opt_edd=1: edd=skipmbr */ -+ decb sym_phys(opt_edd) /* opt_edd=1: edd=skipmbr */ - cmpw $0x6b73,(%eax) /* 0x6b73 == "sk" */ - je .Lparse_edid -- decb bootsym_phys(opt_edd) /* opt_edd=0: edd=on (default) */ -+ decb sym_phys(opt_edd) /* opt_edd=0: edd=on (default) */ - - .Lparse_edid: - /* Check for 'edid=' command-line option. */ -@@ -203,17 +203,17 @@ cmdline_parse_early: - pushl $sym_phys(.Ledid_force) - call .Lstr_prefix - add $8,%esp -- movb $2,bootsym_phys(opt_edid) /* opt_edid=2: edid=force */ -+ movb $2,sym_phys(opt_edid) /* opt_edid=2: edid=force */ - test %eax,%eax - jz .Lparse_vga - push %ebx - pushl $sym_phys(.Ledid_no) - call .Lstr_prefix - add $8,%esp -- decb bootsym_phys(opt_edid) /* opt_edid=1: edid=no */ -+ decb sym_phys(opt_edid) /* opt_edid=1: edid=no */ - test %eax,%eax - jz .Lparse_vga -- decb bootsym_phys(opt_edid) /* opt_edid=0: default */ -+ decb sym_phys(opt_edid) /* opt_edid=0: default */ - - .Lparse_vga: - /* Check for 'vga=' command-line option. */ -@@ -227,7 +227,7 @@ cmdline_parse_early: - add $4,%eax - - /* Found the 'vga=' option. Default option is to display vga menu. */ -- movw $ASK_VGA,bootsym_phys(boot_vid_mode) -+ movw $ASK_VGA,sym_phys(boot_vid_mode) - - /* Check for 'vga=text-80x. */ - mov %eax,%ebx -@@ -251,7 +251,7 @@ cmdline_parse_early: - cmp %ax,%bx - lodsw - jne 1b -- mov %ax,bootsym_phys(boot_vid_mode) -+ mov %ax,sym_phys(boot_vid_mode) - jmp .Lcmdline_exit - - .Lparse_vga_gfx: -@@ -270,7 +270,7 @@ cmdline_parse_early: - push %ebx - call .Latoi - pop %esi -- mov %ax,bootsym_phys(vesa_size)+0 -+ mov %ax,sym_phys(vesa_size)+0 - /* skip 'x' */ - lodsb - cmpb $'x',%al -@@ -279,7 +279,7 @@ cmdline_parse_early: - push %esi - call .Latoi - pop %esi -- mov %ax,bootsym_phys(vesa_size)+2 -+ mov %ax,sym_phys(vesa_size)+2 - /* skip 'x' */ - lodsb - cmpb $'x',%al -@@ -288,9 +288,9 @@ cmdline_parse_early: - push %esi - call .Latoi - pop %esi -- mov %ax,bootsym_phys(vesa_size)+4 -+ mov %ax,sym_phys(vesa_size)+4 - /* commit to vesa mode */ -- movw $VIDEO_VESA_BY_SIZE,bootsym_phys(boot_vid_mode) -+ movw $VIDEO_VESA_BY_SIZE,sym_phys(boot_vid_mode) - jmp .Lcmdline_exit - - .Lparse_vga_mode: -@@ -307,7 +307,7 @@ cmdline_parse_early: - push %ebx - call .Latoi - add $4,%esp -- mov %ax,bootsym_phys(boot_vid_mode) -+ mov %ax,sym_phys(boot_vid_mode) - jmp .Lcmdline_exit - - .Lparse_vga_current: -@@ -320,7 +320,7 @@ cmdline_parse_early: - jnz .Lcmdline_exit - - /* We have 'vga=current'. */ -- movw $VIDEO_CURRENT_MODE,bootsym_phys(boot_vid_mode) -+ movw $VIDEO_CURRENT_MODE,sym_phys(boot_vid_mode) - - .Lcmdline_exit: - popa ---- a/xen/arch/x86/boot/head.S -+++ b/xen/arch/x86/boot/head.S -@@ -9,9 +9,7 @@ - .text - .code32 - --#define BOOT_TRAMPOLINE 0x7c000 - #define sym_phys(sym) ((sym) - __XEN_VIRT_START) --#define bootsym_phys(sym) ((sym) - trampoline_start + BOOT_TRAMPOLINE) - - #define BOOT_CS32 0x0008 - #define BOOT_CS64 0x0010 -@@ -79,6 +77,23 @@ __start: - cmp $0x2BADB002,%eax - jne not_multiboot - -+ /* Set up trampoline segment 64k below EBDA */ -+ movzwl 0x40e,%eax /* EBDA segment */ -+ cmp $0xa000,%eax /* sanity check (high) */ -+ jae 0f -+ cmp $0x4000,%eax /* sanity check (low) */ -+ jae 1f -+0: -+ movzwl 0x413,%eax /* use base memory size on failure */ -+ shl $10-4,%eax -+1: -+ sub $0x1000,%eax -+ -+ /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */ -+ xor %al, %al -+ shl $4, %eax -+ mov %eax,sym_phys(trampoline_phys) -+ - /* Save the Multiboot info struct (after relocation) for later use. */ - mov $sym_phys(cpu0_stack)+1024,%esp - push %ebx -@@ -190,7 +205,7 @@ __start: - #endif - - /* Apply relocations to bootstrap trampoline. */ -- mov $BOOT_TRAMPOLINE,%edx -+ mov sym_phys(trampoline_phys),%edx - mov $sym_phys(__trampoline_rel_start),%edi - mov %edx,sym_phys(trampoline_phys) - 1: -@@ -200,17 +215,32 @@ __start: - cmp $sym_phys(__trampoline_rel_stop),%edi - jb 1b - -+ /* Patch in the trampoline segment. */ -+ shr $4,%edx -+ mov $sym_phys(__trampoline_seg_start),%edi -+1: -+ mov (%edi),%eax -+ mov %dx,(%edi,%eax) -+ add $4,%edi -+ cmp $sym_phys(__trampoline_seg_stop),%edi -+ jb 1b -+ -+ call cmdline_parse_early -+ -+ /* Switch to low-memory stack. */ -+ mov sym_phys(trampoline_phys),%edi -+ lea 0x10000(%edi),%esp -+ lea trampoline_boot_cpu_entry-trampoline_start(%edi),%eax -+ pushl $BOOT_CS32 -+ push %eax -+ - /* Copy bootstrap trampoline to low memory, below 1MB. */ - mov $sym_phys(trampoline_start),%esi -- mov $bootsym_phys(trampoline_start),%edi - mov $trampoline_end - trampoline_start,%ecx - rep movsb - -- mov $bootsym_phys(early_stack),%esp -- call cmdline_parse_early -- - /* Jump into the relocated trampoline. */ -- jmp $BOOT_CS32,$bootsym_phys(trampoline_boot_cpu_entry) -+ lret - - #include "cmdline.S" - ---- a/xen/arch/x86/boot/reloc.c -+++ b/xen/arch/x86/boot/reloc.c -@@ -10,42 +10,49 @@ - * Keir Fraser - */ - -+/* entered with %eax = BOOT_TRAMPOLINE */ - asm ( - " .text \n" - " .globl _start \n" - "_start: \n" -- " mov $_start,%edi \n" - " call 1f \n" -- "1: pop %esi \n" -- " sub $1b-_start,%esi \n" -- " mov $__bss_start-_start,%ecx \n" -- " rep movsb \n" -- " xor %eax,%eax \n" -- " mov $_end,%ecx \n" -- " sub %edi,%ecx \n" -- " rep stosb \n" -- " mov $reloc,%eax \n" -- " jmp *%eax \n" -+ "1: pop %ebx \n" -+ " mov %eax,alloc-1b(%ebx) \n" -+ " mov $_end,%ecx \n" /* check that BSS is empty! */ -+ " sub $__bss_start,%ecx \n" -+ " jz reloc \n" -+ "1: jmp 1b \n" -+ ); -+ -+/* This is our data. Because the code must be relocatable, no BSS is -+ * allowed. All data is accessed PC-relative with inline assembly. -+ */ -+asm ( -+ "alloc: \n" -+ " .long 0 \n" -+ " .subsection 1 \n" -+ " .p2align 4, 0xcc \n" -+ " .subsection 0 \n" - ); - - typedef unsigned int u32; - #include "../../../include/xen/multiboot.h" - --extern char _start[]; -- --static void *memcpy(void *dest, const void *src, unsigned int n) --{ -- char *s = (char *)src, *d = dest; -- while ( n-- ) -- *d++ = *s++; -- return dest; --} -- - static void *reloc_mbi_struct(void *old, unsigned int bytes) - { -- static void *alloc = &_start; -- alloc = (void *)(((unsigned long)alloc - bytes) & ~15ul); -- return memcpy(alloc, old, bytes); -+ void *new; -+ asm( -+ " call 1f \n" -+ "1: pop %%edx \n" -+ " mov alloc-1b(%%edx),%0 \n" -+ " sub %1,%0 \n" -+ " and $~15,%0 \n" -+ " mov %0,alloc-1b(%%edx) \n" -+ " mov %0,%%edi \n" -+ " rep movsb \n" -+ : "=&r" (new), "+c" (bytes), "+S" (old) -+ : : "edx", "edi"); -+ return new; - } - - static char *reloc_mbi_string(char *old) ---- a/xen/arch/x86/boot/trampoline.S -+++ b/xen/arch/x86/boot/trampoline.S -@@ -11,6 +11,13 @@ - .long 111b - (off) - .; \ - .popsection - -+#define bootsym_segrel(sym, off) \ -+ $0,$bootsym(sym); \ -+111:; \ -+ .pushsection .trampoline_seg, "a"; \ -+ .long 111b - (off) - .; \ -+ .popsection -+ - .globl trampoline_realmode_entry - trampoline_realmode_entry: - mov %cs,%ax -@@ -132,7 +139,7 @@ high_start: - - .code32 - trampoline_boot_cpu_entry: -- cmpb $0,bootsym_phys(skip_realmode) -+ cmpb $0,bootsym_rel(skip_realmode,5) - jnz .Lskip_realmode - - /* Load pseudo-real-mode segments. */ -@@ -151,14 +158,14 @@ trampoline_boot_cpu_entry: - 1: mov %eax,%cr0 # CR0.PE = 0 (leave protected mode) - - /* Load proper real-mode values into %cs, %ds, %es and %ss. */ -- ljmp $(BOOT_TRAMPOLINE>>4),$bootsym(1f) --1: mov $(BOOT_TRAMPOLINE>>4),%ax -+ ljmp bootsym_segrel(1f,2) -+1: mov %cs,%ax - mov %ax,%ds - mov %ax,%es - mov %ax,%ss - - /* Initialise stack pointer and IDT, and enable irqs. */ -- mov $bootsym(early_stack),%sp -+ xor %sp,%sp - lidt bootsym(rm_idt) - sti - -@@ -195,7 +202,7 @@ trampoline_boot_cpu_entry: - lmsw %ax # CR0.PE = 1 (enter protected mode) - - /* Load proper protected-mode values into all segment registers. */ -- ljmpl $BOOT_CS32,$bootsym_phys(1f) -+ ljmpl $BOOT_CS32,$bootsym_rel(1f,6) - .code32 - 1: mov $BOOT_DS,%eax - mov %eax,%ds -@@ -220,7 +227,3 @@ rm_idt: .word 256*4-1, 0, 0 - #include "edd.S" - #include "video.S" - #include "wakeup.S" -- -- .align 16 -- .fill PAGE_SIZE,1,0 --early_stack: ---- a/xen/arch/x86/boot/wakeup.S -+++ b/xen/arch/x86/boot/wakeup.S -@@ -11,7 +11,7 @@ ENTRY(wakeup_start) - movw %cs, %ax - movw %ax, %ds - movw %ax, %ss # A stack required for BIOS call -- movw $wakesym(early_stack), %sp -+ movw $wakesym(wakeup_stack), %sp - - pushl $0 # Kill dangerous flag early - popfl -@@ -101,7 +101,7 @@ real_magic: .long 0x12345678 - .globl video_mode, video_flags - video_mode: .long 0 - video_flags: .long 0 --trampoline_seg: .word BOOT_TRAMPOLINE >> 4 -+trampoline_seg: .word 0 - .pushsection .trampoline_seg, "a" - .long trampoline_seg - . - .popsection -@@ -116,7 +116,7 @@ wakeup_32: - mov $BOOT_DS, %eax - mov %eax, %ds - mov %eax, %ss -- mov $bootsym_rel(early_stack, 4, %esp) -+ mov $bootsym_rel(wakeup_stack, 4, %esp) - - # check saved magic again - mov $sym_phys(saved_magic), %eax -@@ -188,3 +188,7 @@ ret_point: - bogus_saved_magic: - movw $0x0e00 + 'S', 0xb8014 - jmp bogus_saved_magic -+ -+ .align 16 -+ .fill PAGE_SIZE,1,0 -+wakeup_stack: diff --git a/25485-x86_64-canonical-checks.patch b/25485-x86_64-canonical-checks.patch deleted file mode 100644 index 35e70ae..0000000 --- a/25485-x86_64-canonical-checks.patch +++ /dev/null @@ -1,78 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1340031721 -7200 -# Node ID 5b6a857411ba5212c71885a2fd39cae4c3d8231c -# Parent c272cfe25bea00375fb65c339926c83b6e830230 -x86-64: don't allow non-canonical addresses to be set for any callback - -Rather than deferring the detection of these to the point where they -get actually used (the fix for XSA-7, 25480:76eaf5966c05, causing a #GP -to be raised by IRET, which invokes the guest's [fragile] fail-safe -callback), don't even allow such to be set. - -Signed-off-by: Jan Beulich -Acked-by: Keir Fraser - ---- a/xen/arch/x86/domain.c -+++ b/xen/arch/x86/domain.c -@@ -683,6 +683,14 @@ int arch_set_info_guest( - { - if ( !compat ) - { -+#ifdef __x86_64__ -+ if ( !is_canonical_address(c.nat->user_regs.eip) || -+ !is_canonical_address(c.nat->event_callback_eip) || -+ !is_canonical_address(c.nat->syscall_callback_eip) || -+ !is_canonical_address(c.nat->failsafe_callback_eip) ) -+ return -EINVAL; -+#endif -+ - fixup_guest_stack_selector(d, c.nat->user_regs.ss); - fixup_guest_stack_selector(d, c.nat->kernel_ss); - fixup_guest_code_selector(d, c.nat->user_regs.cs); -@@ -692,7 +700,11 @@ int arch_set_info_guest( - #endif - - for ( i = 0; i < 256; i++ ) -+ { -+ if ( !is_canonical_address(c.nat->trap_ctxt[i].address) ) -+ return -EINVAL; - fixup_guest_code_selector(d, c.nat->trap_ctxt[i].cs); -+ } - - /* LDT safety checks. */ - if ( ((c.nat->ldt_base & (PAGE_SIZE-1)) != 0) || ---- a/xen/arch/x86/domctl.c -+++ b/xen/arch/x86/domctl.c -@@ -1148,6 +1148,9 @@ long arch_do_domctl( - if ( evc->size < offsetof(typeof(*evc), mcg_cap) ) - goto ext_vcpucontext_out; - #ifdef __x86_64__ -+ if ( !is_canonical_address(evc->sysenter_callback_eip) || -+ !is_canonical_address(evc->syscall32_callback_eip) ) -+ goto ext_vcpucontext_out; - fixup_guest_code_selector(d, evc->sysenter_callback_cs); - v->arch.sysenter_callback_cs = evc->sysenter_callback_cs; - v->arch.sysenter_callback_eip = evc->sysenter_callback_eip; ---- a/xen/arch/x86/traps.c -+++ b/xen/arch/x86/traps.c -@@ -3544,6 +3544,9 @@ long register_guest_nmi_callback(unsigne - struct domain *d = v->domain; - struct trap_info *t = &v->arch.guest_context.trap_ctxt[TRAP_nmi]; - -+ if ( !is_canonical_address(address) ) -+ return -EINVAL; -+ - t->vector = TRAP_nmi; - t->flags = 0; - t->cs = (is_pv_32on64_domain(d) ? -@@ -3671,6 +3674,9 @@ long do_set_trap_table(XEN_GUEST_HANDLE( - if ( cur.address == 0 ) - break; - -+ if ( !is_canonical_address(cur.address) ) -+ return -EINVAL; -+ - fixup_guest_code_selector(curr->domain, cur.cs); - - memcpy(&dst[cur.vector], &cur, sizeof(cur)); diff --git a/25589-pygrub-size-limits.patch b/25589-pygrub-size-limits.patch deleted file mode 100644 index f2ca475..0000000 --- a/25589-pygrub-size-limits.patch +++ /dev/null @@ -1,114 +0,0 @@ -# HG changeset patch -# User M A Young -# Date 1341413174 -3600 -# Node ID 60f09d1ab1fe5dee87db1bf55c7479a5d71e85a5 -# Parent 42f76d536b116d2ebad1b6705ae51ecd171d2581 -pygrub: cope better with big files in the guest. - -Only read the first megabyte of a configuration file (grub etc.) and read the -kernel and ramdisk files from the guest in one megabyte pieces so pygrub -doesn't use a lot of memory if the files are large. With --not-really option -check that the chosen kernel and ramdisk files exist. If there are problems -writing the copy of the kernel or ramdisk, delete the copied files and exit in -case they have filled the filesystem. - -Signed-off-by: Michael Young -Acked-by: Matt Wilson -Acked-by: Ian Campbell -Acked-by: Ian Jackson -Committed-by: Ian Campbell - -diff -r 42f76d536b11 -r 60f09d1ab1fe tools/pygrub/src/pygrub ---- a/tools/pygrub/src/pygrub Tue Jul 03 13:39:01 2012 +0100 -+++ b/tools/pygrub/src/pygrub Wed Jul 04 15:46:14 2012 +0100 -@@ -28,6 +28,7 @@ - import grub.ExtLinuxConf - - PYGRUB_VER = 0.6 -+FS_READ_MAX = 1024 * 1024 - - def enable_cursor(ison): - if ison: -@@ -448,7 +449,8 @@ - if self.__dict__.get('cf', None) is None: - raise RuntimeError, "couldn't find bootloader config file in the image provided." - f = fs.open_file(self.cf.filename) -- buf = f.read() -+ # limit read size to avoid pathological cases -+ buf = f.read(FS_READ_MAX) - del f - self.cf.parse(buf) - -@@ -697,6 +699,37 @@ - def usage(): - print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] " %(sys.argv[0],) - -+ def copy_from_image(fs, file_to_read, file_type, output_directory, -+ not_really): -+ if not_really: -+ if fs.file_exists(file_to_read): -+ return "<%s:%s>" % (file_type, file_to_read) -+ else: -+ sys.exit("The requested %s file does not exist" % file_type) -+ try: -+ datafile = fs.open_file(file_to_read) -+ except Exception, e: -+ print >>sys.stderr, e -+ sys.exit("Error opening %s in guest" % file_to_read) -+ (tfd, ret) = tempfile.mkstemp(prefix="boot_"+file_type+".", -+ dir=output_directory) -+ dataoff = 0 -+ while True: -+ data = datafile.read(FS_READ_MAX, dataoff) -+ if len(data) == 0: -+ os.close(tfd) -+ del datafile -+ return ret -+ try: -+ os.write(tfd, data) -+ except Exception, e: -+ print >>sys.stderr, e -+ os.close(tfd) -+ os.unlink(ret) -+ del datafile -+ sys.exit("Error writing temporary copy of "+file_type) -+ dataoff += len(data) -+ - try: - opts, args = getopt.gnu_getopt(sys.argv[1:], 'qinh::', - ["quiet", "interactive", "not-really", "help", -@@ -821,24 +854,18 @@ - if not fs: - raise RuntimeError, "Unable to find partition containing kernel" - -- if not_really: -- bootcfg["kernel"] = "" % chosencfg["kernel"] -- else: -- data = fs.open_file(chosencfg["kernel"]).read() -- (tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.", -- dir=output_directory) -- os.write(tfd, data) -- os.close(tfd) -+ bootcfg["kernel"] = copy_from_image(fs, chosencfg["kernel"], "kernel", -+ output_directory, not_really) - - if chosencfg["ramdisk"]: -- if not_really: -- bootcfg["ramdisk"] = "" % chosencfg["ramdisk"] -- else: -- data = fs.open_file(chosencfg["ramdisk"],).read() -- (tfd, bootcfg["ramdisk"]) = tempfile.mkstemp( -- prefix="boot_ramdisk.", dir=output_directory) -- os.write(tfd, data) -- os.close(tfd) -+ try: -+ bootcfg["ramdisk"] = copy_from_image(fs, chosencfg["ramdisk"], -+ "ramdisk", output_directory, -+ not_really) -+ except: -+ if not not_really: -+ os.unlink(bootcfg["kernel"]) -+ raise - else: - initrd = None - diff --git a/25616-x86-MCi_CTL-default.patch b/25616-x86-MCi_CTL-default.patch deleted file mode 100644 index 3b56126..0000000 --- a/25616-x86-MCi_CTL-default.patch +++ /dev/null @@ -1,125 +0,0 @@ -# HG changeset patch -# User Liu, Jinsong -# Date 1342709122 -3600 -# Node ID 8a4cda0bbdc2309c7f86445eaa14e4f75e9bd21a -# Parent 3625ff5e9f80aebb403d6efc75522eef08cd3802 -Xen/MCE: stick all 1's to MCi_CTL of vMCE - -This patch is a middle-work patch, prepare for future new vMCE model. -It remove mci_ctl array, and keep MCi_CTL all 1's. - -Signed-off-by: Liu, Jinsong -Committed-by: Keir Fraser - ---- a/xen/arch/x86/cpu/mcheck/vmce.c -+++ b/xen/arch/x86/cpu/mcheck/vmce.c -@@ -25,7 +25,6 @@ uint64_t g_mcg_cap; - - /* Real value in physical CTL MSR */ - uint64_t h_mcg_ctl = 0UL; --uint64_t *h_mci_ctrl; - - int vmce_init_msr(struct domain *d) - { -@@ -33,15 +32,6 @@ int vmce_init_msr(struct domain *d) - if ( !dom_vmce(d) ) - return -ENOMEM; - -- dom_vmce(d)->mci_ctl = xmalloc_array(uint64_t, nr_mce_banks); -- if ( !dom_vmce(d)->mci_ctl ) -- { -- xfree(dom_vmce(d)); -- return -ENOMEM; -- } -- memset(dom_vmce(d)->mci_ctl, ~0, -- nr_mce_banks * sizeof(*dom_vmce(d)->mci_ctl)); -- - dom_vmce(d)->mcg_status = 0x0; - dom_vmce(d)->mcg_ctl = ~(uint64_t)0x0; - dom_vmce(d)->nr_injection = 0; -@@ -56,7 +46,6 @@ void vmce_destroy_msr(struct domain *d) - { - if ( !dom_vmce(d) ) - return; -- xfree(dom_vmce(d)->mci_ctl); - xfree(dom_vmce(d)); - dom_vmce(d) = NULL; - } -@@ -93,9 +82,8 @@ static int bank_mce_rdmsr(const struct v - switch ( msr & (MSR_IA32_MC0_CTL | 3) ) - { - case MSR_IA32_MC0_CTL: -- if ( bank < nr_mce_banks ) -- *val = vmce->mci_ctl[bank] & -- (h_mci_ctrl ? h_mci_ctrl[bank] : ~0UL); -+ /* stick all 1's to MCi_CTL */ -+ *val = ~0UL; - mce_printk(MCE_VERBOSE, "MCE: rdmsr MC%u_CTL 0x%"PRIx64"\n", - bank, *val); - break; -@@ -220,8 +208,10 @@ static int bank_mce_wrmsr(struct vcpu *v - switch ( msr & (MSR_IA32_MC0_CTL | 3) ) - { - case MSR_IA32_MC0_CTL: -- if ( bank < nr_mce_banks ) -- vmce->mci_ctl[bank] = val; -+ /* -+ * if guest crazy clear any bit of MCi_CTL, -+ * treat it as not implement and ignore write change it. -+ */ - break; - case MSR_IA32_MC0_STATUS: - if ( entry && (entry->bank == bank) ) -@@ -522,22 +512,6 @@ int vmce_domain_inject( - int vmce_init(struct cpuinfo_x86 *c) - { - u64 value; -- unsigned int i; -- -- if ( !h_mci_ctrl ) -- { -- h_mci_ctrl = xmalloc_array(uint64_t, nr_mce_banks); -- if (!h_mci_ctrl) -- { -- dprintk(XENLOG_INFO, "Failed to alloc h_mci_ctrl\n"); -- return -ENOMEM; -- } -- /* Don't care banks before firstbank */ -- memset(h_mci_ctrl, ~0, -- min(firstbank, nr_mce_banks) * sizeof(*h_mci_ctrl)); -- for (i = firstbank; i < nr_mce_banks; i++) -- rdmsrl(MSR_IA32_MCx_CTL(i), h_mci_ctrl[i]); -- } - - rdmsrl(MSR_IA32_MCG_CAP, value); - /* For Guest vMCE usage */ -@@ -550,18 +524,13 @@ int vmce_init(struct cpuinfo_x86 *c) - - static int mca_ctl_conflict(struct mcinfo_bank *bank, struct domain *d) - { -- int bank_nr; -- -- if ( !bank || !d || !h_mci_ctrl ) -+ if ( !bank || !d ) - return 1; - - /* Will MCE happen in host if If host mcg_ctl is 0? */ - if ( ~d->arch.vmca_msrs->mcg_ctl & h_mcg_ctl ) - return 1; - -- bank_nr = bank->mc_bank; -- if (~d->arch.vmca_msrs->mci_ctl[bank_nr] & h_mci_ctrl[bank_nr] ) -- return 1; - return 0; - } - ---- a/xen/include/asm-x86/mce.h -+++ b/xen/include/asm-x86/mce.h -@@ -18,7 +18,6 @@ struct domain_mca_msrs - /* Guest should not change below values after DOM boot up */ - uint64_t mcg_ctl; - uint64_t mcg_status; -- uint64_t *mci_ctl; - uint16_t nr_injection; - struct list_head impact_header; - spinlock_t lock; diff --git a/32on64-extra-mem.patch b/32on64-extra-mem.patch index 0b9d3c3..288d258 100644 --- a/32on64-extra-mem.patch +++ b/32on64-extra-mem.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2932,7 +2932,7 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -2939,7 +2939,7 @@ class XendDomainInfo: self.guest_bitsize = self.image.getBitSize() # Make sure there's enough RAM available for the domain diff --git a/altgr_2.patch b/altgr_2.patch index 4f74695..f7eeabc 100644 --- a/altgr_2.patch +++ b/altgr_2.patch @@ -29,10 +29,10 @@ keycodes up and down events and make sure the intentionally added altgr keycode Signed-off by Chunyan Liu (cyliu@novell.com) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c @@ -1308,6 +1308,9 @@ static void do_key_event(VncState *vs, i shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36]; altgr_keys = vs->modifiers_state[0xb8]; diff --git a/bdrv_default_rwflag.patch b/bdrv_default_rwflag.patch index a48bebd..c94a69f 100644 --- a/bdrv_default_rwflag.patch +++ b/bdrv_default_rwflag.patch @@ -1,11 +1,11 @@ Subject: modify default read/write flag in bdrv_init. Signed-off by Chunyan Liu -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vl.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c -@@ -2617,6 +2617,8 @@ int drive_init(struct drive_opt *arg, in +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c +@@ -2627,6 +2627,8 @@ int drive_init(struct drive_opt *arg, in strncpy(drives_table[nb_drives].serial, serial, sizeof(serial)); nb_drives++; @@ -14,7 +14,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c switch(type) { case IF_IDE: case IF_XEN: -@@ -2630,6 +2632,7 @@ int drive_init(struct drive_opt *arg, in +@@ -2640,6 +2642,7 @@ int drive_init(struct drive_opt *arg, in break; case MEDIA_CDROM: bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM); @@ -22,7 +22,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c break; } break; -@@ -2650,7 +2653,6 @@ int drive_init(struct drive_opt *arg, in +@@ -2660,7 +2663,6 @@ int drive_init(struct drive_opt *arg, in } if (!file[0]) return -2; diff --git a/bdrv_open2_fix_flags.patch b/bdrv_open2_fix_flags.patch index 6030d2c..e3fc2e6 100644 --- a/bdrv_open2_fix_flags.patch +++ b/bdrv_open2_fix_flags.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/block.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/block.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/block.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block.c @@ -350,7 +350,7 @@ int bdrv_file_open(BlockDriverState **pb int bdrv_open(BlockDriverState *bs, const char *filename, int flags) @@ -28,10 +28,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block.c ret = drv->bdrv_open(bs, filename, open_flags); if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) { ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR); -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/usb-msd.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/usb-msd.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/usb-msd.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/usb-msd.c @@ -551,7 +551,7 @@ USBDevice *usb_msd_init(const char *file s = qemu_mallocz(sizeof(MSDState)); @@ -41,10 +41,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c goto fail; s->bs = bdrv; *pbs = bdrv; -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-img.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-img.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/qemu-img.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-img.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/qemu-img.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-img.c @@ -32,7 +32,7 @@ #endif diff --git a/bdrv_open2_flags_2.patch b/bdrv_open2_flags_2.patch index 6b737e2..d9f1c24 100644 --- a/bdrv_open2_flags_2.patch +++ b/bdrv_open2_flags_2.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -237,6 +237,7 @@ static int open_disk(struct td_state *s, +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c +@@ -225,6 +225,7 @@ static int open_disk(struct td_state *s, BlockDriver* drv; char* devname; static int devnumber = 0; @@ -10,7 +10,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c int i; DPRINTF("Opening %s as blktap%d\n", path, devnumber); -@@ -259,7 +260,7 @@ static int open_disk(struct td_state *s, +@@ -247,7 +248,7 @@ static int open_disk(struct td_state *s, DPRINTF("%s driver specified\n", drv ? drv->format_name : "No"); /* Open the image */ @@ -19,11 +19,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c fprintf(stderr, "Could not open image file %s\n", path); return -ENOMEM; } -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -136,7 +136,8 @@ static void insert_media(void *opaque) +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +@@ -133,7 +133,8 @@ static void insert_media(void *opaque) else format = &bdrv_raw; @@ -33,7 +33,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c #ifdef CONFIG_STUBDOM { char *buf, *backend, *params_path, *params; -@@ -511,7 +512,8 @@ void xenstore_parse_domain_config(int hv +@@ -508,7 +509,8 @@ void xenstore_parse_domain_config(int hv } for (i = 0; i < num; i++) { @@ -43,7 +43,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c /* read the backend path */ xenstore_get_backend_path(&bpath, "vbd", danger_path, hvm_domid, e_danger[i]); if (bpath == NULL) -@@ -597,6 +599,17 @@ void xenstore_parse_domain_config(int hv +@@ -594,6 +596,17 @@ void xenstore_parse_domain_config(int hv format = &bdrv_raw; } @@ -61,7 +61,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c #if 0 /* Phantom VBDs are disabled because the use of paths * from guest-controlled areas in xenstore is unsafe. -@@ -664,7 +677,7 @@ void xenstore_parse_domain_config(int hv +@@ -661,7 +674,7 @@ void xenstore_parse_domain_config(int hv #ifdef CONFIG_STUBDOM if (pasprintf(&danger_buf, "%s/device/vbd/%s", danger_path, e_danger[i]) == -1) continue; @@ -70,12 +70,3 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c pstrcpy(bs->filename, sizeof(bs->filename), params); } #else -@@ -716,7 +729,7 @@ void xenstore_parse_domain_config(int hv - - fprintf(stderr, "Using file %s in read-%s mode\n", bs->filename, is_readonly ? "only" : "write"); - -- if (bdrv_open2(bs, params, BDRV_O_CACHE_WB /* snapshot and write-back */, format) < 0) { -+ if (bdrv_open2(bs, params, flags|BDRV_O_CACHE_WB /* snapshot and write-back */, format) < 0) { - fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?", format ? format->format_name : "0"); - } else { - char* snapshot = get_snapshot_name(atoi(e_danger[i])); diff --git a/blktap-close-fifos.patch b/blktap-close-fifos.patch index 98f99bb..c1fcb07 100644 --- a/blktap-close-fifos.patch +++ b/blktap-close-fifos.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c +Index: xen-4.2.0-testing/tools/blktap/drivers/blktapctrl.c =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/blktapctrl.c -+++ xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c -@@ -280,7 +280,7 @@ static int del_disktype(blkif_t *blkif) +--- xen-4.2.0-testing.orig/tools/blktap/drivers/blktapctrl.c ++++ xen-4.2.0-testing/tools/blktap/drivers/blktapctrl.c +@@ -282,7 +282,7 @@ static int del_disktype(blkif_t *blkif) * qemu-dm instance. We may close the file handle only if there is * no other disk left for this domain. */ diff --git a/blktap-disable-debug-printf.patch b/blktap-disable-debug-printf.patch index ec933ca..8c29bef 100644 --- a/blktap-disable-debug-printf.patch +++ b/blktap-disable-debug-printf.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c +Index: xen-4.2.0-testing/tools/blktap/drivers/blktapctrl.c =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/blktapctrl.c -+++ xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c -@@ -59,6 +59,9 @@ +--- xen-4.2.0-testing.orig/tools/blktap/drivers/blktapctrl.c ++++ xen-4.2.0-testing/tools/blktap/drivers/blktapctrl.c +@@ -61,6 +61,9 @@ #include "list.h" #include "xs_api.h" /* for xs_fire_next_watch() */ @@ -12,11 +12,11 @@ Index: xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c #define PIDFILE "/var/run/blktapctrl.pid" #define NUM_POLL_FDS 2 -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -48,7 +48,7 @@ +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c +@@ -46,7 +46,7 @@ #define BLKTAP_CTRL_DIR "/var/run/tap" /* If enabled, print debug messages to stderr */ diff --git a/blktap-pv-cdrom.patch b/blktap-pv-cdrom.patch index 9935187..9c2552f 100644 --- a/blktap-pv-cdrom.patch +++ b/blktap-pv-cdrom.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/blktap/drivers/block-cdrom.c +Index: xen-4.2.0-testing/tools/blktap/drivers/block-cdrom.c =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/blktap/drivers/block-cdrom.c ++++ xen-4.2.0-testing/tools/blktap/drivers/block-cdrom.c @@ -0,0 +1,535 @@ +/* block-cdrom.c + * @@ -538,10 +538,10 @@ Index: xen-4.1.2-testing/tools/blktap/drivers/block-cdrom.c + .td_get_parent_id = tdcdrom_get_parent_id, + .td_validate_parent = tdcdrom_validate_parent +}; -Index: xen-4.1.2-testing/xen/include/public/io/cdromif.h +Index: xen-4.2.0-testing/xen/include/public/io/cdromif.h =================================================================== --- /dev/null -+++ xen-4.1.2-testing/xen/include/public/io/cdromif.h ++++ xen-4.2.0-testing/xen/include/public/io/cdromif.h @@ -0,0 +1,122 @@ +/****************************************************************************** + * cdromif.h @@ -665,23 +665,23 @@ Index: xen-4.1.2-testing/xen/include/public/io/cdromif.h + sizeof(struct vcd_generic_command) - sizeof(struct request_sense)) + +#endif -Index: xen-4.1.2-testing/tools/blktap/drivers/Makefile +Index: xen-4.2.0-testing/tools/blktap/drivers/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/Makefile -+++ xen-4.1.2-testing/tools/blktap/drivers/Makefile -@@ -28,8 +28,9 @@ CFLAGS += -DMEMSHR - MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a - endif +--- xen-4.2.0-testing.orig/tools/blktap/drivers/Makefile ++++ xen-4.2.0-testing/tools/blktap/drivers/Makefile +@@ -37,8 +37,9 @@ endif + CFLAGS += $(PTHREAD_CFLAGS) + LDFLAGS += $(PTHREAD_LDFLAGS) --LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread --LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz +-LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm $(PTHREAD_LIBS) +-LDLIBS_img := $(AIOLIBS) $(CRYPT_LIB) $(PTHREAD_LIBS) -lz +LDLIBS_xen := $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -+LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_xen) -L../lib -lblktap -lrt -lm -lpthread -+LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz $(LDLIBS_xen) ++LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_xen) -L../lib -lblktap -lrt -lm $(PTHREAD_LIBS) ++LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) $(PTHREAD_LIBS) -lz $(LDLIBS_xen) BLK-OBJS-y := block-aio.o BLK-OBJS-y += block-sync.o -@@ -37,6 +38,7 @@ BLK-OBJS-y += block-vmdk.o +@@ -46,6 +47,7 @@ BLK-OBJS-y += block-vmdk.o BLK-OBJS-y += block-ram.o BLK-OBJS-y += block-qcow.o BLK-OBJS-y += block-qcow2.o @@ -689,10 +689,10 @@ Index: xen-4.1.2-testing/tools/blktap/drivers/Makefile BLK-OBJS-y += aes.o BLK-OBJS-y += tapaio.o BLK-OBJS-$(CONFIG_Linux) += blk_linux.o -Index: xen-4.1.2-testing/tools/blktap/drivers/tapdisk.h +Index: xen-4.2.0-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/tapdisk.h -+++ xen-4.1.2-testing/tools/blktap/drivers/tapdisk.h +--- xen-4.2.0-testing.orig/tools/blktap/drivers/tapdisk.h ++++ xen-4.2.0-testing/tools/blktap/drivers/tapdisk.h @@ -137,6 +137,9 @@ struct tap_disk { int (*td_get_parent_id) (struct disk_driver *dd, struct disk_id *id); int (*td_validate_parent)(struct disk_driver *dd, @@ -737,11 +737,11 @@ Index: xen-4.1.2-testing/tools/blktap/drivers/tapdisk.h }; typedef struct driver_list_entry { -Index: xen-4.1.2-testing/tools/blktap/lib/blktaplib.h +Index: xen-4.2.0-testing/tools/blktap/lib/blktaplib.h =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-4.1.2-testing/tools/blktap/lib/blktaplib.h -@@ -225,6 +225,7 @@ typedef struct msg_pid { +--- xen-4.2.0-testing.orig/tools/blktap/lib/blktaplib.h ++++ xen-4.2.0-testing/tools/blktap/lib/blktaplib.h +@@ -220,6 +220,7 @@ typedef struct msg_pid { #define DISK_TYPE_RAM 3 #define DISK_TYPE_QCOW 4 #define DISK_TYPE_QCOW2 5 @@ -749,23 +749,23 @@ Index: xen-4.1.2-testing/tools/blktap/lib/blktaplib.h /* xenstore/xenbus: */ #define DOMNAME "Domain-0" -Index: xen-4.1.2-testing/xen/include/public/io/blkif.h +Index: xen-4.2.0-testing/xen/include/public/io/blkif.h =================================================================== ---- xen-4.1.2-testing.orig/xen/include/public/io/blkif.h -+++ xen-4.1.2-testing/xen/include/public/io/blkif.h -@@ -80,7 +80,7 @@ +--- xen-4.2.0-testing.orig/xen/include/public/io/blkif.h ++++ xen-4.2.0-testing/xen/include/public/io/blkif.h +@@ -379,7 +379,7 @@ * Used in SLES sources for device specific command packet * contained within the request. Reserved for that purpose. */ -#define BLKIF_OP_RESERVED_1 4 +#define BLKIF_OP_PACKET 4 /* - * Recognised only if "feature-trim" is present in backend xenbus info. - * The "feature-trim" node contains a boolean indicating whether trim -Index: xen-4.1.2-testing/tools/blktap/drivers/tapdisk.c + * Indicate to the backend device that a region of storage is no longer in + * use, and may be discarded at any time without impact to the client. If +Index: xen-4.2.0-testing/tools/blktap/drivers/tapdisk.c =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/tapdisk.c -+++ xen-4.1.2-testing/tools/blktap/drivers/tapdisk.c +--- xen-4.2.0-testing.orig/tools/blktap/drivers/tapdisk.c ++++ xen-4.2.0-testing/tools/blktap/drivers/tapdisk.c @@ -735,6 +735,22 @@ static void get_io_request(struct td_sta goto out; } @@ -789,10 +789,10 @@ Index: xen-4.1.2-testing/tools/blktap/drivers/tapdisk.c default: DPRINTF("Unknown block operation\n"); break; -Index: xen-4.1.2-testing/tools/python/xen/xend/server/BlktapController.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/BlktapController.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/server/BlktapController.py -+++ xen-4.1.2-testing/tools/python/xen/xend/server/BlktapController.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/server/BlktapController.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/BlktapController.py @@ -15,6 +15,7 @@ blktap1_disk_types = [ 'ram', 'qcow', diff --git a/blktap.patch b/blktap.patch index 2cd7509..7d504cb 100644 --- a/blktap.patch +++ b/blktap.patch @@ -1,11 +1,11 @@ bug #239173 bug #242953 -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3296,7 +3296,7 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3301,7 +3301,7 @@ class XendDomainInfo: (fn, BOOTLOADER_LOOPBACK_DEVICE)) vbd = { @@ -14,10 +14,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py 'device': BOOTLOADER_LOOPBACK_DEVICE, } -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c @@ -447,9 +447,9 @@ void xenstore_parse_domain_config(int hv { char **e_danger = NULL; diff --git a/blktapctrl-default-to-ioemu.patch b/blktapctrl-default-to-ioemu.patch index 01c3786..acc1144 100644 --- a/blktapctrl-default-to-ioemu.patch +++ b/blktapctrl-default-to-ioemu.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/blktap/drivers/tapdisk.h +Index: xen-4.2.0-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/tapdisk.h -+++ xen-4.1.2-testing/tools/blktap/drivers/tapdisk.h +--- xen-4.2.0-testing.orig/tools/blktap/drivers/tapdisk.h ++++ xen-4.2.0-testing/tools/blktap/drivers/tapdisk.h @@ -168,7 +168,7 @@ static disk_info_t aio_disk = { "raw image (aio)", "aio", diff --git a/bridge-bonding.diff b/bridge-bonding.diff index 459abb4..c4b1112 100644 --- a/bridge-bonding.diff +++ b/bridge-bonding.diff @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.2.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.1.2-testing/tools/hotplug/Linux/network-bridge -@@ -249,6 +249,9 @@ op_start () { +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.2.0-testing/tools/hotplug/Linux/network-bridge +@@ -251,6 +251,9 @@ op_start () { claim_lock "network-bridge" @@ -12,7 +12,7 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge vlans=$(find_active_vlans "${netdev}") for vlan in $vlans ; do ifdown $vlan ; done -@@ -266,18 +269,32 @@ op_start () { +@@ -268,18 +271,32 @@ op_start () { ip link set ${netdev} down ip addr flush ${netdev} fi diff --git a/bridge-opensuse.patch b/bridge-opensuse.patch index 1390bf1..2a01269 100644 --- a/bridge-opensuse.patch +++ b/bridge-opensuse.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.2.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.1.2-testing/tools/hotplug/Linux/network-bridge -@@ -278,19 +278,19 @@ op_stop () { +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.2.0-testing/tools/hotplug/Linux/network-bridge +@@ -280,19 +280,19 @@ op_stop () { transfer_addrs ${bridge} ${pdev} if ! ifdown ${bridge}; then get_ip_info ${bridge} diff --git a/bridge-record-creation.patch b/bridge-record-creation.patch index e18a635..dcac5d4 100644 --- a/bridge-record-creation.patch +++ b/bridge-record-creation.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.2.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.1.2-testing/tools/hotplug/Linux/network-bridge -@@ -257,6 +257,11 @@ op_start () { +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.2.0-testing/tools/hotplug/Linux/network-bridge +@@ -259,6 +259,11 @@ op_start () { create_bridge ${tdev} @@ -14,7 +14,7 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge preiftransfer ${netdev} transfer_addrs ${netdev} ${tdev} # Remember slaves for bonding interface. -@@ -338,6 +343,13 @@ op_stop () { +@@ -340,6 +345,13 @@ op_stop () { ip link set ${pdev} name ${netdev} do_ifup ${netdev} diff --git a/bridge-vlan.diff b/bridge-vlan.diff index 8d0b110..10df34c 100644 --- a/bridge-vlan.diff +++ b/bridge-vlan.diff @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.2.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.1.2-testing/tools/hotplug/Linux/network-bridge -@@ -193,6 +193,28 @@ antispoofing () { +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.2.0-testing/tools/hotplug/Linux/network-bridge +@@ -195,6 +195,28 @@ antispoofing () { iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT } @@ -31,7 +31,7 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge # Usage: show_status dev bridge # Print ifconfig and routes. show_status () { -@@ -227,6 +249,9 @@ op_start () { +@@ -229,6 +251,9 @@ op_start () { claim_lock "network-bridge" @@ -41,7 +41,7 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge create_bridge ${tdev} preiftransfer ${netdev} -@@ -254,6 +279,8 @@ op_start () { +@@ -256,6 +281,8 @@ op_start () { add_to_bridge2 ${bridge} ${pdev} do_ifup ${bridge} @@ -50,7 +50,7 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge if [ ${antispoof} = 'yes' ] ; then antispoofing fi -@@ -275,6 +302,9 @@ op_stop () { +@@ -277,6 +304,9 @@ op_stop () { claim_lock "network-bridge" @@ -60,7 +60,7 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/network-bridge transfer_addrs ${bridge} ${pdev} if ! ifdown ${bridge}; then get_ip_info ${bridge} -@@ -291,6 +321,8 @@ op_stop () { +@@ -293,6 +323,8 @@ op_stop () { ip link set ${pdev} name ${netdev} do_ifup ${netdev} diff --git a/build-tapdisk-ioemu.patch b/build-tapdisk-ioemu.patch index af9787d..5e31357 100644 --- a/build-tapdisk-ioemu.patch +++ b/build-tapdisk-ioemu.patch @@ -15,10 +15,10 @@ Signed-off-by: Kevin Wolf tapdisk-ioemu.c | 17 ----------------- 4 files changed, 17 insertions(+), 26 deletions(-) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/Makefile -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/Makefile ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile @@ -46,14 +46,6 @@ $(filter %-user,$(SUBDIR_RULES)): libqem recurse-all: $(SUBDIR_RULES) @@ -56,10 +56,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile ###################################################################### # libqemu_common.a: Target independent part of system emulation. The # long term path is to suppress *all* target specific code in case of -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/configure +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/configure =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/configure -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/configure +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/configure ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/configure @@ -1511,7 +1511,7 @@ bsd) ;; esac @@ -69,10 +69,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/configure if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then tools="qemu-img\$(EXESUF) $tools" if [ "$linux" = "yes" ] ; then -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-tool.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-tool.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/qemu-tool.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-tool.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/qemu-tool.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-tool.c @@ -68,7 +68,7 @@ void qemu_bh_delete(QEMUBH *bh) qemu_free(bh); } @@ -82,10 +82,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-tool.c IOCanRWHandler *fd_read_poll, IOHandler *fd_read, IOHandler *fd_write, -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/tapdisk-ioemu.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c @@ -12,34 +12,12 @@ extern void qemu_aio_init(void); diff --git a/capslock_enable.patch b/capslock_enable.patch index bf68962..9bc0cba 100644 --- a/capslock_enable.patch +++ b/capslock_enable.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c @@ -1342,6 +1342,11 @@ static void do_key_event(VncState *vs, i } break; diff --git a/cdrom-removable.patch b/cdrom-removable.patch index cdf3652..9048020 100644 --- a/cdrom-removable.patch +++ b/cdrom-removable.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/server/HalDaemon.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/HalDaemon.py =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/python/xen/xend/server/HalDaemon.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/HalDaemon.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python +# -*- mode: python; -*- @@ -246,10 +246,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/server/HalDaemon.py + print 'Falling off end' + + -Index: xen-4.1.2-testing/tools/python/xen/xend/server/Hald.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/Hald.py =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/python/xen/xend/server/Hald.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/Hald.py @@ -0,0 +1,125 @@ +#============================================================================ +# This library is free software; you can redistribute it and/or @@ -376,10 +376,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/server/Hald.py + watcher.run() + time.sleep(10) + watcher.shutdown() -Index: xen-4.1.2-testing/tools/python/xen/xend/server/SrvServer.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/SrvServer.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/server/SrvServer.py -+++ xen-4.1.2-testing/tools/python/xen/xend/server/SrvServer.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/server/SrvServer.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/SrvServer.py @@ -57,6 +57,7 @@ from xen.web.SrvDir import SrvDir from SrvRoot import SrvRoot @@ -397,10 +397,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/server/SrvServer.py def create(): root = SrvDir() -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c @@ -18,6 +18,7 @@ #include "exec-all.h" #include "sysemu.h" diff --git a/change-vnc-passwd.patch b/change-vnc-passwd.patch index 1f80fa2..3b6bc76 100644 --- a/change-vnc-passwd.patch +++ b/change-vnc-passwd.patch @@ -2,10 +2,10 @@ Add support of change-vnc-password while vm is running. Signed-off-by: Chunyan Liu -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vl.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c @@ -200,7 +200,7 @@ DriveInfo drives_table[MAX_DRIVES+1]; int nb_drives; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; @@ -15,10 +15,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c int nographic; static int curses; static int sdl; -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c @@ -2591,6 +2591,7 @@ int vnc_display_password(DisplayState *d if (password && password[0]) { if (!(vs->password = qemu_strdup(password))) @@ -27,11 +27,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c } return 0; -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -25,6 +25,7 @@ +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +@@ -24,6 +24,7 @@ #include "qemu-timer.h" #include "qemu-xen.h" @@ -39,7 +39,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c struct xs_handle *xsh = NULL; static char *media_filename[MAX_DRIVES+1]; static QEMUTimer *insert_timer = NULL; -@@ -1006,6 +1007,19 @@ static void xenstore_process_dm_command_ +@@ -937,6 +938,19 @@ static void xenstore_process_dm_command_ } else if (!strncmp(command, "continue", len)) { fprintf(logfile, "dm-command: continue after state save\n"); xen_pause_requested = 0; @@ -59,11 +59,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c } else if (!strncmp(command, "usb-add", len)) { fprintf(logfile, "dm-command: usb-add a usb device\n"); if (pasprintf(&path, -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1488,6 +1488,20 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -1490,6 +1490,20 @@ class XendDomainInfo: target = max_target self.setMemoryTarget(target) @@ -84,10 +84,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py def setMemoryTarget(self, target): """Set the memory target of this domain. @param target: In MiB. -Index: xen-4.1.2-testing/tools/python/xen/xend/server/XMLRPCServer.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/XMLRPCServer.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/server/XMLRPCServer.py -+++ xen-4.1.2-testing/tools/python/xen/xend/server/XMLRPCServer.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/server/XMLRPCServer.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/XMLRPCServer.py @@ -95,7 +95,7 @@ methods = ['device_create', 'device_conf 'destroyDevice','getDeviceSxprs', 'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown', @@ -97,10 +97,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/server/XMLRPCServer.py exclude = ['domain_create', 'domain_restore'] -Index: xen-4.1.2-testing/tools/python/xen/xm/main.py +Index: xen-4.2.0-testing/tools/python/xen/xm/main.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.1.2-testing/tools/python/xen/xm/main.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/main.py ++++ xen-4.2.0-testing/tools/python/xen/xm/main.py @@ -21,6 +21,7 @@ """Grand unified management application for Xen. @@ -109,7 +109,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/main.py import atexit import cmd import os -@@ -289,6 +290,9 @@ SUBCOMMAND_HELP = { +@@ -281,6 +282,9 @@ SUBCOMMAND_HELP = { 'getenforce' : ('', 'Returns the current enforcing mode for the Flask XSM module (Enforcing,Permissive)'), 'setenforce' : ('[ (Enforcing|1) | (Permissive|0) ]', 'Modifies the current enforcing mode for the Flask XSM module'), @@ -119,7 +119,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/main.py } SUBCOMMAND_OPTIONS = { -@@ -421,6 +425,7 @@ common_commands = [ +@@ -406,6 +410,7 @@ common_commands = [ "usb-del", "domstate", "vcpu-set", @@ -127,7 +127,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/main.py ] domain_commands = [ -@@ -462,6 +467,7 @@ domain_commands = [ +@@ -443,6 +448,7 @@ domain_commands = [ "vcpu-list", "vcpu-pin", "vcpu-set", @@ -135,7 +135,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/main.py ] host_commands = [ -@@ -3881,6 +3887,10 @@ def xm_cpupool_migrate(args): +@@ -3806,6 +3812,10 @@ def xm_cpupool_migrate(args): else: server.xend.cpu_pool.migrate(domname, poolname) @@ -146,7 +146,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/main.py commands = { "shell": xm_shell, -@@ -3993,6 +4003,8 @@ commands = { +@@ -3914,6 +3924,8 @@ commands = { "usb-del": xm_usb_del, #domstate "domstate": xm_domstate, diff --git a/change_home_server.patch b/change_home_server.patch index 7bb7bcd..ff4aa57 100644 --- a/change_home_server.patch +++ b/change_home_server.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3132,6 +3132,11 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3139,6 +3139,11 @@ class XendDomainInfo: self._cleanup_phantom_devs(paths) self._cleanupVm() diff --git a/check_device_status.patch b/check_device_status.patch index 9d3eb09..be4ef5b 100644 --- a/check_device_status.patch +++ b/check_device_status.patch @@ -5,10 +5,10 @@ get the signal, it will wait until timeout, thus incorrect device status is returned. To fix this problem, we do not depend on ev.wait() result, but read xenstore directly to get correct device status. -Index: xen-4.1.2-testing/tools/python/xen/xend/server/DevController.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/server/DevController.py -+++ xen-4.1.2-testing/tools/python/xen/xend/server/DevController.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/server/DevController.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py @@ -149,7 +149,10 @@ class DevController: (status, err) = self.waitForBackend(devid) diff --git a/checkpoint-rename.patch b/checkpoint-rename.patch index 9e64bcc..a29d56a 100644 --- a/checkpoint-rename.patch +++ b/checkpoint-rename.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py @@ -172,7 +172,7 @@ def save(fd, dominfo, network, live, dst dominfo.destroy() dominfo.testDeviceComplete() diff --git a/cve-2012-0029-qemu-xen-unstable.patch b/cve-2012-0029-qemu-xen-unstable.patch new file mode 100644 index 0000000..5914c20 --- /dev/null +++ b/cve-2012-0029-qemu-xen-unstable.patch @@ -0,0 +1,21 @@ +Index: xen-4.1.2-testing/tools/qemu-xen-traditional-dir-remote/hw/e1000.c +=================================================================== +--- xen-4.1.2-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/e1000.c ++++ xen-4.1.2-testing/tools/qemu-xen-traditional-dir-remote/hw/e1000.c +@@ -444,6 +444,8 @@ process_tx_desc(E1000State *s, struct e1 + bytes = split_size; + if (tp->size + bytes > msh) + bytes = msh - tp->size; ++ ++ bytes = MIN(sizeof(tp->data) - tp->size, bytes); + cpu_physical_memory_read(addr, tp->data + tp->size, bytes); + if ((sz = tp->size + bytes) >= hdr && tp->size < hdr) + memmove(tp->header, tp->data, hdr); +@@ -459,6 +461,7 @@ process_tx_desc(E1000State *s, struct e1 + // context descriptor TSE is not set, while data descriptor TSE is set + DBGOUT(TXERR, "TCP segmentaion Error\n"); + } else { ++ split_size = MIN(sizeof(tp->data) - tp->size, split_size); + cpu_physical_memory_read(addr, tp->data + tp->size, split_size); + tp->size += split_size; + } diff --git a/del_usb_xend_entry.patch b/del_usb_xend_entry.patch index 2a7f19c..9da77dc 100644 --- a/del_usb_xend_entry.patch +++ b/del_usb_xend_entry.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1296,8 +1296,15 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -1298,8 +1298,15 @@ class XendDomainInfo: frontpath = self.getDeviceController(deviceClass).frontendPath(dev) backpath = xstransact.Read(frontpath, "backend") thread.start_new_thread(self.getDeviceController(deviceClass).finishDeviceCleanup, (backpath, path)) diff --git a/disable-xl-when-using-xend.patch b/disable-xl-when-using-xend.patch deleted file mode 100644 index 4e76d7e..0000000 --- a/disable-xl-when-using-xend.patch +++ /dev/null @@ -1,70 +0,0 @@ -Print a warning and exit xl if xend is running. It is not -recommened to use libxenlight in conjunction with legacy xend -toolstack. - -xl could be useful even when xend is running, e.g. to debug -xend itself, so add a '-f' option to override the exit. - -Index: xen-4.1.3-testing/tools/libxl/xl.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxl/xl.c -+++ xen-4.1.3-testing/tools/libxl/xl.c -@@ -88,12 +88,16 @@ int main(int argc, char **argv) - char *config_file; - void *config_data = 0; - int config_len = 0; -+ int force = 0; - -- while ((opt = getopt(argc, argv, "+v")) >= 0) { -+ while ((opt = getopt(argc, argv, "+vf")) >= 0) { - switch (opt) { - case 'v': - if (minmsglevel > 0) minmsglevel--; - break; -+ case 'f': -+ force = 1; -+ break; - default: - fprintf(stderr, "unknown global option\n"); - exit(2); -@@ -107,6 +111,18 @@ int main(int argc, char **argv) - exit(1); - } - opterr = 0; -+ /* -+ * On SUSE, if xend is running (and user isn't asking for help), -+ * print a warning and exit unless forced. -+ */ -+ if ((system("/usr/sbin/xend status") == 0) && strcmp(cmd, "help")) { -+ if (force == 0) { -+ fprintf(stderr, "WARNING: xend is running! It is not recommended " -+ "using libxenlight in\nconjunction with the legacy xend " -+ "toolstack. Use -f (force) to override\n"); -+ exit(1); -+ } -+ } - - logger = xtl_createlogger_stdiostream(stderr, minmsglevel, 0); - if (!logger) exit(1); -Index: xen-4.1.3-testing/tools/libxl/xl_cmdimpl.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxl/xl_cmdimpl.c -+++ xen-4.1.3-testing/tools/libxl/xl_cmdimpl.c -@@ -1741,7 +1741,7 @@ void help(const char *command) - struct cmd_spec *cmd; - - if (!command || !strcmp(command, "help")) { -- printf("Usage xl [-v] [args]\n\n"); -+ printf("Usage xl [-v] [-f] [args]\n\n"); - printf("xl full list of subcommands:\n\n"); - for (i = 0; i < cmdtable_len; i++) - printf(" %-20s%s\n", -@@ -1749,7 +1749,7 @@ void help(const char *command) - } else { - cmd = cmdtable_lookup(command); - if (cmd) { -- printf("Usage: xl [-v] %s %s\n\n%s.\n\n", -+ printf("Usage: xl [-v] [-f] %s %s\n\n%s.\n\n", - cmd->cmd_name, - cmd->cmd_usage, - cmd->cmd_desc); diff --git a/disable_emulated_device.diff b/disable_emulated_device.diff index f3d5fca..a93c8bf 100644 --- a/disable_emulated_device.diff +++ b/disable_emulated_device.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.3-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c =================================================================== ---- xen-4.1.3-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c -+++ xen-4.1.3-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +--- xen-4.2.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -424,6 +424,11 @@ static int __devinit platform_pci_init(s platform_mmio = mmio_addr; platform_mmiolen = mmio_len; diff --git a/dom-print.patch b/dom-print.patch index 63fd961..5795764 100644 --- a/dom-print.patch +++ b/dom-print.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/xen/arch/x86/domain.c +Index: xen-4.2.0-testing/xen/arch/x86/domain.c =================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/domain.c -+++ xen-4.1.2-testing/xen/arch/x86/domain.c -@@ -150,15 +150,30 @@ void dump_pageframe_info(struct domain * +--- xen-4.2.0-testing.orig/xen/arch/x86/domain.c ++++ xen-4.2.0-testing/xen/arch/x86/domain.c +@@ -148,15 +148,30 @@ void dump_pageframe_info(struct domain * printk("Memory pages belonging to domain %u:\n", d->domain_id); diff --git a/domu-usb-controller.patch b/domu-usb-controller.patch index 6b7abbc..0e70ba5 100644 --- a/domu-usb-controller.patch +++ b/domu-usb-controller.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py -@@ -1874,7 +1874,14 @@ class XendConfig(dict): +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendConfig.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py +@@ -1875,7 +1875,14 @@ class XendConfig(dict): ports = sxp.child(dev_sxp, 'port') for port in ports[1:]: try: diff --git a/hibernate.patch b/hibernate.patch index d016c52..64bd76c 100644 --- a/hibernate.patch +++ b/hibernate.patch @@ -1,14 +1,12 @@ -Index: xen-4.1.2-testing/tools/firmware/hvmloader/acpi/dsdt.asl +Index: xen-4.2.0-testing/tools/firmware/hvmloader/acpi/ssdt_s3.asl =================================================================== ---- xen-4.1.2-testing.orig/tools/firmware/hvmloader/acpi/dsdt.asl -+++ xen-4.1.2-testing/tools/firmware/hvmloader/acpi/dsdt.asl -@@ -30,21 +30,9 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, - /* - * S3 (suspend-to-ram), S4 (suspend-to-disc) and S5 (power-off) type codes: - * must match piix4 emulation. -+ * Turn off support for s3 and s4 sleep states to deal with SVVP tests. -+ * This is what MSFT does on HyperV. - */ +--- xen-4.2.0-testing.orig/tools/firmware/hvmloader/acpi/ssdt_s3.asl ++++ xen-4.2.0-testing/tools/firmware/hvmloader/acpi/ssdt_s3.asl +@@ -20,13 +20,9 @@ + + DefinitionBlock ("SSDT_S3.aml", "SSDT", 2, "Xen", "HVM", 0) + { +- /* Must match piix emulation */ - Name (\_S3, Package (0x04) - { - 0x01, /* PM1a_CNT.SLP_TYP */ @@ -16,6 +14,21 @@ Index: xen-4.1.2-testing/tools/firmware/hvmloader/acpi/dsdt.asl - 0x0, /* reserved */ - 0x0 /* reserved */ - }) ++ /* ++ * Turn off support for s3 sleep state to deal with SVVP tests. ++ * This is what MSFT does on HyperV. ++ */ + } + +Index: xen-4.2.0-testing/tools/firmware/hvmloader/acpi/ssdt_s4.asl +=================================================================== +--- xen-4.2.0-testing.orig/tools/firmware/hvmloader/acpi/ssdt_s4.asl ++++ xen-4.2.0-testing/tools/firmware/hvmloader/acpi/ssdt_s4.asl +@@ -20,13 +20,9 @@ + + DefinitionBlock ("SSDT_S4.aml", "SSDT", 2, "Xen", "HVM", 0) + { +- /* Must match piix emulation */ - Name (\_S4, Package (0x04) - { - 0x00, /* PM1a_CNT.SLP_TYP */ @@ -23,6 +36,9 @@ Index: xen-4.1.2-testing/tools/firmware/hvmloader/acpi/dsdt.asl - 0x00, /* reserved */ - 0x00 /* reserved */ - }) - Name (\_S5, Package (0x04) - { - 0x00, /* PM1a_CNT.SLP_TYP */ ++ /* ++ * Turn off support for s4 sleep state to deal with SVVP tests. ++ * This is what MSFT does on HyperV. ++ */ + } + diff --git a/hotplug.losetup.patch b/hotplug.losetup.patch deleted file mode 100644 index 0f44e46..0000000 --- a/hotplug.losetup.patch +++ /dev/null @@ -1,34 +0,0 @@ -Improve busy loop device detection after changeset 22773:02c0af2bf280 - -The intention is not to find the file to be mounted in the losetup -a -output. What matters are existing mounted files with the same dev:inode -as the new file. So the fix is to apply variable expansion which -happens only without double quotes. Otherwise $dev will contain -newlines for hardlinked files, as mentioned in the commit message from -the changeset above. - -losetup -a does also truncate long filenames to 62 chars due to ioctl -limitations. This part is fixed with 2.6.37 where the filename can be -obtained from sysfs. As a result very long filenames will be missed. - -Signed-off-by: Olaf Hering - ---- - tools/hotplug/Linux/block | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/hotplug/Linux/block -=================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/block -+++ xen-4.1.2-testing/tools/hotplug/Linux/block -@@ -280,8 +280,8 @@ mount it read-write in a guest domain." - fi - - shared_list=$(losetup -a | -- sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[${dev}\]:${inode}[[:blank:]](${file})\)@\1@p" ) -- for dev in "$shared_list" -+ sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[0*${dev}\]:${inode}[[:blank:]](.*)\)@\1@p" ) -+ for dev in $shared_list - do - if [ -n "$dev" ] - then diff --git a/hv_extid_compatibility.patch b/hv_extid_compatibility.patch index d757343..f9f45b9 100644 --- a/hv_extid_compatibility.patch +++ b/hv_extid_compatibility.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendConfig.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py @@ -159,6 +159,7 @@ XENAPI_PLATFORM_CFG_TYPES = { 'nographic': int, 'nomigrate': int, @@ -19,11 +19,11 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py if 'viridian' not in self['platform']: self['platform']['viridian'] = 0 if 'rtc_timeoffset' not in self['platform']: -Index: xen-4.1.2-testing/tools/python/xen/xend/image.py +Index: xen-4.2.0-testing/tools/python/xen/xend/image.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/image.py -+++ xen-4.1.2-testing/tools/python/xen/xend/image.py -@@ -839,6 +839,7 @@ class HVMImageHandler(ImageHandler): +--- xen-4.2.0-testing.orig/tools/python/xen/xend/image.py ++++ xen-4.2.0-testing/tools/python/xen/xend/image.py +@@ -828,6 +828,7 @@ class HVMImageHandler(ImageHandler): self.apic = int(vmConfig['platform'].get('apic', 0)) self.acpi = int(vmConfig['platform'].get('acpi', 0)) @@ -31,10 +31,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/image.py self.guest_os_type = vmConfig['platform'].get('guest_os_type') self.memory_sharing = int(vmConfig['memory_sharing']) try: -Index: xen-4.1.2-testing/tools/python/xen/xm/create.py +Index: xen-4.2.0-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.1.2-testing/tools/python/xen/xm/create.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/create.py ++++ xen-4.2.0-testing/tools/python/xen/xm/create.py @@ -242,6 +242,10 @@ gopts.var('viridian', val='VIRIDIAN', use="""Expose Viridian interface to x86 HVM guest? (Default is 0).""") @@ -46,7 +46,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/create.py gopts.var('acpi', val='ACPI', fn=set_int, default=1, use="Disable or enable ACPI of HVM domain.") -@@ -1106,7 +1110,7 @@ def configure_hvm(config_image, vals): +@@ -1111,7 +1115,7 @@ def configure_hvm(config_image, vals): 'timer_mode', 'usb', 'usbdevice', 'vcpus', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten', @@ -55,7 +55,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/create.py 'watchdog', 'watchdog_action', 'xauthority', 'xen_extended_power_mgmt', 'xen_platform_pci', 'memory_sharing' ] -@@ -1116,6 +1120,10 @@ def configure_hvm(config_image, vals): +@@ -1121,6 +1125,10 @@ def configure_hvm(config_image, vals): config_image.append([a, vals.__dict__[a]]) if vals.vncpasswd is not None: config_image.append(['vncpasswd', vals.vncpasswd]) diff --git a/init.xendomains b/init.xendomains index 1e20612..0b1abc5 100644 --- a/init.xendomains +++ b/init.xendomains @@ -21,17 +21,11 @@ . /etc/rc.status rc_reset +LOCKFILE=/var/lock/subsys/xendomains XENDOM_CONFIG=/etc/sysconfig/xendomains RETCODE_FILE=/tmp/xendomains.rc.$$ xm_cmd=echo -# See docs/misc/distro_mapping.txt -if [ -d /var/lock/subsys ]; then - LOCKFILE=/var/lock/subsys/xendomains -else - LOCKFILE=/var/lock/xendomains -fi - . "$XENDOM_CONFIG" shopt -s dotglob nullglob diff --git a/ioemu-7615-qcow2-fix-alloc_cluster_link_l2.patch b/ioemu-7615-qcow2-fix-alloc_cluster_link_l2.patch index 87d656f..99e520b 100644 --- a/ioemu-7615-qcow2-fix-alloc_cluster_link_l2.patch +++ b/ioemu-7615-qcow2-fix-alloc_cluster_link_l2.patch @@ -17,10 +17,10 @@ qcow2 image (the header is gone after three loop iterations): Signed-off-by: Kevin Wolf -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block-qcow2.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block-qcow2.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/block-qcow2.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/block-qcow2.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/block-qcow2.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block-qcow2.c @@ -916,7 +916,7 @@ static int alloc_cluster_link_l2(BlockDr goto err; diff --git a/ioemu-9868-MSI-X.patch b/ioemu-9868-MSI-X.patch deleted file mode 100644 index 877bc64..0000000 --- a/ioemu-9868-MSI-X.patch +++ /dev/null @@ -1,247 +0,0 @@ -# HG changeset patch -# User Ian Jackson -# Date 1324565191 0 -# Node ID 11ca857d983420a9f54e4d0e6919f8e6bd5fca48 -# Parent 533ebc61dfef98d55f054c97ec30179660214852 -qemu: clean up MSI-X table handling - -This patch does cleaning up of QEMU MSI handling. The fixes are: -1. Changes made to MSI-X table mapping handling to eliminate the small -windows in which guest could have access to physical MSI-X table. -2. MSI-X table is mapped as read-only to QEMU, as masking of MSI-X is -already in Xen now. -3. For registers that coexists inside the MSI-X table (this could be -only PBA I think), value read from physical page would be returned. - -Signed-off-by: Shan Haitao - -Consolidated duplicate code into _pt_iomem_helper(). Fixed formatting. - -Signed-off-by: Jan Beulich - -Acked-by: Haitao Shan -Acked-by: Stefano Stabellini - -committer: Ian Jackson - -Index: xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/pass-through.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/ioemu-qemu-xen/hw/pass-through.c -+++ xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/pass-through.c -@@ -92,6 +92,7 @@ - - #include - #include -+#include - - extern int gfx_passthru; - int igd_passthru = 0; -@@ -1097,6 +1098,44 @@ uint8_t pci_intx(struct pt_dev *ptdev) - return r_val; - } - -+static int _pt_iomem_helper(struct pt_dev *assigned_device, int i, -+ uint32_t e_base, uint32_t e_size, int op) -+{ -+ if ( has_msix_mapping(assigned_device, i) ) -+ { -+ uint32_t msix_last_pfn = (assigned_device->msix->mmio_base_addr - 1 + -+ assigned_device->msix->total_entries * 16) >> XC_PAGE_SHIFT; -+ uint32_t bar_last_pfn = (e_base + e_size - 1) >> XC_PAGE_SHIFT; -+ int ret = 0; -+ -+ if ( assigned_device->msix->table_off ) -+ ret = xc_domain_memory_mapping(xc_handle, domid, -+ e_base >> XC_PAGE_SHIFT, -+ assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT, -+ (assigned_device->msix->mmio_base_addr >> XC_PAGE_SHIFT) -+ - (e_base >> XC_PAGE_SHIFT), op); -+ -+ if ( ret == 0 && msix_last_pfn != bar_last_pfn ) -+ { -+ assert(msix_last_pfn < bar_last_pfn); -+ ret = xc_domain_memory_mapping(xc_handle, domid, -+ msix_last_pfn + 1, -+ (assigned_device->bases[i].access.maddr + -+ assigned_device->msix->table_off + -+ assigned_device->msix->total_entries * 16 + -+ XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT, -+ bar_last_pfn - msix_last_pfn, op); -+ } -+ -+ return ret; -+ } -+ -+ return xc_domain_memory_mapping(xc_handle, domid, -+ e_base >> XC_PAGE_SHIFT, -+ assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT, -+ (e_size + XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT, op); -+} -+ - /* Being called each time a mmio region has been updated */ - static void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, - int type) -@@ -1118,13 +1157,11 @@ static void pt_iomem_map(PCIDevice *d, i - - if ( !first_map && old_ebase != -1 ) - { -- add_msix_mapping(assigned_device, i); -- /* Remove old mapping */ -- ret = xc_domain_memory_mapping(xc_handle, domid, -- old_ebase >> XC_PAGE_SHIFT, -- assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT, -- (e_size+XC_PAGE_SIZE-1) >> XC_PAGE_SHIFT, -- DPCI_REMOVE_MAPPING); -+ if ( has_msix_mapping(assigned_device, i) ) -+ unregister_iomem(assigned_device->msix->mmio_base_addr); -+ -+ ret = _pt_iomem_helper(assigned_device, i, old_ebase, e_size, -+ DPCI_REMOVE_MAPPING); - if ( ret != 0 ) - { - PT_LOG("Error: remove old mapping failed!\n"); -@@ -1135,22 +1172,26 @@ static void pt_iomem_map(PCIDevice *d, i - /* map only valid guest address */ - if (e_phys != -1) - { -- /* Create new mapping */ -- ret = xc_domain_memory_mapping(xc_handle, domid, -- assigned_device->bases[i].e_physbase >> XC_PAGE_SHIFT, -- assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT, -- (e_size+XC_PAGE_SIZE-1) >> XC_PAGE_SHIFT, -- DPCI_ADD_MAPPING); -+ if ( has_msix_mapping(assigned_device, i) ) -+ { -+ assigned_device->msix->mmio_base_addr = -+ assigned_device->bases[i].e_physbase -+ + assigned_device->msix->table_off; -+ -+ cpu_register_physical_memory(assigned_device->msix->mmio_base_addr, -+ (assigned_device->msix->total_entries * 16 + XC_PAGE_SIZE - 1) -+ & XC_PAGE_MASK, -+ assigned_device->msix->mmio_index); -+ } - -+ ret = _pt_iomem_helper(assigned_device, i, e_phys, e_size, -+ DPCI_ADD_MAPPING); - if ( ret != 0 ) - { - PT_LOG("Error: create new mapping failed!\n"); -+ return; - } - -- ret = remove_msix_mapping(assigned_device, i); -- if ( ret != 0 ) -- PT_LOG("Error: remove MSI-X mmio mapping failed!\n"); -- - if ( old_ebase != e_phys && old_ebase != -1 ) - pt_msix_update_remap(assigned_device, i); - } -Index: xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/pt-msi.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/ioemu-qemu-xen/hw/pt-msi.c -+++ xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/pt-msi.c -@@ -284,15 +284,6 @@ void pt_disable_msi_translate(struct pt_ - dev->msi_trans_en = 0; - } - --/* MSI-X virtulization functions */ --static void mask_physical_msix_entry(struct pt_dev *dev, int entry_nr, int mask) --{ -- void *phys_off; -- -- phys_off = dev->msix->phys_iomem_base + 16 * entry_nr + 12; -- *(uint32_t *)phys_off = mask; --} -- - static int pt_msix_update_one(struct pt_dev *dev, int entry_nr) - { - struct msix_entry_info *entry = &dev->msix->msix_entry[entry_nr]; -@@ -486,7 +477,6 @@ static void pci_msix_writel(void *opaque - { - if ( msix->enabled && !(val & 0x1) ) - pt_msix_update_one(dev, entry_nr); -- mask_physical_msix_entry(dev, entry_nr, entry->io_mem[3] & 0x1); - } - } - -@@ -519,7 +509,11 @@ static uint32_t pci_msix_readl(void *opa - entry_nr = (addr - msix->mmio_base_addr) / 16; - offset = ((addr - msix->mmio_base_addr) % 16) / 4; - -- return msix->msix_entry[entry_nr].io_mem[offset]; -+ if ( addr - msix->mmio_base_addr < msix->total_entries * 16 ) -+ return msix->msix_entry[entry_nr].io_mem[offset]; -+ else -+ return *(uint32_t *)(msix->phys_iomem_base + -+ (addr - msix->mmio_base_addr)); - } - - static CPUReadMemoryFunc *pci_msix_read[] = { -@@ -528,39 +522,12 @@ static CPUReadMemoryFunc *pci_msix_read[ - pci_msix_readl - }; - --int add_msix_mapping(struct pt_dev *dev, int bar_index) -+int has_msix_mapping(struct pt_dev *dev, int bar_index) - { - if ( !(dev->msix && dev->msix->bar_index == bar_index) ) - return 0; - -- return xc_domain_memory_mapping(xc_handle, domid, -- dev->msix->mmio_base_addr >> XC_PAGE_SHIFT, -- (dev->bases[bar_index].access.maddr -- + dev->msix->table_off) >> XC_PAGE_SHIFT, -- (dev->msix->total_entries * 16 -- + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT, -- DPCI_ADD_MAPPING); --} -- --int remove_msix_mapping(struct pt_dev *dev, int bar_index) --{ -- if ( !(dev->msix && dev->msix->bar_index == bar_index) ) -- return 0; -- -- dev->msix->mmio_base_addr = dev->bases[bar_index].e_physbase -- + dev->msix->table_off; -- -- cpu_register_physical_memory(dev->msix->mmio_base_addr, -- dev->msix->total_entries * 16, -- dev->msix->mmio_index); -- -- return xc_domain_memory_mapping(xc_handle, domid, -- dev->msix->mmio_base_addr >> XC_PAGE_SHIFT, -- (dev->bases[bar_index].access.maddr -- + dev->msix->table_off) >> XC_PAGE_SHIFT, -- (dev->msix->total_entries * 16 -- + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT, -- DPCI_REMOVE_MAPPING); -+ return 1; - } - - int pt_msix_init(struct pt_dev *dev, int pos) -@@ -616,7 +583,7 @@ int pt_msix_init(struct pt_dev *dev, int - PT_LOG("table_off = %x, total_entries = %d\n", table_off, total_entries); - dev->msix->table_offset_adjust = table_off & 0x0fff; - dev->msix->phys_iomem_base = mmap(0, total_entries * 16 + dev->msix->table_offset_adjust, -- PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED, -+ PROT_READ, MAP_SHARED | MAP_LOCKED, - fd, dev->msix->table_base + table_off - dev->msix->table_offset_adjust); - dev->msix->phys_iomem_base = (void *)((char *)dev->msix->phys_iomem_base + - dev->msix->table_offset_adjust); -Index: xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/pt-msi.h -=================================================================== ---- xen-4.1.3-testing.orig/tools/ioemu-qemu-xen/hw/pt-msi.h -+++ xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/pt-msi.h -@@ -109,10 +109,7 @@ void - pt_msix_disable(struct pt_dev *dev); - - int --remove_msix_mapping(struct pt_dev *dev, int bar_index); -- --int --add_msix_mapping(struct pt_dev *dev, int bar_index); -+has_msix_mapping(struct pt_dev *dev, int bar_index); - - int - pt_msix_init(struct pt_dev *dev, int pos); diff --git a/ioemu-9869-MSI-X-init.patch b/ioemu-9869-MSI-X-init.patch deleted file mode 100644 index f47849d..0000000 --- a/ioemu-9869-MSI-X-init.patch +++ /dev/null @@ -1,53 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1325783746 0 -# Node ID db6c7b83d4165ada5498339b87031a09f5b79d8a -# Parent 11ca857d983420a9f54e4d0e6919f8e6bd5fca48 -qemu-xen: fix sequence of operations in pt_msix_init() - -Checking the return value of mmap() must be done before adjusting the -value, otherwise failure may not be detected. - -Closing the file handle, on the other hand, can be done before checking -the return value. - -Finally, printing the errno value without knowing whether the previous -function actually failed is bogus (and superfluous since a subsequent -message prints the strerror() representaton anyway). - -Signed-off-by: Jan Beulich -Acked-by: Stefano Stabellini - -committer: Ian Jackson - ---- a/tools/ioemu-qemu-xen/hw/pt-msi.c -+++ b/tools/ioemu-qemu-xen/hw/pt-msi.c -@@ -537,7 +537,6 @@ int pt_msix_init(struct pt_dev *dev, int - int i, total_entries, table_off, bar_index; - struct pci_dev *pd = dev->pci_dev; - int fd; -- int err; - - id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID); - -@@ -585,17 +584,14 @@ int pt_msix_init(struct pt_dev *dev, int - dev->msix->phys_iomem_base = mmap(0, total_entries * 16 + dev->msix->table_offset_adjust, - PROT_READ, MAP_SHARED | MAP_LOCKED, - fd, dev->msix->table_base + table_off - dev->msix->table_offset_adjust); -- dev->msix->phys_iomem_base = (void *)((char *)dev->msix->phys_iomem_base + -- dev->msix->table_offset_adjust); -- err = errno; -- PT_LOG("errno = %d\n",err); -+ close(fd); - if ( dev->msix->phys_iomem_base == MAP_FAILED ) - { - PT_LOG("Error: Can't map physical MSI-X table: %s\n", strerror(errno)); -- close(fd); - goto error_out; - } -- close(fd); -+ -+ dev->msix->phys_iomem_base += dev->msix->table_offset_adjust; - - PT_LOG("mapping physical MSI-X table to %lx\n", - (unsigned long)dev->msix->phys_iomem_base); diff --git a/ioemu-9873-MSI-X-fix-unregister_iomem.patch b/ioemu-9873-MSI-X-fix-unregister_iomem.patch deleted file mode 100644 index ef0c866..0000000 --- a/ioemu-9873-MSI-X-fix-unregister_iomem.patch +++ /dev/null @@ -1,57 +0,0 @@ -qemu-dm: fix unregister_iomem() -References: bnc#744014 - -This function (introduced quite a long time ago in -e7911109f4321e9ba0cc56a253b653600aa46bea - "disable qemu PCI -devices in HVM domains") appears to be completely broken, causing -the regression reported in -http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1805 (due to -the newly added caller of it in -56d7747a3cf811910c4cf865e1ebcb8b82502005 - "qemu: clean up -MSI-X table handling"). It's unclear how the function can ever have -fulfilled its purpose: the value returned by iomem_index() is *not* an -index into mmio[]. - -Additionally, fix two problems: -- unregister_iomem() must not clear mmio[].start, otherwise - cpu_register_physical_memory() won't be able to re-use the previous - slot, thus causing a leak -- cpu_unregister_io_memory() must not check mmio[].size, otherwise it - won't properly clean up entries (temporarily) squashed through - unregister_iomem() - -Signed-off-by: Jan Beulich -Tested-by: Stefano Stabellini -Tested-by: Yongjie Ren - ---- a/tools/ioemu-qemu-xen/i386-dm/exec-dm.c -+++ b/tools/ioemu-qemu-xen/i386-dm/exec-dm.c -@@ -360,7 +360,7 @@ void cpu_unregister_io_memory(int io_tab - int io_index = io_table_address >> IO_MEM_SHIFT; - - for (i = 0; i < mmio_cnt; i++) { -- if (mmio[i].size && mmio[i].io_index == io_index) { -+ if (mmio[i].io_index == io_index) { - mmio[i].start = mmio[i].size = 0; - break; - } -@@ -466,12 +466,16 @@ static int iomem_index(target_phys_addr_ - - void unregister_iomem(target_phys_addr_t start) - { -- int index = iomem_index(start); -- if (index) { -+ unsigned int index; -+ -+ for (index = 0; index < mmio_cnt; index++) -+ if (start == mmio[index].start) -+ break; -+ if (index < mmio_cnt) { - fprintf(logfile, "squash iomem [%lx, %lx).\n", - (unsigned long)(mmio[index].start), - (unsigned long)(mmio[index].start + mmio[index].size)); -- mmio[index].start = mmio[index].size = 0; -+ mmio[index].size = 0; - } - } - diff --git a/ioemu-9877-MSI-X-device-cleanup.patch b/ioemu-9877-MSI-X-device-cleanup.patch deleted file mode 100644 index 4a68756..0000000 --- a/ioemu-9877-MSI-X-device-cleanup.patch +++ /dev/null @@ -1,73 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1333384536 -3600 -# Node ID c39da254d7b9a029080e970508a6aebac4e01220 -# Parent 40274e03bcbf22d9456f8526d488bc47b1917246 -qemu-traditional/passthrough: adjust MSI-X device cleanup (bug 1809) - -To address http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1809, -pt_unregister_regions() also needs to use the newly introduced -_pt_iomem_helper() instead of calling xc_domain_memory_mapping() -directly, to take into consideration the hole created for the MSI-X -table. - -For this to work, two calls in unregister_real_device() need to be -swapped, since otherwise we'd have - -unregister_real_device() - -> pt_config_delete() - -> pt_msix_delete() (frees [and fails to clear] ->msix) - -> pt_unregister_regions() - -> _pt_iomem_helper() (with the patch below) - -> has_msix_mapping() (uses ->msix) - -And to be certain to prevent (catch) further/future use-after-free -instances, let's also clear dev->msix in pt_msix_delete(). - -Signed-off-by: Jan Beulich -Tested-by: Yongjie Ren -Acked-by: Stefano Stabellini - -committer: Ian Jackson - ---- a/tools/ioemu-qemu-xen/hw/pass-through.c -+++ b/tools/ioemu-qemu-xen/hw/pass-through.c -@@ -1988,11 +1988,9 @@ static void pt_unregister_regions(struct - if ( type == PCI_ADDRESS_SPACE_MEM || - type == PCI_ADDRESS_SPACE_MEM_PREFETCH ) - { -- ret = xc_domain_memory_mapping(xc_handle, domid, -- assigned_device->bases[i].e_physbase >> XC_PAGE_SHIFT, -- assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT, -- (e_size+XC_PAGE_SIZE-1) >> XC_PAGE_SHIFT, -- DPCI_REMOVE_MAPPING); -+ ret = _pt_iomem_helper(assigned_device, i, -+ assigned_device->bases[i].e_physbase, -+ e_size, DPCI_REMOVE_MAPPING); - if ( ret != 0 ) - { - PT_LOG("Error: remove old mem mapping failed!\n"); -@@ -4425,12 +4423,12 @@ static int unregister_real_device(int de - } - } - -- /* delete all emulated config registers */ -- pt_config_delete(assigned_device); -- - /* unregister real device's MMIO/PIO BARs */ - pt_unregister_regions(assigned_device); - -+ /* delete all emulated config registers */ -+ pt_config_delete(assigned_device); -+ - pt_iomul_free(assigned_device); - - /* mark this devfn as free */ ---- a/tools/ioemu-qemu-xen/hw/pt-msi.c -+++ b/tools/ioemu-qemu-xen/hw/pt-msi.c -@@ -621,4 +621,5 @@ void pt_msix_delete(struct pt_dev *dev) - - - free(dev->msix); -+ dev->msix = NULL; - } diff --git a/ioemu-bdrv-open-CACHE_WB.patch b/ioemu-bdrv-open-CACHE_WB.patch index 664bc83..136a971 100644 --- a/ioemu-bdrv-open-CACHE_WB.patch +++ b/ioemu-bdrv-open-CACHE_WB.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -259,8 +259,11 @@ static int open_disk(struct td_state *s, +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c +@@ -247,8 +247,11 @@ static int open_disk(struct td_state *s, drv = blktap_drivers[i].drv; DPRINTF("%s driver specified\n", drv ? drv->format_name : "No"); diff --git a/ioemu-blktap-barriers.patch b/ioemu-blktap-barriers.patch index 91e398f..6019138 100644 --- a/ioemu-blktap-barriers.patch +++ b/ioemu-blktap-barriers.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c @@ -360,6 +360,15 @@ static void qemu_send_responses(void* op } diff --git a/ioemu-blktap-fv-init.patch b/ioemu-blktap-fv-init.patch index 669367d..5217502 100644 --- a/ioemu-blktap-fv-init.patch +++ b/ioemu-blktap-fv-init.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_machine_fv.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_machine_fv.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c -@@ -269,6 +269,7 @@ void qemu_invalidate_entry(uint8_t *buff +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_machine_fv.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_machine_fv.c +@@ -270,6 +270,7 @@ void qemu_invalidate_entry(uint8_t *buff #endif /* defined(MAPCACHE) */ @@ -10,7 +10,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, -@@ -294,6 +295,11 @@ static void xen_init_fv(ram_addr_t ram_s +@@ -295,6 +296,11 @@ static void xen_init_fv(ram_addr_t ram_s } #endif diff --git a/ioemu-blktap-image-format.patch b/ioemu-blktap-image-format.patch index 516352c..933416f 100644 --- a/ioemu-blktap-image-format.patch +++ b/ioemu-blktap-image-format.patch @@ -15,11 +15,11 @@ Signed-off-by: Kevin Wolf hw/xen_blktap.h | 14 ++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -230,9 +230,10 @@ static int map_new_dev(struct td_state * +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c +@@ -218,9 +218,10 @@ static int map_new_dev(struct td_state * return -1; } @@ -31,7 +31,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c char* devname; static int devnumber = 0; int i; -@@ -242,7 +243,22 @@ static int open_disk(struct td_state *s, +@@ -230,7 +231,22 @@ static int open_disk(struct td_state *s, bs = bdrv_new(devname); free(devname); @@ -64,11 +64,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c msglen = sizeof(msg_hdr_t); msg->type = CTLMSG_IMG_FAIL; msg->len = msglen; -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.h =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h -@@ -53,4 +53,18 @@ typedef struct fd_list_entry { +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.h +@@ -52,4 +52,18 @@ typedef struct fd_list_entry { int init_blktap(void); diff --git a/ioemu-blktap-zero-size.patch b/ioemu-blktap-zero-size.patch index 438a649..a4877fc 100644 --- a/ioemu-blktap-zero-size.patch +++ b/ioemu-blktap-zero-size.patch @@ -12,11 +12,11 @@ Signed-off-by: Kevin Wolf hw/xen_blktap.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -268,6 +268,12 @@ static int open_disk(struct td_state *s, +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c +@@ -256,6 +256,12 @@ static int open_disk(struct td_state *s, s->size = bs->total_sectors; s->sector_size = 512; @@ -28,11 +28,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c + s->info = ((s->flags & TD_RDONLY) ? VDISK_READONLY : 0); - return 0; -Index: xen-4.1.2-testing/tools/python/xen/xend/server/DevController.py + #ifndef QEMU_TOOL +Index: xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/server/DevController.py -+++ xen-4.1.2-testing/tools/python/xen/xend/server/DevController.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/server/DevController.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py @@ -155,7 +155,7 @@ class DevController: (devid, self.deviceClass)) diff --git a/ioemu-debuginfo.patch b/ioemu-debuginfo.patch index 98bac18..ab35dbe 100644 --- a/ioemu-debuginfo.patch +++ b/ioemu-debuginfo.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/Makefile -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/Makefile ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile @@ -243,7 +243,7 @@ endif install: all $(if $(BUILD_DOCS),install-doc) mkdir -p "$(DESTDIR)$(bindir)" @@ -11,10 +11,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile endif ifneq ($(BLOBS),) mkdir -p "$(DESTDIR)$(datadir)" -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile.target +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/Makefile.target -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile.target +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/Makefile.target ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target @@ -755,7 +755,7 @@ clean: install: all install-hook diff --git a/ioemu-disable-emulated-ide-if-pv.patch b/ioemu-disable-emulated-ide-if-pv.patch index ce41e81..4415743 100644 --- a/ioemu-disable-emulated-ide-if-pv.patch +++ b/ioemu-disable-emulated-ide-if-pv.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/qemu-xen.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h @@ -1,6 +1,8 @@ #ifndef QEMU_XEN_H #define QEMU_XEN_H @@ -11,7 +11,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h /* vl.c */ extern int restore; extern int vga_ram_size; -@@ -75,7 +77,7 @@ void handle_buffered_pio(void); +@@ -65,7 +67,7 @@ void handle_buffered_pio(void); /* xenstore.c */ void xenstore_init(void); uint32_t xenstore_read_target(void); @@ -20,11 +20,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h int xenstore_parse_disable_pf_config(void); int xenstore_fd(void); void xenstore_process_event(void *opaque); -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vl.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c -@@ -5852,9 +5852,9 @@ int main(int argc, char **argv, char **e +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c +@@ -5862,9 +5862,9 @@ int main(int argc, char **argv, char **e if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s))) fprintf(stderr,"Can not read our own domid: %s\n", msg); else @@ -36,11 +36,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c #endif /* CONFIG_STUBDOM */ } -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -448,7 +448,7 @@ void xenstore_init(void) +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +@@ -445,7 +445,7 @@ void xenstore_init(void) } } @@ -49,7 +49,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c { char **e_danger = NULL; char *buf = NULL; -@@ -761,15 +761,19 @@ void xenstore_parse_domain_config(int hv +@@ -733,15 +733,19 @@ void xenstore_parse_domain_config(int hv #endif diff --git a/ioemu-disable-scsi.patch b/ioemu-disable-scsi.patch index 392e76c..bfdc8ed 100644 --- a/ioemu-disable-scsi.patch +++ b/ioemu-disable-scsi.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_platform.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c @@ -359,6 +359,8 @@ static void platform_ioport_write(void * case 4: fprintf(logfile, "Disconnect IDE hard disk...\n"); @@ -11,11 +11,11 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c fprintf(logfile, "Disconnect netifs...\n"); pci_unplug_netifs(); fprintf(logfile, "Shutdown taps...\n"); -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h -@@ -57,6 +57,7 @@ void unset_vram_mapping(void *opaque); +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/qemu-xen.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h +@@ -47,6 +47,7 @@ void unset_vram_mapping(void *opaque); #endif void pci_unplug_netifs(void); @@ -23,10 +23,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h void destroy_hvm_domain(void); void unregister_iomem(target_phys_addr_t start); -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pci.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pci.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/pci.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pci.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/pci.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pci.c @@ -871,6 +871,50 @@ void pci_unplug_netifs(void) } } diff --git a/ioemu-vnc-resize.patch b/ioemu-vnc-resize.patch index 1c1b3d2..144e9ea 100644 --- a/ioemu-vnc-resize.patch +++ b/ioemu-vnc-resize.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vnc.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c @@ -1734,6 +1734,25 @@ static int protocol_client_msg(VncState } diff --git a/ioemu-watchdog-ib700-timer.patch b/ioemu-watchdog-ib700-timer.patch index cdcff78..de0e813 100644 --- a/ioemu-watchdog-ib700-timer.patch +++ b/ioemu-watchdog-ib700-timer.patch @@ -14,10 +14,10 @@ qemu_del_timer(). Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_ib700.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/wdt_ib700.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_ib700.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c @@ -93,6 +93,7 @@ static int ib700_load(QEMUFile *f, void /* Create and initialize a virtual IB700 during PC creation. */ static void ib700_pc_init(PCIBus *unused) diff --git a/ioemu-watchdog-linkage.patch b/ioemu-watchdog-linkage.patch index dfc8849..eedd81b 100644 --- a/ioemu-watchdog-linkage.patch +++ b/ioemu-watchdog-linkage.patch @@ -7,10 +7,10 @@ Git: 88b3be201acf64e0bd19782bebd533901c951c87 Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/watchdog.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c @@ -26,6 +26,16 @@ #include "sysemu.h" #include "hw/watchdog.h" @@ -28,10 +28,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.c static LIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; void watchdog_add_model(WatchdogTimerModel *model) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/watchdog.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.h +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h @@ -27,13 +27,6 @@ extern void wdt_i6300esb_init(void); extern void wdt_ib700_init(void); @@ -57,10 +57,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.h /* in hw/watchdog.c */ extern int select_watchdog(const char *p); extern int select_watchdog_action(const char *action); -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vl.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c @@ -250,8 +250,6 @@ int no_shutdown = 0; int cursor_hide = 1; int graphic_rotate = 0; diff --git a/ioemu-watchdog-support.patch b/ioemu-watchdog-support.patch index 8589348..7bb5266 100644 --- a/ioemu-watchdog-support.patch +++ b/ioemu-watchdog-support.patch @@ -10,10 +10,10 @@ everything that was raised about the previous version ... Signed-off-by: Richard W.M. Jones Signed-off-by: Anthony Liguori -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile.target +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/Makefile.target -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile.target +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/Makefile.target ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target @@ -580,6 +580,10 @@ OBJS += e1000.o # Serial mouse OBJS += msmouse.o @@ -25,10 +25,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/Makefile.target ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support ifdef CONFIG_AUDIO -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/pc.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/pc.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c @@ -41,6 +41,7 @@ #include "virtio-balloon.h" #include "virtio-console.h" @@ -46,10 +46,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c @@ -0,0 +1,136 @@ +/* + * Virtual hardware watchdog. @@ -187,10 +187,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.c + wdt_ib700_init(); + wdt_i6300esb_init(); +} -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h @@ -0,0 +1,65 @@ +/* + * Virtual hardware watchdog. @@ -257,10 +257,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/watchdog.h +extern void register_watchdogs(void); + +#endif /* QEMU_WATCHDOG_H */ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_i6300esb.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_i6300esb.c =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_i6300esb.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_i6300esb.c @@ -0,0 +1,470 @@ +/* + * Virtual hardware watchdog. @@ -732,10 +732,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_i6300esb.c +{ + watchdog_add_model(&model); +} -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_ib700.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_ib700.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c @@ -0,0 +1,112 @@ +/* + * Virtual hardware watchdog. @@ -849,10 +849,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/wdt_ib700.c + watchdog_add_model(&model); + timer = qemu_new_timer(vm_clock, ib700_timer_expired, NULL); +} -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/monitor.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/monitor.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/monitor.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/monitor.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/monitor.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/monitor.c @@ -26,6 +26,7 @@ #include "hw/pcmcia.h" #include "hw/pc.h" @@ -884,10 +884,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/monitor.c { "cpu_set", "is", do_cpu_set_nr, "cpu [online|offline]", "change cpu state" }, { NULL, NULL, }, -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/vl.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c @@ -30,6 +30,7 @@ #include "hw/isa.h" #include "hw/baum.h" @@ -905,7 +905,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c const char *option_rom[MAX_OPTION_ROMS]; int nb_option_roms; int semihosting_enabled = 0; -@@ -4167,6 +4170,10 @@ static void help(int exitcode) +@@ -4177,6 +4180,10 @@ static void help(int exitcode) "-startdate select initial date of the clock\n" "-icount [N|auto]\n" " enable virtual instruction counter with 2^N clock ticks per instruction\n" @@ -916,7 +916,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c "-echr chr set terminal escape character instead of ctrl-a\n" "-virtioconsole c\n" " set virtio console\n" -@@ -4314,6 +4321,8 @@ enum { +@@ -4324,6 +4331,8 @@ enum { QEMU_OPTION_localtime, QEMU_OPTION_startdate, QEMU_OPTION_icount, @@ -925,7 +925,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c QEMU_OPTION_echr, QEMU_OPTION_virtiocon, QEMU_OPTION_show_cursor, -@@ -4440,6 +4449,8 @@ static const QEMUOption qemu_options[] = +@@ -4450,6 +4459,8 @@ static const QEMUOption qemu_options[] = { "localtime", 0, QEMU_OPTION_localtime }, { "startdate", HAS_ARG, QEMU_OPTION_startdate }, { "icount", HAS_ARG, QEMU_OPTION_icount }, @@ -934,7 +934,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c { "echr", HAS_ARG, QEMU_OPTION_echr }, { "virtioconsole", HAS_ARG, QEMU_OPTION_virtiocon }, { "show-cursor", 0, QEMU_OPTION_show_cursor }, -@@ -4941,6 +4952,8 @@ int main(int argc, char **argv, char **e +@@ -4951,6 +4962,8 @@ int main(int argc, char **argv, char **e tb_size = 0; autostart= 1; @@ -943,7 +943,7 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/vl.c optind = 1; for(;;) { if (optind >= argc) -@@ -5315,6 +5328,17 @@ int main(int argc, char **argv, char **e +@@ -5325,6 +5338,17 @@ int main(int argc, char **argv, char **e serial_devices[serial_device_index] = optarg; serial_device_index++; break; diff --git a/ipxe-enable-nics.patch b/ipxe-enable-nics.patch index 8eb996e..4306289 100644 --- a/ipxe-enable-nics.patch +++ b/ipxe-enable-nics.patch @@ -1,17 +1,9 @@ -Index: xen-4.1.2-testing/tools/firmware/etherboot/Config +Index: xen-4.2.0-testing/tools/firmware/etherboot/Config =================================================================== ---- xen-4.1.2-testing.orig/tools/firmware/etherboot/Config -+++ xen-4.1.2-testing/tools/firmware/etherboot/Config -@@ -1,11 +1,8 @@ - --NICS = rtl8139 8086100e +--- xen-4.2.0-testing.orig/tools/firmware/etherboot/Config ++++ xen-4.2.0-testing/tools/firmware/etherboot/Config +@@ -1,3 +1,4 @@ +NICS = rtl8139 8086100e eepro100 e1000 pcnet32 10ec8029 CFLAGS += -UPXE_DHCP_STRICT CFLAGS += -DPXE_DHCP_STRICT - - CFLAGS += -UNO_POST_PROMPT - CFLAGS += -DNO_POST_PROMPT -- --CFLAGS += -UCONSOLE_SERIAL --CFLAGS += -DCONSOLE_SERIAL=1 diff --git a/ipxe-gcc45-warnings.patch b/ipxe-gcc45-warnings.patch index e451fab..eff4232 100644 --- a/ipxe-gcc45-warnings.patch +++ b/ipxe-gcc45-warnings.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-f7c5918b179b +Index: xen-4.2.0-testing/tools/firmware/etherboot/patches/ipxe-git-f7c5918b179b =================================================================== --- /dev/null -+++ xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-f7c5918b179b ++++ xen-4.2.0-testing/tools/firmware/etherboot/patches/ipxe-git-f7c5918b179b @@ -0,0 +1,61 @@ + +Subject: [drivers] Fix warnings identified by gcc 4.5 @@ -64,12 +64,10 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-f7c5918b179b + + return 1; + } -Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/series +Index: xen-4.2.0-testing/tools/firmware/etherboot/patches/series =================================================================== ---- xen-4.1.3-testing.orig/tools/firmware/etherboot/patches/series -+++ xen-4.1.3-testing/tools/firmware/etherboot/patches/series -@@ -3,3 +3,4 @@ gpxe-git-0edf2405b457 - gpxe-git-a803ef3dfeac - gpxe-git-b8924c1aed51 - gpxe-git-fe61f6de0dd5 +--- xen-4.2.0-testing.orig/tools/firmware/etherboot/patches/series ++++ xen-4.2.0-testing/tools/firmware/etherboot/patches/series +@@ -1 +1,2 @@ + boot_prompt_option.patch +ipxe-git-f7c5918b179b diff --git a/ipxe-ipv4-fragment.patch b/ipxe-ipv4-fragment.patch index 026d1c5..5816ddd 100644 --- a/ipxe-ipv4-fragment.patch +++ b/ipxe-ipv4-fragment.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 +Index: xen-4.2.0-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 =================================================================== ---- /dev/null 2010-08-26 08:28:41.000000000 -0600 -+++ xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 2012-06-19 09:29:52.000000000 -0600 -@@ -0,0 +1,357 @@ +--- /dev/null ++++ xen-4.2.0-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 +@@ -0,0 +1,354 @@ +commit 13186b64b6c3d5cbe9ed13bda1532e79b1afe81d +Author: Michael Brown +Date: Sat Jul 16 01:15:53 2011 +0100 @@ -12,14 +12,13 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 + Signed-off-by: Michael Brown + Signed-off-by: Michal Kubecek + -+Index: ipxe/src/include/gpxe/ip.h -+=================================================================== -+--- ipxe.orig/src/include/gpxe/ip.h -++++ ipxe/src/include/gpxe/ip.h ++diff -up a/src/include/gpxe/ip.h.orig-frag b/src/include/gpxe/ip.h ++--- a/src/include/gpxe/ip.h.orig-frag 2010-02-02 17:12:44.000000000 +0100 +++++ b/src/include/gpxe/ip.h 2011-11-18 15:49:17.202660163 +0100 +@@ -32,9 +32,6 @@ struct net_protocol; + #define IP_TOS 0 + #define IP_TTL 64 -+ ++ +-#define IP_FRAG_IOB_SIZE 1500 +-#define IP_FRAG_TIMEOUT 50 +- @@ -29,7 +28,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 +@@ -74,20 +71,16 @@ struct ipv4_miniroute { + struct in_addr gateway; + }; -+ ++ +-/* Fragment reassembly buffer */ +-struct frag_buffer { +- /* Identification number */ @@ -53,16 +52,15 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++ /** Reassembly timer */ ++ struct retry_timer timer; + }; -+ ++ + extern struct list_head ipv4_miniroutes; -+Index: ipxe/src/include/gpxe/retry.h -+=================================================================== -+--- ipxe.orig/src/include/gpxe/retry.h -++++ ipxe/src/include/gpxe/retry.h ++diff -up a/src/include/gpxe/retry.h.orig-frag b/src/include/gpxe/retry.h ++--- a/src/include/gpxe/retry.h.orig-frag 2010-02-02 17:12:44.000000000 +0100 +++++ b/src/include/gpxe/retry.h 2011-11-18 15:59:25.258837891 +0100 +@@ -51,6 +51,19 @@ struct retry_timer { + void ( * expired ) ( struct retry_timer *timer, int over ); + }; -+ ++ ++/** ++ * Initialise a timer ++ * @@ -79,39 +77,38 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 + extern void start_timer ( struct retry_timer *timer ); + extern void start_timer_fixed ( struct retry_timer *timer, + unsigned long timeout ); -+Index: ipxe/src/net/ipv4.c -+=================================================================== -+--- ipxe.orig/src/net/ipv4.c -++++ ipxe/src/net/ipv4.c ++diff -up a/src/net/ipv4.c.orig-frag b/src/net/ipv4.c ++--- a/src/net/ipv4.c.orig-frag 2010-02-02 17:12:44.000000000 +0100 +++++ b/src/net/ipv4.c 2011-11-18 15:49:17.203660142 +0100 +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include -+ ++ + /** @file + * +@@ -32,7 +33,10 @@ struct net_protocol ipv4_protocol; + struct list_head ipv4_miniroutes = LIST_HEAD_INIT ( ipv4_miniroutes ); -+ ++ + /** List of fragment reassembly buffers */ +-static LIST_HEAD ( frag_buffers ); ++static LIST_HEAD ( ipv4_fragments ); ++ ++/** Fragment reassembly timeout */ ++#define IP_FRAG_TIMEOUT ( TICKS_PER_SEC / 2 ) -+ ++ + /** + * Add IPv4 minirouting table entry +@@ -134,104 +138,126 @@ static struct ipv4_miniroute * ipv4_rout + } -+ ++ + /** +- * Fragment reassembly counter timeout ++ * Expire fragment reassembly buffer + * +- * @v timer Retry timer -+- * @v over If asserted, the timer is greater than @c MAX_TIMEOUT ++- * @v over If asserted, the timer is greater than @c MAX_TIMEOUT ++ * @v timer Retry timer ++ * @v fail Failure indicator + */ @@ -132,7 +129,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++ list_del ( &frag->list ); ++ free ( frag ); + } -+ ++ + /** +- * Free fragment buffer ++ * Find matching fragment reassembly buffer @@ -158,7 +155,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++ ++ return NULL; + } -+ ++ + /** + * Fragment reassembler + * @@ -171,7 +168,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++static struct io_buffer * ipv4_reassemble ( struct io_buffer *iobuf ) { + struct iphdr *iphdr = iobuf->data; +- struct frag_buffer *fragbuf; -+- ++- +- /** +- * Check if the fragment belongs to any fragment series +- */ @@ -180,12 +177,12 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 +- fragbuf->src.s_addr == iphdr->src.s_addr ) { +- /** +- * Check if the packet is the expected fragment -+- * ++- * +- * The offset of the new packet must be equal to the +- * length of the data accumulated so far (the length of +- * the reassembled I/O buffer +- */ -+- if ( iob_len ( fragbuf->frag_iob ) == ++- if ( iob_len ( fragbuf->frag_iob ) == +- ( iphdr->frags & IP_MASK_OFFSET ) ) { +- /** +- * Append the contents of the fragment to the @@ -254,11 +251,11 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++ goto drop; + } +- } -+- ++- +- /** Check if the fragment is the first in the fragment series */ +- if ( iphdr->frags & IP_MASK_MOREFRAGS && +- ( ( iphdr->frags & IP_MASK_OFFSET ) == 0 ) ) { -+- ++- +- /** Create a new fragment buffer */ +- fragbuf = ( struct frag_buffer* ) malloc ( sizeof( *fragbuf ) ); +- fragbuf->ident = iphdr->ident; @@ -278,14 +275,14 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 + free_iob ( iobuf ); ++ iphdr = frag->iobuf->data; ++ iphdr->len = ntohs ( iob_len ( frag->iobuf ) ); -+ ++ +- /* Set the reassembly timer */ +- fragbuf->frag_timer.timeout = IP_FRAG_TIMEOUT; +- fragbuf->frag_timer.expired = ipv4_frag_expired; +- start_timer ( &fragbuf->frag_timer ); ++ /* Stop fragment reassembly timer */ ++ stop_timer ( &frag->timer ); -+ ++ +- /* Add the fragment buffer to the list of fragment buffers */ +- list_add ( &fragbuf->list, &frag_buffers ); ++ /* If this is the final fragment, return it */ @@ -296,7 +293,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++ return iobuf; ++ } + } -+- ++- ++ ++ /* (Re)start fragment reassembly timer */ ++ start_timer_fixed ( &frag->timer, IP_FRAG_TIMEOUT ); @@ -307,11 +304,11 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++ free_iob ( iobuf ); + return NULL; + } -+ ++ +@@ -432,37 +458,38 @@ static int ipv4_rx ( struct io_buffer *i + goto err; + } -+ ++ ++ /* Truncate packet to correct length */ ++ iob_unput ( iobuf, ( iob_len ( iobuf ) - len ) ); ++ @@ -320,7 +317,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 + DBG ( "%s len %d proto %d id %04x csum %04x\n", + inet_ntoa ( iphdr->src ), ntohs ( iphdr->len ), iphdr->protocol, + ntohs ( iphdr->ident ), ntohs ( iphdr->chksum ) ); -+ ++ +- /* Truncate packet to correct length, calculate pseudo-header +- * checksum and then strip off the IPv4 header. +- */ @@ -329,7 +326,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 +- iob_pull ( iobuf, hdrlen ); +- +- /* Fragment reassembly */ -+- if ( ( iphdr->frags & htons ( IP_MASK_MOREFRAGS ) ) || ++- if ( ( iphdr->frags & htons ( IP_MASK_MOREFRAGS ) ) || +- ( ( iphdr->frags & htons ( IP_MASK_OFFSET ) ) != 0 ) ) { +- /* Pass the fragment to ipv4_reassemble() which either +- * returns a fully reassembled I/O buffer or NULL. @@ -344,7 +341,7 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 ++ iphdr = iobuf->data; ++ hdrlen = ( ( iphdr->verhdrlen & IP_MASK_HLEN ) * 4 ); + } -+ ++ +- /* Construct socket addresses and hand off to transport layer */ ++ /* Construct socket addresses, calculate pseudo-header ++ * checksum, and hand off to transport layer @@ -360,12 +357,10 @@ Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 + if ( ( rc = tcpip_rx ( iobuf, iphdr->protocol, &src.st, + &dest.st, pshdr_csum ) ) != 0 ) { + DBG ( "IPv4 received packet rejected by stack: %s\n", -Index: xen-4.1.3-testing/tools/firmware/etherboot/patches/series +Index: xen-4.2.0-testing/tools/firmware/etherboot/patches/series =================================================================== ---- xen-4.1.3-testing.orig/tools/firmware/etherboot/patches/series -+++ xen-4.1.3-testing/tools/firmware/etherboot/patches/series -@@ -4,3 +4,4 @@ gpxe-git-a803ef3dfeac - gpxe-git-b8924c1aed51 - gpxe-git-fe61f6de0dd5 - ipxe-git-f7c5918b179b +--- xen-4.2.0-testing.orig/tools/firmware/etherboot/patches/series ++++ xen-4.2.0-testing/tools/firmware/etherboot/patches/series +@@ -1 +1,2 @@ + boot_prompt_option.patch +ipxe-git-13186b64b6c3 diff --git a/ipxe.tar.bz2 b/ipxe.tar.bz2 new file mode 100644 index 0000000..f5efa59 --- /dev/null +++ b/ipxe.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71ec2c199f41fe74e647f4065df60d99cc62ed684ef37f4267a457a2f65b1aff +size 2877265 diff --git a/kernel-boot-hvm.patch b/kernel-boot-hvm.patch index 45bf557..969f4c5 100644 --- a/kernel-boot-hvm.patch +++ b/kernel-boot-hvm.patch @@ -4,10 +4,10 @@ kernel and initrd, which could be accessed by hvmloader. Signed-off-by: Chunyan Liu -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/block.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/block.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/block.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block.c @@ -596,6 +596,16 @@ int bdrv_read(BlockDriverState *bs, int6 if (bdrv_check_request(bs, sector_num, nb_sectors)) @@ -79,10 +79,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block.c ret = drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block_int.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block_int.h =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/block_int.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/block_int.h +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/block_int.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block_int.h @@ -122,6 +122,9 @@ struct BlockDriverState { BlockDriver *drv; /* NULL means no media */ void *opaque; @@ -93,10 +93,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block_int.h char filename[1024]; char backing_file[1024]; /* if non zero, the image is a diff of this file image */ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/pc.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/pc.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c @@ -474,45 +474,28 @@ static void bochs_bios_init(void) /* Generate an initial boot sector which sets state and jump to @@ -231,10 +231,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1); i8259 = i8259_init(cpu_irq[0]); ferr_irq = i8259[13]; -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/block.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block.h =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/block.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/block.h +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/block.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/block.h @@ -82,6 +82,7 @@ int64_t bdrv_getlength(BlockDriverState void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr); void bdrv_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int *psecs); diff --git a/libxen_permissive.patch b/libxen_permissive.patch index ec9c752..16b32e3 100644 --- a/libxen_permissive.patch +++ b/libxen_permissive.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/libxen/src/xen_common.c +Index: xen-4.2.0-testing/tools/libxen/src/xen_common.c =================================================================== ---- xen-4.1.2-testing.orig/tools/libxen/src/xen_common.c -+++ xen-4.1.2-testing/tools/libxen/src/xen_common.c +--- xen-4.2.0-testing.orig/tools/libxen/src/xen_common.c ++++ xen-4.2.0-testing/tools/libxen/src/xen_common.c @@ -904,8 +904,15 @@ static void parse_into(xen_session *s, x 0 != strcmp((char *)value_node->children->name, "struct") || value_node->children->children == NULL) diff --git a/log-guest-console.patch b/log-guest-console.patch index 32cef51..0dd986a 100644 --- a/log-guest-console.patch +++ b/log-guest-console.patch @@ -6,10 +6,10 @@ Signed-off-by: Chunyan Liu hw/xen_console.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-) -Index: xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/xen_console.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_console.c =================================================================== ---- xen-4.1.3-testing.orig/tools/ioemu-qemu-xen/hw/xen_console.c -+++ xen-4.1.3-testing/tools/ioemu-qemu-xen/hw/xen_console.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_console.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_console.c @@ -38,6 +38,8 @@ #include "qemu-char.h" #include "xen_backend.h" diff --git a/magic_ioport_compat.patch b/magic_ioport_compat.patch index ab65848..ff7b80a 100644 --- a/magic_ioport_compat.patch +++ b/magic_ioport_compat.patch @@ -2,10 +2,10 @@ Make our PV drivers work with older hosts that do not recognize the new PV driv Signed-off-by: K. Y. Srinivasan -Index: xen-4.1.2-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c =================================================================== ---- xen-4.1.2-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c -+++ xen-4.1.2-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +--- xen-4.2.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -321,7 +321,10 @@ static int check_platform_magic(struct d if (magic != XEN_IOPORT_MAGIC_VAL) { diff --git a/minios-fixups.patch b/minios-fixups.patch index 2dfc11e..90f5572 100644 --- a/minios-fixups.patch +++ b/minios-fixups.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/extras/mini-os/lib/math.c +Index: xen-4.2.0-testing/extras/mini-os/lib/math.c =================================================================== ---- xen-4.1.2-testing.orig/extras/mini-os/lib/math.c -+++ xen-4.1.2-testing/extras/mini-os/lib/math.c -@@ -187,6 +187,7 @@ __qdivrem(uint64_t uq, uint64_t vq, uint +--- xen-4.2.0-testing.orig/extras/mini-os/lib/math.c ++++ xen-4.2.0-testing/extras/mini-os/lib/math.c +@@ -190,6 +190,7 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_qu * and thus * m = 4 - n <= 2 */ diff --git a/multi-xvdp.patch b/multi-xvdp.patch index 4d305b4..ca615b6 100644 --- a/multi-xvdp.patch +++ b/multi-xvdp.patch @@ -5,10 +5,10 @@ bootloader loopback device. This patch creates a list of bootloader loopback devices so more than one instance of bootloader can be run concurrently. -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -74,7 +74,7 @@ from xen.xend.XendPSCSI import XendPSCSI from xen.xend.XendDSCSI import XendDSCSI, XendDSCSI_HBA @@ -18,7 +18,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py xc = xen.lowlevel.xc.xc() xoptions = XendOptions.instance() -@@ -3301,33 +3301,38 @@ class XendDomainInfo: +@@ -3308,33 +3308,38 @@ class XendDomainInfo: # This is a file, not a device. pygrub can cope with a # file if it's raw, but if it's QCOW or other such formats # used through blktap, then we need to mount it first. diff --git a/network-nat-open-SuSEfirewall2-FORWARD.patch b/network-nat-open-SuSEfirewall2-FORWARD.patch index e2ef968..1613584 100644 --- a/network-nat-open-SuSEfirewall2-FORWARD.patch +++ b/network-nat-open-SuSEfirewall2-FORWARD.patch @@ -1,9 +1,9 @@ Open SuSEfirewall2 FORWARD rule when use xen nat -Index: xen-4.1.2-testing/tools/hotplug/Linux/network-nat +Index: xen-4.2.0-testing/tools/hotplug/Linux/network-nat =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/network-nat -+++ xen-4.1.2-testing/tools/hotplug/Linux/network-nat +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/network-nat ++++ xen-4.2.0-testing/tools/hotplug/Linux/network-nat @@ -83,6 +83,7 @@ function dhcp_stop() op_start() { echo 1 >/proc/sys/net/ipv4/ip_forward diff --git a/network-nat.patch b/network-nat.patch index b7b1a95..9565e95 100644 --- a/network-nat.patch +++ b/network-nat.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/network-nat +Index: xen-4.2.0-testing/tools/hotplug/Linux/network-nat =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/network-nat -+++ xen-4.1.2-testing/tools/hotplug/Linux/network-nat +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/network-nat ++++ xen-4.2.0-testing/tools/hotplug/Linux/network-nat @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash diff --git a/pv-driver-build.patch b/pv-driver-build.patch new file mode 100644 index 0000000..3bebe7d --- /dev/null +++ b/pv-driver-build.patch @@ -0,0 +1,9 @@ +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/blkfront/Kbuild +=================================================================== +--- xen-4.2.0-testing.orig/unmodified_drivers/linux-2.6/blkfront/Kbuild ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/blkfront/Kbuild +@@ -3,3 +3,4 @@ include $(M)/overrides.mk + obj-m += xen-vbd.o + + xen-vbd-objs := blkfront.o vbd.o ++xen-vbd-objs += $(patsubst %.c,%.o,$(notdir $(wildcard $(src)/vcd.c))) diff --git a/pvdrv-import-shared-info.patch b/pvdrv-import-shared-info.patch index 323f715..8c1534b 100644 --- a/pvdrv-import-shared-info.patch +++ b/pvdrv-import-shared-info.patch @@ -1,5 +1,7 @@ ---- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c -+++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/evtchn.c +=================================================================== +--- xen-4.2.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/evtchn.c ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/evtchn.c @@ -40,7 +40,9 @@ #include #endif @@ -10,8 +12,10 @@ #define is_valid_evtchn(x) ((x) != 0) #define evtchn_from_irq(x) (irq_evtchn[irq].evtchn) ---- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c -+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +=================================================================== +--- xen-4.2.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -76,7 +76,6 @@ static uint64_t callback_via; static int __devinit init_xen_info(void) { @@ -40,8 +44,10 @@ return 0; } ---- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h -+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h +=================================================================== +--- xen-4.2.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h @@ -27,6 +27,11 @@ unsigned long alloc_xen_mmio(unsigned long len); void platform_pci_resume(void); diff --git a/pvdrv_emulation_control.patch b/pvdrv_emulation_control.patch index 71cd97f..92044e0 100644 --- a/pvdrv_emulation_control.patch +++ b/pvdrv_emulation_control.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_platform.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c @@ -365,6 +365,19 @@ static void platform_ioport_write(void * net_tap_shutdown_all(); fprintf(logfile, "Done.\n"); diff --git a/qemu-dm-segfault.patch b/qemu-dm-segfault.patch index dc73bba..307a881 100644 --- a/qemu-dm-segfault.patch +++ b/qemu-dm-segfault.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/ide.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/ide.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/ide.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/ide.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/ide.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/ide.c @@ -935,8 +935,9 @@ static inline void ide_dma_submit_check( static inline void ide_set_irq(IDEState *s) diff --git a/qemu-security-etch1.diff b/qemu-security-etch1.diff index f807a85..e01992f 100644 --- a/qemu-security-etch1.diff +++ b/qemu-security-etch1.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/ne2000.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/ne2000.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/ne2000.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/ne2000.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/ne2000.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/ne2000.c @@ -218,7 +218,7 @@ static int ne2000_can_receive(void *opaq NE2000State *s = opaque; @@ -11,10 +11,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/ne2000.c return !ne2000_buffer_full(s); } -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/pc.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/pc.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/pc.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c @@ -413,7 +413,8 @@ static void bochs_bios_write(void *opaqu case 0x400: case 0x401: diff --git a/qemu-xen-dir-remote.tar.bz2 b/qemu-xen-dir-remote.tar.bz2 new file mode 100644 index 0000000..42a616c --- /dev/null +++ b/qemu-xen-dir-remote.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e638878f86a530319b0c391bf34f90361939afbfa99650cbd2e0a1ac58dd2417 +size 5111841 diff --git a/qemu-xen-traditional-dir-remote.tar.bz2 b/qemu-xen-traditional-dir-remote.tar.bz2 new file mode 100644 index 0000000..8c29116 --- /dev/null +++ b/qemu-xen-traditional-dir-remote.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:207a214e0234add0748fc12b186e365d1ebfb082a045e762563136dee1eb39e1 +size 3210667 diff --git a/seabios-dir-remote.tar.bz2 b/seabios-dir-remote.tar.bz2 new file mode 100644 index 0000000..af01e0e --- /dev/null +++ b/seabios-dir-remote.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19c94171a349b7983e30beb82e393f92074359e44282600310967f7deae590b2 +size 356370 diff --git a/serial-split.patch b/serial-split.patch index e5cf597..c2f7d21 100644 --- a/serial-split.patch +++ b/serial-split.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/misc/serial-split/Makefile +Index: xen-4.2.0-testing/tools/misc/serial-split/Makefile =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/misc/serial-split/Makefile ++++ xen-4.2.0-testing/tools/misc/serial-split/Makefile @@ -0,0 +1,20 @@ +CC ?= gcc +CFLAGS ?= -Wall -Os @@ -23,10 +23,10 @@ Index: xen-4.1.2-testing/tools/misc/serial-split/Makefile + +%.o: %.c Makefile + $(CC) $(CFLAGS) -c -o $@ $< -Index: xen-4.1.2-testing/tools/misc/serial-split/serial-split.c +Index: xen-4.2.0-testing/tools/misc/serial-split/serial-split.c =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/misc/serial-split/serial-split.c ++++ xen-4.2.0-testing/tools/misc/serial-split/serial-split.c @@ -0,0 +1,422 @@ +/* + * serial-split.c diff --git a/snapshot-ioemu-delete.patch b/snapshot-ioemu-delete.patch deleted file mode 100644 index 09c921a..0000000 --- a/snapshot-ioemu-delete.patch +++ /dev/null @@ -1,75 +0,0 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -978,6 +978,18 @@ static void xenstore_process_dm_command_ - } - - snapshot_name = xs_read(xsh, XBT_NULL, path, &len); -+ } else if (!strncmp(command, "snapshot-delete", len)) { -+ if (pasprintf(&path, -+ "/local/domain/0/device-model/%u/parameter", domid) == -1) { -+ fprintf(logfile, "out of memory reading dm command parameter\n"); -+ goto out; -+ } -+ par = xs_read(xsh, XBT_NULL, path, &len); -+ if (!par) -+ goto out; -+ if (delete_disk_snapshots(par) == 0) -+ xenstore_record_dm_state("snapshot-deleted"); -+ free(par); - } else if (!strncmp(command, "continue", len)) { - fprintf(logfile, "dm-command: continue after state save\n"); - xen_pause_requested = 0; -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/savevm.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/savevm.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/savevm.c -@@ -1106,6 +1106,35 @@ the_end: - return ret; - } - -+int delete_disk_snapshots(const char* name) -+{ -+ BlockDriverState *bs, *bs1; -+ int i, ret; -+ -+ bs = get_bs_snapshots(); -+ if (!bs) { -+ xenstore_record_dm_error("No block device supports snapshots"); -+ return -1; -+ } -+ -+ for(i = 0; i <= nb_drives; i++) { -+ bs1 = drives_table[i].bdrv; -+ if (bdrv_has_snapshot(bs1)) { -+ ret = bdrv_snapshot_delete(bs1, name); -+ if (ret < 0) { -+ if (ret == -ENOTSUP) -+ fprintf(stderr, "Snapshots not supported on device '%s'\n", -+ bdrv_get_device_name(bs1)); -+ else -+ fprintf(stderr, "Error %d while deleting snapshot on " -+ "'%s'\n", ret, bdrv_get_device_name(bs1)); -+ } -+ } -+ } -+ -+ return 0; -+} -+ - #ifndef CONFIG_DM - - void do_savevm(const char *name) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h -@@ -42,6 +42,7 @@ enum { - - /* xen-vl-extra.c */ - int save_disk_snapshots(const char* name); -+int delete_disk_snapshots(const char* name); - - /* helper2.c */ - extern long time_offset; diff --git a/snapshot-ioemu-restore.patch b/snapshot-ioemu-restore.patch deleted file mode 100644 index 64920fe..0000000 --- a/snapshot-ioemu-restore.patch +++ /dev/null @@ -1,72 +0,0 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -103,6 +103,8 @@ int xenstore_watch_new_callback(const ch - } - - -+char* get_snapshot_name(int devid); -+ - static int pasprintf(char **buf, const char *fmt, ...) - { - va_list ap; -@@ -714,8 +716,33 @@ void xenstore_parse_domain_config(int hv - - fprintf(stderr, "Using file %s in read-%s mode\n", bs->filename, is_readonly ? "only" : "write"); - -- if (bdrv_open2(bs, params, flags, format) < 0) -+ if (bdrv_open2(bs, params, BDRV_O_CACHE_WB /* snapshot and write-back */, format) < 0) { - fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?", format ? format->format_name : "0"); -+ } else { -+ char* snapshot = get_snapshot_name(atoi(e_danger[i])); -+ if (snapshot) { -+ fprintf(stderr, "Using snapshot %s\n", snapshot); -+ ret = bdrv_snapshot_goto(bs, snapshot); -+ switch (ret) { -+ case 0: -+ /* Success */ -+ break; -+ case -ENOTSUP: -+ /* Don't abort here (could be read-only ISO) */ -+ fprintf(stderr, "Snapshots are not supported for " -+ "this image file format\n"); -+ break; -+ case -ENOENT: -+ fprintf(stderr, "No such snapshot, skipping this " -+ "image file\n"); -+ continue; -+ default: -+ fprintf(stderr, "Could not load snapshot, skipping" -+ " this image file\n"); -+ continue; -+ } -+ } -+ } - } - - #endif -@@ -845,6 +872,23 @@ int xenstore_parse_disable_pf_config () - return disable_pf; - } - -+ -+char* get_snapshot_name(int devid) -+{ -+ char* path = NULL; -+ char* name = NULL; -+ unsigned int len; -+ -+ if (pasprintf(&path, -+ "/local/domain/0/backend/tap/%u/%u/snapshot", domid, devid) == -1) -+ return NULL; -+ name = xs_read(xsh, XBT_NULL, path, &len); -+ -+ free(path); -+ return name; -+} -+ -+ - int xenstore_fd(void) - { - if (xsh) diff --git a/snapshot-ioemu-save.patch b/snapshot-ioemu-save.patch deleted file mode 100644 index ee74b47..0000000 --- a/snapshot-ioemu-save.patch +++ /dev/null @@ -1,251 +0,0 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/savevm.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/savevm.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/savevm.c -@@ -28,6 +28,7 @@ - #include "sysemu.h" - #include "qemu-timer.h" - #include "qemu-char.h" -+#include "block_int.h" - #include "block.h" - #include "audio/audio.h" - #include "migration.h" -@@ -1025,6 +1026,86 @@ static int bdrv_snapshot_find(BlockDrive - return ret; - } - -+int save_disk_snapshots(const char* name) -+{ -+ BlockDriverState *bs; -+ QEMUSnapshotInfo sn, old_sn; -+ struct timeval tv; -+ int saved_vm_running; -+ int can_snapshot; -+ int i; -+ int ret = 0; -+ -+ /* Deal with all aio submit */ -+ qemu_aio_flush(); -+ /* Do fsync at backend fs */ -+ ret = bdrv_flush_all(); -+ if (ret) -+ fprintf(stderr, "Fsync error[%d] when do snapshot[%s]\n", ret, name); -+ -+ saved_vm_running = vm_running; -+ vm_stop(0); -+ -+ /* Ensure that all images support snapshots or are read-only */ -+ for(i = 0; i < MAX_DRIVES; i++) { -+ bs = drives_table[i].bdrv; -+ -+ if (!bs || !bs->drv) -+ continue; -+ -+ can_snapshot = bs->drv->bdrv_snapshot_create && bdrv_can_snapshot(bs); -+ if (!bdrv_is_read_only(bs) && !can_snapshot) { -+ fprintf(stderr, "Error: bdrv %s (%s) doesn't support snapshots\n", -+ bdrv_get_device_name(bs), bs->drv->format_name); -+ ret = -ENOTSUP; -+ goto the_end; -+ } -+ } -+ -+ /* fill auxiliary fields */ -+ memset(&sn, 0, sizeof(sn)); -+ gettimeofday(&tv, NULL); -+ sn.date_sec = tv.tv_sec; -+ sn.date_nsec = tv.tv_usec * 1000; -+ sn.vm_clock_nsec = qemu_get_clock(vm_clock); -+ pstrcpy(sn.name, sizeof(sn.name), name); -+ -+ for(i = 0; i < MAX_DRIVES; i++) { -+ bs = drives_table[i].bdrv; -+ -+ /* No snapshots on read-only images */ -+ if (!bs || !bs->drv || bdrv_is_read_only(bs)) -+ continue; -+ -+ /* Delete old snapshot of the same name */ -+ if (bdrv_snapshot_find(bs, &old_sn, name) >= 0) { -+ ret = bdrv_snapshot_delete(bs, old_sn.id_str); -+ if (ret < 0) { -+ fprintf(stderr, "Error while deleting snapshot on '%s'\n", -+ bdrv_get_device_name(bs)); -+ } -+ } -+ -+ /* Create the snapshot */ -+ fprintf(stderr, "Creating snapshot on '%s' (%s)\n", -+ bdrv_get_device_name(bs), bs->drv->format_name); -+ ret = bdrv_snapshot_create(bs, &sn); -+ if (ret < 0) { -+ fprintf(stderr, "Error while creating snapshot on '%s': %d (%s)\n", -+ bdrv_get_device_name(bs), ret, strerror(-ret)); -+ goto the_end; -+ } -+ } -+ -+ fprintf(stderr, "Created all snapshots\n"); -+ -+the_end: -+ if (saved_vm_running) -+ vm_start(); -+ -+ return ret; -+} -+ - #ifndef CONFIG_DM - - void do_savevm(const char *name) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/i386-dm/helper2.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/i386-dm/helper2.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/i386-dm/helper2.c -@@ -112,6 +112,9 @@ int send_vcpu = 0; - //the evtchn port for polling the notification, - evtchn_port_t *ioreq_local_port; - -+/** Name of the snapshot which should be saved */ -+char* snapshot_name; -+ - CPUX86State *cpu_x86_init(const char *cpu_model) - { - CPUX86State *env; -@@ -556,6 +559,7 @@ int main_loop(void) - int evtchn_fd = xce_handle == NULL ? -1 : xc_evtchn_fd(xce_handle); - char *qemu_file; - fd_set fds; -+ int ret; - - main_loop_prepare(); - -@@ -588,11 +592,43 @@ int main_loop(void) - main_loop_wait(1); /* For the select() on events */ - - /* Save the device state */ -- asprintf(&qemu_file, "/var/lib/xen/qemu-save.%d", domid); -- do_savevm(qemu_file); -- free(qemu_file); -+ switch (xen_pause_requested) { -+ case SUSPEND_SAVEVM: -+ asprintf(&qemu_file, "/var/lib/xen/qemu-save.%d", domid); -+ do_savevm(qemu_file); -+ free(qemu_file); -+ xenstore_record_dm_state("paused"); -+ break; -+ -+ case SUSPEND_SNAPSHOT: -+ if (snapshot_name != NULL) { -+ ret = save_disk_snapshots(snapshot_name); -+ free(snapshot_name); -+ snapshot_name = NULL; -+ -+ switch (ret) { -+ case 0: -+ xenstore_record_dm_state("paused"); -+ break; -+ case -ENOTSUP: -+ xenstore_record_dm_error("Snapshots not supported on all" -+ " attached read-write disks"); -+ break; -+ case -ENOENT: -+ xenstore_record_dm_error("A snapshot with the same name" -+ " already exists"); -+ break; -+ default: -+ xenstore_record_dm_error("An error occurred while saving" -+ " the snapshot"); -+ break; -+ } -+ } else { -+ xenstore_record_dm_error("No snapshot name given"); -+ } -+ break; -+ } - -- xenstore_record_dm_state("paused"); - - /* Wait to be allowed to continue */ - while (xen_pause_requested) { -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/qemu-xen.h -@@ -34,6 +34,15 @@ void qemu_invalidate_map_cache(void) - #define mapcache_lock() ((void)0) - #define mapcache_unlock() ((void)0) - -+/* Reason for xen_pause_requested */ -+enum { -+ SUSPEND_SAVEVM = 1, -+ SUSPEND_SNAPSHOT = 2 -+}; -+ -+/* xen-vl-extra.c */ -+int save_disk_snapshots(const char* name); -+ - /* helper2.c */ - extern long time_offset; - void timeoffset_get(void); -@@ -70,6 +79,7 @@ int xenstore_fd(void); - void xenstore_process_event(void *opaque); - void xenstore_record_dm(const char *subpath, const char *state); - void xenstore_record_dm_state(const char *state); -+void xenstore_record_dm_error(const char *errmsg); - void xenstore_check_new_media_present(int timeout); - void xenstore_read_vncpasswd(int domid, char *pwbuf, size_t pwbuflen); - void xenstore_write_vslots(char *vslots); -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -17,6 +17,7 @@ - - #include "exec-all.h" - #include "sysemu.h" -+#include "qemu-xen.h" - - #include "console.h" - #include "hw.h" -@@ -905,6 +906,7 @@ static void xenstore_process_dm_command_ - { - char *path = NULL, *command = NULL, *par = NULL; - unsigned int len; -+ extern char* snapshot_name; - - if (pasprintf(&path, - "/local/domain/0/device-model/%u/command", domid) == -1) { -@@ -920,7 +922,18 @@ static void xenstore_process_dm_command_ - - if (!strncmp(command, "save", len)) { - fprintf(logfile, "dm-command: pause and save state\n"); -- xen_pause_requested = 1; -+ xen_pause_requested = SUSPEND_SAVEVM; -+ } else if (!strncmp(command, "snapshot", len)) { -+ fprintf(logfile, "dm-command: pause and snapshot disks\n"); -+ xen_pause_requested = SUSPEND_SNAPSHOT; -+ -+ if (pasprintf(&path, -+ "/local/domain/0/device-model/%u/parameter", domid) == -1) { -+ fprintf(logfile, "out of memory reading dm command parameter\n"); -+ goto out; -+ } -+ -+ snapshot_name = xs_read(xsh, XBT_NULL, path, &len); - } else if (!strncmp(command, "continue", len)) { - fprintf(logfile, "dm-command: continue after state save\n"); - xen_pause_requested = 0; -@@ -1083,6 +1096,13 @@ static void xenstore_process_vcpu_set_ev - return; - } - -+void xenstore_record_dm_error(const char *errmsg) -+{ -+ fprintf(logfile, "%s\n", errmsg); -+ xenstore_record_dm("error", errmsg); -+ xenstore_record_dm_state("error"); -+} -+ - static void xenstore_process_media_change_event(char **vec) - { - char *media_present = NULL; diff --git a/snapshot-without-pv-fix.patch b/snapshot-without-pv-fix.patch deleted file mode 100644 index 75beb98..0000000 --- a/snapshot-without-pv-fix.patch +++ /dev/null @@ -1,394 +0,0 @@ -Subject: add the drive into drives_table[] only if guest is using PV driver - -now when blktapctrl asks qemu to add a device, it also set a watch -on the xenstore backend state path of the device, e.g. -/local/domain//device/vbd//state and when the -state changed to 4, that means guest is using the PV driver and it's -ready, so the watch will tell qemu to add the disk entry to -drives_table[], otherwise the disk in qemu will just stay opened,not -showing up in drives_table[]. - -Index: xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/blktapctrl.c -+++ xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c -@@ -380,7 +380,22 @@ static int write_msg(int fd, int msgtype - msg->cookie = blkif->cookie; - - break; -- -+ -+ case CTLMSG_ADDDEV: -+ DPRINTF("Write_msg called: CTLMSG_ADDDEV\n"); -+ -+ msglen = sizeof(msg_hdr_t); -+ buf = malloc(msglen); -+ -+ /*Assign header fields*/ -+ msg = (msg_hdr_t *)buf; -+ msg->type = CTLMSG_ADDDEV; -+ msg->len = msglen; -+ msg->drivertype = blkif->drivertype; -+ msg->cookie = blkif->cookie; -+ -+ break; -+ - default: - return -1; - } -@@ -475,6 +490,12 @@ static int read_msg(int fd, int msgtype, - DPRINTF("\tPID: [%d]\n",blkif->tappid); - } - break; -+ -+ case CTLMSG_ADDDEV_RSP: -+ DPRINTF("Received CTLMSG_ADDDEV_RSP\n"); -+ if (msgtype != CTLMSG_ADDDEV_RSP) ret = 0; -+ break; -+ - default: - DPRINTF("UNKNOWN MESSAGE TYPE RECEIVED\n"); - ret = 0; -@@ -757,6 +778,63 @@ static int unmap_blktapctrl(blkif_t *blk - return 0; - } - -+static int blktapctrl_blkif_state(blkif_t *blkif, XenbusState state) -+{ -+ struct disk_info *drivertype = NULL; -+ -+ if (!blkif) -+ return -EINVAL; -+ -+ switch (state) -+ { -+ case XenbusStateUnknown: -+ break; -+ -+ case XenbusStateInitialising: -+ break; -+ -+ case XenbusStateInitWait: -+ break; -+ -+ case XenbusStateInitialised: -+ break; -+ -+ case XenbusStateConnected: -+ drivertype = dtypes[blkif->drivertype]; -+ if (drivertype->use_ioemu && blkif->state == CONNECTED) { -+ if (write_msg(blkif->fds[WRITE], CTLMSG_ADDDEV, blkif, NULL) -+ <=0) { -+ DPRINTF("Write_msg failed - CTLMSG_ADDDEV\n"); -+ return -1; -+ } -+ if (read_msg(blkif->fds[READ], CTLMSG_ADDDEV_RSP, blkif) <= 0) { -+ DPRINTF("Read_msg failure - CTLMSG_ADDDEV\n"); -+ return -1; -+ } -+ } -+ -+ break; -+ -+ case XenbusStateClosing: -+ break; -+ -+ case XenbusStateClosed: -+ break; -+ -+ case XenbusStateReconfiguring: -+ break; -+ -+ case XenbusStateReconfigured: -+ break; -+ -+ default: -+ DPRINTF("Unrecognized XenbusState %d\n", state); -+ return -1; -+ } -+ -+ return 0; -+} -+ - int open_ctrl_socket(char *devname) - { - int ret; -@@ -853,6 +931,7 @@ int main(int argc, char *argv[]) - register_new_blkif_hook(blktapctrl_new_blkif); - register_new_devmap_hook(map_new_blktapctrl); - register_new_unmap_hook(unmap_blktapctrl); -+ register_blkif_state_hook(blktapctrl_blkif_state); - - ctlfd = blktap_interface_open(); - if (ctlfd < 0) { -Index: xen-4.1.2-testing/tools/blktap/lib/blkif.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/lib/blkif.c -+++ xen-4.1.2-testing/tools/blktap/lib/blkif.c -@@ -89,6 +89,11 @@ void register_new_blkif_hook(int (*fn)(b - { - new_blkif_hook = fn; - } -+static int (*blkif_state_hook)(blkif_t *blkif, XenbusState state) = NULL; -+void register_blkif_state_hook(int (*fn)(blkif_t *blkif, XenbusState state)) -+{ -+ blkif_state_hook = fn; -+} - - int blkif_init(blkif_t *blkif, long int handle, long int pdev, - long int readonly) -@@ -179,6 +184,24 @@ void free_blkif(blkif_t *blkif) - } - } - -+int blkif_handle_state(blkif_t *blkif, XenbusState state) -+{ -+ if (blkif == NULL) -+ return -EINVAL; -+ -+ if (blkif_state_hook == NULL) -+ { -+ DPRINTF("Probe handling blkif state, but no blkif_state_hook!\n"); -+ return -1; -+ } -+ if (blkif_state_hook(blkif, state)!=0) { -+ DPRINTF("BLKIF: blkif_state_hook failed!\n"); -+ return -1; -+ } -+ -+ return 0; -+} -+ - void __init_blkif(void) - { - memset(blkif_hash, 0, sizeof(blkif_hash)); -Index: xen-4.1.2-testing/tools/blktap/lib/blktaplib.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-4.1.2-testing/tools/blktap/lib/blktaplib.h -@@ -38,6 +38,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -138,11 +139,13 @@ typedef struct blkif_info { - void register_new_devmap_hook(int (*fn)(blkif_t *blkif)); - void register_new_unmap_hook(int (*fn)(blkif_t *blkif)); - void register_new_blkif_hook(int (*fn)(blkif_t *blkif)); -+void register_blkif_state_hook(int (*fn)(blkif_t *blkif, XenbusState state)); - blkif_t *blkif_find_by_handle(domid_t domid, unsigned int handle); - blkif_t *alloc_blkif(domid_t domid); - int blkif_init(blkif_t *blkif, long int handle, long int pdev, - long int readonly); - void free_blkif(blkif_t *blkif); -+int blkif_handle_state(blkif_t *blkif, XenbusState state); - void __init_blkif(void); - - typedef struct busy_state { -@@ -210,6 +213,8 @@ typedef struct msg_pid { - #define CTLMSG_CLOSE_RSP 8 - #define CTLMSG_PID 9 - #define CTLMSG_PID_RSP 10 -+#define CTLMSG_ADDDEV 11 -+#define CTLMSG_ADDDEV_RSP 12 - - /* disk driver types */ - #define MAX_DISK_TYPES 20 -Index: xen-4.1.2-testing/tools/blktap/lib/xenbus.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/lib/xenbus.c -+++ xen-4.1.2-testing/tools/blktap/lib/xenbus.c -@@ -318,6 +318,72 @@ static int check_image(struct xs_handle - return 0; - } - -+static void check_frontend_state(struct xs_handle *h, struct xenbus_watch *w, -+ const char *state_path_im) -+{ -+ struct backend_info *be = NULL; -+ struct blkif *blkif = NULL; -+ char *fepath = NULL, *bepath = NULL; -+ XenbusState state; -+ int er, len; -+ -+ len = strsep_len(state_path_im, '/', 6); -+ if (len < 0) -+ return; -+ if (!(fepath = malloc(len + 1))) -+ return; -+ memset(fepath, 0, len + 1); -+ strncpy(fepath, state_path_im, len); -+ -+ er = xs_gather(h, fepath, "state", "%d", &state, -+ "backend", NULL, &bepath, -+ NULL); -+ -+ if (er) { -+ DPRINTF("Error getting state [%s]\n", fepath); -+ goto free_fe; -+ } -+ -+ be = be_lookup_be(bepath); -+ if (!be || !be->blkif) -+ goto free_fe; -+ -+ blkif = be->blkif; -+ blkif_handle_state(blkif, state); -+ -+free_fe: -+ if (fepath) -+ free(fepath); -+ if (bepath) -+ free(bepath); -+ return; -+} -+ -+static int add_blockdevice_state_watch(struct xs_handle *h, const char *frontend) -+{ -+ char *path = NULL; -+ struct xenbus_watch *vbd_watch; -+ -+ if (asprintf(&path, frontend) == -1) -+ return -ENOMEM; -+ if (!(path = realloc(path, strlen(path) + strlen("/state") + 1))) -+ return -ENOMEM; -+ strcpy(path + strlen(path), "/state"); -+ -+ vbd_watch = (struct xenbus_watch *)malloc(sizeof(struct xenbus_watch)); -+ if (!vbd_watch) { -+ DPRINTF("ERROR: unable to malloc vbd_watch [%s]\n", path); -+ return -EINVAL; -+ } -+ vbd_watch->node = path; -+ vbd_watch->callback = check_frontend_state; -+ if (register_xenbus_watch(h, vbd_watch) != 0) { -+ DPRINTF("ERROR: adding vbd probe watch %s\n", path); -+ return -EINVAL; -+ } -+ return 0; -+} -+ - static void ueblktap_setup(struct xs_handle *h, char *bepath) - { - struct backend_info *be; -@@ -512,6 +578,9 @@ static void ueblktap_probe(struct xs_han - - be->backpath = bepath; - be->frontpath = frontend; -+ -+ if (add_blockdevice_state_watch(h, frontend) != 0) -+ goto free_be; - - list_add(&be->list, &belist); - -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -35,6 +35,8 @@ - #ifndef QEMU_TOOL - #include "qemu-common.h" - #include "sysemu.h" -+#include "irq.h" -+#include "hw.h" - #endif - - #include "xen_blktap.h" -@@ -81,8 +83,18 @@ static void unmap_disk(struct td_state * - { - tapdev_info_t *info = s->ring_info; - fd_list_entry_t *entry; -+ int i; - - bdrv_close(s->bs); -+#ifndef QEMU_TOOL -+ for (i = 0; i < MAX_DRIVES + 1; i++) { -+ if (drives_table[i].bdrv == s->bs) { -+ drives_table[i].bdrv = NULL; -+ nb_drives--; -+ break; -+ } -+ } -+#endif - - if (info != NULL && info->mem > 0) - munmap(info->mem, getpagesize() * BLKTAP_MMAP_REGION_SIZE); -@@ -242,18 +254,6 @@ static int open_disk(struct td_state *s, - - s->info = ((s->flags & TD_RDONLY) ? VDISK_READONLY : 0); - --#ifndef QEMU_TOOL -- for (i = 0; i < MAX_DRIVES + 1; i++) { -- if (drives_table[i].bdrv == NULL) { -- drives_table[i].bdrv = bs; -- drives_table[i].type = IF_BLKTAP; -- drives_table[i].bus = 0; -- drives_table[i].unit = 0; -- break; -- } -- } --#endif -- - return 0; - } - -@@ -494,7 +494,7 @@ static void handle_blktap_ctrlmsg(void* - msg_hdr_t *msg; - msg_newdev_t *msg_dev; - msg_pid_t *msg_pid; -- int ret = -1; -+ int ret = -1, i; - struct td_state *s = NULL; - fd_list_entry_t *entry; - -@@ -584,6 +584,33 @@ static void handle_blktap_ctrlmsg(void* - len = write(write_fd, buf, msglen); - break; - -+ case CTLMSG_ADDDEV: -+ s = get_state(msg->cookie); -+ if (s && !s->added) { -+#ifndef QEMU_TOOL -+ ide_unplug_harddisks(); -+ for (i = 0; i < MAX_DRIVES + 1; i++) { -+ if (drives_table[i].bdrv == NULL) { -+ drives_table[i].bdrv = s->bs; -+ drives_table[i].type = IF_BLKTAP; -+ drives_table[i].bus = 0; -+ drives_table[i].unit = 0; -+ drives_table[i].used = 1; -+ nb_drives++; -+ s->added = 1; -+ break; -+ } -+ } -+#endif -+ } -+ -+ memset(buf, 0x00, MSG_SIZE); -+ msglen = sizeof(msg_hdr_t); -+ msg->type = CTLMSG_ADDDEV_RSP; -+ msg->len = msglen; -+ len = write(write_fd, buf, msglen); -+ break; -+ - default: - break; - } -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h -@@ -40,7 +40,8 @@ struct td_state { - void *fd_entry; - uint64_t sector_size; - uint64_t size; -- unsigned int info; -+ unsigned int info; -+ int added; - }; - - typedef struct fd_list_entry { diff --git a/snapshot-xend.patch b/snapshot-xend.patch deleted file mode 100644 index e08b8d9..0000000 --- a/snapshot-xend.patch +++ /dev/null @@ -1,728 +0,0 @@ -Index: xen-4.1.3-testing/tools/python/xen/xend/image.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/image.py -+++ xen-4.1.3-testing/tools/python/xen/xend/image.py -@@ -490,7 +490,7 @@ class ImageHandler: - - domains.domains_lock.acquire() - -- def signalDeviceModel(self, cmd, ret, par = None): -+ def signalDeviceModel(self, cmd, ret, par = None, timeout = True): - if self.device_model is None: - return - # Signal the device model to for action -@@ -527,10 +527,17 @@ class ImageHandler: - while state != ret: - state = xstransact.Read("/local/domain/0/device-model/%i/state" - % self.vm.getDomid()) -+ if state == 'error': -+ msg = ("The device model returned an error: %s" -+ % xstransact.Read("/local/domain/0/device-model/%i/error" -+ % self.vm.getDomid())) -+ raise VmError(msg) -+ - time.sleep(0.1) -- count += 1 -- if count > 100: -- raise VmError('Timed out waiting for device model action') -+ if timeout: -+ count += 1 -+ if count > 100: -+ raise VmError('Timed out waiting for device model action') - - #resotre orig state - xstransact.Store("/local/domain/0/device-model/%i" -@@ -555,6 +562,10 @@ class ImageHandler: - except: - pass - -+ def snapshotDeviceModel(self, name): -+ # Signal the device model to perform snapshot operation -+ self.signalDeviceModel('snapshot', 'paused', name, False) -+ - def recreate(self): - if self.device_model is None: - return -Index: xen-4.1.3-testing/tools/python/xen/xend/server/blkif.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/server/blkif.py -+++ xen-4.1.3-testing/tools/python/xen/xend/server/blkif.py -@@ -88,6 +88,10 @@ class BlkifController(DevController): - if bootable != None: - back['bootable'] = str(bootable) - -+ if 'snapshotname' in self.vm.info: -+ back['snapshot'] = self.vm.info['snapshotname'] -+ self.vm.info.pop('snapshotname') -+ - if security.on() == xsconstants.XS_POLICY_USE: - self.do_access_control(config, uname) - -Index: xen-4.1.3-testing/tools/python/xen/xend/server/SrvDomain.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/server/SrvDomain.py -+++ xen-4.1.3-testing/tools/python/xen/xend/server/SrvDomain.py -@@ -95,6 +95,31 @@ class SrvDomain(SrvDir): - def do_save(self, _, req): - return self.xd.domain_save(self.dom.domid, req.args['file'][0]) - -+ def op_snapshot_create(self, op, req): -+ self.acceptCommand(req) -+ return req.threadRequest(self.do_snapshot_create, op, req) -+ -+ def do_snapshot_create(self, _, req): -+ return self.xd.domain_snapshot_create(self.dom.domid, req.args['name'][0]) -+ -+ def op_snapshot_list(self, op, req): -+ self.acceptCommand(req) -+ return self.xd.domain_snapshot_list(self.dom.getName()) -+ -+ def op_snapshot_apply(self, op, req): -+ self.acceptCommand(req) -+ return req.threadRequest(self.do_snapshot_apply, op, req) -+ -+ def do_snapshot_apply(self, _, req): -+ return self.xd.domain_snapshot_apply(self.dom.getName(), req.args['name'][0]) -+ -+ def op_snapshot_delete(self, op, req): -+ self.acceptCommand(req) -+ return req.threadRequest(self.do_snapshot_delete, op, req) -+ -+ def do_snapshot_delete(self, _, req): -+ return self.xd.domain_snapshot_delete(self.dom.getName(), req.args['name'][0]) -+ - def op_dump(self, op, req): - self.acceptCommand(req) - return req.threadRequest(self.do_dump, op, req) -@@ -273,7 +298,7 @@ class SrvDomain(SrvDir): - def render_GET(self, req): - op = req.args.get('op') - -- if op and op[0] in ['vcpuinfo']: -+ if op and op[0] in ['vcpuinfo', 'snapshot_list']: - return self.perform(req) - - # -Index: xen-4.1.3-testing/tools/python/xen/xend/XendCheckpoint.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.1.3-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -65,7 +65,7 @@ def insert_after(list, pred, value): - return - - --def save(fd, dominfo, network, live, dst, checkpoint=False, node=-1,sock=None): -+def save(fd, dominfo, network, live, dst, checkpoint=False, node=-1, sock=None, name=None, diskonly=False): - from xen.xend import XendDomain - - try: -@@ -78,6 +78,8 @@ def save(fd, dominfo, network, live, dst - write_exact(fd, SIGNATURE, "could not write guest state file: signature") - - sxprep = dominfo.sxpr() -+ if name: -+ sxprep.append(['snapshotname', name]) - - if node > -1: - insert_after(sxprep,'vcpus',['node', str(node)]) -@@ -112,52 +114,61 @@ def save(fd, dominfo, network, live, dst - image_cfg = dominfo.info.get('image', {}) - hvm = dominfo.info.is_hvm() - -- # xc_save takes three customization parameters: maxit, max_f, and -- # flags the last controls whether or not save is 'live', while the -- # first two further customize behaviour when 'live' save is -- # enabled. Passing "0" simply uses the defaults compiled into -- # libxenguest; see the comments and/or code in xc_linux_save() for -- # more information. -- cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(fd), -- str(dominfo.getDomid()), "0", "0", -- str(int(live) | (int(hvm) << 2)) ] -- log.debug("[xc_save]: %s", string.join(cmd)) -- -- def saveInputHandler(line, tochild): -- log.debug("In saveInputHandler %s", line) -- if line == "suspend": -- log.debug("Suspending %d ...", dominfo.getDomid()) -- dominfo.shutdown('suspend') -- dominfo.waitForSuspend() -- if line in ('suspend', 'suspended'): -- dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, -- domain_name) -- log.info("Domain %d suspended.", dominfo.getDomid()) -- dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP3, -- domain_name) -- if hvm: -- dominfo.image.saveDeviceModel() -- -- if line == "suspend": -- tochild.write("done\n") -- tochild.flush() -- log.debug('Written done') -- -- forkHelper(cmd, fd, saveInputHandler, False) -- -- # put qemu device model state -- if os.path.exists("/var/lib/xen/qemu-save.%d" % dominfo.getDomid()): -- write_exact(fd, QEMU_SIGNATURE, "could not write qemu signature") -- qemu_fd = os.open("/var/lib/xen/qemu-save.%d" % dominfo.getDomid(), -- os.O_RDONLY) -- while True: -- buf = os.read(qemu_fd, dm_batch) -- if len(buf): -- write_exact(fd, buf, "could not write device model state") -- else: -- break -- os.close(qemu_fd) -- os.remove("/var/lib/xen/qemu-save.%d" % dominfo.getDomid()) -+ if not diskonly: -+ # xc_save takes three customization parameters: maxit, max_f, and -+ # flags the last controls whether or not save is 'live', while the -+ # first two further customize behaviour when 'live' save is -+ # enabled. Passing "0" simply uses the defaults compiled into -+ # libxenguest; see the comments and/or code in xc_linux_save() for -+ # more information. -+ cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(fd), -+ str(dominfo.getDomid()), "0", "0", -+ str(int(live) | (int(hvm) << 2)) ] -+ log.debug("[xc_save]: %s", string.join(cmd)) -+ -+ def saveInputHandler(line, tochild): -+ log.debug("In saveInputHandler %s", line) -+ if line == "suspend": -+ log.debug("Suspending %d ...", dominfo.getDomid()) -+ dominfo.shutdown('suspend') -+ dominfo.waitForSuspend() -+ if line in ('suspend', 'suspended'): -+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, -+ domain_name) -+ log.info("Domain %d suspended.", dominfo.getDomid()) -+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP3, -+ domain_name) -+ if hvm: -+ dominfo.image.saveDeviceModel() -+ if name: -+ dominfo.image.resumeDeviceModel() -+ -+ if line == "suspend": -+ tochild.write("done\n") -+ tochild.flush() -+ log.debug('Written done') -+ -+ forkHelper(cmd, fd, saveInputHandler, False) -+ -+ # put qemu device model state -+ if os.path.exists("/var/lib/xen/qemu-save.%d" % dominfo.getDomid()): -+ write_exact(fd, QEMU_SIGNATURE, "could not write qemu signature") -+ qemu_fd = os.open("/var/lib/xen/qemu-save.%d" % dominfo.getDomid(), -+ os.O_RDONLY) -+ while True: -+ buf = os.read(qemu_fd, dm_batch) -+ if len(buf): -+ write_exact(fd, buf, "could not write device model state") -+ else: -+ break -+ os.close(qemu_fd) -+ os.remove("/var/lib/xen/qemu-save.%d" % dominfo.getDomid()) -+ else: -+ dominfo.shutdown('suspend') -+ dominfo.waitForShutdown() -+ -+ if name: -+ dominfo.image.snapshotDeviceModel(name) - - if checkpoint: - dominfo.resumeDomain() -@@ -231,6 +242,71 @@ def restore(xd, fd, dominfo = None, paus - if othervm is not None and othervm.domid is not None: - raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid)) - -+ def contains_state(fd): -+ try: -+ cur = os.lseek(fd, 0, 1) -+ end = os.lseek(fd, 0, 2) -+ -+ ret = False -+ if cur < end: -+ ret = True -+ -+ os.lseek(fd, cur, 0) -+ return ret -+ except OSError, (errno, strerr): -+ # lseek failed <==> socket <==> state -+ return True -+ -+ # -+ # We shouldn't hold the domains_lock over a waitForDevices -+ # As this function sometime gets called holding this lock, -+ # we must release it and re-acquire it appropriately -+ # -+ def wait_devs(dominfo): -+ from xen.xend import XendDomain -+ -+ lock = True; -+ try: -+ XendDomain.instance().domains_lock.release() -+ except: -+ lock = False; -+ -+ try: -+ dominfo.waitForDevices() # Wait for backends to set up -+ except Exception, exn: -+ log.exception(exn) -+ if lock: -+ XendDomain.instance().domains_lock.acquire() -+ raise -+ -+ if lock: -+ XendDomain.instance().domains_lock.acquire() -+ -+ -+ if not contains_state(fd): -+ # Disk-only snapshot. Just start the vm from config (which should -+ # contain snapshotname. -+ if dominfo: -+ log.debug("### starting domain directly through XendDomainInfo") -+ dominfo.start() -+ else: -+ # Warning! Do we need to call into XendDomain to get domain -+ # lock? Similar to the xd.restore_() call below? -+ # We'll try XendDomain.domain_create() -+ log.debug("### starting domain through XendDomain.create()") -+ dominfo = xd.domain_create(vmconfig) -+ -+ try: -+ wait_devs(dominfo) -+ except: -+ dominfo.destroy() -+ raise -+ -+ dominfo.unpause() -+ -+ # Done if disk only snapshot -+ return dominfo -+ - if dominfo: - dominfo.resume() - else: -@@ -332,24 +408,7 @@ def restore(xd, fd, dominfo = None, paus - - dominfo.completeRestore(handler.store_mfn, handler.console_mfn) - -- # -- # We shouldn't hold the domains_lock over a waitForDevices -- # As this function sometime gets called holding this lock, -- # we must release it and re-acquire it appropriately -- # -- from xen.xend import XendDomain -- -- lock = True; -- try: -- XendDomain.instance().domains_lock.release() -- except: -- lock = False; -- -- try: -- dominfo.waitForDevices() # Wait for backends to set up -- finally: -- if lock: -- XendDomain.instance().domains_lock.acquire() -+ wait_devs(dominfo) - - if not paused: - dominfo.unpause() -Index: xen-4.1.3-testing/tools/python/xen/xend/XendConfig.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.1.3-testing/tools/python/xen/xend/XendConfig.py -@@ -244,6 +244,7 @@ XENAPI_CFG_TYPES = { - 'memory_sharing': int, - 'pool_name' : str, - 'Description': str, -+ 'snapshotname': str, - } - - # List of legacy configuration keys that have no equivalent in the -Index: xen-4.1.3-testing/tools/python/xen/xend/XendDomain.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/XendDomain.py -+++ xen-4.1.3-testing/tools/python/xen/xend/XendDomain.py -@@ -53,6 +53,7 @@ from xen.xend.xenstore.xstransact import - from xen.xend.xenstore.xswatch import xswatch - from xen.util import mkdir, rwlock - from xen.xend import uuid -+from xen.xend import sxp - - xc = xen.lowlevel.xc.xc() - xoptions = XendOptions.instance() -@@ -319,11 +320,16 @@ class XendDomain: - fd, fn = tempfile.mkstemp() - f = os.fdopen(fd, 'w+b') - try: -+ snapshotname = '' -+ if dominfo.info.has_key('snapshotname'): -+ snapshotname = dominfo.info.pop('snapshotname') -+ - prettyprint(dominfo.sxpr(legacy_only = False), f, - width = 78) - finally: - f.close() -- -+ if snapshotname: -+ dominfo.info['snapshotname'] = snapshotname - try: - shutil.move(fn, self._managed_config_path(dom_uuid)) - except: -@@ -1585,6 +1591,187 @@ class XendDomain: - else: - log.debug("error: Domain is not running!") - -+ def domain_snapshot_create(self, domid, name, diskonly=False): -+ """Snapshot a running domain. -+ -+ @param domid: Domain ID or Name -+ @type domid: int or string. -+ @param name: Snapshot name -+ @type dst: string -+ @param diskonly: Snapshot disk only - exclude machine state -+ @type dst: bool -+ @rtype: None -+ @raise XendError: Failed to snapshot domain -+ @raise XendInvalidDomain: Domain is not valid -+ """ -+ try: -+ dominfo = self.domain_lookup_nr(domid) -+ if not dominfo: -+ raise XendInvalidDomain(str(domid)) -+ -+ snap_file = os.path.join(xoptions.get_xend_domains_path(), -+ dominfo.get_uuid(), "snapshots", name) -+ -+ if os.access(snap_file, os.F_OK): -+ raise XendError("Snapshot:%s exist for domain %s\n" % (name, str(domid))) -+ -+ if dominfo.getDomid() == DOM0_ID: -+ raise XendError("Cannot snapshot privileged domain %s" % str(domid)) -+ if dominfo._stateGet() != DOM_STATE_RUNNING: -+ raise VMBadState("Domain is not running", -+ POWER_STATE_NAMES[DOM_STATE_RUNNING], -+ POWER_STATE_NAMES[dominfo._stateGet()]) -+ -+ if not os.path.exists(self._managed_config_path(dominfo.get_uuid())): -+ raise XendError("Domain is not managed by Xend lifecycle " + -+ "support.") -+ -+ # Check if all images support snapshots -+ for dev_type, dev_info in dominfo.info.all_devices_sxpr(): -+ mode = sxp.child_value(dev_info, 'mode') -+ if mode == 'r': -+ continue; -+ if dev_type == 'vbd': -+ raise XendError("All writable images need to use the " + -+ "tap:qcow2 protocol for snapshot support") -+ if dev_type == 'tap': -+ # Fetch the protocol name from tap:xyz:filename -+ type = sxp.child_value(dev_info, 'uname') -+ type = type.split(':')[1] -+ if type != 'qcow2': -+ raise XendError("All writable images need to use the " + -+ "tap:qcow2 protocol for snapshot support") -+ -+ snap_path = os.path.join(xoptions.get_xend_domains_path(), -+ dominfo.get_uuid(), "snapshots") -+ mkdir.parents(snap_path, stat.S_IRWXU) -+ snap_file = os.path.join(snap_path, name) -+ -+ -+ oflags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC -+ if hasattr(os, "O_LARGEFILE"): -+ oflags |= os.O_LARGEFILE -+ fd = os.open(snap_file, oflags) -+ try: -+ XendCheckpoint.save(fd, dominfo, False, False, snap_file, -+ True, sock=None, name=name, diskonly=diskonly) -+ except Exception, e: -+ os.close(fd) -+ os.unlink(snap_file) -+ raise e -+ os.close(fd) -+ except OSError, ex: -+ raise XendError("can't write guest state file %s: %s" % -+ (snap_file, ex[1])) -+ -+ def domain_snapshot_list(self, domid): -+ """List available snapshots for a domain. -+ -+ @param domid: Domain ID or Name -+ @type domid: int or string. -+ @rtype: list of snapshot names -+ @raise XendInvalidDomain: Domain is not valid -+ """ -+ try: -+ dominfo = self.domain_lookup_nr(domid) -+ if not dominfo: -+ raise XendInvalidDomain(str(domid)) -+ -+ snap_path = os.path.join(xoptions.get_xend_domains_path(), -+ dominfo.get_uuid(), "snapshots") -+ -+ if not os.access(snap_path, os.R_OK): -+ return [] -+ -+ return os.listdir(snap_path) -+ -+ except: -+ return [] -+ -+ def domain_snapshot_apply(self, domid, name): -+ """Start a domain from snapshot -+ -+ @param domid: Domain ID or Name -+ @type domid: int or string. -+ @param name: Snapshot name -+ @type dst: string -+ @rtype: None -+ @raise XendError: Failed to apply snapshot -+ @raise XendInvalidDomain: Domain is not valid -+ """ -+ try: -+ dominfo = self.domain_lookup_nr(domid) -+ if not dominfo: -+ log.debug("## no dominfo") -+ raise XendInvalidDomain(str(domid)) -+ -+ if dominfo.getDomid() == DOM0_ID: -+ raise XendError("Cannot apply snapshots to privileged domain %s" % str(domid)) -+ if dominfo._stateGet() != DOM_STATE_HALTED: -+ raise VMBadState("Domain is not halted", -+ POWER_STATE_NAMES[DOM_STATE_HALTED], -+ POWER_STATE_NAMES[dominfo._stateGet()]) -+ -+ snap_file = os.path.join(xoptions.get_xend_domains_path(), -+ dominfo.get_uuid(), "snapshots", name) -+ if not os.access(snap_file, os.R_OK): -+ raise XendError("Unable to access snapshot %s for domain %s" % -+ (name, str(domid))) -+ -+ oflags = os.O_RDONLY -+ if hasattr(os, "O_LARGEFILE"): -+ oflags |= os.O_LARGEFILE -+ fd = os.open(snap_file, oflags) -+ try: -+ self.domain_restore_fd(fd) -+ finally: -+ os.close(fd) -+ except OSError, ex: -+ raise XendError("Unable to read snapshot file file %s: %s" % -+ (snap_file, ex[1])) -+ -+ def domain_snapshot_delete(self, domid, name): -+ """Delete domain snapshot -+ -+ @param domid: Domain ID or Name -+ @type domid: int or string. -+ @param name: Snapshot name -+ @type domid: string -+ @rtype: None -+ @raise XendInvalidDomain: Domain is not valid -+ """ -+ dominfo = self.domain_lookup_nr(domid) -+ if not dominfo: -+ raise XendInvalidDomain(str(domid)) -+ -+ snap_file = os.path.join(xoptions.get_xend_domains_path(), -+ dominfo.get_uuid(), "snapshots", name) -+ -+ if not os.access(snap_file, os.F_OK): -+ raise XendError("Snapshot %s does not exist for domain %s" % -+ (name, str(domid))) -+ -+ # Need to "remove" snapshot from qcow2 image file. -+ # For running domains, this is left to ioemu. For stopped domains -+ # we must invoke qemu-img for all devices ourselves -+ if dominfo._stateGet() != DOM_STATE_HALTED: -+ dominfo.image.signalDeviceModel("snapshot-delete", -+ "snapshot-deleted", name) -+ else: -+ for dev_type, dev_info in dominfo.info.all_devices_sxpr(): -+ if dev_type != 'tap': -+ continue -+ -+ # Fetch the filename and strip off tap:xyz: -+ image_file = sxp.child_value(dev_info, 'uname') -+ image_file = image_file.split(':')[2] -+ -+ os.system("qemu-img-xen snapshot -d %s %s" % -+ (name, image_file)); -+ -+ -+ os.unlink(snap_file) -+ - def domain_pincpu(self, domid, vcpu, cpumap): - """Set which cpus vcpu can use - -Index: xen-4.1.3-testing/tools/python/xen/xm/main.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.1.3-testing/tools/python/xen/xm/main.py -@@ -123,6 +123,14 @@ SUBCOMMAND_HELP = { - 'Restore a domain from a saved state.'), - 'save' : ('[-c|-f] ', - 'Save a domain state to restore later.'), -+ 'snapshot-create' : ('[-d] ', -+ 'Snapshot a running domain.'), -+ 'snapshot-list' : ('', -+ 'List available snapshots for a domain.'), -+ 'snapshot-apply' : (' ', -+ 'Apply previous snapshot to domain.'), -+ 'snapshot-delete' : (' ', -+ 'Delete snapshot of domain.'), - 'shutdown' : (' [-waRH]', 'Shutdown a domain.'), - 'top' : ('', 'Monitor a host and the domains in real time.'), - 'unpause' : ('', 'Unpause a paused domain.'), -@@ -344,6 +352,9 @@ SUBCOMMAND_OPTIONS = { - ('-c', '--checkpoint', 'Leave domain running after creating snapshot'), - ('-f', '--force', 'Force to overwrite exist file'), - ), -+ 'snapshot-create': ( -+ ('-d', '--diskonly', 'Perform disk only snapshot of domain'), -+ ), - 'restore': ( - ('-p', '--paused', 'Do not unpause domain after restoring it'), - ), -@@ -395,6 +406,10 @@ common_commands = [ - "restore", - "resume", - "save", -+ "snapshot-create", -+ "snapshot-list", -+ "snapshot-apply", -+ "snapshot-delete", - "shell", - "shutdown", - "start", -@@ -429,6 +444,10 @@ domain_commands = [ - "restore", - "resume", - "save", -+ "snapshot-create", -+ "snapshot-list", -+ "snapshot-apply", -+ "snapshot-delete", - "shutdown", - "start", - "suspend", -@@ -863,6 +882,62 @@ def xm_event_monitor(args): - # - ######################################################################### - -+def xm_snapshot_create(args): -+ -+ arg_check(args, "snapshot-create", 2, 3) -+ -+ try: -+ (options, params) = getopt.gnu_getopt(args, 'd', ['diskonly']) -+ except getopt.GetoptError, opterr: -+ err(opterr) -+ sys.exit(1) -+ -+ diskonly = False -+ for (k, v) in options: -+ if k in ['-d', '--diskonly']: -+ diskonly = True -+ -+ if len(params) != 2: -+ err("Wrong number of parameters") -+ usage('snapshot-create') -+ -+ if serverType == SERVER_XEN_API: -+ server.xenapi.VM.snapshot_create(get_single_vm(params[0]), params[1], diskonly) -+ else: -+ server.xend.domain.snapshot_create(params[0], params[1], diskonly) -+ -+def xm_snapshot_list(args): -+ arg_check(args, "snapshot-list", 1, 2) -+ -+ snapshots = None -+ if serverType == SERVER_XEN_API: -+ snapshots = server.xenapi.VM.snapshot_list(get_single_vm(args[0])) -+ else: -+ snapshots = server.xend.domain.snapshot_list(args[0]) -+ -+ if snapshots: -+ print "Available snapshots for domain %s" % args[0] -+ for snapshot in snapshots: -+ print " %s" % snapshot -+ else: -+ print "No snapshot available for domain %s" % args[0] -+ -+def xm_snapshot_apply(args): -+ arg_check(args, "snapshot-apply", 2, 3) -+ -+ if serverType == SERVER_XEN_API: -+ server.xenapi.VM.snapshot_apply(get_single_vm(args[0]), args[1]) -+ else: -+ server.xend.domain.snapshot_apply(args[0], args[1]) -+ -+def xm_snapshot_delete(args): -+ arg_check(args, "snapshot-delete", 2, 3) -+ -+ if serverType == SERVER_XEN_API: -+ server.xenapi.VM.snapshot_delete(get_single_vm(args[0]), args[1]) -+ else: -+ server.xend.domain.snapshot_delete(args[0], args[1]) -+ - def xm_save(args): - - arg_check(args, "save", 2, 4) -@@ -3827,6 +3902,10 @@ commands = { - "restore": xm_restore, - "resume": xm_resume, - "save": xm_save, -+ "snapshot-create": xm_snapshot_create, -+ "snapshot-list": xm_snapshot_list, -+ "snapshot-apply": xm_snapshot_apply, -+ "snapshot-delete": xm_snapshot_delete, - "shutdown": xm_shutdown, - "start": xm_start, - "sysrq": xm_sysrq, -Index: xen-4.1.3-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.3-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -508,8 +508,6 @@ class XendDomainInfo: - self._setSchedParams() - self._storeVmDetails() - self._createChannels() -- self._createDevices() -- self._storeDomDetails() - self._endRestore() - except: - log.exception('VM resume failed') -@@ -2371,7 +2369,7 @@ class XendDomainInfo: - return self.getDeviceController(deviceClass).reconfigureDevice( - devid, devconfig) - -- def _createDevices(self): -+ def _createDevices(self, resume = False): - """Create the devices for a vm. - - @raise: VmError for invalid devices -@@ -2420,7 +2418,7 @@ class XendDomainInfo: - - - if self.image: -- self.image.createDeviceModel() -+ self.image.createDeviceModel(resume) - - #if have pass-through devs, need the virtual pci slots info from qemu - self.pci_device_configure_boot() -@@ -3046,7 +3044,7 @@ class XendDomainInfo: - self._introduceDomain() - self.image = image.create(self, self.info) - if self.image: -- self.image.createDeviceModel(True) -+ self._createDevices(True) - self._storeDomDetails() - self._registerWatches() - self.refreshShutdown() diff --git a/stdvga-cache.patch b/stdvga-cache.patch index 1548dec..bbaf726 100644 --- a/stdvga-cache.patch +++ b/stdvga-cache.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/xen/arch/x86/hvm/stdvga.c +Index: xen-4.2.0-testing/xen/arch/x86/hvm/stdvga.c =================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/hvm/stdvga.c -+++ xen-4.1.2-testing/xen/arch/x86/hvm/stdvga.c +--- xen-4.2.0-testing.orig/xen/arch/x86/hvm/stdvga.c ++++ xen-4.2.0-testing/xen/arch/x86/hvm/stdvga.c @@ -135,7 +135,10 @@ static int stdvga_outb(uint64_t addr, ui /* When in standard vga mode, emulate here all writes to the vram buffer diff --git a/stubdom.tar.bz2 b/stubdom.tar.bz2 index 08029de..916379f 100644 --- a/stubdom.tar.bz2 +++ b/stubdom.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6215320ea160b7296e463abb60e3264fc35f88b47374ae3e054ba4352f6d43dc -size 16864982 +oid sha256:29f4dfad9cd69740193eaaf302c9608ee85759280235516533d3ee1f40819e1e +size 13995441 diff --git a/supported_module.diff b/supported_module.diff index 16ca173..05b7a48 100644 --- a/supported_module.diff +++ b/supported_module.diff @@ -2,10 +2,10 @@ Make our PV drivers "Novell supported modules" Signed-off-by: K. Y. Srinivasan -Index: xen-4.1.2-testing/unmodified_drivers/linux-2.6/Module.supported +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/Module.supported =================================================================== --- /dev/null -+++ xen-4.1.2-testing/unmodified_drivers/linux-2.6/Module.supported ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/Module.supported @@ -0,0 +1,6 @@ +xen-vbd +xen-platform-pci diff --git a/suspend_evtchn_lock.patch b/suspend_evtchn_lock.patch index 7d05d4c..3cb8f4a 100644 --- a/suspend_evtchn_lock.patch +++ b/suspend_evtchn_lock.patch @@ -6,10 +6,10 @@ http://xen.1045712.n5.nabble.com/Re-PATCH-improve-suspend-evtchn-lock-processing Signed-off-by: Chunyan Liu -Index: xen-4.1.2-testing/tools/libxc/xc_suspend.c +Index: xen-4.2.0-testing/tools/libxc/xc_suspend.c =================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_suspend.c -+++ xen-4.1.2-testing/tools/libxc/xc_suspend.c +--- xen-4.2.0-testing.orig/tools/libxc/xc_suspend.c ++++ xen-4.2.0-testing/tools/libxc/xc_suspend.c @@ -16,8 +16,43 @@ #include "xc_private.h" diff --git a/tapdisk-ioemu-logfile.patch b/tapdisk-ioemu-logfile.patch index 251da18..8960a33 100644 --- a/tapdisk-ioemu-logfile.patch +++ b/tapdisk-ioemu-logfile.patch @@ -11,10 +11,10 @@ Signed-off-by: Kevin Wolf tapdisk-ioemu.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/tapdisk-ioemu.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c @@ -78,15 +78,22 @@ int main(void) struct timeval tv; void *old_fd_start = NULL; diff --git a/tapdisk-ioemu-shutdown-fix.patch b/tapdisk-ioemu-shutdown-fix.patch index 339e3c5..428806f 100644 --- a/tapdisk-ioemu-shutdown-fix.patch +++ b/tapdisk-ioemu-shutdown-fix.patch @@ -16,11 +16,11 @@ Signed-off-by: Kevin Wolf tapdisk-ioemu.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -67,6 +67,7 @@ int read_fd; +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_blktap.c +@@ -65,6 +65,7 @@ int read_fd; int write_fd; static pid_t process; @@ -46,10 +46,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c case CTLMSG_PID: memset(buf, 0x00, MSG_SIZE); -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/tapdisk-ioemu.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/tapdisk-ioemu.c @@ -14,6 +14,7 @@ extern void qemu_aio_init(void); extern void qemu_aio_poll(void); diff --git a/tmp-initscript-modprobe.patch b/tmp-initscript-modprobe.patch index f977f9d..e44b969 100644 --- a/tmp-initscript-modprobe.patch +++ b/tmp-initscript-modprobe.patch @@ -1,25 +1,46 @@ -Index: xen-4.1.3-testing/tools/hotplug/Linux/init.d/xencommons +Index: xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons =================================================================== ---- xen-4.1.3-testing.orig/tools/hotplug/Linux/init.d/xencommons -+++ xen-4.1.3-testing/tools/hotplug/Linux/init.d/xencommons -@@ -62,6 +62,20 @@ do_start () { - modprobe evtchn 2>/dev/null - modprobe gntdev 2>/dev/null +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/init.d/xencommons ++++ xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons +@@ -60,21 +60,26 @@ do_start () { + local time=0 + local timeout=30 -+ # Load XEN backend modules -+ # NB: They could be loaded later, e.g. when dom0 hotplug events occur, -+ # but for now it's safest to have them loaded here. +- modprobe xen-evtchn 2>/dev/null +- modprobe xen-gntdev 2>/dev/null +- modprobe xen-gntalloc 2>/dev/null +- modprobe xen-blkback 2>/dev/null +- modprobe xen-netback 2>/dev/null +- modprobe xen-pciback 2>/dev/null +- modprobe evtchn 2>/dev/null +- modprobe gntdev 2>/dev/null +- modprobe netbk 2>/dev/null +- modprobe blkbk 2>/dev/null +- modprobe xen-scsibk 2>/dev/null +- modprobe usbbk 2>/dev/null +- modprobe pciback 2>/dev/null +- modprobe xen-acpi-processor 2>/dev/null +- modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null ++ #modprobe xen-evtchn 2>/dev/null ++ #modprobe xen-gntdev 2>/dev/null ++ #modprobe xen-gntalloc 2>/dev/null ++ #modprobe xen-blkback 2>/dev/null ++ #modprobe xen-netback 2>/dev/null ++ #modprobe xen-pciback 2>/dev/null + modprobe evtchn 2>/dev/null || true + modprobe gntdev 2>/dev/null || true -+ modprobe blktap 2>/dev/null || true -+ modprobe blkbk 2>/dev/null || true ++ modprobe gntalloc 2>/dev/null || true + modprobe netbk 2>/dev/null || true ++ modprobe blkbk 2>/dev/null || true ++ modprobe xen-scsibk 2>/dev/null || true + modprobe usbbk 2>/dev/null || true ++ modprobe pciback 2>/dev/null || true ++ modprobe xen-acpi-processor 2>/dev/null || true ++ modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null || true + # xenblk (frontend module) is needed in dom0, allowing it to use vbds + modprobe xenblk 2>/dev/null || true + # support xl create pv guest with qcow/qcow2 disk image + modprobe nbd max_part=8 2>/dev/null || true -+ + mkdir -p /var/run/xen + if ! `xenstore-read -s / >/dev/null 2>&1` - then - test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="/var/lib/xenstored" diff --git a/tmp_build.patch b/tmp_build.patch index 44eb69a..ba14373 100644 --- a/tmp_build.patch +++ b/tmp_build.patch @@ -1,16 +1,16 @@ -Index: xen-4.1.2-testing/tools/xenstore/Makefile +Index: xen-4.2.0-testing/tools/xenstore/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/Makefile -+++ xen-4.1.2-testing/tools/xenstore/Makefile -@@ -58,6 +58,7 @@ $(CLIENTS_DOMU): xenstore +--- xen-4.2.0-testing.orig/tools/xenstore/Makefile ++++ xen-4.2.0-testing/tools/xenstore/Makefile +@@ -72,6 +72,7 @@ $(CLIENTS_DOMU): xenstore xenstore: xenstore_client.o $(LIBXENSTORE) - $(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--build-id=uuid $< -L. -lxenstore $(SOCKET_LIBS) -o domu-$@ xenstore-control: xenstore_control.o $(LIBXENSTORE) - $(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@ -@@ -106,10 +107,11 @@ install: all + $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS) +@@ -121,10 +122,11 @@ install: all $(INSTALL_PROG) xenstore-control $(DESTDIR)$(BINDIR) $(INSTALL_PROG) xenstore $(DESTDIR)$(BINDIR) set -e ; for c in $(CLIENTS) ; do \ diff --git a/tools-kboot.diff b/tools-kboot.diff deleted file mode 100644 index 22a2f40..0000000 --- a/tools-kboot.diff +++ /dev/null @@ -1,2171 +0,0 @@ -kexec-based boot loader for xen guests. - -Signed-off-by: Gerd Hoffmann ---- - buildconfigs/linux-defconfig_xenUboot_x86_32 | 874 +++++++++++++++++++++++++++ - buildconfigs/linux-defconfig_xenUboot_x86_64 | 653 ++++++++++++++++++++ - buildconfigs/mk.linux-2.6-xenUboot | 2 - make-kboot | 37 + - tools/kboot/Makefile | 23 - tools/kboot/README | 43 + - tools/kboot/init | 309 +++++++++ - tools/kboot/mkinitramfs | 111 +++ - tools/kboot/select-kernel | 59 + - 9 files changed, 2111 insertions(+) - -Index: xen-4.1.2-testing/buildconfigs/linux-defconfig_xenUboot_x86_32 -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/buildconfigs/linux-defconfig_xenUboot_x86_32 -@@ -0,0 +1,874 @@ -+# -+# Automatically generated make config: don't edit -+# Linux kernel version: 2.6.16.29-xenUboot -+# Tue Nov 28 12:43:18 2006 -+# -+CONFIG_X86_32=y -+CONFIG_SEMAPHORE_SLEEPERS=y -+CONFIG_X86=y -+CONFIG_MMU=y -+CONFIG_GENERIC_ISA_DMA=y -+CONFIG_GENERIC_IOMAP=y -+CONFIG_ARCH_MAY_HAVE_PC_FDC=y -+CONFIG_DMI=y -+ -+# -+# Code maturity level options -+# -+CONFIG_EXPERIMENTAL=y -+CONFIG_BROKEN_ON_SMP=y -+CONFIG_INIT_ENV_ARG_LIMIT=32 -+ -+# -+# General setup -+# -+CONFIG_LOCALVERSION="" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SWAP=y -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+# CONFIG_BSD_PROCESS_ACCT is not set -+CONFIG_SYSCTL=y -+# CONFIG_AUDIT is not set -+# CONFIG_IKCONFIG is not set -+CONFIG_INITRAMFS_SOURCE="../tools/kboot/kboot.initramfs" -+CONFIG_INITRAMFS_ROOT_UID=0 -+CONFIG_INITRAMFS_ROOT_GID=0 -+CONFIG_UID16=y -+CONFIG_VM86=y -+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -+# CONFIG_EMBEDDED is not set -+CONFIG_KALLSYMS=y -+CONFIG_KALLSYMS_ALL=y -+# CONFIG_KALLSYMS_EXTRA_PASS is not set -+CONFIG_HOTPLUG=y -+CONFIG_PRINTK=y -+CONFIG_BUG=y -+CONFIG_ELF_CORE=y -+CONFIG_BASE_FULL=y -+CONFIG_FUTEX=y -+CONFIG_EPOLL=y -+CONFIG_SHMEM=y -+CONFIG_CC_ALIGN_FUNCTIONS=0 -+CONFIG_CC_ALIGN_LABELS=0 -+CONFIG_CC_ALIGN_LOOPS=0 -+CONFIG_CC_ALIGN_JUMPS=0 -+CONFIG_SLAB=y -+# CONFIG_TINY_SHMEM is not set -+CONFIG_BASE_SMALL=0 -+# CONFIG_SLOB is not set -+ -+# -+# Loadable module support -+# -+# CONFIG_MODULES is not set -+ -+# -+# Block layer -+# -+# CONFIG_LBD is not set -+ -+# -+# IO Schedulers -+# -+CONFIG_IOSCHED_NOOP=y -+# CONFIG_IOSCHED_AS is not set -+# CONFIG_IOSCHED_DEADLINE is not set -+# CONFIG_IOSCHED_CFQ is not set -+# CONFIG_DEFAULT_AS is not set -+# CONFIG_DEFAULT_DEADLINE is not set -+# CONFIG_DEFAULT_CFQ is not set -+CONFIG_DEFAULT_NOOP=y -+CONFIG_DEFAULT_IOSCHED="noop" -+ -+# -+# Processor type and features -+# -+# CONFIG_X86_PC is not set -+CONFIG_X86_XEN=y -+# CONFIG_X86_ELAN is not set -+# CONFIG_X86_VOYAGER is not set -+# CONFIG_X86_NUMAQ is not set -+# CONFIG_X86_SUMMIT is not set -+# CONFIG_X86_BIGSMP is not set -+# CONFIG_X86_VISWS is not set -+# CONFIG_X86_GENERICARCH is not set -+# CONFIG_X86_ES7000 is not set -+# CONFIG_M386 is not set -+# CONFIG_M486 is not set -+# CONFIG_M586 is not set -+# CONFIG_M586TSC is not set -+# CONFIG_M586MMX is not set -+CONFIG_M686=y -+# CONFIG_MPENTIUMII is not set -+# CONFIG_MPENTIUMIII is not set -+# CONFIG_MPENTIUMM is not set -+# CONFIG_MPENTIUM4 is not set -+# CONFIG_MK6 is not set -+# CONFIG_MK7 is not set -+# CONFIG_MK8 is not set -+# CONFIG_MCRUSOE is not set -+# CONFIG_MEFFICEON is not set -+# CONFIG_MWINCHIPC6 is not set -+# CONFIG_MWINCHIP2 is not set -+# CONFIG_MWINCHIP3D is not set -+# CONFIG_MGEODEGX1 is not set -+# CONFIG_MGEODE_LX is not set -+# CONFIG_MCYRIXIII is not set -+# CONFIG_MVIAC3_2 is not set -+CONFIG_X86_GENERIC=y -+CONFIG_X86_CMPXCHG=y -+CONFIG_X86_XADD=y -+CONFIG_X86_L1_CACHE_SHIFT=7 -+CONFIG_RWSEM_XCHGADD_ALGORITHM=y -+CONFIG_GENERIC_CALIBRATE_DELAY=y -+CONFIG_X86_PPRO_FENCE=y -+CONFIG_X86_WP_WORKS_OK=y -+CONFIG_X86_INVLPG=y -+CONFIG_X86_BSWAP=y -+CONFIG_X86_POPAD_OK=y -+CONFIG_X86_CMPXCHG64=y -+CONFIG_X86_GOOD_APIC=y -+CONFIG_X86_INTEL_USERCOPY=y -+CONFIG_X86_USE_PPRO_CHECKSUM=y -+CONFIG_X86_TSC=y -+# CONFIG_SMP is not set -+CONFIG_PREEMPT_NONE=y -+# CONFIG_PREEMPT_VOLUNTARY is not set -+# CONFIG_PREEMPT is not set -+# CONFIG_TOSHIBA is not set -+# CONFIG_I8K is not set -+# CONFIG_X86_REBOOTFIXUPS is not set -+# CONFIG_X86_CPUID is not set -+CONFIG_SWIOTLB=y -+ -+# -+# Firmware Drivers -+# -+# CONFIG_DELL_RBU is not set -+# CONFIG_DCDBAS is not set -+CONFIG_NOHIGHMEM=y -+# CONFIG_HIGHMEM4G is not set -+# CONFIG_HIGHMEM64G is not set -+CONFIG_VMSPLIT_3G=y -+# CONFIG_VMSPLIT_3G_OPT is not set -+# CONFIG_VMSPLIT_2G is not set -+# CONFIG_VMSPLIT_1G is not set -+CONFIG_PAGE_OFFSET=0xC0000000 -+CONFIG_SELECT_MEMORY_MODEL=y -+CONFIG_FLATMEM_MANUAL=y -+# CONFIG_DISCONTIGMEM_MANUAL is not set -+# CONFIG_SPARSEMEM_MANUAL is not set -+CONFIG_FLATMEM=y -+CONFIG_FLAT_NODE_MEM_MAP=y -+# CONFIG_SPARSEMEM_STATIC is not set -+CONFIG_SPLIT_PTLOCK_CPUS=4096 -+# CONFIG_REGPARM is not set -+# CONFIG_SECCOMP is not set -+CONFIG_HZ_100=y -+# CONFIG_HZ_250 is not set -+# CONFIG_HZ_1000 is not set -+CONFIG_HZ=100 -+CONFIG_KEXEC=y -+CONFIG_PHYSICAL_START=0x100000 -+ -+# -+# Bus options (PCI, PCMCIA, EISA, MCA, ISA) -+# -+# CONFIG_PCI is not set -+CONFIG_ISA_DMA_API=y -+# CONFIG_SCx200 is not set -+ -+# -+# PCCARD (PCMCIA/CardBus) support -+# -+# CONFIG_PCCARD is not set -+ -+# -+# PCI Hotplug Support -+# -+ -+# -+# Executable file formats -+# -+CONFIG_BINFMT_ELF=y -+# CONFIG_BINFMT_AOUT is not set -+# CONFIG_BINFMT_MISC is not set -+ -+# -+# Networking -+# -+CONFIG_NET=y -+ -+# -+# Networking options -+# -+# CONFIG_NETDEBUG is not set -+CONFIG_PACKET=y -+CONFIG_PACKET_MMAP=y -+CONFIG_UNIX=y -+# CONFIG_NET_KEY is not set -+CONFIG_INET=y -+# CONFIG_IP_MULTICAST is not set -+# CONFIG_IP_ADVANCED_ROUTER is not set -+CONFIG_IP_FIB_HASH=y -+# CONFIG_IP_PNP is not set -+# CONFIG_NET_IPIP is not set -+# CONFIG_NET_IPGRE is not set -+# CONFIG_ARPD is not set -+# CONFIG_SYN_COOKIES is not set -+# CONFIG_INET_AH is not set -+# CONFIG_INET_ESP is not set -+# CONFIG_INET_IPCOMP is not set -+# CONFIG_INET_TUNNEL is not set -+CONFIG_INET_DIAG=y -+CONFIG_INET_TCP_DIAG=y -+# CONFIG_TCP_CONG_ADVANCED is not set -+CONFIG_TCP_CONG_BIC=y -+# CONFIG_IPV6 is not set -+# CONFIG_NETFILTER is not set -+ -+# -+# DCCP Configuration (EXPERIMENTAL) -+# -+# CONFIG_IP_DCCP is not set -+ -+# -+# SCTP Configuration (EXPERIMENTAL) -+# -+# CONFIG_IP_SCTP is not set -+ -+# -+# TIPC Configuration (EXPERIMENTAL) -+# -+# CONFIG_TIPC is not set -+# CONFIG_ATM is not set -+# CONFIG_BRIDGE is not set -+# CONFIG_VLAN_8021Q is not set -+# CONFIG_DECNET is not set -+# CONFIG_LLC2 is not set -+# CONFIG_IPX is not set -+# CONFIG_ATALK is not set -+# CONFIG_X25 is not set -+# CONFIG_LAPB is not set -+# CONFIG_NET_DIVERT is not set -+# CONFIG_ECONET is not set -+# CONFIG_WAN_ROUTER is not set -+ -+# -+# QoS and/or fair queueing -+# -+# CONFIG_NET_SCHED is not set -+ -+# -+# Network testing -+# -+# CONFIG_NET_PKTGEN is not set -+# CONFIG_HAMRADIO is not set -+# CONFIG_IRDA is not set -+# CONFIG_BT is not set -+# CONFIG_IEEE80211 is not set -+ -+# -+# Device Drivers -+# -+ -+# -+# Generic Driver Options -+# -+CONFIG_STANDALONE=y -+CONFIG_PREVENT_FIRMWARE_BUILD=y -+# CONFIG_FW_LOADER is not set -+# CONFIG_DEBUG_DRIVER is not set -+ -+# -+# Connector - unified userspace <-> kernelspace linker -+# -+# CONFIG_CONNECTOR is not set -+ -+# -+# Memory Technology Devices (MTD) -+# -+# CONFIG_MTD is not set -+ -+# -+# Parallel port support -+# -+# CONFIG_PARPORT is not set -+ -+# -+# Plug and Play support -+# -+ -+# -+# Block devices -+# -+# CONFIG_BLK_DEV_FD is not set -+# CONFIG_BLK_DEV_COW_COMMON is not set -+CONFIG_BLK_DEV_LOOP=y -+# CONFIG_BLK_DEV_CRYPTOLOOP is not set -+# CONFIG_BLK_DEV_NBD is not set -+CONFIG_BLK_DEV_RAM=y -+CONFIG_BLK_DEV_RAM_COUNT=16 -+CONFIG_BLK_DEV_RAM_SIZE=4096 -+CONFIG_BLK_DEV_INITRD=y -+# CONFIG_CDROM_PKTCDVD is not set -+# CONFIG_ATA_OVER_ETH is not set -+ -+# -+# ATA/ATAPI/MFM/RLL support -+# -+# CONFIG_IDE is not set -+ -+# -+# SCSI device support -+# -+# CONFIG_RAID_ATTRS is not set -+# CONFIG_SCSI is not set -+ -+# -+# Multi-device support (RAID and LVM) -+# -+CONFIG_MD=y -+CONFIG_BLK_DEV_MD=y -+CONFIG_MD_LINEAR=y -+CONFIG_MD_RAID0=y -+CONFIG_MD_RAID1=y -+# CONFIG_MD_RAID10 is not set -+# CONFIG_MD_RAID5 is not set -+# CONFIG_MD_RAID6 is not set -+# CONFIG_MD_MULTIPATH is not set -+# CONFIG_MD_FAULTY is not set -+CONFIG_BLK_DEV_DM=y -+# CONFIG_DM_CRYPT is not set -+# CONFIG_DM_SNAPSHOT is not set -+# CONFIG_DM_MIRROR is not set -+# CONFIG_DM_ZERO is not set -+# CONFIG_DM_MULTIPATH is not set -+ -+# -+# Fusion MPT device support -+# -+# CONFIG_FUSION is not set -+ -+# -+# IEEE 1394 (FireWire) support -+# -+ -+# -+# I2O device support -+# -+ -+# -+# Network device support -+# -+# CONFIG_NETDEVICES is not set -+# CONFIG_DUMMY is not set -+# CONFIG_BONDING is not set -+# CONFIG_EQUALIZER is not set -+# CONFIG_TUN is not set -+ -+# -+# PHY device support -+# -+ -+# -+# Ethernet (10 or 100Mbit) -+# -+# CONFIG_NET_ETHERNET is not set -+ -+# -+# Ethernet (1000 Mbit) -+# -+ -+# -+# Ethernet (10000 Mbit) -+# -+# CONFIG_PPP is not set -+# CONFIG_SLIP is not set -+# CONFIG_SHAPER is not set -+# CONFIG_NETCONSOLE is not set -+# CONFIG_NETPOLL is not set -+# CONFIG_NET_POLL_CONTROLLER is not set -+ -+# -+# ISDN subsystem -+# -+# CONFIG_ISDN is not set -+ -+# -+# Telephony Support -+# -+# CONFIG_PHONE is not set -+ -+# -+# Input device support -+# -+CONFIG_INPUT=y -+ -+# -+# Userland interfaces -+# -+CONFIG_INPUT_MOUSEDEV=y -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -+# CONFIG_INPUT_JOYDEV is not set -+# CONFIG_INPUT_TSDEV is not set -+# CONFIG_INPUT_EVDEV is not set -+# CONFIG_INPUT_EVBUG is not set -+ -+# -+# Input Device Drivers -+# -+CONFIG_INPUT_KEYBOARD=y -+# CONFIG_KEYBOARD_ATKBD is not set -+# CONFIG_KEYBOARD_SUNKBD is not set -+# CONFIG_KEYBOARD_LKKBD is not set -+# CONFIG_KEYBOARD_XTKBD is not set -+# CONFIG_KEYBOARD_NEWTON is not set -+# CONFIG_INPUT_MOUSE is not set -+# CONFIG_INPUT_JOYSTICK is not set -+# CONFIG_INPUT_TOUCHSCREEN is not set -+# CONFIG_INPUT_MISC is not set -+ -+# -+# Hardware I/O ports -+# -+CONFIG_SERIO=y -+CONFIG_SERIO_I8042=y -+CONFIG_SERIO_SERPORT=y -+# CONFIG_SERIO_CT82C710 is not set -+# CONFIG_SERIO_RAW is not set -+# CONFIG_GAMEPORT is not set -+ -+# -+# Character devices -+# -+CONFIG_VT=y -+CONFIG_VT_CONSOLE=y -+CONFIG_HW_CONSOLE=y -+# CONFIG_SERIAL_NONSTANDARD is not set -+ -+# -+# Serial drivers -+# -+ -+# -+# Non-8250 serial port support -+# -+CONFIG_UNIX98_PTYS=y -+CONFIG_LEGACY_PTYS=y -+CONFIG_LEGACY_PTY_COUNT=32 -+ -+# -+# IPMI -+# -+# CONFIG_IPMI_HANDLER is not set -+ -+# -+# Watchdog Cards -+# -+# CONFIG_WATCHDOG is not set -+# CONFIG_NVRAM is not set -+# CONFIG_RTC is not set -+# CONFIG_GEN_RTC is not set -+# CONFIG_DTLK is not set -+# CONFIG_R3964 is not set -+ -+# -+# Ftape, the floppy tape device driver -+# -+# CONFIG_FTAPE is not set -+# CONFIG_AGP is not set -+# CONFIG_MWAVE is not set -+# CONFIG_CS5535_GPIO is not set -+# CONFIG_RAW_DRIVER is not set -+# CONFIG_HANGCHECK_TIMER is not set -+ -+# -+# TPM devices -+# -+# CONFIG_TCG_TPM is not set -+# CONFIG_TELCLOCK is not set -+ -+# -+# I2C support -+# -+# CONFIG_I2C is not set -+ -+# -+# SPI support -+# -+# CONFIG_SPI is not set -+# CONFIG_SPI_MASTER is not set -+ -+# -+# Dallas's 1-wire bus -+# -+# CONFIG_W1 is not set -+ -+# -+# Hardware Monitoring support -+# -+# CONFIG_HWMON is not set -+# CONFIG_HWMON_VID is not set -+ -+# -+# Misc devices -+# -+ -+# -+# Multimedia Capabilities Port drivers -+# -+ -+# -+# Multimedia devices -+# -+# CONFIG_VIDEO_DEV is not set -+ -+# -+# Digital Video Broadcasting Devices -+# -+# CONFIG_DVB is not set -+ -+# -+# Graphics support -+# -+# CONFIG_FB is not set -+# CONFIG_VIDEO_SELECT is not set -+ -+# -+# Console display driver support -+# -+CONFIG_VGA_CONSOLE=y -+CONFIG_DUMMY_CONSOLE=y -+ -+# -+# Sound -+# -+# CONFIG_SOUND is not set -+ -+# -+# USB support -+# -+# CONFIG_USB_ARCH_HAS_HCD is not set -+# CONFIG_USB_ARCH_HAS_OHCI is not set -+ -+# -+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' -+# -+ -+# -+# USB Gadget Support -+# -+# CONFIG_USB_GADGET is not set -+ -+# -+# MMC/SD Card support -+# -+# CONFIG_MMC is not set -+ -+# -+# InfiniBand support -+# -+ -+# -+# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) -+# -+# CONFIG_EDAC is not set -+ -+# -+# File systems -+# -+CONFIG_EXT2_FS=y -+CONFIG_EXT2_FS_XATTR=y -+CONFIG_EXT2_FS_POSIX_ACL=y -+CONFIG_EXT2_FS_SECURITY=y -+# CONFIG_EXT2_FS_XIP is not set -+CONFIG_EXT3_FS=y -+CONFIG_EXT3_FS_XATTR=y -+CONFIG_EXT3_FS_POSIX_ACL=y -+CONFIG_EXT3_FS_SECURITY=y -+CONFIG_JBD=y -+# CONFIG_JBD_DEBUG is not set -+CONFIG_FS_MBCACHE=y -+CONFIG_REISERFS_FS=y -+# CONFIG_REISERFS_CHECK is not set -+# CONFIG_REISERFS_PROC_INFO is not set -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=y -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+# CONFIG_JFS_DEBUG is not set -+# CONFIG_JFS_STATISTICS is not set -+CONFIG_FS_POSIX_ACL=y -+CONFIG_XFS_FS=y -+# CONFIG_XFS_QUOTA is not set -+CONFIG_XFS_SECURITY=y -+CONFIG_XFS_POSIX_ACL=y -+# CONFIG_XFS_RT is not set -+# CONFIG_OCFS2_FS is not set -+CONFIG_MINIX_FS=y -+# CONFIG_ROMFS_FS is not set -+CONFIG_INOTIFY=y -+# CONFIG_QUOTA is not set -+CONFIG_DNOTIFY=y -+# CONFIG_AUTOFS_FS is not set -+# CONFIG_AUTOFS4_FS is not set -+# CONFIG_FUSE_FS is not set -+ -+# -+# CD-ROM/DVD Filesystems -+# -+CONFIG_ISO9660_FS=y -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_ZISOFS_FS=y -+# CONFIG_UDF_FS is not set -+ -+# -+# DOS/FAT/NT Filesystems -+# -+CONFIG_FAT_FS=y -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_CODEPAGE=437 -+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -+# CONFIG_NTFS_FS is not set -+ -+# -+# Pseudo filesystems -+# -+CONFIG_PROC_FS=y -+CONFIG_PROC_KCORE=y -+CONFIG_SYSFS=y -+CONFIG_TMPFS=y -+# CONFIG_HUGETLB_PAGE is not set -+CONFIG_RAMFS=y -+# CONFIG_RELAYFS_FS is not set -+# CONFIG_CONFIGFS_FS is not set -+ -+# -+# Miscellaneous filesystems -+# -+# CONFIG_ADFS_FS is not set -+# CONFIG_AFFS_FS is not set -+# CONFIG_HFS_FS is not set -+# CONFIG_HFSPLUS_FS is not set -+# CONFIG_BEFS_FS is not set -+# CONFIG_BFS_FS is not set -+# CONFIG_EFS_FS is not set -+# CONFIG_CRAMFS is not set -+# CONFIG_VXFS_FS is not set -+# CONFIG_HPFS_FS is not set -+# CONFIG_QNX4FS_FS is not set -+CONFIG_SYSV_FS=y -+CONFIG_UFS_FS=y -+ -+# -+# Network File Systems -+# -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3=y -+# CONFIG_NFS_V3_ACL is not set -+CONFIG_NFS_V4=y -+# CONFIG_NFS_DIRECTIO is not set -+# CONFIG_NFSD is not set -+CONFIG_LOCKD=y -+CONFIG_LOCKD_V4=y -+CONFIG_NFS_COMMON=y -+CONFIG_SUNRPC=y -+CONFIG_SUNRPC_GSS=y -+CONFIG_RPCSEC_GSS_KRB5=y -+# CONFIG_RPCSEC_GSS_SPKM3 is not set -+# CONFIG_SMB_FS is not set -+# CONFIG_CIFS is not set -+# CONFIG_NCP_FS is not set -+# CONFIG_CODA_FS is not set -+# CONFIG_AFS_FS is not set -+# CONFIG_9P_FS is not set -+ -+# -+# Partition Types -+# -+CONFIG_PARTITION_ADVANCED=y -+# CONFIG_ACORN_PARTITION is not set -+# CONFIG_OSF_PARTITION is not set -+# CONFIG_AMIGA_PARTITION is not set -+# CONFIG_ATARI_PARTITION is not set -+CONFIG_MAC_PARTITION=y -+CONFIG_MSDOS_PARTITION=y -+CONFIG_BSD_DISKLABEL=y -+CONFIG_MINIX_SUBPARTITION=y -+CONFIG_SOLARIS_X86_PARTITION=y -+CONFIG_UNIXWARE_DISKLABEL=y -+# CONFIG_LDM_PARTITION is not set -+# CONFIG_SGI_PARTITION is not set -+# CONFIG_ULTRIX_PARTITION is not set -+CONFIG_SUN_PARTITION=y -+# CONFIG_KARMA_PARTITION is not set -+CONFIG_EFI_PARTITION=y -+ -+# -+# Native Language Support -+# -+CONFIG_NLS=y -+CONFIG_NLS_DEFAULT="iso8859-1" -+CONFIG_NLS_CODEPAGE_437=y -+# CONFIG_NLS_CODEPAGE_737 is not set -+# CONFIG_NLS_CODEPAGE_775 is not set -+# CONFIG_NLS_CODEPAGE_850 is not set -+# CONFIG_NLS_CODEPAGE_852 is not set -+# CONFIG_NLS_CODEPAGE_855 is not set -+# CONFIG_NLS_CODEPAGE_857 is not set -+# CONFIG_NLS_CODEPAGE_860 is not set -+# CONFIG_NLS_CODEPAGE_861 is not set -+# CONFIG_NLS_CODEPAGE_862 is not set -+# CONFIG_NLS_CODEPAGE_863 is not set -+# CONFIG_NLS_CODEPAGE_864 is not set -+# CONFIG_NLS_CODEPAGE_865 is not set -+# CONFIG_NLS_CODEPAGE_866 is not set -+# CONFIG_NLS_CODEPAGE_869 is not set -+# CONFIG_NLS_CODEPAGE_936 is not set -+# CONFIG_NLS_CODEPAGE_950 is not set -+# CONFIG_NLS_CODEPAGE_932 is not set -+# CONFIG_NLS_CODEPAGE_949 is not set -+# CONFIG_NLS_CODEPAGE_874 is not set -+# CONFIG_NLS_ISO8859_8 is not set -+# CONFIG_NLS_CODEPAGE_1250 is not set -+# CONFIG_NLS_CODEPAGE_1251 is not set -+# CONFIG_NLS_ASCII is not set -+CONFIG_NLS_ISO8859_1=y -+# CONFIG_NLS_ISO8859_2 is not set -+# CONFIG_NLS_ISO8859_3 is not set -+# CONFIG_NLS_ISO8859_4 is not set -+# CONFIG_NLS_ISO8859_5 is not set -+# CONFIG_NLS_ISO8859_6 is not set -+# CONFIG_NLS_ISO8859_7 is not set -+# CONFIG_NLS_ISO8859_9 is not set -+# CONFIG_NLS_ISO8859_13 is not set -+# CONFIG_NLS_ISO8859_14 is not set -+# CONFIG_NLS_ISO8859_15 is not set -+# CONFIG_NLS_KOI8_R is not set -+# CONFIG_NLS_KOI8_U is not set -+# CONFIG_NLS_UTF8 is not set -+ -+# -+# Instrumentation Support -+# -+# CONFIG_PROFILING is not set -+ -+# -+# Kernel hacking -+# -+# CONFIG_PRINTK_TIME is not set -+CONFIG_MAGIC_SYSRQ=y -+CONFIG_DEBUG_KERNEL=y -+CONFIG_LOG_BUF_SHIFT=16 -+CONFIG_DETECT_SOFTLOCKUP=y -+# CONFIG_SCHEDSTATS is not set -+# CONFIG_DEBUG_SLAB is not set -+# CONFIG_DEBUG_MUTEXES is not set -+# CONFIG_DEBUG_SPINLOCK is not set -+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set -+# CONFIG_DEBUG_KOBJECT is not set -+CONFIG_DEBUG_BUGVERBOSE=y -+# CONFIG_DEBUG_INFO is not set -+# CONFIG_DEBUG_FS is not set -+# CONFIG_DEBUG_VM is not set -+CONFIG_FRAME_POINTER=y -+CONFIG_FORCED_INLINING=y -+# CONFIG_RCU_TORTURE_TEST is not set -+CONFIG_EARLY_PRINTK=y -+# CONFIG_DEBUG_STACKOVERFLOW is not set -+# CONFIG_DEBUG_STACK_USAGE is not set -+# CONFIG_DEBUG_PAGEALLOC is not set -+# CONFIG_DEBUG_RODATA is not set -+# CONFIG_4KSTACKS is not set -+ -+# -+# Security options -+# -+# CONFIG_KEYS is not set -+# CONFIG_SECURITY is not set -+ -+# -+# Cryptographic options -+# -+CONFIG_CRYPTO=y -+# CONFIG_CRYPTO_HMAC is not set -+# CONFIG_CRYPTO_NULL is not set -+# CONFIG_CRYPTO_MD4 is not set -+CONFIG_CRYPTO_MD5=y -+# CONFIG_CRYPTO_SHA1 is not set -+# CONFIG_CRYPTO_SHA256 is not set -+# CONFIG_CRYPTO_SHA512 is not set -+# CONFIG_CRYPTO_WP512 is not set -+# CONFIG_CRYPTO_TGR192 is not set -+CONFIG_CRYPTO_DES=y -+# CONFIG_CRYPTO_BLOWFISH is not set -+# CONFIG_CRYPTO_TWOFISH is not set -+# CONFIG_CRYPTO_SERPENT is not set -+# CONFIG_CRYPTO_AES is not set -+# CONFIG_CRYPTO_AES_586 is not set -+# CONFIG_CRYPTO_CAST5 is not set -+# CONFIG_CRYPTO_CAST6 is not set -+# CONFIG_CRYPTO_TEA is not set -+# CONFIG_CRYPTO_ARC4 is not set -+# CONFIG_CRYPTO_KHAZAD is not set -+# CONFIG_CRYPTO_ANUBIS is not set -+# CONFIG_CRYPTO_DEFLATE is not set -+# CONFIG_CRYPTO_MICHAEL_MIC is not set -+# CONFIG_CRYPTO_CRC32C is not set -+# CONFIG_CRYPTO_TEST is not set -+ -+# -+# Hardware crypto devices -+# -+# CONFIG_CRYPTO_DEV_PADLOCK is not set -+CONFIG_XEN=y -+CONFIG_XEN_INTERFACE_VERSION=0x00030203 -+ -+# -+# XEN -+# -+# CONFIG_XEN_PRIVILEGED_GUEST is not set -+CONFIG_XEN_UNPRIVILEGED_GUEST=y -+CONFIG_XEN_PRIVCMD=y -+CONFIG_XEN_XENBUS_DEV=y -+# CONFIG_XEN_BACKEND is not set -+CONFIG_XEN_BLKDEV_FRONTEND=y -+CONFIG_XEN_NETDEV_FRONTEND=y -+CONFIG_XEN_SCRUB_PAGES=y -+CONFIG_XEN_DISABLE_SERIAL=y -+# CONFIG_XEN_SYSFS is not set -+CONFIG_XEN_COMPAT_030002_AND_LATER=y -+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set -+CONFIG_XEN_COMPAT_030002=y -+CONFIG_HAVE_ARCH_ALLOC_SKB=y -+CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y -+CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y -+CONFIG_NO_IDLE_HZ=y -+CONFIG_XEN_UTIL=y -+CONFIG_XEN_BALLOON=y -+CONFIG_XEN_DEVMEM=y -+CONFIG_XEN_SKBUFF=y -+CONFIG_XEN_REBOOT=y -+ -+# -+# Library routines -+# -+# CONFIG_CRC_CCITT is not set -+# CONFIG_CRC16 is not set -+CONFIG_CRC32=y -+# CONFIG_LIBCRC32C is not set -+CONFIG_ZLIB_INFLATE=y -+CONFIG_GENERIC_HARDIRQS=y -+CONFIG_GENERIC_IRQ_PROBE=y -+CONFIG_X86_BIOS_REBOOT=y -+CONFIG_X86_NO_TSS=y -+CONFIG_X86_NO_IDT=y -+CONFIG_KTIME_SCALAR=y -Index: xen-4.1.2-testing/buildconfigs/linux-defconfig_xenUboot_x86_64 -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/buildconfigs/linux-defconfig_xenUboot_x86_64 -@@ -0,0 +1,653 @@ -+# -+# Automatically generated make config: don't edit -+# Linux kernel version: 2.6.16.13-xenUboot -+# Tue Aug 15 16:25:30 2006 -+# -+CONFIG_X86_64=y -+CONFIG_64BIT=y -+CONFIG_X86=y -+CONFIG_SEMAPHORE_SLEEPERS=y -+CONFIG_MMU=y -+CONFIG_RWSEM_GENERIC_SPINLOCK=y -+CONFIG_GENERIC_CALIBRATE_DELAY=y -+CONFIG_X86_CMPXCHG=y -+CONFIG_EARLY_PRINTK=y -+CONFIG_GENERIC_ISA_DMA=y -+CONFIG_GENERIC_IOMAP=y -+CONFIG_ARCH_MAY_HAVE_PC_FDC=y -+CONFIG_DMI=y -+ -+# -+# Code maturity level options -+# -+CONFIG_EXPERIMENTAL=y -+CONFIG_BROKEN_ON_SMP=y -+CONFIG_INIT_ENV_ARG_LIMIT=32 -+ -+# -+# General setup -+# -+CONFIG_LOCALVERSION="" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SWAP=y -+CONFIG_SYSVIPC=y -+# CONFIG_BSD_PROCESS_ACCT is not set -+CONFIG_SYSCTL=y -+# CONFIG_IKCONFIG is not set -+CONFIG_INITRAMFS_SOURCE="../tools/kboot/kboot.initramfs" -+CONFIG_INITRAMFS_ROOT_UID=0 -+CONFIG_INITRAMFS_ROOT_GID=0 -+CONFIG_UID16=y -+CONFIG_VM86=y -+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -+# CONFIG_EMBEDDED is not set -+CONFIG_KALLSYMS=y -+# CONFIG_KALLSYMS_ALL is not set -+# CONFIG_KALLSYMS_EXTRA_PASS is not set -+CONFIG_HOTPLUG=y -+CONFIG_PRINTK=y -+CONFIG_BUG=y -+CONFIG_ELF_CORE=y -+CONFIG_BASE_FULL=y -+CONFIG_FUTEX=y -+CONFIG_EPOLL=y -+CONFIG_SHMEM=y -+CONFIG_CC_ALIGN_FUNCTIONS=0 -+CONFIG_CC_ALIGN_LABELS=0 -+CONFIG_CC_ALIGN_LOOPS=0 -+CONFIG_CC_ALIGN_JUMPS=0 -+CONFIG_SLAB=y -+# CONFIG_TINY_SHMEM is not set -+CONFIG_BASE_SMALL=0 -+# CONFIG_SLOB is not set -+ -+# -+# Loadable module support -+# -+# CONFIG_MODULES is not set -+ -+# -+# Block layer -+# -+# CONFIG_LBD is not set -+ -+# -+# IO Schedulers -+# -+CONFIG_IOSCHED_NOOP=y -+# CONFIG_IOSCHED_AS is not set -+# CONFIG_IOSCHED_DEADLINE is not set -+# CONFIG_IOSCHED_CFQ is not set -+# CONFIG_DEFAULT_AS is not set -+# CONFIG_DEFAULT_DEADLINE is not set -+# CONFIG_DEFAULT_CFQ is not set -+CONFIG_DEFAULT_NOOP=y -+CONFIG_DEFAULT_IOSCHED="noop" -+ -+# -+# Processor type and features -+# -+CONFIG_X86_PC=y -+# CONFIG_X86_VSMP is not set -+# CONFIG_MK8 is not set -+# CONFIG_MPSC is not set -+CONFIG_GENERIC_CPU=y -+CONFIG_X86_64_XEN=y -+CONFIG_X86_NO_TSS=y -+CONFIG_X86_NO_IDT=y -+CONFIG_X86_L1_CACHE_BYTES=128 -+CONFIG_X86_L1_CACHE_SHIFT=7 -+CONFIG_X86_GOOD_APIC=y -+# CONFIG_MICROCODE is not set -+# CONFIG_X86_MSR is not set -+# CONFIG_X86_CPUID is not set -+# CONFIG_X86_XEN_GENAPIC is not set -+# CONFIG_SMP is not set -+CONFIG_PREEMPT_NONE=y -+# CONFIG_PREEMPT_VOLUNTARY is not set -+# CONFIG_PREEMPT is not set -+CONFIG_ARCH_FLATMEM_ENABLE=y -+CONFIG_SELECT_MEMORY_MODEL=y -+CONFIG_FLATMEM_MANUAL=y -+# CONFIG_DISCONTIGMEM_MANUAL is not set -+# CONFIG_SPARSEMEM_MANUAL is not set -+CONFIG_FLATMEM=y -+CONFIG_FLAT_NODE_MEM_MAP=y -+# CONFIG_SPARSEMEM_STATIC is not set -+CONFIG_SPLIT_PTLOCK_CPUS=4096 -+CONFIG_SWIOTLB=y -+CONFIG_KEXEC=y -+# CONFIG_CRASH_DUMP is not set -+CONFIG_PHYSICAL_START=0x100000 -+# CONFIG_SECCOMP is not set -+CONFIG_HZ_100=y -+# CONFIG_HZ_250 is not set -+# CONFIG_HZ_1000 is not set -+CONFIG_HZ=100 -+CONFIG_GENERIC_HARDIRQS=y -+CONFIG_GENERIC_IRQ_PROBE=y -+CONFIG_ISA_DMA_API=y -+ -+# -+# Bus options (PCI etc.) -+# -+# CONFIG_PCI is not set -+# CONFIG_UNORDERED_IO is not set -+ -+# -+# PCCARD (PCMCIA/CardBus) support -+# -+# CONFIG_PCCARD is not set -+ -+# -+# PCI Hotplug Support -+# -+ -+# -+# Executable file formats / Emulations -+# -+CONFIG_BINFMT_ELF=y -+# CONFIG_BINFMT_MISC is not set -+CONFIG_IA32_EMULATION=y -+# CONFIG_IA32_AOUT is not set -+CONFIG_COMPAT=y -+CONFIG_SYSVIPC_COMPAT=y -+ -+# -+# Networking -+# -+# CONFIG_NET is not set -+ -+# -+# Device Drivers -+# -+ -+# -+# Generic Driver Options -+# -+CONFIG_STANDALONE=y -+CONFIG_PREVENT_FIRMWARE_BUILD=y -+# CONFIG_FW_LOADER is not set -+# CONFIG_DEBUG_DRIVER is not set -+ -+# -+# Connector - unified userspace <-> kernelspace linker -+# -+ -+# -+# Memory Technology Devices (MTD) -+# -+# CONFIG_MTD is not set -+ -+# -+# Parallel port support -+# -+# CONFIG_PARPORT is not set -+ -+# -+# Plug and Play support -+# -+ -+# -+# Block devices -+# -+# CONFIG_BLK_DEV_FD is not set -+# CONFIG_BLK_DEV_COW_COMMON is not set -+CONFIG_BLK_DEV_LOOP=y -+# CONFIG_BLK_DEV_CRYPTOLOOP is not set -+CONFIG_BLK_DEV_RAM=y -+CONFIG_BLK_DEV_RAM_COUNT=16 -+CONFIG_BLK_DEV_RAM_SIZE=4096 -+CONFIG_BLK_DEV_INITRD=y -+# CONFIG_CDROM_PKTCDVD is not set -+ -+# -+# ATA/ATAPI/MFM/RLL support -+# -+# CONFIG_IDE is not set -+ -+# -+# SCSI device support -+# -+# CONFIG_RAID_ATTRS is not set -+# CONFIG_SCSI is not set -+ -+# -+# Multi-device support (RAID and LVM) -+# -+CONFIG_MD=y -+CONFIG_BLK_DEV_MD=y -+CONFIG_MD_LINEAR=y -+CONFIG_MD_RAID0=y -+CONFIG_MD_RAID1=y -+# CONFIG_MD_RAID10 is not set -+# CONFIG_MD_RAID5 is not set -+# CONFIG_MD_RAID6 is not set -+# CONFIG_MD_MULTIPATH is not set -+# CONFIG_MD_FAULTY is not set -+CONFIG_BLK_DEV_DM=y -+# CONFIG_DM_CRYPT is not set -+# CONFIG_DM_SNAPSHOT is not set -+# CONFIG_DM_MIRROR is not set -+# CONFIG_DM_ZERO is not set -+# CONFIG_DM_MULTIPATH is not set -+ -+# -+# Fusion MPT device support -+# -+# CONFIG_FUSION is not set -+ -+# -+# IEEE 1394 (FireWire) support -+# -+ -+# -+# I2O device support -+# -+ -+# -+# ISDN subsystem -+# -+ -+# -+# Telephony Support -+# -+# CONFIG_PHONE is not set -+ -+# -+# Input device support -+# -+CONFIG_INPUT=y -+ -+# -+# Userland interfaces -+# -+CONFIG_INPUT_MOUSEDEV=y -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -+# CONFIG_INPUT_JOYDEV is not set -+# CONFIG_INPUT_TSDEV is not set -+# CONFIG_INPUT_EVDEV is not set -+# CONFIG_INPUT_EVBUG is not set -+ -+# -+# Input Device Drivers -+# -+CONFIG_INPUT_KEYBOARD=y -+CONFIG_KEYBOARD_ATKBD=y -+# CONFIG_KEYBOARD_SUNKBD is not set -+# CONFIG_KEYBOARD_LKKBD is not set -+# CONFIG_KEYBOARD_XTKBD is not set -+# CONFIG_KEYBOARD_NEWTON is not set -+# CONFIG_INPUT_MOUSE is not set -+# CONFIG_INPUT_JOYSTICK is not set -+# CONFIG_INPUT_TOUCHSCREEN is not set -+# CONFIG_INPUT_MISC is not set -+ -+# -+# Hardware I/O ports -+# -+CONFIG_SERIO=y -+CONFIG_SERIO_I8042=y -+CONFIG_SERIO_SERPORT=y -+# CONFIG_SERIO_CT82C710 is not set -+CONFIG_SERIO_LIBPS2=y -+# CONFIG_SERIO_RAW is not set -+# CONFIG_GAMEPORT is not set -+ -+# -+# Character devices -+# -+CONFIG_VT=y -+CONFIG_VT_CONSOLE=y -+CONFIG_HW_CONSOLE=y -+# CONFIG_SERIAL_NONSTANDARD is not set -+ -+# -+# Serial drivers -+# -+ -+# -+# Non-8250 serial port support -+# -+CONFIG_UNIX98_PTYS=y -+CONFIG_LEGACY_PTYS=y -+CONFIG_LEGACY_PTY_COUNT=32 -+ -+# -+# IPMI -+# -+# CONFIG_IPMI_HANDLER is not set -+ -+# -+# Watchdog Cards -+# -+# CONFIG_WATCHDOG is not set -+# CONFIG_NVRAM is not set -+# CONFIG_RTC is not set -+# CONFIG_GEN_RTC is not set -+# CONFIG_DTLK is not set -+# CONFIG_R3964 is not set -+ -+# -+# Ftape, the floppy tape device driver -+# -+# CONFIG_FTAPE is not set -+# CONFIG_AGP is not set -+# CONFIG_MWAVE is not set -+# CONFIG_RAW_DRIVER is not set -+# CONFIG_HANGCHECK_TIMER is not set -+ -+# -+# TPM devices -+# -+# CONFIG_TCG_TPM is not set -+# CONFIG_TELCLOCK is not set -+ -+# -+# I2C support -+# -+# CONFIG_I2C is not set -+ -+# -+# SPI support -+# -+# CONFIG_SPI is not set -+# CONFIG_SPI_MASTER is not set -+ -+# -+# Dallas's 1-wire bus -+# -+# CONFIG_W1 is not set -+ -+# -+# Hardware Monitoring support -+# -+# CONFIG_HWMON is not set -+# CONFIG_HWMON_VID is not set -+ -+# -+# Misc devices -+# -+ -+# -+# Multimedia Capabilities Port drivers -+# -+ -+# -+# Multimedia devices -+# -+# CONFIG_VIDEO_DEV is not set -+ -+# -+# Digital Video Broadcasting Devices -+# -+ -+# -+# Graphics support -+# -+# CONFIG_FB is not set -+# CONFIG_VIDEO_SELECT is not set -+ -+# -+# Console display driver support -+# -+CONFIG_VGA_CONSOLE=y -+CONFIG_DUMMY_CONSOLE=y -+ -+# -+# Sound -+# -+# CONFIG_SOUND is not set -+ -+# -+# USB support -+# -+# CONFIG_USB_ARCH_HAS_HCD is not set -+# CONFIG_USB_ARCH_HAS_OHCI is not set -+ -+# -+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' -+# -+ -+# -+# USB Gadget Support -+# -+# CONFIG_USB_GADGET is not set -+ -+# -+# MMC/SD Card support -+# -+# CONFIG_MMC is not set -+ -+# -+# InfiniBand support -+# -+ -+# -+# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) -+# -+# CONFIG_EDAC is not set -+ -+# -+# Firmware Drivers -+# -+# CONFIG_DELL_RBU is not set -+# CONFIG_DCDBAS is not set -+ -+# -+# File systems -+# -+CONFIG_EXT2_FS=y -+CONFIG_EXT2_FS_XATTR=y -+CONFIG_EXT2_FS_POSIX_ACL=y -+CONFIG_EXT2_FS_SECURITY=y -+# CONFIG_EXT2_FS_XIP is not set -+CONFIG_EXT3_FS=y -+CONFIG_EXT3_FS_XATTR=y -+CONFIG_EXT3_FS_POSIX_ACL=y -+CONFIG_EXT3_FS_SECURITY=y -+CONFIG_JBD=y -+# CONFIG_JBD_DEBUG is not set -+CONFIG_FS_MBCACHE=y -+CONFIG_REISERFS_FS=y -+# CONFIG_REISERFS_CHECK is not set -+# CONFIG_REISERFS_PROC_INFO is not set -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=y -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+# CONFIG_JFS_DEBUG is not set -+# CONFIG_JFS_STATISTICS is not set -+CONFIG_FS_POSIX_ACL=y -+CONFIG_XFS_FS=y -+# CONFIG_XFS_QUOTA is not set -+CONFIG_XFS_SECURITY=y -+CONFIG_XFS_POSIX_ACL=y -+# CONFIG_XFS_RT is not set -+CONFIG_MINIX_FS=y -+# CONFIG_ROMFS_FS is not set -+CONFIG_INOTIFY=y -+# CONFIG_QUOTA is not set -+CONFIG_DNOTIFY=y -+# CONFIG_AUTOFS_FS is not set -+# CONFIG_AUTOFS4_FS is not set -+# CONFIG_FUSE_FS is not set -+ -+# -+# CD-ROM/DVD Filesystems -+# -+CONFIG_ISO9660_FS=y -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_ZISOFS_FS=y -+# CONFIG_UDF_FS is not set -+ -+# -+# DOS/FAT/NT Filesystems -+# -+CONFIG_FAT_FS=y -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_CODEPAGE=437 -+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -+# CONFIG_NTFS_FS is not set -+ -+# -+# Pseudo filesystems -+# -+CONFIG_PROC_FS=y -+CONFIG_PROC_KCORE=y -+CONFIG_SYSFS=y -+CONFIG_TMPFS=y -+# CONFIG_HUGETLB_PAGE is not set -+CONFIG_RAMFS=y -+# CONFIG_RELAYFS_FS is not set -+# CONFIG_CONFIGFS_FS is not set -+ -+# -+# Miscellaneous filesystems -+# -+# CONFIG_ADFS_FS is not set -+# CONFIG_AFFS_FS is not set -+# CONFIG_HFS_FS is not set -+# CONFIG_HFSPLUS_FS is not set -+# CONFIG_BEFS_FS is not set -+# CONFIG_BFS_FS is not set -+# CONFIG_EFS_FS is not set -+# CONFIG_CRAMFS is not set -+# CONFIG_VXFS_FS is not set -+# CONFIG_HPFS_FS is not set -+# CONFIG_QNX4FS_FS is not set -+# CONFIG_SYSV_FS is not set -+# CONFIG_UFS_FS is not set -+ -+# -+# Partition Types -+# -+# CONFIG_PARTITION_ADVANCED is not set -+CONFIG_MSDOS_PARTITION=y -+ -+# -+# Native Language Support -+# -+CONFIG_NLS=y -+CONFIG_NLS_DEFAULT="iso8859-1" -+CONFIG_NLS_CODEPAGE_437=y -+# CONFIG_NLS_CODEPAGE_737 is not set -+# CONFIG_NLS_CODEPAGE_775 is not set -+# CONFIG_NLS_CODEPAGE_850 is not set -+# CONFIG_NLS_CODEPAGE_852 is not set -+# CONFIG_NLS_CODEPAGE_855 is not set -+# CONFIG_NLS_CODEPAGE_857 is not set -+# CONFIG_NLS_CODEPAGE_860 is not set -+# CONFIG_NLS_CODEPAGE_861 is not set -+# CONFIG_NLS_CODEPAGE_862 is not set -+# CONFIG_NLS_CODEPAGE_863 is not set -+# CONFIG_NLS_CODEPAGE_864 is not set -+# CONFIG_NLS_CODEPAGE_865 is not set -+# CONFIG_NLS_CODEPAGE_866 is not set -+# CONFIG_NLS_CODEPAGE_869 is not set -+# CONFIG_NLS_CODEPAGE_936 is not set -+# CONFIG_NLS_CODEPAGE_950 is not set -+# CONFIG_NLS_CODEPAGE_932 is not set -+# CONFIG_NLS_CODEPAGE_949 is not set -+# CONFIG_NLS_CODEPAGE_874 is not set -+# CONFIG_NLS_ISO8859_8 is not set -+# CONFIG_NLS_CODEPAGE_1250 is not set -+# CONFIG_NLS_CODEPAGE_1251 is not set -+# CONFIG_NLS_ASCII is not set -+CONFIG_NLS_ISO8859_1=y -+# CONFIG_NLS_ISO8859_2 is not set -+# CONFIG_NLS_ISO8859_3 is not set -+# CONFIG_NLS_ISO8859_4 is not set -+# CONFIG_NLS_ISO8859_5 is not set -+# CONFIG_NLS_ISO8859_6 is not set -+# CONFIG_NLS_ISO8859_7 is not set -+# CONFIG_NLS_ISO8859_9 is not set -+# CONFIG_NLS_ISO8859_13 is not set -+# CONFIG_NLS_ISO8859_14 is not set -+# CONFIG_NLS_ISO8859_15 is not set -+# CONFIG_NLS_KOI8_R is not set -+# CONFIG_NLS_KOI8_U is not set -+# CONFIG_NLS_UTF8 is not set -+ -+# -+# Instrumentation Support -+# -+# CONFIG_PROFILING is not set -+ -+# -+# Kernel hacking -+# -+# CONFIG_PRINTK_TIME is not set -+CONFIG_MAGIC_SYSRQ=y -+CONFIG_DEBUG_KERNEL=y -+CONFIG_LOG_BUF_SHIFT=16 -+CONFIG_DETECT_SOFTLOCKUP=y -+# CONFIG_SCHEDSTATS is not set -+# CONFIG_DEBUG_SLAB is not set -+# CONFIG_DEBUG_MUTEXES is not set -+# CONFIG_DEBUG_SPINLOCK is not set -+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set -+# CONFIG_DEBUG_KOBJECT is not set -+# CONFIG_DEBUG_INFO is not set -+# CONFIG_DEBUG_FS is not set -+# CONFIG_DEBUG_VM is not set -+CONFIG_FRAME_POINTER=y -+CONFIG_FORCED_INLINING=y -+# CONFIG_RCU_TORTURE_TEST is not set -+# CONFIG_DEBUG_RODATA is not set -+ -+# -+# Security options -+# -+# CONFIG_KEYS is not set -+# CONFIG_SECURITY is not set -+ -+# -+# Cryptographic options -+# -+# CONFIG_CRYPTO is not set -+ -+# -+# Hardware crypto devices -+# -+CONFIG_XEN=y -+CONFIG_XEN_INTERFACE_VERSION=0x00030202 -+ -+# -+# XEN -+# -+# CONFIG_XEN_PRIVILEGED_GUEST is not set -+CONFIG_XEN_UNPRIVILEGED_GUEST=y -+CONFIG_XEN_PRIVCMD=y -+CONFIG_XEN_XENBUS_DEV=y -+# CONFIG_XEN_BACKEND is not set -+CONFIG_XEN_BLKDEV_FRONTEND=y -+CONFIG_XEN_SCRUB_PAGES=y -+CONFIG_XEN_DISABLE_SERIAL=y -+# CONFIG_XEN_SYSFS is not set -+CONFIG_XEN_COMPAT_030002_AND_LATER=y -+# CONFIG_XEN_COMPAT_LATEST_ONLY is not set -+CONFIG_XEN_COMPAT_030002=y -+CONFIG_HAVE_ARCH_ALLOC_SKB=y -+CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y -+CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y -+CONFIG_NO_IDLE_HZ=y -+CONFIG_XEN_UTIL=y -+CONFIG_XEN_BALLOON=y -+CONFIG_XEN_DEVMEM=y -+CONFIG_XEN_REBOOT=y -+ -+# -+# Library routines -+# -+# CONFIG_CRC_CCITT is not set -+# CONFIG_CRC16 is not set -+# CONFIG_CRC32 is not set -+# CONFIG_LIBCRC32C is not set -+CONFIG_ZLIB_INFLATE=y -Index: xen-4.1.2-testing/buildconfigs/mk.linux-2.6-xenUboot -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/buildconfigs/mk.linux-2.6-xenUboot -@@ -0,0 +1,2 @@ -+EXTRAVERSION = xenUboot -+include buildconfigs/mk.linux-2.6-xen -Index: xen-4.1.2-testing/tools/kboot/Makefile -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/tools/kboot/Makefile -@@ -0,0 +1,23 @@ -+# -+# tools/kboot/Makefile -+# -+# This file is subject to the terms and conditions of the GNU General -+# Public License. See the file "COPYING" in the main directory of -+# this archive for more details. -+# -+# Copyright (C) 2005 by Christian Limpach -+# -+ -+XEN_ROOT = ../.. -+include $(XEN_ROOT)/tools/Rules.mk -+ -+.PHONY: all clean -+all: kboot.initramfs -+ -+clean: -+ rm -f kboot.initramfs -+ rm -f *~ -+ -+kboot.initramfs: mkinitramfs init select-kernel ../xcutils/xc_kexec -+ sh ./mkinitramfs | tee $@ -+ -Index: xen-4.1.2-testing/tools/kboot/README -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/tools/kboot/README -@@ -0,0 +1,43 @@ -+ -+This is a simple kexec-based boot loader -+======================================== -+ -+Files -+----- -+ -+init this is the /init script for the initramfs -+ -+select-kernel this script searches for bootable xen kernels -+ in a directory (/boot by default). -+ -+mkinitramfs this script generates a file list. It can -+ be passed to CONFIG_INITRAMFS_SOURCE when -+ building a linux kernel. That way you get -+ a linux kernel with the boot loader initramfs -+ compiled in. -+ -+Usage -+----- -+ -+The script gets it arguments from the kernel command line. -+You can use 'extra = "..."' in the domain config file to -+specify them. It recognises the following arguments: -+ -+root= root filesystem (default: /dev/xvda1). -+boot= /boot filesystem (default: none). -+kernel= kernel to boot. If not specified the script -+ inspects /boot and presents a menu in case -+ multiple xen kernels are found. -+ramdisk= ramdisk (initrd) to boot. If not specified -+ the script looks for one matching the kernel -+ file name. -+ -+Any unknown arguments are passed through to the kexec'ed -+kernel. Same goes for the root= argument. -+ -+ -+enjoy, -+ Gerd -+ -+-- -+Gerd Hoffmann -Index: xen-4.1.2-testing/tools/kboot/init -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/tools/kboot/init -@@ -0,0 +1,309 @@ -+#!/bin/sh -+ -+ -+######################################################################## -+# messages -+ -+function msg() { -+ local str="$*" -+ echo "### kboot: $str" -+} -+ -+function dmsg() { -+ local str="$*" -+ test "$debug" = "" && return -+ echo "### kboot debug: $str" -+} -+ -+function banner() { -+ local str="$*" -+ /bin/figlet -f /xen.flf "$str" >/dev/null -+} -+ -+ -+######################################################################## -+# helper functions -+ -+function init_storage_linux() { -+ # activate raid -+ if test -x /bin/mdrun && grep -q mdp /proc/devices; then -+ msg "raid support available, activating" -+ mdrun -+ fi -+ -+ # activate lvm -+ if test -x /bin/lvm && grep -q device-mapper /proc/misc; then -+ msg "lvm support available, activating" -+ lvm vgscan --mknodes -+ lvm vgchange -a y -+ if test "$debug" != ""; then -+ dmsg "physical volumes" -+ lvm pvscan -+ dmsg "logical volumes" -+ lvm lvscan -+ fi -+ fi -+} -+ -+function init_network_dhcp() { -+ if test -x /bin/dhcpcd -a -x /bin/ip &&\ -+ ip link ls 2>/dev/null | grep -q eth0; then -+ msg "network support available" -+ msg "activating eth0 using dhcp (15s max) ..." -+ dhcpcd -t 15 eth0 -+ if test "$?" = "0"; then -+ eval "$(grep IPADDR /var/lib/dhcpcd/dhcpcd-eth0.info)" -+ echo "... worked ok: $IPADDR" -+ else -+ echo "... FAILED" -+ fi -+ fi -+} -+ -+function try_mount() { -+ local dev="$1" -+ local dir="$2" -+ -+ if mount | grep -q " ${dir} "; then -+ msg "$dir already mounted" -+ return 0 -+ fi -+ if mount | grep -q "^${dev} "; then -+ msg "$dev already mounted" -+ return 0 -+ fi -+ mount -t auto -o ro $dev $dir -+ if test "$?" = "0"; then -+ msg "mounted $dev at $dir" -+ return 0 -+ else -+ msg "mounting $dev failed" -+ return 1 -+ fi -+} -+ -+function mount_root_boot() { -+ # mount filesystems -+ try_mount "$root" "/root" || return 1 -+ if test "$boot" != ""; then -+ try_mount "$boot" "/root/boot" || return 1 -+ fi -+} -+ -+function linux_find_kernel() { -+ if test "$kernel" != ""; then -+ return -+ fi -+ kernel="/boot/$(select-kernel /root/boot)" -+} -+ -+function linux_find_ramdisk() { -+ if test "$ramdisk" != ""; then -+ return -+ fi -+ -+ for file in \ -+ /root${kernel//vmlinuz/initrd} \ -+ /root${kernel//vmlinuz/initrd}.gz \ -+ /root${kernel//vmlinuz/initrd}.img \ -+ ; do -+ if test -f "$file"; then -+ ramdisk="${file#/root}" -+ break -+ fi -+ done -+ if test "$ramdisk" != ""; then -+ msg "no ramdisk specified, using $ramdisk" -+ fi -+} -+ -+function solaris_find_kernel() { -+ local solaris="" -+ -+ if test "$kernel" != ""; then -+ return -+ fi -+ -+ case "$(uname -m)" in -+ x86_64) -+ solaris="/platform/i86xen/kernel/amd64/unix" -+ ;; -+ i586 | i686) -+ solaris="/platform/i86xen/kernel/unix" -+ ;; -+ esac -+ -+ if test -f "/root$solaris"; then -+ kernel="$solaris" -+ ramdisk="/platform/i86pc/boot_archive" -+ fi -+} -+ -+function netware_find_kernel() { -+ if test "$kernel" != ""; then -+ return -+ fi -+ -+ for file in \ -+ /nwserver/xnloader.sys \ -+ /NWSERVER/XNLOADER.SYS \ -+ /startup/xnloader.sys \ -+ /STARTUP/XNLOADER.SYS \ -+ ; do -+ test -f "/root${file}" || continue -+ msg "netware loader found: $file" -+ kernel="$file" -+ break; -+ done -+} -+ -+ -+######################################################################## -+# main -+ -+# setup -+export PATH="/sbin:/bin" -+export PS1="kboot panic shell \w# " -+trap "echo; exec /bin/sh" EXIT -+ -+# hello world -+exec < /dev/console > /dev/console 2>&1 -+banner "xen mini kboot" -+ -+# mount pseudo filesystems -+mount -v -t proc proc /proc -+mount -v -t sysfs sysfs /sys -+ -+# defaults for arguments -+root="/dev/xvda1" # root filesystem -+boot="" # /boot filesystem (if present) -+kernel="" # kernel to boot -+ramdisk="" # ramdisk to boot -+debug="" # debug mode -+ -+# parse arguments -+cmdline="" -+for cmd in $(cat /proc/cmdline); do -+ case "$cmd" in -+ root=*) -+ root="${cmd#root=}" -+ ;; -+ boot=*) -+ boot="${cmd#boot=}" -+ ;; -+ kernel=*) -+ kernel="${cmd#kernel=}" -+ ;; -+ ramdisk=*) -+ ramdisk="${cmd#ramdisk=}" -+ ;; -+ debug=*) -+ debug="${cmd#debug=}" -+ ;; -+ *) -+ cmdline="$cmdline $cmd" -+ ;; -+ esac -+done -+cmdline="$cmdline root=$root" -+ -+# create block device nodes -+while read major minor blocks name; do -+ case "$name" in -+ xvd* | hd* | sd*) -+ dmsg "blkdev: /dev/$name, major $major, minor $minor" -+ mknod /dev/$name b $major $minor -+ ;; -+ esac -+done < /proc/partitions -+ -+# mount rootfs (and /boot if specified) -+mount_root_boot -+if test "$?" != "0"; then -+ msg "trying to activate raid and lvm first" -+ init_storage_linux; -+ mount_root_boot || exit 1 -+fi -+ -+# activate network device -+# not (yet?) fetching kernels this way, this is -+# only for testing network device handover ... -+init_network_dhcp; -+ -+# figure rootfs type -+set -- $(mount | grep " /root ") -+rootfstype="$5" -+ -+# find kernel if unspecified -+if test "${kernel}" = ""; then -+ case "$rootfstype" in -+ minix | ext2 | ext3 | reiserfs | xfs) -+ linux_find_kernel -+ ;; -+ ufs) -+ solaris_find_kernel -+ ;; -+ vfat) -+ netware_find_kernel -+ ;; -+ *) -+ msg "no kernel location guess for fs \"$rootfstype\"" -+ ;; -+ esac -+fi -+if test ! -f "/root${kernel}"; then -+ msg "ERROR: kernel \"$kernel\" doesn't exist" -+ exit 1 -+fi -+ -+# OS tweaks -+case "$kernel" in -+*/xnloader.sys | */XNLOADER.SYS ) -+ guestos="Netware" -+ ramdisk="" -+ cmdline="" -+ ;; -+*/unix) -+ guestos="Solaris"; -+ cmdline="$cmdline $kernel" -+ ;; -+*linu[xz]*) -+ guestos="Linux" -+ linux_find_ramdisk -+ ;; -+*) -+ guestos="Unknown" -+ ;; -+esac -+ -+# print configuration -+msg "using this boot configuration:" -+msg " root : $root" -+msg " boot : $boot" -+msg " kernel : $kernel" -+msg " ramdisk: $ramdisk" -+msg " cmdline: $cmdline" -+ -+# load kernel & ramdisk -+kexec="-l " -+if test "$debug" != ""; then -+ kexec="$kexec -d" -+ echo 9 > /proc/sysrq-trigger -+fi -+if test "$kernel" != ""; then -+ kexec="$kexec -k /root${kernel}" -+fi -+if test "$ramdisk" != ""; then -+ kexec="$kexec -i /root${ramdisk}" -+fi -+dmsg "run: xc_kexec $kexec -c \"${cmdline}\"" -+xc_kexec $kexec -c "${cmdline}" || exit 1 -+ -+# cleanup -+msg "cleaning up" -+umount -av -+ -+# go! -+msg "bye ..." -+banner "boot $guestos" -+xc_kexec -e -Index: xen-4.1.2-testing/tools/kboot/mkinitramfs -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/tools/kboot/mkinitramfs -@@ -0,0 +1,111 @@ -+#!/bin/sh -+ -+# config -+binaries="bash mount umount cat mknod mkdir" # required: some shell bits -+binaries="$binaries xc_kexec" # required: kexec stuff -+binaries="$binaries ls rm grep dialog clear" # required by select-kernel -+binaries="$binaries resize" # required by select-kernel -+binaries="$binaries dmesg free ps" # nice for diagnostics -+binaries="$binaries uname sed cp touch mktemp" # some scripts need this -+binaries="$binaries pidofproc logger" # some scripts need this -+ -+optbin="mdrun mdadm lvm" # optional stuff -+optbin="$optbin dhcpcd ip modify_resolvconf" # optional stuff -+ -+############################################################################ -+ -+# setup -+XEN_ROOT=$(pwd | sed -e 's|/[^/]*/[^/]*$||') -+export PATH="${XEN_ROOT}/tools/xcutils:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin" -+export LD_LIBRARY_PATH="${XEN_ROOT}/tools/libxc" -+ -+# use lib64? -+if ldd /bin/sh | grep -qe '/lib64/'; then -+ LIB="/lib64" -+else -+ LIB="/lib" -+fi -+ -+# static filelist entries -+cat <&2 -+} -+ -+# check kernels -+klist="" -+kcount="1" -+for kernel in $(ls -t $kdir/vmlinu[xz]* 2>/dev/null); do -+ msg "checking $kernel ..." -+ type="$(xc_kexec -t -k $kernel)" -+ case "$type" in -+ xen-3.0-x86_32 | xen-3.0-x86_32p | xen-3.0-x86_64) -+ # yes, this is a xen kernel -+ msg "... $type, ok" -+ klist="$klist ${kcount} ${kernel#$kdir/}" -+ eval "kernel${kcount}=${kernel#$kdir/}" -+ kcount=$(( $kcount + 1 )) -+ ;; -+ *) -+ msg "... $type, ignore" -+ continue -+ ;; -+ esac -+done -+if test "$kcount" = "1"; then -+ msg "no xen kernel found in $kdir" -+ exit 1 -+fi -+ -+if test "$kcount" = "2"; then -+ # only one kernel -+ msg "one xen kernel found in $kdir, using it" -+ kernelnr=1 -+else -+ # present menu to pick kernel -+ export TERM=vt100 -+ eval $(resize) -+ kernelnr=$(dialog --stdout --timeout 10 \ -+ --menu "xen kboot -- kernel menu (10s timeout)" \ -+ 20 60 12 $klist) -+ clear >&2 -+ if test "$kernelnr" = ""; then -+ # timeout, also quit via ESC, pick first then -+ kernelnr=1 -+ fi -+fi -+ -+# print result -+eval "kernelname=\${kernel$kernelnr}" -+msg "using $kernelname" -+echo "$kernelname" -+ -Index: xen-4.1.2-testing/make-kboot -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/make-kboot -@@ -0,0 +1,37 @@ -+#!/bin/sh -+ -+test -f .buildenv && source .buildenv -+set -ex -+ -+# update tools -+make -C tools/libxc -+make -C tools/xcutils/helper -+make -C tools/xcutils -+make -C tools/kboot -+ -+# update kernel -+ks=$(echo linux-2.6*-xenUboot) -+if test ! -d "$ks"; then -+ make CONFIGMODE=oldconfig linux-2.6-xenUboot-config -+ ks=$(echo linux-2.6*-xenUboot) -+fi -+if ! grep -q tools/kboot/kboot.initramfs $ks/.config; then -+ # fixup configuration if needed -+ src="$(pwd)/tools/kboot/kboot.initramfs" -+ sed -i.kboot \ -+ -e "/KEXEC/s|.*|CONFIG_KEXEC=y|" \ -+ -e "/INITRAMFS_SOURCE/s|=.*|=\"$src\"|" \ -+ "$ks/.config" -+ make -C "$ks" oldconfig -+fi -+make -C "$ks" -+ -+# copy boot loader -+cp $ks/vmlinuz ../kboot/vmlinuz-xen-kboot.${BTYPE-default} -+cp tools/kboot/README ../kboot/README.vmlinuz-xen-kboot -+ -+# create assembler listings -+objdump -d $ks/vmlinux > vmlinux-xenUboot.asm -+objdump -dr tools/xcutils/helper/helper.elf > helper.asm -+objdump -t tools/xcutils/helper/helper.elf | grep ^0 | sort > helper.sym -+ diff --git a/tools-watchdog-support.patch b/tools-watchdog-support.patch index 3edec07..7a9f344 100644 --- a/tools-watchdog-support.patch +++ b/tools-watchdog-support.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.3-testing/tools/python/xen/xm/create.py +Index: xen-4.2.0-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.1.3-testing/tools/python/xen/xm/create.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/create.py ++++ xen-4.2.0-testing/tools/python/xen/xm/create.py @@ -535,6 +535,21 @@ gopts.var('usbdevice', val='NAME', fn=set_value, default='', use="Name of USB device to add?") @@ -24,7 +24,7 @@ Index: xen-4.1.3-testing/tools/python/xen/xm/create.py gopts.var('description', val='NAME', fn=set_value, default='', use="Description of a domain") -@@ -1092,6 +1107,7 @@ def configure_hvm(config_image, vals): +@@ -1097,6 +1112,7 @@ def configure_hvm(config_image, vals): 'usb', 'usbdevice', 'vcpus', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten', 'vncunused', 'viridian', 'vpt_align', @@ -32,10 +32,10 @@ Index: xen-4.1.3-testing/tools/python/xen/xm/create.py 'xauthority', 'xen_extended_power_mgmt', 'xen_platform_pci', 'memory_sharing' ] -Index: xen-4.1.3-testing/tools/python/xen/xm/xenapi_create.py +Index: xen-4.2.0-testing/tools/python/xen/xm/xenapi_create.py =================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xm/xenapi_create.py -+++ xen-4.1.3-testing/tools/python/xen/xm/xenapi_create.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/xenapi_create.py ++++ xen-4.2.0-testing/tools/python/xen/xm/xenapi_create.py @@ -1113,7 +1113,9 @@ class sxp2xml: 'xen_platform_pci', 'tsc_mode' @@ -47,11 +47,11 @@ Index: xen-4.1.3-testing/tools/python/xen/xm/xenapi_create.py ] platform_configs = [] -Index: xen-4.1.3-testing/tools/python/xen/xend/image.py +Index: xen-4.2.0-testing/tools/python/xen/xend/image.py =================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/image.py -+++ xen-4.1.3-testing/tools/python/xen/xend/image.py -@@ -866,7 +866,8 @@ class HVMImageHandler(ImageHandler): +--- xen-4.2.0-testing.orig/tools/python/xen/xend/image.py ++++ xen-4.2.0-testing/tools/python/xen/xend/image.py +@@ -855,7 +855,8 @@ class HVMImageHandler(ImageHandler): dmargs = [ 'boot', 'fda', 'fdb', 'soundhw', 'localtime', 'serial', 'stdvga', 'isa', @@ -61,7 +61,7 @@ Index: xen-4.1.3-testing/tools/python/xen/xend/image.py for a in dmargs: v = vmConfig['platform'].get(a) -@@ -874,6 +875,7 @@ class HVMImageHandler(ImageHandler): +@@ -863,6 +864,7 @@ class HVMImageHandler(ImageHandler): # python doesn't allow '-' in variable names if a == 'stdvga': a = 'std-vga' if a == 'keymap': a = 'k' @@ -69,11 +69,11 @@ Index: xen-4.1.3-testing/tools/python/xen/xend/image.py # Handle booleans gracefully if a in ['localtime', 'std-vga', 'isa', 'usb', 'acpi']: -Index: xen-4.1.3-testing/tools/python/xen/xend/XendConfig.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py =================================================================== ---- xen-4.1.3-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.1.3-testing/tools/python/xen/xend/XendConfig.py -@@ -191,6 +191,8 @@ XENAPI_PLATFORM_CFG_TYPES = { +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendConfig.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py +@@ -192,6 +192,8 @@ XENAPI_PLATFORM_CFG_TYPES = { 'xen_platform_pci': int, "gfx_passthru": int, 'oos' : int, @@ -82,68 +82,59 @@ Index: xen-4.1.3-testing/tools/python/xen/xend/XendConfig.py } # Xen API console 'other_config' keys. -Index: xen-4.1.3-testing/tools/libxl/libxl_dm.c +Index: xen-4.2.0-testing/tools/libxl/libxl_dm.c =================================================================== ---- xen-4.1.3-testing.orig/tools/libxl/libxl_dm.c -+++ xen-4.1.3-testing/tools/libxl/libxl_dm.c -@@ -117,6 +117,12 @@ static char ** libxl_build_device_model_ - flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL); +--- xen-4.2.0-testing.orig/tools/libxl/libxl_dm.c ++++ xen-4.2.0-testing/tools/libxl/libxl_dm.c +@@ -196,6 +196,12 @@ static char ** libxl__build_device_model + "-usbdevice", b_info->u.hvm.usbdevice, NULL); } } -+ if (info->watchdog || info->watchdog_action) { ++ if (b_info->u.hvm.watchdog || b_info->u.hvm.watchdog_action) { + flexarray_append(dm_args, "-watchdog"); -+ if (info->watchdog_action) { -+ flexarray_vappend(dm_args, "-watchdog-action", info->watchdog_action, NULL); ++ if (b_info->u.hvm.watchdog_action) { ++ flexarray_vappend(dm_args, "-watchdog-action", b_info->u.hvm.watchdog_action, NULL); + } + } - if (info->soundhw) { - flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL); + if (b_info->u.hvm.soundhw) { + flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL); } -@@ -253,6 +259,12 @@ static char ** libxl_build_device_model_ - flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL); +@@ -449,6 +455,12 @@ static char ** libxl__build_device_model + "-usbdevice", b_info->u.hvm.usbdevice, NULL); } } -+ if (info->watchdog || info->watchdog_action) { ++ if (b_info->u.hvm.watchdog || b_info->u.hvm.watchdog_action) { + flexarray_append(dm_args, "-watchdog"); -+ if (info->watchdog_action) { -+ flexarray_vappend(dm_args, "-watchdog-action", info->watchdog_action, NULL); ++ if (b_info->u.hvm.watchdog_action) { ++ flexarray_vappend(dm_args, "-watchdog-action", b_info->u.hvm.watchdog_action, NULL); + } + } - if (info->soundhw) { - flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL); + if (b_info->u.hvm.soundhw) { + flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL); } -Index: xen-4.1.3-testing/tools/libxl/libxl.idl +Index: xen-4.2.0-testing/tools/libxl/libxl_types.idl =================================================================== ---- xen-4.1.3-testing.orig/tools/libxl/libxl.idl -+++ xen-4.1.3-testing/tools/libxl/libxl.idl -@@ -166,6 +166,8 @@ libxl_device_model_info = Struct("device - ("vcpu_avail", integer, False, "vcpus actually available"), - ("xen_platform_pci", integer, False, "enable/disable the xen platform pci device"), - ("extra", libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"), -+ ("watchdog", string, False, "the watchdog device, ib700 or i6300esb"), -+ ("watchdog_action", string, False, "action to take when the watchdog timer expires"), - ], - comment= - """Device Model information. -Index: xen-4.1.3-testing/tools/libxl/xl_cmdimpl.c +--- xen-4.2.0-testing.orig/tools/libxl/libxl_types.idl ++++ xen-4.2.0-testing/tools/libxl/libxl_types.idl +@@ -319,6 +319,8 @@ libxl_domain_build_info = Struct("domain + ("usbdevice", string), + ("soundhw", string), + ("xen_platform_pci", libxl_defbool), ++ ("watchdog", string), ++ ("watchdog_action", string), + ])), + ("pv", Struct(None, [("kernel", string), + ("slack_memkb", MemKB), +Index: xen-4.2.0-testing/tools/libxl/xl_cmdimpl.c =================================================================== ---- xen-4.1.3-testing.orig/tools/libxl/xl_cmdimpl.c -+++ xen-4.1.3-testing/tools/libxl/xl_cmdimpl.c -@@ -365,6 +365,8 @@ static void printf_info(int domid, - printf("\t\t\t(usb %d)\n", dm_info->usb); - printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice); - printf("\t\t\t(apic %d)\n", dm_info->apic); -+ printf("\t\t\t(watchdog %s)\n", dm_info->watchdog); -+ printf("\t\t\t(watchdog_action %s)\n", dm_info->watchdog_action); - printf("\t\t)\n"); - } else { - printf("\t\t(linux %d)\n", b_info->hvm); -@@ -1158,6 +1160,8 @@ skip_vfb: - xlu_cfg_replace_string (config, "soundhw", &dm_info->soundhw); - if (!xlu_cfg_get_long (config, "xen_platform_pci", &l)) - dm_info->xen_platform_pci = l; -+ xlu_cfg_replace_string (config, "watchdog", &dm_info->watchdog); -+ xlu_cfg_replace_string (config, "watchdog_action", &dm_info->watchdog_action); +--- xen-4.2.0-testing.orig/tools/libxl/xl_cmdimpl.c ++++ xen-4.2.0-testing/tools/libxl/xl_cmdimpl.c +@@ -1405,6 +1405,8 @@ skip_vfb: + xlu_cfg_replace_string (config, "soundhw", &b_info->u.hvm.soundhw, 0); + xlu_cfg_get_defbool(config, "xen_platform_pci", + &b_info->u.hvm.xen_platform_pci, 0); ++ xlu_cfg_replace_string (config, "watchdog", &b_info->u.hvm.watchdog, 0); ++ xlu_cfg_replace_string (config, "watchdog_action", &b_info->u.hvm.watchdog_action, 0); + } - if (!xlu_cfg_get_list(config, "device_model_args", &dmargs, &nr_dmargs, 0)) - { + xlu_cfg_destroy(config); diff --git a/tools-xc_kexec.diff b/tools-xc_kexec.diff deleted file mode 100644 index 97ee191..0000000 --- a/tools-xc_kexec.diff +++ /dev/null @@ -1,5124 +0,0 @@ -xc_kexec utility, for domU kexec support. - -Signed-off-by: Gerd Hoffmann ---- - tools/xcutils/Makefile | 10 - tools/xcutils/helper/Makefile | 39 + - tools/xcutils/helper/console.c | 69 ++ - tools/xcutils/helper/ctype.c | 35 + - tools/xcutils/helper/ctype.h | 54 + - tools/xcutils/helper/helper.h | 107 +++ - tools/xcutils/helper/main.c | 651 +++++++++++++++++++ - tools/xcutils/helper/make-offsets.c | 28 - tools/xcutils/helper/printk.c | 1051 ++++++++++++++++++++++++++++++++ - tools/xcutils/helper/string.c | 601 ++++++++++++++++++ - tools/xcutils/helper/vsprintf.c | 842 +++++++++++++++++++++++++ - tools/xcutils/helper/x86_32/div64.h | 48 + - tools/xcutils/helper/x86_32/entry.S | 49 + - tools/xcutils/helper/x86_32/hypercall.h | 360 ++++++++++ - tools/xcutils/helper/x86_64/div64.h | 58 + - tools/xcutils/helper/x86_64/entry.S | 50 + - tools/xcutils/helper/x86_64/hypercall.h | 355 ++++++++++ - tools/xcutils/kexec-syscall.h | 80 ++ - tools/xcutils/xc_kexec.c | 503 +++++++++++++++ - 19 files changed, 4988 insertions(+), 2 deletions(-) - -Index: xen-4.1.0-testing/tools/xcutils/Makefile -=================================================================== ---- xen-4.1.0-testing.orig/tools/xcutils/Makefile -+++ xen-4.1.0-testing/tools/xcutils/Makefile -@@ -14,7 +14,7 @@ include $(XEN_ROOT)/tools/Rules.mk - CFLAGS += -Werror - CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) - --PROGRAMS = xc_restore xc_save readnotes lsevtchn -+PROGRAMS = xc_restore xc_save readnotes lsevtchn xc_kexec - - LDLIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) - -@@ -27,6 +27,11 @@ build: $(PROGRAMS) - $(PROGRAMS): %: %.o - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@ - -+xc_kexec.o: xc_kexec.c helper/blob.h -+ -+helper/blob.h: -+ make -C helper -+ - .PHONY: install - install: build - $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR) -@@ -37,5 +42,6 @@ install: build - clean: - $(RM) *.o $(PROGRAMS) - $(RM) $(DEPS) -+ make -C helper clean - - -include $(DEPS) -Index: xen-4.1.0-testing/tools/xcutils/helper/Makefile -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/Makefile -@@ -0,0 +1,39 @@ -+ -+XEN_ROOT = ../../.. -+include $(XEN_ROOT)/tools/Rules.mk -+ -+OBJS := $(XEN_TARGET_ARCH)/entry.o -+OBJS += main.o console.o vsprintf.o string.o ctype.o -+ -+CFLAGS += -g -I$(XEN_ROOT)/tools/libxc -I$(XEN_TARGET_ARCH) -I$(XEN_INCLUDE) -+ -+ifeq ($(XEN_TARGET_ARCH),x86_32) -+HLP_LDFLAGS := -melf_i386 -+endif -+ -+HLP_LDFLAGS += --section-start .text=0x10000 -+HLP_LDFLAGS += --section-start .data=0x20000 -+HLP_LDFLAGS += --emit-relocs -+ -+##################### -+# rules -+ -+all: blob.h -+ -+clean: -+ rm -rf helper.elf blob.h -+ rm -rf $(OBJS) *~ -+ -+helper.elf: $(OBJS) -+ ld $(HLP_LDFLAGS) -o $@ $^ -+ -+blob.h: helper.elf -+ hexdump -v -e '1/1 "0x%02x,\n"' $< > $@ -+ -+$(XEN_TARGET_ARCH)/offsets.h: make-offsets -+ ./make-offsets > $@ -+ -+##################### -+# dependencies -+ -+$(XEN_TARGET_ARCH)/entry.o: $(XEN_TARGET_ARCH)/entry.S $(XEN_TARGET_ARCH)/offsets.h -Index: xen-4.1.0-testing/tools/xcutils/helper/console.c -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/console.c -@@ -0,0 +1,69 @@ -+#include -+ -+#include -+#include -+#include "hypercall.h" -+ -+#include "helper.h" -+ -+static inline int notify_remote_via_evtchn(int port) -+{ -+ struct evtchn_send send; -+ send.port = port; -+ return HYPERVISOR_event_channel_op(EVTCHNOP_send, &send); -+} -+ -+static inline struct xencons_interface *xencons_interface(void) -+{ -+ return (void*)(console_page); -+} -+ -+static int xencons_ring_send(const char *data, unsigned len) -+{ -+ int sent = 0; -+ struct xencons_interface *intf = xencons_interface(); -+ XENCONS_RING_IDX cons, prod; -+ -+ cons = intf->out_cons; -+ prod = intf->out_prod; -+ xen_mb(); -+ -+ while ((sent < len) && ((prod - cons) < sizeof(intf->out))) -+ intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = data[sent++]; -+ -+ xen_wmb(); -+ intf->out_prod = prod; -+ -+ if (0 != notify_remote_via_evtchn(console_evtchn)) -+ return -1; -+ return sent; -+} -+ -+int printk(const char *fmt, ...) -+{ -+ va_list args; -+ int r; -+ -+ va_start(args, fmt); -+ r = vprintk(fmt, args); -+ va_end(args); -+ -+ return r; -+} -+ -+int vprintk(const char *fmt, va_list args) -+{ -+ static char printk_buf[1024]; -+ static char prefix[] = "printk: "; -+ int printed_len; -+ -+ /* Emit the output into the temporary buffer */ -+ printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args); -+ if (xencons_ring_send(printk_buf, printed_len) < 0) { -+ /* shouldn't happen, but better have a fallback ;) */ -+ HYPERVISOR_console_io(CONSOLEIO_write, strlen(prefix), prefix); -+ HYPERVISOR_console_io(CONSOLEIO_write, printed_len, printk_buf); -+ } -+ -+ return printed_len; -+} -Index: xen-4.1.0-testing/tools/xcutils/helper/ctype.c -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/ctype.c -@@ -0,0 +1,35 @@ -+/* -+ * linux/lib/ctype.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ */ -+ -+#include "helper.h" -+ -+unsigned char _ctype[] = { -+_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ -+_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ -+_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ -+_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ -+_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ -+_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ -+_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ -+_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ -+_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ -+_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ -+_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ -+_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ -+_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ -+_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ -+_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ -+_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ -+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ -+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ -+_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ -+_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ -+_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ -+_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */ -+_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ -+_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ -+ -+EXPORT_SYMBOL(_ctype); -Index: xen-4.1.0-testing/tools/xcutils/helper/ctype.h -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/ctype.h -@@ -0,0 +1,54 @@ -+#ifndef _LINUX_CTYPE_H -+#define _LINUX_CTYPE_H -+ -+/* -+ * NOTE! This ctype does not handle EOF like the standard C -+ * library is required to. -+ */ -+ -+#define _U 0x01 /* upper */ -+#define _L 0x02 /* lower */ -+#define _D 0x04 /* digit */ -+#define _C 0x08 /* cntrl */ -+#define _P 0x10 /* punct */ -+#define _S 0x20 /* white space (space/lf/tab) */ -+#define _X 0x40 /* hex digit */ -+#define _SP 0x80 /* hard space (0x20) */ -+ -+extern unsigned char _ctype[]; -+ -+#define __ismask(x) (_ctype[(int)(unsigned char)(x)]) -+ -+#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) -+#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) -+#define iscntrl(c) ((__ismask(c)&(_C)) != 0) -+#define isdigit(c) ((__ismask(c)&(_D)) != 0) -+#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) -+#define islower(c) ((__ismask(c)&(_L)) != 0) -+#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) -+#define ispunct(c) ((__ismask(c)&(_P)) != 0) -+#define isspace(c) ((__ismask(c)&(_S)) != 0) -+#define isupper(c) ((__ismask(c)&(_U)) != 0) -+#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) -+ -+#define isascii(c) (((unsigned char)(c))<=0x7f) -+#define toascii(c) (((unsigned char)(c))&0x7f) -+ -+static inline unsigned char __tolower(unsigned char c) -+{ -+ if (isupper(c)) -+ c -= 'A'-'a'; -+ return c; -+} -+ -+static inline unsigned char __toupper(unsigned char c) -+{ -+ if (islower(c)) -+ c -= 'a'-'A'; -+ return c; -+} -+ -+#define tolower(c) __tolower(c) -+#define toupper(c) __toupper(c) -+ -+#endif -Index: xen-4.1.0-testing/tools/xcutils/helper/helper.h -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/helper.h -@@ -0,0 +1,107 @@ -+#include -+#include -+#include -+#include -+ -+#if defined(__i386__) -+typedef unsigned int size_t; -+typedef int ptrdiff_t; -+#define BITS_PER_LONG 32 -+#elif defined(__x86_64__) -+typedef unsigned long size_t; -+typedef long ptrdiff_t; -+#define BITS_PER_LONG 64 -+#else -+#error fixme please: unknown arch -+#endif -+ -+/* from linux */ -+#include "ctype.h" -+#include "div64.h" -+ -+/* some stuff to compile linux kernel sources almost unmodified */ -+#define unlikely(x) (x) -+#define WARN_ON(x) -+#define BUG_ON(x) -+#define EXPORT_SYMBOL(x) -+ -+#ifndef PAGE_SHIFT -+# define PAGE_SHIFT 12 -+# define PAGE_SIZE (1< -+#include "hypercall.h" -+ -+#include "helper.h" -+#undef machine_to_phys_mapping -+ -+/* filled by xc_kexec */ -+unsigned long debug_level = 0; -+unsigned long virt_base; -+unsigned long virt_hypercall; -+unsigned long console_evtchn; -+#if defined(__i386__) -+unsigned long pae_paging; -+#endif -+struct vcpu_guest_context vcpu; -+ -+/* passed by trampoline in %esi */ -+struct start_info *old_info; -+ -+/* my data */ -+static struct start_info *new_info; -+static xen_pfn_t *phys_to_machine_mapping; -+static xen_pfn_t *machine_to_phys_mapping; -+static void (*start_kernel)(void); -+ -+/* magic pages */ -+page_t console_page; -+page_t xenstore_page; -+static page_t shared_info_page; -+static struct shared_info *shared_info = (void*)shared_info_page; -+ -+#define dprintk if (debug_level >= 1) printk -+ -+/* ------------------------------------------------------------------ */ -+ -+static unsigned char xen_features[XENFEAT_NR_SUBMAPS * 32]; -+#define xen_feature(flag) (xen_features[flag]) -+ -+static void setup_xen_features(void) -+{ -+ xen_feature_info_t fi; -+ int i, j; -+ -+ for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) { -+ fi.submap_idx = i; -+ if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0) -+ break; -+ for (j=0; j<32; j++) -+ xen_features[i*32+j] = !!(fi.submap & 1< -+#include -+static void xenstore_debug(void) -+{ -+ struct xenstore_domain_interface *xs = (void*)xenstore_page; -+ -+ printk("xs: req %4d -> %4d\r\n", xs->req_cons, xs->req_prod); -+ printk("xs: rsp %4d -> %4d\r\n", xs->rsp_cons, xs->rsp_prod); -+ if (xs->req_cons != xs->req_prod) -+ return; -+ if (xs->rsp_cons != xs->rsp_prod) -+ return; -+ -+ memset(xenstore_page, 0, PAGE_SIZE); -+ xen_wmb(); -+ printk("xs: debug fixup [zero page] done\r\n"); -+} -+#endif -+ -+/* ------------------------------------------------------------------ */ -+ -+#define INVALID_P2M_ENTRY (~0UL) -+#define FOREIGN_FRAME_BIT (1UL<<31) -+#define pfn_to_mfn(pfn) (phys_to_machine_mapping[pfn] & ~FOREIGN_FRAME_BIT) -+#define mfn_to_pfn(mfn) (machine_to_phys_mapping[mfn]) -+#define set_phys_to_machine(pfn, mfn) (phys_to_machine_mapping[pfn] = mfn) -+#define phys_to_machine_mapping_valid(pfn) (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY) -+ -+void xen_machphys_update(unsigned long mfn, unsigned long pfn) -+{ -+ mmu_update_t u; -+ int rc; -+ -+ u.ptr = ((unsigned long long)mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE; -+ u.val = pfn; -+ rc = HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF); -+ if (0 == rc) -+ return; -+ printk("Oops: HYPERVISOR_mmu_update: rc=%d\r\n",rc); -+} -+ -+static void swap_pages_p2m(unsigned long pfn1, unsigned long pfn2) -+{ -+ unsigned long mfn1, mfn2; -+ -+ mfn1 = phys_to_machine_mapping_valid(pfn1) -+ ? pfn_to_mfn(pfn1) : INVALID_P2M_ENTRY; -+ mfn2 = phys_to_machine_mapping_valid(pfn2) -+ ? pfn_to_mfn(pfn2) : INVALID_P2M_ENTRY; -+ dprintk("%s: pfn %5lx / mfn %5lx <=> pfn %5lx / mfn %5lx\r\n", -+ __FUNCTION__, pfn1, mfn1, pfn2, mfn2); -+ -+ if (mfn1 != INVALID_P2M_ENTRY) -+ xen_machphys_update(mfn1, INVALID_P2M_ENTRY); -+ if (mfn2 != INVALID_P2M_ENTRY) -+ xen_machphys_update(mfn2, INVALID_P2M_ENTRY); -+ -+ set_phys_to_machine(pfn2, mfn1); -+ if (mfn1 != INVALID_P2M_ENTRY) -+ xen_machphys_update(mfn1, pfn2); -+ -+ set_phys_to_machine(pfn1, mfn2); -+ if (mfn2 != INVALID_P2M_ENTRY) -+ xen_machphys_update(mfn2, pfn1); -+} -+ -+static void plug_holes_p2m(void) -+{ -+ unsigned long pfns = shared_info->arch.max_pfn; -+ unsigned long take, give; -+ int count = 0; -+ -+ take = 0; -+ give = pfns-1; -+ -+ for (;;) { -+ while (take < give && phys_to_machine_mapping_valid(take)) -+ take++; -+ for (; take < give; give--) { -+ if (!phys_to_machine_mapping_valid(give)) -+ continue; -+ break; -+ } -+ if (take >= give) -+ break; -+ swap_pages_p2m(give--,take++); -+ count++; -+ } -+ if (!phys_to_machine_mapping_valid(take)) -+ take--; -+ -+ new_info->nr_pages = take+1; -+ dprintk("%s: %d swaps, nr_pages is 0x%lx (0x%lx max)\r\n", -+ __FUNCTION__, count, new_info->nr_pages, pfns); -+} -+ -+static void fillup_memory_p2m(void) -+{ -+ struct xen_memory_reservation reservation = { -+ .mem_flags = 0, -+ .extent_order = 0, -+ .nr_extents = 1, -+ .domid = DOMID_SELF, -+ }; -+ unsigned long pfns = shared_info->arch.max_pfn; -+ unsigned long pfn, mfn; -+ int rc, count = 0; -+ -+ for (pfn = new_info->nr_pages; pfn < pfns; count++, pfn++) { -+ set_xen_guest_handle(reservation.extent_start, &mfn); -+ rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, -+ &reservation); -+ if (1 != rc) -+ break; -+ xen_machphys_update(mfn, pfn); -+ set_phys_to_machine(pfn, mfn); -+ } -+ -+ new_info->nr_pages = pfn; -+ printk("%s: got %d pages, nr_pages is 0x%lx (0x%lx max)\r\n", -+ __FUNCTION__, count, new_info->nr_pages, pfns); -+} -+ -+#define P2M_ENTRIES (PAGE_SIZE/sizeof(xen_pfn_t)) -+#define mfn_to_addr(mfn) ((void*)(mfn_to_pfn(mfn) << PAGE_SHIFT)) -+ -+static void p2m_copy(void) -+{ -+ xen_pfn_t *mfn_lol = NULL, *mfn_list = NULL; -+ unsigned int off_lol = 0, off_list = 0; -+ xen_pfn_t pfn; -+ -+ phys_to_machine_mapping = (unsigned long*)(new_info->mfn_list - virt_base); -+ for (pfn = 0; pfn < shared_info->arch.max_pfn; pfn += P2M_ENTRIES) { -+ if (0 == pfn) { -+ mfn_lol = mfn_to_addr(shared_info->arch.pfn_to_mfn_frame_list_list); -+ off_lol = 0; -+ } -+ if (0 == (pfn % (P2M_ENTRIES * P2M_ENTRIES))) { -+ mfn_list = mfn_to_addr(mfn_lol[off_lol++]); -+ off_list = 0; -+ } -+ memcpy(phys_to_machine_mapping + pfn, -+ mfn_to_addr(mfn_list[off_list++]), -+ PAGE_SIZE); -+ } -+} -+ -+static void xen_tlb_flush(void) -+{ -+ struct mmuext_op op; -+ op.cmd = MMUEXT_TLB_FLUSH_LOCAL; -+ HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF); -+} -+ -+/* ------------------------------------------------------------------ */ -+ -+#if defined(__i386__) -+ -+static void map_page_32(page_t page, unsigned long mfn, unsigned long flags) -+{ -+ unsigned long vaddr = (unsigned long)page; -+ uint32_t *pgd = (void*)old_info->pt_base; -+ uint32_t *pte; -+ unsigned long pfn; -+ int pgd_off, pte_off; -+ -+ pgd_off = (vaddr >> 22) & (1024-1); -+ pte_off = (vaddr >> 12) & (1024-1); -+ -+ pfn = mfn_to_pfn(pgd[pgd_off] >> PAGE_SHIFT); -+ pte = (void*)(pfn << PAGE_SHIFT); -+ -+ pte[pte_off] = (mfn << PAGE_SHIFT) | flags; -+} -+ -+static void map_virt_base_32(void) -+{ -+ mmu_update_t u; -+ xen_pfn_t pgd_mfn = pfn_to_mfn(old_info->pt_base >> PAGE_SHIFT); -+ uint32_t *pgd_ma = (void*)(pgd_mfn << PAGE_SHIFT); -+ uint32_t *pgd = (void*)old_info->pt_base; -+ uint32_t pgd_virt = virt_base >> 22; -+ uint32_t pgd_low = 0; -+ -+ if (pgd_virt << 22 != virt_base) { -+ printk("%s: warning: virt_base is not at pgd entry border,\r\n" -+ " that will work only if old and new kernel have\r\n" -+ " an identical virt_base.\r\n", __FUNCTION__); -+ return; -+ } -+ -+ for (;;) { -+ if (!(pgd[pgd_low] & _PAGE_PRESENT)) -+ return; -+ u.ptr = (unsigned long)(pgd_ma + pgd_virt); -+ u.val = pgd[pgd_low]; -+ if (HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0) { -+ printk("%s: mmu_update failed [l2 0x%x -> 0x%x]\r\n", -+ __FUNCTION__, pgd_low, pgd_virt); -+ return; -+ } -+ pgd_virt++; -+ pgd_low++; -+ } -+} -+ -+static void map_page_pae(page_t page, unsigned long mfn, unsigned long flags) -+{ -+ unsigned long vaddr = (unsigned long)page; -+ uint64_t *pgd = (void*)old_info->pt_base; -+ uint64_t *pmd; -+ uint64_t *pte; -+ unsigned long pfn; -+ int pgd_off, pmd_off, pte_off; -+ -+ pgd_off = (vaddr >> 30) & (4-1); -+ pmd_off = (vaddr >> 21) & (512-1); -+ pte_off = (vaddr >> 12) & (512-1); -+ -+ pfn = mfn_to_pfn(pgd[pgd_off] >> PAGE_SHIFT); -+ pmd = (void*)(pfn << PAGE_SHIFT); -+ pfn = mfn_to_pfn(pmd[pmd_off] >> PAGE_SHIFT); -+ pte = (void*)(pfn << PAGE_SHIFT); -+ -+ pte[pte_off] = (mfn << PAGE_SHIFT) | flags; -+} -+ -+static void map_virt_base_pae(void) -+{ -+ mmu_update_t u; -+ xen_pfn_t pgd_mfn = pfn_to_mfn(old_info->pt_base >> PAGE_SHIFT); -+ uint64_t *pgd_ma = (void*)(pgd_mfn << PAGE_SHIFT); -+ uint64_t *pgd = (void*)old_info->pt_base; -+ int i; -+ -+ for (i = 1; i <= 2; i++) { -+ u.ptr = (unsigned long)(pgd_ma + i); -+ u.val = pgd[0]; -+ if (HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0) { -+ printk("%s: mmu_update failed [l3 0 -> %d]\r\n", -+ __FUNCTION__, i); -+ return; -+ } -+ } -+} -+ -+static void map_page(page_t page, unsigned long mfn, unsigned long flags) -+{ -+ if (pae_paging) -+ map_page_pae(page, mfn, flags); -+ else -+ map_page_32(page, mfn, flags); -+ xen_tlb_flush(); -+ xen_wmb(); -+} -+ -+static void map_virt_base(void) -+{ -+ if (pae_paging) -+ map_virt_base_pae(); -+ else -+ map_virt_base_32(); -+ xen_tlb_flush(); -+ xen_wmb(); -+} -+ -+static void fixup_pagetables_32(void) -+{ -+ uint32_t *pgd = (void*)new_info->pt_base - virt_base; -+ uint32_t *pte; -+ uint32_t flg; -+ unsigned long pfn; -+ int l2, l1; -+ -+ dprintk("%s: pgd at 0x%p\r\n", __FUNCTION__, pgd); -+ for (l2 = 0; l2 < 1024; l2++) { -+ if (!pgd[l2] & 1) -+ continue; -+ flg = pgd[l2] & (PAGE_SIZE-1); -+ pfn = pgd[l2] >> PAGE_SHIFT; -+ pgd[l2] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ -+#if 1 -+ /* Dirty hack alert: Add identity map for first 4MB, -+ * so we don't kill ourself when activating the new -+ * kernel's page tables. May have the side effect of -+ * killing the kernel later. */ -+ if (!pgd[0]) -+ pgd[0] = pgd[l2]; -+#endif -+ -+ pte = (void*)(pfn << PAGE_SHIFT); -+ dprintk("%s: pte at 0x%p\r\n", __FUNCTION__, pte); -+ for (l1 = 0; l1 < 1024; l1++) { -+ if (!pte[l1] & 1) -+ continue; -+ flg = pte[l1] & (PAGE_SIZE-1); -+ pfn = pte[l1] >> PAGE_SHIFT; -+ pte[l1] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ } -+ } -+} -+ -+static void fixup_pagetables_pae(void) -+{ -+ uint64_t *pgd = (void*)new_info->pt_base - virt_base; -+ uint64_t *pmd; -+ uint64_t *pte; -+ uint64_t flg; -+ unsigned long pfn; -+ int l3, l2, l1; -+ -+ dprintk("%s: pgd at 0x%p\r\n", __FUNCTION__, pgd); -+ for (l3 = 0; l3 < 4; l3++) { -+ if (!pgd[l3] & 1) -+ continue; -+ flg = pgd[l3] & (PAGE_SIZE-1); -+ pfn = pgd[l3] >> PAGE_SHIFT; -+ pgd[l3] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ -+ pmd = (void*)(pfn << PAGE_SHIFT); -+ dprintk("%s: pmd at 0x%p\r\n", __FUNCTION__, pmd); -+ for (l2 = 0; l2 < 512; l2++) { -+ if (!pmd[l2] & 1) -+ continue; -+ flg = pmd[l2] & (PAGE_SIZE-1); -+ pfn = pmd[l2] >> PAGE_SHIFT; -+ pmd[l2] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ -+ pte = (void*)(pfn << PAGE_SHIFT); -+ dprintk("%s: pte at 0x%p\r\n", __FUNCTION__, pte); -+ for (l1 = 0; l1 < 512; l1++) { -+ if (!pte[l1] & 1) -+ continue; -+ flg = pte[l1] & (PAGE_SIZE-1); -+ pfn = pte[l1] >> PAGE_SHIFT; -+ pte[l1] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ } -+ } -+ } -+} -+ -+static void fixup_pagetables(void) -+{ -+ if (pae_paging) -+ fixup_pagetables_pae(); -+ else -+ fixup_pagetables_32(); -+} -+ -+#endif /* i386 */ -+ -+#if defined(__x86_64__) -+ -+static void map_page(page_t page, unsigned long mfn, unsigned long flags) -+{ -+ unsigned long vaddr = (unsigned long)page; -+ uint64_t *pgd = (void*)old_info->pt_base; -+ uint64_t *pud; -+ uint64_t *pmd; -+ uint64_t *pte; -+ xen_pfn_t pfn; -+ int pgd_off, pud_off, pmd_off, pte_off; -+ -+ pgd_off = (vaddr >> 39) & (512-1); -+ pud_off = (vaddr >> 30) & (512-1); -+ pmd_off = (vaddr >> 21) & (512-1); -+ pte_off = (vaddr >> 12) & (512-1); -+ -+ pfn = mfn_to_pfn(pgd[pgd_off] >> PAGE_SHIFT); -+ pud = (void*)(pfn << PAGE_SHIFT); -+ pfn = mfn_to_pfn(pud[pud_off] >> PAGE_SHIFT); -+ pmd = (void*)(pfn << PAGE_SHIFT); -+ pfn = mfn_to_pfn(pmd[pmd_off] >> PAGE_SHIFT); -+ pte = (void*)(pfn << PAGE_SHIFT); -+ -+ pte[pte_off] = (mfn << PAGE_SHIFT) | flags; -+ -+ xen_tlb_flush(); -+ xen_wmb(); -+} -+ -+static void map_virt_base(void) -+{ -+ mmu_update_t u; -+ xen_pfn_t pgd_mfn = pfn_to_mfn(old_info->pt_base >> PAGE_SHIFT); -+ uint64_t *pgd_ma = (void*)(pgd_mfn << PAGE_SHIFT); -+ uint64_t *pgd = (void*)old_info->pt_base; -+ uint64_t pgd_virt = (virt_base >> 39); -+ uint64_t pgd_low = 0; -+ -+ if (pgd_virt << 39 != virt_base) { -+ printk("%s: warning: virt_base is not at pgd entry border,\r\n" -+ " that will work only if old and new kernel have\r\n" -+ " an identical virt_base.\r\n", __FUNCTION__); -+ return; -+ } -+ -+ for (;;) { -+ if (!(pgd[pgd_low] & _PAGE_PRESENT)) -+ break; -+ u.ptr = (unsigned long)(pgd_ma + pgd_virt); -+ u.val = pgd[pgd_low]; -+ printk("%s: ptr 0x%" PRIx64" val 0x%" PRIx64"\r\n", -+ __FUNCTION__, u.ptr, u.val); -+ if (HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0) { -+ printk("%s: mmu_update failed [l4 0x%lx -> 0x%lx]\r\n", -+ __FUNCTION__, pgd_low, pgd_virt); -+ break; -+ } -+ pgd_virt++; -+ pgd_low++; -+ } -+ xen_tlb_flush(); -+ xen_wmb(); -+} -+ -+static void fixup_pagetables(void) -+{ -+ uint64_t *pgd = (void*)new_info->pt_base - virt_base; -+ uint64_t *pud; -+ uint64_t *pmd; -+ uint64_t *pte; -+ uint64_t flg; -+ unsigned long pfn; -+ int l4, l3, l2, l1; -+ -+ dprintk("%s: pgd at 0x%p\r\n", __FUNCTION__, pgd); -+ for (l4 = 0; l4 < 512; l4++) { -+ if (!pgd[l4] & 1) -+ continue; -+ flg = pgd[l4] & (PAGE_SIZE-1); -+ pfn = pgd[l4] >> PAGE_SHIFT; -+ pgd[l4] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ -+ pud = (void*)(pfn << PAGE_SHIFT); -+ dprintk("%s: pud at 0x%p\r\n", __FUNCTION__, pud); -+ for (l3 = 0; l3 < 512; l3++) { -+ if (!pud[l3] & 1) -+ continue; -+ flg = pud[l3] & (PAGE_SIZE-1); -+ pfn = pud[l3] >> PAGE_SHIFT; -+ pud[l3] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ -+ pmd = (void*)(pfn << PAGE_SHIFT); -+ dprintk("%s: pmd at 0x%p\r\n", __FUNCTION__, pmd); -+ for (l2 = 0; l2 < 512; l2++) { -+ if (!pmd[l2] & 1) -+ continue; -+ flg = pmd[l2] & (PAGE_SIZE-1); -+ pfn = pmd[l2] >> PAGE_SHIFT; -+ pmd[l2] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ -+ pte = (void*)(pfn << PAGE_SHIFT); -+ dprintk("%s: pte at 0x%p\r\n", __FUNCTION__, pte); -+ for (l1 = 0; l1 < 512; l1++) { -+ if (!pte[l1] & 1) -+ continue; -+ flg = pte[l1] & (PAGE_SIZE-1); -+ pfn = pte[l1] >> PAGE_SHIFT; -+ pte[l1] = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flg; -+ } -+ } -+ } -+ } -+} -+ -+#endif /* x86_64 */ -+ -+/* ------------------------------------------------------------------ */ -+ -+static void print_start_info(char *name, struct start_info *info) -+{ -+ if (!debug_level) -+ return; -+ printk("%s start_info page @ %p\r\n", name, info); -+ printk(" magic \"%s\"\r\n", info->magic); -+ printk(" nr_pages 0x%lx\r\n", info->nr_pages); -+ printk(" shared_info 0x%lx\r\n", info->shared_info); -+ printk(" flags 0x%x\r\n", info->flags); -+ printk(" store_mfn 0x%lx\r\n", info->store_mfn); -+ printk(" store_evtchn %d\r\n", info->store_evtchn); -+ printk(" console.mfn 0x%lx\r\n", info->console.domU.mfn); -+ printk(" console.evtchn %d\r\n", info->console.domU.evtchn); -+ printk(" pt_base 0x%lx\r\n", info->pt_base); -+ printk(" nr_pt_frames 0x%lx\r\n", info->nr_pt_frames); -+ printk(" mfn_list 0x%lx\r\n", info->mfn_list); -+ printk(" mod_start 0x%lx\r\n", info->mod_start); -+ printk(" mod_len 0x%lx\r\n", info->mod_len); -+ printk(" cmd_line \"%s\"\r\n", info->cmd_line); -+ printk("\r\n"); -+} -+ -+void start_helper(void) -+{ -+ int shadow_translated; -+ unsigned long cr3_mfn; -+ -+ /* find m2p map */ -+#if defined(__i386__) -+ if (pae_paging) { -+ machine_to_phys_mapping = (xen_pfn_t*)0xf5800000; -+ } else { -+ machine_to_phys_mapping = (xen_pfn_t*)0xfc000000; -+ } -+#endif -+#if defined(__x86_64__) -+ machine_to_phys_mapping = ((xen_pfn_t*)HYPERVISOR_VIRT_START); -+#endif -+ -+ /* map magic pages */ -+ map_page(console_page, old_info->console.domU.mfn, -+ _PAGE_PRESENT | _PAGE_RW); -+ map_page(xenstore_page, old_info->store_mfn, -+ _PAGE_PRESENT | _PAGE_RW); -+ map_page(shared_info_page, old_info->shared_info >> PAGE_SHIFT, -+ _PAGE_PRESENT | _PAGE_RW); -+ -+ /* setup console, say hello world */ -+ console_evtchn = old_info->console.domU.evtchn; -+ printk("\r\nHello world from xen kexec helper\r\n\r\n"); -+ -+ /* print old start info page */ -+ print_start_info("old", old_info); -+ -+ /* figure and print some info */ -+ setup_xen_features(); -+ shadow_translated = xen_feature(XENFEAT_auto_translated_physmap); -+ dprintk("shadow_translated is %s\r\n", -+ shadow_translated ? "on" : "off"); -+#if defined(__i386__) -+ dprintk("pae paging is %s\r\n", -+ pae_paging ? "on" : "off"); -+#endif -+ dprintk("virtual base is 0x%lx\r\n", virt_base); -+ if (-1 != virt_hypercall) -+ dprintk("hypercall page at is 0x%lx\r\n", virt_hypercall); -+ dprintk("kernel entry point is 0x%lx\r\n", (unsigned long)vcpu.user_regs.eip); -+ dprintk("start_info page is 0x%lx\r\n", (unsigned long)vcpu.user_regs.esi); -+ dprintk("kernel boot stack is 0x%lx\r\n", (unsigned long)vcpu.user_regs.esp); -+ dprintk("\r\n"); -+ -+// xenstore_debug(); -+ -+ /* fixup new start info page */ -+ new_info = (struct start_info*)(vcpu.user_regs.esi - virt_base); -+ new_info->shared_info = old_info->shared_info; -+ new_info->store_mfn = old_info->store_mfn; -+ new_info->store_evtchn = old_info->store_evtchn; -+ new_info->console.domU.mfn = old_info->console.domU.mfn; -+ new_info->console.domU.evtchn = old_info->console.domU.evtchn; -+ -+ if (shadow_translated) { -+ printk("TODO: handle magic pages\r\n"); -+ cr3_mfn = (new_info->pt_base - virt_base) >> PAGE_SHIFT; -+ } else { -+ /* copy p2m table to final place */ -+ dprintk("copy p2m map\r\n"); -+ p2m_copy(); -+ -+ /* move magic pages, page order is important here: -+ * start_info, xenstore, console */ -+ dprintk("setup magic pages: xenstore and console\r\n"); -+ swap_pages_p2m(mfn_to_pfn(new_info->store_mfn), -+ ((unsigned long)new_info >> PAGE_SHIFT)+1); -+ swap_pages_p2m(mfn_to_pfn(new_info->console.domU.mfn), -+ ((unsigned long)new_info >> PAGE_SHIFT)+2); -+ -+ if (-1 != virt_hypercall) { -+ dprintk("setup hypercall page\r\n"); -+ memcpy((void*)(virt_hypercall - virt_base), -+ hypercall_page, PAGE_SIZE); -+ } -+ -+ dprintk("setup main memory\r\n"); -+ plug_holes_p2m(); -+ fillup_memory_p2m(); -+ -+ dprintk("mirror lowmem at virt_base [0x%lx]\r\n", virt_base); -+ map_virt_base(); -+ start_kernel = _start_kernel + virt_base; -+ -+ dprintk("setup new kernel's page tables\r\n"); -+ fixup_pagetables(); -+ cr3_mfn = pfn_to_mfn((new_info->pt_base - virt_base) >> PAGE_SHIFT); -+ } -+ printk("\r\n"); -+ -+ /* print new start info page */ -+ print_start_info("new", new_info); -+ -+ /* boot kernel */ -+ vcpu.ctrlreg[3] = cr3_mfn << PAGE_SHIFT; -+ printk("All done, bye folks, trying to boot the kernel ...\r\n"); -+ printk("\r\n"); -+ start_kernel(); -+} -Index: xen-4.1.0-testing/tools/xcutils/helper/make-offsets.c -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/make-offsets.c -@@ -0,0 +1,28 @@ -+#include -+#include -+ -+#define vcpu_off(name,elem) printf("#define vcpu_%s 0x%lx\n", name, \ -+ (unsigned long)offsetof(struct vcpu_guest_context, elem)) -+ -+int main(int argc, char **argv) -+{ -+ vcpu_off("eax", user_regs.eax); -+ vcpu_off("ebx", user_regs.ebx); -+ vcpu_off("ecx", user_regs.ecx); -+ vcpu_off("edx", user_regs.edx); -+ vcpu_off("esi", user_regs.esi); -+ vcpu_off("edi", user_regs.edi); -+ vcpu_off("ebp", user_regs.ebp); -+ vcpu_off("esp", user_regs.esp); -+ -+ vcpu_off("cs", user_regs.cs); -+ vcpu_off("ds", user_regs.ds); -+ vcpu_off("es", user_regs.es); -+ vcpu_off("fs", user_regs.fs); -+ vcpu_off("gs", user_regs.gs); -+ vcpu_off("ss", user_regs.ss); -+ -+ vcpu_off("eip", user_regs.eip); -+ vcpu_off("cr3", ctrlreg[3]); -+ return 0; -+} -Index: xen-4.1.0-testing/tools/xcutils/helper/printk.c -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/printk.c -@@ -0,0 +1,1051 @@ -+/* -+ * linux/kernel/printk.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ * -+ * Modified to make sys_syslog() more flexible: added commands to -+ * return the last 4k of kernel messages, regardless of whether -+ * they've been read or not. Added option to suppress kernel printk's -+ * to the console. Added hook for sending the console messages -+ * elsewhere, in preparation for a serial line console (someday). -+ * Ted Ts'o, 2/11/93. -+ * Modified for sysctl support, 1/8/97, Chris Horn. -+ * Fixed SMP synchronization, 08/08/99, Manfred Spraul -+ * manfreds@colorfullife.com -+ * Rewrote bits to get rid of console_lock -+ * 01Mar01 Andrew Morton -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include /* For in_interrupt() */ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) -+ -+/* printk's without a loglevel use this.. */ -+#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */ -+ -+/* We show everything that is MORE important than this.. */ -+#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ -+#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ -+ -+DECLARE_WAIT_QUEUE_HEAD(log_wait); -+ -+int console_printk[4] = { -+ DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */ -+ DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */ -+ MINIMUM_CONSOLE_LOGLEVEL, /* minimum_console_loglevel */ -+ DEFAULT_CONSOLE_LOGLEVEL, /* default_console_loglevel */ -+}; -+ -+EXPORT_SYMBOL(console_printk); -+ -+/* -+ * Low lever drivers may need that to know if they can schedule in -+ * their unblank() callback or not. So let's export it. -+ */ -+int oops_in_progress; -+EXPORT_SYMBOL(oops_in_progress); -+ -+/* -+ * console_sem protects the console_drivers list, and also -+ * provides serialisation for access to the entire console -+ * driver system. -+ */ -+static DECLARE_MUTEX(console_sem); -+struct console *console_drivers; -+/* -+ * This is used for debugging the mess that is the VT code by -+ * keeping track if we have the console semaphore held. It's -+ * definitely not the perfect debug tool (we don't know if _WE_ -+ * hold it are racing, but it helps tracking those weird code -+ * path in the console code where we end up in places I want -+ * locked without the console sempahore held -+ */ -+static int console_locked; -+ -+/* -+ * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars -+ * It is also used in interesting ways to provide interlocking in -+ * release_console_sem(). -+ */ -+static DEFINE_SPINLOCK(logbuf_lock); -+ -+#define LOG_BUF_MASK (log_buf_len-1) -+#define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK]) -+ -+/* -+ * The indices into log_buf are not constrained to log_buf_len - they -+ * must be masked before subscripting -+ */ -+static unsigned long log_start; /* Index into log_buf: next char to be read by syslog() */ -+static unsigned long con_start; /* Index into log_buf: next char to be sent to consoles */ -+static unsigned long log_end; /* Index into log_buf: most-recently-written-char + 1 */ -+ -+/* -+ * Array of consoles built from command line options (console=) -+ */ -+struct console_cmdline -+{ -+ char name[8]; /* Name of the driver */ -+ int index; /* Minor dev. to use */ -+ char *options; /* Options for the driver */ -+}; -+ -+#define MAX_CMDLINECONSOLES 8 -+ -+static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; -+static int selected_console = -1; -+static int preferred_console = -1; -+ -+/* Flag: console code may call schedule() */ -+static int console_may_schedule; -+ -+#ifdef CONFIG_PRINTK -+ -+static char __log_buf[__LOG_BUF_LEN]; -+static char *log_buf = __log_buf; -+static int log_buf_len = __LOG_BUF_LEN; -+static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */ -+ -+/* -+ * Setup a list of consoles. Called from init/main.c -+ */ -+static int __init console_setup(char *str) -+{ -+ char name[sizeof(console_cmdline[0].name)]; -+ char *s, *options; -+ int idx; -+ -+ /* -+ * Decode str into name, index, options. -+ */ -+ if (str[0] >= '0' && str[0] <= '9') { -+ strcpy(name, "ttyS"); -+ strncpy(name + 4, str, sizeof(name) - 5); -+ } else -+ strncpy(name, str, sizeof(name) - 1); -+ name[sizeof(name) - 1] = 0; -+ if ((options = strchr(str, ',')) != NULL) -+ *(options++) = 0; -+#ifdef __sparc__ -+ if (!strcmp(str, "ttya")) -+ strcpy(name, "ttyS0"); -+ if (!strcmp(str, "ttyb")) -+ strcpy(name, "ttyS1"); -+#endif -+ for (s = name; *s; s++) -+ if ((*s >= '0' && *s <= '9') || *s == ',') -+ break; -+ idx = simple_strtoul(s, NULL, 10); -+ *s = 0; -+ -+ add_preferred_console(name, idx, options); -+ return 1; -+} -+ -+__setup("console=", console_setup); -+ -+static int __init log_buf_len_setup(char *str) -+{ -+ unsigned long size = memparse(str, &str); -+ unsigned long flags; -+ -+ if (size) -+ size = roundup_pow_of_two(size); -+ if (size > log_buf_len) { -+ unsigned long start, dest_idx, offset; -+ char *new_log_buf; -+ -+ new_log_buf = alloc_bootmem(size); -+ if (!new_log_buf) { -+ printk(KERN_WARNING "log_buf_len: allocation failed\n"); -+ goto out; -+ } -+ -+ spin_lock_irqsave(&logbuf_lock, flags); -+ log_buf_len = size; -+ log_buf = new_log_buf; -+ -+ offset = start = min(con_start, log_start); -+ dest_idx = 0; -+ while (start != log_end) { -+ log_buf[dest_idx] = __log_buf[start & (__LOG_BUF_LEN - 1)]; -+ start++; -+ dest_idx++; -+ } -+ log_start -= offset; -+ con_start -= offset; -+ log_end -= offset; -+ spin_unlock_irqrestore(&logbuf_lock, flags); -+ -+ printk(KERN_NOTICE "log_buf_len: %d\n", log_buf_len); -+ } -+out: -+ return 1; -+} -+ -+__setup("log_buf_len=", log_buf_len_setup); -+ -+/* -+ * Commands to do_syslog: -+ * -+ * 0 -- Close the log. Currently a NOP. -+ * 1 -- Open the log. Currently a NOP. -+ * 2 -- Read from the log. -+ * 3 -- Read all messages remaining in the ring buffer. -+ * 4 -- Read and clear all messages remaining in the ring buffer -+ * 5 -- Clear ring buffer. -+ * 6 -- Disable printk's to console -+ * 7 -- Enable printk's to console -+ * 8 -- Set level of messages printed to console -+ * 9 -- Return number of unread characters in the log buffer -+ * 10 -- Return size of the log buffer -+ */ -+int do_syslog(int type, char __user *buf, int len) -+{ -+ unsigned long i, j, limit, count; -+ int do_clear = 0; -+ char c; -+ int error = 0; -+ -+ error = security_syslog(type); -+ if (error) -+ return error; -+ -+ switch (type) { -+ case 0: /* Close log */ -+ break; -+ case 1: /* Open log */ -+ break; -+ case 2: /* Read from log */ -+ error = -EINVAL; -+ if (!buf || len < 0) -+ goto out; -+ error = 0; -+ if (!len) -+ goto out; -+ if (!access_ok(VERIFY_WRITE, buf, len)) { -+ error = -EFAULT; -+ goto out; -+ } -+ error = wait_event_interruptible(log_wait, -+ (log_start - log_end)); -+ if (error) -+ goto out; -+ i = 0; -+ spin_lock_irq(&logbuf_lock); -+ while (!error && (log_start != log_end) && i < len) { -+ c = LOG_BUF(log_start); -+ log_start++; -+ spin_unlock_irq(&logbuf_lock); -+ error = __put_user(c,buf); -+ buf++; -+ i++; -+ cond_resched(); -+ spin_lock_irq(&logbuf_lock); -+ } -+ spin_unlock_irq(&logbuf_lock); -+ if (!error) -+ error = i; -+ break; -+ case 4: /* Read/clear last kernel messages */ -+ do_clear = 1; -+ /* FALL THRU */ -+ case 3: /* Read last kernel messages */ -+ error = -EINVAL; -+ if (!buf || len < 0) -+ goto out; -+ error = 0; -+ if (!len) -+ goto out; -+ if (!access_ok(VERIFY_WRITE, buf, len)) { -+ error = -EFAULT; -+ goto out; -+ } -+ count = len; -+ if (count > log_buf_len) -+ count = log_buf_len; -+ spin_lock_irq(&logbuf_lock); -+ if (count > logged_chars) -+ count = logged_chars; -+ if (do_clear) -+ logged_chars = 0; -+ limit = log_end; -+ /* -+ * __put_user() could sleep, and while we sleep -+ * printk() could overwrite the messages -+ * we try to copy to user space. Therefore -+ * the messages are copied in reverse. -+ */ -+ for (i = 0; i < count && !error; i++) { -+ j = limit-1-i; -+ if (j + log_buf_len < log_end) -+ break; -+ c = LOG_BUF(j); -+ spin_unlock_irq(&logbuf_lock); -+ error = __put_user(c,&buf[count-1-i]); -+ cond_resched(); -+ spin_lock_irq(&logbuf_lock); -+ } -+ spin_unlock_irq(&logbuf_lock); -+ if (error) -+ break; -+ error = i; -+ if (i != count) { -+ int offset = count-error; -+ /* buffer overflow during copy, correct user buffer. */ -+ for (i = 0; i < error; i++) { -+ if (__get_user(c,&buf[i+offset]) || -+ __put_user(c,&buf[i])) { -+ error = -EFAULT; -+ break; -+ } -+ cond_resched(); -+ } -+ } -+ break; -+ case 5: /* Clear ring buffer */ -+ logged_chars = 0; -+ break; -+ case 6: /* Disable logging to console */ -+ console_loglevel = minimum_console_loglevel; -+ break; -+ case 7: /* Enable logging to console */ -+ console_loglevel = default_console_loglevel; -+ break; -+ case 8: /* Set level of messages printed to console */ -+ error = -EINVAL; -+ if (len < 1 || len > 8) -+ goto out; -+ if (len < minimum_console_loglevel) -+ len = minimum_console_loglevel; -+ console_loglevel = len; -+ error = 0; -+ break; -+ case 9: /* Number of chars in the log buffer */ -+ error = log_end - log_start; -+ break; -+ case 10: /* Size of the log buffer */ -+ error = log_buf_len; -+ break; -+ default: -+ error = -EINVAL; -+ break; -+ } -+out: -+ return error; -+} -+ -+asmlinkage long sys_syslog(int type, char __user *buf, int len) -+{ -+ return do_syslog(type, buf, len); -+} -+ -+/* -+ * Call the console drivers on a range of log_buf -+ */ -+static void __call_console_drivers(unsigned long start, unsigned long end) -+{ -+ struct console *con; -+ -+ for (con = console_drivers; con; con = con->next) { -+ if ((con->flags & CON_ENABLED) && con->write) -+ con->write(con, &LOG_BUF(start), end - start); -+ } -+} -+ -+/* -+ * Write out chars from start to end - 1 inclusive -+ */ -+static void _call_console_drivers(unsigned long start, -+ unsigned long end, int msg_log_level) -+{ -+ if (msg_log_level < console_loglevel && -+ console_drivers && start != end) { -+ if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) { -+ /* wrapped write */ -+ __call_console_drivers(start & LOG_BUF_MASK, -+ log_buf_len); -+ __call_console_drivers(0, end & LOG_BUF_MASK); -+ } else { -+ __call_console_drivers(start, end); -+ } -+ } -+} -+ -+/* -+ * Call the console drivers, asking them to write out -+ * log_buf[start] to log_buf[end - 1]. -+ * The console_sem must be held. -+ */ -+static void call_console_drivers(unsigned long start, unsigned long end) -+{ -+ unsigned long cur_index, start_print; -+ static int msg_level = -1; -+ -+ if (((long)(start - end)) > 0) -+ BUG(); -+ -+ cur_index = start; -+ start_print = start; -+ while (cur_index != end) { -+ if (msg_level < 0 && ((end - cur_index) > 2) && -+ LOG_BUF(cur_index + 0) == '<' && -+ LOG_BUF(cur_index + 1) >= '0' && -+ LOG_BUF(cur_index + 1) <= '7' && -+ LOG_BUF(cur_index + 2) == '>') { -+ msg_level = LOG_BUF(cur_index + 1) - '0'; -+ cur_index += 3; -+ start_print = cur_index; -+ } -+ while (cur_index != end) { -+ char c = LOG_BUF(cur_index); -+ -+ cur_index++; -+ if (c == '\n') { -+ if (msg_level < 0) { -+ /* -+ * printk() has already given us loglevel tags in -+ * the buffer. This code is here in case the -+ * log buffer has wrapped right round and scribbled -+ * on those tags -+ */ -+ msg_level = default_message_loglevel; -+ } -+ _call_console_drivers(start_print, cur_index, msg_level); -+ msg_level = -1; -+ start_print = cur_index; -+ break; -+ } -+ } -+ } -+ _call_console_drivers(start_print, end, msg_level); -+} -+ -+static void emit_log_char(char c) -+{ -+ LOG_BUF(log_end) = c; -+ log_end++; -+ if (log_end - log_start > log_buf_len) -+ log_start = log_end - log_buf_len; -+ if (log_end - con_start > log_buf_len) -+ con_start = log_end - log_buf_len; -+ if (logged_chars < log_buf_len) -+ logged_chars++; -+} -+ -+/* -+ * Zap console related locks when oopsing. Only zap at most once -+ * every 10 seconds, to leave time for slow consoles to print a -+ * full oops. -+ */ -+static void zap_locks(void) -+{ -+ static unsigned long oops_timestamp; -+ -+ if (time_after_eq(jiffies, oops_timestamp) && -+ !time_after(jiffies, oops_timestamp + 30 * HZ)) -+ return; -+ -+ oops_timestamp = jiffies; -+ -+ /* If a crash is occurring, make sure we can't deadlock */ -+ spin_lock_init(&logbuf_lock); -+ /* And make sure that we print immediately */ -+ init_MUTEX(&console_sem); -+} -+ -+#if defined(CONFIG_PRINTK_TIME) -+static int printk_time = 1; -+#else -+static int printk_time = 0; -+#endif -+ -+static int __init printk_time_setup(char *str) -+{ -+ if (*str) -+ return 0; -+ printk_time = 1; -+ return 1; -+} -+ -+__setup("time", printk_time_setup); -+ -+__attribute__((weak)) unsigned long long printk_clock(void) -+{ -+ return sched_clock(); -+} -+ -+/** -+ * printk - print a kernel message -+ * @fmt: format string -+ * -+ * This is printk. It can be called from any context. We want it to work. -+ * -+ * We try to grab the console_sem. If we succeed, it's easy - we log the output and -+ * call the console drivers. If we fail to get the semaphore we place the output -+ * into the log buffer and return. The current holder of the console_sem will -+ * notice the new output in release_console_sem() and will send it to the -+ * consoles before releasing the semaphore. -+ * -+ * One effect of this deferred printing is that code which calls printk() and -+ * then changes console_loglevel may break. This is because console_loglevel -+ * is inspected when the actual printing occurs. -+ * -+ * See also: -+ * printf(3) -+ */ -+ -+asmlinkage int printk(const char *fmt, ...) -+{ -+ va_list args; -+ int r; -+ -+ va_start(args, fmt); -+ r = vprintk(fmt, args); -+ va_end(args); -+ -+ return r; -+} -+ -+/* cpu currently holding logbuf_lock */ -+static volatile unsigned int printk_cpu = UINT_MAX; -+ -+asmlinkage int vprintk(const char *fmt, va_list args) -+{ -+ unsigned long flags; -+ int printed_len; -+ char *p; -+ static char printk_buf[1024]; -+ static int log_level_unknown = 1; -+ -+ preempt_disable(); -+ if (unlikely(oops_in_progress) && printk_cpu == smp_processor_id()) -+ /* If a crash is occurring during printk() on this CPU, -+ * make sure we can't deadlock */ -+ zap_locks(); -+ -+ /* This stops the holder of console_sem just where we want him */ -+ spin_lock_irqsave(&logbuf_lock, flags); -+ printk_cpu = smp_processor_id(); -+ -+ /* Emit the output into the temporary buffer */ -+ printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args); -+ -+ /* -+ * Copy the output into log_buf. If the caller didn't provide -+ * appropriate log level tags, we insert them here -+ */ -+ for (p = printk_buf; *p; p++) { -+ if (log_level_unknown) { -+ /* log_level_unknown signals the start of a new line */ -+ if (printk_time) { -+ int loglev_char; -+ char tbuf[50], *tp; -+ unsigned tlen; -+ unsigned long long t; -+ unsigned long nanosec_rem; -+ -+ /* -+ * force the log level token to be -+ * before the time output. -+ */ -+ if (p[0] == '<' && p[1] >='0' && -+ p[1] <= '7' && p[2] == '>') { -+ loglev_char = p[1]; -+ p += 3; -+ printed_len += 3; -+ } else { -+ loglev_char = default_message_loglevel -+ + '0'; -+ } -+ t = printk_clock(); -+ nanosec_rem = do_div(t, 1000000000); -+ tlen = sprintf(tbuf, -+ "<%c>[%5lu.%06lu] ", -+ loglev_char, -+ (unsigned long)t, -+ nanosec_rem/1000); -+ -+ for (tp = tbuf; tp < tbuf + tlen; tp++) -+ emit_log_char(*tp); -+ printed_len += tlen - 3; -+ } else { -+ if (p[0] != '<' || p[1] < '0' || -+ p[1] > '7' || p[2] != '>') { -+ emit_log_char('<'); -+ emit_log_char(default_message_loglevel -+ + '0'); -+ emit_log_char('>'); -+ } -+ printed_len += 3; -+ } -+ log_level_unknown = 0; -+ if (!*p) -+ break; -+ } -+ emit_log_char(*p); -+ if (*p == '\n') -+ log_level_unknown = 1; -+ } -+ -+ if (!cpu_online(smp_processor_id())) { -+ /* -+ * Some console drivers may assume that per-cpu resources have -+ * been allocated. So don't allow them to be called by this -+ * CPU until it is officially up. We shouldn't be calling into -+ * random console drivers on a CPU which doesn't exist yet.. -+ */ -+ printk_cpu = UINT_MAX; -+ spin_unlock_irqrestore(&logbuf_lock, flags); -+ goto out; -+ } -+ if (!down_trylock(&console_sem)) { -+ console_locked = 1; -+ /* -+ * We own the drivers. We can drop the spinlock and let -+ * release_console_sem() print the text -+ */ -+ printk_cpu = UINT_MAX; -+ spin_unlock_irqrestore(&logbuf_lock, flags); -+ console_may_schedule = 0; -+ release_console_sem(); -+ } else { -+ /* -+ * Someone else owns the drivers. We drop the spinlock, which -+ * allows the semaphore holder to proceed and to call the -+ * console drivers with the output which we just produced. -+ */ -+ printk_cpu = UINT_MAX; -+ spin_unlock_irqrestore(&logbuf_lock, flags); -+ } -+out: -+ preempt_enable(); -+ return printed_len; -+} -+EXPORT_SYMBOL(printk); -+EXPORT_SYMBOL(vprintk); -+ -+#else -+ -+asmlinkage long sys_syslog(int type, char __user *buf, int len) -+{ -+ return 0; -+} -+ -+int do_syslog(int type, char __user *buf, int len) -+{ -+ return 0; -+} -+ -+static void call_console_drivers(unsigned long start, unsigned long end) -+{ -+} -+ -+#endif -+ -+/** -+ * add_preferred_console - add a device to the list of preferred consoles. -+ * @name: device name -+ * @idx: device index -+ * @options: options for this console -+ * -+ * The last preferred console added will be used for kernel messages -+ * and stdin/out/err for init. Normally this is used by console_setup -+ * above to handle user-supplied console arguments; however it can also -+ * be used by arch-specific code either to override the user or more -+ * commonly to provide a default console (ie from PROM variables) when -+ * the user has not supplied one. -+ */ -+int __init add_preferred_console(char *name, int idx, char *options) -+{ -+ struct console_cmdline *c; -+ int i; -+ -+ /* -+ * See if this tty is not yet registered, and -+ * if we have a slot free. -+ */ -+ for(i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) -+ if (strcmp(console_cmdline[i].name, name) == 0 && -+ console_cmdline[i].index == idx) { -+ selected_console = i; -+ return 0; -+ } -+ if (i == MAX_CMDLINECONSOLES) -+ return -E2BIG; -+ selected_console = i; -+ c = &console_cmdline[i]; -+ memcpy(c->name, name, sizeof(c->name)); -+ c->name[sizeof(c->name) - 1] = 0; -+ c->options = options; -+ c->index = idx; -+ return 0; -+} -+ -+/** -+ * acquire_console_sem - lock the console system for exclusive use. -+ * -+ * Acquires a semaphore which guarantees that the caller has -+ * exclusive access to the console system and the console_drivers list. -+ * -+ * Can sleep, returns nothing. -+ */ -+void acquire_console_sem(void) -+{ -+ if (in_interrupt()) -+ BUG(); -+ down(&console_sem); -+ console_locked = 1; -+ console_may_schedule = 1; -+} -+EXPORT_SYMBOL(acquire_console_sem); -+ -+int try_acquire_console_sem(void) -+{ -+ if (down_trylock(&console_sem)) -+ return -1; -+ console_locked = 1; -+ console_may_schedule = 0; -+ return 0; -+} -+EXPORT_SYMBOL(try_acquire_console_sem); -+ -+int is_console_locked(void) -+{ -+ return console_locked; -+} -+EXPORT_SYMBOL(is_console_locked); -+ -+/** -+ * release_console_sem - unlock the console system -+ * -+ * Releases the semaphore which the caller holds on the console system -+ * and the console driver list. -+ * -+ * While the semaphore was held, console output may have been buffered -+ * by printk(). If this is the case, release_console_sem() emits -+ * the output prior to releasing the semaphore. -+ * -+ * If there is output waiting for klogd, we wake it up. -+ * -+ * release_console_sem() may be called from any context. -+ */ -+void release_console_sem(void) -+{ -+ unsigned long flags; -+ unsigned long _con_start, _log_end; -+ unsigned long wake_klogd = 0; -+ -+ for ( ; ; ) { -+ spin_lock_irqsave(&logbuf_lock, flags); -+ wake_klogd |= log_start - log_end; -+ if (con_start == log_end) -+ break; /* Nothing to print */ -+ _con_start = con_start; -+ _log_end = log_end; -+ con_start = log_end; /* Flush */ -+ spin_unlock(&logbuf_lock); -+ call_console_drivers(_con_start, _log_end); -+ local_irq_restore(flags); -+ } -+ console_locked = 0; -+ console_may_schedule = 0; -+ up(&console_sem); -+ spin_unlock_irqrestore(&logbuf_lock, flags); -+ if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) -+ wake_up_interruptible(&log_wait); -+} -+EXPORT_SYMBOL(release_console_sem); -+ -+/** -+ * console_conditional_schedule - yield the CPU if required -+ * -+ * If the console code is currently allowed to sleep, and -+ * if this CPU should yield the CPU to another task, do -+ * so here. -+ * -+ * Must be called within acquire_console_sem(). -+ */ -+void __sched console_conditional_schedule(void) -+{ -+ if (console_may_schedule) -+ cond_resched(); -+} -+EXPORT_SYMBOL(console_conditional_schedule); -+ -+void console_print(const char *s) -+{ -+ printk(KERN_EMERG "%s", s); -+} -+EXPORT_SYMBOL(console_print); -+ -+void console_unblank(void) -+{ -+ struct console *c; -+ -+ /* -+ * console_unblank can no longer be called in interrupt context unless -+ * oops_in_progress is set to 1.. -+ */ -+ if (oops_in_progress) { -+ if (down_trylock(&console_sem) != 0) -+ return; -+ } else -+ acquire_console_sem(); -+ -+ console_locked = 1; -+ console_may_schedule = 0; -+ for (c = console_drivers; c != NULL; c = c->next) -+ if ((c->flags & CON_ENABLED) && c->unblank) -+ c->unblank(); -+ release_console_sem(); -+} -+ -+/* -+ * Return the console tty driver structure and its associated index -+ */ -+struct tty_driver *console_device(int *index) -+{ -+ struct console *c; -+ struct tty_driver *driver = NULL; -+ -+ acquire_console_sem(); -+ for (c = console_drivers; c != NULL; c = c->next) { -+ if (!c->device) -+ continue; -+ driver = c->device(c, index); -+ if (driver) -+ break; -+ } -+ release_console_sem(); -+ return driver; -+} -+ -+/* -+ * Prevent further output on the passed console device so that (for example) -+ * serial drivers can disable console output before suspending a port, and can -+ * re-enable output afterwards. -+ */ -+void console_stop(struct console *console) -+{ -+ acquire_console_sem(); -+ console->flags &= ~CON_ENABLED; -+ release_console_sem(); -+} -+EXPORT_SYMBOL(console_stop); -+ -+void console_start(struct console *console) -+{ -+ acquire_console_sem(); -+ console->flags |= CON_ENABLED; -+ release_console_sem(); -+} -+EXPORT_SYMBOL(console_start); -+ -+/* -+ * The console driver calls this routine during kernel initialization -+ * to register the console printing procedure with printk() and to -+ * print any messages that were printed by the kernel before the -+ * console driver was initialized. -+ */ -+void register_console(struct console *console) -+{ -+ int i; -+ unsigned long flags; -+ -+ if (preferred_console < 0) -+ preferred_console = selected_console; -+ -+ /* -+ * See if we want to use this console driver. If we -+ * didn't select a console we take the first one -+ * that registers here. -+ */ -+ if (preferred_console < 0) { -+ if (console->index < 0) -+ console->index = 0; -+ if (console->setup == NULL || -+ console->setup(console, NULL) == 0) { -+ console->flags |= CON_ENABLED | CON_CONSDEV; -+ preferred_console = 0; -+ } -+ } -+ -+ /* -+ * See if this console matches one we selected on -+ * the command line. -+ */ -+ for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; -+ i++) { -+ if (strcmp(console_cmdline[i].name, console->name) != 0) -+ continue; -+ if (console->index >= 0 && -+ console->index != console_cmdline[i].index) -+ continue; -+ if (console->index < 0) -+ console->index = console_cmdline[i].index; -+ if (console->setup && -+ console->setup(console, console_cmdline[i].options) != 0) -+ break; -+ console->flags |= CON_ENABLED; -+ console->index = console_cmdline[i].index; -+ if (i == selected_console) { -+ console->flags |= CON_CONSDEV; -+ preferred_console = selected_console; -+ } -+ break; -+ } -+ -+ if (!(console->flags & CON_ENABLED)) -+ return; -+ -+ if (console_drivers && (console_drivers->flags & CON_BOOT)) { -+ unregister_console(console_drivers); -+ console->flags &= ~CON_PRINTBUFFER; -+ } -+ -+ /* -+ * Put this console in the list - keep the -+ * preferred driver at the head of the list. -+ */ -+ acquire_console_sem(); -+ if ((console->flags & CON_CONSDEV) || console_drivers == NULL) { -+ console->next = console_drivers; -+ console_drivers = console; -+ if (console->next) -+ console->next->flags &= ~CON_CONSDEV; -+ } else { -+ console->next = console_drivers->next; -+ console_drivers->next = console; -+ } -+ if (console->flags & CON_PRINTBUFFER) { -+ /* -+ * release_console_sem() will print out the buffered messages -+ * for us. -+ */ -+ spin_lock_irqsave(&logbuf_lock, flags); -+ con_start = log_start; -+ spin_unlock_irqrestore(&logbuf_lock, flags); -+ } -+ release_console_sem(); -+} -+EXPORT_SYMBOL(register_console); -+ -+int unregister_console(struct console *console) -+{ -+ struct console *a, *b; -+ int res = 1; -+ -+ acquire_console_sem(); -+ if (console_drivers == console) { -+ console_drivers=console->next; -+ res = 0; -+ } else if (console_drivers) { -+ for (a=console_drivers->next, b=console_drivers ; -+ a; b=a, a=b->next) { -+ if (a == console) { -+ b->next = a->next; -+ res = 0; -+ break; -+ } -+ } -+ } -+ -+ /* If last console is removed, we re-enable picking the first -+ * one that gets registered. Without that, pmac early boot console -+ * would prevent fbcon from taking over. -+ * -+ * If this isn't the last console and it has CON_CONSDEV set, we -+ * need to set it on the next preferred console. -+ */ -+ if (console_drivers == NULL) -+ preferred_console = selected_console; -+ else if (console->flags & CON_CONSDEV) -+ console_drivers->flags |= CON_CONSDEV; -+ -+ release_console_sem(); -+ return res; -+} -+EXPORT_SYMBOL(unregister_console); -+ -+/** -+ * tty_write_message - write a message to a certain tty, not just the console. -+ * @tty: the destination tty_struct -+ * @msg: the message to write -+ * -+ * This is used for messages that need to be redirected to a specific tty. -+ * We don't put it into the syslog queue right now maybe in the future if -+ * really needed. -+ */ -+void tty_write_message(struct tty_struct *tty, char *msg) -+{ -+ if (tty && tty->driver->write) -+ tty->driver->write(tty, msg, strlen(msg)); -+ return; -+} -+ -+/* -+ * printk rate limiting, lifted from the networking subsystem. -+ * -+ * This enforces a rate limit: not more than one kernel message -+ * every printk_ratelimit_jiffies to make a denial-of-service -+ * attack impossible. -+ */ -+int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst) -+{ -+ static DEFINE_SPINLOCK(ratelimit_lock); -+ static unsigned long toks = 10 * 5 * HZ; -+ static unsigned long last_msg; -+ static int missed; -+ unsigned long flags; -+ unsigned long now = jiffies; -+ -+ spin_lock_irqsave(&ratelimit_lock, flags); -+ toks += now - last_msg; -+ last_msg = now; -+ if (toks > (ratelimit_burst * ratelimit_jiffies)) -+ toks = ratelimit_burst * ratelimit_jiffies; -+ if (toks >= ratelimit_jiffies) { -+ int lost = missed; -+ -+ missed = 0; -+ toks -= ratelimit_jiffies; -+ spin_unlock_irqrestore(&ratelimit_lock, flags); -+ if (lost) -+ printk(KERN_WARNING "printk: %d messages suppressed.\n", lost); -+ return 1; -+ } -+ missed++; -+ spin_unlock_irqrestore(&ratelimit_lock, flags); -+ return 0; -+} -+EXPORT_SYMBOL(__printk_ratelimit); -+ -+/* minimum time in jiffies between messages */ -+int printk_ratelimit_jiffies = 5 * HZ; -+ -+/* number of messages we send before ratelimiting */ -+int printk_ratelimit_burst = 10; -+ -+int printk_ratelimit(void) -+{ -+ return __printk_ratelimit(printk_ratelimit_jiffies, -+ printk_ratelimit_burst); -+} -+EXPORT_SYMBOL(printk_ratelimit); -Index: xen-4.1.0-testing/tools/xcutils/helper/string.c -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/string.c -@@ -0,0 +1,601 @@ -+/* -+ * linux/lib/string.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ */ -+ -+/* -+ * stupid library routines.. The optimized versions should generally be found -+ * as inline code in -+ * -+ * These are buggy as well.. -+ * -+ * * Fri Jun 25 1999, Ingo Oeser -+ * - Added strsep() which will replace strtok() soon (because strsep() is -+ * reentrant and should be faster). Use only strsep() in new code, please. -+ * -+ * * Sat Feb 09 2002, Jason Thomas , -+ * Matthew Hawkins -+ * - Kissed strtok() goodbye -+ */ -+ -+#include "helper.h" -+ -+#ifndef __HAVE_ARCH_STRNICMP -+/** -+ * strnicmp - Case insensitive, length-limited string comparison -+ * @s1: One string -+ * @s2: The other string -+ * @len: the maximum number of characters to compare -+ */ -+int strnicmp(const char *s1, const char *s2, size_t len) -+{ -+ /* Yes, Virginia, it had better be unsigned */ -+ unsigned char c1, c2; -+ -+ c1 = c2 = 0; -+ if (len) { -+ do { -+ c1 = *s1; -+ c2 = *s2; -+ s1++; -+ s2++; -+ if (!c1) -+ break; -+ if (!c2) -+ break; -+ if (c1 == c2) -+ continue; -+ c1 = tolower(c1); -+ c2 = tolower(c2); -+ if (c1 != c2) -+ break; -+ } while (--len); -+ } -+ return (int)c1 - (int)c2; -+} -+EXPORT_SYMBOL(strnicmp); -+#endif -+ -+#ifndef __HAVE_ARCH_STRCPY -+/** -+ * strcpy - Copy a %NUL terminated string -+ * @dest: Where to copy the string to -+ * @src: Where to copy the string from -+ */ -+#undef strcpy -+char *strcpy(char *dest, const char *src) -+{ -+ char *tmp = dest; -+ -+ while ((*dest++ = *src++) != '\0') -+ /* nothing */; -+ return tmp; -+} -+EXPORT_SYMBOL(strcpy); -+#endif -+ -+#ifndef __HAVE_ARCH_STRNCPY -+/** -+ * strncpy - Copy a length-limited, %NUL-terminated string -+ * @dest: Where to copy the string to -+ * @src: Where to copy the string from -+ * @count: The maximum number of bytes to copy -+ * -+ * The result is not %NUL-terminated if the source exceeds -+ * @count bytes. -+ * -+ * In the case where the length of @src is less than that of -+ * count, the remainder of @dest will be padded with %NUL. -+ * -+ */ -+char *strncpy(char *dest, const char *src, size_t count) -+{ -+ char *tmp = dest; -+ -+ while (count) { -+ if ((*tmp = *src) != 0) -+ src++; -+ tmp++; -+ count--; -+ } -+ return dest; -+} -+EXPORT_SYMBOL(strncpy); -+#endif -+ -+#ifndef __HAVE_ARCH_STRLCPY -+/** -+ * strlcpy - Copy a %NUL terminated string into a sized buffer -+ * @dest: Where to copy the string to -+ * @src: Where to copy the string from -+ * @size: size of destination buffer -+ * -+ * Compatible with *BSD: the result is always a valid -+ * NUL-terminated string that fits in the buffer (unless, -+ * of course, the buffer size is zero). It does not pad -+ * out the result like strncpy() does. -+ */ -+size_t strlcpy(char *dest, const char *src, size_t size) -+{ -+ size_t ret = strlen(src); -+ -+ if (size) { -+ size_t len = (ret >= size) ? size - 1 : ret; -+ memcpy(dest, src, len); -+ dest[len] = '\0'; -+ } -+ return ret; -+} -+EXPORT_SYMBOL(strlcpy); -+#endif -+ -+#ifndef __HAVE_ARCH_STRCAT -+/** -+ * strcat - Append one %NUL-terminated string to another -+ * @dest: The string to be appended to -+ * @src: The string to append to it -+ */ -+#undef strcat -+char *strcat(char *dest, const char *src) -+{ -+ char *tmp = dest; -+ -+ while (*dest) -+ dest++; -+ while ((*dest++ = *src++) != '\0') -+ ; -+ return tmp; -+} -+EXPORT_SYMBOL(strcat); -+#endif -+ -+#ifndef __HAVE_ARCH_STRNCAT -+/** -+ * strncat - Append a length-limited, %NUL-terminated string to another -+ * @dest: The string to be appended to -+ * @src: The string to append to it -+ * @count: The maximum numbers of bytes to copy -+ * -+ * Note that in contrast to strncpy, strncat ensures the result is -+ * terminated. -+ */ -+char *strncat(char *dest, const char *src, size_t count) -+{ -+ char *tmp = dest; -+ -+ if (count) { -+ while (*dest) -+ dest++; -+ while ((*dest++ = *src++) != 0) { -+ if (--count == 0) { -+ *dest = '\0'; -+ break; -+ } -+ } -+ } -+ return tmp; -+} -+EXPORT_SYMBOL(strncat); -+#endif -+ -+#ifndef __HAVE_ARCH_STRLCAT -+/** -+ * strlcat - Append a length-limited, %NUL-terminated string to another -+ * @dest: The string to be appended to -+ * @src: The string to append to it -+ * @count: The size of the destination buffer. -+ */ -+size_t strlcat(char *dest, const char *src, size_t count) -+{ -+ size_t dsize = strlen(dest); -+ size_t len = strlen(src); -+ size_t res = dsize + len; -+ -+ /* This would be a bug */ -+ BUG_ON(dsize >= count); -+ -+ dest += dsize; -+ count -= dsize; -+ if (len >= count) -+ len = count-1; -+ memcpy(dest, src, len); -+ dest[len] = 0; -+ return res; -+} -+EXPORT_SYMBOL(strlcat); -+#endif -+ -+#ifndef __HAVE_ARCH_STRCMP -+/** -+ * strcmp - Compare two strings -+ * @cs: One string -+ * @ct: Another string -+ */ -+#undef strcmp -+int strcmp(const char *cs, const char *ct) -+{ -+ signed char __res; -+ -+ while (1) { -+ if ((__res = *cs - *ct++) != 0 || !*cs++) -+ break; -+ } -+ return __res; -+} -+EXPORT_SYMBOL(strcmp); -+#endif -+ -+#ifndef __HAVE_ARCH_STRNCMP -+/** -+ * strncmp - Compare two length-limited strings -+ * @cs: One string -+ * @ct: Another string -+ * @count: The maximum number of bytes to compare -+ */ -+int strncmp(const char *cs, const char *ct, size_t count) -+{ -+ signed char __res = 0; -+ -+ while (count) { -+ if ((__res = *cs - *ct++) != 0 || !*cs++) -+ break; -+ count--; -+ } -+ return __res; -+} -+EXPORT_SYMBOL(strncmp); -+#endif -+ -+#ifndef __HAVE_ARCH_STRCHR -+/** -+ * strchr - Find the first occurrence of a character in a string -+ * @s: The string to be searched -+ * @c: The character to search for -+ */ -+char *strchr(const char *s, int c) -+{ -+ for (; *s != (char)c; ++s) -+ if (*s == '\0') -+ return NULL; -+ return (char *)s; -+} -+EXPORT_SYMBOL(strchr); -+#endif -+ -+#ifndef __HAVE_ARCH_STRRCHR -+/** -+ * strrchr - Find the last occurrence of a character in a string -+ * @s: The string to be searched -+ * @c: The character to search for -+ */ -+char *strrchr(const char *s, int c) -+{ -+ const char *p = s + strlen(s); -+ do { -+ if (*p == (char)c) -+ return (char *)p; -+ } while (--p >= s); -+ return NULL; -+} -+EXPORT_SYMBOL(strrchr); -+#endif -+ -+#ifndef __HAVE_ARCH_STRNCHR -+/** -+ * strnchr - Find a character in a length limited string -+ * @s: The string to be searched -+ * @count: The number of characters to be searched -+ * @c: The character to search for -+ */ -+char *strnchr(const char *s, size_t count, int c) -+{ -+ for (; count-- && *s != '\0'; ++s) -+ if (*s == (char)c) -+ return (char *)s; -+ return NULL; -+} -+EXPORT_SYMBOL(strnchr); -+#endif -+ -+#ifndef __HAVE_ARCH_STRLEN -+/** -+ * strlen - Find the length of a string -+ * @s: The string to be sized -+ */ -+size_t strlen(const char *s) -+{ -+ const char *sc; -+ -+ for (sc = s; *sc != '\0'; ++sc) -+ /* nothing */; -+ return sc - s; -+} -+EXPORT_SYMBOL(strlen); -+#endif -+ -+#ifndef __HAVE_ARCH_STRNLEN -+/** -+ * strnlen - Find the length of a length-limited string -+ * @s: The string to be sized -+ * @count: The maximum number of bytes to search -+ */ -+size_t strnlen(const char *s, size_t count) -+{ -+ const char *sc; -+ -+ for (sc = s; count-- && *sc != '\0'; ++sc) -+ /* nothing */; -+ return sc - s; -+} -+EXPORT_SYMBOL(strnlen); -+#endif -+ -+#ifndef __HAVE_ARCH_STRSPN -+/** -+ * strspn - Calculate the length of the initial substring of @s which only -+ * contain letters in @accept -+ * @s: The string to be searched -+ * @accept: The string to search for -+ */ -+size_t strspn(const char *s, const char *accept) -+{ -+ const char *p; -+ const char *a; -+ size_t count = 0; -+ -+ for (p = s; *p != '\0'; ++p) { -+ for (a = accept; *a != '\0'; ++a) { -+ if (*p == *a) -+ break; -+ } -+ if (*a == '\0') -+ return count; -+ ++count; -+ } -+ return count; -+} -+ -+EXPORT_SYMBOL(strspn); -+#endif -+ -+/** -+ * strcspn - Calculate the length of the initial substring of @s which does -+ * not contain letters in @reject -+ * @s: The string to be searched -+ * @reject: The string to avoid -+ */ -+size_t strcspn(const char *s, const char *reject) -+{ -+ const char *p; -+ const char *r; -+ size_t count = 0; -+ -+ for (p = s; *p != '\0'; ++p) { -+ for (r = reject; *r != '\0'; ++r) { -+ if (*p == *r) -+ return count; -+ } -+ ++count; -+ } -+ return count; -+} -+EXPORT_SYMBOL(strcspn); -+ -+#ifndef __HAVE_ARCH_STRPBRK -+/** -+ * strpbrk - Find the first occurrence of a set of characters -+ * @cs: The string to be searched -+ * @ct: The characters to search for -+ */ -+char *strpbrk(const char *cs, const char *ct) -+{ -+ const char *sc1, *sc2; -+ -+ for (sc1 = cs; *sc1 != '\0'; ++sc1) { -+ for (sc2 = ct; *sc2 != '\0'; ++sc2) { -+ if (*sc1 == *sc2) -+ return (char *)sc1; -+ } -+ } -+ return NULL; -+} -+EXPORT_SYMBOL(strpbrk); -+#endif -+ -+#ifndef __HAVE_ARCH_STRSEP -+/** -+ * strsep - Split a string into tokens -+ * @s: The string to be searched -+ * @ct: The characters to search for -+ * -+ * strsep() updates @s to point after the token, ready for the next call. -+ * -+ * It returns empty tokens, too, behaving exactly like the libc function -+ * of that name. In fact, it was stolen from glibc2 and de-fancy-fied. -+ * Same semantics, slimmer shape. ;) -+ */ -+char *strsep(char **s, const char *ct) -+{ -+ char *sbegin = *s; -+ char *end; -+ -+ if (sbegin == NULL) -+ return NULL; -+ -+ end = strpbrk(sbegin, ct); -+ if (end) -+ *end++ = '\0'; -+ *s = end; -+ return sbegin; -+} -+EXPORT_SYMBOL(strsep); -+#endif -+ -+#ifndef __HAVE_ARCH_MEMSET -+/** -+ * memset - Fill a region of memory with the given value -+ * @s: Pointer to the start of the area. -+ * @c: The byte to fill the area with -+ * @count: The size of the area. -+ * -+ * Do not use memset() to access IO space, use memset_io() instead. -+ */ -+void *memset(void *s, int c, size_t count) -+{ -+ char *xs = s; -+ -+ while (count--) -+ *xs++ = c; -+ return s; -+} -+EXPORT_SYMBOL(memset); -+#endif -+ -+#ifndef __HAVE_ARCH_MEMCPY -+/** -+ * memcpy - Copy one area of memory to another -+ * @dest: Where to copy to -+ * @src: Where to copy from -+ * @count: The size of the area. -+ * -+ * You should not use this function to access IO space, use memcpy_toio() -+ * or memcpy_fromio() instead. -+ */ -+void *memcpy(void *dest, const void *src, size_t count) -+{ -+ char *tmp = dest; -+ const char *s = src; -+ -+ while (count--) -+ *tmp++ = *s++; -+ return dest; -+} -+EXPORT_SYMBOL(memcpy); -+#endif -+ -+#ifndef __HAVE_ARCH_MEMMOVE -+/** -+ * memmove - Copy one area of memory to another -+ * @dest: Where to copy to -+ * @src: Where to copy from -+ * @count: The size of the area. -+ * -+ * Unlike memcpy(), memmove() copes with overlapping areas. -+ */ -+void *memmove(void *dest, const void *src, size_t count) -+{ -+ char *tmp; -+ const char *s; -+ -+ if (dest <= src) { -+ tmp = dest; -+ s = src; -+ while (count--) -+ *tmp++ = *s++; -+ } else { -+ tmp = dest; -+ tmp += count; -+ s = src; -+ s += count; -+ while (count--) -+ *--tmp = *--s; -+ } -+ return dest; -+} -+EXPORT_SYMBOL(memmove); -+#endif -+ -+#ifndef __HAVE_ARCH_MEMCMP -+/** -+ * memcmp - Compare two areas of memory -+ * @cs: One area of memory -+ * @ct: Another area of memory -+ * @count: The size of the area. -+ */ -+#undef memcmp -+int memcmp(const void *cs, const void *ct, size_t count) -+{ -+ const unsigned char *su1, *su2; -+ int res = 0; -+ -+ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) -+ if ((res = *su1 - *su2) != 0) -+ break; -+ return res; -+} -+EXPORT_SYMBOL(memcmp); -+#endif -+ -+#ifndef __HAVE_ARCH_MEMSCAN -+/** -+ * memscan - Find a character in an area of memory. -+ * @addr: The memory area -+ * @c: The byte to search for -+ * @size: The size of the area. -+ * -+ * returns the address of the first occurrence of @c, or 1 byte past -+ * the area if @c is not found -+ */ -+void *memscan(void *addr, int c, size_t size) -+{ -+ unsigned char *p = addr; -+ -+ while (size) { -+ if (*p == c) -+ return (void *)p; -+ p++; -+ size--; -+ } -+ return (void *)p; -+} -+EXPORT_SYMBOL(memscan); -+#endif -+ -+#ifndef __HAVE_ARCH_STRSTR -+/** -+ * strstr - Find the first substring in a %NUL terminated string -+ * @s1: The string to be searched -+ * @s2: The string to search for -+ */ -+char *strstr(const char *s1, const char *s2) -+{ -+ int l1, l2; -+ -+ l2 = strlen(s2); -+ if (!l2) -+ return (char *)s1; -+ l1 = strlen(s1); -+ while (l1 >= l2) { -+ l1--; -+ if (!memcmp(s1, s2, l2)) -+ return (char *)s1; -+ s1++; -+ } -+ return NULL; -+} -+EXPORT_SYMBOL(strstr); -+#endif -+ -+#ifndef __HAVE_ARCH_MEMCHR -+/** -+ * memchr - Find a character in an area of memory. -+ * @s: The memory area -+ * @c: The byte to search for -+ * @n: The size of the area. -+ * -+ * returns the address of the first occurrence of @c, or %NULL -+ * if @c is not found -+ */ -+void *memchr(const void *s, int c, size_t n) -+{ -+ const unsigned char *p = s; -+ while (n-- != 0) { -+ if ((unsigned char)c == *p++) { -+ return (void *)(p - 1); -+ } -+ } -+ return NULL; -+} -+EXPORT_SYMBOL(memchr); -+#endif -Index: xen-4.1.0-testing/tools/xcutils/helper/vsprintf.c -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/vsprintf.c -@@ -0,0 +1,842 @@ -+/* -+ * linux/lib/vsprintf.c -+ * -+ * Copyright (C) 1991, 1992 Linus Torvalds -+ */ -+ -+/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */ -+/* -+ * Wirzenius wrote this portably, Torvalds fucked it up :-) -+ */ -+ -+/* -+ * Fri Jul 13 2001 Crutcher Dunnavant -+ * - changed to provide snprintf and vsnprintf functions -+ * So Feb 1 16:51:32 CET 2004 Juergen Quade -+ * - scnprintf and vscnprintf -+ */ -+ -+#include "helper.h" -+ -+/** -+ * simple_strtoul - convert a string to an unsigned long -+ * @cp: The start of the string -+ * @endp: A pointer to the end of the parsed string will be placed here -+ * @base: The number base to use -+ */ -+unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) -+{ -+ unsigned long result = 0,value; -+ -+ if (!base) { -+ base = 10; -+ if (*cp == '0') { -+ base = 8; -+ cp++; -+ if ((toupper(*cp) == 'X') && isxdigit(cp[1])) { -+ cp++; -+ base = 16; -+ } -+ } -+ } else if (base == 16) { -+ if (cp[0] == '0' && toupper(cp[1]) == 'X') -+ cp += 2; -+ } -+ while (isxdigit(*cp) && -+ (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) { -+ result = result*base + value; -+ cp++; -+ } -+ if (endp) -+ *endp = (char *)cp; -+ return result; -+} -+ -+EXPORT_SYMBOL(simple_strtoul); -+ -+/** -+ * simple_strtol - convert a string to a signed long -+ * @cp: The start of the string -+ * @endp: A pointer to the end of the parsed string will be placed here -+ * @base: The number base to use -+ */ -+long simple_strtol(const char *cp,char **endp,unsigned int base) -+{ -+ if(*cp=='-') -+ return -simple_strtoul(cp+1,endp,base); -+ return simple_strtoul(cp,endp,base); -+} -+ -+EXPORT_SYMBOL(simple_strtol); -+ -+/** -+ * simple_strtoull - convert a string to an unsigned long long -+ * @cp: The start of the string -+ * @endp: A pointer to the end of the parsed string will be placed here -+ * @base: The number base to use -+ */ -+unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base) -+{ -+ unsigned long long result = 0,value; -+ -+ if (!base) { -+ base = 10; -+ if (*cp == '0') { -+ base = 8; -+ cp++; -+ if ((toupper(*cp) == 'X') && isxdigit(cp[1])) { -+ cp++; -+ base = 16; -+ } -+ } -+ } else if (base == 16) { -+ if (cp[0] == '0' && toupper(cp[1]) == 'X') -+ cp += 2; -+ } -+ while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp) -+ ? toupper(*cp) : *cp)-'A'+10) < base) { -+ result = result*base + value; -+ cp++; -+ } -+ if (endp) -+ *endp = (char *)cp; -+ return result; -+} -+ -+EXPORT_SYMBOL(simple_strtoull); -+ -+/** -+ * simple_strtoll - convert a string to a signed long long -+ * @cp: The start of the string -+ * @endp: A pointer to the end of the parsed string will be placed here -+ * @base: The number base to use -+ */ -+long long simple_strtoll(const char *cp,char **endp,unsigned int base) -+{ -+ if(*cp=='-') -+ return -simple_strtoull(cp+1,endp,base); -+ return simple_strtoull(cp,endp,base); -+} -+ -+static int skip_atoi(const char **s) -+{ -+ int i=0; -+ -+ while (isdigit(**s)) -+ i = i*10 + *((*s)++) - '0'; -+ return i; -+} -+ -+#define ZEROPAD 1 /* pad with zero */ -+#define SIGN 2 /* unsigned/signed long */ -+#define PLUS 4 /* show plus */ -+#define SPACE 8 /* space if plus */ -+#define LEFT 16 /* left justified */ -+#define SPECIAL 32 /* 0x */ -+#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ -+ -+static char * number(char * buf, char * end, unsigned long long num, int base, int size, int precision, int type) -+{ -+ char c,sign,tmp[66]; -+ const char *digits; -+ static const char small_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -+ static const char large_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -+ int i; -+ -+ digits = (type & LARGE) ? large_digits : small_digits; -+ if (type & LEFT) -+ type &= ~ZEROPAD; -+ if (base < 2 || base > 36) -+ return NULL; -+ c = (type & ZEROPAD) ? '0' : ' '; -+ sign = 0; -+ if (type & SIGN) { -+ if ((signed long long) num < 0) { -+ sign = '-'; -+ num = - (signed long long) num; -+ size--; -+ } else if (type & PLUS) { -+ sign = '+'; -+ size--; -+ } else if (type & SPACE) { -+ sign = ' '; -+ size--; -+ } -+ } -+ if (type & SPECIAL) { -+ if (base == 16) -+ size -= 2; -+ else if (base == 8) -+ size--; -+ } -+ i = 0; -+ if (num == 0) -+ tmp[i++]='0'; -+ else while (num != 0) -+ tmp[i++] = digits[do_div(num,base)]; -+ if (i > precision) -+ precision = i; -+ size -= precision; -+ if (!(type&(ZEROPAD+LEFT))) { -+ while(size-->0) { -+ if (buf <= end) -+ *buf = ' '; -+ ++buf; -+ } -+ } -+ if (sign) { -+ if (buf <= end) -+ *buf = sign; -+ ++buf; -+ } -+ if (type & SPECIAL) { -+ if (base==8) { -+ if (buf <= end) -+ *buf = '0'; -+ ++buf; -+ } else if (base==16) { -+ if (buf <= end) -+ *buf = '0'; -+ ++buf; -+ if (buf <= end) -+ *buf = digits[33]; -+ ++buf; -+ } -+ } -+ if (!(type & LEFT)) { -+ while (size-- > 0) { -+ if (buf <= end) -+ *buf = c; -+ ++buf; -+ } -+ } -+ while (i < precision--) { -+ if (buf <= end) -+ *buf = '0'; -+ ++buf; -+ } -+ while (i-- > 0) { -+ if (buf <= end) -+ *buf = tmp[i]; -+ ++buf; -+ } -+ while (size-- > 0) { -+ if (buf <= end) -+ *buf = ' '; -+ ++buf; -+ } -+ return buf; -+} -+ -+/** -+ * vsnprintf - Format a string and place it in a buffer -+ * @buf: The buffer to place the result into -+ * @size: The size of the buffer, including the trailing null space -+ * @fmt: The format string to use -+ * @args: Arguments for the format string -+ * -+ * The return value is the number of characters which would -+ * be generated for the given input, excluding the trailing -+ * '\0', as per ISO C99. If you want to have the exact -+ * number of characters written into @buf as return value -+ * (not including the trailing '\0'), use vscnprintf. If the -+ * return is greater than or equal to @size, the resulting -+ * string is truncated. -+ * -+ * Call this function if you are already dealing with a va_list. -+ * You probably want snprintf instead. -+ */ -+int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) -+{ -+ int len; -+ unsigned long long num; -+ int i, base; -+ char *str, *end, c; -+ const char *s; -+ -+ int flags; /* flags to number() */ -+ -+ int field_width; /* width of output field */ -+ int precision; /* min. # of digits for integers; max -+ number of chars for from string */ -+ int qualifier; /* 'h', 'l', or 'L' for integer fields */ -+ /* 'z' support added 23/7/1999 S.H. */ -+ /* 'z' changed to 'Z' --davidm 1/25/99 */ -+ /* 't' added for ptrdiff_t */ -+ -+ /* Reject out-of-range values early */ -+ if (unlikely((int) size < 0)) { -+ /* There can be only one.. */ -+ static int warn = 1; -+ WARN_ON(warn); -+ warn = 0; -+ return 0; -+ } -+ -+ str = buf; -+ end = buf + size - 1; -+ -+ if (end < buf - 1) { -+ end = ((void *) -1); -+ size = end - buf + 1; -+ } -+ -+ for (; *fmt ; ++fmt) { -+ if (*fmt != '%') { -+ if (str <= end) -+ *str = *fmt; -+ ++str; -+ continue; -+ } -+ -+ /* process flags */ -+ flags = 0; -+ repeat: -+ ++fmt; /* this also skips first '%' */ -+ switch (*fmt) { -+ case '-': flags |= LEFT; goto repeat; -+ case '+': flags |= PLUS; goto repeat; -+ case ' ': flags |= SPACE; goto repeat; -+ case '#': flags |= SPECIAL; goto repeat; -+ case '0': flags |= ZEROPAD; goto repeat; -+ } -+ -+ /* get field width */ -+ field_width = -1; -+ if (isdigit(*fmt)) -+ field_width = skip_atoi(&fmt); -+ else if (*fmt == '*') { -+ ++fmt; -+ /* it's the next argument */ -+ field_width = va_arg(args, int); -+ if (field_width < 0) { -+ field_width = -field_width; -+ flags |= LEFT; -+ } -+ } -+ -+ /* get the precision */ -+ precision = -1; -+ if (*fmt == '.') { -+ ++fmt; -+ if (isdigit(*fmt)) -+ precision = skip_atoi(&fmt); -+ else if (*fmt == '*') { -+ ++fmt; -+ /* it's the next argument */ -+ precision = va_arg(args, int); -+ } -+ if (precision < 0) -+ precision = 0; -+ } -+ -+ /* get the conversion qualifier */ -+ qualifier = -1; -+ if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || -+ *fmt =='Z' || *fmt == 'z' || *fmt == 't') { -+ qualifier = *fmt; -+ ++fmt; -+ if (qualifier == 'l' && *fmt == 'l') { -+ qualifier = 'L'; -+ ++fmt; -+ } -+ } -+ -+ /* default base */ -+ base = 10; -+ -+ switch (*fmt) { -+ case 'c': -+ if (!(flags & LEFT)) { -+ while (--field_width > 0) { -+ if (str <= end) -+ *str = ' '; -+ ++str; -+ } -+ } -+ c = (unsigned char) va_arg(args, int); -+ if (str <= end) -+ *str = c; -+ ++str; -+ while (--field_width > 0) { -+ if (str <= end) -+ *str = ' '; -+ ++str; -+ } -+ continue; -+ -+ case 's': -+ s = va_arg(args, char *); -+ if ((unsigned long)s < PAGE_SIZE) -+ s = ""; -+ -+ len = strnlen(s, precision); -+ -+ if (!(flags & LEFT)) { -+ while (len < field_width--) { -+ if (str <= end) -+ *str = ' '; -+ ++str; -+ } -+ } -+ for (i = 0; i < len; ++i) { -+ if (str <= end) -+ *str = *s; -+ ++str; ++s; -+ } -+ while (len < field_width--) { -+ if (str <= end) -+ *str = ' '; -+ ++str; -+ } -+ continue; -+ -+ case 'p': -+ if (field_width == -1) { -+ field_width = 2*sizeof(void *); -+ flags |= ZEROPAD; -+ } -+ str = number(str, end, -+ (unsigned long) va_arg(args, void *), -+ 16, field_width, precision, flags); -+ continue; -+ -+ -+ case 'n': -+ /* FIXME: -+ * What does C99 say about the overflow case here? */ -+ if (qualifier == 'l') { -+ long * ip = va_arg(args, long *); -+ *ip = (str - buf); -+ } else if (qualifier == 'Z' || qualifier == 'z') { -+ size_t * ip = va_arg(args, size_t *); -+ *ip = (str - buf); -+ } else { -+ int * ip = va_arg(args, int *); -+ *ip = (str - buf); -+ } -+ continue; -+ -+ case '%': -+ if (str <= end) -+ *str = '%'; -+ ++str; -+ continue; -+ -+ /* integer number formats - set up the flags and "break" */ -+ case 'o': -+ base = 8; -+ break; -+ -+ case 'X': -+ flags |= LARGE; -+ case 'x': -+ base = 16; -+ break; -+ -+ case 'd': -+ case 'i': -+ flags |= SIGN; -+ case 'u': -+ break; -+ -+ default: -+ if (str <= end) -+ *str = '%'; -+ ++str; -+ if (*fmt) { -+ if (str <= end) -+ *str = *fmt; -+ ++str; -+ } else { -+ --fmt; -+ } -+ continue; -+ } -+ if (qualifier == 'L') -+ num = va_arg(args, long long); -+ else if (qualifier == 'l') { -+ num = va_arg(args, unsigned long); -+ if (flags & SIGN) -+ num = (signed long) num; -+ } else if (qualifier == 'Z' || qualifier == 'z') { -+ num = va_arg(args, size_t); -+ } else if (qualifier == 't') { -+ num = va_arg(args, ptrdiff_t); -+ } else if (qualifier == 'h') { -+ num = (unsigned short) va_arg(args, int); -+ if (flags & SIGN) -+ num = (signed short) num; -+ } else { -+ num = va_arg(args, unsigned int); -+ if (flags & SIGN) -+ num = (signed int) num; -+ } -+ str = number(str, end, num, base, -+ field_width, precision, flags); -+ } -+ if (str <= end) -+ *str = '\0'; -+ else if (size > 0) -+ /* don't write out a null byte if the buf size is zero */ -+ *end = '\0'; -+ /* the trailing null byte doesn't count towards the total -+ * ++str; -+ */ -+ return str-buf; -+} -+ -+EXPORT_SYMBOL(vsnprintf); -+ -+/** -+ * vscnprintf - Format a string and place it in a buffer -+ * @buf: The buffer to place the result into -+ * @size: The size of the buffer, including the trailing null space -+ * @fmt: The format string to use -+ * @args: Arguments for the format string -+ * -+ * The return value is the number of characters which have been written into -+ * the @buf not including the trailing '\0'. If @size is <= 0 the function -+ * returns 0. -+ * -+ * Call this function if you are already dealing with a va_list. -+ * You probably want scnprintf instead. -+ */ -+int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) -+{ -+ int i; -+ -+ i=vsnprintf(buf,size,fmt,args); -+ return (i >= size) ? (size - 1) : i; -+} -+ -+EXPORT_SYMBOL(vscnprintf); -+ -+/** -+ * snprintf - Format a string and place it in a buffer -+ * @buf: The buffer to place the result into -+ * @size: The size of the buffer, including the trailing null space -+ * @fmt: The format string to use -+ * @...: Arguments for the format string -+ * -+ * The return value is the number of characters which would be -+ * generated for the given input, excluding the trailing null, -+ * as per ISO C99. If the return is greater than or equal to -+ * @size, the resulting string is truncated. -+ */ -+int snprintf(char * buf, size_t size, const char *fmt, ...) -+{ -+ va_list args; -+ int i; -+ -+ va_start(args, fmt); -+ i=vsnprintf(buf,size,fmt,args); -+ va_end(args); -+ return i; -+} -+ -+EXPORT_SYMBOL(snprintf); -+ -+/** -+ * scnprintf - Format a string and place it in a buffer -+ * @buf: The buffer to place the result into -+ * @size: The size of the buffer, including the trailing null space -+ * @fmt: The format string to use -+ * @...: Arguments for the format string -+ * -+ * The return value is the number of characters written into @buf not including -+ * the trailing '\0'. If @size is <= 0 the function returns 0. If the return is -+ * greater than or equal to @size, the resulting string is truncated. -+ */ -+ -+int scnprintf(char * buf, size_t size, const char *fmt, ...) -+{ -+ va_list args; -+ int i; -+ -+ va_start(args, fmt); -+ i = vsnprintf(buf, size, fmt, args); -+ va_end(args); -+ return (i >= size) ? (size - 1) : i; -+} -+EXPORT_SYMBOL(scnprintf); -+ -+/** -+ * vsprintf - Format a string and place it in a buffer -+ * @buf: The buffer to place the result into -+ * @fmt: The format string to use -+ * @args: Arguments for the format string -+ * -+ * The function returns the number of characters written -+ * into @buf. Use vsnprintf or vscnprintf in order to avoid -+ * buffer overflows. -+ * -+ * Call this function if you are already dealing with a va_list. -+ * You probably want sprintf instead. -+ */ -+int vsprintf(char *buf, const char *fmt, va_list args) -+{ -+ return vsnprintf(buf, INT_MAX, fmt, args); -+} -+ -+EXPORT_SYMBOL(vsprintf); -+ -+/** -+ * sprintf - Format a string and place it in a buffer -+ * @buf: The buffer to place the result into -+ * @fmt: The format string to use -+ * @...: Arguments for the format string -+ * -+ * The function returns the number of characters written -+ * into @buf. Use snprintf or scnprintf in order to avoid -+ * buffer overflows. -+ */ -+int sprintf(char * buf, const char *fmt, ...) -+{ -+ va_list args; -+ int i; -+ -+ va_start(args, fmt); -+ i=vsnprintf(buf, INT_MAX, fmt, args); -+ va_end(args); -+ return i; -+} -+ -+EXPORT_SYMBOL(sprintf); -+ -+/** -+ * vsscanf - Unformat a buffer into a list of arguments -+ * @buf: input buffer -+ * @fmt: format of buffer -+ * @args: arguments -+ */ -+int vsscanf(const char * buf, const char * fmt, va_list args) -+{ -+ const char *str = buf; -+ char *next; -+ char digit; -+ int num = 0; -+ int qualifier; -+ int base; -+ int field_width; -+ int is_sign = 0; -+ -+ while(*fmt && *str) { -+ /* skip any white space in format */ -+ /* white space in format matchs any amount of -+ * white space, including none, in the input. -+ */ -+ if (isspace(*fmt)) { -+ while (isspace(*fmt)) -+ ++fmt; -+ while (isspace(*str)) -+ ++str; -+ } -+ -+ /* anything that is not a conversion must match exactly */ -+ if (*fmt != '%' && *fmt) { -+ if (*fmt++ != *str++) -+ break; -+ continue; -+ } -+ -+ if (!*fmt) -+ break; -+ ++fmt; -+ -+ /* skip this conversion. -+ * advance both strings to next white space -+ */ -+ if (*fmt == '*') { -+ while (!isspace(*fmt) && *fmt) -+ fmt++; -+ while (!isspace(*str) && *str) -+ str++; -+ continue; -+ } -+ -+ /* get field width */ -+ field_width = -1; -+ if (isdigit(*fmt)) -+ field_width = skip_atoi(&fmt); -+ -+ /* get conversion qualifier */ -+ qualifier = -1; -+ if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || -+ *fmt == 'Z' || *fmt == 'z') { -+ qualifier = *fmt++; -+ if (unlikely(qualifier == *fmt)) { -+ if (qualifier == 'h') { -+ qualifier = 'H'; -+ fmt++; -+ } else if (qualifier == 'l') { -+ qualifier = 'L'; -+ fmt++; -+ } -+ } -+ } -+ base = 10; -+ is_sign = 0; -+ -+ if (!*fmt || !*str) -+ break; -+ -+ switch(*fmt++) { -+ case 'c': -+ { -+ char *s = (char *) va_arg(args,char*); -+ if (field_width == -1) -+ field_width = 1; -+ do { -+ *s++ = *str++; -+ } while (--field_width > 0 && *str); -+ num++; -+ } -+ continue; -+ case 's': -+ { -+ char *s = (char *) va_arg(args, char *); -+ if(field_width == -1) -+ field_width = INT_MAX; -+ /* first, skip leading white space in buffer */ -+ while (isspace(*str)) -+ str++; -+ -+ /* now copy until next white space */ -+ while (*str && !isspace(*str) && field_width--) { -+ *s++ = *str++; -+ } -+ *s = '\0'; -+ num++; -+ } -+ continue; -+ case 'n': -+ /* return number of characters read so far */ -+ { -+ int *i = (int *)va_arg(args,int*); -+ *i = str - buf; -+ } -+ continue; -+ case 'o': -+ base = 8; -+ break; -+ case 'x': -+ case 'X': -+ base = 16; -+ break; -+ case 'i': -+ base = 0; -+ case 'd': -+ is_sign = 1; -+ case 'u': -+ break; -+ case '%': -+ /* looking for '%' in str */ -+ if (*str++ != '%') -+ return num; -+ continue; -+ default: -+ /* invalid format; stop here */ -+ return num; -+ } -+ -+ /* have some sort of integer conversion. -+ * first, skip white space in buffer. -+ */ -+ while (isspace(*str)) -+ str++; -+ -+ digit = *str; -+ if (is_sign && digit == '-') -+ digit = *(str + 1); -+ -+ if (!digit -+ || (base == 16 && !isxdigit(digit)) -+ || (base == 10 && !isdigit(digit)) -+ || (base == 8 && (!isdigit(digit) || digit > '7')) -+ || (base == 0 && !isdigit(digit))) -+ break; -+ -+ switch(qualifier) { -+ case 'H': /* that's 'hh' in format */ -+ if (is_sign) { -+ signed char *s = (signed char *) va_arg(args,signed char *); -+ *s = (signed char) simple_strtol(str,&next,base); -+ } else { -+ unsigned char *s = (unsigned char *) va_arg(args, unsigned char *); -+ *s = (unsigned char) simple_strtoul(str, &next, base); -+ } -+ break; -+ case 'h': -+ if (is_sign) { -+ short *s = (short *) va_arg(args,short *); -+ *s = (short) simple_strtol(str,&next,base); -+ } else { -+ unsigned short *s = (unsigned short *) va_arg(args, unsigned short *); -+ *s = (unsigned short) simple_strtoul(str, &next, base); -+ } -+ break; -+ case 'l': -+ if (is_sign) { -+ long *l = (long *) va_arg(args,long *); -+ *l = simple_strtol(str,&next,base); -+ } else { -+ unsigned long *l = (unsigned long*) va_arg(args,unsigned long*); -+ *l = simple_strtoul(str,&next,base); -+ } -+ break; -+ case 'L': -+ if (is_sign) { -+ long long *l = (long long*) va_arg(args,long long *); -+ *l = simple_strtoll(str,&next,base); -+ } else { -+ unsigned long long *l = (unsigned long long*) va_arg(args,unsigned long long*); -+ *l = simple_strtoull(str,&next,base); -+ } -+ break; -+ case 'Z': -+ case 'z': -+ { -+ size_t *s = (size_t*) va_arg(args,size_t*); -+ *s = (size_t) simple_strtoul(str,&next,base); -+ } -+ break; -+ default: -+ if (is_sign) { -+ int *i = (int *) va_arg(args, int*); -+ *i = (int) simple_strtol(str,&next,base); -+ } else { -+ unsigned int *i = (unsigned int*) va_arg(args, unsigned int*); -+ *i = (unsigned int) simple_strtoul(str,&next,base); -+ } -+ break; -+ } -+ num++; -+ -+ if (!next) -+ break; -+ str = next; -+ } -+ return num; -+} -+ -+EXPORT_SYMBOL(vsscanf); -+ -+/** -+ * sscanf - Unformat a buffer into a list of arguments -+ * @buf: input buffer -+ * @fmt: formatting of buffer -+ * @...: resulting arguments -+ */ -+int sscanf(const char * buf, const char * fmt, ...) -+{ -+ va_list args; -+ int i; -+ -+ va_start(args,fmt); -+ i = vsscanf(buf,fmt,args); -+ va_end(args); -+ return i; -+} -+ -+EXPORT_SYMBOL(sscanf); -Index: xen-4.1.0-testing/tools/xcutils/helper/x86_32/div64.h -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/x86_32/div64.h -@@ -0,0 +1,48 @@ -+#ifndef __I386_DIV64 -+#define __I386_DIV64 -+ -+/* -+ * do_div() is NOT a C function. It wants to return -+ * two values (the quotient and the remainder), but -+ * since that doesn't work very well in C, what it -+ * does is: -+ * -+ * - modifies the 64-bit dividend _in_place_ -+ * - returns the 32-bit remainder -+ * -+ * This ends up being the most efficient "calling -+ * convention" on x86. -+ */ -+#define do_div(n,base) ({ \ -+ unsigned long __upper, __low, __high, __mod, __base; \ -+ __base = (base); \ -+ asm("":"=a" (__low), "=d" (__high):"A" (n)); \ -+ __upper = __high; \ -+ if (__high) { \ -+ __upper = __high % (__base); \ -+ __high = __high / (__base); \ -+ } \ -+ asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); \ -+ asm("":"=A" (n):"a" (__low),"d" (__high)); \ -+ __mod; \ -+}) -+ -+/* -+ * (long)X = ((long long)divs) / (long)div -+ * (long)rem = ((long long)divs) % (long)div -+ * -+ * Warning, this will do an exception if X overflows. -+ */ -+#define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c) -+ -+static inline long -+div_ll_X_l_rem(long long divs, long div, long *rem) -+{ -+ long dum2; -+ __asm__("divl %2":"=a"(dum2), "=d"(*rem) -+ : "rm"(div), "A"(divs)); -+ -+ return dum2; -+ -+} -+#endif -Index: xen-4.1.0-testing/tools/xcutils/helper/x86_32/entry.S -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/x86_32/entry.S -@@ -0,0 +1,49 @@ -+#include "offsets.h" -+ -+/* --- stack -------------------------------------------------------- */ -+ -+ .data -+stack_bottom: -+ .fill 4096,1,0 -+stack_top: -+ -+/* --- text --------------------------------------------------------- */ -+ -+ .text -+ .globl _start,_start_kernel,BUG,hypercall_page -+ -+_start: -+ movl %esi, old_info -+ lea stack_top,%esp -+ jmp start_helper -+ -+_start_kernel: -+ movl vcpu+vcpu_ebx,%ebx /* load registers */ -+ movl vcpu+vcpu_ecx,%ecx -+ movl vcpu+vcpu_edx,%edx -+ movl vcpu+vcpu_esi,%esi -+ movl vcpu+vcpu_edi,%edi -+ movl vcpu+vcpu_ebp,%ebp -+ movl vcpu+vcpu_esp,%esp /* using new kernels boot stack now */ -+ -+ movl vcpu+vcpu_eip,%eax /* push entry point */ -+ push %eax -+ movl vcpu+vcpu_eax,%eax /* push eax */ -+ push %eax -+ movl vcpu+vcpu_cr3,%eax /* activate new pagetables */ -+ movl %eax,%cr3 -+ pop %eax /* reload eax */ -+ ret /* jump to new kernel */ -+ -+BUG: -+ /* crash the domain, make xen dump registers */ -+ ud2 -+ jmp BUG -+ -+/* --- hypercall page ----------------------------------------------- */ -+ -+ .align 4096 -+hypercall_page: -+ nop -+ .align 4096 -+hypercall_end: -Index: xen-4.1.0-testing/tools/xcutils/helper/x86_32/hypercall.h -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/x86_32/hypercall.h -@@ -0,0 +1,359 @@ -+/****************************************************************************** -+ * hypercall.h -+ * -+ * Linux-specific hypervisor handling. -+ * -+ * Copyright (c) 2002-2004, K A Fraser -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License version 2 -+ * as published by the Free Software Foundation; or, when distributed -+ * separately from the Linux kernel or incorporated into other -+ * software packages, subject to the following license: -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this source file (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, copy, modify, -+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, -+ * and to permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef __HYPERCALL_H__ -+#define __HYPERCALL_H__ -+ -+ -+#define __STR(x) #x -+#define STR(x) __STR(x) -+ -+#define _hypercall0(type, name) \ -+({ \ -+ long __res; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res) \ -+ : \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall1(type, name, a1) \ -+({ \ -+ long __res, __ign1; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=b" (__ign1) \ -+ : "1" ((long)(a1)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall2(type, name, a1, a2) \ -+({ \ -+ long __res, __ign1, __ign2; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall3(type, name, a1, a2, a3) \ -+({ \ -+ long __res, __ign1, __ign2, __ign3; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ -+ "=d" (__ign3) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)), \ -+ "3" ((long)(a3)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall4(type, name, a1, a2, a3, a4) \ -+({ \ -+ long __res, __ign1, __ign2, __ign3, __ign4; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ -+ "=d" (__ign3), "=S" (__ign4) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)), \ -+ "3" ((long)(a3)), "4" ((long)(a4)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ -+({ \ -+ long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ -+ "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)), \ -+ "3" ((long)(a3)), "4" ((long)(a4)), \ -+ "5" ((long)(a5)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+static inline int -+HYPERVISOR_set_trap_table( -+ trap_info_t *table) -+{ -+ return _hypercall1(int, set_trap_table, table); -+} -+ -+static inline int -+HYPERVISOR_mmu_update( -+ mmu_update_t *req, int count, int *success_count, domid_t domid) -+{ -+ return _hypercall4(int, mmu_update, req, count, success_count, domid); -+} -+ -+static inline int -+HYPERVISOR_mmuext_op( -+ struct mmuext_op *op, int count, int *success_count, domid_t domid) -+{ -+ return _hypercall4(int, mmuext_op, op, count, success_count, domid); -+} -+ -+static inline int -+HYPERVISOR_set_gdt( -+ unsigned long *frame_list, int entries) -+{ -+ return _hypercall2(int, set_gdt, frame_list, entries); -+} -+ -+static inline int -+HYPERVISOR_stack_switch( -+ unsigned long ss, unsigned long esp) -+{ -+ return _hypercall2(int, stack_switch, ss, esp); -+} -+ -+static inline int -+HYPERVISOR_set_callbacks( -+ unsigned long event_selector, unsigned long event_address, -+ unsigned long failsafe_selector, unsigned long failsafe_address) -+{ -+ return _hypercall4(int, set_callbacks, -+ event_selector, event_address, -+ failsafe_selector, failsafe_address); -+} -+ -+static inline int -+HYPERVISOR_fpu_taskswitch( -+ int set) -+{ -+ return _hypercall1(int, fpu_taskswitch, set); -+} -+ -+static inline int -+HYPERVISOR_sched_op_compat( -+ int cmd, unsigned long arg) -+{ -+ return _hypercall2(int, sched_op_compat, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_sched_op( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, sched_op, cmd, arg); -+} -+ -+#if 0 -+static inline long -+HYPERVISOR_set_timer_op( -+ u64 timeout) -+{ -+ unsigned long timeout_hi = (unsigned long)(timeout>>32); -+ unsigned long timeout_lo = (unsigned long)timeout; -+ return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi); -+} -+ -+static inline int -+HYPERVISOR_dom0_op( -+ dom0_op_t *dom0_op) -+{ -+ dom0_op->interface_version = DOM0_INTERFACE_VERSION; -+ return _hypercall1(int, dom0_op, dom0_op); -+} -+#endif -+ -+static inline int -+HYPERVISOR_set_debugreg( -+ int reg, unsigned long value) -+{ -+ return _hypercall2(int, set_debugreg, reg, value); -+} -+ -+static inline unsigned long -+HYPERVISOR_get_debugreg( -+ int reg) -+{ -+ return _hypercall1(unsigned long, get_debugreg, reg); -+} -+ -+#if 0 -+static inline int -+HYPERVISOR_update_descriptor( -+ u64 ma, u64 desc) -+{ -+ return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); -+} -+#endif -+ -+static inline int -+HYPERVISOR_memory_op( -+ unsigned int cmd, void *arg) -+{ -+ return _hypercall2(int, memory_op, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_multicall( -+ void *call_list, int nr_calls) -+{ -+ return _hypercall2(int, multicall, call_list, nr_calls); -+} -+ -+#if 0 -+static inline int -+HYPERVISOR_update_va_mapping( -+ unsigned long va, pte_t new_val, unsigned long flags) -+{ -+ unsigned long pte_hi = 0; -+#ifdef CONFIG_X86_PAE -+ pte_hi = new_val.pte_high; -+#endif -+ return _hypercall4(int, update_va_mapping, va, -+ new_val.pte_low, pte_hi, flags); -+} -+#endif -+ -+static inline int -+HYPERVISOR_event_channel_op( -+ int cmd, void *arg) -+{ -+ int rc = _hypercall2(int, event_channel_op, cmd, arg); -+ /* FIXME: handle -ENOSYS */ -+ return rc; -+} -+ -+static inline int -+HYPERVISOR_acm_op( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, acm_op, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_xen_version( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, xen_version, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_console_io( -+ int cmd, int count, char *str) -+{ -+ return _hypercall3(int, console_io, cmd, count, str); -+} -+ -+static inline int -+HYPERVISOR_physdev_op( -+ int cmd, void *arg) -+{ -+ int rc = _hypercall2(int, physdev_op, cmd, arg); -+ /* FIXME: handle -ENOSYS */ -+ return rc; -+} -+ -+static inline int -+HYPERVISOR_grant_table_op( -+ unsigned int cmd, void *uop, unsigned int count) -+{ -+ return _hypercall3(int, grant_table_op, cmd, uop, count); -+} -+ -+#if 0 -+static inline int -+HYPERVISOR_update_va_mapping_otherdomain( -+ unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) -+{ -+ unsigned long pte_hi = 0; -+#ifdef CONFIG_X86_PAE -+ pte_hi = new_val.pte_high; -+#endif -+ return _hypercall5(int, update_va_mapping_otherdomain, va, -+ new_val.pte_low, pte_hi, flags, domid); -+} -+#endif -+ -+static inline int -+HYPERVISOR_vm_assist( -+ unsigned int cmd, unsigned int type) -+{ -+ return _hypercall2(int, vm_assist, cmd, type); -+} -+ -+static inline int -+HYPERVISOR_vcpu_op( -+ int cmd, int vcpuid, void *extra_args) -+{ -+ return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); -+} -+ -+static inline int -+HYPERVISOR_suspend( -+ unsigned long srec) -+{ -+ struct sched_shutdown sched_shutdown = { -+ .reason = SHUTDOWN_suspend -+ }; -+ -+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, -+ &sched_shutdown, srec); -+ /* FIXME: handle -ENOSYS */ -+ return rc; -+} -+ -+static inline int -+HYPERVISOR_nmi_op( -+ unsigned long op, void *arg) -+{ -+ return _hypercall2(int, nmi_op, op, arg); -+} -+ -+static inline int -+HYPERVISOR_callback_op( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, callback_op, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_xenoprof_op( -+ int op, void *arg) -+{ -+ return _hypercall2(int, xenoprof_op, op, arg); -+} -+ -+ -+#endif /* __HYPERCALL_H__ */ -Index: xen-4.1.0-testing/tools/xcutils/helper/x86_64/div64.h -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/x86_64/div64.h -@@ -0,0 +1,57 @@ -+#ifndef _ASM_GENERIC_DIV64_H -+#define _ASM_GENERIC_DIV64_H -+/* -+ * Copyright (C) 2003 Bernardo Innocenti -+ * Based on former asm-ppc/div64.h and asm-m68knommu/div64.h -+ * -+ * The semantics of do_div() are: -+ * -+ * uint32_t do_div(uint64_t *n, uint32_t base) -+ * { -+ * uint32_t remainder = *n % base; -+ * *n = *n / base; -+ * return remainder; -+ * } -+ * -+ * NOTE: macro parameter n is evaluated multiple times, -+ * beware of side effects! -+ */ -+ -+#include -+ -+#if BITS_PER_LONG == 64 -+ -+# define do_div(n,base) ({ \ -+ uint32_t __base = (base); \ -+ uint32_t __rem; \ -+ __rem = ((uint64_t)(n)) % __base; \ -+ (n) = ((uint64_t)(n)) / __base; \ -+ __rem; \ -+ }) -+ -+#elif BITS_PER_LONG == 32 -+ -+extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); -+ -+/* The unnecessary pointer compare is there -+ * to check for type safety (n must be 64bit) -+ */ -+# define do_div(n,base) ({ \ -+ uint32_t __base = (base); \ -+ uint32_t __rem; \ -+ (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ -+ if (likely(((n) >> 32) == 0)) { \ -+ __rem = (uint32_t)(n) % __base; \ -+ (n) = (uint32_t)(n) / __base; \ -+ } else \ -+ __rem = __div64_32(&(n), __base); \ -+ __rem; \ -+ }) -+ -+#else /* BITS_PER_LONG == ?? */ -+ -+# error do_div() does not yet support the C64 -+ -+#endif /* BITS_PER_LONG */ -+ -+#endif /* _ASM_GENERIC_DIV64_H */ -Index: xen-4.1.0-testing/tools/xcutils/helper/x86_64/entry.S -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/x86_64/entry.S -@@ -0,0 +1,50 @@ -+#include "offsets.h" -+ -+/* --- stack -------------------------------------------------------- */ -+ -+ .data -+stack_bottom: -+ .fill 4096,1,0 -+stack_top: -+ -+/* --- text --------------------------------------------------------- */ -+ -+ .text -+ .globl _start,_start_kernel,hypercall_page,BUG -+ -+_start: -+ /* setup stack */ -+ movq %rsi, old_info -+ lea stack_top,%rsp -+ jmp start_helper -+ -+_start_kernel: -+ movq vcpu+vcpu_ebx,%rbx /* load registers */ -+ movq vcpu+vcpu_ecx,%rcx -+ movq vcpu+vcpu_edx,%rdx -+ movq vcpu+vcpu_esi,%rsi -+ movq vcpu+vcpu_edi,%rdi -+ movq vcpu+vcpu_ebp,%rbp -+ movq vcpu+vcpu_esp,%rsp /* using new kernels boot stack now */ -+ -+ movq vcpu+vcpu_eip,%rax -+ push %rax -+ movq vcpu+vcpu_eax,%rax -+ push %rax -+ movq vcpu+vcpu_cr3,%rax -+ movq %rax,%cr3 /* activate new pagetables */ -+ pop %rax /* load rax */ -+ ret /* jump to new kernel */ -+ -+BUG: -+ /* crash the domain, make xen dump registers */ -+ ud2 -+ jmp BUG -+ -+/* --- hypercall page ----------------------------------------------- */ -+ -+ .align 4096 -+hypercall_page: -+ nop -+ .align 4096 -+hypercall_end: -Index: xen-4.1.0-testing/tools/xcutils/helper/x86_64/hypercall.h -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/helper/x86_64/hypercall.h -@@ -0,0 +1,354 @@ -+/****************************************************************************** -+ * hypercall.h -+ * -+ * Linux-specific hypervisor handling. -+ * -+ * Copyright (c) 2002-2004, K A Fraser -+ * -+ * 64-bit updates: -+ * Benjamin Liu -+ * Jun Nakajima -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License version 2 -+ * as published by the Free Software Foundation; or, when distributed -+ * separately from the Linux kernel or incorporated into other -+ * software packages, subject to the following license: -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this source file (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, copy, modify, -+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, -+ * and to permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef __HYPERCALL_H__ -+#define __HYPERCALL_H__ -+ -+ -+#define __STR(x) #x -+#define STR(x) __STR(x) -+ -+#define _hypercall0(type, name) \ -+({ \ -+ long __res; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res) \ -+ : \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall1(type, name, a1) \ -+({ \ -+ long __res, __ign1; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=D" (__ign1) \ -+ : "1" ((long)(a1)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall2(type, name, a1, a2) \ -+({ \ -+ long __res, __ign1, __ign2; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=D" (__ign1), "=S" (__ign2) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall3(type, name, a1, a2, a3) \ -+({ \ -+ long __res, __ign1, __ign2, __ign3; \ -+ asm volatile ( \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ -+ "=d" (__ign3) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)), \ -+ "3" ((long)(a3)) \ -+ : "memory" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall4(type, name, a1, a2, a3, a4) \ -+({ \ -+ long __res, __ign1, __ign2, __ign3; \ -+ asm volatile ( \ -+ "movq %7,%%r10; " \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ -+ "=d" (__ign3) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)), \ -+ "3" ((long)(a3)), "g" ((long)(a4)) \ -+ : "memory", "r10" ); \ -+ (type)__res; \ -+}) -+ -+#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ -+({ \ -+ long __res, __ign1, __ign2, __ign3; \ -+ asm volatile ( \ -+ "movq %7,%%r10; movq %8,%%r8; " \ -+ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ -+ : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ -+ "=d" (__ign3) \ -+ : "1" ((long)(a1)), "2" ((long)(a2)), \ -+ "3" ((long)(a3)), "g" ((long)(a4)), \ -+ "g" ((long)(a5)) \ -+ : "memory", "r10", "r8" ); \ -+ (type)__res; \ -+}) -+ -+static inline int -+HYPERVISOR_set_trap_table( -+ trap_info_t *table) -+{ -+ return _hypercall1(int, set_trap_table, table); -+} -+ -+static inline int -+HYPERVISOR_mmu_update( -+ mmu_update_t *req, int count, int *success_count, domid_t domid) -+{ -+ return _hypercall4(int, mmu_update, req, count, success_count, domid); -+} -+ -+static inline int -+HYPERVISOR_mmuext_op( -+ struct mmuext_op *op, int count, int *success_count, domid_t domid) -+{ -+ return _hypercall4(int, mmuext_op, op, count, success_count, domid); -+} -+ -+static inline int -+HYPERVISOR_set_gdt( -+ unsigned long *frame_list, int entries) -+{ -+ return _hypercall2(int, set_gdt, frame_list, entries); -+} -+ -+static inline int -+HYPERVISOR_stack_switch( -+ unsigned long ss, unsigned long esp) -+{ -+ return _hypercall2(int, stack_switch, ss, esp); -+} -+ -+static inline int -+HYPERVISOR_set_callbacks( -+ unsigned long event_address, unsigned long failsafe_address, -+ unsigned long syscall_address) -+{ -+ return _hypercall3(int, set_callbacks, -+ event_address, failsafe_address, syscall_address); -+} -+ -+static inline int -+HYPERVISOR_fpu_taskswitch( -+ int set) -+{ -+ return _hypercall1(int, fpu_taskswitch, set); -+} -+ -+static inline int -+HYPERVISOR_sched_op_compat( -+ int cmd, unsigned long arg) -+{ -+ return _hypercall2(int, sched_op_compat, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_sched_op( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, sched_op, cmd, arg); -+} -+ -+#if 0 -+static inline long -+HYPERVISOR_set_timer_op( -+ u64 timeout) -+{ -+ return _hypercall1(long, set_timer_op, timeout); -+} -+ -+static inline int -+HYPERVISOR_dom0_op( -+ dom0_op_t *dom0_op) -+{ -+ dom0_op->interface_version = DOM0_INTERFACE_VERSION; -+ return _hypercall1(int, dom0_op, dom0_op); -+} -+#endif -+ -+static inline int -+HYPERVISOR_set_debugreg( -+ int reg, unsigned long value) -+{ -+ return _hypercall2(int, set_debugreg, reg, value); -+} -+ -+static inline unsigned long -+HYPERVISOR_get_debugreg( -+ int reg) -+{ -+ return _hypercall1(unsigned long, get_debugreg, reg); -+} -+ -+static inline int -+HYPERVISOR_update_descriptor( -+ unsigned long ma, unsigned long word) -+{ -+ return _hypercall2(int, update_descriptor, ma, word); -+} -+ -+static inline int -+HYPERVISOR_memory_op( -+ unsigned int cmd, void *arg) -+{ -+ return _hypercall2(int, memory_op, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_multicall( -+ void *call_list, int nr_calls) -+{ -+ return _hypercall2(int, multicall, call_list, nr_calls); -+} -+ -+#if 0 -+static inline int -+HYPERVISOR_update_va_mapping( -+ unsigned long va, pte_t new_val, unsigned long flags) -+{ -+ return _hypercall3(int, update_va_mapping, va, new_val.pte, flags); -+} -+#endif -+ -+static inline int -+HYPERVISOR_event_channel_op( -+ int cmd, void *arg) -+{ -+ int rc = _hypercall2(int, event_channel_op, cmd, arg); -+ return rc; -+} -+ -+static inline int -+HYPERVISOR_acm_op( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, acm_op, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_xen_version( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, xen_version, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_console_io( -+ int cmd, int count, char *str) -+{ -+ return _hypercall3(int, console_io, cmd, count, str); -+} -+ -+static inline int -+HYPERVISOR_physdev_op( -+ int cmd, void *arg) -+{ -+ int rc = _hypercall2(int, physdev_op, cmd, arg); -+ return rc; -+} -+ -+static inline int -+HYPERVISOR_grant_table_op( -+ unsigned int cmd, void *uop, unsigned int count) -+{ -+ return _hypercall3(int, grant_table_op, cmd, uop, count); -+} -+ -+#if 0 -+static inline int -+HYPERVISOR_update_va_mapping_otherdomain( -+ unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) -+{ -+ return _hypercall4(int, update_va_mapping_otherdomain, va, -+ new_val.pte, flags, domid); -+} -+#endif -+ -+static inline int -+HYPERVISOR_vm_assist( -+ unsigned int cmd, unsigned int type) -+{ -+ return _hypercall2(int, vm_assist, cmd, type); -+} -+ -+static inline int -+HYPERVISOR_vcpu_op( -+ int cmd, int vcpuid, void *extra_args) -+{ -+ return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); -+} -+ -+static inline int -+HYPERVISOR_set_segment_base( -+ int reg, unsigned long value) -+{ -+ return _hypercall2(int, set_segment_base, reg, value); -+} -+ -+static inline int -+HYPERVISOR_suspend( -+ unsigned long srec) -+{ -+ struct sched_shutdown sched_shutdown = { -+ .reason = SHUTDOWN_suspend -+ }; -+ -+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, -+ &sched_shutdown, srec); -+ return rc; -+} -+ -+static inline int -+HYPERVISOR_nmi_op( -+ unsigned long op, void *arg) -+{ -+ return _hypercall2(int, nmi_op, op, arg); -+} -+ -+static inline int -+HYPERVISOR_callback_op( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, callback_op, cmd, arg); -+} -+ -+static inline int -+HYPERVISOR_xenoprof_op( -+ int op, void *arg) -+{ -+ return _hypercall2(int, xenoprof_op, op, arg); -+} -+ -+#endif /* __HYPERCALL_H__ */ -Index: xen-4.1.0-testing/tools/xcutils/kexec-syscall.h -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/kexec-syscall.h -@@ -0,0 +1,80 @@ -+#ifndef KEXEC_SYSCALL_H -+#define KEXEC_SYSCALL_H -+ -+#define __LIBRARY__ -+#include -+#include -+#include -+ -+#define LINUX_REBOOT_MAGIC1 0xfee1dead -+#define LINUX_REBOOT_MAGIC2 672274793 -+#define LINUX_REBOOT_MAGIC2A 85072278 -+#define LINUX_REBOOT_MAGIC2B 369367448 -+ -+#define LINUX_REBOOT_CMD_RESTART 0x01234567 -+#define LINUX_REBOOT_CMD_HALT 0xCDEF0123 -+#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF -+#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 -+#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC -+#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 -+#define LINUX_REBOOT_CMD_EXEC_KERNEL 0x18273645 -+#define LINUX_REBOOT_CMD_KEXEC_OLD 0x81726354 -+#define LINUX_REBOOT_CMD_KEXEC_OLD2 0x18263645 -+#define LINUX_REBOOT_CMD_KEXEC 0x45584543 -+ -+#ifdef __i386__ -+#define __NR_kexec_load 283 -+#endif -+#ifdef __ia64__ -+#define __NR_kexec_load 1268 -+#endif -+#ifdef __powerpc64__ -+#define __NR_kexec_load 268 -+#endif -+#ifdef __powerpc__ -+#define __NR_kexec_load 268 -+#endif -+#ifdef __x86_64__ -+#define __NR_kexec_load 246 -+#endif -+#ifdef __s390x__ -+#define __NR_kexec_load 277 -+#endif -+#ifdef __s390__ -+#define __NR_kexec_load 277 -+#endif -+#ifndef __NR_kexec_load -+#error Unknown processor architecture. Needs a kexec_load syscall number. -+#endif -+ -+struct kexec_segment; -+ -+static inline long kexec_load(void *entry, unsigned long nr_segments, -+ struct kexec_segment *segments, unsigned long flags) -+{ -+ return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags); -+} -+ -+static inline long kexec_reboot(void) -+{ -+ return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); -+} -+ -+ -+#define KEXEC_ON_CRASH 0x00000001 -+#define KEXEC_ARCH_MASK 0xffff0000 -+ -+/* These values match the ELF architecture values. -+ * Unless there is a good reason that should continue to be the case. -+ */ -+#define KEXEC_ARCH_DEFAULT ( 0 << 16) -+#define KEXEC_ARCH_386 ( 3 << 16) -+#define KEXEC_ARCH_X86_64 (62 << 16) -+#define KEXEC_ARCH_PPC (20 << 16) -+#define KEXEC_ARCH_PPC64 (21 << 16) -+#define KEXEC_ARCH_IA_64 (50 << 16) -+#define KEXEC_ARCH_S390 (22 << 16) -+ -+#define KEXEC_MAX_SEGMENTS 16 -+ -+#endif /* KEXEC_SYSCALL_H */ -Index: xen-4.1.0-testing/tools/xcutils/xc_kexec.c -=================================================================== ---- /dev/null -+++ xen-4.1.0-testing/tools/xcutils/xc_kexec.c -@@ -0,0 +1,503 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include "kexec-syscall.h" -+ -+/* ------------------------------------------------------------------ */ -+ -+static unsigned long debug_level; -+ -+static char hypercall_page[PAGE_SIZE]; -+static unsigned long max_pfn; -+static unsigned long xen_start_info; -+static start_info_t start_info; -+ -+/* -------------------------------------------------------------------------------- */ -+ -+static unsigned long kernel_find_symbol(char *name) -+{ -+ FILE *file; -+ char line[256], type, symbol[256]; -+ unsigned long addr, retval = 0; -+ -+ file = fopen("/proc/kallsyms", "r"); -+ if (NULL == file) { -+ perror("open /proc/kallsyms"); -+ exit(1); -+ } -+ while (NULL != fgets(line, sizeof(line), file)) { -+ if (3 != sscanf(line, "%lx %c %127s", &addr, &type, symbol)) { -+ fprintf(stderr,"parse error: %s\n", line); -+ exit(1); -+ } -+ if (0 == strcmp(name, symbol)) { -+ retval = addr; -+ break; -+ } -+ } -+ fclose(file); -+ return retval; -+} -+ -+static int kernel_core_read(void *dest, off_t start, size_t size) -+{ -+ FILE *file; -+ int rc; -+ -+ file = fopen("/proc/kcore", "r"); -+ if (NULL == file) { -+ perror("open /proc/kcore"); -+ exit(1); -+ } -+ rc = fseek(file, start, SEEK_SET); -+ if (rc < 0) -+ goto out; -+ rc = fread(dest, 1, size, file); -+ fclose(file); -+ -+ out: -+ return rc; -+} -+ -+static off_t kernel_core_offset(unsigned long addr) -+{ -+ static void *core_header = NULL; -+ static struct elf_binary elf; -+ const elf_phdr *phdr; -+ uint64_t p_type; -+ uint64_t p_vaddr; -+ uint64_t p_offset; -+ uint64_t p_filesz; -+ off_t offset = 0; -+ int h; -+ -+ if (NULL == core_header) { -+ core_header = malloc(PAGE_SIZE); -+ if (PAGE_SIZE != kernel_core_read(core_header, 0, PAGE_SIZE)) -+ goto out; -+ elf_init(&elf, core_header, PAGE_SIZE); -+ } -+ -+ for (h = 0; h < elf_uval(&elf, elf.ehdr, e_phnum); h++) { -+ phdr = elf_phdr_by_index(&elf, h); -+ p_type = elf_uval(&elf, phdr, p_type); -+ p_vaddr = elf_uval(&elf, phdr, p_vaddr); -+ p_offset = elf_uval(&elf, phdr, p_offset); -+ p_filesz = elf_uval(&elf, phdr, p_filesz); -+ if (p_type != PT_LOAD) -+ continue; -+ if (addr > p_vaddr && addr < p_vaddr + p_filesz) -+ offset = p_offset + (addr - p_vaddr); -+ } -+ -+ out: -+ return offset; -+} -+ -+static int kernel_core_by_addr(void *dest, unsigned long addr, size_t size) -+{ -+ off_t offset; -+ int rc = 0; -+ -+ offset = kernel_core_offset(addr); -+ if (0 == addr) { -+ fprintf(stderr, "%s: addr 0x%lx not in /proc/kcore\n", -+ __FUNCTION__, addr); -+ goto out; -+ } -+ rc = kernel_core_read(dest, offset, size); -+ if (debug_level) -+ fprintf(stderr, "%s: vaddr %lx, offset %lx, %d bytes\n", -+ __FUNCTION__, addr, (unsigned long)offset, rc); -+ -+ out: -+ return rc; -+} -+ -+static int kernel_core_by_name(void *dest, char *name, size_t size) -+{ -+ unsigned long addr; -+ off_t offset; -+ int rc = 0; -+ -+ addr = kernel_find_symbol(name); -+ if (0 == addr) { -+ fprintf(stderr, "%s: can't find symbol \"%s\" in /proc/kallsyms\n", -+ __FUNCTION__, name); -+ fprintf(stderr, "%s: try CONFIG_KALLSYMS_ALL=y\n", __FUNCTION__); -+ goto out; -+ } -+ -+ offset = kernel_core_offset(addr); -+ if (0 == addr) { -+ fprintf(stderr, "%s: symbol \"%s\" (0x%lx) not in /proc/kcore\n", -+ __FUNCTION__, name, addr); -+ goto out; -+ } -+ rc = kernel_core_read(dest, offset, size); -+ if (debug_level) -+ fprintf(stderr, "%s: vaddr %lx, offset %lx, %d bytes (%s)\n", -+ __FUNCTION__, addr, (unsigned long)offset, rc, name); -+ -+ out: -+ return rc; -+} -+ -+/* ------------------------------------------------------------------ */ -+ -+struct kexec_segment { -+ const void *buf; -+ size_t bufsz; -+ const void *mem; -+ size_t memsz; -+}; -+ -+struct kexec_segment segments[KEXEC_MAX_SEGMENTS]; -+static unsigned int nsegments; -+static void *entry; -+ -+static void kexec_add_segment(struct xc_dom_image *dom, -+ struct xc_dom_seg *xc_seg, -+ struct kexec_segment *kseg) -+{ -+ if (0 == xc_seg->vend - xc_seg->vstart) -+ return; -+ -+ kseg->buf = xc_dom_seg_to_ptr(dom, xc_seg); -+ kseg->bufsz = xc_seg->vend - xc_seg->vstart; -+ kseg->mem = (void*)(xc_seg->pfn << PAGE_SHIFT); -+ kseg->memsz = kseg->bufsz; -+ if (debug_level) -+ fprintf(stderr," kexec segment: 0x%08lx-0x%08lx (+0x%08lx)\n", -+ (unsigned long)kseg->mem, -+ (unsigned long)(kseg->mem+kseg->memsz-1), -+ (unsigned long)kseg->memsz); -+} -+ -+static void kexec_add_page(struct xc_dom_image *dom, xen_pfn_t pfn, -+ struct kexec_segment *kseg) -+{ -+ if (0 == pfn) -+ return; -+ -+ kseg->buf = xc_dom_pfn_to_ptr(dom, pfn, 1); -+ kseg->bufsz = PAGE_SIZE; -+ kseg->mem = (void*)(pfn << PAGE_SHIFT); -+ kseg->memsz = kseg->bufsz; -+ if (debug_level) -+ fprintf(stderr," kexec page : 0x%08lx-0x%08lx\n", -+ (unsigned long)kseg->mem, -+ (unsigned long)(kseg->mem+kseg->memsz-1)); -+} -+ -+/* ------------------------------------------------------------------ */ -+ -+static const char helper_blob[] = { -+#include "helper/blob.h" -+}; -+ -+static void helper_parse(struct xc_dom_image *dom, -+ struct elf_binary *elf) -+{ -+ if (debug_level) -+ fprintf(stderr, "%s\n", __FUNCTION__); -+ elf_init(elf, helper_blob, sizeof(helper_blob)); -+ if (debug_level) -+ elf_set_logfile(elf, stderr, debug_level); -+ elf_parse_binary(elf); -+ elf->pstart = elf->pstart & PAGE_MASK; -+ elf->pend = (elf->pend + PAGE_SIZE - 1) & PAGE_MASK; -+ -+ dom->extra_pages = (elf->pend - elf->pstart) >> PAGE_SHIFT; -+} -+ -+static void *helper_load(struct xc_dom_image *dom, -+ struct elf_binary *elf) -+{ -+ struct xc_dom_seg seg; -+ uint64_t entry; -+ -+ if (debug_level) -+ fprintf(stderr, "%s\n", __FUNCTION__); -+ -+ xc_dom_alloc_segment(dom, &seg, "kexec", 0, elf->pend - elf->pstart); -+ elf->dest = xc_dom_seg_to_ptr(dom, &seg); -+ elf->reloc_offset = seg.vstart - dom->parms.virt_base - elf->pstart; -+ if (debug_level) -+ fprintf(stderr,"%s: relocation offset: 0x%" PRIx64 "\n", -+ __FUNCTION__, elf->reloc_offset); -+ -+ if (NULL == elf->dest) -+ goto err; -+ elf_load_binary(elf); -+ if (-1 == elf_reloc(elf)) -+ goto err; -+ kexec_add_segment(dom, &seg, &segments[nsegments++]); -+ -+ entry = elf_uval(elf, elf->ehdr, e_entry); -+ return (void*)((intptr_t)(entry + elf->reloc_offset)); -+ -+ err: -+ exit(1); -+} -+ -+static void* ptr_symbol(struct elf_binary *elf, const char *symbol) -+{ -+ unsigned long addr; -+ -+ addr = elf_lookup_addr(elf, symbol); -+ if (-1 == addr) -+ exit(1); -+ return elf_get_ptr(elf, addr); -+} -+ -+static void helper_pass_info(struct xc_dom_image *dom, struct elf_binary *elf) -+{ -+ struct vcpu_guest_context ctxt; -+ struct vcpu_guest_context *vcpu; -+ unsigned long *addr; -+ void *page; -+ -+ if (debug_level) -+ fprintf(stderr, "%s\n", __FUNCTION__); -+ dom->arch_hooks->vcpu(dom, &ctxt); -+ vcpu = ptr_symbol(elf, "vcpu"); -+ *vcpu = ctxt; -+ addr = ptr_symbol(elf, "virt_base"); -+ *addr = dom->parms.virt_base; -+ addr = ptr_symbol(elf, "virt_hypercall"); -+ *addr = dom->parms.virt_hypercall; -+#if defined(__i386__) -+ addr = ptr_symbol(elf, "pae_paging"); -+ *addr = dom->parms.pae; -+#endif -+ addr = ptr_symbol(elf, "debug_level"); -+ *addr = debug_level; -+ page = ptr_symbol(elf, "hypercall_page"); -+ memcpy(page, hypercall_page, PAGE_SIZE); -+} -+ -+/* ------------------------------------------------------------------ */ -+ -+static char *kernel_name = "/boot/vmlinuz-xen"; -+static char *ramdisk_name; -+static char *cmdline; -+static char *features; // = "auto_translated_physmap"; -+static int do_exec = 0; -+static int do_load = 1; -+static int do_type = 0; -+ -+static void usage(FILE *fp) -+{ -+ fprintf(fp, -+ "\n" -+ "This is a xen kexec loader.\n" -+ "\n" -+ "usage: xen-kexec [ options ]\n" -+ "options:\n" -+ " -h print this text\n" -+ " -d enable debug messages\n" -+ " -e boot loaded kernel [%s]\n" -+ " -l load kernel [%s]\n" -+ " -k kernel image [%s]\n" -+ " -i initrd [%s]\n" -+ " -c kernel command line [%s]\n" -+ " -f xen features [%s]\n" -+ " -t print kernel type\n" -+ "\n" -+ "(c) 2006 Gerd Hoffmann \n", -+ do_exec ? "yes" : "no", -+ do_load ? "yes" : "no", -+ kernel_name, ramdisk_name, -+ cmdline ? : "-", -+ features ? : "-"); -+} -+ -+static void print_type(char *filename) -+{ -+ struct xc_dom_image *dom; -+ -+ dom = xc_dom_allocate(cmdline, features); -+ if (0 != xc_dom_kernel_file(dom, filename)) { -+ fprintf(stderr, "can't open %s: %s\n", filename, strerror(errno)); -+ goto done; -+ } -+ if (0 != xc_dom_parse_image(dom)) { -+ printf("unknown-kernel\n"); -+ goto done; -+ } -+#if defined(__i386__) || defined(__x86_64__) -+ if (NULL == dom->parms.elf_note_start && NULL == dom->parms.guest_info) { -+ printf("other-elf-kernel\n"); -+ goto done; -+ } -+#endif -+ printf("%s\n", dom->guest_type); -+ -+ done: -+ xc_dom_release(dom); -+} -+ -+int main(int argc, char *argv[]) -+{ -+ struct xc_dom_image *dom = NULL; -+ struct elf_binary helper; -+ int fd,rc,c,xc; -+ -+ /* figure defaults */ -+ fd = open("/proc/cmdline", O_RDONLY); -+ if (-1 != fd) { -+ cmdline = malloc(1024); -+ rc = read(fd,cmdline,1024); -+ cmdline[rc-1] = 0; -+ close(fd); -+ } -+ -+ /* parse args */ -+ for (;;) { -+ if (-1 == (c = getopt(argc, argv, "hdletk:i:c:f:"))) -+ break; -+ switch (c) { -+ case 'k': -+ kernel_name = optarg; -+ break; -+ case 'i': -+ if (strlen(optarg)) -+ ramdisk_name = optarg; -+ else -+ ramdisk_name = NULL; -+ break; -+ case 'c': -+ cmdline = optarg; -+ break; -+ case 'f': -+ features = optarg; -+ break; -+ case 'd': -+ debug_level++; -+ break; -+ -+ case 'e': -+ do_exec = 1; -+ do_load = 0; -+ do_type = 0; -+ break; -+ case 'l': -+ do_exec = 0; -+ do_load = 1; -+ do_type = 0; -+ break; -+ case 't': -+ do_exec = 0; -+ do_load = 0; -+ do_type = 1; -+ break; -+ -+ case 'h': -+ usage(stdout); -+ exit(0); -+ default: -+ usage(stderr); -+ exit(1); -+ } -+ } -+ -+ if (do_exec) { -+ kexec_reboot(); -+ perror("kexec_reboot"); -+ exit(1); -+ } -+ -+ /* logging */ -+ if (debug_level) -+ xc_dom_logfile = stderr; -+ -+ if (do_type) { -+ print_type(kernel_name); -+ exit(0); -+ } -+ -+ if (!do_load) -+ exit(0); -+ -+ xc = xc_interface_open(); -+ if (-1 == xc) -+ exit(1); -+ -+ /* get info from kernel */ -+ if (kernel_core_by_name(hypercall_page, "hypercall_page", PAGE_SIZE) <= 0) -+ goto out; -+ if (kernel_core_by_name(&max_pfn, "max_pfn", sizeof(max_pfn)) <= 0) -+ goto out; -+ if (kernel_core_by_name(&xen_start_info, "xen_start_info", sizeof(xen_start_info)) <= 0) -+ goto out; -+ if (kernel_core_by_addr(&start_info, xen_start_info, sizeof(start_info)) <= 0) -+ goto out; -+ -+ /* build image */ -+ dom = xc_dom_allocate(cmdline, features); -+ dom->xen_version = xc_version(xc, XENVER_version, NULL); -+ strcpy(dom->xen_caps, start_info.magic); -+ -+ if (0 != (rc = xc_dom_kernel_file(dom, kernel_name))) -+ goto out; -+ if (ramdisk_name && strlen(ramdisk_name)) -+ if (0 != (rc = xc_dom_ramdisk_file(dom, ramdisk_name))) -+ goto out; -+ if (0 != (rc = xc_dom_parse_image(dom))) -+ goto out; -+ if (0 != strcmp(start_info.magic, dom->guest_type)) { -+ fprintf(stderr,"incompatible kernel (need guest_type \"%s\")\n", -+ start_info.magic); -+ goto out; -+ } -+ helper_parse(dom, &helper); -+ -+ if (0 != (rc = xc_dom_mem_init(dom, max_pfn >> (20 - PAGE_SHIFT)))) -+ goto out; -+ if (0 != (rc = xc_dom_build_image(dom))) -+ goto out; -+ entry = helper_load(dom, &helper); -+ if (0 != (rc = dom->arch_hooks->setup_pgtables(dom))) -+ goto out; -+ dom->arch_hooks->start_info(dom); -+ -+ /* setup kexec structs */ -+ kexec_add_segment(dom, &dom->kernel_seg, &segments[nsegments++]); -+ kexec_add_segment(dom, &dom->ramdisk_seg, &segments[nsegments++]); -+ kexec_add_segment(dom, &dom->p2m_seg, &segments[nsegments++]); -+ kexec_add_page(dom, dom->start_info_pfn, &segments[nsegments++]); -+ kexec_add_segment(dom, &dom->pgtables_seg, &segments[nsegments++]); -+ -+ dom->flags = start_info.flags; -+ dom->console_evtchn = start_info.console.domU.evtchn; -+ dom->xenstore_evtchn = start_info.store_evtchn; -+ -+ /* setup helper code */ -+ helper_pass_info(dom, &helper); -+ -+ rc = kexec_load(entry, nsegments, segments, 0); -+ if (0 != rc) { -+ perror("kexec_load"); -+ exit(1); -+ } -+ if (debug_level) -+ fprintf(stderr,"kexec_load ok [%p]\n", entry); -+ -+ xc_dom_release(dom); -+ exit(0); -+ -+ out: -+ if (dom) -+ xc_dom_release(dom); -+ exit(1); -+} diff --git a/udev-rules.patch b/udev-rules.patch index e7e3bee..86f5db7 100644 --- a/udev-rules.patch +++ b/udev-rules.patch @@ -1,11 +1,11 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/xen-backend.rules +Index: xen-4.2.0-testing/tools/hotplug/Linux/xen-backend.rules =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/xen-backend.rules -+++ xen-4.1.2-testing/tools/hotplug/Linux/xen-backend.rules +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/xen-backend.rules ++++ xen-4.2.0-testing/tools/hotplug/Linux/xen-backend.rules @@ -13,4 +13,5 @@ KERNEL=="blktap-control", NAME="xen/blkt KERNEL=="gntdev", NAME="xen/%k", MODE="0600" KERNEL=="pci_iomul", NAME="xen/%k", MODE="0600" KERNEL=="tapdev[a-z]*", NAME="xen/blktap-2/tapdev%m", MODE="0600" --SUBSYSTEM=="net", KERNEL=="tap*", ACTION=="add", RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap" -+SUBSYSTEM=="net", KERNEL=="tap*", ACTION=="add", TEST=="/proc/xen", RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap" +-SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap" ++SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", TEST=="/proc/xen" RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap" +KERNELS=="xen", KERNEL=="xvd*", SUBSYSTEM=="block", OPTIONS+="last_rule" diff --git a/usb-list.patch b/usb-list.patch index 669ec67..ce95242 100644 --- a/usb-list.patch +++ b/usb-list.patch @@ -15,10 +15,10 @@ could be referred to: http://www.gossamer-threads.com/lists/xen/devel/181021?search_string=usb-list;#181021 -Index: xen-4.1.2-testing/tools/python/xen/xm/main.py +Index: xen-4.2.0-testing/tools/python/xen/xm/main.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.1.2-testing/tools/python/xen/xm/main.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/main.py ++++ xen-4.2.0-testing/tools/python/xen/xm/main.py @@ -2629,10 +2629,22 @@ def xm_usb_list(args): ni = parse_dev_info(x[1]) ni['idx'] = int(x[0]) diff --git a/vif-bridge-no-iptables.patch b/vif-bridge-no-iptables.patch index 8efd5e1..bc4f01c 100644 --- a/vif-bridge-no-iptables.patch +++ b/vif-bridge-no-iptables.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/vif-bridge +Index: xen-4.2.0-testing/tools/hotplug/Linux/vif-bridge =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/vif-bridge -+++ xen-4.1.2-testing/tools/hotplug/Linux/vif-bridge +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/vif-bridge ++++ xen-4.2.0-testing/tools/hotplug/Linux/vif-bridge @@ -101,9 +101,9 @@ case "$command" in ;; esac @@ -13,5 +13,5 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/vif-bridge +# handle_iptable +#fi - log debug "Successful vif-bridge $command for $dev, bridge $bridge." - if [ "$type_if" = vif -a "$command" = "online" ] + call_hooks vif post + diff --git a/vif-bridge-tap-fix.patch b/vif-bridge-tap-fix.patch index 2aa3cab..b571b15 100644 --- a/vif-bridge-tap-fix.patch +++ b/vif-bridge-tap-fix.patch @@ -10,10 +10,10 @@ it from adding user-created taps to bridges. Signed-off-by: Jim Fehlig -Index: xen-4.1.2-testing/tools/hotplug/Linux/vif-bridge +Index: xen-4.2.0-testing/tools/hotplug/Linux/vif-bridge =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/vif-bridge -+++ xen-4.1.2-testing/tools/hotplug/Linux/vif-bridge +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/vif-bridge ++++ xen-4.2.0-testing/tools/hotplug/Linux/vif-bridge @@ -32,6 +32,13 @@ dir=$(dirname "$0") . "$dir/vif-common.sh" diff --git a/vif-bridge.mtu.patch b/vif-bridge.mtu.patch deleted file mode 100644 index e455b78..0000000 --- a/vif-bridge.mtu.patch +++ /dev/null @@ -1,33 +0,0 @@ -Subject: set mtu from bridge also on vif interface -References: bug#625394 - -Apply mtu size from bridge interface also in vif interface. -This depends on a kernel change which allows arbitrary mtu sizes until -the frontend driver has connected to the backend driver. Without this -kernel change, the vif mtu size will be limited to 1500 with this change -to the vif-bridge script. - -(xen-unstable changeset: 22885:005722613063) - -Signed-off-by: Olaf Hering - ---- - tools/hotplug/Linux/vif-bridge | 5 +++++ - 1 file changed, 5 insertions(+) - -Index: xen-4.1.2-testing/tools/hotplug/Linux/vif-bridge -=================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/vif-bridge -+++ xen-4.1.2-testing/tools/hotplug/Linux/vif-bridge -@@ -104,6 +104,11 @@ case "$command" in - - add) - setup_virtual_bridge_port "$dev" -+ mtu="`ip link show $bridge | awk '/mtu/ { print $5 }'`" -+ if [ -n "$mtu" ] && [ "$mtu" -gt 0 ] -+ then -+ ip link set $vif mtu $mtu || : -+ fi - add_to_bridge "$bridge" "$dev" - ;; - esac diff --git a/vif-route-ifup.patch b/vif-route-ifup.patch index ec362a6..e0dec05 100644 --- a/vif-route-ifup.patch +++ b/vif-route-ifup.patch @@ -4,10 +4,10 @@ tools/hotplug/Linux/vif-route-ifup | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) -Index: xen-4.1.2-testing/tools/examples/xend-config.sxp +Index: xen-4.2.0-testing/tools/examples/xend-config.sxp =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xend-config.sxp -+++ xen-4.1.2-testing/tools/examples/xend-config.sxp +--- xen-4.2.0-testing.orig/tools/examples/xend-config.sxp ++++ xen-4.2.0-testing/tools/examples/xend-config.sxp @@ -200,6 +200,26 @@ #(network-script network-route) #(vif-script vif-route) @@ -35,10 +35,10 @@ Index: xen-4.1.2-testing/tools/examples/xend-config.sxp ## Use the following if network traffic is routed with NAT, as an alternative # to the settings for bridged networking given above. -Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile +Index: xen-4.2.0-testing/tools/hotplug/Linux/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/Makefile -+++ xen-4.1.2-testing/tools/hotplug/Linux/Makefile +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/Makefile ++++ xen-4.2.0-testing/tools/hotplug/Linux/Makefile @@ -11,7 +11,7 @@ XENCOMMONS_SYSCONFIG = init.d/sysconfig. # Xen script dir and scripts to go there. @@ -48,10 +48,10 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile XEN_SCRIPTS += network-nat vif-nat XEN_SCRIPTS += vif2 XEN_SCRIPTS += vif-setup -Index: xen-4.1.2-testing/tools/hotplug/Linux/vif-route-ifup +Index: xen-4.2.0-testing/tools/hotplug/Linux/vif-route-ifup =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/hotplug/Linux/vif-route-ifup ++++ xen-4.2.0-testing/tools/hotplug/Linux/vif-route-ifup @@ -0,0 +1,34 @@ +#!/bin/bash +#============================================================================ diff --git a/x86-cpufreq-report.patch b/x86-cpufreq-report.patch index 5b39f74..f153d59 100644 --- a/x86-cpufreq-report.patch +++ b/x86-cpufreq-report.patch @@ -1,7 +1,9 @@ ---- a/xen/arch/x86/platform_hypercall.c -+++ b/xen/arch/x86/platform_hypercall.c -@@ -23,7 +23,7 @@ - #include +Index: xen-4.2.0-testing/xen/arch/x86/platform_hypercall.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/platform_hypercall.c ++++ xen-4.2.0-testing/xen/arch/x86/platform_hypercall.c +@@ -25,7 +25,7 @@ + #include #include #include -#include @@ -9,11 +11,10 @@ #include #include #include -@@ -565,6 +565,42 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe - op->u.mem_add.epfn, - op->u.mem_add.pxm); - break; -+ +@@ -639,6 +639,41 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe + } + break; + + case XENPF_get_cpu_freq: + case XENPF_get_cpu_freq_min: + case XENPF_get_cpu_freq_max: @@ -52,11 +53,13 @@ default: ret = -ENOSYS; break; ---- a/xen/include/public/platform.h -+++ b/xen/include/public/platform.h -@@ -466,6 +466,16 @@ struct xenpf_mem_hotadd - uint32_t flags; - }; +Index: xen-4.2.0-testing/xen/include/public/platform.h +=================================================================== +--- xen-4.2.0-testing.orig/xen/include/public/platform.h ++++ xen-4.2.0-testing/xen/include/public/platform.h +@@ -504,6 +504,16 @@ struct xenpf_core_parking { + typedef struct xenpf_core_parking xenpf_core_parking_t; + DEFINE_XEN_GUEST_HANDLE(xenpf_core_parking_t); +#define XENPF_get_cpu_freq ('N' << 24) +#define XENPF_get_cpu_freq_min (XENPF_get_cpu_freq + 1) @@ -68,13 +71,13 @@ + uint32_t freq; /* in kHz */ +}; + - struct xen_platform_op { - uint32_t cmd; - uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ -@@ -487,6 +497,7 @@ struct xen_platform_op { - struct xenpf_cpu_ol cpu_ol; + /* + * ` enum neg_errnoval + * ` HYPERVISOR_platform_op(const struct xen_platform_op*); +@@ -530,6 +540,7 @@ struct xen_platform_op { struct xenpf_cpu_hotadd cpu_add; struct xenpf_mem_hotadd mem_add; + struct xenpf_core_parking core_parking; + struct xenpf_get_cpu_freq get_cpu_freq; uint8_t pad[128]; } u; diff --git a/x86-extra-trap-info.patch b/x86-extra-trap-info.patch index 531e3a4..86f0636 100644 --- a/x86-extra-trap-info.patch +++ b/x86-extra-trap-info.patch @@ -1,6 +1,8 @@ ---- a/xen/arch/x86/x86_32/entry.S -+++ b/xen/arch/x86/x86_32/entry.S -@@ -390,29 +390,41 @@ UNLIKELY_END(bounce_vm86_3) +Index: xen-4.2.0-testing/xen/arch/x86/x86_32/entry.S +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/x86_32/entry.S ++++ xen-4.2.0-testing/xen/arch/x86/x86_32/entry.S +@@ -389,29 +389,41 @@ UNLIKELY_END(bounce_vm86_3) movl %eax,UREGS_eip+4(%esp) ret _ASM_EXTABLE(.Lft6, domain_crash_synchronous) @@ -60,9 +62,11 @@ domain_crash_synchronous: pushl $domain_crash_synchronous_string call printk ---- a/xen/arch/x86/x86_64/entry.S -+++ b/xen/arch/x86/x86_64/entry.S -@@ -430,22 +430,35 @@ UNLIKELY_END(bounce_failsafe) +Index: xen-4.2.0-testing/xen/arch/x86/x86_64/entry.S +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/x86_64/entry.S ++++ xen-4.2.0-testing/xen/arch/x86/x86_64/entry.S +@@ -427,22 +427,35 @@ UNLIKELY_END(bounce_failsafe) jz domain_crash_synchronous movq %rax,UREGS_rip+8(%rsp) ret diff --git a/x86-ioapic-ack-default.patch b/x86-ioapic-ack-default.patch index c354761..7a0f435 100644 --- a/x86-ioapic-ack-default.patch +++ b/x86-ioapic-ack-default.patch @@ -1,19 +1,19 @@ Change default IO-APIC ack mode for single IO-APIC systems to old-style. -Index: xen-4.1.3-testing/xen/arch/x86/io_apic.c +Index: xen-4.2.0-testing/xen/arch/x86/io_apic.c =================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/io_apic.c -+++ xen-4.1.3-testing/xen/arch/x86/io_apic.c -@@ -1680,7 +1680,7 @@ static unsigned int startup_level_ioapic - return 0; /* don't check for pending */ - } +--- xen-4.2.0-testing.orig/xen/arch/x86/io_apic.c ++++ xen-4.2.0-testing/xen/arch/x86/io_apic.c +@@ -43,7 +43,7 @@ static struct { int pin, apic; } ioapic_ + static DEFINE_SPINLOCK(ioapic_lock); --int __read_mostly ioapic_ack_new = 1; -+int __read_mostly ioapic_ack_new = -1; - static void setup_ioapic_ack(char *s) - { - if ( !strcmp(s, "old") ) -@@ -2187,6 +2187,8 @@ void __init setup_IO_APIC(void) + bool_t __read_mostly skip_ioapic_setup; +-bool_t __read_mostly ioapic_ack_new = 1; ++bool_t __read_mostly ioapic_ack_new = -1; + bool_t __read_mostly ioapic_ack_forced = 0; + + #ifndef sis_apic_bug +@@ -2012,6 +2012,8 @@ void __init setup_IO_APIC(void) else io_apic_irqs = ~PIC_IRQS; diff --git a/x86_64-allow-unsafe-adjust.patch b/x86_64-allow-unsafe-adjust.patch deleted file mode 100644 index 098ec68..0000000 --- a/x86_64-allow-unsafe-adjust.patch +++ /dev/null @@ -1,86 +0,0 @@ -References: CVE-2012-2934, bnc#764077 - -Product management demanded that customer systems must continue to boot -irrespective of the presence of XSA-9. Rather than having our and -perhaps other distros carry non-trivial patches, allow for more fine -grained control (panic on boot, deny guest creation, or merely warn) by -means of a single line change. - ---- a/xen/arch/x86/cpu/amd.c -+++ b/xen/arch/x86/cpu/amd.c -@@ -32,8 +32,11 @@ - static char opt_famrev[14]; - string_param("cpuid_mask_cpu", opt_famrev); - --static int opt_allow_unsafe; -+#ifdef __x86_64__ -+/* 1 = allow, 0 = don't allow guest creation, -1 = don't allow boot */ -+int __read_mostly opt_allow_unsafe; - boolean_param("allow_unsafe", opt_allow_unsafe); -+#endif - - static inline void wrmsr_amd(unsigned int index, unsigned int lo, - unsigned int hi) -@@ -638,10 +641,19 @@ static void __devinit init_amd(struct cp - clear_bit(X86_FEATURE_MCE, c->x86_capability); - - #ifdef __x86_64__ -- if (cpu_has_amd_erratum(c, AMD_ERRATUM_121) && !opt_allow_unsafe) -+ if (!cpu_has_amd_erratum(c, AMD_ERRATUM_121)) -+ opt_allow_unsafe = 1; -+ else if (opt_allow_unsafe < 0) - panic("Xen will not boot on this CPU for security reasons.\n" - "Pass \"allow_unsafe\" if you're trusting all your" - " (PV) guest kernels.\n"); -+ else if (!opt_allow_unsafe && c == &boot_cpu_data) -+ printk(KERN_WARNING -+ "*** Xen will not allow creation of DomU-s on" -+ " this CPU for security reasons. ***\n" -+ KERN_WARNING -+ "*** Pass \"allow_unsafe\" if you're trusting" -+ " all your (PV) guest kernels. ***\n"); - - /* AMD CPUs do not support SYSENTER outside of legacy mode. */ - clear_bit(X86_FEATURE_SEP, c->x86_capability); ---- a/xen/arch/x86/domain.c -+++ b/xen/arch/x86/domain.c -@@ -52,6 +52,7 @@ - #include - #include - #include -+#include - #include - #include - #ifdef CONFIG_COMPAT -@@ -474,6 +475,20 @@ int arch_domain_create(struct domain *d, - - #else /* __x86_64__ */ - -+ if ( d->domain_id && !is_idle_domain(d) && -+ cpu_has_amd_erratum(&boot_cpu_data, AMD_ERRATUM_121) ) -+ { -+ if ( !opt_allow_unsafe ) -+ { -+ printk(XENLOG_G_ERR "Xen does not allow DomU creation on this CPU" -+ " for security reasons.\n"); -+ return -EPERM; -+ } -+ printk(XENLOG_G_WARNING -+ "Dom%d may compromise security on this CPU.\n", -+ d->domain_id); -+ } -+ - BUILD_BUG_ON(PDPT_L2_ENTRIES * sizeof(*d->arch.mm_perdomain_pt_pages) - != PAGE_SIZE); - pg = alloc_domheap_page(NULL, MEMF_node(domain_to_node(d))); ---- a/xen/include/asm-x86/amd.h -+++ b/xen/include/asm-x86/amd.h -@@ -151,6 +151,8 @@ struct cpuinfo_x86; - int cpu_has_amd_erratum(const struct cpuinfo_x86 *, int, ...); - - #ifdef __x86_64__ -+extern int opt_allow_unsafe; -+ - void fam10h_check_enable_mmcfg(void); - void check_enable_amd_mmconf_dmi(void); - #endif diff --git a/xen-4.1.3-testing-src.tar.bz2 b/xen-4.1.3-testing-src.tar.bz2 deleted file mode 100644 index 757cd76..0000000 --- a/xen-4.1.3-testing-src.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6e2d148ca62ed1c2b498c860c5c1a783506152ab69897de4642efe910035cb73 -size 10789169 diff --git a/xen-4.2.0-testing-src.tar.bz2 b/xen-4.2.0-testing-src.tar.bz2 new file mode 100644 index 0000000..798c19d --- /dev/null +++ b/xen-4.2.0-testing-src.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3377276a6def862197a8f9d71e74bb0b981f4c5015bbf79d723ea39f90f74ed2 +size 4861363 diff --git a/xen-api-auth.patch b/xen-api-auth.patch index 599f4c2..381442d 100644 --- a/xen-api-auth.patch +++ b/xen-api-auth.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendAuthSessions.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendAuthSessions.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendAuthSessions.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendAuthSessions.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendAuthSessions.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendAuthSessions.py @@ -84,7 +84,7 @@ class XendAuthSessions: # if PAM doesn't exist, let's ignore it return False diff --git a/xen-bug776995-pvscsi-no-devname.patch b/xen-bug776995-pvscsi-no-devname.patch new file mode 100644 index 0000000..c5cf27f --- /dev/null +++ b/xen-bug776995-pvscsi-no-devname.patch @@ -0,0 +1,36 @@ +xend/pvscsi: fix passing of SCSI control LUNs + +Currently pvscsi can not pass SCSI devices that have just a scsi_generic node. +In the following example sg3 is a control LUN for the disk sdd. +But vscsi=['4:0:2:0,0:0:0:0'] does not work because the internal 'devname' +variable remains None. Later writing p-devname to xenstore fails because None +is not a valid string variable. + +Since devname is used for just informational purpose use sg also as devname. + +carron:~ $ lsscsi -g +[0:0:0:0] disk ATA FK0032CAAZP HPF2 /dev/sda /dev/sg0 +[4:0:0:0] disk HP P2000G3 FC/iSCSI T100 /dev/sdb /dev/sg1 +[4:0:1:0] disk HP P2000G3 FC/iSCSI T100 /dev/sdc /dev/sg2 +[4:0:2:0] storage HP HSV400 0950 - /dev/sg3 +[4:0:2:1] disk HP HSV400 0950 /dev/sdd /dev/sg4 +[4:0:3:0] storage HP HSV400 0950 - /dev/sg5 +[4:0:3:1] disk HP HSV400 0950 /dev/sde /dev/sg6 + +--- + tools/python/xen/util/vscsi_util.py | 2 ++ + 1 file changed, 2 insertions(+) + +Index: xen-4.1.2-testing/tools/python/xen/util/vscsi_util.py +=================================================================== +--- xen-4.1.2-testing.orig/tools/python/xen/util/vscsi_util.py ++++ xen-4.1.2-testing/tools/python/xen/util/vscsi_util.py +@@ -105,6 +105,8 @@ def _vscsi_get_scsidevices_by_lsscsi(opt + devname = None + try: + sg = s[-1].split('/dev/')[1] ++ if devname is None: ++ devname = sg + scsi_id = _vscsi_get_scsiid(sg) + except IndexError: + sg = None diff --git a/xen-bug776995-pvscsi-persistent-names.patch b/xen-bug776995-pvscsi-persistent-names.patch new file mode 100644 index 0000000..efe3b33 --- /dev/null +++ b/xen-bug776995-pvscsi-persistent-names.patch @@ -0,0 +1,39 @@ +xend/pvscsi: fix usage of persistant device names for SCSI devices + +Currently the callers of vscsi_get_scsidevices() do not pass a mask +string. This will call "lsscsi -g '[]'", which causes a lsscsi syntax +error. As a result the sysfs parser _vscsi_get_scsidevices() is used. +But this parser is broken and the specified names in the config file are +not found. + +Using a mask '*' if no mask was given will call lsscsi correctly and the +following config is parsed correctly: + +vscsi=['/dev/sg3,0:0:0:0','/dev/disk/by-id/wwn-0x600508b4000cf1c30000800000410000,0:0:0:1'] + +--- + tools/python/xen/util/vscsi_util.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: xen-4.2.0-testing/tools/python/xen/util/vscsi_util.py +=================================================================== +--- xen-4.2.0-testing.orig/tools/python/xen/util/vscsi_util.py ++++ xen-4.2.0-testing/tools/python/xen/util/vscsi_util.py +@@ -148,7 +148,7 @@ def _vscsi_get_scsidevices_by_sysfs(): + return devices + + +-def vscsi_get_scsidevices(mask=""): ++def vscsi_get_scsidevices(mask="*"): + """ get all scsi devices information """ + + devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask) +@@ -277,7 +277,7 @@ def get_scsi_device(pHCTL): + return _make_scsi_record(scsi_info) + return None + +-def get_all_scsi_devices(mask=""): ++def get_all_scsi_devices(mask="*"): + scsi_records = [] + for scsi_info in vscsi_get_scsidevices(mask): + scsi_record = _make_scsi_record(scsi_info) diff --git a/xen-bug776995-pvscsi-sysfs-parser.patch b/xen-bug776995-pvscsi-sysfs-parser.patch new file mode 100644 index 0000000..503266a --- /dev/null +++ b/xen-bug776995-pvscsi-sysfs-parser.patch @@ -0,0 +1,81 @@ +xend/pvscsi: update sysfs parser for Linux 3.0 + +The sysfs parser for /sys/bus/scsi/devices understands only the layout +of kernel version 2.6.16. This looks as follows: + +/sys/bus/scsi/devices/1:0:0:0/block:sda is a symlink to /sys/block/sda/ +/sys/bus/scsi/devices/1:0:0:0/scsi_generic:sg1 is a symlink to /sys/class/scsi_generic/sg1 + +Both directories contain a 'dev' file with the major:minor information. +This patch updates the used regex strings to match also the colon to +make it more robust against possible future changes. + + +In kernel version 3.0 the layout changed: +/sys/bus/scsi/devices/ contains now additional symlinks to directories +such as host1 and target1:0:0. This patch ignores these as they do not +point to the desired scsi devices. They just clutter the devices array. + +The directory layout in '1:0:0:0' changed as well, the 'type:name' +notation was replaced with 'type/name' directories: + +/sys/bus/scsi/devices/1:0:0:0/block/sda/ +/sys/bus/scsi/devices/1:0:0:0/scsi_generic/sg1/ + +Both directories contain a 'dev' file with the major:minor information. +This patch adds additional code to walk the subdir to find the 'dev' +file to make sure the given subdirectory is really the kernel name. + + +In addition this patch makes sure devname is not None. + +--- + tools/python/xen/util/vscsi_util.py | 26 +++++++++++++++++++++----- + 1 file changed, 21 insertions(+), 5 deletions(-) + +Index: xen-4.1.2-testing/tools/python/xen/util/vscsi_util.py +=================================================================== +--- xen-4.1.2-testing.orig/tools/python/xen/util/vscsi_util.py ++++ xen-4.1.2-testing/tools/python/xen/util/vscsi_util.py +@@ -130,20 +130,36 @@ def _vscsi_get_scsidevices_by_sysfs(): + + for dirpath, dirnames, files in os.walk(sysfs_mnt + SYSFS_SCSI_PATH): + for hctl in dirnames: ++ if len(hctl.split(':')) != 4: ++ continue + paths = os.path.join(dirpath, hctl) + devname = None + sg = None + scsi_id = None + for f in os.listdir(paths): + realpath = os.path.realpath(os.path.join(paths, f)) +- if re.match('^block', f) or \ +- re.match('^tape', f) or \ +- re.match('^scsi_changer', f) or \ +- re.match('^onstream_tape', f): ++ if re.match('^block:', f) or \ ++ re.match('^tape:', f) or \ ++ re.match('^scsi_changer:', f) or \ ++ re.match('^onstream_tape:', f): + devname = os.path.basename(realpath) ++ elif f == "block" or \ ++ f == "tape" or \ ++ f == "scsi_changer" or \ ++ f == "onstream_tape": ++ for dir in os.listdir(os.path.join(paths, f)): ++ if os.path.exists(os.path.join(paths, f, dir, "dev")): ++ devname = os.path.basename(dir) + +- if re.match('^scsi_generic', f): ++ if re.match('^scsi_generic:', f): + sg = os.path.basename(realpath) ++ elif f == "scsi_generic": ++ for dir in os.listdir(os.path.join(paths, f)): ++ if os.path.exists(os.path.join(paths, f, dir, "dev")): ++ sg = os.path.basename(dir) ++ if sg: ++ if devname is None: ++ devname = sg + scsi_id = _vscsi_get_scsiid(sg) + devices.append([hctl, devname, sg, scsi_id]) + diff --git a/xen-changeset.diff b/xen-changeset.diff index e3a5cef..0d45a67 100644 --- a/xen-changeset.diff +++ b/xen-changeset.diff @@ -1,13 +1,13 @@ -Index: xen-4.1.2-testing/xen/Makefile +Index: xen-4.2.0-testing/xen/Makefile =================================================================== ---- xen-4.1.2-testing.orig/xen/Makefile -+++ xen-4.1.2-testing/xen/Makefile +--- xen-4.2.0-testing.orig/xen/Makefile ++++ xen-4.2.0-testing/xen/Makefile @@ -1,3 +1,4 @@ +export XEN_CHANGESET = unavailable # This is the correct place to edit the build version. # All other places this is stored (eg. compile.h) should be autogenerated. export XEN_VERSION = 4 -@@ -97,7 +98,7 @@ delete-unfresh-files: +@@ -112,7 +113,7 @@ delete-unfresh-files: @rm -f $@1 $@2 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation. @@ -16,7 +16,7 @@ Index: xen-4.1.2-testing/xen/Makefile @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \ -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \ -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ -@@ -107,10 +108,9 @@ include/xen/compile.h: include/xen/compi +@@ -122,10 +123,9 @@ include/xen/compile.h: include/xen/compi -e 's/@@version@@/$(XEN_VERSION)/g' \ -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \ -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \ diff --git a/xen-config.diff b/xen-config.diff deleted file mode 100644 index 53b99bc..0000000 --- a/xen-config.diff +++ /dev/null @@ -1,92 +0,0 @@ -Index: xen-4.1.3-testing/Config.mk -=================================================================== ---- xen-4.1.3-testing.orig/Config.mk -+++ xen-4.1.3-testing/Config.mk -@@ -178,7 +178,7 @@ endif - # Specify which qemu-dm to use. This may be `ioemu' to use the old - # Mercurial in-tree version, or a local directory, or a git URL. - # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git --CONFIG_QEMU ?= $(QEMU_REMOTE) -+CONFIG_QEMU ?= ioemu-qemu-xen - - QEMU_TAG ?= xen-4.1.3 - # Mon Apr 2 17:55:05 2012 +0100 -@@ -187,7 +187,7 @@ QEMU_TAG ?= xen-4.1.3 - # Optional components - XENSTAT_XENTOP ?= y - VTPM_TOOLS ?= n --LIBXENAPI_BINDINGS ?= n -+LIBXENAPI_BINDINGS ?= y - PYTHON_TOOLS ?= y - OCAML_TOOLS ?= y - CONFIG_MINITERM ?= n -Index: xen-4.1.3-testing/tools/Makefile -=================================================================== ---- xen-4.1.3-testing.orig/tools/Makefile -+++ xen-4.1.3-testing/tools/Makefile -@@ -79,14 +79,16 @@ IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TAR - --interp-prefix=$(CROSS_SYS_ROOT) - endif - --QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; else echo .; fi) --ifneq ($(QEMU_ROOT),.) --export QEMU_ROOT --endif -+#QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo ""; else echo .; fi) -+#ifneq ($(QEMU_ROOT),.) -+#export QEMU_ROOT -+#endif - - ioemu-dir-find: - set -ex; \ - if test -d $(CONFIG_QEMU); then \ -+ rm -f ioemu-dir; \ -+ ln -sf $(CONFIG_QEMU) ioemu-dir; \ - mkdir -p ioemu-dir; \ - else \ - if [ ! -d ioemu-remote ]; then \ -@@ -107,7 +109,7 @@ ioemu-dir-find: - set -e; \ - $(buildmakevars2shellvars); \ - cd ioemu-dir; \ -- $(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS) -+ ./xen-setup $(IOEMU_CONFIGURE_CROSS) - - .PHONY: ioemu-dir-force-update - ioemu-dir-force-update: -Index: xen-4.1.3-testing/tools/libxc/Makefile -=================================================================== ---- xen-4.1.3-testing.orig/tools/libxc/Makefile -+++ xen-4.1.3-testing/tools/libxc/Makefile -@@ -195,7 +195,7 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c - - libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l) - libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so -- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz -lxenctrl $(PTHREAD_LIBS) -+ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz -lxenctrl $(PTHREAD_LIBS) $(call zlib-options,l) - - xenctrl_osdep_ENOSYS.so: $(OSDEP_PIC_OBJS) libxenctrl.so - $(CC) -g $(CFLAGS) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) -lxenctrl -Index: xen-4.1.3-testing/tools/firmware/etherboot/Makefile -=================================================================== ---- xen-4.1.3-testing.orig/tools/firmware/etherboot/Makefile -+++ xen-4.1.3-testing/tools/firmware/etherboot/Makefile -@@ -35,11 +35,13 @@ eb-roms.h: Config - mv -f $@.new $@ - - $T: -- if ! wget -O _$T $(IPXE_TARBALL_URL); then \ -- $(GIT) clone $(IPXE_GIT_URL) $D.git; \ -- (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \ -- $(IPXE_GIT_TAG) | gzip >../_$T); \ -- rm -rf $D.git; \ -+ if test -f /usr/bin/wget; then \ -+ if ! wget -O _$T $(IPXE_TARBALL_URL); then \ -+ $(GIT) clone $(IPXE_GIT_URL) $D.git; \ -+ (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \ -+ $(IPXE_GIT_TAG) | gzip >../_$T); \ -+ rm -rf $D.git; \ -+ fi \ - fi - mv _$T $T - diff --git a/xen-cpupool-xl-config-format.patch b/xen-cpupool-xl-config-format.patch index 2c79c8f..25e1159 100644 --- a/xen-cpupool-xl-config-format.patch +++ b/xen-cpupool-xl-config-format.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xm/cpupool.py +Index: xen-4.2.0-testing/tools/python/xen/xm/cpupool.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/cpupool.py -+++ xen-4.1.2-testing/tools/python/xen/xm/cpupool.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/cpupool.py ++++ xen-4.2.0-testing/tools/python/xen/xm/cpupool.py @@ -157,9 +157,17 @@ def make_cpus_config(cfg_cpus): # ["0,2","1,3"] -> [[0,2],[1,3]] # ["0-3,^1","1-4,^2"] -> [[0,2,3],[1,3,4]] diff --git a/xen-destdir.diff b/xen-destdir.diff index 4ca7bee..0bf62ab 100644 --- a/xen-destdir.diff +++ b/xen-destdir.diff @@ -1,72 +1,39 @@ -Index: xen-4.1.2-testing/docs/Makefile +Index: xen-4.2.0-testing/tools/pygrub/Makefile =================================================================== ---- xen-4.1.2-testing.orig/docs/Makefile -+++ xen-4.1.2-testing/docs/Makefile -@@ -90,7 +90,8 @@ install: all - $(INSTALL_DIR) $(DESTDIR)$(MANDIR) - cp -dR man1 $(DESTDIR)$(MANDIR) - cp -dR man5 $(DESTDIR)$(MANDIR) -- [ ! -d html ] || cp -dR html $(DESTDIR)$(DOCDIR) -+ $(INSTALL_DIR) $(DESTDIR)$(DOCDIR)/html -+ cp -dR html.done/* $(DESTDIR)$(DOCDIR)/html - - pdf/%.pdf: ps/%.ps - $(INSTALL_DIR) $(@D) -@@ -114,3 +115,9 @@ html/%/index.html: src/%.tex - $(LATEX2HTML) -split 0 -show_section_numbers -toc_depth 3 -nonavigation \ - -numbered_footnotes -local_icons -noinfo -math -dir $(@D) \ - $< 1>/dev/null 2>/dev/null -+ rm -rf html.done/$*/ -+ mkdir -p html.done/$*/ -+ cp html/$*/*.html html/$*/*.css html/$*/*.png html.done/$*/ -+ ln -sf $*.html html.done/$*/index.html -+ rm -rf html/ -+ -Index: xen-4.1.2-testing/tools/security/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/security/Makefile -+++ xen-4.1.2-testing/tools/security/Makefile -@@ -60,8 +60,8 @@ install: all $(ACM_CONFIG_FILE) - $(INSTALL_DATA) $(ACM_INST_HTML) $(DESTDIR)$(ACM_SECGEN_HTMLDIR) - $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR) - $(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR) -- $(PYTHON) python/setup.py install $(PYTHON_PREFIX_ARG) \ -- --root="$(DESTDIR)" --force -+ $(PYTHON) python/setup.py install \ -+ --prefix="/usr" --root="$(DESTDIR)" --force - else - .PHONY: all - all: -Index: xen-4.1.2-testing/tools/pygrub/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/pygrub/Makefile -+++ xen-4.1.2-testing/tools/pygrub/Makefile -@@ -11,7 +11,7 @@ build: +--- xen-4.2.0-testing.orig/tools/pygrub/Makefile ++++ xen-4.2.0-testing/tools/pygrub/Makefile +@@ -11,12 +11,12 @@ build: .PHONY: install install: all CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \ -- $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force -+ --prefix="/usr" --root="$(DESTDIR)" --force - $(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(BINDIR)/pygrub +- $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \ ++ --prefix="/usr" --root="$(DESTDIR)" \ + --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot + set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ + "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ +- ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ ++ $(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(BINDIR)/pygrub; \ + fi -Index: xen-4.1.2-testing/tools/python/Makefile + .PHONY: clean +Index: xen-4.2.0-testing/tools/python/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/python/Makefile -+++ xen-4.1.2-testing/tools/python/Makefile -@@ -65,7 +65,7 @@ refresh-po: $(POTFILE) +--- xen-4.2.0-testing.orig/tools/python/Makefile ++++ xen-4.2.0-testing/tools/python/Makefile +@@ -21,7 +21,7 @@ build: genpath genwrap.py $(XEN_ROOT)/to .PHONY: install - install: install-messages install-dtd + install: install-dtd CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \ - $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force + --prefix="/usr" --root="$(DESTDIR)" --force install-dtd: all $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/xen -Index: xen-4.1.2-testing/tools/xenstore/Makefile +Index: xen-4.2.0-testing/tools/xenstore/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/Makefile -+++ xen-4.1.2-testing/tools/xenstore/Makefile +--- xen-4.2.0-testing.orig/tools/xenstore/Makefile ++++ xen-4.2.0-testing/tools/xenstore/Makefile @@ -10,6 +10,7 @@ CFLAGS += $(CFLAGS_libxenctrl) CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod @@ -75,7 +42,7 @@ Index: xen-4.1.2-testing/tools/xenstore/Makefile XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o -@@ -32,7 +33,7 @@ ALL_TARGETS = libxenstore.so libxenstore +@@ -38,7 +39,7 @@ endif all: $(ALL_TARGETS) .PHONY: clients @@ -84,7 +51,7 @@ Index: xen-4.1.2-testing/tools/xenstore/Makefile ifeq ($(CONFIG_SunOS),y) xenstored_probes.h: xenstored_probes.d -@@ -52,6 +53,9 @@ xenstored: $(XENSTORED_OBJS) +@@ -66,6 +67,9 @@ xenstored.a: $(XENSTORED_OBJS) $(CLIENTS): xenstore ln -f xenstore $@ @@ -92,26 +59,26 @@ Index: xen-4.1.2-testing/tools/xenstore/Makefile + ln -f xenstore $@ + xenstore: xenstore_client.o $(LIBXENSTORE) - $(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS) -@@ -79,7 +83,7 @@ clean: +@@ -93,7 +97,7 @@ clean: rm -f *.a *.o *.opic *.so* xenstored_probes.h rm -f xenstored xs_random xs_stress xs_crashme - rm -f xs_tdb_dump xenstore-control + rm -f xs_tdb_dump xenstore-control init-xenstore-domain - rm -f xenstore $(CLIENTS) -+ rm -f $(CLIENTS) $(CLIENTS_DOMU) ++ rm -f xenstore $(CLIENTS) $(CLIENTS_DOMU) $(RM) $(DEPS) .PHONY: TAGS -@@ -95,6 +99,7 @@ install: all - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) +@@ -110,6 +114,7 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xenstore-compat + $(INSTALL_DIR) $(DESTDIR)/bin $(INSTALL_DIR) $(DESTDIR)/var/run/xenstored $(INSTALL_DIR) $(DESTDIR)/var/lib/xenstored $(INSTALL_PROG) xenstored $(DESTDIR)$(SBINDIR) -@@ -103,6 +108,9 @@ install: all +@@ -118,6 +123,9 @@ install: all set -e ; for c in $(CLIENTS) ; do \ ln -f $(DESTDIR)$(BINDIR)/xenstore $(DESTDIR)$(BINDIR)/$${c} ; \ done @@ -121,10 +88,10 @@ Index: xen-4.1.2-testing/tools/xenstore/Makefile $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR) -Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile +Index: xen-4.2.0-testing/tools/hotplug/Linux/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/Makefile -+++ xen-4.1.2-testing/tools/hotplug/Linux/Makefile +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/Makefile ++++ xen-4.2.0-testing/tools/hotplug/Linux/Makefile @@ -41,18 +41,6 @@ endif UDEV_RULES_DIR = $(CONFIG_DIR)/udev UDEV_RULES = xen-backend.rules xend.rules @@ -167,3 +134,39 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR) .PHONY: install-scripts +Index: xen-4.2.0-testing/tools/firmware/etherboot/Makefile +=================================================================== +--- xen-4.2.0-testing.orig/tools/firmware/etherboot/Makefile ++++ xen-4.2.0-testing/tools/firmware/etherboot/Makefile +@@ -28,12 +28,12 @@ all: $(ROMS) + $(MAKE) -C $D/src bin/$(*F).rom + + $T: +- if ! wget -O _$T $(IPXE_TARBALL_URL); then \ +- $(GIT) clone $(IPXE_GIT_URL) $D.git; \ +- (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \ +- $(IPXE_GIT_TAG) | gzip >../_$T); \ +- rm -rf $D.git; \ +- fi ++ #if ! wget -O _$T $(IPXE_TARBALL_URL); then \ ++ # $(GIT) clone $(IPXE_GIT_URL) $D.git; \ ++ # (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \ ++ # $(IPXE_GIT_TAG) | gzip >../_$T); \ ++ # rm -rf $D.git; \ ++ #fi + mv _$T $T + + $D/src/arch/i386/Makefile: $T Config +Index: xen-4.2.0-testing/tools/Makefile +=================================================================== +--- xen-4.2.0-testing.orig/tools/Makefile ++++ xen-4.2.0-testing/tools/Makefile +@@ -187,7 +187,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-fi + source=.; \ + fi; \ + cd qemu-xen-dir; \ +- $$source/configure --enable-xen --target-list=i386-softmmu \ ++ CFLAGS= $$source/configure --enable-xen --target-list=i386-softmmu \ + --source-path=$$source \ + --extra-cflags="-I$(XEN_ROOT)/tools/include \ + -I$(XEN_ROOT)/tools/libxc \ diff --git a/xen-disable-qemu-monitor.diff b/xen-disable-qemu-monitor.diff index ae98422..e1b2ab0 100644 --- a/xen-disable-qemu-monitor.diff +++ b/xen-disable-qemu-monitor.diff @@ -5,10 +5,10 @@ the "sendkey" command, among other useful things), remove all console commands that can read/write dom0's state. -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/monitor.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/monitor.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/monitor.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/monitor.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/monitor.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/monitor.c @@ -1497,6 +1497,7 @@ static const term_cmd_t term_cmds[] = { "device|all", "commit changes to the disk images (if -snapshot is used) or backing files" }, { "info", "s?", do_info, diff --git a/xen-domUloader.diff b/xen-domUloader.diff index eefcf4f..b70e777 100644 --- a/xen-domUloader.diff +++ b/xen-domUloader.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/server/DevController.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/server/DevController.py -+++ xen-4.1.2-testing/tools/python/xen/xend/server/DevController.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/server/DevController.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py @@ -592,6 +592,31 @@ class DevController: return (Missing, None) @@ -34,10 +34,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/server/DevController.py def backendPath(self, backdom, devid): """Construct backend path given the backend domain and device id. -Index: xen-4.1.2-testing/tools/python/xen/xend/XendBootloader.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendBootloader.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendBootloader.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendBootloader.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendBootloader.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendBootloader.py @@ -12,7 +12,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # @@ -64,7 +64,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendBootloader.py + raise VmError(msg) + + avail = False -+ for i in xrange(1, 100): ++ for i in xrange(1, 500): + avail = os.access(disk, os.R_OK) + if avail: + break @@ -75,10 +75,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendBootloader.py log.error(msg) raise VmError(msg) -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -2333,6 +2333,10 @@ class XendDomainInfo: deviceClass, config = self.info['devices'].get(dev_uuid) self._waitForDevice(deviceClass, config['devid']) @@ -90,7 +90,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py def _waitForDevice_destroy(self, deviceClass, devid, backpath): return self.getDeviceController(deviceClass).waitForDevice_destroy( devid, backpath) -@@ -3278,7 +3282,8 @@ class XendDomainInfo: +@@ -3283,7 +3287,8 @@ class XendDomainInfo: from xen.xend import XendDomain dom0 = XendDomain.instance().privilegedDomain() mounted_vbd_uuid = dom0.create_vbd(vbd, disk); @@ -100,7 +100,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py fn = BOOTLOADER_LOOPBACK_DEVICE try: -@@ -3288,10 +3293,10 @@ class XendDomainInfo: +@@ -3293,10 +3298,10 @@ class XendDomainInfo: if mounted: log.info("Unmounting %s from %s." % (fn, BOOTLOADER_LOOPBACK_DEVICE)) diff --git a/xen-fixme-doc.diff b/xen-fixme-doc.diff index 0b31a5f..6227469 100644 --- a/xen-fixme-doc.diff +++ b/xen-fixme-doc.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 +Index: xen-4.2.0-testing/docs/man/xmdomain.cfg.pod.5 =================================================================== ---- xen-4.1.2-testing.orig/docs/man/xmdomain.cfg.pod.5 -+++ xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 +--- xen-4.2.0-testing.orig/docs/man/xmdomain.cfg.pod.5 ++++ xen-4.2.0-testing/docs/man/xmdomain.cfg.pod.5 @@ -335,16 +335,10 @@ at hda1, which is the root filesystem. =item I @@ -19,11 +19,11 @@ Index: xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 =back =head1 SEE ALSO -Index: xen-4.1.2-testing/docs/man/xm.pod.1 +Index: xen-4.2.0-testing/docs/man/xm.pod.1 =================================================================== ---- xen-4.1.2-testing.orig/docs/man/xm.pod.1 -+++ xen-4.1.2-testing/docs/man/xm.pod.1 -@@ -295,7 +295,8 @@ scheduling by the Xen hypervisor. +--- xen-4.2.0-testing.orig/docs/man/xm.pod.1 ++++ xen-4.2.0-testing/docs/man/xm.pod.1 +@@ -299,7 +299,8 @@ scheduling by the Xen hypervisor. =item B @@ -33,7 +33,7 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 =item B -@@ -308,8 +309,6 @@ restart on crash. See L f +@@ -312,8 +313,6 @@ restart on crash. See L f The domain is in process of dying, but hasn't completely shutdown or crashed. @@ -42,7 +42,7 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 =back B -@@ -733,8 +732,6 @@ Xen ships with a number of domain schedu +@@ -737,8 +736,6 @@ Xen ships with a number of domain schedu time with the B parameter on the Xen command line. By default B is used for scheduling. @@ -51,7 +51,7 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 =over 4 =item B [ B<-d> I [ B<-w>[B<=>I] | B<-c>[B<=>I] ] ] -@@ -784,8 +781,6 @@ The normal EDF scheduling usage in nanos +@@ -788,8 +785,6 @@ The normal EDF scheduling usage in nanos The normal EDF scheduling usage in nanoseconds @@ -60,7 +60,7 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 =item I Scaled period if domain is doing heavy I/O. -@@ -935,9 +930,6 @@ the default setting in xend-config.sxp f +@@ -939,9 +934,6 @@ the default setting in xend-config.sxp f Passes the specified IP Address to the adapter on creation. @@ -70,7 +70,7 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 =item BI The MAC address that the domain will see on its Ethernet device. If -@@ -963,9 +955,6 @@ Removes the network device from the doma +@@ -967,9 +959,6 @@ Removes the network device from the doma I is the virtual interface device number within the domain (i.e. the 3 in vif22.3). @@ -80,13 +80,3 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 =item B [B<-l>|B<--long>]> I List virtual network interfaces for a domain. The returned output is -@@ -988,9 +977,6 @@ formatted as a list or as an S-Expressio - - The Virtual Network interfaces for Xen. - --FIXME: This needs a lot more explanation, or it needs to be ripped --out entirely. -- - =over 4 - - =item B [B<-l>|B<--long>] diff --git a/xen-hvm-default-bridge.diff b/xen-hvm-default-bridge.diff index c2e74b5..638ac77 100644 --- a/xen-hvm-default-bridge.diff +++ b/xen-hvm-default-bridge.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/net.h +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/net.h =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/net.h -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/net.h +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/net.h ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/net.h @@ -107,8 +107,8 @@ void net_host_device_add(const char *dev void net_host_device_remove(int vlan_id, const char *device); @@ -13,10 +13,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/net.h #endif #ifdef __sun__ #define SMBD_COMMAND "/usr/sfw/sbin/smbd" -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/net.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/net.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/net.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/net.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/net.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/net.c @@ -1759,9 +1759,10 @@ int net_client_init(const char *device, } if (get_param_value(script_arg, sizeof(script_arg), "scriptarg", p) == 0 && @@ -30,10 +30,10 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/net.c } } else #endif -Index: xen-4.1.2-testing/tools/python/xen/xend/image.py +Index: xen-4.2.0-testing/tools/python/xen/xend/image.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/image.py -+++ xen-4.1.2-testing/tools/python/xen/xend/image.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/image.py ++++ xen-4.2.0-testing/tools/python/xen/xend/image.py @@ -912,11 +912,13 @@ class HVMImageHandler(ImageHandler): mac = devinfo.get('mac') if mac is None: @@ -48,13 +48,13 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/image.py + if bridge: + net += ",bridge=%s" % bridge + ret.append(net) - vifname = devinfo.get('vifname') - if vifname: - vifname = "tap-" + vifname -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/i386-dm/qemu-ifup-Linux + vifname = "vif%d.%d-emu" % (self.vm.getDomid(), nics-1) + ret.append("-net") + if osdep.tapif_script is not None: +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/i386-dm/qemu-ifup-Linux =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/i386-dm/qemu-ifup-Linux -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/i386-dm/qemu-ifup-Linux +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/i386-dm/qemu-ifup-Linux ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/i386-dm/qemu-ifup-Linux @@ -1,36 +1,22 @@ #!/bin/sh diff --git a/xen-hvm-default-pae.diff b/xen-hvm-default-pae.diff index be5841e..94d69c6 100644 --- a/xen-hvm-default-pae.diff +++ b/xen-hvm-default-pae.diff @@ -1,10 +1,10 @@ PAE must be on for 64-on-64 to work at all. -Index: xen-4.1.2-testing/tools/python/xen/xend/image.py +Index: xen-4.2.0-testing/tools/python/xen/xend/image.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/image.py -+++ xen-4.1.2-testing/tools/python/xen/xend/image.py -@@ -1030,7 +1030,7 @@ class X86_HVM_ImageHandler(HVMImageHandl +--- xen-4.2.0-testing.orig/tools/python/xen/xend/image.py ++++ xen-4.2.0-testing/tools/python/xen/xend/image.py +@@ -1038,7 +1038,7 @@ class X86_HVM_ImageHandler(HVMImageHandl def configure(self, vmConfig): HVMImageHandler.configure(self, vmConfig) diff --git a/xen-ioemu-hvm-pv-support.diff b/xen-ioemu-hvm-pv-support.diff index eb6f7df..4152667 100644 --- a/xen-ioemu-hvm-pv-support.diff +++ b/xen-ioemu-hvm-pv-support.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_platform.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c @@ -30,6 +30,8 @@ #include "qemu-xen.h" #include "net.h" diff --git a/xen-max-free-mem.diff b/xen-max-free-mem.diff index b8995eb..2c17d03 100644 --- a/xen-max-free-mem.diff +++ b/xen-max-free-mem.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendNode.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendNode.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendNode.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendNode.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendNode.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendNode.py @@ -949,11 +949,35 @@ class XendNode: info['cpu_mhz'] = info['cpu_khz'] / 1000 @@ -51,10 +51,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendNode.py ] if show_numa != 0: -Index: xen-4.1.2-testing/tools/python/xen/xend/balloon.py +Index: xen-4.2.0-testing/tools/python/xen/xend/balloon.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/balloon.py -+++ xen-4.1.2-testing/tools/python/xen/xend/balloon.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/balloon.py ++++ xen-4.2.0-testing/tools/python/xen/xend/balloon.py @@ -43,6 +43,8 @@ SLEEP_TIME_GROWTH = 0.1 # label actually shown in the PROC_XEN_BALLOON file. #labels = { 'current' : 'Current allocation', @@ -88,10 +88,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/balloon.py def free(need_mem, dominfo): """Balloon out memory from the privileged domain so that there is the specified required amount (in KiB) free. -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -1459,6 +1459,27 @@ class XendDomainInfo: pci_conf = self.info['devices'][dev_uuid][1] return map(pci_dict_to_bdf_str, pci_conf['devs']) @@ -120,10 +120,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py def setMemoryTarget(self, target): """Set the memory target of this domain. @param target: In MiB. -Index: xen-4.1.2-testing/tools/python/xen/xend/server/SrvDomain.py +Index: xen-4.2.0-testing/tools/python/xen/xend/server/SrvDomain.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/server/SrvDomain.py -+++ xen-4.1.2-testing/tools/python/xen/xend/server/SrvDomain.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/server/SrvDomain.py ++++ xen-4.2.0-testing/tools/python/xen/xend/server/SrvDomain.py @@ -187,7 +187,7 @@ class SrvDomain(SrvDir): diff --git a/xen-minimum-restart-time.patch b/xen-minimum-restart-time.patch index d7e873e..2de06a0 100644 --- a/xen-minimum-restart-time.patch +++ b/xen-minimum-restart-time.patch @@ -1,10 +1,10 @@ References: bnc#661298 -Index: xen-4.1.2-testing/tools/python/xen/xend/XendConstants.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendConstants.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendConstants.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendConstants.py -@@ -92,7 +92,7 @@ DOM_STATES_OLD = [ +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendConstants.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendConstants.py +@@ -94,7 +94,7 @@ DOM_STATES_OLD = [ SHUTDOWN_TIMEOUT = (60.0 * 5) """Minimum time between domain restarts in seconds.""" diff --git a/xen-no-dummy-nfs-ip.diff b/xen-no-dummy-nfs-ip.diff index 899b66f..b22b2bc 100644 --- a/xen-no-dummy-nfs-ip.diff +++ b/xen-no-dummy-nfs-ip.diff @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/python/xen/xm/create.py +Index: xen-4.2.0-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.1.2-testing/tools/python/xen/xm/create.py -@@ -1337,9 +1337,8 @@ def preprocess_access_control(vals): +--- xen-4.2.0-testing.orig/tools/python/xen/xm/create.py ++++ xen-4.2.0-testing/tools/python/xen/xm/create.py +@@ -1342,9 +1342,8 @@ def preprocess_access_control(vals): def preprocess_ip(vals): if vals.ip or vals.dhcp != 'off': diff --git a/xen-paths.diff b/xen-paths.diff index 864a8a9..448fe18 100644 --- a/xen-paths.diff +++ b/xen-paths.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xm/create.py +Index: xen-4.2.0-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.1.2-testing/tools/python/xen/xm/create.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/create.py ++++ xen-4.2.0-testing/tools/python/xen/xm/create.py @@ -73,7 +73,7 @@ gopts.opt('quiet', short='q', use="Quiet.") @@ -11,11 +11,11 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/create.py use="Search path for configuration scripts. " "The value of PATH is a colon-separated directory list.") -Index: xen-4.1.2-testing/docs/man/xm.pod.1 +Index: xen-4.2.0-testing/docs/man/xm.pod.1 =================================================================== ---- xen-4.1.2-testing.orig/docs/man/xm.pod.1 -+++ xen-4.1.2-testing/docs/man/xm.pod.1 -@@ -75,7 +75,7 @@ in the config file. See L +--- xen-4.2.0-testing.orig/docs/man/xm.pod.1 ++++ xen-4.2.0-testing/docs/man/xm.pod.1 +@@ -79,7 +79,7 @@ in the config file. See L format, and possible options used in either the configfile or for I. I can either be an absolute path to a file, or a relative @@ -24,7 +24,7 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 Create will return B as the domain is started. This B mean the guest OS in the domain has actually booted, or is -@@ -156,7 +156,7 @@ B +@@ -160,7 +160,7 @@ B xm create Fedora4 @@ -33,10 +33,10 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 soon as it is run. =item I -Index: xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 +Index: xen-4.2.0-testing/docs/man/xmdomain.cfg.pod.5 =================================================================== ---- xen-4.1.2-testing.orig/docs/man/xmdomain.cfg.pod.5 -+++ xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 +--- xen-4.2.0-testing.orig/docs/man/xmdomain.cfg.pod.5 ++++ xen-4.2.0-testing/docs/man/xmdomain.cfg.pod.5 @@ -4,9 +4,9 @@ xmdomain.cfg - xm domain config file for =head1 SYNOPSIS diff --git a/xen-qemu-iscsi-fix.patch b/xen-qemu-iscsi-fix.patch index e15d01f..f888eff 100644 --- a/xen-qemu-iscsi-fix.patch +++ b/xen-qemu-iscsi-fix.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c +--- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c @@ -449,7 +449,7 @@ void xenstore_parse_domain_config(int hv char *buf = NULL; char *fpath = NULL, *bpath = NULL, *btype = NULL, @@ -65,12 +65,12 @@ Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c format = &bdrv_host_device; else format = &bdrv_raw; -+ } else if (!strcmp(drv,"iscsi")) { -+ format = &bdrv_raw; -+ } else if (!strcmp(drv,"npiv")) { -+ format = &bdrv_raw; -+ } else if (!strcmp(drv,"dmmd")) { -+ format = &bdrv_raw; ++ } else if (!strcmp(drv,"iscsi")) { ++ format = &bdrv_raw; ++ } else if (!strcmp(drv,"npiv")) { ++ format = &bdrv_raw; ++ } else if (!strcmp(drv,"dmmd")) { ++ format = &bdrv_raw; } else { format = bdrv_find_format(drv); if (!format) { diff --git a/xen-rpmoptflags.diff b/xen-rpmoptflags.diff index 73aafb2..666d3ee 100644 --- a/xen-rpmoptflags.diff +++ b/xen-rpmoptflags.diff @@ -1,20 +1,20 @@ -Index: xen-4.1.2-testing/tools/blktap/drivers/Makefile +Index: xen-4.2.0-testing/tools/blktap/drivers/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/drivers/Makefile -+++ xen-4.1.2-testing/tools/blktap/drivers/Makefile -@@ -6,7 +6,6 @@ QCOW_UTIL = img2qcow qcow2raw qcow-cr - LIBAIO_DIR = ../../libaio/src - MEMSHR_DIR = ../../memshr +--- xen-4.2.0-testing.orig/tools/blktap/drivers/Makefile ++++ xen-4.2.0-testing/tools/blktap/drivers/Makefile +@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk + IBIN = blktapctrl tapdisk + QCOW_UTIL = img2qcow qcow2raw qcow-create -CFLAGS += -Werror CFLAGS += -Wno-unused CFLAGS += -I../lib CFLAGS += $(CFLAGS_libxenctrl) -Index: xen-4.1.2-testing/Config.mk +Index: xen-4.2.0-testing/Config.mk =================================================================== ---- xen-4.1.2-testing.orig/Config.mk -+++ xen-4.1.2-testing/Config.mk -@@ -14,7 +14,7 @@ SHELL ?= /bin/sh +--- xen-4.2.0-testing.orig/Config.mk ++++ xen-4.2.0-testing/Config.mk +@@ -24,7 +24,7 @@ SHELL ?= /bin/sh # Tools to run on system hosting the build HOSTCC = gcc diff --git a/xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch b/xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch deleted file mode 100644 index 817c815..0000000 --- a/xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch +++ /dev/null @@ -1,110 +0,0 @@ -# HG changeset patch -# Parent aa0d678fece208975984e8e59ca223c07fc50c06 -tools/libxc: send page-in requests in batches in linux_privcmd_map_foreign_bulk - -One of the bottlenecks with foreign page-in request is the poor retry -handling in linux_privcmd_map_foreign_bulk(). It sends one request per -paged gfn at a time and it waits until the gfn is accessible. This -causes long delays in mmap requests from qemu-dm and xc_save. - -Instead of sending one request at a time, walk the entire gfn list and -send batches of mmap requests. They will eventually end up in the pagers -request ring (if it has room again), and will fill up this ring so that -in turn the pager can also process page-in in batches. - -Signed-off-by: Olaf Hering - ---- - tools/libxc/xc_linux_osdep.c | 72 ++++++++++++++++++++++++++++++++++--------- - 1 file changed, 57 insertions(+), 15 deletions(-) - -Index: xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_linux_osdep.c -+++ xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c -@@ -167,6 +167,59 @@ static void *linux_privcmd_map_foreign_b - return addr; - } - -+/* -+ * Retry mmap of paged gfns in batches -+ * retuns < 0 on fatal error -+ * returns 0 if all gfns left paging state -+ * returns > 0 if some gfns are still in paging state -+ * -+ * Walk all gfns are assemble blocks of gfns in paging state. -+ * This will keep the request ring full and avoids delays. -+ */ -+static int retry_paged(int fd, uint32_t dom, void *addr, -+ const xen_pfn_t *arr, int *err, unsigned int num) -+{ -+ privcmd_mmapbatch_v2_t ioctlx; -+ int rc, paged = 0, i = 0; -+ -+ do -+ { -+ /* Skip gfns not in paging state */ -+ if ( err[i] != -ENOENT ) -+ { -+ i++; -+ continue; -+ } -+ -+ paged++; -+ -+ /* At least one gfn is still in paging state */ -+ ioctlx.num = 1; -+ ioctlx.dom = dom; -+ ioctlx.addr = (unsigned long)addr + ((unsigned long)i< 0 ); - } - /* Command was not recognized, use fall back */ - else if ( rc < 0 && errno == EINVAL && (int)num > 0 ) diff --git a/xen-utils-0.1.tar.bz2 b/xen-utils-0.1.tar.bz2 index 96576f8..abbd04a 100644 --- a/xen-utils-0.1.tar.bz2 +++ b/xen-utils-0.1.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a4144a91d26495e1307de8e03c3a077f2f23a38e794bd601f92a20de759bdb6 -size 8368 +oid sha256:ee37e7f7b3e0a7cf4a38d18965c8fe6c23221a28e05033a4f3e6b021a3bd32d0 +size 8377 diff --git a/xen-warnings-unused.diff b/xen-warnings-unused.diff index b553892..d274cd6 100644 --- a/xen-warnings-unused.diff +++ b/xen-warnings-unused.diff @@ -1,36 +1,8 @@ ---- a/tools/libxc/xc_tmem.c -+++ b/tools/libxc/xc_tmem.c -@@ -390,7 +390,8 @@ static int xc_tmem_restore_new_pool( - - int xc_tmem_restore(xc_interface *xch, int dom, int io_fd) - { -- uint32_t save_max_pools, save_version; -+ uint32_t save_version; -+ uint32_t __attribute__((__unused__)) save_max_pools; - uint32_t this_max_pools, this_version; - uint32_t pool_id; - uint32_t minusone; ---- a/tools/libxc/xc_domain_restore.c -+++ b/tools/libxc/xc_domain_restore.c -@@ -1098,7 +1098,6 @@ int xc_domain_restore(xc_interface *xch, - int vcpuextstate = 0; - uint32_t vcpuextstate_size = 0; - unsigned long mfn, pfn; -- unsigned int prev_pc; - int nraces = 0; - - /* The new domain's shared-info frame number. */ -@@ -1262,7 +1261,6 @@ int xc_domain_restore(xc_interface *xch, - * Now simply read each saved frame into its new machine frame. - * We uncanonicalise page tables as we go. - */ -- prev_pc = 0; - - n = m = 0; - loadpages: ---- a/tools/misc/gtraceview.c -+++ b/tools/misc/gtraceview.c -@@ -622,7 +622,8 @@ void crt_init(void) +Index: xen-4.2.0-testing/tools/misc/gtraceview.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/misc/gtraceview.c ++++ xen-4.2.0-testing/tools/misc/gtraceview.c +@@ -621,7 +621,8 @@ void crt_init(void) void nr_addch(int nr, int ch) { int i; @@ -40,8 +12,10 @@ getyx(stdscr, y, x); for (i = 0; i < nr; i++) { if (x == COLS-1) ---- a/tools/xcutils/xc_restore.c -+++ b/tools/xcutils/xc_restore.c +Index: xen-4.2.0-testing/tools/xcutils/xc_restore.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/xcutils/xc_restore.c ++++ xen-4.2.0-testing/tools/xcutils/xc_restore.c @@ -19,7 +19,8 @@ int main(int argc, char **argv) { @@ -52,8 +26,10 @@ xc_interface *xch; int io_fd, ret; int superpages; ---- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c -+++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c +Index: xen-4.2.0-testing/tools/firmware/rombios/32bit/tcgbios/tcgbios.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/firmware/rombios/32bit/tcgbios/tcgbios.c ++++ xen-4.2.0-testing/tools/firmware/rombios/32bit/tcgbios/tcgbios.c @@ -1064,7 +1064,7 @@ uint32_t HashLogEvent32(struct hlei *hle uint32_t rc = 0; uint16_t size; @@ -63,8 +39,10 @@ uint32_t hashdataptr; uint32_t hashdatalen; ---- a/tools/console/client/main.c -+++ b/tools/console/client/main.c +Index: xen-4.2.0-testing/tools/console/client/main.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/console/client/main.c ++++ xen-4.2.0-testing/tools/console/client/main.c @@ -277,7 +277,8 @@ int main(int argc, char **argv) }; @@ -75,9 +53,11 @@ struct xs_handle *xs; char *end; console_type type = CONSOLE_INVAL; ---- a/tools/xenstat/xentop/xentop.c -+++ b/tools/xenstat/xentop/xentop.c -@@ -272,7 +272,8 @@ static void fail(const char *str) +Index: xen-4.2.0-testing/tools/xenstat/xentop/xentop.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/xenstat/xentop/xentop.c ++++ xen-4.2.0-testing/tools/xenstat/xentop/xentop.c +@@ -278,7 +278,8 @@ static void fail(const char *str) /* Return the row containing the cursor. */ static int current_row(void) { @@ -87,7 +67,7 @@ getyx(stdscr, y, x); return y; } -@@ -280,7 +281,8 @@ static int current_row(void) +@@ -286,7 +287,8 @@ static int current_row(void) /* Return the number of lines on the screen. */ static int lines(void) { @@ -97,9 +77,11 @@ getmaxyx(stdscr, y, x); return y; } ---- a/tools/libxl/libxlu_cfg.c -+++ b/tools/libxl/libxlu_cfg.c -@@ -348,7 +348,7 @@ char *xlu__cfgl_dequote(CfgParseContext +Index: xen-4.2.0-testing/tools/libxl/libxlu_cfg.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/libxl/libxlu_cfg.c ++++ xen-4.2.0-testing/tools/libxl/libxlu_cfg.c +@@ -406,7 +406,7 @@ char *xlu__cfgl_dequote(CfgParseContext #define NUMERIC_CHAR(minlen,maxlen,base,basetext) do{ \ char numbuf[(maxlen)+1], *ep; \ @@ -108,38 +90,11 @@ \ strncpy(numbuf,p,(maxlen)); \ numbuf[(maxlen)]= 0; \ ---- a/tools/libxl/libxl.c -+++ b/tools/libxl/libxl.c -@@ -221,7 +221,7 @@ int libxl_domain_rename(libxl_ctx *ctx, - int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid) - { - libxl__gc gc = LIBXL_INIT_GC(ctx); -- int rc = 0; -+ int __attribute__((__unused__)) rc = 0; - - if (libxl__domain_is_hvm(ctx, domid)) { - LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Called domain_resume on " -@@ -1303,7 +1303,7 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx - { - libxl__gc gc = LIBXL_INIT_GC(ctx); - char *dompath, *nic_path_fe; -- char **l, **list; -+ char **l; - char *val, *tok; - unsigned int nb_nics, i; - libxl_nicinfo *res, *nics; -@@ -1311,7 +1311,7 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx - dompath = libxl__xs_get_dompath(&gc, domid); - if (!dompath) - goto err; -- list = l = libxl__xs_directory(&gc, XBT_NULL, -+ l = libxl__xs_directory(&gc, XBT_NULL, - libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics); - if (!l) - goto err; ---- a/tools/libxl/libxl_pci.c -+++ b/tools/libxl/libxl_pci.c -@@ -240,7 +240,7 @@ static int libxl_create_pci_backend(libx +Index: xen-4.2.0-testing/tools/libxl/libxl_pci.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/libxl/libxl_pci.c ++++ xen-4.2.0-testing/tools/libxl/libxl_pci.c +@@ -71,7 +71,7 @@ int libxl__create_pci_backend(libxl__gc flexarray_t *front = NULL; flexarray_t *back = NULL; libxl__device device; @@ -148,7 +103,7 @@ front = flexarray_make(16, 1); if (!front) -@@ -249,8 +249,6 @@ static int libxl_create_pci_backend(libx +@@ -80,8 +80,6 @@ int libxl__create_pci_backend(libxl__gc if (!back) goto out; @@ -157,45 +112,22 @@ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Creating pci backend"); /* add pci device */ ---- a/tools/libxl/libxl_dom.c -+++ b/tools/libxl/libxl_dom.c -@@ -268,14 +268,13 @@ int libxl__build_hvm(libxl_ctx *ctx, uin - libxl_domain_build_info *info, libxl_domain_build_state *state) - { - libxl__gc gc = LIBXL_INIT_GC(ctx); -- int ret, rc = ERROR_INVAL; -+ int ret; - - if (info->kernel.mapped) { - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "libxl__build_hvm kernel cannot be mmapped"); - goto out; - } - -- rc = ERROR_FAIL; - ret = xc_hvm_build_target_mem( - ctx->xch, - domid, -@@ -293,7 +292,6 @@ int libxl__build_hvm(libxl_ctx *ctx, uin +Index: xen-4.2.0-testing/tools/libxl/libxl_dom.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/libxl/libxl_dom.c ++++ xen-4.2.0-testing/tools/libxl/libxl_dom.c +@@ -565,7 +565,6 @@ int libxl__build_hvm(libxl__gc *gc, uint LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm build set params failed"); goto out; } - rc = 0; out: - libxl__free_all(&gc); - return 0; ---- a/tools/libxl/libxl_utils.c -+++ b/tools/libxl/libxl_utils.c -@@ -531,7 +531,7 @@ int libxl_devid_to_device_disk(libxl_ctx - libxl__gc gc = LIBXL_INIT_GC(ctx); - char *val; - char *dompath, *diskpath, *be_path; -- unsigned int devid_n; -+ unsigned int __attribute__((__unused__)) devid_n; - int rc = ERROR_INVAL; - - devid_n = libxl__device_disk_dev_number(devid); ---- a/tools/debugger/gdbsx/gx/gx_comm.c -+++ b/tools/debugger/gdbsx/gx/gx_comm.c + return rc; + } +Index: xen-4.2.0-testing/tools/debugger/gdbsx/gx/gx_comm.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/debugger/gdbsx/gx/gx_comm.c ++++ xen-4.2.0-testing/tools/debugger/gdbsx/gx/gx_comm.c @@ -163,7 +163,7 @@ readchar(void) static char buf[BUFSIZ]; static int bufcnt = 0; @@ -205,9 +137,11 @@ if (bufcnt-- > 0) return *bufp++ & 0x7f; ---- a/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c -+++ b/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c -@@ -820,7 +820,7 @@ static int create_suspend_thread(checkpo +Index: xen-4.2.0-testing/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c ++++ xen-4.2.0-testing/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c +@@ -836,7 +836,7 @@ static int create_suspend_thread(checkpo static void stop_suspend_thread(checkpoint_state* s) { @@ -216,8 +150,10 @@ s->done = 1; ---- a/tools/python/xen/lowlevel/netlink/libnetlink.c -+++ b/tools/python/xen/lowlevel/netlink/libnetlink.c +Index: xen-4.2.0-testing/tools/python/xen/lowlevel/netlink/libnetlink.c +=================================================================== +--- xen-4.2.0-testing.orig/tools/python/xen/lowlevel/netlink/libnetlink.c ++++ xen-4.2.0-testing/tools/python/xen/lowlevel/netlink/libnetlink.c @@ -433,7 +433,8 @@ int rtnl_from_file(FILE *rtnl, rtnl_filt nladdr.nl_groups = 0; @@ -228,29 +164,20 @@ int l; status = fread(&buf, 1, sizeof(*h), rtnl); ---- a/xen/arch/x86/msi.c -+++ b/xen/arch/x86/msi.c -@@ -799,7 +799,7 @@ static void __pci_disable_msi(struct msi - { - struct pci_dev *dev; - int pos; -- u16 control; -+ u16 __attribute__((__unused__)) control; - u8 bus, slot, func; - - dev = entry->dev; ---- a/xen/common/cpupool.c -+++ b/xen/common/cpupool.c -@@ -356,7 +356,7 @@ int cpupool_add_domain(struct domain *d, +Index: xen-4.2.0-testing/xen/common/cpupool.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/common/cpupool.c ++++ xen-4.2.0-testing/xen/common/cpupool.c +@@ -371,7 +371,7 @@ int cpupool_add_domain(struct domain *d, { struct cpupool *c; - int rc = 1; + int rc; - int n_dom = 0; + int __attribute__((__unused__)) n_dom = 0; if ( poolid == CPUPOOLID_NONE ) return 0; -@@ -380,8 +380,8 @@ int cpupool_add_domain(struct domain *d, +@@ -399,8 +399,8 @@ int cpupool_add_domain(struct domain *d, */ void cpupool_rm_domain(struct domain *d) { @@ -261,20 +188,11 @@ if ( d->cpupool == NULL ) return; ---- a/xen/common/grant_table.c -+++ b/xen/common/grant_table.c -@@ -769,7 +769,7 @@ __gnttab_unmap_common( - struct domain *ld, *rd; - struct active_grant_entry *act; - s16 rc = 0; -- u32 old_pin; -+ u32 __attribute__((__unused__)) old_pin; - - ld = current->domain; - ---- a/xen/common/kexec.c -+++ b/xen/common/kexec.c -@@ -573,7 +573,8 @@ static int kexec_exec(XEN_GUEST_HANDLE(v +Index: xen-4.2.0-testing/xen/common/kexec.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/common/kexec.c ++++ xen-4.2.0-testing/xen/common/kexec.c +@@ -817,7 +817,8 @@ static int kexec_exec(XEN_GUEST_HANDLE(v { xen_kexec_exec_t exec; xen_kexec_image_t *image; @@ -284,52 +202,11 @@ if ( unlikely(copy_from_guest(&exec, uarg, 1)) ) return -EFAULT; ---- a/xen/drivers/passthrough/vtd/intremap.c -+++ b/xen/drivers/passthrough/vtd/intremap.c -@@ -367,7 +367,7 @@ unsigned int io_apic_read_remap_rte( - unsigned int ioapic_pin = (reg - 0x10) / 2; - int index; - struct IO_xAPIC_route_entry old_rte = { 0 }; -- struct IO_APIC_route_remap_entry *remap_rte; -+ struct IO_APIC_route_remap_entry __attribute__((__unused__)) *remap_rte; - int rte_upper = (reg & 1) ? 1 : 0; - struct iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic)); - struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); -@@ -870,7 +870,7 @@ int iommu_enable_x2apic_IR(void) - - for_each_drhd_unit ( drhd ) - { -- struct qi_ctrl *qi_ctrl = NULL; -+ struct qi_ctrl __attribute__((__unused__)) *qi_ctrl = NULL; - - iommu = drhd->iommu; - qi_ctrl = iommu_qi_ctrl(iommu); ---- a/xen/common/sched_credit2.c -+++ b/xen/common/sched_credit2.c -@@ -1854,7 +1854,8 @@ static void deactivate_runqueue(struct c - - static void init_pcpu(const struct scheduler *ops, int cpu) - { -- int rqi, old_rqi, flags; -+ int rqi, flags; -+ int __attribute__((__unused__)) old_rqi; - struct csched_private *prv = CSCHED_PRIV(ops); - struct csched_runqueue_data *rqd; - spinlock_t *old_lock; ---- a/xen/common/unlzo.c -+++ b/xen/common/unlzo.c -@@ -68,7 +68,7 @@ static int INIT parse_header(u8 *input, - { - int l; - u8 *parse = input; -- u8 level = 0; -+ u8 __attribute__((__unused__)) level = 0; - u16 version; - - /* read magic: 9 first bits */ ---- a/xen/arch/x86/time.c -+++ b/xen/arch/x86/time.c -@@ -1009,7 +1009,8 @@ static void local_time_calibration(void) +Index: xen-4.2.0-testing/xen/arch/x86/time.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/time.c ++++ xen-4.2.0-testing/xen/arch/x86/time.c +@@ -1012,7 +1012,8 @@ static void local_time_calibration(void) * System timestamps, extrapolated from local and master oscillators, * taken during this calibration and the previous calibration. */ @@ -339,20 +216,11 @@ s_time_t prev_master_stime, curr_master_stime; /* TSC timestamps taken during this calibration and prev calibration. */ ---- a/xen/arch/x86/cpu/amd.c -+++ b/xen/arch/x86/cpu/amd.c -@@ -394,7 +394,7 @@ static void __devinit init_amd(struct cp - { - u32 l, h; - int mbytes = num_physpages >> (20-PAGE_SHIFT); -- int r; -+ int __attribute__((__unused__)) r; - - #ifdef CONFIG_SMP - unsigned long long value; ---- a/xen/arch/x86/mm/p2m.c -+++ b/xen/arch/x86/mm/p2m.c -@@ -2341,7 +2341,7 @@ p2m_remove_page(struct p2m_domain *p2m, +Index: xen-4.2.0-testing/xen/arch/x86/mm/p2m.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/mm/p2m.c ++++ xen-4.2.0-testing/xen/arch/x86/mm/p2m.c +@@ -483,7 +483,7 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned int page_order) { unsigned long i; @@ -361,61 +229,11 @@ p2m_type_t t; p2m_access_t a; -@@ -2410,7 +2410,7 @@ guest_physmap_mark_populate_on_demand(st - struct p2m_domain *p2m = p2m_get_hostp2m(d); - unsigned long i; - p2m_type_t ot; -- mfn_t omfn; -+ mfn_t __attribute__((__unused__)) omfn; - int pod_count = 0; - int rc = 0; - ---- a/xen/arch/x86/hvm/emulate.c -+++ b/xen/arch/x86/hvm/emulate.c -@@ -59,7 +59,7 @@ static int hvmemul_do_io( - ioreq_t *p = get_ioreq(curr); - unsigned long ram_gfn = paddr_to_pfn(ram_gpa); - p2m_type_t p2mt; -- mfn_t ram_mfn; -+ mfn_t __attribute__((__unused__)) ram_mfn; - int rc; - - /* Check for paged out page */ ---- a/xen/arch/x86/hvm/hvm.c -+++ b/xen/arch/x86/hvm/hvm.c -@@ -286,7 +286,8 @@ void hvm_migrate_timers(struct vcpu *v) - - void hvm_migrate_pirqs(struct vcpu *v) - { -- int pirq, irq; -+ int pirq; -+ int __attribute__((__unused__)) irq; - struct irq_desc *desc; - struct domain *d = v->domain; - struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; -@@ -3722,7 +3723,7 @@ long do_hvm_op(unsigned long op, XEN_GUE - { - p2m_type_t t; - p2m_type_t nt; -- mfn_t mfn; -+ mfn_t __attribute__((__unused__)) mfn; - mfn = gfn_to_mfn_unshare(p2m, pfn, &t, 0); - if ( p2m_is_paging(t) ) - { ---- a/xen/arch/x86/acpi/cpu_idle.c -+++ b/xen/arch/x86/acpi/cpu_idle.c -@@ -279,7 +279,7 @@ static void acpi_processor_ffh_cstate_en - - static void acpi_idle_do_entry(struct acpi_processor_cx *cx) - { -- int unused; -+ int __attribute__((__unused__)) unused; - - switch ( cx->entry_method ) - { ---- a/xen/arch/x86/cpu/intel_cacheinfo.c -+++ b/xen/arch/x86/cpu/intel_cacheinfo.c -@@ -170,7 +170,8 @@ unsigned int __cpuinit init_intel_cachei +Index: xen-4.2.0-testing/xen/arch/x86/cpu/intel_cacheinfo.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/cpu/intel_cacheinfo.c ++++ xen-4.2.0-testing/xen/arch/x86/cpu/intel_cacheinfo.c +@@ -169,7 +169,8 @@ unsigned int __cpuinit init_intel_cachei unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */ unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ @@ -425,20 +243,11 @@ if (c->cpuid_level > 3) { static int is_initialized; ---- a/xen/arch/x86/mm/mem_sharing.c -+++ b/xen/arch/x86/mm/mem_sharing.c -@@ -375,7 +375,7 @@ int mem_sharing_debug_gfn(struct domain - { - p2m_type_t p2mt; - mfn_t mfn; -- struct page_info *page; -+ struct page_info __attribute__((__unused__)) *page; - - mfn = gfn_to_mfn(p2m_get_hostp2m(d), gfn, &p2mt); - page = mfn_to_page(mfn); ---- a/xen/arch/x86/hvm/viridian.c -+++ b/xen/arch/x86/hvm/viridian.c -@@ -270,7 +270,7 @@ int rdmsr_viridian_regs(uint32_t idx, ui +Index: xen-4.2.0-testing/xen/arch/x86/hvm/viridian.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/hvm/viridian.c ++++ xen-4.2.0-testing/xen/arch/x86/hvm/viridian.c +@@ -317,7 +317,7 @@ int rdmsr_viridian_regs(uint32_t idx, ui int viridian_hypercall(struct cpu_user_regs *regs) { int mode = hvm_guest_x86_mode(current); @@ -447,9 +256,11 @@ uint16_t status = HV_STATUS_SUCCESS; union hypercall_input { ---- a/xen/arch/x86/mm.c -+++ b/xen/arch/x86/mm.c -@@ -4943,7 +4943,7 @@ static int ptwr_emulated_update( +Index: xen-4.2.0-testing/xen/arch/x86/mm.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/mm.c ++++ xen-4.2.0-testing/xen/arch/x86/mm.c +@@ -4969,7 +4969,7 @@ static int ptwr_emulated_update( { unsigned long mfn; unsigned long unaligned_addr = addr; @@ -458,57 +269,11 @@ l1_pgentry_t pte, ol1e, nl1e, *pl1e; struct vcpu *v = current; struct domain *d = v->domain; ---- a/xen/arch/x86/x86_64/mm.c -+++ b/xen/arch/x86/x86_64/mm.c -@@ -436,7 +436,8 @@ void destroy_m2p_mapping(struct mem_hota - static int setup_compat_m2p_table(struct mem_hotadd_info *info) - { - unsigned long i, va, smap, emap, rwva, epfn = info->epfn; -- unsigned int n, memflags; -+ unsigned int n; -+ unsigned int __attribute__((__unused__)) memflags; - l3_pgentry_t *l3_ro_mpt = NULL; - l2_pgentry_t *l2_ro_mpt = NULL; - struct page_info *l1_pg; ---- a/xen/arch/x86/cpu/mcheck/mce.c -+++ b/xen/arch/x86/cpu/mcheck/mce.c -@@ -151,7 +151,6 @@ static struct mcinfo_bank *mca_init_bank - struct mc_info *mi, int bank) - { - struct mcinfo_bank *mib; -- uint64_t addr=0, misc = 0; - - if (!mi) - return NULL; -@@ -170,7 +169,6 @@ static struct mcinfo_bank *mca_init_bank - mib->common.size = sizeof (struct mcinfo_bank); - mib->mc_bank = bank; - -- addr = misc = 0; - if (mib->mc_status & MCi_STATUS_MISCV) - mib->mc_misc = mca_rdmsr(MSR_IA32_MCx_MISC(bank)); - -@@ -281,7 +279,7 @@ mctelem_cookie_t mcheck_mca_logout(enum - recover = (mc_recoverable_scan)? 1: 0; - - for (i = 0; i < 32 && i < nr_mce_banks; i++) { -- struct mcinfo_bank *mib; /* on stack */ -+ struct mcinfo_bank __attribute__((__unused__)) *mib; /* on stack */ - - /* Skip bank if corresponding bit in bankmask is clear */ - if (!mcabanks_test(i, bankmask)) -@@ -1215,7 +1213,7 @@ static void x86_mc_msrinject(void *data) - { - struct xen_mc_msrinject *mci = data; - struct mcinfo_msr *msr; -- struct cpuinfo_x86 *c; -+ struct cpuinfo_x86 __attribute__((__unused__)) *c; - uint64_t hwcr = 0; - int intpose; - int i; ---- a/xen/common/tmem.c -+++ b/xen/common/tmem.c -@@ -1351,7 +1351,8 @@ obj_unlock: +Index: xen-4.2.0-testing/xen/common/tmem.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/common/tmem.c ++++ xen-4.2.0-testing/xen/common/tmem.c +@@ -1348,7 +1348,8 @@ obj_unlock: static int tmem_evict(void) { client_t *client = tmh_client_from_current(); @@ -518,7 +283,7 @@ obj_t *obj; pool_t *pool; int ret = 0; -@@ -1588,7 +1589,8 @@ static NOINLINE int do_tmem_put(pool_t * +@@ -1585,7 +1586,8 @@ static NOINLINE int do_tmem_put(pool_t * pagesize_t pfn_offset, pagesize_t len, void *cva) { obj_t *obj = NULL, *objfound = NULL, *objnew = NULL; @@ -528,9 +293,11 @@ client_t *client = pool->client; int ret = client->frozen ? -EFROZEN : -ENOMEM; ---- a/xen/common/tmem_xen.c -+++ b/xen/common/tmem_xen.c -@@ -177,7 +177,7 @@ EXPORT int tmh_copy_from_client(pfp_t *p +Index: xen-4.2.0-testing/xen/common/tmem_xen.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/common/tmem_xen.c ++++ xen-4.2.0-testing/xen/common/tmem_xen.c +@@ -181,7 +181,7 @@ EXPORT int tmh_copy_from_client(pfp_t *p EXPORT int tmh_compress_from_client(tmem_cli_mfn_t cmfn, void **out_va, size_t *out_len, void *cli_va) { @@ -539,7 +306,7 @@ unsigned char *dmem = this_cpu(dstmem); unsigned char *wmem = this_cpu(workmem); pfp_t *cli_pfp = NULL; -@@ -237,7 +237,7 @@ EXPORT int tmh_decompress_to_client(tmem +@@ -241,7 +241,7 @@ EXPORT int tmh_decompress_to_client(tmem pfp_t *cli_pfp = NULL; size_t out_len = PAGE_SIZE; bool_t tmemc = cli_va != NULL; /* if true, cli_va is control-op buffer */ @@ -548,7 +315,7 @@ if ( !tmemc ) { -@@ -366,15 +366,17 @@ static void tmh_persistent_pool_page_put +@@ -370,15 +370,17 @@ static void tmh_persistent_pool_page_put EXPORT tmh_client_t *tmh_client_init(cli_id_t cli_id) { tmh_client_t *tmh; @@ -567,20 +334,11 @@ tmh->persistent_pool = xmem_pool_create(name, tmh_persistent_pool_page_get, tmh_persistent_pool_page_put, PAGE_SIZE, 0, PAGE_SIZE); if ( tmh->persistent_pool == NULL ) ---- a/xen/arch/x86/cpu/mcheck/vmce.c -+++ b/xen/arch/x86/cpu/mcheck/vmce.c -@@ -625,7 +625,7 @@ int is_vmce_ready(struct mcinfo_bank *ba - */ - int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn) - { -- mfn_t r_mfn; -+ mfn_t __attribute__((__unused__)) r_mfn; - struct p2m_domain *p2m; - p2m_type_t pt; - ---- a/xen/arch/x86/mm/shadow/multi.c -+++ b/xen/arch/x86/mm/shadow/multi.c -@@ -124,7 +124,7 @@ set_shadow_status(struct vcpu *v, mfn_t +Index: xen-4.2.0-testing/xen/arch/x86/mm/shadow/multi.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/mm/shadow/multi.c ++++ xen-4.2.0-testing/xen/arch/x86/mm/shadow/multi.c +@@ -124,7 +124,7 @@ set_shadow_status(struct vcpu *v, mfn_t /* Put a shadow into the hash table */ { struct domain *d = v->domain; @@ -589,7 +347,7 @@ SHADOW_PRINTK("d=%d, v=%d, gmfn=%05lx, type=%08x, smfn=%05lx\n", d->domain_id, v->vcpu_id, mfn_x(gmfn), -@@ -4447,7 +4447,7 @@ sh_update_cr3(struct vcpu *v, int do_loc +@@ -4438,7 +4438,7 @@ sh_update_cr3(struct vcpu *v, int do_loc int sh_rm_write_access_from_sl1p(struct vcpu *v, mfn_t gmfn, mfn_t smfn, unsigned long off) { @@ -598,9 +356,11 @@ shadow_l1e_t *sl1p, sl1e; struct page_info *sp; ---- a/xen/arch/x86/domain_build.c -+++ b/xen/arch/x86/domain_build.c -@@ -378,8 +378,7 @@ int __init construct_dom0( +Index: xen-4.2.0-testing/xen/arch/x86/domain_build.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/domain_build.c ++++ xen-4.2.0-testing/xen/arch/x86/domain_build.c +@@ -377,8 +377,7 @@ int __init construct_dom0( return rc; /* compatibility check */ @@ -610,9 +370,11 @@ machine = elf_uval(&elf, elf.ehdr, e_machine); switch (CONFIG_PAGING_LEVELS) { case 3: /* x86_32p */ ---- a/xen/arch/x86/traps.c -+++ b/xen/arch/x86/traps.c -@@ -1858,7 +1858,11 @@ static int emulate_privileged_op(struct +Index: xen-4.2.0-testing/xen/arch/x86/traps.c +=================================================================== +--- xen-4.2.0-testing.orig/xen/arch/x86/traps.c ++++ xen-4.2.0-testing/xen/arch/x86/traps.c +@@ -1910,7 +1910,11 @@ static int emulate_privileged_op(struct struct vcpu *v = current; unsigned long *reg, eip = regs->eip; u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0, lock = 0, rex = 0; diff --git a/xen-warnings.diff b/xen-warnings.diff index 485359e..785cc00 100644 --- a/xen-warnings.diff +++ b/xen-warnings.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/misc/miniterm/miniterm.c +Index: xen-4.2.0-testing/tools/misc/miniterm/miniterm.c =================================================================== ---- xen-4.1.2-testing.orig/tools/misc/miniterm/miniterm.c -+++ xen-4.1.2-testing/tools/misc/miniterm/miniterm.c +--- xen-4.2.0-testing.orig/tools/misc/miniterm/miniterm.c ++++ xen-4.2.0-testing/tools/misc/miniterm/miniterm.c @@ -157,7 +157,7 @@ int main(int argc, char **argv) case 0: close(1); /* stdout not needed */ @@ -35,10 +35,10 @@ Index: xen-4.1.2-testing/tools/misc/miniterm/miniterm.c break; } -Index: xen-4.1.2-testing/tools/libxc/xc_dom_elfloader.c +Index: xen-4.2.0-testing/tools/libxc/xc_dom_elfloader.c =================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_dom_elfloader.c -+++ xen-4.1.2-testing/tools/libxc/xc_dom_elfloader.c +--- xen-4.2.0-testing.orig/tools/libxc/xc_dom_elfloader.c ++++ xen-4.2.0-testing/tools/libxc/xc_dom_elfloader.c @@ -228,8 +228,9 @@ static int xc_dom_load_elf_symtab(struct if ( load ) @@ -50,24 +50,24 @@ Index: xen-4.1.2-testing/tools/libxc/xc_dom_elfloader.c elf_section_start(elf, shdr2), size); } -Index: xen-4.1.2-testing/tools/xenstore/Makefile +Index: xen-4.2.0-testing/tools/xenstore/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/Makefile -+++ xen-4.1.2-testing/tools/xenstore/Makefile +--- xen-4.2.0-testing.orig/tools/xenstore/Makefile ++++ xen-4.2.0-testing/tools/xenstore/Makefile @@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk MAJOR = 3.0 - MINOR = 0 + MINOR = 1 -CFLAGS += -Werror +CFLAGS += -Werror -fno-strict-aliasing CFLAGS += -I. CFLAGS += $(CFLAGS_libxenctrl) -Index: xen-4.1.2-testing/tools/xenstore/xenstored_core.c +Index: xen-4.2.0-testing/tools/xenstore/xenstored_core.c =================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/xenstored_core.c -+++ xen-4.1.2-testing/tools/xenstore/xenstored_core.c -@@ -77,8 +77,8 @@ static void check_store(void); +--- xen-4.2.0-testing.orig/tools/xenstore/xenstored_core.c ++++ xen-4.2.0-testing/tools/xenstore/xenstored_core.c +@@ -79,8 +79,8 @@ static void check_store(void); int quota_nb_entry_per_domain = 1000; int quota_nb_watch_per_domain = 128; @@ -78,7 +78,7 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstored_core.c TDB_CONTEXT *tdb_context(struct connection *conn) { -@@ -130,7 +130,7 @@ void trace(const char *fmt, ...) +@@ -134,7 +134,7 @@ void trace(const char *fmt, ...) va_list arglist; char *str; char sbuf[1024]; @@ -87,7 +87,7 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstored_core.c if (tracefd < 0) return; -@@ -200,7 +200,7 @@ void trace_destroy(const void *data, con +@@ -204,7 +204,7 @@ void trace_destroy(const void *data, con static void trigger_reopen_log(int signal __attribute__((unused))) { char c = 'A'; @@ -96,7 +96,7 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstored_core.c dummy = write(reopen_log_pipe[1], &c, 1); } -@@ -1786,10 +1786,10 @@ int main(int argc, char *argv[]) +@@ -1807,10 +1807,10 @@ int main(int argc, char *argv[]) remove_local = false; break; case 'S': @@ -109,11 +109,11 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstored_core.c break; case 'T': tracefile = optarg; -Index: xen-4.1.2-testing/tools/xenstore/xenstored_domain.c +Index: xen-4.2.0-testing/tools/xenstore/xenstored_domain.c =================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/xenstored_domain.c -+++ xen-4.1.2-testing/tools/xenstore/xenstored_domain.c -@@ -213,7 +213,7 @@ void handle_event(void) +--- xen-4.2.0-testing.orig/tools/xenstore/xenstored_domain.c ++++ xen-4.2.0-testing/tools/xenstore/xenstored_domain.c +@@ -241,7 +241,7 @@ void handle_event(void) { evtchn_port_t port; @@ -122,7 +122,7 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstored_domain.c barf_perror("Failed to read from event fd"); if (port == virq_port) -@@ -562,7 +562,7 @@ static int dom0_init(void) +@@ -603,7 +603,7 @@ static int dom0_init(void) struct domain *dom0; port = xenbus_evtchn(); @@ -131,10 +131,10 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstored_domain.c return -1; dom0 = new_domain(NULL, 0, port); -Index: xen-4.1.2-testing/tools/xenstore/xenstored_transaction.c +Index: xen-4.2.0-testing/tools/xenstore/xenstored_transaction.c =================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/xenstored_transaction.c -+++ xen-4.1.2-testing/tools/xenstore/xenstored_transaction.c +--- xen-4.2.0-testing.orig/tools/xenstore/xenstored_transaction.c ++++ xen-4.2.0-testing/tools/xenstore/xenstored_transaction.c @@ -82,7 +82,7 @@ struct transaction struct list_head changed_domains; }; @@ -144,10 +144,10 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstored_transaction.c static unsigned int generation; /* Return tdb context to use for this connection. */ -Index: xen-4.1.2-testing/tools/xenstore/xenstore_client.c +Index: xen-4.2.0-testing/tools/xenstore/xenstore_client.c =================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/xenstore_client.c -+++ xen-4.1.2-testing/tools/xenstore/xenstore_client.c +--- xen-4.2.0-testing.orig/tools/xenstore/xenstore_client.c ++++ xen-4.2.0-testing/tools/xenstore/xenstore_client.c @@ -255,7 +255,7 @@ do_chmod(char *path, struct xs_permissio char **xsval = xs_directory(xsh, xth, path, &xsval_n); @@ -157,10 +157,10 @@ Index: xen-4.1.2-testing/tools/xenstore/xenstore_client.c for (i = 0; i < xsval_n; i++) { snprintf(buf, MAX_PATH_LEN, "%s/%s", path, xsval[i]); -Index: xen-4.1.2-testing/tools/libxen/src/xen_common.c +Index: xen-4.2.0-testing/tools/libxen/src/xen_common.c =================================================================== ---- xen-4.1.2-testing.orig/tools/libxen/src/xen_common.c -+++ xen-4.1.2-testing/tools/libxen/src/xen_common.c +--- xen-4.2.0-testing.orig/tools/libxen/src/xen_common.c ++++ xen-4.2.0-testing/tools/libxen/src/xen_common.c @@ -1057,6 +1057,8 @@ static size_t size_of_member(const abstr default: assert(false); @@ -179,10 +179,10 @@ Index: xen-4.1.2-testing/tools/libxen/src/xen_common.c } -Index: xen-4.1.2-testing/tools/blktap2/drivers/block-remus.c +Index: xen-4.2.0-testing/tools/blktap2/drivers/block-remus.c =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap2/drivers/block-remus.c -+++ xen-4.1.2-testing/tools/blktap2/drivers/block-remus.c +--- xen-4.2.0-testing.orig/tools/blktap2/drivers/block-remus.c ++++ xen-4.2.0-testing/tools/blktap2/drivers/block-remus.c @@ -1636,7 +1636,7 @@ static int tdremus_open(td_driver_t *dri td_flag_t flags) { @@ -192,10 +192,10 @@ Index: xen-4.1.2-testing/tools/blktap2/drivers/block-remus.c RPRINTF("opening %s\n", name); -Index: xen-4.1.2-testing/tools/blktap/lib/blktaplib.h +Index: xen-4.2.0-testing/tools/blktap/lib/blktaplib.h =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-4.1.2-testing/tools/blktap/lib/blktaplib.h +--- xen-4.2.0-testing.orig/tools/blktap/lib/blktaplib.h ++++ xen-4.2.0-testing/tools/blktap/lib/blktaplib.h @@ -196,6 +196,7 @@ typedef struct msg_pid { } msg_pid_t; @@ -204,10 +204,10 @@ Index: xen-4.1.2-testing/tools/blktap/lib/blktaplib.h #define WRITE 1 /*Control Messages between manager and tapdev*/ -Index: xen-4.1.2-testing/tools/blktap2/include/blktaplib.h +Index: xen-4.2.0-testing/tools/blktap2/include/blktaplib.h =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap2/include/blktaplib.h -+++ xen-4.1.2-testing/tools/blktap2/include/blktaplib.h +--- xen-4.2.0-testing.orig/tools/blktap2/include/blktaplib.h ++++ xen-4.2.0-testing/tools/blktap2/include/blktaplib.h @@ -190,6 +190,7 @@ typedef struct msg_lock { } msg_lock_t; @@ -216,11 +216,11 @@ Index: xen-4.1.2-testing/tools/blktap2/include/blktaplib.h #define WRITE 1 /*Control Messages between manager and tapdev*/ -Index: xen-4.1.2-testing/tools/blktap/lib/Makefile +Index: xen-4.2.0-testing/tools/blktap/lib/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap/lib/Makefile -+++ xen-4.1.2-testing/tools/blktap/lib/Makefile -@@ -28,6 +28,8 @@ OBJS_PIC = $(SRCS:.c=.opic) +--- xen-4.2.0-testing.orig/tools/blktap/lib/Makefile ++++ xen-4.2.0-testing/tools/blktap/lib/Makefile +@@ -24,6 +24,8 @@ OBJS_PIC = $(SRCS:.c=.opic) IBINS := LIB = libblktap.a libblktap.so.$(MAJOR).$(MINOR) @@ -229,7 +229,7 @@ Index: xen-4.1.2-testing/tools/blktap/lib/Makefile .PHONY: all all: $(LIB) -@@ -36,7 +38,8 @@ all: $(LIB) +@@ -32,7 +34,8 @@ all: $(LIB) install: all $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR) @@ -239,12 +239,12 @@ Index: xen-4.1.2-testing/tools/blktap/lib/Makefile ln -sf libblktap.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libblktap.so.$(MAJOR) ln -sf libblktap.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libblktap.so $(INSTALL_DATA) blktaplib.h $(DESTDIR)$(INCLUDEDIR) -Index: xen-4.1.2-testing/tools/blktap2/vhd/lib/Makefile +Index: xen-4.2.0-testing/tools/blktap2/vhd/lib/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/blktap2/vhd/lib/Makefile -+++ xen-4.1.2-testing/tools/blktap2/vhd/lib/Makefile -@@ -49,6 +49,8 @@ LIB-OBJS = $(patsubst %.c,%.o,$( - LIB-OBJS += $(LVM-UTIL-OBJ) +--- xen-4.2.0-testing.orig/tools/blktap2/vhd/lib/Makefile ++++ xen-4.2.0-testing/tools/blktap2/vhd/lib/Makefile +@@ -52,6 +52,8 @@ LIB-OBJS += $(LVM-UTIL-OBJ) + LIB-PICOBJS = $(patsubst %.o,%.opic,$(LIB-OBJS)) LIBVHD = libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) +LIBVHD_SO = libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) @@ -252,11 +252,12 @@ Index: xen-4.1.2-testing/tools/blktap2/vhd/lib/Makefile all: build -@@ -63,7 +65,8 @@ libvhd.a: $(LIB-OBJS) +@@ -68,8 +70,8 @@ libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR install: all $(INSTALL_DIR) -p $(DESTDIR)$(INST-DIR) -- $(INSTALL_PROG) $(LIBVHD) $(DESTDIR)$(INST-DIR) +- $(INSTALL_PROG) libvhd.a $(DESTDIR)$(INST-DIR) +- $(INSTALL_PROG) libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR) + $(INSTALL_PROG) $(LIBVHD_SO) $(DESTDIR)$(INST-DIR) + $(INSTALL_DATA) $(LIBVHD_AR) $(DESTDIR)$(INST-DIR) ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR)/libvhd.so.$(LIBVHD-MAJOR) diff --git a/xen-xm-top-needs-root.diff b/xen-xm-top-needs-root.diff index 6332eb2..763fe5e 100644 --- a/xen-xm-top-needs-root.diff +++ b/xen-xm-top-needs-root.diff @@ -1,10 +1,10 @@ From: Charles Coffing Upstream: no -Index: xen-4.1.2-testing/tools/python/xen/xm/main.py +Index: xen-4.2.0-testing/tools/python/xen/xm/main.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.1.2-testing/tools/python/xen/xm/main.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/main.py ++++ xen-4.2.0-testing/tools/python/xen/xm/main.py @@ -2201,6 +2201,10 @@ def xm_debug_keys(args): def xm_top(args): arg_check(args, "top", 0) diff --git a/xen-xmexample-vti.diff b/xen-xmexample-vti.diff index 22bb6a2..5e52a60 100644 --- a/xen-xmexample-vti.diff +++ b/xen-xmexample-vti.diff @@ -1,12 +1,12 @@ -Index: xen-4.1.2-testing/tools/examples/Makefile +Index: xen-4.2.0-testing/tools/examples/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/Makefile -+++ xen-4.1.2-testing/tools/examples/Makefile +--- xen-4.2.0-testing.orig/tools/examples/Makefile ++++ xen-4.2.0-testing/tools/examples/Makefile @@ -18,7 +18,6 @@ XEN_CONFIGS += xmexample.hvm XEN_CONFIGS += xmexample.hvm-stubdom XEN_CONFIGS += xmexample.pv-grub XEN_CONFIGS += xmexample.nbd -XEN_CONFIGS += xmexample.vti + XEN_CONFIGS += xlexample.hvm + XEN_CONFIGS += xlexample.pvlinux XEN_CONFIGS += xend-pci-quirks.sxp - XEN_CONFIGS += xend-pci-permissive.sxp - XEN_CONFIGS += xl.conf diff --git a/xen-xmexample.diff b/xen-xmexample.diff index 8a2c907..8774af4 100644 --- a/xen-xmexample.diff +++ b/xen-xmexample.diff @@ -1,9 +1,9 @@ Change various example paths in the config files to match SUSE. -Index: xen-4.1.2-testing/tools/examples/xmexample1 +Index: xen-4.2.0-testing/tools/examples/xmexample1 =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample1 -+++ xen-4.1.2-testing/tools/examples/xmexample1 +--- xen-4.2.0-testing.orig/tools/examples/xmexample1 ++++ xen-4.2.0-testing/tools/examples/xmexample1 @@ -7,11 +7,17 @@ #============================================================================ @@ -61,10 +61,10 @@ Index: xen-4.1.2-testing/tools/examples/xmexample1 #---------------------------------------------------------------------------- # Configure the behaviour when a domain exits. There are three 'reasons' -Index: xen-4.1.2-testing/tools/examples/xmexample2 +Index: xen-4.2.0-testing/tools/examples/xmexample2 =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample2 -+++ xen-4.1.2-testing/tools/examples/xmexample2 +--- xen-4.2.0-testing.orig/tools/examples/xmexample2 ++++ xen-4.2.0-testing/tools/examples/xmexample2 @@ -35,11 +35,17 @@ xm_vars.var('vmid', xm_vars.check() @@ -122,10 +122,10 @@ Index: xen-4.1.2-testing/tools/examples/xmexample2 #---------------------------------------------------------------------------- # Configure the behaviour when a domain exits. There are three 'reasons' -Index: xen-4.1.2-testing/tools/examples/xmexample3 +Index: xen-4.2.0-testing/tools/examples/xmexample3 =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample3 -+++ xen-4.1.2-testing/tools/examples/xmexample3 +--- xen-4.2.0-testing.orig/tools/examples/xmexample3 ++++ xen-4.2.0-testing/tools/examples/xmexample3 @@ -35,11 +35,17 @@ xm_vars.var('vmid', xm_vars.check() @@ -148,10 +148,10 @@ Index: xen-4.1.2-testing/tools/examples/xmexample3 # The domain build function. Default is 'linux'. #builder='linux' -Index: xen-4.1.2-testing/tools/examples/xmexample.hvm +Index: xen-4.2.0-testing/tools/examples/xmexample.hvm =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample.hvm -+++ xen-4.1.2-testing/tools/examples/xmexample.hvm +--- xen-4.2.0-testing.orig/tools/examples/xmexample.hvm ++++ xen-4.2.0-testing/tools/examples/xmexample.hvm @@ -64,11 +64,26 @@ name = "ExampleHVMDomain" #cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 #cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 @@ -193,10 +193,10 @@ Index: xen-4.1.2-testing/tools/examples/xmexample.hvm #---------------------------------------------------------------------------- # Configure the behaviour when a domain exits. There are three 'reasons' -Index: xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 +Index: xen-4.2.0-testing/docs/man/xmdomain.cfg.pod.5 =================================================================== ---- xen-4.1.2-testing.orig/docs/man/xmdomain.cfg.pod.5 -+++ xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 +--- xen-4.2.0-testing.orig/docs/man/xmdomain.cfg.pod.5 ++++ xen-4.2.0-testing/docs/man/xmdomain.cfg.pod.5 @@ -38,13 +38,13 @@ file. The kernel image for the domain. The format of the parameter is the @@ -232,11 +232,11 @@ Index: xen-4.1.2-testing/docs/man/xmdomain.cfg.pod.5 at hda1, which is the root filesystem. =item I -Index: xen-4.1.2-testing/docs/man/xm.pod.1 +Index: xen-4.2.0-testing/docs/man/xm.pod.1 =================================================================== ---- xen-4.1.2-testing.orig/docs/man/xm.pod.1 -+++ xen-4.1.2-testing/docs/man/xm.pod.1 -@@ -161,8 +161,8 @@ soon as it is run. +--- xen-4.2.0-testing.orig/docs/man/xm.pod.1 ++++ xen-4.2.0-testing/docs/man/xm.pod.1 +@@ -165,8 +165,8 @@ soon as it is run. =item I @@ -247,10 +247,10 @@ Index: xen-4.1.2-testing/docs/man/xm.pod.1 name=ramdisk vif='' vcpus=1 \ memory=64 root=/dev/ram0 -Index: xen-4.1.2-testing/tools/examples/xmexample.hvm-stubdom +Index: xen-4.2.0-testing/tools/examples/xmexample.hvm-stubdom =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample.hvm-stubdom -+++ xen-4.1.2-testing/tools/examples/xmexample.hvm-stubdom +--- xen-4.2.0-testing.orig/tools/examples/xmexample.hvm-stubdom ++++ xen-4.2.0-testing/tools/examples/xmexample.hvm-stubdom @@ -55,11 +55,26 @@ name = "xmexample.hvm" #cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 #cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 @@ -283,10 +283,10 @@ Index: xen-4.1.2-testing/tools/examples/xmexample.hvm-stubdom #---------------------------------------------------------------------------- # Define the disk devices you want the domain to have access to, and -Index: xen-4.1.2-testing/tools/examples/xmexample.pv-grub +Index: xen-4.2.0-testing/tools/examples/xmexample.pv-grub =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample.pv-grub -+++ xen-4.1.2-testing/tools/examples/xmexample.pv-grub +--- xen-4.2.0-testing.orig/tools/examples/xmexample.pv-grub ++++ xen-4.2.0-testing/tools/examples/xmexample.pv-grub @@ -53,11 +53,11 @@ name = "ExampleDomain" # # or optionally override backend, bridge, ip, mac, script, type, or vifname: @@ -301,10 +301,10 @@ Index: xen-4.1.2-testing/tools/examples/xmexample.pv-grub vif = [ '' ] -Index: xen-4.1.2-testing/tools/examples/xmexample.vti +Index: xen-4.2.0-testing/tools/examples/xmexample.vti =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample.vti -+++ xen-4.1.2-testing/tools/examples/xmexample.vti +--- xen-4.2.0-testing.orig/tools/examples/xmexample.vti ++++ xen-4.2.0-testing/tools/examples/xmexample.vti @@ -40,11 +40,26 @@ name = "ExampleVTIDomain" # In Windows OS, smaller size shows better performance. #vhpt = 23 diff --git a/xen.changes b/xen.changes index 6096468..6bad49f 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,50 @@ +------------------------------------------------------------------- +Mon Sep 17 09:02:37 MDT 2012 - carnold@novell.com + +- Update to Xen 4.2.0 FCS c/s 25844 + +------------------------------------------------------------------- +Fri Sep 7 19:23:15 CEST 2012 - ohering@suse.de + +- unmodified_drivers: handle IRQF_SAMPLE_RANDOM, it was removed + in 3.6-rc1 + +------------------------------------------------------------------- +Wed Sep 5 11:36:24 MDT 2012 - jfehlig@suse.com + +- bnc#778105 - first XEN-PV VM fails to spawn + xend: Increase wait time for disk to appear in host bootloader + Modified existing xen-domUloader.diff + +------------------------------------------------------------------- +Thu Aug 30 14:08:45 MDT 2012 - carnold@novell.com + +- Disable the snapshot patches. Snapshot only supported the qcow2 + image format which was poorly implemented qemu 0.10.2. Snapshot + support may be restored in the future when the newer upstream + qemu is used by Xen. + +------------------------------------------------------------------- +Tue Aug 28 16:31:18 CEST 2012 - ohering@suse.de + +- bnc#776995 - attaching scsi control luns with pvscsi + - xend/pvscsi: fix passing of SCSI control LUNs + xen-bug776995-pvscsi-no-devname.patch + - xend/pvscsi: fix usage of persistant device names for SCSI devices + xen-bug776995-pvscsi-persistent-names.patch + - xend/pvscsi: update sysfs parser for Linux 3.0 + xen-bug776995-pvscsi-sysfs-parser.patch + +------------------------------------------------------------------- +Thu Aug 23 15:47:24 MDT 2012 - carnold@novell.com + +- Update to Xen 4.2.0 RC3+ c/s 25779 + +------------------------------------------------------------------- +Tue Aug 21 13:54:45 MDT 2012 - carnold@novell.com + +- Update to Xen 4.2.0 RC2+ c/s 25765 + ------------------------------------------------------------------- Mon Aug 20 18:32:15 CEST 2012 - ohering@suse.de diff --git a/xen.no-default-runlevel-4.patch b/xen.no-default-runlevel-4.patch index 2df4a60..10024be 100644 --- a/xen.no-default-runlevel-4.patch +++ b/xen.no-default-runlevel-4.patch @@ -3,69 +3,13 @@ Runlevel 4 is for local sysadmin. He is responsible to create all required symlinks in this private runlevel. --- - tools/hotplug/Linux/init.d/xen-watchdog | 2 +- - tools/hotplug/Linux/init.d/xencommons | 2 +- - tools/hotplug/Linux/init.d/xend | 2 +- - tools/hotplug/Linux/init.d/xendomains | 2 +- tools/xenballoon/xenballoond.init | 2 +- - 5 files changed, 5 insertions(+), 5 deletions(-) + 1 files changed, 1 insertions(+), 1 deletions(-) -Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xen-watchdog +Index: xen-4.2.0-testing/tools/xenballoon/xenballoond.init =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xen-watchdog -+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xen-watchdog -@@ -10,7 +10,7 @@ - # Should-Start: xend - # Required-Stop: $syslog $remote_fs - # Should-Stop: xend --# Default-Start: 2 3 4 5 -+# Default-Start: 2 3 5 - # Default-Stop: 0 1 6 - # Short-Description: Start/stop xen-watchdog - # Description: Run domain watchdog daemon. -Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xencommons -=================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xencommons -+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xencommons -@@ -12,7 +12,7 @@ - # Should-Start: - # Required-Stop: $syslog $remote_fs - # Should-Stop: --# Default-Start: 2 3 4 5 -+# Default-Start: 2 3 5 - # Default-Stop: 0 1 6 - # Short-Description: Start/stop xenstored and xenconsoled - # Description: Starts and stops the daemons neeeded for xl/xend -Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xend -=================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xend -+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xend -@@ -12,7 +12,7 @@ - # Should-Start: - # Required-Stop: $syslog $remote_fs xenstored xenconsoled - # Should-Stop: --# Default-Start: 2 3 4 5 -+# Default-Start: 2 3 5 - # Default-Stop: 0 1 6 - # Short-Description: Start/stop xend - # Description: Starts and stops the Xen control daemon. -Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xendomains -=================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xendomains -+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xendomains -@@ -20,7 +20,7 @@ - # Should-Start: xend - # Required-Stop: $syslog $remote_fs xenstored xenconsoled - # Should-Stop: xend --# Default-Start: 2 3 4 5 -+# Default-Start: 2 3 5 - # Default-Stop: 0 1 6 - # Short-Description: Start/stop secondary xen domains - # Description: Start / stop domains automatically when domain 0 -Index: xen-4.1.2-testing/tools/xenballoon/xenballoond.init -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenballoon/xenballoond.init -+++ xen-4.1.2-testing/tools/xenballoon/xenballoond.init +--- xen-4.2.0-testing.orig/tools/xenballoon/xenballoond.init ++++ xen-4.2.0-testing/tools/xenballoon/xenballoond.init @@ -14,7 +14,7 @@ # Should-Start: # Required-Stop: $syslog $remote_fs diff --git a/xen.sles11sp1.fate311487.xen_platform_pci.dmistring.patch b/xen.sles11sp1.fate311487.xen_platform_pci.dmistring.patch index f693116..5c11750 100644 --- a/xen.sles11sp1.fate311487.xen_platform_pci.dmistring.patch +++ b/xen.sles11sp1.fate311487.xen_platform_pci.dmistring.patch @@ -9,10 +9,10 @@ Signed-off-by: Olaf Hering unmodified_drivers/linux-2.6/platform-pci/platform-pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -Index: xen-4.1.3-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +Index: xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c =================================================================== ---- xen-4.1.3-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c -+++ xen-4.1.3-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +--- xen-4.2.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c ++++ xen-4.2.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -27,6 +27,7 @@ #include #include diff --git a/xen.spec b/xen.spec index 00dfc65..aea4e2d 100644 --- a/xen.spec +++ b/xen.spec @@ -15,18 +15,17 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - Name: xen ExclusiveArch: %ix86 x86_64 -%define xvers 4.1 +%define xvers 4.2 %define xvermaj 4 -%define changeset 23336 -%define xen_build_dir xen-4.1.3-testing +%define changeset 25844 +%define xen_build_dir xen-4.2.0-testing %define with_kmp 1 %define with_stubdom 1 # EFI requires gcc46 or newer # its available in 12.1 or >= sles11sp2 -%if %suse_version == 1110 +%if %suse_version == 1140 || %suse_version == 1210 || %suse_version == 1110 %define with_gcc46 1 %else %define with_gcc46 0 @@ -48,12 +47,14 @@ BuildRequires: automake BuildRequires: bin86 BuildRequires: curl-devel BuildRequires: dev86 +BuildRequires: glib2-devel BuildRequires: graphviz BuildRequires: latex2html BuildRequires: libbz2-devel BuildRequires: libjpeg-devel BuildRequires: libuuid-devel BuildRequires: libxml2-devel +BuildRequires: libyajl-devel BuildRequires: ncurses-devel BuildRequires: openssl BuildRequires: openssl-devel @@ -95,10 +96,10 @@ BuildRequires: gcc46 BuildRequires: libgcc46 BuildRequires: libgcc46-32bit %endif -BuildRequires: gcc-32bit -BuildRequires: gcc43-32bit BuildRequires: glibc-32bit BuildRequires: glibc-devel-32bit +BuildRequires: gcc-32bit +BuildRequires: gcc43-32bit %define max_cpus 256 %define pae_enabled n %else @@ -112,238 +113,57 @@ BuildRequires: kernel-syms BuildRequires: module-init-tools BuildRequires: xorg-x11 %endif -Version: 4.1.3_01 +Version: 4.2.0_01 Release: 0 PreReq: %insserv_prereq %fillup_prereq Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel) License: GPL-2.0+ Group: System/Kernel -Source0: xen-4.1.3-testing-src.tar.bz2 +Source0: xen-4.2.0-testing-src.tar.bz2 Source1: stubdom.tar.bz2 -Source2: xen-utils-0.1.tar.bz2 -Source3: README.SuSE -Source4: boot.xen -Source5: boot.local.xenU -Source6: init.xend -Source7: init.xendomains -Source8: logrotate.conf -Source9: domUloader.py -Source10: xmexample.domUloader -Source11: xmexample.disks -Source12: block-nbd -Source13: block-iscsi -Source14: block-npiv-common.sh -Source15: block-npiv -Source16: block-npiv-vport -Source17: xmclone.sh -Source18: xend-relocation.sh -Source19: init.xen_loop +Source2: qemu-xen-traditional-dir-remote.tar.bz2 +Source3: qemu-xen-dir-remote.tar.bz2 +Source4: seabios-dir-remote.tar.bz2 +Source5: ipxe.tar.bz2 +Source6: xen-utils-0.1.tar.bz2 +Source10: README.SuSE +Source11: boot.xen +Source12: boot.local.xenU +Source13: init.xend +Source14: init.xendomains +Source15: logrotate.conf +Source16: domUloader.py +Source17: xmexample.domUloader +Source18: xmexample.disks +Source19: block-nbd +Source20: block-iscsi +Source21: block-npiv-common.sh +Source22: block-npiv +Source23: block-npiv-vport +Source24: xmclone.sh +Source25: xend-relocation.sh +Source26: init.xen_loop %if %{?with_kmp}0 -Source20: xen_pvdrivers.conf -Source21: kmp_filelist +Source27: xen_pvdrivers.conf +Source28: kmp_filelist %endif -Source22: block-dmmd # Xen API remote authentication sources -Source23: etc_pam.d_xen-api -Source24: xenapiusers +Source29: block-dmmd +Source30: etc_pam.d_xen-api +Source31: xenapiusers # sysconfig hook script for Xen -Source25: xen-updown.sh +Source32: xen-updown.sh # Firewall service file for xend relocation server -Source26: xend-relocation-server.fw +Source33: xend-relocation-server.fw # init script and sysconf file for pciback -Source27: init.pciback -Source28: sysconfig.pciback +Source34: init.pciback +Source35: sysconfig.pciback Source99: baselibs.conf # http://xenbits.xensource.com/ext/xenalyze Source20000: xenalyze.hg.tar.bz2 # Upstream patches -Patch22998: 22998-x86-get_page_from_l1e-retcode.patch -Patch22999: 22999-x86-mod_l1_entry-retcode.patch -Patch23000: 23000-x86-mod_l2_entry-retcode.patch -Patch23050: 23050-xentrace_dynamic_tracebuffer_allocation.patch -Patch23074: 23074-pfn.h.patch -Patch23091: 23091-xentrace_fix_t_info_pages_calculation..patch -Patch23092: 23092-xentrace_print_calculated_numbers_in_calculate_tbuf_size.patch -Patch23093: 23093-xentrace_remove_gdprintk_usage_since_they_are_not_in_guest_context.patch -Patch23094: 23094-xentrace_update_comments.patch -Patch23095: 23095-xentrace_use_consistent_printk_prefix.patch -Patch23096: 23096-x86-hpet-no-cpumask_lock.patch -Patch23099: 23099-x86-rwlock-scalability.patch -Patch23103: 23103-x86-pirq-guest-eoi-check.patch -Patch23127: 23127-vtd-bios-settings.patch -Patch23128: 23128-xentrace_correct_formula_to_calculate_t_info_pages.patch -Patch23129: 23129-xentrace_remove_unneeded_debug_printk.patch -Patch23173: 23173-xentrace_Move_register_cpu_notifier_call_into_boot-time_init..patch -Patch23199: 23199-amd-iommu-unmapped-intr-fault.patch -Patch23236: 23236-svm-decode-assist-invlpg.patch -Patch23239: 23239-xentrace_correct_overflow_check_for_number_of_per-cpu_trace_pages.patch -Patch23246: 23246-x86-xsave-enable.patch -Patch23303: 23303-cpufreq-misc.patch -Patch23308: 23308-xentrace_Move_the_global_variable_t_info_first_offset_into_calculate_tbuf_size.patch -Patch23309: 23309-xentrace_Mark_data_size___read_mostly_because_its_only_written_once.patch -Patch23310: 23310-xentrace_Remove_unneeded_cast_when_assigning_pointer_value_to_dst.patch -Patch23334: 23334-amd-fam12+14-vpmu.patch -Patch23383: 23383-libxc-rm-static-vars.patch -Patch23404: 23404-xentrace_reduce_trace_buffer_size_to_something_mfn_offset_can_reach.patch -Patch23405: 23405-xentrace_fix_type_of_offset_to_avoid_ouf-of-bounds_access.patch -Patch23406: 23406-xentrace_update___insert_record_to_copy_the_trace_record_to_individual_mfns.patch -Patch23407: 23407-xentrace_allocate_non-contiguous_per-cpu_trace_buffers.patch -Patch23462: 23462-libxc-cpu-feature.patch -Patch23506: 23506-x86_Disable_set_gpfn_from_mfn_until_m2p_table_is_allocated..patch -Patch23507: 23507-xenpaging_update_machine_to_phys_mapping_during_page_deallocation.patch -Patch23508: 23508-vmx-proc-based-ctls-probe.patch -Patch23509: 23509-x86_32_Fix_build_Define_machine_to_phys_mapping_valid.patch -Patch23562: 23562-xenpaging_remove_unused_spinlock_in_pager.patch -Patch23571: 23571-vtd-fault-verbosity.patch -Patch23574: 23574-x86-dom0-compressed-ELF.patch -Patch23575: 23575-x86-DMI.patch -Patch23576: 23576-x86_show_page_walk_also_for_early_page_faults.patch -Patch23577: 23577-tools_merge_several_bitop_functions_into_xc_bitops.h.patch -Patch23578: 23578-xenpaging_add_xs_handle_to_struct_xenpaging.patch -Patch23579: 23579-xenpaging_drop_xc.c_remove_ASSERT.patch -Patch23580: 23580-xenpaging_drop_xc.c_remove_xc_platform_info_t.patch -Patch23581: 23581-xenpaging_drop_xc.c_remove_xc_wait_for_event.patch -Patch23582: 23582-xenpaging_drop_xc.c_move_xc_mem_paging_flush_ioemu_cache.patch -Patch23583: 23583-xenpaging_drop_xc.c_move_xc_wait_for_event_or_timeout.patch -Patch23584: 23584-xenpaging_drop_xc.c_remove_xc_files.patch -Patch23585: 23585-xenpaging_correct_dropping_of_pages_to_avoid_full_ring_buffer.patch -Patch23586: 23586-xenpaging_do_not_bounce_p2mt_back_to_the_hypervisor.patch -Patch23587: 23587-xenpaging_remove_srand_call.patch -Patch23588: 23588-xenpaging_remove_return_values_from_functions_that_can_not_fail.patch -Patch23589: 23589-xenpaging_catch_xc_mem_paging_resume_errors.patch -Patch23590: 23590-xenpaging_remove_local_domain_id_variable.patch -Patch23591: 23591-xenpaging_move_num_pages_into_xenpaging_struct.patch -Patch23592: 23592-xenpaging_start_paging_in_the_middle_of_gfn_range.patch -Patch23593: 23593-xenpaging_pass_integer_to_xenpaging_populate_page.patch -Patch23594: 23594-xenpaging_add_helper_function_for_unlinking_pagefile.patch -Patch23595: 23595-xenpaging_add_watch_thread_to_catch_guest_shutdown.patch -Patch23596: 23596-xenpaging_implement_stopping_of_pager_by_sending_SIGTERM-SIGINT.patch -Patch23597: 23597-xenpaging_remove_private_mem_event.h.patch -Patch23599: 23599-tools_fix_build_after_recent_xenpaging_changes.patch -Patch23613: 23613-EFI-headers.patch -Patch23614: 23614-x86_64-EFI-boot.patch -Patch23615: 23615-x86_64-EFI-runtime.patch -Patch23616: 23616-x86_64-EFI-MPS.patch -Patch23643: 23643-xentrace_Allow_tracing_to_be_enabled_at_boot.patch -Patch23676: 23676-x86_64-image-map-bounds.patch -Patch23697: 23697-pygrub-grub2.patch -Patch23719: 23719-xentrace_update___trace_var_comment.patch -Patch23723: 23723-x86-CMOS-lock.patch -Patch23735: 23735-guest-dom0-cap.patch -Patch23747: 23747-mmcfg-base-address.patch -Patch23749: 23749-mmcfg-reservation.patch -Patch23771: 23771-x86-ioapic-clear-pin.patch -Patch23772: 23772-x86-trampoline.patch -Patch23774: 23774-x86_64-EFI-EDD.patch -Patch23782: 23782-x86-ioapic-clear-irr.patch -Patch23783: 23783-ACPI-set-_PDC-bits.patch -Patch23800: 23800-x86_64-guest-addr-range.patch -Patch23804: 23804-x86-IPI-counts.patch -Patch23817: 23817-mem_event_add_ref_counting_for_free_requestslots.patch -Patch23818: 23818-mem_event_use_mem_event_mark_and_pause_in_mem_event_check_ring.patch -Patch23827: 23827-xenpaging_use_batch_of_pages_during_final_page-in.patch -Patch23841: 23841-mem_event_pass_mem_event_domain_pointer_to_mem_event_functions.patch -Patch23842: 23842-mem_event_use_different_ringbuffers_for_share_paging_and_access.patch -Patch23874: 23874-xenpaging_track_number_of_paged_pages_in_struct_domain.patch -Patch23897: 23897-x86-mce-offline-again.patch -Patch23904: 23904-xenpaging_use_p2m-get_entry_in_p2m_mem_paging_functions.patch -Patch23905: 23905-xenpaging_fix_locking_in_p2m_mem_paging_functions.patch -Patch23906: 23906-xenpaging_remove_confusing_comment_from_p2m_mem_paging_populate.patch -Patch23933: 23933-pt-bus2bridge-update.patch -Patch23943: 23943-xenpaging_clear_page_content_after_evict.patch -Patch23944: 23944-pygrub-debug.patch -Patch23949: 23949-constify_vcpu_set_affinitys_second_parameter.patch -Patch23953: 23953-xenpaging_handle_evict_failures.patch -Patch23957: 23957-cpufreq-error-paths.patch -Patch23978: 23978-xenpaging_check_p2mt_in_p2m_mem_paging_functions.patch -Patch23979: 23979-xenpaging_document_p2m_mem_paging_functions.patch -Patch23980: 23980-xenpaging_disallow_paging_in_a_PoD_guest.patch -Patch23993: 23993-x86-microcode-amd-fix-23871.patch -Patch23999: 23999-pygrub-grub2.patch -Patch24064: 24064-pygrub-HybridISO.patch -Patch24104: 24104-waitqueue_Double_size_of_x86_shadow_stack..patch -Patch24105: 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch -Patch24106: 24106-mem_event_check_capabilities_only_once.patch -Patch24123: 24123-x86-cpuidle-quiesce.patch -Patch24124: 24124-x86-microcode-amd-quiesce.patch -Patch24138: 24138-xenpaging_munmap_all_pages_after_page-in.patch -Patch24153: 24153-x86-emul-feature-checks.patch -Patch24171: 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch -Patch24178: 24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch -Patch24195: 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch -Patch24196: 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch -Patch24197: 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch -Patch24208: 24208-xenpaging_remove_filename_from_comment.patch -Patch24209: 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch -Patch24210: 24210-xenpaging_use_PERROR_to_print_errno.patch -Patch24211: 24211-xenpaging_simplify_file_op.patch -Patch24212: 24212-xenpaging_print_gfn_in_failure_case.patch -Patch24213: 24213-xenpaging_update_xenpaging_init.patch -Patch24214: 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch -Patch24215: 24215-xenpaging_track_the_number_of_paged-out_pages.patch -Patch24216: 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch -Patch24217: 24217-xenpaging_improve_mainloop_exit_handling.patch -Patch24218: 24218-libxc_add_bitmap_clear_function.patch -Patch24219: 24219-xenpaging_retry_unpageable_gfns.patch -Patch24220: 24220-xenpaging_install_into_LIBEXEC_dir.patch -Patch24221: 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch -Patch24222: 24222-xenpaging_use_guests_tot_pages_as_working_target.patch -Patch24223: 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch -Patch24224: 24224-xenpaging_add_cmdline_interface_for_pager.patch -Patch24225: 24225-xenpaging_improve_policy_mru_list_handling.patch -Patch24226: 24226-xenpaging_add_debug_to_show_received_watch_event..patch -Patch24227: 24227-xenpaging_restrict_pagefile_permissions.patch -Patch24231: 24231-waitqueue_Implement_wake_up_nroneall..patch -Patch24232: 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch -Patch24269: 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch -Patch24270: 24270-Free_d-mem_event_on_domain_destruction..patch -Patch24272: 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch -Patch24275: 24275-x86-emul-lzcnt.patch -Patch24277: 24277-x86-dom0-features.patch -Patch24278: 24278-x86-dom0-no-PCID.patch -Patch24318: 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch -Patch24327: 24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch -Patch24328: 24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch -Patch24329: 24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch -Patch24359: 24359-x86-domU-features.patch -Patch24360: 24360-x86-pv-domU-no-PCID.patch -Patch24391: 24391-x86-pcpu-version.patch -Patch24401: 24401-pygrub-scrolling.patch -Patch24402: 24402-pygrub-edit-fix.patch -Patch24459: 24459-libxl-vifname.patch -Patch24466: 24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch -Patch24478: 24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch -Patch24566: 24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch -Patch24586: 24586-x86-mm_Properly_account_for_paged_out_pages.patch -Patch24609: 24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch -Patch24610: 24610-xenpaging_make_file_op_largefile_aware.patch -Patch24706: 24706-pygrub-extlinux.patch -Patch24780: 24780-x86-paging-use-clear_guest.patch -Patch24781: 24781-x86-vmce-mcg_ctl.patch -Patch24805: 24805-x86-MSI-X-dom0-ro.patch -Patch24886: 24886-x86-vmce-mcg_ctl-default.patch -Patch24887: 24887-x86-vmce-sr.patch -Patch25041: 25041-tapdisk2-create-init-name.patch -Patch25196: 25196-x86-HAP-PAT-sr.patch -Patch25247: 25247-SVM-no-rdtsc-intercept.patch -Patch25267: 25267-x86-text-unlikely.patch -Patch25269: 25269-x86-vMCE-addr-misc-write.patch -Patch25382: 25382-x86-masked-MCE-masking-NMI.patch -Patch25387: 25387-amd-iommu-workaround-73x.patch -Patch25430: 25430-x86-AMD-Fam15-reenable-topoext.patch -Patch25431: 25431-x86-EDD-MBR-sig-check.patch -Patch25459: 25459-page-list-splice.patch -Patch25479: 25479-x86-boot-trampoline-remove.patch -Patch25485: 25485-x86_64-canonical-checks.patch -Patch25589: 25589-pygrub-size-limits.patch -Patch25616: 25616-x86-MCi_CTL-default.patch # Upstream qemu patches -Patch100: ioemu-9868-MSI-X.patch -Patch101: ioemu-9869-MSI-X-init.patch -Patch102: ioemu-9873-MSI-X-fix-unregister_iomem.patch -Patch103: ioemu-9877-MSI-X-device-cleanup.patch # Our patches -Patch300: xen-config.diff Patch301: xend-config.diff Patch302: xen-destdir.diff Patch303: xen-rpmoptflags.diff @@ -369,23 +189,19 @@ Patch328: vif-route-ifup.patch Patch329: network-nat-open-SuSEfirewall2-FORWARD.patch Patch340: xen-hvm-default-bridge.diff Patch341: xen-hvm-default-pae.diff -Patch342: xm-test-cleanup.diff -Patch343: tools-xc_kexec.diff -Patch344: tools-kboot.diff -Patch345: libxen_permissive.patch -Patch346: xenapi-console-protocol.patch -Patch347: xen-disable-qemu-monitor.diff -Patch348: qemu-security-etch1.diff +Patch342: libxen_permissive.patch +Patch343: xenapi-console-protocol.patch +Patch344: xen-disable-qemu-monitor.diff +Patch345: qemu-security-etch1.diff Patch350: cdrom-removable.patch Patch351: xend-core-dump-loc.diff Patch352: blktap.patch -Patch353: xen-qemu-iscsi-fix.patch -Patch354: xen-api-auth.patch +Patch353: xen-api-auth.patch +Patch354: xen-qemu-iscsi-fix.patch Patch355: ioemu-vnc-resize.patch Patch356: ioemu-debuginfo.patch Patch357: vif-bridge-no-iptables.patch Patch358: xenconsole-no-multiple-connections.patch -Patch359: disable-xl-when-using-xend.patch # Needs to go upstream Patch370: checkpoint-rename.patch Patch371: xm-save-check-file.patch @@ -400,12 +216,6 @@ Patch379: xend-migration-domname-fix.patch Patch380: xm-create-maxmem.patch Patch381: vif-bridge-tap-fix.patch Patch382: xend-cpuid.patch -# Patches for snapshot support -Patch400: snapshot-ioemu-save.patch -Patch401: snapshot-ioemu-restore.patch -Patch402: snapshot-ioemu-delete.patch -Patch403: snapshot-xend.patch -Patch404: snapshot-without-pv-fix.patch # ioemu part of blktap patch series Patch410: ioemu-blktap-fv-init.patch Patch411: ioemu-blktap-image-format.patch @@ -433,8 +243,6 @@ Patch438: stdvga-cache.patch Patch439: minios-fixups.patch Patch440: bdrv_default_rwflag.patch Patch442: xen-minimum-restart-time.patch -Patch443: vif-bridge.mtu.patch -Patch445: hotplug.losetup.patch Patch446: xend-disable-internal-logrotate.patch Patch447: xend-config-enable-dump-comment.patch Patch448: change-vnc-passwd.patch @@ -446,14 +254,13 @@ Patch453: tools-watchdog-support.patch Patch454: xend-console-port-restore.patch Patch455: xencommons-proc-xen.patch Patch456: xend-vcpu-affinity-fix.patch -Patch457: xenstored.XS_RESET_WATCHES.patch -Patch458: xen-cpupool-xl-config-format.patch -Patch459: xl-create-pv-with-qcow2-img.patch -Patch460: ipxe-gcc45-warnings.patch -Patch461: ipxe-ipv4-fragment.patch -Patch462: ipxe-enable-nics.patch -Patch463: blktap-close-fifos.patch -Patch464: blktap-disable-debug-printf.patch +Patch457: xen-cpupool-xl-config-format.patch +Patch458: ipxe-enable-nics.patch +Patch459: blktap-close-fifos.patch +Patch460: blktap-disable-debug-printf.patch +Patch461: xen-bug776995-pvscsi-persistent-names.patch +Patch462: xen-bug776995-pvscsi-no-devname.patch +Patch463: xen-bug776995-pvscsi-sysfs-parser.patch # Jim's domain lock patch Patch480: xend-domain-lock.patch Patch481: xend-domain-lock-sfex.patch @@ -466,34 +273,15 @@ Patch505: pvdrv-import-shared-info.patch Patch507: x86-extra-trap-info.patch Patch508: pvdrv_emulation_control.patch Patch509: blktap-pv-cdrom.patch -Patch510: supported_module.diff -Patch511: magic_ioport_compat.patch -Patch512: xen.sles11sp1.fate311487.xen_platform_pci.dmistring.patch +Patch510: pv-driver-build.patch +Patch511: supported_module.diff +Patch512: magic_ioport_compat.patch +Patch513: xen.sles11sp1.fate311487.xen_platform_pci.dmistring.patch Patch650: disable_emulated_device.diff Patch651: ioemu-disable-scsi.patch Patch652: ioemu-disable-emulated-ide-if-pv.patch -Patch653: x86_64-allow-unsafe-adjust.patch Patch700: hv_extid_compatibility.patch Patch701: xen.no-default-runlevel-4.patch -# FATE 310510 -Patch1100: xenpaging.versioned-interface.patch -Patch1101: xenpaging.mmap-before-nominate.patch -Patch1102: xenpaging.p2m_is_paged.patch -Patch1103: xenpaging.evict_fail_fast_forward.patch -Patch1104: xenpaging.error-handling.patch -Patch1105: xenpaging.mem_event-use-wait_queue.patch -Patch1106: xenpaging.waitqueue-paging.patch -Patch1107: xenpaging.evict_mmap_readonly.patch -Patch1126: xenpaging.guest-memusage.patch -Patch1129: xenpaging.autostart.patch -Patch1130: xenpaging.doc.patch -Patch1131: xenpaging.speedup-page-out.patch -Patch1132: xenpaging.speedup-page-in.gfn_to_slot.patch -Patch1134: xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch -Patch1135: xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch -Patch1136: xenpaging.speedup-page-out.policy_choose_victim.patch -Patch1137: xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch -Patch1142: xenpaging.qemu.flush-cache.patch # xenalyze Patch20000: xenalyze.gcc46.patch # Build patch @@ -831,197 +619,12 @@ Authors: %endif %prep -%setup -q -n %xen_build_dir -a 1 -a 20000 +%setup -q -n %xen_build_dir -a 1 -a 2 -a 3 -a 4 -a 5 -a 20000 +tar xfj %{SOURCE6} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch20000 -p1 -tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools # Upstream patches -%patch22998 -p1 -%patch22999 -p1 -%patch23000 -p1 -%patch23050 -p1 -%patch23074 -p1 -%patch23091 -p1 -%patch23092 -p1 -%patch23093 -p1 -%patch23094 -p1 -%patch23095 -p1 -%patch23096 -p1 -%patch23099 -p1 -%patch23103 -p1 -%patch23127 -p1 -%patch23128 -p1 -%patch23129 -p1 -%patch23173 -p1 -%patch23199 -p1 -%patch23236 -p1 -%patch23239 -p1 -%patch23246 -p1 -%patch23303 -p1 -%patch23308 -p1 -%patch23309 -p1 -%patch23310 -p1 -%patch23334 -p1 -%patch23383 -p1 -%patch23404 -p1 -%patch23405 -p1 -%patch23406 -p1 -%patch23407 -p1 -%patch23462 -p1 -%patch23506 -p1 -%patch23507 -p1 -%patch23508 -p1 -%patch23509 -p1 -%patch23562 -p1 -%patch23571 -p1 -%patch23574 -p1 -%patch23575 -p1 -%patch23576 -p1 -%patch23577 -p1 -%patch23578 -p1 -%patch23579 -p1 -%patch23580 -p1 -%patch23581 -p1 -%patch23582 -p1 -%patch23583 -p1 -%patch23584 -p1 -%patch23585 -p1 -%patch23586 -p1 -%patch23587 -p1 -%patch23588 -p1 -%patch23589 -p1 -%patch23590 -p1 -%patch23591 -p1 -%patch23592 -p1 -%patch23593 -p1 -%patch23594 -p1 -%patch23595 -p1 -%patch23596 -p1 -%patch23597 -p1 -%patch23599 -p1 -%patch23613 -p1 -%patch23614 -p1 -%patch23615 -p1 -%patch23616 -p1 -%patch23643 -p1 -%patch23676 -p1 -%patch23697 -p1 -%patch23719 -p1 -%patch23723 -p1 -%patch23735 -p1 -%patch23747 -p1 -%patch23749 -p1 -%patch23771 -p1 -%patch23772 -p1 -%patch23774 -p1 -%patch23782 -p1 -%patch23783 -p1 -%patch23800 -p1 -%patch23804 -p1 -%patch23817 -p1 -%patch23818 -p1 -%patch23827 -p1 -%patch23841 -p1 -%patch23842 -p1 -%patch23874 -p1 -%patch23897 -p1 -%patch23904 -p1 -%patch23905 -p1 -%patch23906 -p1 -%patch23933 -p1 -%patch23943 -p1 -%patch23944 -p1 -%patch23949 -p1 -%patch23953 -p1 -%patch23957 -p1 -%patch23978 -p1 -%patch23979 -p1 -%patch23980 -p1 -%patch23993 -p1 -%patch23999 -p1 -%patch24064 -p1 -%patch24104 -p1 -%patch24105 -p1 -%patch24106 -p1 -%patch24123 -p1 -%patch24124 -p1 -%patch24138 -p1 -%patch24153 -p1 -%patch24171 -p1 -%patch24178 -p1 -%patch24195 -p1 -%patch24196 -p1 -%patch24197 -p1 -%patch24208 -p1 -%patch24209 -p1 -%patch24210 -p1 -%patch24211 -p1 -%patch24212 -p1 -%patch24213 -p1 -%patch24214 -p1 -%patch24215 -p1 -%patch24216 -p1 -%patch24217 -p1 -%patch24218 -p1 -%patch24219 -p1 -%patch24220 -p1 -%patch24221 -p1 -%patch24222 -p1 -%patch24223 -p1 -%patch24224 -p1 -%patch24225 -p1 -%patch24226 -p1 -%patch24227 -p1 -%patch24231 -p1 -%patch24232 -p1 -%patch24269 -p1 -%patch24270 -p1 -%patch24272 -p1 -%patch24275 -p1 -%patch24277 -p1 -%patch24278 -p1 -%patch24318 -p1 -%patch24327 -p1 -%patch24328 -p1 -%patch24329 -p1 -%patch24359 -p1 -%patch24360 -p1 -%patch24391 -p1 -%patch24401 -p1 -%patch24402 -p1 -%patch24459 -p1 -%patch24466 -p1 -%patch24478 -p1 -%patch24566 -p1 -%patch24586 -p1 -%patch24609 -p1 -%patch24610 -p1 -%patch24706 -p1 -%patch24780 -p1 -%patch24781 -p1 -%patch24805 -p1 -%patch24886 -p1 -%patch24887 -p1 -%patch25041 -p1 -%patch25196 -p1 -%patch25247 -p1 -%patch25267 -p1 -%patch25269 -p1 -%patch25382 -p1 -%patch25387 -p1 -%patch25430 -p1 -%patch25431 -p1 -%patch25459 -p1 -%patch25479 -p1 -%patch25485 -p1 -%patch25589 -p1 -%patch25616 -p1 # Qemu -%patch100 -p1 -%patch101 -p1 -%patch102 -p1 -%patch103 -p1 # Our patches -%patch300 -p1 %patch301 -p1 %patch302 -p1 %patch303 -p1 @@ -1048,12 +651,9 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch340 -p1 %patch341 -p1 %patch342 -p1 -#%patch343 -p1 kexec +%patch343 -p1 %patch344 -p1 %patch345 -p1 -%patch346 -p1 -%patch347 -p1 -%patch348 -p1 %patch350 -p1 %patch351 -p1 %patch352 -p1 @@ -1063,7 +663,6 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch356 -p1 %patch357 -p1 %patch358 -p1 -%patch359 -p1 %patch370 -p1 %patch371 -p1 %patch372 -p1 @@ -1077,11 +676,6 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch380 -p1 %patch381 -p1 %patch382 -p1 -%patch400 -p1 -%patch401 -p1 -%patch402 -p1 -%patch403 -p1 -%patch404 -p1 %patch410 -p1 %patch411 -p1 %patch412 -p1 @@ -1107,8 +701,6 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch439 -p1 %patch440 -p1 %patch442 -p1 -%patch443 -p1 -%patch445 -p1 %patch446 -p1 %patch447 -p1 %patch448 -p1 @@ -1127,7 +719,6 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch461 -p1 %patch462 -p1 %patch463 -p1 -%patch464 -p1 %patch480 -p1 %patch481 -p1 %patch500 -p1 @@ -1138,35 +729,17 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch507 -p1 %patch508 -p1 %patch509 -p1 +%if %suse_version < 1220 %patch510 -p1 +%endif %patch511 -p1 %patch512 -p1 +%patch513 -p1 %patch650 -p1 %patch651 -p1 %patch652 -p1 -%patch653 -p1 %patch700 -p1 %patch701 -p1 -# FATE 310510 -%patch1100 -p1 -%patch1101 -p1 -%patch1102 -p1 -%patch1103 -p1 -%patch1104 -p1 -%patch1105 -p1 -%patch1106 -p1 -%patch1107 -p1 -%patch1126 -p1 -%patch1129 -p1 -%patch1130 -p1 -%patch1131 -p1 -%patch1132 -p1 -%patch1134 -p1 -%patch1135 -p1 -%patch1136 -p1 -%patch1137 -p1 -%patch1142 -p1 -# %patch99998 -p1 %patch99999 -p1 @@ -1179,11 +752,20 @@ RPM_OPT_FLAGS=${RPM_OPT_FLAGS//-fstack-protector/} export CFLAGS="${RPM_OPT_FLAGS}" export RPM_OPT_FLAGS %if %{?with_dom0_support}0 +CFLAGS_SAVE=$CFLAGS make -C xenalyze.hg CC="gcc -I../xen/include" %{?_smp_mflags} +./configure \ + --enable-xenapi \ + --prefix=/usr \ + --exec_prefix=/usr \ + --bindir=%{_bindir} \ + --sbindir=%{_sbindir} \ + --libdir=%{_libdir} \ + --datadir=%{_datadir} make -C tools/include/xen-foreign %{?_smp_mflags} make tools docs %{?_smp_mflags} make -C tools/debugger/gdbsx -make -C tools/xen-utils-0.1 XEN_INTREE_BUILD=yes +make -C tools/xen-utils-0.1 XEN_INTREE_BUILD=yes XEN_ROOT=$PWD %else make -C tools/include/xen-foreign %{?_smp_mflags} make tools docs %{?_smp_mflags} @@ -1275,7 +857,7 @@ mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d for flavor in %flavors_to_build; do make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \ M=$PWD/obj/$flavor - install -m644 %SOURCE20 $RPM_BUILD_ROOT/etc/modprobe.d/xen_pvdrivers-$flavor.conf + install -m644 %SOURCE27 $RPM_BUILD_ROOT/etc/modprobe.d/xen_pvdrivers-$flavor.conf done %endif %if %{?with_dom0_support}0 @@ -1291,11 +873,13 @@ ln -s /usr/lib/xen/bin/stubdom-dm $RPM_BUILD_ROOT/usr/lib64/xen/bin/stubdom-dm ln -s /usr/lib/xen/bin/stubdompath.sh $RPM_BUILD_ROOT/usr/lib64/xen/bin/stubdompath.sh %endif %endif +# Qemu +#make -C tools/qemu-xen-dir-remote install # Docs make -C docs install \ DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir} \ DOCDIR=%{_defaultdocdir}/xen -for name in COPYING %SOURCE3 %SOURCE4 %SOURCE5; do +for name in COPYING %SOURCE10 %SOURCE11 %SOURCE12; do install -m 644 $name $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/ done mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/misc @@ -1306,38 +890,39 @@ done # init scripts %if %{?with_dom0_support}0 mkdir -p $RPM_BUILD_ROOT/etc/init.d -install %SOURCE6 $RPM_BUILD_ROOT/etc/init.d/xend +install %SOURCE13 $RPM_BUILD_ROOT/etc/init.d/xend ln -s /etc/init.d/xend $RPM_BUILD_ROOT/usr/sbin/rcxend -install %SOURCE7 $RPM_BUILD_ROOT/etc/init.d/xendomains +install %SOURCE14 $RPM_BUILD_ROOT/etc/init.d/xendomains ln -s /etc/init.d/xendomains $RPM_BUILD_ROOT/usr/sbin/rcxendomains -install %SOURCE27 $RPM_BUILD_ROOT/etc/init.d/pciback +install %SOURCE34 $RPM_BUILD_ROOT/etc/init.d/pciback ln -s /etc/init.d/pciback $RPM_BUILD_ROOT/usr/sbin/rcpciback -install %SOURCE28 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.pciback +install %SOURCE35 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.pciback mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d -install -m644 %SOURCE19 $RPM_BUILD_ROOT/etc/modprobe.d/xen_loop.conf +install -m644 %SOURCE26 $RPM_BUILD_ROOT/etc/modprobe.d/xen_loop.conf # example config mkdir -p $RPM_BUILD_ROOT/etc/xen/{vm,examples,scripts} mv $RPM_BUILD_ROOT/etc/xen/xmexample* $RPM_BUILD_ROOT/etc/xen/examples +mv $RPM_BUILD_ROOT/etc/xen/xlexample* $RPM_BUILD_ROOT/etc/xen/examples rm -f $RPM_BUILD_ROOT/etc/xen/examples/*nbd -install -m644 %SOURCE10 %SOURCE11 $RPM_BUILD_ROOT/etc/xen/examples/ +install -m644 %SOURCE17 %SOURCE18 $RPM_BUILD_ROOT/etc/xen/examples/ install -m644 tools/xentrace/formats $RPM_BUILD_ROOT/etc/xen/examples/xentrace_formats.txt # scripts rm -f $RPM_BUILD_ROOT/etc/xen/scripts/block-*nbd -install -m755 %SOURCE12 %SOURCE13 %SOURCE14 %SOURCE15 %SOURCE16 %SOURCE17 %SOURCE18 %SOURCE22 $RPM_BUILD_ROOT/etc/xen/scripts/ +install -m755 %SOURCE19 %SOURCE20 %SOURCE21 %SOURCE22 %SOURCE23 %SOURCE24 %SOURCE25 %SOURCE29 $RPM_BUILD_ROOT/etc/xen/scripts/ ln -s /etc/xen/scripts/vm-monitor $RPM_BUILD_ROOT/etc/xen/scripts/set-lock # Xen API remote authentication files install -d $RPM_BUILD_ROOT/etc/pam.d -install -m644 %SOURCE23 $RPM_BUILD_ROOT/etc/pam.d/xen-api -install -m644 %SOURCE24 $RPM_BUILD_ROOT/etc/xen/ +install -m644 %SOURCE30 $RPM_BUILD_ROOT/etc/pam.d/xen-api +install -m644 %SOURCE31 $RPM_BUILD_ROOT/etc/xen/ # sysconfig hook for Xen mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/network/scripts mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/network/if-up.d mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/network/if-down.d -install -m755 %SOURCE25 $RPM_BUILD_ROOT/etc/sysconfig/network/scripts +install -m755 %SOURCE32 $RPM_BUILD_ROOT/etc/sysconfig/network/scripts ln -s /etc/sysconfig/network/scripts/xen-updown.sh $RPM_BUILD_ROOT/etc/sysconfig/network/if-up.d/xen ln -s /etc/sysconfig/network/scripts/xen-updown.sh $RPM_BUILD_ROOT/etc/sysconfig/network/if-down.d/xen # logrotate -install -m644 -D %SOURCE8 $RPM_BUILD_ROOT/etc/logrotate.d/xen +install -m644 -D %SOURCE15 $RPM_BUILD_ROOT/etc/logrotate.d/xen # directories mkdir -p $RPM_BUILD_ROOT/var/lib/xenstored mkdir -p $RPM_BUILD_ROOT/var/lib/xen/images @@ -1351,21 +936,26 @@ mkdir -p $RPM_BUILD_ROOT/var/log/xen mkdir -p $RPM_BUILD_ROOT/var/log/xen/console ln -s /var/lib/xen/images $RPM_BUILD_ROOT/etc/xen/images # Bootloader -install -m755 %SOURCE9 $RPM_BUILD_ROOT/usr/lib/xen/boot/ +install -m755 %SOURCE16 $RPM_BUILD_ROOT/usr/lib/xen/boot/ # udev support mkdir -p $RPM_BUILD_ROOT/etc/udev/rules.d mv $RPM_BUILD_ROOT/etc/udev/rules.d/xen-backend.rules $RPM_BUILD_ROOT/etc/udev/rules.d/40-xen.rules mv $RPM_BUILD_ROOT/etc/udev/rules.d/xend.rules $RPM_BUILD_ROOT/etc/udev/rules.d/40-xend.rules # xen utils -make -C tools/xen-utils-0.1 install DESTDIR=$RPM_BUILD_ROOT XEN_INTREE_BUILD=yes +make -C tools/xen-utils-0.1 install DESTDIR=$RPM_BUILD_ROOT XEN_INTREE_BUILD=yes XEN_ROOT=$PWD # Clean up unpackaged files rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/xen/qemu/ rm -f $RPM_BUILD_ROOT/%{_datadir}/doc/qemu/qemu-* +rm -f $RPM_BUILD_ROOT/%{_datadir}/doc/packages/xen/html/hypercall/.deps rm -rf $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/ps rm -rf $RPM_BUILD_ROOT/usr/share/xen/man/man1/qemu/qemu* +rm -f $RPM_BUILD_ROOT/usr/share/xen/qemu/openbios-ppc rm -f $RPM_BUILD_ROOT/usr/share/xen/qemu/openbios-sparc32 rm -f $RPM_BUILD_ROOT/usr/share/xen/qemu/openbios-sparc64 -rm -f $RPM_BUILD_ROOT/usr/share/xen/qemu/openbios-ppc +rm -f $RPM_BUILD_ROOT/usr/share/qemu-xen/openbios-ppc +rm -f $RPM_BUILD_ROOT/usr/share/qemu-xen/openbios-sparc32 +rm -f $RPM_BUILD_ROOT/usr/share/qemu-xen/openbios-sparc64 +rm -f $RPM_BUILD_ROOT/usr/share/qemu-xen/palcode-clipper rm -f $RPM_BUILD_ROOT/usr/sbin/netfix rm -f $RPM_BUILD_ROOT/%{_libdir}/python%{pyver}/site-packages/*.egg-info rm -rf $RPM_BUILD_ROOT/html @@ -1374,6 +964,16 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug rm -f $RPM_BUILD_ROOT/%{_bindir}/qemu-img-xen rm -f $RPM_BUILD_ROOT/%{_bindir}/qemu-nbd-xen rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug +rm -rf $RPM_BUILD_ROOT/usr/lib/debug +# Upstream Qemu +rm -rf $RPM_BUILD_ROOT/usr/local/share/qemu +rm -rf $RPM_BUILD_ROOT/usr/local/share/doc/qemu +rm -f $RPM_BUILD_ROOT/usr/local/etc/qemu/target-x86_64.conf +rm -f $RPM_BUILD_ROOT/usr/local/share/man/man1/qemu.1 +rm -f $RPM_BUILD_ROOT/usr/local/share/man/man1/qemu-img.1 +rm -f $RPM_BUILD_ROOT/usr/local/share/man/man8/qemu-nbd.8 +rm -f $RPM_BUILD_ROOT/usr/local/share/doc/qemu/qemu-doc.html +rm -f $RPM_BUILD_ROOT/usr/local/share/doc/qemu/qemu-tech.html #install firewall definitions format is described here: #/usr/share/SuSEfirewall2/services/TEMPLATE mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir} @@ -1444,6 +1044,9 @@ rm -f $RPM_BUILD_ROOT/%{_bindir}/xencons /usr/sbin/flask-loadpolicy /usr/sbin/flask-getenforce /usr/sbin/flask-setenforce +/usr/sbin/flask-get-bool +/usr/sbin/flask-label-pci +/usr/sbin/flask-set-bool /usr/sbin/rcxend /usr/sbin/rcxendomains /usr/sbin/rcpciback @@ -1518,11 +1121,13 @@ rm -f $RPM_BUILD_ROOT/%{_bindir}/xencons %{_defaultdocdir}/xen/misc %dir %{_libdir}/python%{pyver}/site-packages/xen %dir %{_libdir}/python%{pyver}/site-packages/grub +%dir %{_datadir}/qemu-xen %dir %{_datadir}/xen %dir %{_datadir}/xen/man %dir %{_datadir}/xen/man/man1 %dir %{_datadir}/xen/man/man8 %dir %{_datadir}/xen/qemu +%{_datadir}/qemu-xen/* %{_datadir}/xen/*.dtd %{_datadir}/xen/qemu/* %{_datadir}/xen/man/man1/* @@ -1551,6 +1156,7 @@ rm -f $RPM_BUILD_ROOT/%{_bindir}/xencons %files doc-html %defattr(-,root,root) %{_defaultdocdir}/xen/html +#%{_datadir}/doc/qemu %files doc-pdf %defattr(-,root,root) diff --git a/xenalyze.gcc46.patch b/xenalyze.gcc46.patch index 8590601..13b517a 100644 --- a/xenalyze.gcc46.patch +++ b/xenalyze.gcc46.patch @@ -18,10 +18,10 @@ cc1: all warnings being treated as errors xenalyze.hg/xenalyze.c | 21 --------------------- 1 file changed, 21 deletions(-) -Index: xen-4.1.2-testing/xenalyze.hg/xenalyze.c +Index: xen-4.2.0-testing/xenalyze.hg/xenalyze.c =================================================================== ---- xen-4.1.2-testing.orig/xenalyze.hg/xenalyze.c -+++ xen-4.1.2-testing/xenalyze.hg/xenalyze.c +--- xen-4.2.0-testing.orig/xenalyze.hg/xenalyze.c ++++ xen-4.2.0-testing/xenalyze.hg/xenalyze.c @@ -2016,8 +2016,6 @@ float weighted_percentile(float * A, /* float X, t1; unsigned long long t2; diff --git a/xenapi-console-protocol.patch b/xenapi-console-protocol.patch index 8ab158b..341827b 100644 --- a/xenapi-console-protocol.patch +++ b/xenapi-console-protocol.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3935,6 +3935,14 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3940,6 +3940,14 @@ class XendDomainInfo: if not config.has_key('backend'): config['backend'] = "00000000-0000-0000-0000-000000000000" diff --git a/xencommons-proc-xen.patch b/xencommons-proc-xen.patch index 29299cf..56e6ee4 100644 --- a/xencommons-proc-xen.patch +++ b/xencommons-proc-xen.patch @@ -15,11 +15,11 @@ Signed-off-by: Olaf Hering tools/hotplug/Linux/init.d/xencommons | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) -Index: xen-4.1.3-testing/tools/hotplug/Linux/init.d/xencommons +Index: xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons =================================================================== ---- xen-4.1.3-testing.orig/tools/hotplug/Linux/init.d/xencommons -+++ xen-4.1.3-testing/tools/hotplug/Linux/init.d/xencommons -@@ -27,27 +27,30 @@ fi +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/init.d/xencommons ++++ xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons +@@ -27,6 +27,7 @@ fi test -f $xencommons_config/xencommons && . $xencommons_config/xencommons XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid @@ -27,35 +27,32 @@ Index: xen-4.1.3-testing/tools/hotplug/Linux/init.d/xencommons shopt -s extglob # not running in Xen dom0 or domU - if ! test -d /proc/xen ; then -- exit 0 -+ exit 0 +@@ -34,10 +35,15 @@ if ! test -d /proc/xen ; then + exit 0 fi ++# not running in Xen dom0 or domU ++if ! test -d /proc/xen ; then ++ exit 0 ++fi ++ # mount xenfs in dom0 or domU with a pv_ops kernel if test "x$1" = xstart && \ - ! test -f /proc/xen/capabilities && \ - ! grep '^xenfs ' /proc/mounts >/dev/null; -+ ! test -f $XEN_CAPABILITIES && \ -+ ! grep -q '^xenfs ' /proc/mounts ; ++ ! test -f $XEN_CAPABILITIES && \ ++ ! grep -q '^xenfs ' /proc/mounts ; then -- mount -t xenfs xenfs /proc/xen -+ mount -t xenfs xenfs /proc/xen + mount -t xenfs xenfs /proc/xen fi - +@@ -45,8 +51,8 @@ fi # run this script only in dom0: --# no capabilities file in xenlinux domU kernel --# empty capabilities file in pv_ops domU kernel + # no capabilities file in xenlinux domU kernel + # empty capabilities file in pv_ops domU kernel -if test -f /proc/xen/capabilities && \ - ! grep -q "control_d" /proc/xen/capabilities ; then -- exit 0 -+# no capabilities file in xenlinux kernel -+if ! test -f $XEN_CAPABILITIES ; then -+ exit 0 -+fi -+# empty capabilities file in pv_ops kernel -+if ! grep -q "control_d" $XEN_CAPABILITIES ; then -+ exit 0 ++if test -f $XEN_CAPABILITIES && \ ++ ! grep -q "control_d" $XEN_CAPABILITIES ; then + exit 0 fi - do_start () { diff --git a/xenconsole-no-multiple-connections.patch b/xenconsole-no-multiple-connections.patch index b761fdb..9649221 100644 --- a/xenconsole-no-multiple-connections.patch +++ b/xenconsole-no-multiple-connections.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/console/client/main.c +Index: xen-4.2.0-testing/tools/console/client/main.c =================================================================== ---- xen-4.1.2-testing.orig/tools/console/client/main.c -+++ xen-4.1.2-testing/tools/console/client/main.c +--- xen-4.2.0-testing.orig/tools/console/client/main.c ++++ xen-4.2.0-testing/tools/console/client/main.c @@ -96,6 +96,7 @@ static int get_pty_fd(struct xs_handle * * Assumes there is already a watch set in the store for this path. */ { diff --git a/xend-config-enable-dump-comment.patch b/xend-config-enable-dump-comment.patch index 90f0862..24e243a 100644 --- a/xend-config-enable-dump-comment.patch +++ b/xend-config-enable-dump-comment.patch @@ -4,10 +4,10 @@ bnc#684305 tools/examples/xend-config.sxp | 3 +++ 1 file changed, 3 insertions(+) -Index: xen-4.1.2-testing/tools/examples/xend-config.sxp +Index: xen-4.2.0-testing/tools/examples/xend-config.sxp =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xend-config.sxp -+++ xen-4.1.2-testing/tools/examples/xend-config.sxp +--- xen-4.2.0-testing.orig/tools/examples/xend-config.sxp ++++ xen-4.2.0-testing/tools/examples/xend-config.sxp @@ -250,6 +250,9 @@ (dom0-cpus 0) diff --git a/xend-config.diff b/xend-config.diff index cf44eb3..3205e44 100644 --- a/xend-config.diff +++ b/xend-config.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/sysconfig.xendomains +Index: xen-4.2.0-testing/tools/hotplug/Linux/init.d/sysconfig.xendomains =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/sysconfig.xendomains -+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/sysconfig.xendomains +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/init.d/sysconfig.xendomains ++++ xen-4.2.0-testing/tools/hotplug/Linux/init.d/sysconfig.xendomains @@ -1,4 +1,4 @@ -## Path: System/xen +## Path: System/Virtualization @@ -16,21 +16,10 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/sysconfig.xendomains # XENDOMAINS_AUTO=/etc/xen/auto -@@ -109,9 +108,8 @@ XENDOMAINS_AUTO=/etc/xen/auto - # files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, - # XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise - # all running domains will be. --# Note that the name matching is somewhat fuzzy. - # --XENDOMAINS_AUTO_ONLY=false -+XENDOMAINS_AUTO_ONLY=true - - ## Type: integer - ## Default: 300 -Index: xen-4.1.2-testing/tools/examples/xend-config.sxp +Index: xen-4.2.0-testing/tools/examples/xend-config.sxp =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xend-config.sxp -+++ xen-4.1.2-testing/tools/examples/xend-config.sxp +--- xen-4.2.0-testing.orig/tools/examples/xend-config.sxp ++++ xen-4.2.0-testing/tools/examples/xend-config.sxp @@ -58,11 +58,12 @@ diff --git a/xend-console-port-restore.patch b/xend-console-port-restore.patch index 29b5b73..7f371a3 100644 --- a/xend-console-port-restore.patch +++ b/xend-console-port-restore.patch @@ -3,11 +3,11 @@ xenstore. See bnc#706574 From: Chunyan Liu -Index: xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -405,8 +405,7 @@ def restore(xd, fd, dominfo = None, paus +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py +@@ -329,8 +329,7 @@ def restore(xd, fd, dominfo = None, paus restore_image.setCpuid() # xc_restore will wait for source to close connection @@ -15,13 +15,13 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py - dominfo.completeRestore(handler.store_mfn, handler.console_mfn) + dominfo.completeRestore(handler.store_mfn, handler.console_mfn, console_port) - wait_devs(dominfo) - -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py + # + # We shouldn't hold the domains_lock over a waitForDevices +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3055,7 +3055,7 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3062,7 +3062,7 @@ class XendDomainInfo: # TODO: recategorise - called from XendCheckpoint # @@ -30,10 +30,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py log.debug("XendDomainInfo.completeRestore") -@@ -3066,6 +3066,7 @@ class XendDomainInfo: +@@ -3073,6 +3073,7 @@ class XendDomainInfo: self.image = image.create(self, self.info) if self.image: - self._createDevices(True) + self.image.createDeviceModel(True) + self.console_port = console_port self._storeDomDetails() self._registerWatches() diff --git a/xend-core-dump-loc.diff b/xend-core-dump-loc.diff index 3aba1ec..6aa1939 100644 --- a/xend-core-dump-loc.diff +++ b/xend-core-dump-loc.diff @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -2304,7 +2304,7 @@ class XendDomainInfo: # To prohibit directory traversal based_name = os.path.basename(self.info['name_label']) diff --git a/xend-cpuid.patch b/xend-cpuid.patch index bc6cd6f..4bf4b93 100644 --- a/xend-cpuid.patch +++ b/xend-cpuid.patch @@ -9,11 +9,11 @@ are read and parsed. This patch skips the first conversion, and uses only the custom cpuid{_check} conversion methods called later. It is not pretty, but is the least invasive fix in this complex code. -Index: xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py -@@ -1125,6 +1125,10 @@ class XendConfig(dict): +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendConfig.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py +@@ -1126,6 +1126,10 @@ class XendConfig(dict): else: for name, typ in XENAPI_CFG_TYPES.items(): if name in self and self[name] not in (None, []): diff --git a/xend-devid-or-name.patch b/xend-devid-or-name.patch index 3e2ded4..a57a4b7 100644 --- a/xend-devid-or-name.patch +++ b/xend-devid-or-name.patch @@ -11,10 +11,10 @@ form, e.g. it would accept '5632' or 'hdc'. This patch restores that behavior. Signed-off-by: Jim Fehlig -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -1203,6 +1203,9 @@ class XendDomainInfo: except ValueError: pass diff --git a/xend-disable-internal-logrotate.patch b/xend-disable-internal-logrotate.patch index 8eb5394..32560e3 100644 --- a/xend-disable-internal-logrotate.patch +++ b/xend-disable-internal-logrotate.patch @@ -5,10 +5,10 @@ This allows larger xend.log files tools/python/xen/xend/XendLogging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -Index: xen-4.1.2-testing/tools/python/xen/xend/XendLogging.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendLogging.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendLogging.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendLogging.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendLogging.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendLogging.py @@ -76,7 +76,7 @@ if 'TRACE' not in logging.__dict__: log = logging.getLogger("xend") diff --git a/xend-domain-lock-sfex.patch b/xend-domain-lock-sfex.patch index 67fdbdb..7a85f82 100644 --- a/xend-domain-lock-sfex.patch +++ b/xend-domain-lock-sfex.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/examples/xend-config.sxp +Index: xen-4.2.0-testing/tools/examples/xend-config.sxp =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xend-config.sxp -+++ xen-4.1.2-testing/tools/examples/xend-config.sxp +--- xen-4.2.0-testing.orig/tools/examples/xend-config.sxp ++++ xen-4.2.0-testing/tools/examples/xend-config.sxp @@ -357,7 +357,7 @@ # path // # Return 0 on success, non-zero on error. @@ -23,10 +23,10 @@ Index: xen-4.1.2-testing/tools/examples/xend-config.sxp # If we have a very big scsi device configuration, start of xend is slow, # because xend scans all the device paths to build its internal PSCSI device # list. If we need only a few devices for assigning to a guest, we can reduce -Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile +Index: xen-4.2.0-testing/tools/hotplug/Linux/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/Makefile -+++ xen-4.1.2-testing/tools/hotplug/Linux/Makefile +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/Makefile ++++ xen-4.2.0-testing/tools/hotplug/Linux/Makefile @@ -23,6 +23,7 @@ XEN_SCRIPTS += xen-hotplug-cleanup XEN_SCRIPTS += external-device-migrate XEN_SCRIPTS += vscsi @@ -35,10 +35,10 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh -Index: xen-4.1.2-testing/tools/hotplug/Linux/domain-lock +Index: xen-4.2.0-testing/tools/hotplug/Linux/domain-lock =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/domain-lock -+++ xen-4.1.2-testing/tools/hotplug/Linux/domain-lock +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/domain-lock ++++ xen-4.2.0-testing/tools/hotplug/Linux/domain-lock @@ -4,7 +4,7 @@ basedir=$(dirname "$0") usage() { @@ -48,10 +48,10 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/domain-lock echo "" echo "-l lock" echo "-u unlock" -Index: xen-4.1.2-testing/tools/hotplug/Linux/domain-lock-sfex +Index: xen-4.2.0-testing/tools/hotplug/Linux/domain-lock-sfex =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/hotplug/Linux/domain-lock-sfex ++++ xen-4.2.0-testing/tools/hotplug/Linux/domain-lock-sfex @@ -0,0 +1,166 @@ +#!/bin/bash + @@ -219,11 +219,11 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/domain-lock-sfex +;; +esac + -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -4519,8 +4519,14 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -4526,8 +4526,14 @@ class XendDomainInfo: # Return name of host contained in lock file. def get_lock_host(self, path): @@ -240,7 +240,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py hostname = "unknown" try: -@@ -4542,6 +4548,16 @@ class XendDomainInfo: +@@ -4549,6 +4555,16 @@ class XendDomainInfo: path = xoptions.get_xend_domain_lock_path() path = os.path.join(path, self.get_uuid()) @@ -257,7 +257,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py try: if not os.path.exists(path): mkdir.parents(path, stat.S_IRWXU) -@@ -4549,12 +4565,7 @@ class XendDomainInfo: +@@ -4556,12 +4572,7 @@ class XendDomainInfo: log.exception("%s could not be created." % path) raise XendError("%s could not be created." % path) @@ -271,7 +271,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py if status != 0: log.debug("Failed to aqcuire lock: status = %d" % status) raise XendError("The VM is locked and appears to be running on host %s." % self.get_lock_host(path)) -@@ -4571,12 +4582,18 @@ class XendDomainInfo: +@@ -4578,12 +4589,18 @@ class XendDomainInfo: path = xoptions.get_xend_domain_lock_path() path = os.path.join(path, self.get_uuid()) @@ -296,10 +296,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py if status != 0: log.exception("Failed to release lock: status = %s" % status) try: -Index: xen-4.1.2-testing/tools/python/xen/xend/XendNode.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendNode.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendNode.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendNode.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendNode.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendNode.py @@ -162,6 +162,7 @@ class XendNode: self._init_cpu_pools() @@ -326,10 +326,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendNode.py def add_network(self, interface): # TODO log.debug("add_network(): Not implemented.") -Index: xen-4.1.2-testing/tools/python/xen/xend/XendOptions.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendOptions.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendOptions.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendOptions.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendOptions.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendOptions.py @@ -164,6 +164,9 @@ class XendOptions: """Default script to acquire/release domain lock""" xend_domain_lock_utility = auxbin.scripts_dir() + "/domain-lock" diff --git a/xend-domain-lock.patch b/xend-domain-lock.patch index 313ba85..8103271 100644 --- a/xend-domain-lock.patch +++ b/xend-domain-lock.patch @@ -8,10 +8,10 @@ tools/python/xen/xend/XendOptions.py | 29 +++++++++++ 7 files changed, 290 insertions(+) -Index: xen-4.1.2-testing/tools/examples/xend-config.sxp +Index: xen-4.2.0-testing/tools/examples/xend-config.sxp =================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xend-config.sxp -+++ xen-4.1.2-testing/tools/examples/xend-config.sxp +--- xen-4.2.0-testing.orig/tools/examples/xend-config.sxp ++++ xen-4.2.0-testing/tools/examples/xend-config.sxp @@ -324,6 +324,65 @@ # device assignment could really work properly even after we do this. #(pci-passthrough-strict-check yes) @@ -78,10 +78,10 @@ Index: xen-4.1.2-testing/tools/examples/xend-config.sxp # If we have a very big scsi device configuration, start of xend is slow, # because xend scans all the device paths to build its internal PSCSI device # list. If we need only a few devices for assigning to a guest, we can reduce -Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile +Index: xen-4.2.0-testing/tools/hotplug/Linux/Makefile =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/Makefile -+++ xen-4.1.2-testing/tools/hotplug/Linux/Makefile +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/Makefile ++++ xen-4.2.0-testing/tools/hotplug/Linux/Makefile @@ -22,6 +22,7 @@ XEN_SCRIPTS += vtpm vtpm-delete XEN_SCRIPTS += xen-hotplug-cleanup XEN_SCRIPTS += external-device-migrate @@ -90,10 +90,10 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/Makefile XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh -Index: xen-4.1.2-testing/tools/hotplug/Linux/domain-lock +Index: xen-4.2.0-testing/tools/hotplug/Linux/domain-lock =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/hotplug/Linux/domain-lock ++++ xen-4.2.0-testing/tools/hotplug/Linux/domain-lock @@ -0,0 +1,83 @@ +#!/bin/bash + @@ -178,10 +178,10 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/domain-lock + get_status $vm_path + ;; +esac -Index: xen-4.1.2-testing/tools/hotplug/Linux/vm-monitor +Index: xen-4.2.0-testing/tools/hotplug/Linux/vm-monitor =================================================================== --- /dev/null -+++ xen-4.1.2-testing/tools/hotplug/Linux/vm-monitor ++++ xen-4.2.0-testing/tools/hotplug/Linux/vm-monitor @@ -0,0 +1,41 @@ +#!/bin/bash + @@ -224,20 +224,20 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/vm-monitor +elif [ $0 = "$basedir/vm-monitor" ]; then + monitor $* +fi -Index: xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -133,6 +133,8 @@ def save(fd, dominfo, network, live, dst - dominfo.shutdown('suspend') - dominfo.waitForSuspend() - if line in ('suspend', 'suspended'): -+ if checkpoint == False: -+ dominfo.release_running_lock(domain_name) - dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, - domain_name) - log.info("Domain %d suspended.", dominfo.getDomid()) -@@ -412,6 +414,7 @@ def restore(xd, fd, dominfo = None, paus +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py +@@ -130,6 +130,8 @@ def save(fd, dominfo, network, live, dst + dominfo.shutdown('suspend') + dominfo.waitForSuspend() + if line in ('suspend', 'suspended'): ++ if checkpoint == False: ++ dominfo.release_running_lock(domain_name) + dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, + domain_name) + log.info("Domain %d suspended.", dominfo.getDomid()) +@@ -353,6 +355,7 @@ def restore(xd, fd, dominfo = None, paus if not paused: dominfo.unpause() @@ -245,10 +245,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py return dominfo except Exception, exn: dominfo.destroy() -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -470,6 +470,7 @@ class XendDomainInfo: if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED, XEN_API_VM_POWER_STATE_CRASHED): @@ -257,7 +257,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py XendTask.log_progress(0, 30, self._constructDomain) XendTask.log_progress(31, 60, self._initDomain) -@@ -3003,6 +3004,11 @@ class XendDomainInfo: +@@ -3010,6 +3011,11 @@ class XendDomainInfo: self._stateSet(DOM_STATE_HALTED) self.domid = None # Do not push into _stateSet()! @@ -269,7 +269,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py finally: self.refresh_shutdown_lock.release() -@@ -4511,6 +4517,74 @@ class XendDomainInfo: +@@ -4518,6 +4524,74 @@ class XendDomainInfo: def has_device(self, dev_class, dev_uuid): return (dev_uuid in self.info['%s_refs' % dev_class.lower()]) @@ -344,10 +344,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py def __str__(self): return '' % \ (str(self.domid), self.info['name_label'], -Index: xen-4.1.2-testing/tools/python/xen/xend/XendOptions.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendOptions.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendOptions.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendOptions.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendOptions.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendOptions.py @@ -154,6 +154,17 @@ class XendOptions: use loose check automatically if necessary.""" pci_dev_assign_strict_check_default = True diff --git a/xend-migration-domname-fix.patch b/xend-migration-domname-fix.patch index 4bcb2a1..7941dfd 100644 --- a/xend-migration-domname-fix.patch +++ b/xend-migration-domname-fix.patch @@ -4,10 +4,10 @@ domname from xenstore (like 'virsh list') could get correct value. destroyed but there is still VM entry in xenstore. Signed-off-by: Chunyan Liu -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -1947,6 +1947,8 @@ class XendDomainInfo: self.info['name_label'] = name if to_store: @@ -17,10 +17,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py def getName(self): return self.info['name_label'] -Index: xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendCheckpoint.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py @@ -172,7 +172,10 @@ def save(fd, dominfo, network, live, dst dominfo.destroy() dominfo.testDeviceComplete() diff --git a/xend-sysconfig.patch b/xend-sysconfig.patch index fae2e46..4d45f0f 100644 --- a/xend-sysconfig.patch +++ b/xend-sysconfig.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/sysconfig.xencommons +Index: xen-4.2.0-testing/tools/hotplug/Linux/init.d/sysconfig.xencommons =================================================================== ---- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/sysconfig.xencommons -+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/sysconfig.xencommons -@@ -1,11 +1,24 @@ +--- xen-4.2.0-testing.orig/tools/hotplug/Linux/init.d/sysconfig.xencommons ++++ xen-4.2.0-testing/tools/hotplug/Linux/init.d/sysconfig.xencommons +@@ -1,14 +1,30 @@ +## Path: System/Virtualization +## Type: string +## Default: "none" @@ -10,6 +10,12 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/sysconfig.xencommons # Log xenconsoled messages (cf xl dmesg) #XENCONSOLED_TRACE=[none|guest|hv|all] ++## Type: string ++## Default: xenstored ++# + # Select xenstored implementation + #XENSTORED=[oxenstored|xenstored] + +## Type: string +## Default: Not defined, tracing off +# diff --git a/xend-vcpu-affinity-fix.patch b/xend-vcpu-affinity-fix.patch index e10b1ce..4c28e92 100644 --- a/xend-vcpu-affinity-fix.patch +++ b/xend-vcpu-affinity-fix.patch @@ -1,8 +1,8 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2778,7 +2778,10 @@ class XendDomainInfo: +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -2785,7 +2785,10 @@ class XendDomainInfo: from xen.xend import XendDomain doms = XendDomain.instance().list('all') for dom in filter (lambda d: d.domid != self.domid, doms): diff --git a/xenpaging.autostart.patch b/xenpaging.autostart.patch deleted file mode 100644 index 0fa2d87..0000000 --- a/xenpaging.autostart.patch +++ /dev/null @@ -1,413 +0,0 @@ -# HG changeset patch -# Parent 659ee31faec91ac543578db7c9b2849fb7367419 - -xenpaging: xend: start xenpaging via config option - -Start xenpaging via config option. - -TODO: add libxl support -TODO: parse config values like 42K, 42M, 42G, 42% - -Signed-off-by: Olaf Hering - ---- -v5: - use actmem=, xenpaging_file=, xenpaging_extra= - add xm mem-swap-target - -v4: - add config option for pagefile directory - add config option to enable debug - add config option to set policy mru_size - fail if chdir fails - force self.xenpaging* variables to be strings because a xm new may turn some - of them into type int and later os.execve fails with a TypeError - -v3: - decouple create/destroycreateXenPaging from _create/_removeDevices - init xenpaging variable to 0 if xenpaging is not in config file to - avoid string None coming from sxp file - -v2: - unlink logfile instead of truncating it. - allows hardlinking for further inspection - ---- - tools/examples/xmexample.hvm | 9 +++ - tools/python/README.XendConfig | 3 + - tools/python/README.sxpcfg | 3 + - tools/python/xen/xend/XendConfig.py | 9 +++ - tools/python/xen/xend/XendDomain.py | 15 +++++ - tools/python/xen/xend/XendDomainInfo.py | 23 ++++++++ - tools/python/xen/xend/image.py | 85 ++++++++++++++++++++++++++++++++ - tools/python/xen/xm/create.py | 15 +++++ - tools/python/xen/xm/main.py | 14 +++++ - tools/python/xen/xm/xenapi_create.py | 3 + - 10 files changed, 179 insertions(+) - -Index: xen-4.1.2-testing/tools/examples/xmexample.hvm -=================================================================== ---- xen-4.1.2-testing.orig/tools/examples/xmexample.hvm -+++ xen-4.1.2-testing/tools/examples/xmexample.hvm -@@ -142,6 +142,15 @@ disk = [ 'file:/var/lib/xen/images/disk. - # Device Model to be used - device_model = 'qemu-dm' - -+# the amount of memory in MiB for the guest -+#actmem=42 -+ -+# Optional: guest page file -+#xenpaging_file="/var/lib/xen/xenpaging/..paging" -+ -+# Optional: extra cmdline options for xenpaging -+#xenpaging_extra=[ 'string', 'string' ] -+ - #----------------------------------------------------------------------------- - # boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d) - # default: hard disk, cd-rom, floppy -Index: xen-4.1.2-testing/tools/python/README.XendConfig -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/README.XendConfig -+++ xen-4.1.2-testing/tools/python/README.XendConfig -@@ -120,6 +120,9 @@ otherConfig - image.vncdisplay - image.vncunused - image.hvm.device_model -+ image.hvm.actmem -+ image.hvm.xenpaging_file -+ image.hvm.xenpaging_extra - image.hvm.display - image.hvm.xauthority - image.hvm.vncconsole -Index: xen-4.1.2-testing/tools/python/README.sxpcfg -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/README.sxpcfg -+++ xen-4.1.2-testing/tools/python/README.sxpcfg -@@ -51,6 +51,9 @@ image - - vncunused - (HVM) - - device_model -+ - actmem -+ - xenpaging_file -+ - xenpaging_extra - - display - - xauthority - - vncconsole -Index: xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py -@@ -147,6 +147,9 @@ XENAPI_PLATFORM_CFG_TYPES = { - 'apic': int, - 'boot': str, - 'device_model': str, -+ 'actmem': str, -+ 'xenpaging_file': str, -+ 'xenpaging_extra': str, - 'loader': str, - 'display' : str, - 'fda': str, -@@ -516,6 +519,12 @@ class XendConfig(dict): - self['platform']['nomigrate'] = 0 - - if self.is_hvm(): -+ if 'actmem' not in self['platform']: -+ self['platform']['actmem'] = "0" -+ if 'xenpaging_file' not in self['platform']: -+ self['platform']['xenpaging_file'] = "" -+ if 'xenpaging_extra' not in self['platform']: -+ self['platform']['xenpaging_extra'] = [] - if 'timer_mode' not in self['platform']: - self['platform']['timer_mode'] = 1 - if 'extid' in self['platform'] and int(self['platform']['extid']) == 1: -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomain.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomain.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomain.py -@@ -2022,6 +2022,21 @@ class XendDomain: - log.exception(ex) - raise XendError(str(ex)) - -+ def domain_swaptarget_set(self, domid, mem): -+ """Set the memory limit for a domain. -+ -+ @param domid: Domain ID or Name -+ @type domid: int or string. -+ @param mem: memory limit (in MiB) -+ @type mem: int -+ @raise XendError: fail to set memory -+ @rtype: 0 -+ """ -+ dominfo = self.domain_lookup_nr(domid) -+ if not dominfo: -+ raise XendInvalidDomain(str(domid)) -+ dominfo.setSwapTarget(mem) -+ - def domain_maxmem_set(self, domid, mem): - """Set the memory limit for a domain. - -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1503,6 +1503,17 @@ class XendDomainInfo: - break - xen.xend.XendDomain.instance().managed_config_save(self) - -+ def setSwapTarget(self, target): -+ """Set the swap target of this domain. -+ @param target: In MiB. -+ """ -+ log.debug("Setting swap target of domain %s (%s) to %d MiB.", -+ self.info['name_label'], str(self.domid), target) -+ -+ if self.domid > 0: -+ self.storeDom("memory/target-tot_pages", target * 1024) -+ self.info['platform']['actmem'] = str(target) -+ - def setMemoryTarget(self, target): - """Set the memory target of this domain. - @param target: In MiB. -@@ -2293,6 +2304,8 @@ class XendDomainInfo: - self.info['name_label'], self.domid, self.info['uuid'], - new_name, new_uuid) - self._unwatchVm() -+ if self.image: -+ self.image.destroyXenPaging() - self._releaseDevices() - # Remove existing vm node in xenstore - self._removeVm() -@@ -2967,6 +2980,9 @@ class XendDomainInfo: - - self._createDevices() - -+ if self.image: -+ self.image.createXenPaging() -+ - self.image.cleanupTmpImages() - - self.info['start_time'] = time.time() -@@ -2991,6 +3007,8 @@ class XendDomainInfo: - self.refresh_shutdown_lock.acquire() - try: - self.unwatchShutdown() -+ if self.image: -+ self.image.destroyXenPaging() - self._releaseDevices() - bootloader_tidy(self) - -@@ -3075,6 +3093,7 @@ class XendDomainInfo: - self.image = image.create(self, self.info) - if self.image: - self._createDevices(True) -+ self.image.createXenPaging() - self.console_port = console_port - self._storeDomDetails() - self._registerWatches() -@@ -3216,6 +3235,8 @@ class XendDomainInfo: - # could also fetch a parsed note from xenstore - fast = self.info.get_notes().get('SUSPEND_CANCEL') and 1 or 0 - if not fast: -+ if self.image: -+ self.image.destroyXenPaging() - self._releaseDevices() - self.testDeviceComplete() - self.testvifsComplete() -@@ -3231,6 +3252,8 @@ class XendDomainInfo: - self._storeDomDetails() - - self._createDevices() -+ if self.image: -+ self.image.createXenPaging() - log.debug("XendDomainInfo.resumeDomain: devices created") - - xc.domain_resume(self.domid, fast) -Index: xen-4.1.2-testing/tools/python/xen/xend/image.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/image.py -+++ xen-4.1.2-testing/tools/python/xen/xend/image.py -@@ -122,6 +122,10 @@ class ImageHandler: - self.vm.permissionsVm("image/cmdline", { 'dom': self.vm.getDomid(), 'read': True } ) - - self.device_model = vmConfig['platform'].get('device_model') -+ self.actmem = str(vmConfig['platform'].get('actmem')) -+ self.xenpaging_file = str(vmConfig['platform'].get('xenpaging_file')) -+ self.xenpaging_extra = vmConfig['platform'].get('xenpaging_extra') -+ self.xenpaging_pid = None - - self.display = vmConfig['platform'].get('display') - self.xauthority = vmConfig['platform'].get('xauthority') -@@ -392,6 +396,87 @@ class ImageHandler: - sentinel_fifos_inuse[sentinel_path_fifo] = 1 - self.sentinel_path_fifo = sentinel_path_fifo - -+ def createXenPaging(self): -+ if not self.vm.info.is_hvm(): -+ return -+ if self.actmem == "0": -+ return -+ if self.xenpaging_pid: -+ return -+ xenpaging_bin = auxbin.pathTo("xenpaging") -+ args = [xenpaging_bin] -+ args = args + ([ "-f", "/var/lib/xen/xenpaging/%s.%d.paging" % (str(self.vm.info['name_label']), self.vm.getDomid())]) -+ if self.xenpaging_extra: -+ args = args + (self.xenpaging_extra) -+ args = args + ([ "-d", "%d" % self.vm.getDomid()]) -+ self.xenpaging_logfile = "/var/log/xen/xenpaging-%s.log" % str(self.vm.info['name_label']) -+ logfile_mode = os.O_WRONLY|os.O_CREAT|os.O_APPEND|os.O_TRUNC -+ null = os.open("/dev/null", os.O_RDONLY) -+ try: -+ os.unlink(self.xenpaging_logfile) -+ except: -+ pass -+ logfd = os.open(self.xenpaging_logfile, logfile_mode, 0644) -+ sys.stderr.flush() -+ contract = osdep.prefork("%s:%d" % (self.vm.getName(), self.vm.getDomid())) -+ xenpaging_pid = os.fork() -+ if xenpaging_pid == 0: #child -+ try: -+ osdep.postfork(contract) -+ os.dup2(null, 0) -+ os.dup2(logfd, 1) -+ os.dup2(logfd, 2) -+ try: -+ env = dict(os.environ) -+ log.info("starting %s" % args) -+ os.execve(xenpaging_bin, args, env) -+ except Exception, e: -+ log.warn('failed to execute xenpaging: %s' % utils.exception_string(e)) -+ os._exit(126) -+ except: -+ log.warn("starting xenpaging failed") -+ os._exit(127) -+ else: -+ osdep.postfork(contract, abandon=True) -+ self.xenpaging_pid = xenpaging_pid -+ os.close(null) -+ os.close(logfd) -+ self.vm.storeDom("xenpaging/xenpaging-pid", self.xenpaging_pid) -+ self.vm.storeDom("memory/target-tot_pages", int(self.actmem) * 1024) -+ -+ def destroyXenPaging(self): -+ if self.actmem == "0": -+ return -+ if self.xenpaging_pid: -+ try: -+ os.kill(self.xenpaging_pid, signal.SIGHUP) -+ except OSError, exn: -+ log.exception(exn) -+ for i in xrange(100): -+ try: -+ (p, rv) = os.waitpid(self.xenpaging_pid, os.WNOHANG) -+ if p == self.xenpaging_pid: -+ break -+ except OSError: -+ # This is expected if Xend has been restarted within -+ # the life of this domain. In this case, we can kill -+ # the process, but we can't wait for it because it's -+ # not our child. We continue this loop, and after it is -+ # terminated make really sure the process is going away -+ # (SIGKILL). -+ pass -+ time.sleep(0.1) -+ else: -+ log.warning("xenpaging %d took more than 10s " -+ "to terminate: sending SIGKILL" % self.xenpaging_pid) -+ try: -+ os.kill(self.xenpaging_pid, signal.SIGKILL) -+ os.waitpid(self.xenpaging_pid, 0) -+ except OSError: -+ # This happens if the process doesn't exist. -+ pass -+ self.xenpaging_pid = None -+ - def createDeviceModel(self, restore = False): - if self.device_model is None: - return -Index: xen-4.1.2-testing/tools/python/xen/xm/create.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.1.2-testing/tools/python/xen/xm/create.py -@@ -495,6 +495,18 @@ gopts.var('nfs_root', val="PATH", - fn=set_value, default=None, - use="Set the path of the root NFS directory.") - -+gopts.var('actmem', val='NUM', -+ fn=set_value, default='0', -+ use="Number of pages to swap.") -+ -+gopts.var('xenpaging_file', val='PATH', -+ fn=set_value, default=None, -+ use="pagefile to use (optional)") -+ -+gopts.var('xenpaging_extra', val='string1,string2', -+ fn=append_value, default=[], -+ use="additional args for xenpaging (optional)") -+ - gopts.var('device_model', val='FILE', - fn=set_value, default=None, - use="Path to device model program.") -@@ -1095,6 +1107,9 @@ def configure_hvm(config_image, vals): - args = [ 'acpi', 'apic', - 'boot', - 'cpuid', 'cpuid_check', -+ 'actmem', -+ 'xenpaging_file', -+ 'xenpaging_extra', - 'device_model', 'display', - 'fda', 'fdb', - 'gfx_passthru', 'guest_os_type', -Index: xen-4.1.2-testing/tools/python/xen/xm/main.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.1.2-testing/tools/python/xen/xm/main.py -@@ -115,6 +115,8 @@ SUBCOMMAND_HELP = { - 'Set the maximum amount reservation for a domain.'), - 'mem-set' : (' ', - 'Set the current memory usage for a domain.'), -+ 'mem-swap-target' : (' ', -+ 'Set the memory usage for a domain.'), - 'migrate' : (' ', - 'Migrate a domain to another machine.'), - 'pause' : ('', 'Pause execution of a domain.'), -@@ -1667,6 +1669,17 @@ def xm_mem_set(args): - mem_target = int_unit(args[1], 'm') - server.xend.domain.setMemoryTarget(dom, mem_target) - -+def xm_mem_swap_target(args): -+ arg_check(args, "mem-swap-target", 2) -+ -+ dom = args[0] -+ -+ if serverType == SERVER_XEN_API: -+ err("xenapi not supported") -+ else: -+ swap_target = int_unit(args[1], 'm') -+ server.xend.domain.swaptarget_set(dom, swap_target) -+ - def xm_usb_add(args): - arg_check(args, "usb-add", 2) - server.xend.domain.usb_add(args[0],args[1]) -@@ -3926,6 +3939,7 @@ commands = { - # memory commands - "mem-max": xm_mem_max, - "mem-set": xm_mem_set, -+ "mem-swap-target": xm_mem_swap_target, - # cpu commands - "vcpu-pin": xm_vcpu_pin, - "vcpu-list": xm_vcpu_list, -Index: xen-4.1.2-testing/tools/python/xen/xm/xenapi_create.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/xenapi_create.py -+++ xen-4.1.2-testing/tools/python/xen/xm/xenapi_create.py -@@ -1085,6 +1085,9 @@ class sxp2xml: - 'acpi', - 'apic', - 'boot', -+ 'actmem', -+ 'xenpaging_file', -+ 'xenpaging_extra', - 'device_model', - 'loader', - 'fda', diff --git a/xenpaging.doc.patch b/xenpaging.doc.patch deleted file mode 100644 index e304325..0000000 --- a/xenpaging.doc.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- - docs/misc/xenpaging.txt | 66 +++++++++++++++++++++++++++++------------------- - 1 file changed, 40 insertions(+), 26 deletions(-) - -Index: xen-4.1.2-testing/docs/misc/xenpaging.txt -=================================================================== ---- xen-4.1.2-testing.orig/docs/misc/xenpaging.txt -+++ xen-4.1.2-testing/docs/misc/xenpaging.txt -@@ -1,8 +1,6 @@ - Warning: - - The xenpaging code is new and not fully debugged. --Usage of xenpaging can crash Xen or cause severe data corruption in the --guest memory and its filesystems! - - Description: - -@@ -14,34 +12,50 @@ than physically available on the host. - - Usage: - --Once the guest is running, run xenpaging with the guest_id and the --number of pages to page-out: -+To enable xenpaging for a guest add the option 'actmem=' to the guests -+config file and run 'xm new ' to make the changes -+active. actmem= takes the amount of memory in MB which a guest is -+allowed to use at a given time. Everything above this limit will be -+paged out. This paging is transparent to the guest. -+ -+Example: -+ memory=4096 -+ actmem=1024 -+In this example a guest gets the impression it has 4GB of memory and -+the guest OS has to configure itself for this amount of memory. But -+xenpaging will page-out 3072MB, leaving only 1024MB active at a time. -+ -+At runtime the configured value of actmem= can be changed with the "xm -+mem-swap-target" command. -+ xm mem-swap-target 512 -+ -+Additional cmdline options for the xenpaging binary can be specified -+with the xenpaging_extra= config file option: -+ -+ xenpaging_extra=[ '-f', '/dev/shm/pagefile-guest_name', '-v' ] -+ -+To get a list of available options, run /usr/lib/xen/bin/xenpaging -h: -+ -+ xenpaging [options] -f -d -+ -+options: -+ -d --domain= numerical domain_id of guest. This option is required. -+ -f --pagefile= pagefile to use. This option is required. -+ -m --max_memkb= maximum amount of memory to handle. -+ -r --mru_size= number of paged-in pages to keep in memory. -+ -v --verbose enable debug output. -+ -h --help this output. -+ -+ -+Caveats: -+Live migration with a paged guest does currently not work, the guest -+will crash once it starts on the target host. As a workaround stop -+paging before starting the migration: - -- chdir /var/lib/xen/xenpaging -- xenpaging -- --To obtain the guest_id, run 'xm list'. --xenpaging will write the pagefile to the current directory. --Example with 128MB pagefile on guest 1: -- -- xenpaging 1 32768 -- --Caution: stopping xenpaging manually will cause the guest to stall or --crash because the paged-out memory is not written back into the guest! -- --After a reboot of a guest, its guest_id changes, the current xenpaging --binary has no target anymore. To automate restarting of xenpaging after --guest reboot, specify the number if pages in the guest configuration --file /etc/xen/vm/: -- --xenpaging=32768 -- --Redo the guest with 'xm create /etc/xen/vm/' to activate the --changes. -+xm mem-swap-target 0 && xm migrate -l - - - Todo: --- implement stopping of xenpaging - - implement/test live migration - - diff --git a/xenpaging.error-handling.patch b/xenpaging.error-handling.patch deleted file mode 100644 index 14fb29e..0000000 --- a/xenpaging.error-handling.patch +++ /dev/null @@ -1,189 +0,0 @@ -# HG changeset patch -# Parent 5a299906312e606553e6dd2acbe44ab692722a75 -xenpaging: improve evict error handling - -Adjust return codes in Xen and handle errors in evict_victim() properly. - -p2m_mem_paging_nominate() returns -EAGAIN, p2m_mem_paging_evict() -returns -EBUSY. Other errors indicate guest failures, which -xenpaging_evict_page() can now catch correctly. Also write() failures -are fatal. - -Without this change, evict_victim() may spin forever if the guest is -killed because this function does not get a signal. - -Signed-off-by: Olaf Hering - ---- - tools/xenpaging/xenpaging.c | 47 ++++++++++++++++++++++++++--------------- - xen/arch/x86/mm/p2m.c | 7 +----- - xen/include/public/mem_event.h | 2 - - 3 files changed, 33 insertions(+), 23 deletions(-) - -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c -@@ -569,29 +569,35 @@ static int xenpaging_evict_page(xenpagin - xc_interface *xch = paging->xc_handle; - void *page; - unsigned long gfn; -- int ret; -+ int ret = -1; - - DECLARE_DOMCTL; - - /* Map page to get a handle */ - gfn = victim->gfn; -- ret = -EFAULT; - page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, - PROT_READ | PROT_WRITE, &gfn, 1); - if ( page == NULL ) - { -- PERROR("Error mapping page %lx", victim->gfn); -+ if ( errno == EINVAL ) -+ ret = 1; -+ else -+ PERROR("Error mapping page %lx", victim->gfn); - goto out; - } - - /* Nominate the page */ -- ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn); -- if ( ret != 0 ) -+ if ( xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn) ) -+ { -+ if ( errno == EAGAIN ) -+ ret = 1; -+ else -+ PERROR("Error nominating page %lx", victim->gfn); - goto out; -+ } - - /* Copy page */ -- ret = write_page(fd, page, i); -- if ( ret != 0 ) -+ if ( write_page(fd, page, i) ) - { - PERROR("Error copying page %lx", victim->gfn); - goto out; -@@ -601,10 +607,10 @@ static int xenpaging_evict_page(xenpagin - page = NULL; - - /* Tell Xen to evict page */ -- ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id, -- victim->gfn); -- if ( ret != 0 ) -+ if ( xc_mem_paging_evict(xch, paging->mem_event.domain_id, victim->gfn) ) - { -+ if ( errno == EBUSY ) -+ ret = 1; - PERROR("Error evicting page %lx", victim->gfn); - goto out; - } -@@ -616,6 +622,8 @@ static int xenpaging_evict_page(xenpagin - /* Record number of evicted pages */ - paging->num_paged_out++; - -+ ret = 0; -+ - out: - if (page) - munmap(page, PAGE_SIZE); -@@ -724,7 +732,7 @@ static int evict_victim(xenpaging_t *pag - xenpaging_victim_t *victim, int fd, int i) - { - xc_interface *xch = paging->xc_handle; -- int j = 0; -+ static int num_paged_out; - int ret; - - do -@@ -732,9 +740,13 @@ static int evict_victim(xenpaging_t *pag - ret = policy_choose_victim(paging, victim); - if ( ret != 0 ) - { -- if ( ret != -ENOSPC ) -- ERROR("Error choosing victim"); -- goto out; -+ if ( num_paged_out != paging->num_paged_out ) { -+ DPRINTF("Flushing qemu cache\n"); -+ xenpaging_mem_paging_flush_ioemu_cache(paging); -+ num_paged_out = paging->num_paged_out; -+ } -+ ret = -ENOSPC; -+ goto out; - } - - if ( interrupted ) -@@ -742,11 +754,12 @@ static int evict_victim(xenpaging_t *pag - ret = -EINTR; - goto out; - } -+ - ret = xenpaging_evict_page(paging, victim, fd, i); -- if ( ret && j++ % 1000 == 0 ) -+ if ( ret < 0 ) - { -- if ( xenpaging_mem_paging_flush_ioemu_cache(paging) ) -- PERROR("Error flushing ioemu cache"); -+ ret = -EINTR; -+ goto out; - } - } - while ( ret ); -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2865,19 +2865,17 @@ int p2m_mem_paging_nominate(struct p2m_d - p2m_type_t p2mt; - p2m_access_t a; - mfn_t mfn; -- int ret; -+ int ret = -EAGAIN; - - p2m_lock(p2m); - - mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - - /* Check if mfn is valid */ -- ret = -EINVAL; - if ( !mfn_valid(mfn) ) - goto out; - - /* Check p2m type */ -- ret = -EAGAIN; - if ( !p2m_is_pageable(p2mt) ) - goto out; - -@@ -2930,7 +2928,7 @@ int p2m_mem_paging_evict(struct p2m_doma - p2m_access_t a; - mfn_t mfn; - struct domain *d = p2m->domain; -- int ret = -EINVAL; -+ int ret = -EBUSY; - - p2m_lock(p2m); - -@@ -2943,7 +2941,6 @@ int p2m_mem_paging_evict(struct p2m_doma - if ( p2mt != p2m_ram_paging_out ) - goto out; - -- ret = -EBUSY; - /* Get the page so it doesn't get modified under Xen's feet */ - page = mfn_to_page(mfn); - if ( unlikely(!get_page(page, d)) ) -Index: xen-4.1.3-testing/xen/include/public/mem_event.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/mem_event.h -+++ xen-4.1.3-testing/xen/include/public/mem_event.h -@@ -49,7 +49,7 @@ - #define MEM_EVENT_REASON_INT3 5 /* int3 was hit: gla/gfn are RIP */ - #define MEM_EVENT_REASON_SINGLESTEP 6 /* single step was invoked: gla/gfn are RIP */ - --#define MEM_EVENT_PAGING_AGE 2UL /* Number distinguish the mem_paging <-> pager interface */ -+#define MEM_EVENT_PAGING_AGE 3UL /* Number distinguish the mem_paging <-> pager interface */ - - typedef struct mem_event_shared_page { - uint32_t port; diff --git a/xenpaging.evict_fail_fast_forward.patch b/xenpaging.evict_fail_fast_forward.patch deleted file mode 100644 index adbc4d3..0000000 --- a/xenpaging.evict_fail_fast_forward.patch +++ /dev/null @@ -1,59 +0,0 @@ -# HG changeset patch -# Parent 00989d5f44b59ba7f3a467342a14b9c7621fa926 -xenpaging: restore p2mt if gfn is needed before evict - -In the rare case that a gfn is needed by a guest or a foreign domain -between nominate and evict, restore the p2mt and skip sending a request. -A request is not needed because the pager will notice the evict failure. - -Signed-off-by: Olaf Hering - ---- - xen/arch/x86/mm/p2m.c | 18 +++++++++++------- - 1 file changed, 11 insertions(+), 7 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -3038,6 +3038,7 @@ void p2m_mem_paging_populate(struct p2m_ - p2m_type_t p2mt; - p2m_access_t a; - mfn_t mfn; -+ int restored = 0; - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -@@ -3053,23 +3054,25 @@ void p2m_mem_paging_populate(struct p2m_ - /* Allow only nominated or evicted pages to enter page-in path */ - if ( p2m_do_populate(p2mt) ) - { -- /* Evict will fail now, tag this request for pager */ -- if ( p2mt == p2m_ram_paging_out ) -- req.flags |= MEM_EVENT_FLAG_EVICT_FAIL; -- -- set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in_start, a); -+ /* Restore page state if gfn was requested before evict */ -+ if ( p2mt == p2m_ram_paging_out && mfn_valid(mfn) ) { -+ set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_rw, a); -+ restored = 1; -+ } else { -+ set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in_start, a); -+ } - audit_p2m(p2m, 1); - } - p2m_unlock(p2m); - - /* Pause domain if request came from guest and gfn has paging type */ -- if ( p2m_is_paging(p2mt) && v->domain == d ) -+ if ( !restored && p2m_is_paging(p2mt) && v->domain == d ) - { - vcpu_pause_nosync(v); - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; - } - /* No need to inform pager if the gfn is not in the page-out path */ -- else if ( !p2m_do_populate(p2mt) ) -+ else if ( restored || !p2m_do_populate(p2mt) ) - { - /* gfn is already on its way back and vcpu is not paused */ - mem_event_put_req_producers(&d->mem_event->paging); diff --git a/xenpaging.evict_mmap_readonly.patch b/xenpaging.evict_mmap_readonly.patch deleted file mode 100644 index 2a1bbac..0000000 --- a/xenpaging.evict_mmap_readonly.patch +++ /dev/null @@ -1,20 +0,0 @@ -xenpaging: mmap gfn to evict in readonly mode - -nominate/evict will not modify the page so there is no need to map the page rw. - ---- - tools/xenpaging/xenpaging.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/tools/xenpaging/xenpaging.c -+++ b/tools/xenpaging/xenpaging.c -@@ -575,8 +575,7 @@ static int xenpaging_evict_page(xenpagin - - /* Map page to get a handle */ - gfn = victim->gfn; -- page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, -- PROT_READ | PROT_WRITE, &gfn, 1); -+ page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, PROT_READ, &gfn, 1); - if ( page == NULL ) - { - if ( errno == EINVAL ) diff --git a/xenpaging.guest-memusage.patch b/xenpaging.guest-memusage.patch deleted file mode 100644 index 807003a..0000000 --- a/xenpaging.guest-memusage.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- - tools/xenpaging/Makefile | 2 - - tools/xenpaging/xenmem.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 58 insertions(+), 1 deletion(-) - -Index: xen-4.1.2-testing/tools/xenpaging/Makefile -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/Makefile -+++ xen-4.1.2-testing/tools/xenpaging/Makefile -@@ -20,7 +20,7 @@ CFLAGS += -Wp,-MD,.$(@F).d - DEPS = .*.d - - OBJS = $(SRCS:.c=.o) --IBINS = xenpaging -+IBINS = xenpaging xenmem - - all: $(IBINS) - -Index: xen-4.1.2-testing/tools/xenpaging/xenmem.c -=================================================================== ---- /dev/null -+++ xen-4.1.2-testing/tools/xenpaging/xenmem.c -@@ -0,0 +1,57 @@ -+#include -+#include -+ -+static void dump_mem(const char *domid) -+{ -+ xc_interface *xch; -+ xc_dominfo_t info; -+ unsigned char handle[16]; -+ char uuid[16 * 2 + 1]; -+ int i; -+ -+ xch = xc_interface_open(NULL, NULL, 0); -+ if (!xch) -+ perror("xc_interface_open"); -+ else { -+ i = xc_domain_getinfo(xch, atoi(domid), 1, &info); -+ if (i != 1) -+ perror("xc_domain_getinfo"); -+ else { -+ printf("domid\t%u\n", info.domid); -+ printf("ssidref\t%u\n", info.ssidref); -+ printf("dying\t%u\n", info.dying); -+ printf("crashed\t%u\n", info.crashed); -+ printf("shutdown\t%u\n", info.shutdown); -+ printf("paused\t%u\n", info.paused); -+ printf("blocked\t%u\n", info.blocked); -+ printf("running\t%u\n", info.running); -+ printf("hvm\t%u\n", info.hvm); -+ printf("debugged\t%u\n", info.debugged); -+ printf("shutdown_reason\t%u\n", info.shutdown_reason); -+ printf("nr_pages\t%lu\t%lu KiB\t%lu MiB\n", info.nr_pages, info.nr_pages * 4, info.nr_pages * 4 / 1024); -+ printf("nr_shared_pages\t%lu\t%lu KiB\t%lu MiB\n", info.nr_shared_pages, info.nr_shared_pages * 4, info.nr_shared_pages * 4 / 1024); -+ printf("nr_paged_pages\t%lu\t%lu KiB\t%lu MiB\n", info.nr_paged_pages, info.nr_paged_pages * 4, info.nr_paged_pages * 4 / 1024); -+ printf("max_memkb\t%lu KiB\t%lu MiB\n", info.max_memkb, info.max_memkb / 1024); -+ printf("shared_info_frame\t%lu\t%lx\n", info.shared_info_frame, info.shared_info_frame); -+ printf("cpu_time\t%llu\t%016llx\n", (unsigned long long)info.cpu_time, (unsigned long long)info.cpu_time); -+ printf("nr_online_vcpus\t%u\n", info.nr_online_vcpus); -+ printf("max_vcpu_id\t%u\n", info.max_vcpu_id); -+ printf("cpupool\t%u\n", info.cpupool); -+ -+ memcpy(&handle, &info.handle, sizeof(handle)); -+ uuid[0] = '\0'; -+ for (i = 0; i < sizeof(handle); i++) -+ snprintf(&uuid[i * 2], sizeof(uuid) - strlen(uuid), "%02x", handle[i]); -+ printf("handle\t%s\n", uuid); -+ } -+ if (xc_interface_close(xch) < 0) -+ perror("xc_interface_close"); -+ } -+} -+ -+int main(int argc, char **argv) -+{ -+ if (argv[1]) -+ dump_mem(argv[1]); -+ return 0; -+} diff --git a/xenpaging.mem_event-use-wait_queue.patch b/xenpaging.mem_event-use-wait_queue.patch deleted file mode 100644 index d1946aa..0000000 --- a/xenpaging.mem_event-use-wait_queue.patch +++ /dev/null @@ -1,571 +0,0 @@ -# HG changeset patch -# Parent aa97fafb53fc95aaec8d9890635d14304f24c362 -mem_event: use wait queue when ring is full - -This change is based on an idea/patch from Adin Scannell. - -If the ring is full, put the current vcpu to sleep if it belongs to the -target domain. The wakeup happens in the p2m_*_resume functions. Wakeup -will take the number of free slots into account. - -A request from foreign domain has to succeed once a slot was claimed -because such vcpus can not sleep. - -This change fixes also a bug in p2m_mem_paging_drop_page(). Up to now a -full ring will lead to harmless inconsistency in the pager. - -v6: - - take foreign requests into account before calling wake_up_nr() - - call wake_up_nr() outside of ring lock - - rename ->bit to ->pause_flag - -v5: - - rename mem_event_check_ring() to mem_event_claim_slot() - - rename mem_event_put_req_producers() to mem_event_release_slot() - - add local/foreign request accounting - - keep room for at least one guest request - -v4: - - fix off-by-one bug in _mem_event_put_request - - add mem_event_wake_requesters() and use wake_up_nr() - - rename mem_event_mark_and_pause() and mem_event_mark_and_pause() functions - - req_producers counts foreign request producers, rename member - -v3: - - rename ->mem_event_bit to ->bit - - remove me_ from new VPF_ defines - -v2: - - p2m_mem_paging_populate: move vcpu_pause after put_request, otherwise the - vcpu will not wake_up after a wait_event because the pause_count was - increased twice. Fixes guest hangs. - - update free space check in _mem_event_put_request() - - simplify mem_event_put_request() - -Signed-off-by: Olaf Hering - ---- - xen/arch/x86/hvm/hvm.c | 4 - - xen/arch/x86/mm/mem_event.c | 147 ++++++++++++++++++++++++++++++++++------ - xen/arch/x86/mm/mem_sharing.c | 46 ++++-------- - xen/arch/x86/mm/p2m.c | 36 ++++----- - xen/include/asm-x86/mem_event.h | 10 +- - xen/include/xen/sched.h | 17 +++- - 6 files changed, 179 insertions(+), 81 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -4049,8 +4049,8 @@ static int hvm_memory_event_traps(long p - if ( (p & HVMPME_onchangeonly) && (value == old) ) - return 1; - -- rc = mem_event_check_ring(d, &d->mem_event->access); -- if ( rc ) -+ rc = mem_event_claim_slot(d, &d->mem_event->access); -+ if ( rc < 0 ) - return rc; - - memset(&req, 0, sizeof(req)); -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c -@@ -23,6 +23,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -39,6 +40,7 @@ - - static int mem_event_enable(struct domain *d, - xen_domctl_mem_event_op_t *mec, -+ int pause_flag, - struct mem_event_domain *med) - { - int rc; -@@ -94,8 +96,12 @@ static int mem_event_enable(struct domai - - mem_event_ring_lock_init(med); - -+ med->pause_flag = pause_flag; -+ -+ init_waitqueue_head(&med->wq); -+ - /* Wake any VCPUs paused for memory events */ -- mem_event_unpause_vcpus(d); -+ mem_event_wake_waiters(d, med); - - return 0; - -@@ -111,6 +117,9 @@ static int mem_event_enable(struct domai - - static int mem_event_disable(struct mem_event_domain *med) - { -+ if (!list_empty(&med->wq.list)) -+ return -EBUSY; -+ - unmap_domain_page(med->ring_page); - med->ring_page = NULL; - -@@ -120,13 +129,24 @@ static int mem_event_disable(struct mem_ - return 0; - } - --void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req) -+static int _mem_event_put_request(struct domain *d, -+ struct mem_event_domain *med, -+ mem_event_request_t *req) - { - mem_event_front_ring_t *front_ring; -+ int free_req, claimed_req; - RING_IDX req_prod; - - mem_event_ring_lock(med); - -+ free_req = RING_FREE_REQUESTS(&med->front_ring); -+ /* Foreign requests must succeed because their vcpus can not sleep */ -+ claimed_req = med->foreign_producers; -+ if ( !free_req || ( current->domain == d && free_req <= claimed_req ) ) { -+ mem_event_ring_unlock(med); -+ return 0; -+ } -+ - front_ring = &med->front_ring; - req_prod = front_ring->req_prod_pvt; - -@@ -134,14 +154,35 @@ void mem_event_put_request(struct domain - memcpy(RING_GET_REQUEST(front_ring, req_prod), req, sizeof(*req)); - req_prod++; - -+ /* Update accounting */ -+ if ( current->domain == d ) -+ med->target_producers--; -+ else -+ med->foreign_producers--; -+ - /* Update ring */ -- med->req_producers--; - front_ring->req_prod_pvt = req_prod; - RING_PUSH_REQUESTS(front_ring); - - mem_event_ring_unlock(med); - - notify_via_xen_event_channel(d, med->xen_port); -+ -+ return 1; -+} -+ -+void mem_event_put_request(struct domain *d, struct mem_event_domain *med, -+ mem_event_request_t *req) -+{ -+ /* Go to sleep if request came from guest */ -+ if (current->domain == d) { -+ wait_event(med->wq, _mem_event_put_request(d, med, req)); -+ return; -+ } -+ /* Ring was full anyway, unable to sleep in non-guest context */ -+ if (!_mem_event_put_request(d, med, req)) -+ printk("Failed to put memreq: d %u t %x f %x gfn %lx\n", d->domain_id, -+ req->type, req->flags, (unsigned long)req->gfn); - } - - void mem_event_get_response(struct mem_event_domain *med, mem_event_response_t *rsp) -@@ -165,32 +206,97 @@ void mem_event_get_response(struct mem_e - mem_event_ring_unlock(med); - } - --void mem_event_unpause_vcpus(struct domain *d) -+/** -+ * mem_event_wake_requesters - Wake vcpus waiting for room in the ring -+ * @d: guest domain -+ * @med: mem_event ring -+ * -+ * mem_event_wake_requesters() will wakeup vcpus waiting for room in the -+ * ring. Only as many as can place another request in the ring will -+ * resume execution. -+ */ -+void mem_event_wake_requesters(struct mem_event_domain *med) -+{ -+ int free_req; -+ -+ mem_event_ring_lock(med); -+ free_req = RING_FREE_REQUESTS(&med->front_ring); -+ free_req -= med->foreign_producers; -+ mem_event_ring_unlock(med); -+ -+ if ( free_req ) -+ wake_up_nr(&med->wq, free_req); -+} -+ -+/** -+ * mem_event_wake_waiters - Wake all vcpus waiting for the ring -+ * @d: guest domain -+ * @med: mem_event ring -+ * -+ * mem_event_wake_waiters() will wakeup all vcpus waiting for the ring to -+ * become available. -+ */ -+void mem_event_wake_waiters(struct domain *d, struct mem_event_domain *med) - { - struct vcpu *v; - - for_each_vcpu ( d, v ) -- if ( test_and_clear_bit(_VPF_mem_event, &v->pause_flags) ) -+ if ( test_and_clear_bit(med->pause_flag, &v->pause_flags) ) - vcpu_wake(v); - } - --void mem_event_mark_and_pause(struct vcpu *v) -+/** -+ * mem_event_mark_and_sleep - Put vcpu to sleep -+ * @v: guest vcpu -+ * @med: mem_event ring -+ * -+ * mem_event_mark_and_sleep() tags vcpu and put it to sleep. -+ * The vcpu will resume execution in mem_event_wake_waiters(). -+ */ -+void mem_event_mark_and_sleep(struct vcpu *v, struct mem_event_domain *med) - { -- set_bit(_VPF_mem_event, &v->pause_flags); -+ set_bit(med->pause_flag, &v->pause_flags); - vcpu_sleep_nosync(v); - } - --void mem_event_put_req_producers(struct mem_event_domain *med) -+/** -+ * mem_event_release_slot - Release a claimed slot -+ * @med: mem_event ring -+ * -+ * mem_event_release_slot() releases a claimed slot in the mem_event ring. -+ */ -+void mem_event_release_slot(struct domain *d, struct mem_event_domain *med) - { - mem_event_ring_lock(med); -- med->req_producers--; -+ if ( current->domain == d ) -+ med->target_producers--; -+ else -+ med->foreign_producers--; - mem_event_ring_unlock(med); - } - --int mem_event_check_ring(struct domain *d, struct mem_event_domain *med) -+/** -+ * mem_event_claim_slot - Check state of a mem_event ring -+ * @d: guest domain -+ * @med: mem_event ring -+ * -+ * Return codes: < 0: the ring is not yet configured -+ * 0: the ring has some room -+ * > 0: the ring is full -+ * -+ * mem_event_claim_slot() checks the state of the given mem_event ring. -+ * If the current vcpu belongs to the guest domain, the function assumes that -+ * mem_event_put_request() will sleep until the ring has room again. -+ * A guest can always place at least one request. -+ * -+ * If the current vcpu does not belong to the target domain the caller must try -+ * again until there is room. A slot is claimed and the caller can place a -+ * request. If the caller does not need to send a request, the claimed slot has -+ * to be released with mem_event_release_slot(). -+ */ -+int mem_event_claim_slot(struct domain *d, struct mem_event_domain *med) - { -- struct vcpu *curr = current; -- int free_requests; -+ int free_req; - int ring_full = 1; - - if ( !med->ring_page ) -@@ -198,16 +304,17 @@ int mem_event_check_ring(struct domain * - - mem_event_ring_lock(med); - -- free_requests = RING_FREE_REQUESTS(&med->front_ring); -- if ( med->req_producers < free_requests ) -+ free_req = RING_FREE_REQUESTS(&med->front_ring); -+ -+ if ( current->domain == d ) { -+ med->target_producers++; -+ ring_full = 0; -+ } else if ( med->foreign_producers + med->target_producers + 1 < free_req ) - { -- med->req_producers++; -+ med->foreign_producers++; - ring_full = 0; - } - -- if ( ring_full && (curr->domain == d) ) -- mem_event_mark_and_pause(curr); -- - mem_event_ring_unlock(med); - - return ring_full; -@@ -283,7 +390,7 @@ int mem_event_domctl(struct domain *d, x - break; - } - -- rc = mem_event_enable(d, mec, med); -+ rc = mem_event_enable(d, mec, _VPF_mem_paging, med); - } - break; - -@@ -322,7 +429,7 @@ int mem_event_domctl(struct domain *d, x - if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) - break; - -- rc = mem_event_enable(d, mec, med); -+ rc = mem_event_enable(d, mec, _VPF_mem_access, med); - } - break; - -Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c -@@ -292,44 +292,32 @@ static void mem_sharing_audit(void) - #endif - - --static struct page_info* mem_sharing_alloc_page(struct domain *d, -- unsigned long gfn, -- int must_succeed) -+static void mem_sharing_notify_helper(struct domain *d, unsigned long gfn) - { -- struct page_info* page; - struct vcpu *v = current; -- mem_event_request_t req; -+ mem_event_request_t req = { .type = MEM_EVENT_TYPE_SHARED }; - -- page = alloc_domheap_page(d, 0); -- if(page != NULL) return page; -- -- memset(&req, 0, sizeof(req)); -- req.type = MEM_EVENT_TYPE_SHARED; -- -- if(must_succeed) -- { -- /* We do not support 'must_succeed' any more. External operations such -- * as grant table mappings may fail with OOM condition! -- */ -- BUG(); -- } -- else -+ if ( v->domain != d ) - { -- /* All foreign attempts to unshare pages should be handled through -- * 'must_succeed' case. */ -- ASSERT(v->domain->domain_id == d->domain_id); -- vcpu_pause_nosync(v); -- req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; -+ /* XXX This path needs some attention. For now, just fail foreign -+ * XXX requests to unshare if there's no memory. This replaces -+ * XXX old code that BUG()ed here; the callers now BUG() -+ * XXX elewhere. */ -+ gdprintk(XENLOG_ERR, -+ "Failed alloc on unshare path for foreign (%d) lookup\n", -+ d->domain_id); -+ return; - } - -- if(mem_event_check_ring(d, &d->mem_event->share)) return page; -+ if (mem_event_claim_slot(d, &d->mem_event->share) < 0) -+ return; - -+ req.flags = MEM_EVENT_FLAG_VCPU_PAUSED; - req.gfn = gfn; - req.p2mt = p2m_ram_shared; - req.vcpu_id = v->vcpu_id; - mem_event_put_request(d, &d->mem_event->share, &req); -- -- return page; -+ vcpu_pause_nosync(v); - } - - unsigned int mem_sharing_get_nr_saved_mfns(void) -@@ -692,14 +680,14 @@ gfn_found: - if(ret == 0) goto private_page_found; - - old_page = page; -- page = mem_sharing_alloc_page(d, gfn, flags & MEM_SHARING_MUST_SUCCEED); -- BUG_ON(!page && (flags & MEM_SHARING_MUST_SUCCEED)); -+ page = alloc_domheap_page(d, 0); - if(!page) - { - /* We've failed to obtain memory for private page. Need to re-add the - * gfn_info to relevant list */ - list_add(&gfn_info->list, &hash_entry->gfns); - shr_unlock(); -+ mem_sharing_notify_helper(d, gfn); - return -ENOMEM; - } - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2990,21 +2990,13 @@ int p2m_mem_paging_evict(struct p2m_doma - */ - void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn) - { -- struct vcpu *v = current; -- mem_event_request_t req; -+ mem_event_request_t req = { .type = MEM_EVENT_TYPE_PAGING, .gfn = gfn }; - struct domain *d = p2m->domain; - -- /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d, &d->mem_event->paging) == 0) -- { -- /* Send release notification to pager */ -- memset(&req, 0, sizeof(req)); -- req.flags |= MEM_EVENT_FLAG_DROP_PAGE; -- req.gfn = gfn; -- req.vcpu_id = v->vcpu_id; -+ /* Send release notification to pager */ -+ req.flags = MEM_EVENT_FLAG_DROP_PAGE; - -- mem_event_put_request(d, &d->mem_event->paging, &req); -- } -+ mem_event_put_request(d, &d->mem_event->paging, &req); - } - - /** -@@ -3039,7 +3031,7 @@ void p2m_mem_paging_populate(struct p2m_ - struct domain *d = p2m->domain; - - /* Check that there's space on the ring for this request */ -- if ( mem_event_check_ring(d, &d->mem_event->paging) ) -+ if ( mem_event_claim_slot(d, &d->mem_event->paging) ) - return; - - memset(&req, 0, sizeof(req)); -@@ -3072,7 +3064,7 @@ void p2m_mem_paging_populate(struct p2m_ - else if ( restored || !p2m_do_populate(p2mt) ) - { - /* gfn is already on its way back and vcpu is not paused */ -- mem_event_put_req_producers(&d->mem_event->paging); -+ mem_event_release_slot(d, &d->mem_event->paging); - return; - } - -@@ -3212,8 +3204,8 @@ void p2m_mem_paging_resume(struct p2m_do - if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) - vcpu_unpause(d->vcpu[rsp.vcpu_id]); - -- /* Unpause any domains that were paused because the ring was full */ -- mem_event_unpause_vcpus(d); -+ /* Wake vcpus waiting for room in the ring */ -+ mem_event_wake_requesters(&d->mem_event->paging); - } - - void p2m_mem_access_check(paddr_t gpa, bool_t gla_valid, unsigned long gla, -@@ -3242,7 +3234,7 @@ void p2m_mem_access_check(paddr_t gpa, b - p2m_unlock(p2m); - - /* Otherwise, check if there is a memory event listener, and send the message along */ -- res = mem_event_check_ring(d, &d->mem_event->access); -+ res = mem_event_claim_slot(d, &d->mem_event->access); - if ( res < 0 ) - { - /* No listener */ -@@ -3252,7 +3244,7 @@ void p2m_mem_access_check(paddr_t gpa, b - "Memory access permissions failure, no mem_event listener: pausing VCPU %d, dom %d\n", - v->vcpu_id, d->domain_id); - -- mem_event_mark_and_pause(v); -+ mem_event_mark_and_sleep(v, &d->mem_event->access); - } - else - { -@@ -3302,9 +3294,11 @@ void p2m_mem_access_resume(struct p2m_do - if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) - vcpu_unpause(d->vcpu[rsp.vcpu_id]); - -- /* Unpause any domains that were paused because the ring was full or no listener -- * was available */ -- mem_event_unpause_vcpus(d); -+ /* Wake vcpus waiting for room in the ring */ -+ mem_event_wake_requesters(&d->mem_event->access); -+ -+ /* Unpause all vcpus that were paused because no listener was available */ -+ mem_event_wake_waiters(d, &d->mem_event->access); - } - #endif /* __x86_64__ */ - -Index: xen-4.1.3-testing/xen/include/asm-x86/mem_event.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/mem_event.h -+++ xen-4.1.3-testing/xen/include/asm-x86/mem_event.h -@@ -24,13 +24,13 @@ - #ifndef __MEM_EVENT_H__ - #define __MEM_EVENT_H__ - --/* Pauses VCPU while marking pause flag for mem event */ --void mem_event_mark_and_pause(struct vcpu *v); --int mem_event_check_ring(struct domain *d, struct mem_event_domain *med); --void mem_event_put_req_producers(struct mem_event_domain *med); -+int mem_event_claim_slot(struct domain *d, struct mem_event_domain *med); -+void mem_event_release_slot(struct domain *d, struct mem_event_domain *med); - void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req); - void mem_event_get_response(struct mem_event_domain *med, mem_event_response_t *rsp); --void mem_event_unpause_vcpus(struct domain *d); -+void mem_event_wake_requesters(struct mem_event_domain *med); -+void mem_event_wake_waiters(struct domain *d, struct mem_event_domain *med); -+void mem_event_mark_and_sleep(struct vcpu *v, struct mem_event_domain *med); - - int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec, - XEN_GUEST_HANDLE(void) u_domctl); -Index: xen-4.1.3-testing/xen/include/xen/sched.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/xen/sched.h -+++ xen-4.1.3-testing/xen/include/xen/sched.h -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #ifdef CONFIG_COMPAT - #include -@@ -190,7 +191,8 @@ struct mem_event_domain - { - /* ring lock */ - spinlock_t ring_lock; -- unsigned int req_producers; -+ unsigned short foreign_producers; -+ unsigned short target_producers; - /* shared page */ - mem_event_shared_page_t *shared_page; - /* shared ring page */ -@@ -199,6 +201,10 @@ struct mem_event_domain - mem_event_front_ring_t front_ring; - /* event channel port (vcpu0 only) */ - int xen_port; -+ /* mem_event bit for vcpu->pause_flags */ -+ int pause_flag; -+ /* list of vcpus waiting for room in the ring */ -+ struct waitqueue_head wq; - }; - - struct mem_event_per_domain -@@ -601,9 +607,12 @@ extern struct domain *domain_list; - /* VCPU affinity has changed: migrating to a new CPU. */ - #define _VPF_migrating 3 - #define VPF_migrating (1UL<<_VPF_migrating) -- /* VCPU is blocked on memory-event ring. */ --#define _VPF_mem_event 4 --#define VPF_mem_event (1UL<<_VPF_mem_event) -+ /* VCPU is blocked due to missing mem_paging ring. */ -+#define _VPF_mem_paging 4 -+#define VPF_mem_paging (1UL<<_VPF_mem_paging) -+ /* VCPU is blocked due to missing mem_access ring. */ -+#define _VPF_mem_access 5 -+#define VPF_mem_access (1UL<<_VPF_mem_access) - - static inline int vcpu_runnable(struct vcpu *v) - { diff --git a/xenpaging.mmap-before-nominate.patch b/xenpaging.mmap-before-nominate.patch deleted file mode 100644 index 0b33bf6..0000000 --- a/xenpaging.mmap-before-nominate.patch +++ /dev/null @@ -1,120 +0,0 @@ -# HG changeset patch -# Parent 4019436855ff3d44228c8eb3e78a9133a9caf870 -xenpaging: map gfn before nomination - -If the gfn is mapped before nomination, all special cases in do_mmu_update() -for paged gfns can be removed. If a gfn is actually in any of the paging -states the caller has to try again. - -Bump interface age. - -Signed-off-by: Olaf Hering - -Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c -@@ -573,7 +573,7 @@ static int xenpaging_evict_page(xenpagin - - DECLARE_DOMCTL; - -- /* Map page */ -+ /* Map page to get a handle */ - gfn = victim->gfn; - ret = -EFAULT; - page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, -@@ -584,16 +584,21 @@ static int xenpaging_evict_page(xenpagin - goto out; - } - -+ /* Nominate the page */ -+ ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn); -+ if ( ret != 0 ) -+ goto out; -+ - /* Copy page */ - ret = write_page(fd, page, i); - if ( ret != 0 ) - { - PERROR("Error copying page %lx", victim->gfn); -- munmap(page, PAGE_SIZE); - goto out; - } - - munmap(page, PAGE_SIZE); -+ page = NULL; - - /* Tell Xen to evict page */ - ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id, -@@ -612,6 +617,8 @@ static int xenpaging_evict_page(xenpagin - paging->num_paged_out++; - - out: -+ if (page) -+ munmap(page, PAGE_SIZE); - return ret; - } - -@@ -735,14 +742,11 @@ static int evict_victim(xenpaging_t *pag - ret = -EINTR; - goto out; - } -- ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, victim->gfn); -- if ( ret == 0 ) -- ret = xenpaging_evict_page(paging, victim, fd, i); -- else -+ ret = xenpaging_evict_page(paging, victim, fd, i); -+ if ( ret && j++ % 1000 == 0 ) - { -- if ( j++ % 1000 == 0 ) -- if ( xenpaging_mem_paging_flush_ioemu_cache(paging) ) -- PERROR("Error flushing ioemu cache"); -+ if ( xenpaging_mem_paging_flush_ioemu_cache(paging) ) -+ PERROR("Error flushing ioemu cache"); - } - } - while ( ret ); -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -2854,7 +2854,7 @@ set_shared_p2m_entry(struct p2m_domain * - * - the gfn is backed by a mfn - * - the p2mt of the gfn is pageable - * - the mfn is not used for IO -- * - the mfn has exactly one user and has no special meaning -+ * - the mfn has exactly two users (guest+pager) and has no special meaning - * - * Once the p2mt is changed the page is readonly for the guest. On success the - * pager can write the page contents to disk and later evict the page. -@@ -2888,7 +2888,7 @@ int p2m_mem_paging_nominate(struct p2m_d - /* Check page count and type */ - page = mfn_to_page(mfn); - if ( (page->count_info & (PGC_count_mask | PGC_allocated)) != -- (1 | PGC_allocated) ) -+ (2 | PGC_allocated) ) - goto out; - - if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none ) -@@ -2916,7 +2916,7 @@ int p2m_mem_paging_nominate(struct p2m_d - * freed: - * - the gfn is backed by a mfn - * - the gfn was nominated -- * - the mfn has still exactly one user and has no special meaning -+ * - the mfn has still exactly one user (the guest) and has no special meaning - * - * After successful nomination some other process could have mapped the page. In - * this case eviction can not be done. If the gfn was populated before the pager -Index: xen-4.1.3-testing/xen/include/public/mem_event.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/public/mem_event.h -+++ xen-4.1.3-testing/xen/include/public/mem_event.h -@@ -49,7 +49,7 @@ - #define MEM_EVENT_REASON_INT3 5 /* int3 was hit: gla/gfn are RIP */ - #define MEM_EVENT_REASON_SINGLESTEP 6 /* single step was invoked: gla/gfn are RIP */ - --#define MEM_EVENT_PAGING_AGE 1UL /* Number distinguish the mem_paging <-> pager interface */ -+#define MEM_EVENT_PAGING_AGE 2UL /* Number distinguish the mem_paging <-> pager interface */ - - typedef struct mem_event_shared_page { - uint32_t port; diff --git a/xenpaging.p2m_is_paged.patch b/xenpaging.p2m_is_paged.patch deleted file mode 100644 index 2badf3c..0000000 --- a/xenpaging.p2m_is_paged.patch +++ /dev/null @@ -1,363 +0,0 @@ -# HG changeset patch -# Parent 4a0a6a1cd56a8f3d242f323fb5161c2d1f52dccb -xenpaging: add need_populate and paged_no_mfn checks - -There is currently a mix of p2mt checks for the various paging types. -Some mean the p2mt needs to be populated, others mean a gfn without mfn. - -Add a new p2m_do_populate() helper which covers the p2m_ram_paged and -p2m_ram_paging_out types. If a gfn is not in these states anymore another -populate request for the pager is not needed. This avoids a call to -p2m_mem_paging_populate() which in turn reduces the pressure on the ring -buffer because no temporary slot needs to be claimed. As such, this helper is -an optimization. - -Modify the existing p2m_is_paged() helper which now covers also -p2m_ram_paging_in_start in addition to the current p2m_ram_paged type. A gfn -in these two states is not backed by a mfn. - -Signed-off-by: Olaf Hering - ---- - xen/arch/x86/hvm/emulate.c | 3 + - xen/arch/x86/hvm/hvm.c | 17 ++++++---- - xen/arch/x86/mm.c | 63 ++++++++++++--------------------------- - xen/arch/x86/mm/guest_walk.c | 3 + - xen/arch/x86/mm/hap/guest_walk.c | 6 ++- - xen/arch/x86/mm/hap/p2m-ept.c | 3 - - xen/arch/x86/mm/p2m.c | 4 +- - xen/common/grant_table.c | 3 + - xen/include/asm-x86/p2m.h | 9 ++++- - 9 files changed, 51 insertions(+), 60 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/emulate.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/emulate.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/emulate.c -@@ -66,7 +66,8 @@ static int hvmemul_do_io( - ram_mfn = gfn_to_mfn_unshare(p2m, ram_gfn, &p2mt, 0); - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, ram_gfn); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, ram_gfn); - return X86EMUL_RETRY; - } - if ( p2m_is_shared(p2mt) ) -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -393,7 +393,8 @@ static int hvm_set_ioreq_page( - return -EINVAL; - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, gmfn); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, gmfn); - return -ENOENT; - } - if ( p2m_is_shared(p2mt) ) -@@ -1207,7 +1208,7 @@ bool_t hvm_hap_nested_page_fault(unsigne - - #ifdef __x86_64__ - /* Check if the page has been paged out */ -- if ( p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_out) ) -+ if ( p2m_do_populate(p2mt) ) - p2m_mem_paging_populate(p2m, gfn); - - /* Mem sharing: unshare the page and try again */ -@@ -1695,7 +1696,8 @@ static void *__hvm_map_guest_frame(unsig - return NULL; - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, gfn); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, gfn); - return NULL; - } - -@@ -2153,7 +2155,8 @@ static enum hvm_copy_result __hvm_copy( - - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, gfn); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, gfn); - return HVMCOPY_gfn_paged_out; - } - if ( p2m_is_shared(p2mt) ) -@@ -2241,7 +2244,8 @@ static enum hvm_copy_result __hvm_clear( - - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, gfn); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, gfn); - return HVMCOPY_gfn_paged_out; - } - if ( p2m_is_shared(p2mt) ) -@@ -3630,7 +3634,8 @@ long do_hvm_op(unsigned long op, XEN_GUE - mfn_t mfn = gfn_to_mfn(p2m, pfn, &t); - if ( p2m_is_paging(t) ) - { -- p2m_mem_paging_populate(p2m, pfn); -+ if ( p2m_do_populate(t) ) -+ p2m_mem_paging_populate(p2m, pfn); - - rc = -EINVAL; - goto param_fail3; -@@ -3727,7 +3732,8 @@ long do_hvm_op(unsigned long op, XEN_GUE - mfn = gfn_to_mfn_unshare(p2m, pfn, &t, 0); - if ( p2m_is_paging(t) ) - { -- p2m_mem_paging_populate(p2m, pfn); -+ if ( p2m_do_populate(t) ) -+ p2m_mem_paging_populate(p2m, pfn); - - rc = -EINVAL; - goto param_fail4; -Index: xen-4.1.3-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm.c -+++ xen-4.1.3-testing/xen/arch/x86/mm.c -@@ -3467,9 +3467,10 @@ int do_mmu_update( - if ( !p2m_is_valid(p2mt) ) - mfn = INVALID_MFN; - -- if ( p2m_is_paged(p2mt) ) -+ if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), gmfn); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), gmfn); - - rc = -ENOENT; - break; -@@ -3494,24 +3495,18 @@ int do_mmu_update( - { - l1_pgentry_t l1e = l1e_from_intpte(req.val); - p2m_type_t l1e_p2mt; -- unsigned long l1emfn = mfn_x( - gfn_to_mfn(p2m_get_hostp2m(pg_owner), -- l1e_get_pfn(l1e), &l1e_p2mt)); -+ l1e_get_pfn(l1e), &l1e_p2mt); - -- if ( p2m_is_paged(l1e_p2mt) ) -+#ifdef __x86_64__ -+ if ( p2m_is_paging(l1e_p2mt) ) - { -- p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), -+ if ( p2m_do_populate(l1e_p2mt) ) -+ p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), - l1e_get_pfn(l1e)); - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l1e_p2mt && -- !mfn_valid(l1emfn) ) -- { -- rc = -ENOENT; -- break; -- } --#ifdef __x86_64__ - /* XXX: Ugly: pull all the checks into a separate function. - * Don't want to do it now, not to interfere with mem_paging - * patches */ -@@ -3538,22 +3533,16 @@ int do_mmu_update( - { - l2_pgentry_t l2e = l2e_from_intpte(req.val); - p2m_type_t l2e_p2mt; -- unsigned long l2emfn = mfn_x( -- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt)); -+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt); - -- if ( p2m_is_paged(l2e_p2mt) ) -+ if ( p2m_is_paging(l2e_p2mt) ) - { -- p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), -+ if ( p2m_do_populate(l2e_p2mt) ) -+ p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), - l2e_get_pfn(l2e)); - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l2e_p2mt && -- !mfn_valid(l2emfn) ) -- { -- rc = -ENOENT; -- break; -- } - else if ( p2m_ram_shared == l2e_p2mt ) - { - MEM_LOG("Unexpected attempt to map shared page.\n"); -@@ -3569,22 +3558,16 @@ int do_mmu_update( - { - l3_pgentry_t l3e = l3e_from_intpte(req.val); - p2m_type_t l3e_p2mt; -- unsigned long l3emfn = mfn_x( -- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt)); -+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt); - -- if ( p2m_is_paged(l3e_p2mt) ) -+ if ( p2m_is_paging(l3e_p2mt) ) - { -- p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), -+ if ( p2m_do_populate(l3e_p2mt) ) -+ p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), - l3e_get_pfn(l3e)); - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l3e_p2mt && -- !mfn_valid(l3emfn) ) -- { -- rc = -ENOENT; -- break; -- } - else if ( p2m_ram_shared == l3e_p2mt ) - { - MEM_LOG("Unexpected attempt to map shared page.\n"); -@@ -3600,23 +3583,17 @@ int do_mmu_update( - { - l4_pgentry_t l4e = l4e_from_intpte(req.val); - p2m_type_t l4e_p2mt; -- unsigned long l4emfn = mfn_x( - gfn_to_mfn(p2m_get_hostp2m(pg_owner), -- l4e_get_pfn(l4e), &l4e_p2mt)); -+ l4e_get_pfn(l4e), &l4e_p2mt); - -- if ( p2m_is_paged(l4e_p2mt) ) -+ if ( p2m_is_paging(l4e_p2mt) ) - { -- p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), -+ if ( p2m_do_populate(l4e_p2mt) ) -+ p2m_mem_paging_populate(p2m_get_hostp2m(pg_owner), - l4e_get_pfn(l4e)); - rc = -ENOENT; - break; - } -- else if ( p2m_ram_paging_in_start == l4e_p2mt && -- !mfn_valid(l4emfn) ) -- { -- rc = -ENOENT; -- break; -- } - else if ( p2m_ram_shared == l4e_p2mt ) - { - MEM_LOG("Unexpected attempt to map shared page.\n"); -Index: xen-4.1.3-testing/xen/arch/x86/mm/guest_walk.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/guest_walk.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/guest_walk.c -@@ -96,7 +96,8 @@ static inline void *map_domain_gfn(struc - *mfn = gfn_to_mfn_unshare(p2m, gfn_x(gfn), p2mt, 0); - if ( p2m_is_paging(*p2mt) ) - { -- p2m_mem_paging_populate(p2m, gfn_x(gfn)); -+ if ( p2m_do_populate(*p2mt) ) -+ p2m_mem_paging_populate(p2m, gfn_x(gfn)); - - *rc = _PAGE_PAGED; - return NULL; -Index: xen-4.1.3-testing/xen/arch/x86/mm/hap/guest_walk.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/hap/guest_walk.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/hap/guest_walk.c -@@ -50,7 +50,8 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN - top_mfn = gfn_to_mfn_unshare(p2m, cr3 >> PAGE_SHIFT, &p2mt, 0); - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, cr3 >> PAGE_SHIFT); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, cr3 >> PAGE_SHIFT); - - pfec[0] = PFEC_page_paged; - return INVALID_GFN; -@@ -82,7 +83,8 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN - gfn_to_mfn_unshare(p2m, gfn_x(gfn), &p2mt, 0); - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, gfn_x(gfn)); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, gfn_x(gfn)); - - pfec[0] = PFEC_page_paged; - return INVALID_GFN; -Index: xen-4.1.3-testing/xen/arch/x86/mm/hap/p2m-ept.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/hap/p2m-ept.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/hap/p2m-ept.c -@@ -377,8 +377,7 @@ ept_set_entry(struct p2m_domain *p2m, un - * the intermediate tables will be freed below after the ept flush */ - old_entry = *ept_entry; - -- if ( mfn_valid(mfn_x(mfn)) || direct_mmio || p2m_is_paged(p2mt) || -- (p2mt == p2m_ram_paging_in_start) ) -+ if ( mfn_valid(mfn_x(mfn)) || direct_mmio || p2m_is_paged(p2mt) ) - { - /* Construct the new entry, and then write it once */ - new_entry.emt = epte_get_entry_emt(p2m->domain, gfn, mfn, &ipat, -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -3051,7 +3051,7 @@ void p2m_mem_paging_populate(struct p2m_ - p2m_lock(p2m); - mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); - /* Allow only nominated or evicted pages to enter page-in path */ -- if ( p2mt == p2m_ram_paging_out || p2mt == p2m_ram_paged ) -+ if ( p2m_do_populate(p2mt) ) - { - /* Evict will fail now, tag this request for pager */ - if ( p2mt == p2m_ram_paging_out ) -@@ -3069,7 +3069,7 @@ void p2m_mem_paging_populate(struct p2m_ - req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; - } - /* No need to inform pager if the gfn is not in the page-out path */ -- else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) -+ else if ( !p2m_do_populate(p2mt) ) - { - /* gfn is already on its way back and vcpu is not paused */ - mem_event_put_req_producers(&d->mem_event->paging); -Index: xen-4.1.3-testing/xen/common/grant_table.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/grant_table.c -+++ xen-4.1.3-testing/xen/common/grant_table.c -@@ -158,7 +158,8 @@ static int __get_paged_frame(unsigned lo - *frame = mfn_x(mfn); - if ( p2m_is_paging(p2mt) ) - { -- p2m_mem_paging_populate(p2m, gfn); -+ if ( p2m_do_populate(p2mt) ) -+ p2m_mem_paging_populate(p2m, gfn); - rc = GNTST_eagain; - } - } else { -Index: xen-4.1.3-testing/xen/include/asm-x86/p2m.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/p2m.h -+++ xen-4.1.3-testing/xen/include/asm-x86/p2m.h -@@ -159,7 +159,11 @@ typedef enum { - | p2m_to_mask(p2m_ram_paging_in_start) \ - | p2m_to_mask(p2m_ram_paging_in)) - --#define P2M_PAGED_TYPES (p2m_to_mask(p2m_ram_paged)) -+#define P2M_POPULATE_TYPES (p2m_to_mask(p2m_ram_paged) \ -+ | p2m_to_mask(p2m_ram_paging_out) ) -+ -+#define P2M_PAGED_NO_MFN_TYPES (p2m_to_mask(p2m_ram_paged) \ -+ | p2m_to_mask(p2m_ram_paging_in_start) ) - - /* Shared types */ - /* XXX: Sharable types could include p2m_ram_ro too, but we would need to -@@ -181,7 +185,8 @@ typedef enum { - #define p2m_has_emt(_t) (p2m_to_mask(_t) & (P2M_RAM_TYPES | p2m_to_mask(p2m_mmio_direct))) - #define p2m_is_pageable(_t) (p2m_to_mask(_t) & P2M_PAGEABLE_TYPES) - #define p2m_is_paging(_t) (p2m_to_mask(_t) & P2M_PAGING_TYPES) --#define p2m_is_paged(_t) (p2m_to_mask(_t) & P2M_PAGED_TYPES) -+#define p2m_is_paged(_t) (p2m_to_mask(_t) & P2M_PAGED_NO_MFN_TYPES) -+#define p2m_do_populate(_t) (p2m_to_mask(_t) & P2M_POPULATE_TYPES) - #define p2m_is_sharable(_t) (p2m_to_mask(_t) & P2M_SHARABLE_TYPES) - #define p2m_is_shared(_t) (p2m_to_mask(_t) & P2M_SHARED_TYPES) - #define p2m_is_broken(_t) (p2m_to_mask(_t) & P2M_BROKEN_TYPES) diff --git a/xenpaging.qemu.flush-cache.patch b/xenpaging.qemu.flush-cache.patch deleted file mode 100644 index 272efa1..0000000 --- a/xenpaging.qemu.flush-cache.patch +++ /dev/null @@ -1,31 +0,0 @@ -Subject: xenpaging/qemu-dm: add command to flush buffer cache. - -Add support for a xenstore dm command to flush qemu's buffer cache. - -qemu will just keep mapping pages and not release them, which causes problems -for the memory pager (since the page is mapped, it won't get paged out). When -the pager has trouble finding a page to page out, it asks qemu to flush its -buffer, which releases all the page mappings. This makes it possible to find -pages to swap out agian. - -Already-Signed-off-by: Patrick Colp -Signed-off-by: Olaf Hering - ---- - tools/ioemu-qemu-xen/xenstore.c | 3 +++ - 1 file changed, 3 insertions(+) - -Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -1082,6 +1082,9 @@ static void xenstore_process_dm_command_ - do_pci_add(par); - free(par); - #endif -+ } else if (!strncmp(command, "flush-cache", len)) { -+ fprintf(logfile, "dm-command: flush caches\n"); -+ qemu_invalidate_map_cache(); - } else { - fprintf(logfile, "dm-command: unknown command\"%*s\"\n", len, command); - } diff --git a/xenpaging.speedup-page-in.gfn_to_slot.patch b/xenpaging.speedup-page-in.gfn_to_slot.patch deleted file mode 100644 index 119c681..0000000 --- a/xenpaging.speedup-page-in.gfn_to_slot.patch +++ /dev/null @@ -1,85 +0,0 @@ -xenpaging: use flat index for pagefile and page-in requests - -This change is based on an idea by and -. - -Scanning the victims[] array is time consuming with a large number of -target pages. Replace the loop to find the slot in the pagefile which -holds the requested gfn with an index. - ---- - tools/xenpaging/xenpaging.c | 13 ++++++++++--- - tools/xenpaging/xenpaging.h | 2 ++ - 2 files changed, 12 insertions(+), 3 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -626,6 +626,8 @@ static int xenpaging_evict_page(xenpagin - /* Record number of evicted pages */ - paging->num_paged_out++; - -+ paging->gfn_to_slot[victim->gfn] = i; -+ - ret = 0; - - out: -@@ -805,7 +807,7 @@ int main(int argc, char *argv[]) - { - struct sigaction act; - xenpaging_t *paging; -- xenpaging_victim_t *victims; -+ xenpaging_victim_t *victims = NULL; - mem_event_request_t req; - mem_event_response_t rsp; - int num, prev_num = 0; -@@ -838,6 +840,10 @@ int main(int argc, char *argv[]) - return 2; - } - -+ paging->gfn_to_slot = calloc(paging->max_pages, sizeof(int)); -+ if ( ! paging->gfn_to_slot ) -+ goto out; -+ - /* Allocate upper limit of pages to allow growing and shrinking */ - victims = calloc(paging->max_pages, sizeof(xenpaging_victim_t)); - if ( !victims ) -@@ -882,10 +888,11 @@ int main(int argc, char *argv[]) - if ( test_and_clear_bit(req.gfn, paging->bitmap) ) - { - /* Find where in the paging file to read from */ -- for ( i = 0; i < paging->max_pages; i++ ) -+ i = paging->gfn_to_slot[req.gfn]; -+ if ( victims[i].gfn != req.gfn || i > paging->max_pages ) - { -- if ( victims[i].gfn == req.gfn ) -- break; -+ ERROR("Expected gfn %lx in slot %d, got gfn %lx instead\n", req.gfn, i, victims[i].gfn); -+ goto out; - } - - if ( i >= paging->max_pages ) -@@ -1019,7 +1026,8 @@ int main(int argc, char *argv[]) - out: - close(fd); - unlink_pagefile(); -- free(victims); -+ if ( victims != NULL ) -+ free(victims); - - /* Tear down domain paging */ - rc1 = xenpaging_teardown(paging); -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -46,6 +46,8 @@ typedef struct xenpaging { - - unsigned long *bitmap; - -+ int *gfn_to_slot; -+ - mem_event_t mem_event; - /* number of pages for which data structures were allocated */ - int max_pages; diff --git a/xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch b/xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch deleted file mode 100644 index 92c1c0b..0000000 --- a/xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch +++ /dev/null @@ -1,69 +0,0 @@ -Scanning the victims array for a free slot is expensive. -Remember the last slots freed during page-in requests and reuse them in evict_victims. ---- - tools/xenpaging/xenpaging.c | 20 ++++++++++++++++++-- - tools/xenpaging/xenpaging.h | 2 ++ - 2 files changed, 20 insertions(+), 2 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -787,11 +787,23 @@ static int evict_victim(xenpaging_t *pag - } - - /* Evict a batch of pages and write them to a free slot in the paging file */ --static int evict_pages(xenpaging_t *paging, int fd, xenpaging_victim_t *victims, int num_pages) -+static void evict_pages(xenpaging_t *paging, int fd, xenpaging_victim_t *victims, int num_pages) - { - xc_interface *xch = paging->xc_handle; - int rc, slot, num = 0; - -+ while ( paging->stack_count > 0 && num < num_pages ) -+ { -+ paging->stack_count--; -+ slot = paging->free_slot_stack[paging->stack_count]; -+ rc = evict_victim(paging, &victims[slot], fd, slot); -+ if ( rc == -ENOSPC ) -+ return; -+ if ( rc == -EINTR ) -+ return; -+ num++; -+ } -+ - for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ ) - { - /* Slot is allocated */ -@@ -807,7 +819,6 @@ static int evict_pages(xenpaging_t *pagi - DPRINTF("%d pages evicted\n", num); - num++; - } -- return num; - } - - int main(int argc, char *argv[]) -@@ -939,6 +950,11 @@ int main(int argc, char *argv[]) - - /* Clear this pagefile slot */ - victims[i].gfn = INVALID_MFN; -+ if ( paging->stack_count < XENPAGING_PAGEIN_QUEUE_SIZE ) -+ { -+ paging->free_slot_stack[paging->stack_count] = i; -+ paging->stack_count++; -+ } - } - else - { -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -56,6 +56,8 @@ typedef struct xenpaging { - int policy_mru_size; - int use_poll_timeout; - int debug; -+ int stack_count; -+ int free_slot_stack[XENPAGING_PAGEIN_QUEUE_SIZE]; - unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE]; - } xenpaging_t; - diff --git a/xenpaging.speedup-page-out.patch b/xenpaging.speedup-page-out.patch deleted file mode 100644 index b61a58c..0000000 --- a/xenpaging.speedup-page-out.patch +++ /dev/null @@ -1,89 +0,0 @@ -xenpaging: no poll timeout while page-out is in progress - -The main loop calls xenpaging_wait_for_event_or_timeout() unconditionally -before doing any work. This function calls poll() with a timeout of 100ms. As -a result the page-out process is very slow due to the delay in poll(). - -Call poll() without timeout so that it returns immediately until the page-out -is done. Page-out is done when either the policy finds no more pages to -nominate or when the requested number of pages is reached. - -The condition is cleared when a watch event arrives, so that processing the -new target is not delayed once again by poll(). - -Signed-off-by: Olaf Hering - ---- - tools/xenpaging/policy_default.c | 1 + - tools/xenpaging/xenpaging.c | 12 +++++++++++- - tools/xenpaging/xenpaging.h | 1 + - 3 files changed, 13 insertions(+), 1 deletion(-) - -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -90,6 +90,7 @@ int policy_choose_victim(xenpaging_t *pa - /* Could not nominate any gfn */ - if ( wrap == current_gfn ) - { -+ paging->use_poll_timeout = 1; - /* Count wrap arounds */ - unconsumed_cleared++; - /* Force retry every few seconds (depends on poll() timeout) */ -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -85,6 +85,7 @@ static int xenpaging_wait_for_event_or_t - struct pollfd fd[2]; - int port; - int rc; -+ int timeout; - - /* Wait for event channel and xenstore */ - fd[0].fd = xc_evtchn_fd(xce); -@@ -92,7 +93,9 @@ static int xenpaging_wait_for_event_or_t - fd[1].fd = xs_fileno(paging->xs_handle); - fd[1].events = POLLIN | POLLERR; - -- rc = poll(fd, 2, 100); -+ /* No timeout while page-out is still in progress */ -+ timeout = paging->use_poll_timeout ? 100 : 0; -+ rc = poll(fd, 2, timeout); - if ( rc < 0 ) - { - if (errno == EINTR) -@@ -134,6 +137,8 @@ static int xenpaging_wait_for_event_or_t - if ( target_tot_pages < 0 || target_tot_pages > paging->max_pages ) - target_tot_pages = paging->max_pages; - paging->target_tot_pages = target_tot_pages; -+ /* Disable poll() delay while new target is not yet reached */ -+ paging->use_poll_timeout = 0; - DPRINTF("new target_tot_pages %d\n", target_tot_pages); - } - free(val); -@@ -1002,6 +1007,11 @@ int main(int argc, char *argv[]) - } - resume_pages(paging, num); - } -+ /* Now target was reached, enable poll() timeout */ -+ else -+ { -+ paging->use_poll_timeout = 1; -+ } - - } - DPRINTF("xenpaging got signal %d\n", interrupted); -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h -@@ -52,6 +52,7 @@ typedef struct xenpaging { - int num_paged_out; - int target_tot_pages; - int policy_mru_size; -+ int use_poll_timeout; - int debug; - unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE]; - } xenpaging_t; diff --git a/xenpaging.speedup-page-out.policy_choose_victim.patch b/xenpaging.speedup-page-out.policy_choose_victim.patch deleted file mode 100644 index 94edbfc..0000000 --- a/xenpaging.speedup-page-out.policy_choose_victim.patch +++ /dev/null @@ -1,83 +0,0 @@ -Skip longs with all bits set. -Iterate only once over the entire gfn range. ---- - tools/xenpaging/policy_default.c | 55 ++++++++++++++++++++++++++------------- - 1 file changed, 38 insertions(+), 17 deletions(-) - -Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c -+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c -@@ -80,34 +80,55 @@ int policy_init(xenpaging_t *paging) - int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim) - { - xc_interface *xch = paging->xc_handle; -- unsigned long wrap = current_gfn; -+ unsigned long i; - -- do -+ /* One iteration over all possible gfns */ -+ for ( i = 0; i < max_pages; i++) - { - current_gfn++; - if ( current_gfn >= max_pages ) - current_gfn = 0; -- /* Could not nominate any gfn */ -- if ( wrap == current_gfn ) -+ -+ if ( (current_gfn & (BITS_PER_LONG - 1)) == 0 ) - { -- paging->use_poll_timeout = 1; -- /* Count wrap arounds */ -- unconsumed_cleared++; -- /* Force retry every few seconds (depends on poll() timeout) */ -- if ( unconsumed_cleared > 123) -+ /* All gfns busy */ -+ if ( ~bitmap[current_gfn >> ORDER_LONG] == 0 || ~unconsumed[current_gfn >> ORDER_LONG] == 0 ) - { -- /* Force retry of unconsumed gfns */ -- bitmap_clear(unconsumed, max_pages); -- unconsumed_cleared = 0; -- DPRINTF("clearing unconsumed, wrap %lx", wrap); -- /* One more round before returning ENOSPC */ -+ current_gfn += BITS_PER_LONG; -+ i += BITS_PER_LONG; - continue; - } -- victim->gfn = INVALID_MFN; -- return -ENOSPC; - } -+ -+ /* gfn busy */ -+ if ( test_bit(current_gfn, bitmap) ) -+ continue; -+ -+ /* gfn already tested */ -+ if ( test_bit(current_gfn, unconsumed) ) -+ continue; -+ -+ /* gfn found */ -+ break; -+ } -+ -+ /* Could not nominate any gfn */ -+ if ( i >= max_pages ) -+ { -+ paging->use_poll_timeout = 1; -+ /* Count wrap arounds */ -+ unconsumed_cleared++; -+ /* Force retry every few seconds (depends on poll() timeout) */ -+ if ( unconsumed_cleared > 123) -+ { -+ /* Force retry of unconsumed gfns in next call */ -+ bitmap_clear(unconsumed, max_pages); -+ unconsumed_cleared = 0; -+ DPRINTF("clearing unconsumed, current_gfn %lx", current_gfn); -+ } -+ victim->gfn = INVALID_MFN; -+ return -ENOSPC; - } -- while ( test_bit(current_gfn, bitmap) || test_bit(current_gfn, unconsumed) ); - - set_bit(current_gfn, unconsumed); - victim->gfn = current_gfn; diff --git a/xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch b/xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch deleted file mode 100644 index 14c256a..0000000 --- a/xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch +++ /dev/null @@ -1,23 +0,0 @@ - ---- - tools/xenpaging/xenpaging.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -721,6 +721,13 @@ static void resume_pages(xenpaging_t *pa - - for ( i = 0; i < paging->max_pages && num < num_pages; i++ ) - { -+ /* Skip empty longs */ -+ if ( (i & (BITS_PER_LONG - 1)) == 0 && paging->bitmap[i >> ORDER_LONG] == 0 ) -+ { -+ i += BITS_PER_LONG; -+ continue; -+ } -+ - if ( test_bit(i, paging->bitmap) ) - { - paging->pagein_queue[num] = i; diff --git a/xenpaging.versioned-interface.patch b/xenpaging.versioned-interface.patch deleted file mode 100644 index 51939e3..0000000 --- a/xenpaging.versioned-interface.patch +++ /dev/null @@ -1,87 +0,0 @@ -# HG changeset patch -# Parent a4d7c27ec1f190ecbb9a909609f6ef0eca250c00 -xenpaging: extend xc_mem_paging_enable() to handle interface version - -Since upcoming patches will change the way how paging internally works, add a -new interface to xc_mem_paging_enable() to make sure the pager is not -out-of-date. This is similar to XEN_DOMCTL_INTERFACE_VERSION in do_domctl() -where the tools have to match the running hypervisor. - -Signed-off-by: Olaf Hering - -Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xc_mem_paging.c -+++ xen-4.1.2-testing/tools/libxc/xc_mem_paging.c -@@ -25,12 +25,13 @@ - - - int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id, -+ unsigned long interface_age, - void *shared_page, void *ring_page) - { - return xc_mem_event_control(xch, domain_id, - XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE, - XEN_DOMCTL_MEM_EVENT_OP_PAGING, -- shared_page, ring_page, INVALID_MFN); -+ shared_page, ring_page, interface_age); - } - - int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id) -Index: xen-4.1.2-testing/tools/libxc/xenctrl.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxc/xenctrl.h -+++ xen-4.1.2-testing/tools/libxc/xenctrl.h -@@ -1736,6 +1736,7 @@ int xc_mem_event_control(xc_interface *x - void *ring_page, unsigned long gfn); - - int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id, -+ unsigned long interface_age, - void *shared_page, void *ring_page); - int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id); - int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, -Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c -+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c -@@ -366,6 +366,7 @@ static xenpaging_t *xenpaging_init(int a - - /* Initialise Xen */ - rc = xc_mem_paging_enable(xch, paging->mem_event.domain_id, -+ MEM_EVENT_PAGING_AGE, - paging->mem_event.shared_page, - paging->mem_event.ring_page); - if ( rc != 0 ) -Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -=================================================================== ---- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c -+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c -@@ -274,6 +274,15 @@ int mem_event_domctl(struct domain *d, x - if ( p2m->pod.entry_count ) - break; - -+ rc = -ENOEXEC; -+ /* Disallow paging in a PoD guest */ -+ if ( mec->gfn != MEM_EVENT_PAGING_AGE ) -+ { -+ gdprintk(XENLOG_INFO, "Expected paging age %lx, got %lx\n", -+ MEM_EVENT_PAGING_AGE, mec->gfn); -+ break; -+ } -+ - rc = mem_event_enable(d, mec, med); - } - break; -Index: xen-4.1.2-testing/xen/include/public/mem_event.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/public/mem_event.h -+++ xen-4.1.2-testing/xen/include/public/mem_event.h -@@ -49,6 +49,8 @@ - #define MEM_EVENT_REASON_INT3 5 /* int3 was hit: gla/gfn are RIP */ - #define MEM_EVENT_REASON_SINGLESTEP 6 /* single step was invoked: gla/gfn are RIP */ - -+#define MEM_EVENT_PAGING_AGE 1UL /* Number distinguish the mem_paging <-> pager interface */ -+ - typedef struct mem_event_shared_page { - uint32_t port; - } mem_event_shared_page_t; diff --git a/xenpaging.waitqueue-paging.patch b/xenpaging.waitqueue-paging.patch deleted file mode 100644 index 4ed16d6..0000000 --- a/xenpaging.waitqueue-paging.patch +++ /dev/null @@ -1,397 +0,0 @@ -# HG changeset patch -# Parent 427c10f8e1e28d942886f89ebc79ffa93cb7fce9 -xenpaging: use wait queues - -Use a wait queue to put a guest vcpu to sleep while the requested gfn is -in paging state. This adds missing p2m_mem_paging_populate() calls to -some callers of the new get_gfn* variants, which would crash now -because they get an invalid mfn. It also fixes guest crashes due to -unexpected returns from do_memory_op because copy_to/from_guest ran into -a paged gfn. Now those places will always get a valid mfn. - -Since each gfn could be requested by several guest vcpus at the same -time a queue of paged gfns is maintained. Each vcpu will be attached to -that queue. Once p2m_mem_paging_resume restored the gfn the waiting -vcpus will resume execution. - -There is untested code in p2m_mem_paging_init_queue() to allow cpu -hotplug. Since each vcpu may wait on a different gfn there have to be as -many queues as vcpus. But xl vcpu-set does not seem to work right now, -so this code path cant be excercised right now. - -TODO: - - use hash in p2m_mem_paging_queue_head - - rename gfn_lock - - use mm_lock_t for gfn_lock - -Signed-off-by: Olaf Hering - ---- - xen/arch/x86/hvm/hvm.c | 2 - xen/arch/x86/mm/p2m.c | 220 +++++++++++++++++++++++++++++++++------ - xen/common/domctl.c | 3 - xen/include/asm-x86/hvm/domain.h | 3 - xen/include/asm-x86/p2m.h | 7 + - 5 files changed, 205 insertions(+), 30 deletions(-) - -Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c -@@ -475,6 +475,8 @@ int hvm_domain_initialise(struct domain - spin_lock_init(&d->arch.hvm_domain.irq_lock); - spin_lock_init(&d->arch.hvm_domain.uc_lock); - -+ spin_lock_init(&d->arch.hvm_domain.gfn_lock); -+ - INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list); - spin_lock_init(&d->arch.hvm_domain.msixtbl_list_lock); - -Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c -@@ -30,6 +30,7 @@ - #include - #include /* ept_p2m_init() */ - #include -+#include - #include - #include - #include -@@ -2841,6 +2842,182 @@ set_shared_p2m_entry(struct p2m_domain * - } - - #ifdef __x86_64__ -+struct p2m_mem_paging_queue { -+ struct list_head list; -+ struct waitqueue_head wq; -+ unsigned long gfn; -+ unsigned short waiters; -+ unsigned short woken; -+ unsigned short index; -+}; -+ -+struct p2m_mem_paging_queue_head { -+ struct list_head list; -+ unsigned int max; -+}; -+ -+int p2m_mem_paging_init_queue(struct domain *d, unsigned int max) -+{ -+ struct p2m_mem_paging_queue_head *h; -+ struct p2m_mem_paging_queue *q; -+ unsigned int i, nr; -+ int ret = 0; -+ -+ if (!is_hvm_domain(d)) -+ return 0; -+ -+ spin_lock(&d->arch.hvm_domain.gfn_lock); -+ -+ if (!d->arch.hvm_domain.gfn_queue) { -+ ret = -ENOMEM; -+ h = xzalloc(struct p2m_mem_paging_queue_head); -+ if (!h) { -+ domain_crash(d); -+ goto out; -+ } -+ -+ INIT_LIST_HEAD(&h->list); -+ nr = max; -+ } else { -+ h = d->arch.hvm_domain.gfn_queue; -+ if (max <= h->max) -+ goto out; -+ nr = max - h->max; -+ } -+ -+ ret = -ENOMEM; -+ q = xzalloc_array(struct p2m_mem_paging_queue, nr); -+ if (!q) { -+ if (!d->arch.hvm_domain.gfn_queue) -+ xfree(h); -+ domain_crash(d); -+ goto out; -+ } -+ -+ for (i = 0; i < nr; i++) { -+ init_waitqueue_head(&q[i].wq); -+ INIT_LIST_HEAD(&q[i].list); -+ q[i].index = h->max + i + 1; -+ list_add_tail(&q[i].list, &h->list); -+ } -+ -+ h->max = max; -+ d->arch.hvm_domain.gfn_queue = h; -+ ret = 0; -+ -+out: -+ spin_unlock(&d->arch.hvm_domain.gfn_lock); -+ return ret; -+} -+ -+static struct p2m_mem_paging_queue *p2m_mem_paging_get_queue(struct domain *d, unsigned long gfn) -+{ -+ struct p2m_mem_paging_queue_head *h; -+ struct p2m_mem_paging_queue *q, *q_match, *q_free; -+ -+ h = d->arch.hvm_domain.gfn_queue; -+ q_match = q_free = NULL; -+ -+ spin_lock(&d->arch.hvm_domain.gfn_lock); -+ -+ list_for_each_entry(q, &h->list, list) { -+ if (q->gfn == gfn) { -+ q_match = q; -+ break; -+ } -+ if (!q_free && !q->waiters) -+ q_free = q; -+ } -+ -+ if (!q_match && q_free) -+ q_match = q_free; -+ -+ if (q_match) { -+ if (q_match->woken) -+ printk("wq woken for gfn %u:%u %lx %u %u %u\n", current->domain->domain_id, current->vcpu_id, gfn, q_match->index, q_match->woken, q_match->waiters); -+ q_match->waiters++; -+ q_match->gfn = gfn; -+ } -+ -+ if (!q_match) -+ printk("No wq_get for gfn %u:%u %lx\n", current->domain->domain_id, current->vcpu_id, gfn); -+ -+ spin_unlock(&d->arch.hvm_domain.gfn_lock); -+ return q_match; -+} -+ -+static void p2m_mem_paging_put_queue(struct domain *d, struct p2m_mem_paging_queue *q_match) -+{ -+ spin_lock(&d->arch.hvm_domain.gfn_lock); -+ -+ if (q_match->waiters == 0) -+ printk("wq_put no waiters, gfn %u:%u %lx %u\n", current->domain->domain_id, current->vcpu_id, q_match->gfn, q_match->woken); -+ else if (--q_match->waiters == 0) -+ q_match->gfn = q_match->woken = 0;; -+ -+ spin_unlock(&d->arch.hvm_domain.gfn_lock); -+} -+ -+static void p2m_mem_paging_wake_queue(struct domain *d, unsigned long gfn) -+{ -+ struct p2m_mem_paging_queue_head *h; -+ struct p2m_mem_paging_queue *q, *q_match = NULL; -+ -+ spin_lock(&d->arch.hvm_domain.gfn_lock); -+ -+ h = d->arch.hvm_domain.gfn_queue; -+ list_for_each_entry(q, &h->list, list) { -+ if (q->gfn == gfn) { -+ q_match = q; -+ break; -+ } -+ } -+ if (q_match) { -+ if (q_match->woken || q_match->waiters == 0) -+ printk("Wrong wake for gfn %u:%u %p %lx %u %u\n", current->domain->domain_id, current->vcpu_id, q_match, gfn, q_match->woken, q_match->waiters); -+ q_match->woken++; -+ wake_up_all(&q_match->wq); -+ } -+ spin_unlock(&d->arch.hvm_domain.gfn_lock); -+} -+ -+/* Returns 0 if the gfn is still paged */ -+static int p2m_mem_paging_get_entry(mfn_t *mfn, -+ struct p2m_domain *p2m, unsigned long gfn, -+ p2m_type_t *t, p2m_query_t q) -+{ -+ p2m_access_t a = 0; -+ *mfn = p2m->get_entry(p2m, gfn, t, &a, q); -+ -+ return p2m_is_paging(*t) ? 0 : 1; -+} -+ -+/* Go to sleep in case of guest access */ -+void p2m_mem_paging_wait(mfn_t *mfn, -+ struct p2m_domain *p2m, unsigned long gfn, -+ p2m_type_t *t, p2m_query_t q) -+{ -+ struct p2m_mem_paging_queue *pmpq; -+ -+ /* Return p2mt as is in case of query */ -+ if ( q == p2m_query ) -+ return; -+ /* Foreign domains can not go to sleep */ -+ if ( current->domain != p2m->domain ) -+ return; -+ -+ pmpq = p2m_mem_paging_get_queue(p2m->domain, gfn); -+ if ( !pmpq ) -+ return; -+ -+ /* Populate the page once */ -+ if ( *t == p2m_ram_paging_out || *t == p2m_ram_paged ) -+ p2m_mem_paging_populate(p2m, gfn); -+ -+ wait_event(pmpq->wq, p2m_mem_paging_get_entry(mfn, p2m, gfn, t, q)); -+ p2m_mem_paging_put_queue(p2m->domain, pmpq); -+} -+ - /** - * p2m_mem_paging_nominate - Mark a guest page as to-be-paged-out - * @d: guest domain -@@ -3022,21 +3199,17 @@ void p2m_mem_paging_drop_page(struct p2m - */ - void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn) - { -- struct vcpu *v = current; -- mem_event_request_t req; -+ mem_event_request_t req = { .type = MEM_EVENT_TYPE_PAGING, .gfn = gfn }; - p2m_type_t p2mt; - p2m_access_t a; - mfn_t mfn; -- int restored = 0; - struct domain *d = p2m->domain; -+ int put_request = 0; - - /* Check that there's space on the ring for this request */ - if ( mem_event_claim_slot(d, &d->mem_event->paging) ) - return; - -- memset(&req, 0, sizeof(req)); -- req.type = MEM_EVENT_TYPE_PAGING; -- - /* Fix p2m mapping */ - p2m_lock(p2m); - mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); -@@ -3045,35 +3218,23 @@ void p2m_mem_paging_populate(struct p2m_ - { - /* Restore page state if gfn was requested before evict */ - if ( p2mt == p2m_ram_paging_out && mfn_valid(mfn) ) { -+ /* Restore gfn because it is needed by guest before evict */ - set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_rw, a); -- restored = 1; - } else { - set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in_start, a); -+ put_request = 1; - } -+ /* Evict will fail now, the pager has to try another gfn */ -+ - audit_p2m(p2m, 1); - } - p2m_unlock(p2m); - -- /* Pause domain if request came from guest and gfn has paging type */ -- if ( !restored && p2m_is_paging(p2mt) && v->domain == d ) -- { -- vcpu_pause_nosync(v); -- req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; -- } -- /* No need to inform pager if the gfn is not in the page-out path */ -- else if ( restored || !p2m_do_populate(p2mt) ) -- { -- /* gfn is already on its way back and vcpu is not paused */ -+ /* One request per gfn, guest vcpus go to sleep, foreigners try again */ -+ if ( put_request ) -+ mem_event_put_request(d, &d->mem_event->paging, &req); -+ else - mem_event_release_slot(d, &d->mem_event->paging); -- return; -- } -- -- /* Send request to pager */ -- req.gfn = gfn; -- req.p2mt = p2mt; -- req.vcpu_id = v->vcpu_id; -- -- mem_event_put_request(d, &d->mem_event->paging, &req); - } - - /** -@@ -3200,12 +3361,11 @@ void p2m_mem_paging_resume(struct p2m_do - p2m_unlock(p2m); - } - -- /* Unpause domain */ -- if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) -- vcpu_unpause(d->vcpu[rsp.vcpu_id]); -- - /* Wake vcpus waiting for room in the ring */ - mem_event_wake_requesters(&d->mem_event->paging); -+ -+ /* Unpause all vcpus that were paused because the gfn was paged */ -+ p2m_mem_paging_wake_queue(d, rsp.gfn); - } - - void p2m_mem_access_check(paddr_t gpa, bool_t gla_valid, unsigned long gla, -Index: xen-4.1.3-testing/xen/common/domctl.c -=================================================================== ---- xen-4.1.3-testing.orig/xen/common/domctl.c -+++ xen-4.1.3-testing/xen/common/domctl.c -@@ -536,6 +536,9 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc - goto maxvcpu_out; - } - -+ if ( p2m_mem_paging_init_queue(d, max) ) -+ goto maxvcpu_out; -+ - ret = 0; - - maxvcpu_out: -Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/domain.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/domain.h -+++ xen-4.1.3-testing/xen/include/asm-x86/hvm/domain.h -@@ -87,6 +87,9 @@ struct hvm_domain { - - struct viridian_domain viridian; - -+ spinlock_t gfn_lock; -+ struct p2m_mem_paging_queue_head *gfn_queue; -+ - bool_t hap_enabled; - bool_t mem_sharing_enabled; - bool_t qemu_mapcache_invalidate; -Index: xen-4.1.3-testing/xen/include/asm-x86/p2m.h -=================================================================== ---- xen-4.1.3-testing.orig/xen/include/asm-x86/p2m.h -+++ xen-4.1.3-testing/xen/include/asm-x86/p2m.h -@@ -345,6 +345,8 @@ gfn_to_mfn_type_p2m(struct p2m_domain *p - } - - -+extern void p2m_mem_paging_wait(mfn_t *mfn, struct p2m_domain *p2m, unsigned long gfn, p2m_type_t *t, p2m_query_t q); -+ - /* General conversion function from gfn to mfn */ - static inline mfn_t _gfn_to_mfn_type(struct p2m_domain *p2m, - unsigned long gfn, p2m_type_t *t, -@@ -366,6 +368,9 @@ static inline mfn_t _gfn_to_mfn_type(str - mfn = gfn_to_mfn_type_p2m(p2m, gfn, t, q); - - #ifdef __x86_64__ -+ if (unlikely(p2m_is_paging(*t)) ) -+ p2m_mem_paging_wait(&mfn, p2m, gfn, t, q); -+ - if (unlikely((p2m_is_broken(*t)))) - { - /* Return invalid_mfn to avoid caller's access */ -@@ -522,6 +527,8 @@ int clear_mmio_p2m_entry(struct p2m_doma - /* Modify p2m table for shared gfn */ - int set_shared_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn); - -+/* Initialize per-gfn wait queue */ -+int p2m_mem_paging_init_queue(struct domain *d, unsigned int max); - /* Check if a nominated gfn is valid to be paged out */ - int p2m_mem_paging_nominate(struct p2m_domain *p2m, unsigned long gfn); - /* Evict a frame */ -@@ -535,6 +542,8 @@ int p2m_mem_paging_prep(struct p2m_domai - /* Resume normal operation (in case a domain was paused) */ - void p2m_mem_paging_resume(struct p2m_domain *p2m); - #else -+static inline int p2m_mem_paging_init_queue(struct domain *d, unsigned int max) -+{ return 0; } - static inline void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn) - { } - static inline void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn) diff --git a/xenstored.XS_RESET_WATCHES.patch b/xenstored.XS_RESET_WATCHES.patch deleted file mode 100644 index 0a73d7d..0000000 --- a/xenstored.XS_RESET_WATCHES.patch +++ /dev/null @@ -1,115 +0,0 @@ -changeset: 23839:42a45baf037d -user: Olaf Hering -date: Thu Sep 15 11:08:05 2011 +0100 -files: docs/misc/xenstore.txt tools/xenstore/xenstored_core.c tools/xenstore/xenstored_domain.c tools/xenstore/xenstored_domain.h xen/include/public/io/xs_wire.h -description: -xenstored: allow guest to shutdown all its watches/transactions - -During kexec all old watches have to be removed, otherwise the new -kernel will receive unexpected events. Allow a guest to reset itself -and cleanup all of its watches and transactions. - -Add a new XS_RESET_WATCHES command to do the reset on behalf of the -guest. - -(Changes by iwj: specify the argument to be a single nul byte. Permit -read-only clients to use the new command.) - -Signed-off-by: Olaf Hering -Signed-off-by: Ian Jackson -Committed-by: Ian Jackson - - ---- - docs/misc/xenstore.txt | 3 +++ - tools/xenstore/xenstored_core.c | 5 +++++ - tools/xenstore/xenstored_domain.c | 9 +++++++++ - tools/xenstore/xenstored_domain.h | 3 +++ - xen/include/public/io/xs_wire.h | 3 ++- - 5 files changed, 22 insertions(+), 1 deletion(-) - -Index: xen-4.1.2-testing/docs/misc/xenstore.txt -=================================================================== ---- xen-4.1.2-testing.orig/docs/misc/xenstore.txt -+++ xen-4.1.2-testing/docs/misc/xenstore.txt -@@ -217,6 +217,9 @@ WATCH_EVENT || - - UNWATCH ||? - -+RESET_WATCHES | -+ Reset all watches and transactions of the caller. -+ - ---------- Transactions ---------- - - TRANSACTION_START | | -Index: xen-4.1.2-testing/tools/xenstore/xenstored_core.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/xenstored_core.c -+++ xen-4.1.2-testing/tools/xenstore/xenstored_core.c -@@ -120,6 +120,7 @@ static char *sockmsg_string(enum xsd_soc - case XS_IS_DOMAIN_INTRODUCED: return "XS_IS_DOMAIN_INTRODUCED"; - case XS_RESUME: return "RESUME"; - case XS_SET_TARGET: return "SET_TARGET"; -+ case XS_RESET_WATCHES: return "RESET_WATCHES"; - default: - return "**UNKNOWN**"; - } -@@ -1242,6 +1243,10 @@ static void process_message(struct conne - do_set_target(conn, in); - break; - -+ case XS_RESET_WATCHES: -+ do_reset_watches(conn); -+ break; -+ - default: - eprintf("Client unknown operation %i", in->hdr.msg.type); - send_error(conn, ENOSYS); -Index: xen-4.1.2-testing/tools/xenstore/xenstored_domain.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/xenstored_domain.c -+++ xen-4.1.2-testing/tools/xenstore/xenstored_domain.c -@@ -537,6 +537,15 @@ void do_is_domain_introduced(struct conn - send_reply(conn, XS_IS_DOMAIN_INTRODUCED, result ? "T" : "F", 2); - } - -+/* Allow guest to reset all watches */ -+void do_reset_watches(struct connection *conn) -+{ -+ conn_delete_all_watches(conn); -+ conn_delete_all_transactions(conn); -+ -+ send_ack(conn, XS_RESET_WATCHES); -+} -+ - static int close_xc_handle(void *_handle) - { - xc_interface_close(*(xc_interface**)_handle); -Index: xen-4.1.2-testing/tools/xenstore/xenstored_domain.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/xenstore/xenstored_domain.h -+++ xen-4.1.2-testing/tools/xenstore/xenstored_domain.h -@@ -40,6 +40,9 @@ void do_set_target(struct connection *co - /* domid */ - void do_get_domain_path(struct connection *conn, const char *domid_str); - -+/* Allow guest to reset all watches */ -+void do_reset_watches(struct connection *conn); -+ - void domain_init(void); - - /* Returns the implicit path of a connection (only domains have this) */ -Index: xen-4.1.2-testing/xen/include/public/io/xs_wire.h -=================================================================== ---- xen-4.1.2-testing.orig/xen/include/public/io/xs_wire.h -+++ xen-4.1.2-testing/xen/include/public/io/xs_wire.h -@@ -48,7 +48,8 @@ enum xsd_sockmsg_type - XS_IS_DOMAIN_INTRODUCED, - XS_RESUME, - XS_SET_TARGET, -- XS_RESTRICT -+ XS_RESTRICT, -+ XS_RESET_WATCHES - }; - - #define XS_WRITE_NONE "NONE" diff --git a/xl-create-pv-with-qcow2-img.patch b/xl-create-pv-with-qcow2-img.patch deleted file mode 100644 index eded8ed..0000000 --- a/xl-create-pv-with-qcow2-img.patch +++ /dev/null @@ -1,234 +0,0 @@ -Fix problem that xl cannot create PV guest with qcow/qcow2 disk image by using -pygrub. Have discussed with upstream, but the work is something related to both -qemu and xen upstream, making it accepted may take a long time. Submit first and -will be replaced with upstream patches if it is accepted. -http://xen.1045712.n5.nabble.com/xl-create-PV-guest-with-qcow-qcow2-disk-images-fail-td4909399.html - -Signed-off-by: Chunyan Liu - -Index: xen-4.1.2-testing/tools/libxl/libxl.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxl/libxl.c -+++ xen-4.1.2-testing/tools/libxl/libxl.c -@@ -1071,11 +1071,131 @@ int libxl_device_disk_del(libxl_ctx *ctx - return rc; - } - -+static int libxl_forkexec(libxl_ctx *ctx, char *arg0, char **args) -+{ -+ pid_t pid; -+ int status; -+ -+ pid = libxl_fork(ctx); -+ if (pid < 0) -+ return -1; -+ else if (pid == 0){ -+ libxl__exec(-1, -1, -1, arg0, args); -+ exit(127); -+ } -+ while (waitpid(pid, &status, 0) < 0) { -+ if (errno != EINTR) { -+ status = -1; -+ break; -+ } -+ } -+ -+ return status; -+} -+ -+#ifdef __linux__ -+static int is_nbd_used(int minor) -+{ -+ FILE *proc; -+ int NBDMAJOR = 43; -+ char buf[BUFSIZ]; -+ int find = 0; -+ -+ proc = fopen("/proc/partitions", "r"); -+ if (proc != NULL) { -+ while (fgets(buf, sizeof(buf), proc)) { -+ int m, n; -+ unsigned long long sz; -+ char name[16]; -+ char *pname = name; -+ char *end; -+ -+ if (sscanf(buf, " %d %d %llu %128[^\n ]", -+ &m, &n, &sz, name) != 4) -+ continue; -+ if (m != NBDMAJOR) -+ continue; -+ if (strncmp(name, "nbd", 3)) -+ continue; -+ pname += 3; -+ n = strtol(pname, &end, 10); -+ if (end && end != pname && *end == '\0' && n == minor) { -+ find = 1; -+ break; -+ } -+ } -+ fclose(proc); -+ } -+ -+ return find; -+} -+ -+static int find_free_nbd_minor(void) -+{ -+ int i; -+ int nbds_max = 16; -+ int minor = -1; -+ -+ for (i = 0; i < nbds_max; i++) { -+ if (!is_nbd_used(i)) { -+ minor = i; -+ break; -+ } -+ } -+ -+ return minor; -+} -+ -+static char * nbd_mount_disk(libxl__gc *gc, libxl_device_disk *disk) -+{ -+ libxl_ctx *ctx = libxl__gc_owner(gc); -+ int n = -1; -+ char *nbd_dev = NULL; -+ char *args[] = {"qemu-nbd","-c",NULL,NULL,NULL}; -+ char *ret = NULL; -+ -+ n = find_free_nbd_minor(); -+ if (n >= 0) { -+ int i = 0; -+ int retry = 3; -+ -+ nbd_dev = libxl__sprintf(gc, "/dev/nbd%d", n); -+ args[2] = libxl__sprintf(gc, "%s", nbd_dev); -+ args[3] = libxl__sprintf(gc, "%s", disk->pdev_path); -+ libxl_forkexec(ctx, args[0], args); -+ -+ /*check connection*/ -+ while (i < retry) { -+ if (is_nbd_used(n)) { -+ ret = strdup(nbd_dev); -+ break; -+ } -+ i++; -+ sleep(1); -+ } -+ } -+ -+ return ret; -+} -+ -+static int nbd_unmount_disk(libxl__gc *gc, char *diskpath) { -+ libxl_ctx *ctx = libxl__gc_owner(gc); -+ char *args[] = {"qemu-nbd","-d",NULL,NULL}; -+ -+ args[2] = libxl__sprintf(gc, "%s", diskpath); -+ if (libxl_forkexec(ctx, args[0], args)) -+ return 0; -+ else -+ return ERROR_FAIL; -+} -+#endif -+ - char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk) - { - libxl__gc gc = LIBXL_INIT_GC(ctx); - const char *dev = NULL; - char *ret = NULL; -+ char *mdev = NULL; - - switch (disk->backend) { - case DISK_BACKEND_PHY: -@@ -1117,8 +1237,17 @@ char * libxl_device_disk_local_attach(li - } - case DISK_BACKEND_QDISK: - if (disk->format != DISK_FORMAT_RAW) { -- LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a qdisk " -- "image if the format is not raw"); -+#ifdef __linux__ -+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "attaching a non-raw qdisk image to domain 0\n"); -+ mdev = nbd_mount_disk(&gc, disk); -+ if (mdev) -+ dev = mdev; -+ else -+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "fail to mount image with qemu-nbd"); -+#else -+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally" -+ " attach a qdisk image if the format is not raw"); -+#endif - break; - } - LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "attaching qdisk %s to domain 0\n", -@@ -1134,18 +1263,37 @@ char * libxl_device_disk_local_attach(li - - if (dev != NULL) - ret = strdup(dev); -+ free(mdev); - libxl__free_all(&gc); - return ret; - } - --int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk) -+int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk, char *diskpath) - { -- /* Nothing to do for PHYSTYPE_PHY. */ -+#ifdef __linux__ -+ libxl__gc gc = LIBXL_INIT_GC(ctx); -+ int ret; -+ -+ switch (disk->backend) { -+ case DISK_BACKEND_QDISK: -+ if (disk->format != DISK_FORMAT_RAW) { -+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Locally detach a non-raw " -+ "qdisk image"); -+ ret = nbd_unmount_disk(&gc, diskpath); -+ return ret; -+ } -+ default: -+ /* Nothing to do for PHYSTYPE_PHY. */ - -- /* -- * For other device types assume that the blktap2 process is -- * needed by the soon to be started domain and do nothing. -- */ -+ /* -+ * For other device types assume that the blktap2 process is -+ * needed by the soon to be started domain and do nothing. -+ */ -+ break; -+ } -+ -+ libxl__free_all(&gc); -+#endif - - return 0; - } -Index: xen-4.1.2-testing/tools/libxl/libxl.h -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxl/libxl.h -+++ xen-4.1.2-testing/tools/libxl/libxl.h -@@ -429,7 +429,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u - * Make a disk available in this domain. Returns path to a device. - */ - char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk); --int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk); -+int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk, char *diskpath); - - int libxl_device_nic_init(libxl_device_nic *nic, int dev_num); - int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic); -Index: xen-4.1.2-testing/tools/libxl/libxl_bootloader.c -=================================================================== ---- xen-4.1.2-testing.orig/tools/libxl/libxl_bootloader.c -+++ xen-4.1.2-testing/tools/libxl/libxl_bootloader.c -@@ -419,7 +419,7 @@ int libxl_run_bootloader(libxl_ctx *ctx, - rc = 0; - out_close: - if (diskpath) { -- libxl_device_disk_local_detach(ctx, disk); -+ libxl_device_disk_local_detach(ctx, disk, diskpath); - free(diskpath); - } - if (fifo_fd > -1) diff --git a/xm-create-maxmem.patch b/xm-create-maxmem.patch index 7b9b645..2fde154 100644 --- a/xm-create-maxmem.patch +++ b/xm-create-maxmem.patch @@ -4,10 +4,10 @@ Reported in L3 bnc#732782 From: Dario Abatianni -Index: xen-4.1.2-testing/tools/python/xen/xm/xenapi_create.py +Index: xen-4.2.0-testing/tools/python/xen/xm/xenapi_create.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/xenapi_create.py -+++ xen-4.1.2-testing/tools/python/xen/xm/xenapi_create.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/xenapi_create.py ++++ xen-4.2.0-testing/tools/python/xen/xm/xenapi_create.py @@ -764,7 +764,7 @@ class sxp2xml: if get_child_by_name(config, "maxmem"): diff --git a/xm-create-xflag.patch b/xm-create-xflag.patch index 4d9c826..1cbb474 100644 --- a/xm-create-xflag.patch +++ b/xm-create-xflag.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xm/create.py +Index: xen-4.2.0-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.1.2-testing/tools/python/xen/xm/create.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/create.py ++++ xen-4.2.0-testing/tools/python/xen/xm/create.py @@ -36,7 +36,7 @@ from xen.xend.server.DevConstants import from xen.util import blkif from xen.util import vscsi_util @@ -11,7 +11,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/create.py from xen.util import utils, auxbin from xen.util.pci import dev_dict_to_sxp, \ parse_pci_name_extended, PciDeviceParseError -@@ -1528,7 +1528,7 @@ def main(argv): +@@ -1533,7 +1533,7 @@ def main(argv): except IOError, exn: raise OptionError("Cannot read file %s: %s" % (config, exn[1])) @@ -20,23 +20,19 @@ Index: xen-4.1.2-testing/tools/python/xen/xm/create.py from xen.xm.xenapi_create import sxp2xml sxp2xml_inst = sxp2xml() doc = sxp2xml_inst.convert_sxp_to_xml(config, transient=True) -@@ -1536,9 +1536,9 @@ def main(argv): +@@ -1541,7 +1541,7 @@ def main(argv): if opts.vals.dryrun and not opts.is_xml: SXPPrettyPrint.prettyprint(config) - if opts.vals.xmldryrun and serverType == SERVER_XEN_API: -- from xml.dom.ext import PrettyPrint as XMLPrettyPrint -- XMLPrettyPrint(doc) + if opts.vals.xmldryrun: -+ xml_as_string = doc.toprettyxml() -+ print("%s" % xml_as_string) + print doc.toprettyxml() if opts.vals.dryrun or opts.vals.xmldryrun: - return -Index: xen-4.1.2-testing/tools/python/xen/xend/XendAPIConstants.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendAPIConstants.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendAPIConstants.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendAPIConstants.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendAPIConstants.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendAPIConstants.py @@ -45,8 +45,10 @@ XEN_API_ON_NORMAL_EXIT = [ XEN_API_ON_CRASH_BEHAVIOUR = [ 'destroy', diff --git a/xm-save-check-file.patch b/xm-save-check-file.patch index 88e8215..67db2e2 100644 --- a/xm-save-check-file.patch +++ b/xm-save-check-file.patch @@ -1,7 +1,7 @@ -Index: xen-4.1.2-testing/tools/python/xen/xend/XendAPI.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendAPI.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendAPI.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendAPI.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendAPI.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendAPI.py @@ -1959,10 +1959,10 @@ class XendAPI(object): bool(live), port, node, ssl, bool(chs)) return xen_api_success_void() @@ -15,10 +15,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendAPI.py return xen_api_success_void() def VM_restore(self, _, src, paused): -Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomain.py +Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomain.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomain.py -+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomain.py +--- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomain.py ++++ xen-4.2.0-testing/tools/python/xen/xend/XendDomain.py @@ -1505,7 +1505,7 @@ class XendDomain: pass sock.close() @@ -38,10 +38,10 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomain.py if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot save privileged domain %s" % str(domid)) if dominfo._stateGet() != DOM_STATE_RUNNING: -Index: xen-4.1.2-testing/tools/python/xen/xm/main.py +Index: xen-4.2.0-testing/tools/python/xen/xm/main.py =================================================================== ---- xen-4.1.2-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.1.2-testing/tools/python/xen/xm/main.py +--- xen-4.2.0-testing.orig/tools/python/xen/xm/main.py ++++ xen-4.2.0-testing/tools/python/xen/xm/main.py @@ -121,7 +121,7 @@ SUBCOMMAND_HELP = { 'reset' : ('', 'Reset a domain.'), 'restore' : (' [-p]', diff --git a/xm-test-cleanup.diff b/xm-test-cleanup.diff deleted file mode 100644 index 673c802..0000000 --- a/xm-test-cleanup.diff +++ /dev/null @@ -1,14 +0,0 @@ -Index: xen-4.1.2-testing/tools/xm-test/tests/save/01_save_basic_pos.py -=================================================================== ---- xen-4.1.2-testing.orig/tools/xm-test/tests/save/01_save_basic_pos.py -+++ xen-4.1.2-testing/tools/xm-test/tests/save/01_save_basic_pos.py -@@ -35,3 +35,9 @@ if s != 0: - # Make sure it's gone - if isDomainRunning(domain.getName()): - FAIL("Domain still running after save!") -+ -+# Clean up -+try: -+ s, o = traceCommand("xm delete %s" % domain.getName(), timeout=30) -+except: -+ pass