25 Aug, 2016

1 commit

  • We pass xen_vcpu_id mapping information to hypercalls which require
    uint32_t type so it would be cleaner to have it as uint32_t. The
    initializer to -1 can be dropped as we always do the mapping before using
    it and we never check the 'not set' value anyway.

    Signed-off-by: Vitaly Kuznetsov
    Signed-off-by: David Vrabel

    Vitaly Kuznetsov
     

26 Jul, 2016

1 commit


25 Jul, 2016

1 commit

  • It may happen that Xen's and Linux's ideas of vCPU id diverge. In
    particular, when we crash on a secondary vCPU we may want to do kdump
    and unlike plain kexec where we do migrate_to_reboot_cpu() we try
    booting on the vCPU which crashed. This doesn't work very well for
    PVHVM guests as we have a number of hypercalls where we pass vCPU id
    as a parameter. These hypercalls either fail or do something
    unexpected.

    To solve the issue introduce percpu xen_vcpu_id mapping. ARM and PV
    guests get direct mapping for now. Boot CPU for PVHVM guest gets its
    id from CPUID. With secondary CPUs it is a bit more
    trickier. Currently, we initialize IPI vectors before these CPUs boot
    so we can't use CPUID. Use ACPI ids from MADT instead.

    Signed-off-by: Vitaly Kuznetsov
    Signed-off-by: David Vrabel

    Vitaly Kuznetsov
     

06 Jul, 2016

3 commits

  • The pv_time_ops structure contains a function pointer for the
    "steal_clock" functionality used only by KVM and Xen on ARM. Xen on x86
    uses its own mechanism to account for the "stolen" time a thread wasn't
    able to run due to hypervisor scheduling.

    Add support in Xen arch independent time handling for this feature by
    moving it out of the arm arch into drivers/xen and remove the x86 Xen
    hack.

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Reviewed-by: Stefano Stabellini
    Signed-off-by: David Vrabel

    Juergen Gross
     
  • Move x86 specific codes to architecture directory and export those EFI
    runtime service functions. This will be useful for initializing runtime
    service on ARM later.

    Signed-off-by: Shannon Zhao
    Reviewed-by: Stefano Stabellini
    Tested-by: Julien Grall
    Signed-off-by: Stefano Stabellini

    Shannon Zhao
     
  • Move xlated_setup_gnttab_pages to common place, so it can be reused by
    ARM to setup grant table.

    Rename it to xen_xlate_map_ballooned_pages.

    Signed-off-by: Shannon Zhao
    Reviewed-by: Stefano Stabellini
    Reviewed-by: Julien Grall
    Tested-by: Julien Grall

    Shannon Zhao
     

21 Dec, 2015

1 commit


09 Sep, 2015

1 commit

  • The privcmd code is mixing the usage of GFN and MFN within the same
    functions which make the code difficult to understand when you only work
    with auto-translated guests.

    The privcmd driver is only dealing with GFN so replace all the mention
    of MFN into GFN.

    The ioctl structure used to map foreign change has been left unchanged
    given that the userspace is using it. Nonetheless, add a comment to
    explain the expected value within the "mfn" field.

    Signed-off-by: Julien Grall
    Reviewed-by: David Vrabel
    Signed-off-by: David Vrabel

    Julien Grall
     

30 Apr, 2015

1 commit

  • Commit 77e32c89a711 ("clockevents: Manage device's state separately for
    the core") decouples clockevent device's modes from states. With this
    change when a Xen guest tries to resume, it won't be calling its
    set_mode op which needs to be done on each VCPU in order to make the
    hypervisor aware that we are in oneshot mode.

    This happens because clockevents_tick_resume() (which is an intermediate
    step of resuming ticks on a processor) doesn't call clockevents_set_state()
    anymore and because during suspend clockevent devices on all VCPUs (except
    for the one doing the suspend) are left in ONESHOT state. As result, during
    resume the clockevents state machine will assume that device is already
    where it should be and doesn't need to be updated.

    To avoid this problem we should suspend ticks on all VCPUs during
    suspend.

    Signed-off-by: Boris Ostrovsky
    Signed-off-by: David Vrabel

    Boris Ostrovsky
     

16 Mar, 2015

2 commits

  • Make the IOCTL_PRIVCMD_MMAPBATCH_V2 (and older V1 version) map
    multiple frames at a time rather than one at a time, despite the pages
    being non-consecutive GFNs.

    xen_remap_foreign_mfn_array() is added which maps an array of GFNs
    (instead of a consecutive range of GFNs).

    Since per-frame errors are returned in an array, privcmd must set the
    MMAPBATCH_V1 error bits as part of the "report errors" phase, after
    all the frames are mapped.

    Migrate times are significantly improved (when using a PV toolstack
    domain). For example, for an idle 12 GiB PV guest:

    Before After
    real 0m38.179s 0m26.868s
    user 0m15.096s 0m13.652s
    sys 0m28.988s 0m18.732s

    Signed-off-by: David Vrabel
    Reviewed-by: Stefano Stabellini

    David Vrabel
     
  • Auto-translated physmap guests (arm, arm64 and x86 PVHVM/PVH) map and
    unmap foreign GFNs using the same method (updating the physmap).
    Unify the two arm and x86 implementations into one commont one.

    Note that on arm and arm64, the correct error code will be returned
    (instead of always -EFAULT) and map/unmap failure warnings are no
    longer printed. These changes are required if the foreign domain is
    paging (-ENOENT failures are expected and must be propagated up to the
    caller).

    Signed-off-by: David Vrabel
    Reviewed-by: Stefano Stabellini

    David Vrabel
     

24 Feb, 2015

1 commit

  • Hypercalls submitted by user space tools via the privcmd driver can
    take a long time (potentially many 10s of seconds) if the hypercall
    has many sub-operations.

    A fully preemptible kernel may deschedule such as task in any upcall
    called from a hypercall continuation.

    However, in a kernel with voluntary or no preemption, hypercall
    continuations in Xen allow event handlers to be run but the task
    issuing the hypercall will not be descheduled until the hypercall is
    complete and the ioctl returns to user space. These long running
    tasks may also trigger the kernel's soft lockup detection.

    Add xen_preemptible_hcall_begin() and xen_preemptible_hcall_end() to
    bracket hypercalls that may be preempted. Use these in the privcmd
    driver.

    When returning from an upcall, call xen_maybe_preempt_hcall() which
    adds a schedule point if if the current task was within a preemptible
    hypercall.

    Since _cond_resched() can move the task to a different CPU, clear and
    set xen_in_preemptible_hcall around the call.

    Signed-off-by: David Vrabel
    Reviewed-by: Boris Ostrovsky

    David Vrabel
     

19 Jul, 2014

2 commits

  • Add inline keyword to silence the following compiler
    warnings if xen_efi_probe() is not used:

    CC arch/x86/xen/setup.o
    In file included from arch/x86/xen/xen-ops.h:7:0,
    from arch/x86/xen/setup.c:31:
    include/xen/xen-ops.h:43:35: warning: ‘xen_efi_probe’ defined but not used [-Wunused-function]

    Signed-off-by: Daniel Kiper
    Reviewed-by: Konrad Rzeszutek Wilk
    Signed-off-by: Matt Fleming

    Daniel Kiper
     
  • This patch enables EFI usage under Xen dom0. Standard EFI Linux
    Kernel infrastructure cannot be used because it requires direct
    access to EFI data and code. However, in dom0 case it is not possible
    because above mentioned EFI stuff is fully owned and controlled
    by Xen hypervisor. In this case all calls from dom0 to EFI must
    be requested via special hypercall which in turn executes relevant
    EFI code in behalf of dom0.

    When dom0 kernel boots it checks for EFI availability on a machine.
    If it is detected then artificial EFI system table is filled.
    Native EFI callas are replaced by functions which mimics them
    by calling relevant hypercall. Later pointer to EFI system table
    is passed to standard EFI machinery and it continues EFI subsystem
    initialization taking into account that there is no direct access
    to EFI boot services, runtime, tables, structures, etc. After that
    system runs as usual.

    This patch is based on Jan Beulich and Tang Liang work.

    Signed-off-by: Jan Beulich
    Signed-off-by: Tang Liang
    Signed-off-by: Daniel Kiper
    Reviewed-by: David Vrabel
    Acked-by: Stefano Stabellini

    Daniel Kiper
     

13 May, 2014

1 commit

  • New architectures currently have to provide implementations of 5 different
    functions: xen_arch_pre_suspend(), xen_arch_post_suspend(),
    xen_arch_hvm_post_suspend(), xen_mm_pin_all(), and xen_mm_unpin_all().

    Refactor the suspend code to only require xen_arch_pre_suspend() and
    xen_arch_post_suspend().

    Signed-off-by: David Vrabel
    Reviewed-by: Boris Ostrovsky

    David Vrabel
     

18 Mar, 2014

1 commit

  • syscore->resume() callback is expected to do not enable interrupts,
    it generates warning like below otherwise:

    [ 9386.365390] WARNING: CPU: 0 PID: 6733 at drivers/base/syscore.c:104 syscore_resume+0x9a/0xe0()
    [ 9386.365403] Interrupts enabled after xen_acpi_processor_resume+0x0/0x34 [xen_acpi_processor]
    ...
    [ 9386.365429] Call Trace:
    [ 9386.365434] [] dump_stack+0x45/0x56
    [ 9386.365437] [] warn_slowpath_common+0x7d/0xa0
    [ 9386.365439] [] warn_slowpath_fmt+0x4c/0x50
    [ 9386.365442] [] ? xen_upload_processor_pm_data+0x300/0x300 [xen_acpi_processor]
    [ 9386.365443] [] syscore_resume+0x9a/0xe0
    [ 9386.365445] [] suspend_devices_and_enter+0x402/0x470
    [ 9386.365447] [] pm_suspend+0x178/0x260

    On xen_acpi_processor_resume() we call various procedures, which are
    non atomic and can enable interrupts. To prevent the issue introduce
    separate resume notify called after we enable interrupts on resume
    and before we call other drivers resume callbacks.

    Signed-off-by: Stanislaw Gruszka
    Signed-off-by: Konrad Rzeszutek Wilk

    Stanislaw Gruszka
     

10 Oct, 2013

2 commits

  • Use xen_alloc_coherent_pages and xen_free_coherent_pages to allocate or
    free coherent pages.

    We need to be careful handling the pointer returned by
    xen_alloc_coherent_pages, because on ARM the pointer is not equal to
    phys_to_virt(*dma_handle). In fact virt_to_phys only works for kernel
    direct mapped RAM memory.
    In ARM case the pointer could be an ioremap address, therefore passing
    it to virt_to_phys would give you another physical address that doesn't
    correspond to it.

    Make xen_create_contiguous_region take a phys_addr_t as start parameter to
    avoid the virt_to_phys calls which would be incorrect.

    Changes in v6:
    - remove extra spaces.

    Signed-off-by: Stefano Stabellini
    Reviewed-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     
  • Modify xen_create_contiguous_region to return the dma address of the
    newly contiguous buffer.

    Signed-off-by: Stefano Stabellini
    Acked-by: Konrad Rzeszutek Wilk
    Reviewed-by: David Vrabel

    Changes in v4:
    - use virt_to_machine instead of virt_to_bus.

    Stefano Stabellini
     

01 Dec, 2012

1 commit

  • …to stable/for-linus-3.8

    * 'arm-privcmd-for-3.8' of git://xenbits.xen.org/people/ianc/linux:
    xen: arm: implement remap interfaces needed for privcmd mappings.
    xen: correctly use xen_pfn_t in remap_domain_mfn_range.
    xen: arm: enable balloon driver
    xen: balloon: allow PVMMU interfaces to be compiled out
    xen: privcmd: support autotranslated physmap guests.
    xen: add pages parameter to xen_remap_domain_mfn_range

    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

    Konrad Rzeszutek Wilk
     

29 Nov, 2012

3 commits


29 Mar, 2012

1 commit


26 Feb, 2011

1 commit


21 Oct, 2010

1 commit


13 Aug, 2010

1 commit

  • * 'stable/xen-swiotlb-0.8.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    x86: Detect whether we should use Xen SWIOTLB.
    pci-swiotlb-xen: Add glue code to setup dma_ops utilizing xen_swiotlb_* functions.
    swiotlb-xen: SWIOTLB library for Xen PV guest with PCI passthrough.
    xen/mmu: inhibit vmap aliases rather than trying to clear them out
    vmap: add flag to allow lazy unmap to be disabled at runtime
    xen: Add xen_create_contiguous_region
    xen: Rename the balloon lock
    xen: Allow unprivileged Xen domains to create iomap pages
    xen: use _PAGE_IOMAP in ioremap to do machine mappings

    Fix up trivial conflicts (adding both xen swiotlb and xen pci platform
    driver setup close to each other) in drivers/xen/{Kconfig,Makefile} and
    include/xen/xen-ops.h

    Linus Torvalds
     

23 Jul, 2010

1 commit


08 Jun, 2010

1 commit

  • A memory region must be physically contiguous in order to be accessed
    through DMA. This patch adds xen_create_contiguous_region, which
    ensures a region of contiguous virtual memory is also physically
    contiguous.

    Based on Stephen Tweedie's port of the 2.6.18-xen version.

    Remove contiguous_bitmap[] as it's no longer needed.

    Ported from linux-2.6.18-xen.hg 707:e410857fd83c

    [ Impact: add Xen-internal API to make pages phys-contig ]

    Signed-off-by: Alex Nixon
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk

    Alex Nixon
     

16 Jul, 2008

1 commit

  • add xen_timer_resume() hook.

    Timer resume should be done after event channel is resumed.
    add xen_arch_resume() hook when ipi becomes usable after resume.
    After resume, some cpu specific resource must be reinitialized
    on ia64 that can't be set by another cpu.

    However available hooks is run once on only one cpu so that ipi has
    to be used.

    During stop_machine_run() ipi can't be used because interrupt is masked.
    So add another hook after stop_machine_run().
    Another approach might be use resume hook which is run by
    device_resume(). However device_resume() may be executed on
    suspend error recovery path.

    So it is necessary to determine whether it is executed on real resume path
    or error recovery path.

    Signed-off-by: Isaku Yamahata
    Cc: Stephen Tweedie
    Cc: Eduardo Habkost
    Cc: Mark McLoughlin
    Signed-off-by: Ingo Molnar

    Isaku Yamahata
     

27 May, 2008

2 commits

  • Hook into the device model to make sure that timekeeping's resume handler
    is called. This deals with our clocksource's non-monotonicity over the
    save/restore. Explicitly call clock_has_changed() to make sure that
    all the timers get retriggered properly.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     
  • This patch implements Xen save/restore and migration.

    Saving is triggered via xenbus, which is polled in
    drivers/xen/manage.c. When a suspend request comes in, the kernel
    prepares itself for saving by:

    1 - Freeze all processes. This is primarily to prevent any
    partially-completed pagetable updates from confusing the suspend
    process. If CONFIG_PREEMPT isn't defined, then this isn't necessary.

    2 - Suspend xenbus and other devices

    3 - Stop_machine, to make sure all the other vcpus are quiescent. The
    Xen tools require the domain to run its save off vcpu0.

    4 - Within the stop_machine state, it pins any unpinned pgds (under
    construction or destruction), performs canonicalizes various other
    pieces of state (mostly converting mfns to pfns), and finally

    5 - Suspend the domain

    Restore reverses the steps used to save the domain, ending when all
    the frozen processes are thawed.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     

25 Apr, 2008

1 commit