10 Jun, 2017

1 commit


07 Jun, 2017

1 commit

  • Commit 5995a68 "xen/privcmd: Add support for Linux 64KB page granularity" did
    not go far enough to support 64KB in mmap_batch_fn.

    The variable 'nr' is the number of 4KB chunk to map. However, when Linux
    is using 64KB page granularity the array of pages (vma->vm_private_data)
    contain one page per 64KB. Fix it by incrementing st->index correctly.

    Furthermore, st->va is not correctly incremented as PAGE_SIZE !=
    XEN_PAGE_SIZE.

    Fixes: 5995a68 ("xen/privcmd: Add support for Linux 64KB page granularity")
    CC: stable@vger.kernel.org
    Reported-by: Feng Kan
    Signed-off-by: Julien Grall
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Juergen Gross

    Julien Grall
     

10 May, 2017

1 commit

  • Pull misc vfs updates from Al Viro:
    "Assorted bits and pieces from various people. No common topic in this
    pile, sorry"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs/affs: add rename exchange
    fs/affs: add rename2 to prepare multiple methods
    Make stat/lstat/fstatat pass AT_NO_AUTOMOUNT to vfs_statx()
    fs: don't set *REFERENCED on single use objects
    fs: compat: Remove warning from COMPATIBLE_IOCTL
    remove pointless extern of atime_need_update_rcu()
    fs: completely ignore unknown open flags
    fs: add a VALID_OPEN_FLAGS
    fs: remove _submit_bh()
    fs: constify tree_descr arrays passed to simple_fill_super()
    fs: drop duplicate header percpu-rwsem.h
    fs/affs: bugfix: Write files greater than page size on OFS
    fs/affs: bugfix: enable writes on OFS disks
    fs/affs: remove node generation check
    fs/affs: import amigaffs.h
    fs/affs: bugfix: make symbolic links work again

    Linus Torvalds
     

09 May, 2017

1 commit

  • There are many code paths opencoding kvmalloc. Let's use the helper
    instead. The main difference to kvmalloc is that those users are
    usually not considering all the aspects of the memory allocator. E.g.
    allocation requests
    Reviewed-by: Boris Ostrovsky # Xen bits
    Acked-by: Kees Cook
    Acked-by: Vlastimil Babka
    Acked-by: Andreas Dilger # Lustre
    Acked-by: Christian Borntraeger # KVM/s390
    Acked-by: Dan Williams # nvdim
    Acked-by: David Sterba # btrfs
    Acked-by: Ilya Dryomov # Ceph
    Acked-by: Tariq Toukan # mlx4
    Acked-by: Leon Romanovsky # mlx5
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Herbert Xu
    Cc: Anton Vorontsov
    Cc: Colin Cross
    Cc: Tony Luck
    Cc: "Rafael J. Wysocki"
    Cc: Ben Skeggs
    Cc: Kent Overstreet
    Cc: Santosh Raspatur
    Cc: Hariprasad S
    Cc: Yishai Hadas
    Cc: Oleg Drokin
    Cc: "Yan, Zheng"
    Cc: Alexander Viro
    Cc: Alexei Starovoitov
    Cc: Eric Dumazet
    Cc: David Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     

02 May, 2017

4 commits

  • When rebooting DOM0 with ACPI on ARM64, the kernel is crashing with the stack
    trace [1].

    This is happening because when EFI runtimes are enabled, the reset code
    (see machine_restart) will first try to use EFI restart method.

    However, the EFI restart code is expecting the reset_system callback to
    be always set. This is not the case for Xen and will lead to crash.

    The EFI restart helper is used in multiple places and some of them don't
    not have fallback (see machine_power_off). So implement reset_system
    callback as a call to xen_reboot when using EFI Xen.

    [ 36.999270] reboot: Restarting system
    [ 37.002921] Internal error: Attempting to execute userspace memory: 86000004 [#1] PREEMPT SMP
    [ 37.011460] Modules linked in:
    [ 37.014598] CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 4.11.0-rc1-00003-g1e248b60a39b-dirty #506
    [ 37.023903] Hardware name: (null) (DT)
    [ 37.027734] task: ffff800902068000 task.stack: ffff800902064000
    [ 37.033739] PC is at 0x0
    [ 37.036359] LR is at efi_reboot+0x94/0xd0
    [ 37.040438] pc : [] lr : [] pstate: 404001c5
    [ 37.047920] sp : ffff800902067cf0
    [ 37.051314] x29: ffff800902067cf0 x28: ffff800902068000
    [ 37.056709] x27: ffff000008992000 x26: 000000000000008e
    [ 37.062104] x25: 0000000000000123 x24: 0000000000000015
    [ 37.067499] x23: 0000000000000000 x22: ffff000008e6e250
    [ 37.072894] x21: ffff000008e6e000 x20: 0000000000000000
    [ 37.078289] x19: ffff000008e5d4c8 x18: 0000000000000010
    [ 37.083684] x17: 0000ffffa7c27470 x16: 00000000deadbeef
    [ 37.089079] x15: 0000000000000006 x14: ffff000088f42bef
    [ 37.094474] x13: ffff000008f42bfd x12: ffff000008e706c0
    [ 37.099870] x11: ffff000008e70000 x10: 0000000005f5e0ff
    [ 37.105265] x9 : ffff800902067a50 x8 : 6974726174736552
    [ 37.110660] x7 : ffff000008cc6fb8 x6 : ffff000008cc6fb0
    [ 37.116055] x5 : ffff000008c97dd8 x4 : 0000000000000000
    [ 37.121453] x3 : 0000000000000000 x2 : 0000000000000000
    [ 37.126845] x1 : 0000000000000000 x0 : 0000000000000000
    [ 37.132239]
    [ 37.133808] Process systemd-shutdow (pid: 1, stack limit = 0xffff800902064000)
    [ 37.141118] Stack: (0xffff800902067cf0 to 0xffff800902068000)
    [ 37.146949] 7ce0: ffff800902067d40 ffff000008085334
    [ 37.154869] 7d00: 0000000000000000 ffff000008f3b000 ffff800902067d40 ffff0000080852e0
    [ 37.162787] 7d20: ffff000008cc6fb0 ffff000008cc6fb8 ffff000008c7f580 ffff000008c97dd8
    [ 37.170706] 7d40: ffff800902067d60 ffff0000080e2c2c 0000000000000000 0000000001234567
    [ 37.178624] 7d60: ffff800902067d80 ffff0000080e2ee8 0000000000000000 ffff0000080e2df4
    [ 37.186544] 7d80: 0000000000000000 ffff0000080830f0 0000000000000000 00008008ff1c1000
    [ 37.194462] 7da0: ffffffffffffffff 0000ffffa7c4b1cc 0000000000000000 0000000000000024
    [ 37.202380] 7dc0: ffff800902067dd0 0000000000000005 0000fffff24743c8 0000000000000004
    [ 37.210299] 7de0: 0000fffff2475f03 0000000000000010 0000fffff2474418 0000000000000005
    [ 37.218218] 7e00: 0000fffff2474578 000000000000000a 0000aaaad6b722c0 0000000000000001
    [ 37.226136] 7e20: 0000000000000123 0000000000000038 ffff800902067e50 ffff0000081e7294
    [ 37.234055] 7e40: ffff800902067e60 ffff0000081e935c ffff800902067e60 ffff0000081e9388
    [ 37.241973] 7e60: ffff800902067eb0 ffff0000081ea388 0000000000000000 00008008ff1c1000
    [ 37.249892] 7e80: ffffffffffffffff 0000ffffa7c4a79c 0000000000000000 ffff000000020000
    [ 37.257810] 7ea0: 0000010000000004 0000000000000000 0000000000000000 ffff0000080830f0
    [ 37.265729] 7ec0: fffffffffee1dead 0000000028121969 0000000001234567 0000000000000000
    [ 37.273651] 7ee0: ffffffffffffffff 8080000000800000 0000800000008080 feffa9a9d4ff2d66
    [ 37.281567] 7f00: 000000000000008e feffa9a9d5b60e0f 7f7fffffffff7f7f 0101010101010101
    [ 37.289485] 7f20: 0000000000000010 0000000000000008 000000000000003a 0000ffffa7ccf588
    [ 37.297404] 7f40: 0000aaaad6b87d00 0000ffffa7c4b1b0 0000fffff2474be0 0000aaaad6b88000
    [ 37.305326] 7f60: 0000fffff2474fb0 0000000001234567 0000000000000000 0000000000000000
    [ 37.313240] 7f80: 0000000000000000 0000000000000001 0000aaaad6b70d4d 0000000000000000
    [ 37.321159] 7fa0: 0000000000000001 0000fffff2474ea0 0000aaaad6b5e2e0 0000fffff2474e80
    [ 37.329078] 7fc0: 0000ffffa7c4b1cc 0000000000000000 fffffffffee1dead 000000000000008e
    [ 37.336997] 7fe0: 0000000000000000 0000000000000000 9ce839cffee77eab fafdbf9f7ed57f2f
    [ 37.344911] Call trace:
    [ 37.347437] Exception stack(0xffff800902067b20 to 0xffff800902067c50)
    [ 37.353970] 7b20: ffff000008e5d4c8 0001000000000000 0000000080f82000 0000000000000000
    [ 37.361883] 7b40: ffff800902067b60 ffff000008e17000 ffff000008f44c68 00000001081081b4
    [ 37.369802] 7b60: ffff800902067bf0 ffff000008108478 0000000000000000 ffff000008c235b0
    [ 37.377721] 7b80: ffff800902067ce0 0000000000000000 0000000000000000 0000000000000015
    [ 37.385643] 7ba0: 0000000000000123 000000000000008e ffff000008992000 ffff800902068000
    [ 37.393557] 7bc0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    [ 37.401477] 7be0: 0000000000000000 ffff000008c97dd8 ffff000008cc6fb0 ffff000008cc6fb8
    [ 37.409396] 7c00: 6974726174736552 ffff800902067a50 0000000005f5e0ff ffff000008e70000
    [ 37.417318] 7c20: ffff000008e706c0 ffff000008f42bfd ffff000088f42bef 0000000000000006
    [ 37.425234] 7c40: 00000000deadbeef 0000ffffa7c27470
    [ 37.430190] [< (null)>] (null)
    [ 37.434982] [] machine_restart+0x6c/0x70
    [ 37.440550] [] kernel_restart+0x6c/0x78
    [ 37.446030] [] SyS_reboot+0x130/0x228
    [ 37.451337] [] el0_svc_naked+0x24/0x28
    [ 37.456737] Code: bad PC value
    [ 37.459891] ---[ end trace 76e2fc17e050aecd ]---

    Signed-off-by: Julien Grall

    --

    Cc: Boris Ostrovsky
    Cc: Juergen Gross
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: x86@kernel.org

    The x86 code has theoritically a similar issue, altought EFI does not
    seem to be the preferred method. I have only built test it on x86.

    This should also probably be fixed in stable tree.

    Changes in v2:
    - Implement xen_efi_reset_system using xen_reboot
    - Move xen_efi_reset_system in drivers/xen/efi.c
    Signed-off-by: Juergen Gross

    Julien Grall
     
  • Recent discussion (http://marc.info/?l=xen-devel&m=149192184523741)
    established that commit 72a9b186292d ("xen: Remove event channel
    notification through Xen PCI platform device") (and thus commit
    da72ff5bfcb0 ("partially revert "xen: Remove event channel
    notification through Xen PCI platform device"")) are unnecessary and,
    in fact, prevent HVM guests from booting on Xen releases prior to 4.0

    Therefore we revert both of those commits.

    The summary of that discussion is below:

    Here is the brief summary of the current situation:

    Before the offending commit (72a9b186292):

    1) INTx does not work because of the reset_watches path.
    2) The reset_watches path is only taken if you have Xen > 4.0
    3) The Linux Kernel by default will use vector inject if the hypervisor
    support. So even INTx does not work no body running the kernel with
    Xen > 4.0 would notice. Unless he explicitly disabled this feature
    either in the kernel or in Xen (and this can only be disabled by
    modifying the code, not user-supported way to do it).

    After the offending commit (+ partial revert):

    1) INTx is no longer support for HVM (only for PV guests).
    2) Any HVM guest The kernel will not boot on Xen < 4.0 which does
    not have vector injection support. Since the only other mode
    supported is INTx which.

    So based on this summary, I think before commit (72a9b186292) we were
    in much better position from a user point of view.

    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Boris Ostrovsky
     
  • Now that __generic_dma_ops is a xen specific function, rename it to
    xen_get_dma_ops. Change all the call sites appropriately.

    Signed-off-by: Stefano Stabellini
    Reviewed-by: Boris Ostrovsky
    Acked-by: Konrad Rzeszutek Wilk
    CC: linux@armlinux.org.uk
    CC: catalin.marinas@arm.com
    CC: will.deacon@arm.com
    CC: boris.ostrovsky@oracle.com
    CC: jgross@suse.com
    CC: Julien Grall

    Stefano Stabellini
     
  • Balloon driver uses several PV-only concepts (xen_start_info,
    xen_extra_mem,..) and it seems the simpliest solution to make HVM-only
    build happy is to decorate these parts with #ifdefs.

    Signed-off-by: Vitaly Kuznetsov
    Reviewed-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Vitaly Kuznetsov
     

27 Apr, 2017

1 commit

  • simple_fill_super() is passed an array of tree_descr structures which
    describe the files to create in the filesystem's root directory. Since
    these arrays are never modified intentionally, they should be 'const' so
    that they are placed in .rodata and benefit from memory protection.
    This patch updates the function signature and all users, and also
    constifies tree_descr.name.

    Signed-off-by: Eric Biggers
    Signed-off-by: Al Viro

    Eric Biggers
     

04 Apr, 2017

1 commit

  • After allocation the item is being placed on the list right away.
    Consequently it needs to be taken off the list before freeing in the
    case xenbus_dev_request_and_reply() failed, as in that case the
    callback (xenbus_dev_queue_reply()) is not being called (and if it
    was called, it should do both).

    Fixes: 5584ea250ae44f929feb4c7bd3877d1c5edbf813
    Signed-off-by: Jan Beulich
    Reviewed-by: Juergen Gross
    Signed-off-by: Boris Ostrovsky

    Jan Beulich
     

24 Mar, 2017

1 commit

  • This was broken in commit cd979883b9ed ("xen/acpi-processor:
    fix enabling interrupts on syscore_resume"). do_suspend (from
    xen/manage.c) and thus xen_resume_notifier never get called on
    the initial-domain at resume (it is if running as guest.)

    The rationale for the breaking change was that upload_pm_data()
    potentially does blocking work in syscore_resume(). This patch
    addresses the original issue by scheduling upload_pm_data() to
    execute in workqueue context.

    Cc: Stanislaw Gruszka
    Cc: stable@vger.kernel.org
    Based-on-patch-by: Konrad Wilk
    Reviewed-by: Konrad Rzeszutek Wilk
    Reviewed-by: Stanislaw Gruszka
    Signed-off-by: Ankur Arora
    Signed-off-by: Boris Ostrovsky

    Ankur Arora
     

23 Mar, 2017

1 commit


14 Mar, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: Boris Ostrovsky

    Elena Reshetova
     

10 Mar, 2017

1 commit


08 Mar, 2017

1 commit


02 Mar, 2017

2 commits

  • Add #include dependencies to all .c files rely on sched.h
    doing that for them.

    Note that even if the count where we need to add extra headers seems high,
    it's still a net win, because is included in over
    2,200 files ...

    Acked-by: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • We are going to split out of , which
    will have to be picked up from other headers and a couple of .c files.

    Create a trivial placeholder file that just
    maps to to make this patch obviously correct and
    bisectable.

    The APIs that are going to be moved first are:

    mm_alloc()
    __mmdrop()
    mmdrop()
    mmdrop_async_fn()
    mmdrop_async()
    mmget_not_zero()
    mmput()
    mmput_async()
    get_task_mm()
    mm_access()
    mm_release()

    Include the new header in the files that are going to need it.

    Acked-by: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

27 Feb, 2017

1 commit


25 Feb, 2017

1 commit

  • ->fault(), ->page_mkwrite(), and ->pfn_mkwrite() calls do not need to
    take a vma and vmf parameter when the vma already resides in vmf.

    Remove the vma parameter to simplify things.

    [arnd@arndb.de: fix ARM build]
    Link: http://lkml.kernel.org/r/20170125223558.1451224-1-arnd@arndb.de
    Link: http://lkml.kernel.org/r/148521301778.19116.10840599906674778980.stgit@djiang5-desk3.ch.intel.com
    Signed-off-by: Dave Jiang
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Ross Zwisler
    Cc: Theodore Ts'o
    Cc: Darrick J. Wong
    Cc: Matthew Wilcox
    Cc: Dave Hansen
    Cc: Christoph Hellwig
    Cc: Jan Kara
    Cc: Dan Williams
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Jiang
     

15 Feb, 2017

2 commits

  • The purpose if this ioctl is to allow a user of privcmd to restrict its
    operation such that it will no longer service arbitrary hypercalls via
    IOCTL_PRIVCMD_HYPERCALL, and will check for a matching domid when
    servicing IOCTL_PRIVCMD_DM_OP or IOCTL_PRIVCMD_MMAP*. The aim of this
    is to limit the attack surface for a compromised device model.

    Signed-off-by: Paul Durrant
    Signed-off-by: Boris Ostrovsky

    Paul Durrant
     
  • Recently a new dm_op[1] hypercall was added to Xen to provide a mechanism
    for restricting device emulators (such as QEMU) to a limited set of
    hypervisor operations, and being able to audit those operations in the
    kernel of the domain in which they run.

    This patch adds IOCTL_PRIVCMD_DM_OP as gateway for __HYPERVISOR_dm_op.

    NOTE: There is no requirement for user-space code to bounce data through
    locked memory buffers (as with IOCTL_PRIVCMD_HYPERCALL) since
    privcmd has enough information to lock the original buffers
    directly.

    [1] http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=524a98c2

    Signed-off-by: Paul Durrant
    Acked-by: Stefano Stabellini
    Signed-off-by: Boris Ostrovsky

    Paul Durrant
     

14 Feb, 2017

3 commits


10 Feb, 2017

3 commits

  • Handling of multiple concurrent Xenstore accesses through xenbus driver
    either from the kernel or user land is rather lame today: xenbus is
    capable to have one access active only at one point of time.

    Rewrite xenbus to handle multiple requests concurrently by making use
    of the request id of the Xenstore protocol. This requires to:

    - Instead of blocking inside xb_read() when trying to read data from
    the xenstore ring buffer do so only in the main loop of
    xenbus_thread().

    - Instead of doing writes to the xenstore ring buffer in the context of
    the caller just queue the request and do the write in the dedicated
    xenbus thread.

    - Instead of just forwarding the request id specified by the caller of
    xenbus to xenstore use a xenbus internal unique request id. This will
    allow multiple outstanding requests.

    - Modify the locking scheme in order to allow multiple requests being
    active in parallel.

    - Instead of waiting for the reply of a user's xenstore request after
    writing the request to the xenstore ring buffer return directly to
    the caller and do the waiting in the read path.

    Additionally signal handling was optimized by avoiding waking up the
    xenbus thread or sending an event to Xenstore in case the addressed
    entity is known to be running already.

    As a result communication with Xenstore is sped up by a factor of up
    to 5: depending on the request type (read or write) and the amount of
    data transferred the gain was at least 20% (small reads) and went up to
    a factor of 5 for large writes.

    In the end some more rough edges of xenbus have been smoothed:

    - Handling of memory shortage when reading from xenstore ring buffer in
    the xenbus driver was not optimal: it was busy looping and issuing a
    warning in each loop.

    - In case of xenstore not running in dom0 but in a stubdom we end up
    with two xenbus threads running as the initialization of xenbus in
    dom0 expecting a local xenstored will be redone later when connecting
    to the xenstore domain. Up to now this was no problem as locking
    would prevent the two xenbus threads interfering with each other, but
    this was just a waste of kernel resources.

    - An out of memory situation while writing to or reading from the
    xenstore ring buffer no longer will lead to a possible loss of
    synchronization with xenstore.

    - The user read and write part are now interruptible by signals.

    Signed-off-by: Juergen Gross
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     
  • Today a Xenstore watch event is delivered via a callback function
    declared as:

    void (*callback)(struct xenbus_watch *,
    const char **vec, unsigned int len);

    As all watch events only ever come with two parameters (path and token)
    changing the prototype to:

    void (*callback)(struct xenbus_watch *,
    const char *path, const char *token);

    is the natural thing to do.

    Apply this change and adapt all users.

    Cc: konrad.wilk@oracle.com
    Cc: roger.pau@citrix.com
    Cc: wei.liu2@citrix.com
    Cc: paul.durrant@citrix.com
    Cc: netdev@vger.kernel.org

    Signed-off-by: Juergen Gross
    Reviewed-by: Paul Durrant
    Reviewed-by: Wei Liu
    Reviewed-by: Roger Pau Monné
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     
  • The xenbus driver has an awful mixture of internally and globally
    visible headers: some of the internally used only stuff is defined in
    the global header include/xen/xenbus.h while some stuff defined in
    internal headers is used by other drivers, too.

    Clean this up by moving the externally used symbols to
    include/xen/xenbus.h and the symbols used internally only to a new
    header drivers/xen/xenbus/xenbus.h replacing xenbus_comms.h and
    xenbus_probe.h

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     

08 Feb, 2017

1 commit


07 Feb, 2017

3 commits

  • PVH guests don't (yet) receive ACPI hotplug interrupts and therefore
    need to monitor xenstore for CPU hotplug event.

    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Juergen Gross

    Boris Ostrovsky
     
  • Like PV guests, PVH does not have PCI devices and therefore cannot
    use MMIO space to store grants. Instead it balloons out memory and
    keeps grants there.

    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Juergen Gross

    Boris Ostrovsky
     
  • We are replacing existing PVH guests with new implementation.

    We are keeping xen_pvh_domain() macro (for now set to zero) because
    when we introduce new PVH implementation later in this series we will
    reuse current PVH-specific code (xen_pvh_gnttab_setup()), and that
    code is conditioned by 'if (xen_pvh_domain())'. (We will also need
    a noop xen_pvh_domain() for !CONFIG_XEN_PVH).

    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Juergen Gross
    Reviewed-by: Konrad Rzeszutek Wilk

    Boris Ostrovsky
     

04 Feb, 2017

1 commit


28 Jan, 2017

1 commit


20 Jan, 2017

2 commits

  • In xen_swiotlb_map_page and xen_swiotlb_map_sg_attrs, if the original
    page is not suitable, we swap it for another page from the swiotlb
    pool.

    In these cases, we don't update the previously calculated dma address
    for the page before calling xen_dma_map_page. Thus, we end up calling
    xen_dma_map_page passing the wrong dev_addr, resulting in
    xen_dma_map_page mistakenly assuming that the page is foreign when it is
    local.

    Fix the bug by updating dev_addr appropriately.

    This change has no effect on x86, because xen_dma_map_page is a stub
    there.

    Signed-off-by: Stefano Stabellini
    Signed-off-by: Pooya Keshavarzi
    Tested-by: Pooya Keshavarzi
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     
  • Pull xen fix from Juergen Gross:
    "A fix for Xen running in nested virtualization environment"

    * tag 'for-linus-4.10-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    partially revert "xen: Remove event channel notification through Xen PCI platform device"

    Linus Torvalds
     

14 Jan, 2017

1 commit

  • Commit 72a9b186292d ("xen: Remove event channel notification through Xen
    PCI platform device") broke Linux when booting as Dom0 on Xen in a
    nested Xen environment (Xen installed inside a Xen VM). In this
    scenario, Linux is a PV guest, but at the same time it uses the
    platform-pci driver to receive notifications from L0 Xen. vector
    callbacks are not available because L1 Xen doesn't allow them.

    Partially revert the offending commit, by restoring IRQ based
    notifications for PV guests only. I restored only the code which is
    strictly needed and replaced the xen_have_vector_callback checks within
    it with xen_pv_domain() checks.

    Signed-off-by: Stefano Stabellini
    Reviewed-by: Boris Ostrovsky

    Stefano Stabellini
     

07 Jan, 2017

2 commits

  • Pull swiotlb fixes from Konrad Rzeszutek Wilk:
    "This has one fix to make i915 work when using Xen SWIOTLB, and a
    feature from Geert to aid in debugging of devices that can't do DMA
    outside the 32-bit address space.

    The feature from Geert is on top of v4.10 merge window commit
    (specifically you pulling my previous branch), as his changes were
    dependent on the Documentation/ movement patches.

    I figured it would just easier than me trying than to cherry-pick the
    Documentation patches to satisfy git.

    The patches have been soaking since 12/20, albeit I updated the last
    patch due to linux-next catching an compiler error and adding an
    Tested-and-Reported-by tag"

    * 'stable/for-linus-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
    swiotlb: Export swiotlb_max_segment to users
    swiotlb: Add swiotlb=noforce debug option
    swiotlb: Convert swiotlb_force from int to enum
    x86, swiotlb: Simplify pci_swiotlb_detect_override()

    Linus Torvalds
     
  • So they can figure out what is the optimal number of pages
    that can be contingously stitched together without fear of
    bounce buffer.

    We also expose an mechanism for sub-users of SWIOTLB API, such
    as Xen-SWIOTLB to set the max segment value. And lastly
    if swiotlb=force is set (which mandates we bounce buffer everything)
    we set max_segment so at least we can bounce buffer one 4K page
    instead of a giant 512KB one for which we may not have space.

    Signed-off-by: Konrad Rzeszutek Wilk
    Reported-and-Tested-by: Juergen Gross

    Konrad Rzeszutek Wilk
     

06 Jan, 2017

1 commit

  • Pull xen fixes and cleanups from Juergen Gross:

    - small fixes for xenbus driver

    - one fix for xen dom0 boot on huge system

    - small cleanups

    * tag 'for-linus-4.10-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    Xen: ARM: Zero reserved fields of xatp before making hypervisor call
    xen: events: Replace BUG() with BUG_ON()
    xen: remove stale xs_input_avail() from header
    xen: return xenstore command failures via response instead of rc
    xen: xenbus driver must not accept invalid transaction ids
    xen/evtchn: use rb_entry()
    xen/setup: Don't relocate p2m over existing one

    Linus Torvalds
     

04 Jan, 2017

1 commit