12 Feb, 2019

2 commits


31 Jan, 2019

1 commit

  • commit 2229f70b5bbb025e1394b61007938a68060afbfb upstream.

    In order to support pvclock vdso on xen we need to setup the time
    info page for vcpu 0 and register the page with Xen using the
    VCPUOP_register_vcpu_time_memory_area hypercall. This hypercall
    will also forcefully update the pvti which will set some of the
    necessary flags for vdso. Afterwards we check if it supports the
    PVCLOCK_TSC_STABLE_BIT flag which is mandatory for having
    vdso/vsyscall support. And if so, it will set the cpu 0 pvti that
    will be later on used when mapping the vdso image.

    The xen headers are also updated to include the new hypercall for
    registering the secondary vcpu_time_info struct.

    Signed-off-by: Joao Martins
    Reviewed-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky
    Signed-off-by: Juergen Gross
    Signed-off-by: Greg Kroah-Hartman

    Joao Martins
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

31 Aug, 2017

1 commit

  • Introduce the C header file which defines the PV Calls interface. It is
    imported from xen/include/public/io/pvcalls.h.

    Signed-off-by: Stefano Stabellini
    Reviewed-by: Boris Ostrovsky
    Reviewed-by: Juergen Gross
    CC: konrad.wilk@oracle.com
    CC: boris.ostrovsky@oracle.com
    CC: jgross@suse.com
    Signed-off-by: Boris Ostrovsky

    Stefano Stabellini
     

15 Jun, 2017

1 commit


02 May, 2017

6 commits

  • This is the ABI for the two halves of a para-virtualized
    display driver.

    This protocol aims to provide a unified protocol which fits more
    sophisticated use-cases than a framebuffer device can handle. At the
    moment basic functionality is supported with the intention to extend:
    o multiple dynamically allocated/destroyed framebuffers
    o buffers of arbitrary sizes
    o better configuration options including multiple display support

    Note: existing fbif can be used together with displif running at the
    same time, e.g. on Linux one provides framebuffer and another DRM/KMS

    Future extensions to the existing protocol may include:
    o allow display/connector cloning
    o allow allocating objects other than display buffers
    o add planes/overlays support
    o support scaling
    o support rotation

    Note, that this protocol doesn't use ring macros for
    bi-directional exchange (PV calls/9pfs) bacause:
    o it statically defines the use of a single page
    for the ring buffer
    o it uses direct memory access to ring's contents
    w/o memory copying
    o re-uses the same idea that kbdif/fbif use
    which for this use-case seems to be appropriate

    ==================================================
    Rationale for introducing this protocol instead of
    using the existing fbif:
    ==================================================

    1. In/out event sizes
    o fbif - 40 octets
    o displif - 40 octets
    This is only the initial version of the displif protocol
    which means that there could be requests which will not fit
    (WRT introducing some GPU related functionality
    later on). In that case we cannot alter fbif sizes as we need to
    be backward compatible an will be forced to handle those
    apart of fbif.

    2. Shared page
    Displif doesn't use anything like struct xenfb_page, but
    DEFINE_RING_TYPES(xen_displif, struct xendispl_req, struct
    xendispl_resp) which is a better and more common way.
    Output events use a shared page which only has in_cons and in_prod
    and all the rest is used for incoming events. Here struct xenfb_page
    could probably be used as is despite the fact that it only has a half
    of a page for incoming events which is only 50 events. (consider
    something like 60Hz display)

    3. Amount of changes.
    fbif only provides XENFB_TYPE_UPDATE and XENFB_TYPE_RESIZE
    events, so it looks like it is easier to get fb support into displif
    than vice versa. displif at the moment has 6 requests and 1 event,
    multiple connector support, etc.

    Signed-off-by: Oleksandr Grytsov
    Signed-off-by: Oleksandr Andrushchenko
    Acked-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Oleksandr Andrushchenko
     
  • Add ABI for the two halves of a para-virtualized
    sound driver to communicate with each other.

    The ABI allows implementing audio playback and capture as
    well as volume control and possibility to mute/unmute
    audio sources.

    Note: depending on the use-case backend can expose more sound
    cards and PCM devices/streams than the underlying HW physically
    has by employing SW mixers, configuring virtual sound streams,
    channels etc. Thus, allowing fine tunned configurations per
    frontend.

    Signed-off-by: Oleksandr Andrushchenko
    Signed-off-by: Oleksandr Grytsov
    Signed-off-by: Oleksandr Dmytryshyn
    Signed-off-by: Iurii Konovalenko
    Acked-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Oleksandr Andrushchenko
     
  • Multi-touch fields re-use the page that is used by the other features
    which means that you can interleave multi-touch, motion, and key
    events.

    Signed-off-by: Oleksandr Andrushchenko
    Acked-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Oleksandr Andrushchenko
     
  • The patch clarifies the protocol that is used by the PV keyboard
    drivers.

    Signed-off-by: Oleksandr Andrushchenko
    Acked-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Oleksandr Andrushchenko
     
  • It uses the new ring.h macros to declare rings and interfaces.

    CC: konrad.wilk@oracle.com
    CC: boris.ostrovsky@oracle.com
    CC: jgross@suse.com
    CC: groug@kaod.org

    Signed-off-by: Stefano Stabellini
    Acked-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Stefano Stabellini
     
  • Sync the ring.h file with upstream Xen, to introduce the new ring macros.
    They will be used by the Xen transport for 9pfs.

    CC: konrad.wilk@oracle.com
    CC: boris.ostrovsky@oracle.com
    CC: jgross@suse.com
    CC: groug@kaod.org

    Signed-off-by: Stefano Stabellini
    Acked-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Stefano Stabellini
     

28 Feb, 2017

1 commit


15 Feb, 2017

1 commit

  • 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
     

07 Feb, 2017

1 commit


05 Sep, 2016

1 commit

  • Import the actual version of include/xen/interface/sched.h from Xen.

    Signed-off-by: Juergen Gross
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: David Vrabel
    Cc: Douglas_Warzecha@dell.com
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: akataria@vmware.com
    Cc: boris.ostrovsky@oracle.com
    Cc: chrisw@sous-sol.org
    Cc: hpa@zytor.com
    Cc: jdelvare@suse.com
    Cc: jeremy@goop.org
    Cc: linux@roeck-us.net
    Cc: pali.rohar@gmail.com
    Cc: rusty@rustcorp.com.au
    Cc: virtualization@lists.linux-foundation.org
    Cc: xen-devel@lists.xenproject.org
    Link: http://lkml.kernel.org/r/1472453327-19050-2-git-send-email-jgross@suse.com
    Signed-off-by: Ingo Molnar

    Juergen Gross
     

06 Jul, 2016

4 commits


14 Mar, 2016

1 commit

  • The canonical netif header (in the Xen source repo) and the Linux variant
    have diverged significantly. Recently much documentation has been added to
    the canonical header which is highly useful for developers making
    modifications to either xen-netfront or xen-netback. This patch therefore
    re-imports the canonical header in its entirity.

    To maintain compatibility and some style consistency with the old Linux
    variant, the header was stripped of its emacs boilerplate, and
    post-processed and copied into place with the following commands:

    ed -s netif.h << EOF
    H
    ,s/NETTXF_/XEN_NETTXF_/g
    ,s/NETRXF_/XEN_NETRXF_/g
    ,s/NETIF_/XEN_NETIF_/g
    ,s/XEN_XEN_/XEN_/g
    ,s/netif/xen_netif/g
    ,s/xen_xen_/xen_/g
    ,s/^typedef.*$//g
    ,s/^ /${TAB}/g
    w
    $
    w
    EOF

    indent --line-length 80 --linux-style netif.h \
    -o include/xen/interface/io/netif.h

    Signed-off-by: Paul Durrant
    Cc: Konrad Rzeszutek Wilk
    Cc: Boris Ostrovsky
    Cc: David Vrabel
    Cc: Wei Liu
    Acked-by: Wei Liu
    Signed-off-by: David S. Miller

    Paul Durrant
     

22 Jan, 2016

1 commit

  • Pull block driver updates from Jens Axboe:
    "This is the block driver pull request for 4.5, with the exception of
    NVMe, which is in a separate branch and will be posted after this one.

    This pull request contains:

    - A set of bcache stability fixes, which have been acked by Kent.
    These have been used and tested for more than a year by the
    community, so it's about time that they got in.

    - A set of drbd updates from the drbd team (Andreas, Lars, Philipp)
    and Markus Elfring, Oleg Drokin.

    - A set of fixes for xen blkback/front from the usual suspects, (Bob,
    Konrad) as well as community based fixes from Kiri, Julien, and
    Peng.

    - A 2038 time fix for sx8 from Shraddha, with a fix from me.

    - A small mtip32xx cleanup from Zhu Yanjun.

    - A null_blk division fix from Arnd"

    * 'for-4.5/drivers' of git://git.kernel.dk/linux-block: (71 commits)
    null_blk: use sector_div instead of do_div
    mtip32xx: restrict variables visible in current code module
    xen/blkfront: Fix crash if backend doesn't follow the right states.
    xen/blkback: Fix two memory leaks.
    xen/blkback: make st_ statistics per ring
    xen/blkfront: Handle non-indirect grant with 64KB pages
    xen-blkfront: Introduce blkif_ring_get_request
    xen-blkback: clear PF_NOFREEZE for xen_blkif_schedule()
    xen/blkback: Free resources if connect_ring failed.
    xen/blocks: Return -EXX instead of -1
    xen/blkback: make pool of persistent grants and free pages per-queue
    xen/blkback: get the number of hardware queues/rings from blkfront
    xen/blkback: pseudo support for multi hardware queues/rings
    xen/blkback: separate ring information out of struct xen_blkif
    xen/blkfront: correct setting for xen_blkif_max_ring_order
    xen/blkfront: make persistent grants pool per-queue
    xen/blkfront: Remove duplicate setting of ->xbdev.
    xen/blkfront: Cleanup of comments, fix unaligned variables, and syntax errors.
    xen/blkfront: negotiate number of queues/rings to be used with backend
    xen/blkfront: split per device io_lock
    ...

    Linus Torvalds
     

19 Jan, 2016

1 commit

  • Pull virtio barrier rework+fixes from Michael Tsirkin:
    "This adds a new kind of barrier, and reworks virtio and xen to use it.

    Plus some fixes here and there"

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (44 commits)
    checkpatch: add virt barriers
    checkpatch: check for __smp outside barrier.h
    checkpatch.pl: add missing memory barriers
    virtio: make find_vqs() checkpatch.pl-friendly
    virtio_balloon: fix race between migration and ballooning
    virtio_balloon: fix race by fill and leak
    s390: more efficient smp barriers
    s390: use generic memory barriers
    xen/events: use virt_xxx barriers
    xen/io: use virt_xxx barriers
    xenbus: use virt_xxx barriers
    virtio_ring: use virt_store_mb
    sh: move xchg_cmpxchg to a header by itself
    sh: support 1 and 2 byte xchg
    virtio_ring: update weak barriers to use virt_xxx
    Revert "virtio_ring: Update weak barriers to use dma_wmb/rmb"
    asm-generic: implement virt_xxx memory barriers
    x86: define __smp_xxx
    xtensa: define __smp_xxx
    tile: define __smp_xxx
    ...

    Linus Torvalds
     

13 Jan, 2016

1 commit

  • include/xen/interface/io/ring.h uses
    full memory barriers to communicate with the other side.

    For guests compiled with CONFIG_SMP, smp_wmb and smp_mb
    would be sufficient, so mb() and wmb() here are only needed if
    a non-SMP guest runs on an SMP host.

    Switch to virt_xxx barriers which serve this exact purpose.

    Signed-off-by: Michael S. Tsirkin
    Acked-by: David Vrabel
    Acked-by: Peter Zijlstra (Intel)

    Michael S. Tsirkin
     

04 Jan, 2016

1 commit


21 Dec, 2015

2 commits


18 Dec, 2015

1 commit

  • Using RING_GET_REQUEST() on a shared ring is easy to use incorrectly
    (i.e., by not considering that the other end may alter the data in the
    shared ring while it is being inspected). Safe usage of a request
    generally requires taking a local copy.

    Provide a RING_COPY_REQUEST() macro to use instead of
    RING_GET_REQUEST() and an open-coded memcpy(). This takes care of
    ensuring that the copy is done correctly regardless of any possible
    compiler optimizations.

    Use a volatile source to prevent the compiler from reordering or
    omitting the copy.

    This is part of XSA155.

    CC: stable@vger.kernel.org
    Signed-off-by: David Vrabel
    Signed-off-by: Konrad Rzeszutek Wilk

    David Vrabel
     

28 Sep, 2015

1 commit

  • Currently there is a number of issues preventing PVHVM Xen guests from
    doing successful kexec/kdump:

    - Bound event channels.
    - Registered vcpu_info.
    - PIRQ/emuirq mappings.
    - shared_info frame after XENMAPSPACE_shared_info operation.
    - Active grant mappings.

    Basically, newly booted kernel stumbles upon already set up Xen
    interfaces and there is no way to reestablish them. In Xen-4.7 a new
    feature called 'soft reset' is coming. A guest performing kexec/kdump
    operation is supposed to call SCHEDOP_shutdown hypercall with
    SHUTDOWN_soft_reset reason before jumping to new kernel. Hypervisor
    (with some help from toolstack) will do full domain cleanup (but
    keeping its memory and vCPU contexts intact) returning the guest to
    the state it had when it was first booted and thus allowing it to
    start over.

    Doing SHUTDOWN_soft_reset on Xen hypervisors which don't support it is
    probably OK as by default all unknown shutdown reasons cause domain
    destroy with a message in toolstack log: 'Unknown shutdown reason code
    5. Destroying domain.' which gives a clue to what the problem is and
    eliminates false expectations.

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

    Vitaly Kuznetsov
     

09 Sep, 2015

1 commit

  • Pull xen updates from David Vrabel:
    "Xen features and fixes for 4.3:

    - Convert xen-blkfront to the multiqueue API
    - [arm] Support binding event channels to different VCPUs.
    - [x86] Support > 512 GiB in a PV guests (off by default as such a
    guest cannot be migrated with the current toolstack).
    - [x86] PMU support for PV dom0 (limited support for using perf with
    Xen and other guests)"

    * tag 'for-linus-4.3-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (33 commits)
    xen: switch extra memory accounting to use pfns
    xen: limit memory to architectural maximum
    xen: avoid another early crash of memory limited dom0
    xen: avoid early crash of memory limited dom0
    arm/xen: Remove helpers which are PV specific
    xen/x86: Don't try to set PCE bit in CR4
    xen/PMU: PMU emulation code
    xen/PMU: Intercept PMU-related MSR and APIC accesses
    xen/PMU: Describe vendor-specific PMU registers
    xen/PMU: Initialization code for Xen PMU
    xen/PMU: Sysfs interface for setting Xen PMU mode
    xen: xensyms support
    xen: remove no longer needed p2m.h
    xen: allow more than 512 GB of RAM for 64 bit pv-domains
    xen: move p2m list if conflicting with e820 map
    xen: add explicit memblock_reserve() calls for special pages
    mm: provide early_memremap_ro to establish read-only mapping
    xen: check for initrd conflicting with e820 map
    xen: check pre-allocated page tables for conflict with memory map
    xen: check for kernel memory conflicting with memory layout
    ...

    Linus Torvalds
     

03 Sep, 2015

1 commit

  • Xen's PV network protocol includes messages to add/remove ethernet
    multicast addresses to/from a filter list in the backend. This allows
    the frontend to request the backend only forward multicast packets
    which are of interest thus preventing unnecessary noise on the shared
    ring.

    The canonical netif header in git://xenbits.xen.org/xen.git specifies
    the message format (two more XEN_NETIF_EXTRA_TYPEs) so the minimal
    necessary changes have been pulled into include/xen/interface/io/netif.h.

    To prevent the frontend from extending the multicast filter list
    arbitrarily a limit (XEN_NETBK_MCAST_MAX) has been set to 64 entries.
    This limit is not specified by the protocol and so may change in future.
    If the limit is reached then the next XEN_NETIF_EXTRA_TYPE_MCAST_ADD
    sent by the frontend will be failed with NETIF_RSP_ERROR.

    Signed-off-by: Paul Durrant
    Cc: Ian Campbell
    Cc: Wei Liu
    Acked-by: Wei Liu
    Signed-off-by: David S. Miller

    Paul Durrant
     

20 Aug, 2015

5 commits

  • Provide interfaces for recognizing accesses to PMU-related MSRs and
    LVTPC APIC and process these accesses in Xen PMU code.

    (The interrupt handler performs XENPMU_flush right away in the beginning
    since no PMU emulation is available. It will be added with a later patch).

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

    Boris Ostrovsky
     
  • Map shared data structure that will hold CPU registers, VPMU context,
    V/PCPU IDs of the CPU interrupted by PMU interrupt. Hypervisor fills
    this information in its handler and passes it to the guest for further
    processing.

    Set up PMU VIRQ.

    Now that perf infrastructure will assume that PMU is available on a PV
    guest we need to be careful and make sure that accesses via RDPMC
    instruction don't cause fatal traps by the hypervisor. Provide a nop
    RDPMC handler.

    For the same reason avoid issuing a warning on a write to APIC's LVTPC.

    Both of these will be made functional in later patches.

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

    Boris Ostrovsky
     
  • Set Xen's PMU mode via /sys/hypervisor/pmu/pmu_mode. Add XENPMU hypercall.

    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Konrad Rzeszutek Wilk
    Signed-off-by: David Vrabel

    Boris Ostrovsky
     
  • Export Xen symbols to dom0 via /proc/xen/xensyms (similar to
    /proc/kallsyms).

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

    Boris Ostrovsky
     
  • Use the newest headers from the xen tree to get some new structure
    layouts.

    Signed-off-by: Juergen Gross
    Reviewed-by: David Vrabel
    Acked-by: Konrad Rzeszutek Wilk
    Signed-off-by: David Vrabel

    Juergen Gross
     

16 Mar, 2015

1 commit


28 Jan, 2015

1 commit

  • In an x86 PV guest, get_user_pages_fast() on a userspace address range
    containing foreign mappings does not work correctly because the M2P
    lookup of the MFN from a userspace PTE may return the wrong page.

    Force get_user_pages_fast() to fail on such addresses by marking the PTEs
    as special.

    If Xen has XENFEAT_gnttab_map_avail_bits (available since at least
    4.0), we can do so efficiently in the grant map hypercall. Otherwise,
    it needs to be done afterwards. This is both inefficient and racy
    (the mapping is visible to the task before we fixup the PTEs), but
    will be fine for well-behaved applications that do not use the mapping
    until after the mmap() system call returns.

    Guests with XENFEAT_auto_translated_physmap (ARM and x86 HVM or PVH)
    do not need this since get_user_pages() has always worked correctly
    for them.

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

    David Vrabel
     

13 Jan, 2015

1 commit

  • Using the native code here can't work properly, as the hypervisor would
    normally have cleared the two reason bits by the time Dom0 gets to see
    the NMI (if passed to it at all). There's a shared info field for this,
    and there's an existing hook to use - just fit the two together. This
    is particularly relevant so that NMIs intended to be handled by APEI /
    GHES actually make it to the respective handler.

    Note that the hook can (and should) be used irrespective of whether
    being in Dom0, as accessing port 0x61 in a DomU would be even worse,
    while the shared info field would just hold zero all the time. Note
    further that hardware NMI handling for PVH doesn't currently work
    anyway due to missing code in the hypervisor (but it is expected to
    work the native rather than the PV way).

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

    Jan Beulich
     

04 Dec, 2014

1 commit

  • Introduce support for new hypercall GNTTABOP_cache_flush.
    Use it to perform cache flashing on pages used for dma when necessary.

    If GNTTABOP_cache_flush is supported by the hypervisor, we don't need to
    bounce dma map operations that involve foreign grants and non-coherent
    devices.

    Signed-off-by: Stefano Stabellini
    Reviewed-by: Catalin Marinas
    Acked-by: Ian Campbell

    Stefano Stabellini