04 Feb, 2020

1 commit

  • Pull VFIO updates from Alex Williamson:

    - Fix nvlink error path (Alexey Kardashevskiy)

    - Update nvlink and spapr to use mmgrab() (Julia Lawall)

    - Update static declaration (Ben Dooks)

    - Annotate __iomem to fix sparse warnings (Ben Dooks)

    * tag 'vfio-v5.6-rc1' of git://github.com/awilliam/linux-vfio:
    vfio: platform: fix __iomem in vfio_platform_amdxgbe.c
    vfio/mdev: make create attribute static
    vfio/spapr_tce: use mmgrab
    vfio: vfio_pci_nvlink2: use mmgrab
    vfio/spapr/nvlink2: Skip unpinning pages on error exit

    Linus Torvalds
     

10 Jan, 2020

1 commit

  • The ioaddr should have __iomem marker on it, so add that to fix
    the following sparse warnings:

    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:33:44: warning: incorrect type in argument 2 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:33:44: expected void volatile [noderef] *addr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:33:44: got void *
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:34:33: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:34:33: expected void const volatile [noderef] *addr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:34:33: got void *
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:44:44: warning: incorrect type in argument 2 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:44:44: expected void volatile [noderef] *addr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:44:44: got void *
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:45:33: warning: incorrect type in argument 2 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:45:33: expected void volatile [noderef] *addr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:45:33: got void *
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:69:41: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:69:41: expected void *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:69:41: got void [noderef] *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:71:30: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:71:30: expected void *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:71:30: got void [noderef] *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:76:49: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:76:49: expected void *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:76:49: got void [noderef] *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:85:37: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:85:37: expected void *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:85:37: got void [noderef] *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:87:30: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:87:30: expected void *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:87:30: got void [noderef] *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:90:30: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:90:30: expected void *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:90:30: got void [noderef] *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:93:30: warning: incorrect type in argument 1 (different address spaces)
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:93:30: expected void *ioaddr
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:93:30: got void [noderef] *ioaddr

    Signed-off-by: Ben Dooks (Codethink)
    Acked-by: Eric Auger
    Signed-off-by: Alex Williamson

    Ben Dooks (Codethink)
     

06 Jan, 2020

1 commit


31 May, 2019

2 commits

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation this program
    is distributed in the hope 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 see http www gnu org
    licenses

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 228 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Steve Winslow
    Reviewed-by: Richard Fontana
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171438.107155473@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    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 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

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 655 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


23 Apr, 2019

1 commit


06 Feb, 2019

1 commit


09 Jun, 2018

3 commits

  • If a device is part of a PM Domain (e.g. power and/or clock domain), its
    power state is managed using Runtime PM. Without Runtime PM, the device
    may not be powered up or clocked, causing subtle failures, crashes, or
    system lock-ups when the device is accessed by the guest.

    Fix this by adding Runtime PM support, powering the device when the VFIO
    device is opened by the guest.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Simon Horman
    Acked-by: Eric Auger
    Signed-off-by: Alex Williamson

    Geert Uytterhoeven
     
  • - Capitalize the first word of error messages,
    - Unwrap statements that fit on a single line,
    - Use "VFIO" instead of "vfio" as the error message prefix.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Eric Auger
    Acked-by: Eric Auger
    Signed-off-by: Alex Williamson

    Geert Uytterhoeven
     
  • If the IOMMU group setup fails, the reset module is not released.

    Fixes: b5add544d677d363 ("vfio, platform: make reset driver a requirement by default")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Eric Auger
    Reviewed-by: Simon Horman
    Acked-by: Eric Auger
    Signed-off-by: Alex Williamson

    Geert Uytterhoeven
     

15 Nov, 2017

1 commit

  • Pull VFIO updates from Alex Williamson:

    - Virtualize PCI MPS and MRRS registers

    - Avoid soft lockups on SPAPR when clearing TCE

    - Broadcom FlexRM platform device support

    - Samples driver cleanup & type1 integer overflow fix

    * tag 'vfio-v4.15-rc1' of git://github.com/awilliam/linux-vfio:
    vfio: platform: reset: Add Broadcom FlexRM reset module
    vfio/type1: silence integer overflow warning
    vfio-mdev/samples: make mdev_fops const and static
    vfio/spapr: Add cond_resched() for huge updates
    vfio/pci: Virtualize Maximum Read Request Size
    vfio/pci: Virtualize Maximum Payload Size

    Linus Torvalds
     

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
     

21 Oct, 2017

1 commit

  • This patch adds Broadcom FlexRM low-level reset for
    VFIO platform.

    It will do the following:
    1. Disable/Deactivate each FlexRM ring
    2. Flush each FlexRM ring

    The cleanup sequence for FlexRM rings is adapted from
    Broadcom FlexRM mailbox driver.

    Signed-off-by: Anup Patel
    Reviewed-by: Oza Oza
    Reviewed-by: Scott Branden
    Reviewed-by: Eric Auger
    Signed-off-by: Alex Williamson

    Anup Patel
     

31 Aug, 2017

1 commit


17 Nov, 2016

1 commit


14 Sep, 2016

1 commit

  • We get a few warnings when building kernel with W=1:
    drivers/vfio/platform/vfio_platform_common.c:76:5: warning: no previous prototype for 'vfio_platform_acpi_call_reset' [-Wmissing-prototypes]
    drivers/vfio/platform/vfio_platform_common.c:98:6: warning: no previous prototype for 'vfio_platform_acpi_has_reset' [-Wmissing-prototypes]
    drivers/vfio/platform/vfio_platform_common.c:640:5: warning: no previous prototype for 'vfio_platform_of_probe' [-Wmissing-prototypes]
    drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:59:5: warning: no previous prototype for 'vfio_platform_amdxgbe_reset' [-Wmissing-prototypes]
    drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c:60:5: warning: no previous prototype for 'vfio_platform_calxedaxgmac_reset' [-Wmissing-prototypes]
    ....

    In fact, these functions are only used in the file in which they are
    declared and don't need a declaration, but can be made static.
    so this patch marks these functions with 'static'.

    Signed-off-by: Baoyou Xie
    Acked-by: Arnd Bergmann
    Reviewed-by: Eric Auger
    Reviewed-by: Baptiste Reynal
    Signed-off-by: Alex Williamson

    Baoyou Xie
     

20 Jul, 2016

9 commits

  • Release call is ignoring the return code from reset call and can
    potentially continue even though reset call failed.

    If reset_required module parameter is set, this patch is going
    to validate the return code and will cause stack dump with
    WARN_ON and warn the user of failure.

    Signed-off-by: Sinan Kaya
    Reviewed-by: Eric Auger
    Reviewed-by: Baptiste Reynal
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • Open call is ignoring the return code from reset call and can
    potentially continue even though reset call failed.

    If reset_required module parameter is set, this patch is going
    to validate the return code and will abort open if reset fails.

    Signed-off-by: Sinan Kaya
    Reviewed-by: Baptiste Reynal
    Reviewed-by: Eric Auger
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • The code was allowing platform devices to be used without a supporting
    VFIO reset driver. The hardware can be left in some inconsistent state
    after a guest machine abort.

    The reset driver will put the hardware back to safe state and disable
    interrupts before returning the control back to the host machine.

    Adding a new reset_required kernel module option to platform VFIO drivers.
    The default value is true for the DT and ACPI based drivers.
    The reset requirement value for AMBA drivers is set to false and is
    unchangeable to maintain the existing functionality.

    New requirements are:
    1. A reset function needs to be implemented by the corresponding driver
    via DT/ACPI.
    2. The reset function needs to be discovered via DT/ACPI.

    The probe of the driver will fail if any of the above conditions are
    not satisfied.

    Signed-off-by: Sinan Kaya
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • The device tree code checks for the presence of a reset driver and calls
    the of_reset function pointer by looking up the reset driver as a module.

    ACPI defines _RST method to perform device level reset. After the _RST
    method is executed, the OS can resume using the device. _RST method is
    expected to stop DMA transfers and IRQs.

    This patch introduces two functions as vfio_platform_acpi_has_reset and
    vfio_platform_acpi_call_reset. The has reset method is used to declare
    reset capability via the ioctl flag VFIO_DEVICE_FLAGS_RESET. The call
    reset function is used to execute the _RST ACPI method.

    Signed-off-by: Sinan Kaya
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • Getting ready to bring out extra debug information to the caller
    so that more verbose information can be printed when an error is
    observed.

    Signed-off-by: Sinan Kaya
    Reviewed-by: Baptiste Reynal
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • The code is using the compatible DT string to associate a reset driver
    with the actual device itself. The compatible string does not exist on
    ACPI based systems. HID is the unique identifier for a device driver
    instead.

    Signed-off-by: Sinan Kaya
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • Creating a new function to determine if this driver supports reset
    function or not. This is an attempt to abstract device tree calls
    from the rest of the code.

    Signed-off-by: Sinan Kaya
    Reviewed-by: Eric Auger
    Reviewed-by: Baptiste Reynal
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • The reset call sequence seems to replicate itself multiple times
    across the file. Grouping them together for maintenance reasons.

    Signed-off-by: Sinan Kaya
    Reviewed-by: Eric Auger
    Reviewed-by: Baptiste Reynal
    Signed-off-by: Alex Williamson

    Sinan Kaya
     
  • Renaming the reset function to of_reset as it is only used
    by the device tree based platforms.

    Signed-off-by: Sinan Kaya
    Reviewed-by: Eric Auger
    Reviewed-by: Baptiste Reynal
    Signed-off-by: Alex Williamson

    Sinan Kaya
     

23 Jun, 2016

1 commit

  • The vfio No-IOMMU mode was supported by this
    'commit 03a76b60f8ba2797 ("vfio: Include No-IOMMU mode")',
    but it only support vfio-pci.

    Using vfio_iommu_group_get/put, but not iommu_group_get/put,
    the platform devices can be exposed to userspace with
    CONFIG_VFIO_NOIOMMU and the "enable_unsafe_noiommu_mode"
    option enabled.

    From 'commit 03a76b60f8ba2797 ("vfio: Include No-IOMMU mode")',
    "This should make it very clear that this mode is not safe.
    Additionally, CAP_SYS_RAWIO privileges are necessary to work
    with groups and containers using this mode. Groups making
    use of this support are named /dev/vfio/noiommu-$GROUP and
    can only make use of the special VFIO_NOIOMMU_IOMMU for the
    container. Use of this mode, specifically binding a device
    without a native IOMMU group to a VFIO bus driver will taint
    the kernel and should therefore not be considered supported."

    Signed-off-by: Peng Fan
    Cc: Eric Auger
    Cc: Baptiste Reynal
    Cc: Alex Williamson
    Reviewed-by: Eric Auger
    Signed-off-by: Alex Williamson

    Peng Fan
     

28 Feb, 2016

1 commit

  • Calling return copy_to_user(...) in an ioctl will not
    do the right thing if there's a pagefault:
    copy_to_user returns the number of bytes not copied
    in this case.

    Fix up vfio to do
    return copy_to_user(...)) ?
    -EFAULT : 0;

    everywhere.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Alex Williamson

    Michael S. Tsirkin
     

22 Dec, 2015

1 commit

  • This loop ends with count set to -1 and not zero so the warning message
    isn't printed when it should be. I've fixed this by change the postop
    to a preop.

    Fixes: 0990822c9866 ('VFIO: platform: reset: AMD xgbe reset module')
    Signed-off-by: Dan Carpenter
    Reviewed-by: Eric Auger
    Signed-off-by: Alex Williamson

    Dan Carpenter
     

21 Nov, 2015

1 commit


20 Nov, 2015

1 commit


04 Nov, 2015

9 commits

  • This patch introduces a module that registers and implements a low-level
    reset function for the AMD XGBE device.

    it performs the following actions:
    - reset the PHY
    - disable auto-negotiation
    - disable & clear auto-negotiation IRQ
    - soft-reset the MAC

    Those tiny pieces of code are inherited from the native xgbe driver.

    Signed-off-by: Eric Auger
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • In the current code the vfio_platform_region is copied on the stack.
    As a consequence the ioaddr address is not iounmapped in the vfio
    platform driver (vfio_platform_regions_cleanup). The patch uses the
    pointer to the region instead.

    Signed-off-by: Eric Auger
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • It might be helpful for the end-user to check the device reset
    function was found by the vfio platform reset framework.

    Lets store a pointer to the struct device in vfio_platform_device
    and trace when the reset function is called or not found.

    Signed-off-by: Eric Auger
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • Remove the static lookup table and use the dynamic list of registered
    reset functions instead. Also load the reset module through its alias.
    The reset struct module pointer is stored in vfio_platform_device.

    We also remove the useless struct device pointer parameter in
    vfio_platform_get_reset.

    This patch fixes the issue related to the usage of __symbol_get, which
    besides from being moot, prevented compilation with CONFIG_MODULES
    disabled.

    Also usage of MODULE_ALIAS makes possible to add a new reset module
    without needing to update the framework. This was suggested by Arnd.

    Signed-off-by: Eric Auger
    Reported-by: Arnd Bergmann
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • Let's retrieve the compatibility string on probe and store it
    in the vfio_platform_device struct

    Signed-off-by: Eric Auger
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • This patch adds the reset function registration/unregistration.
    This is handled through the module_vfio_reset_handler macro. This
    latter also defines a MODULE_ALIAS which simplifies the load from
    vfio-platform.

    Signed-off-by: Eric Auger
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • The module_vfio_reset_handler macro
    - define a module alias
    - implement module init/exit function which respectively registers
    and unregisters the reset function.

    Signed-off-by: Eric Auger
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • In preparation for subsequent changes in reset function lookup,
    lets introduce a dynamic list of reset combos (compat string,
    reset module, reset function). The list can be populated/voided with
    vfio_platform_register/unregister_reset. Those are not yet used in
    this patch.

    Signed-off-by: Eric Auger
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Alex Williamson

    Eric Auger
     
  • To prepare for vfio platform reset rework let's build
    vfio_platform_common.c and vfio_platform_irq.c in a separate
    module from vfio-platform and vfio-amba. This makes possible
    to have separate module inits and works around a race between
    platform driver init and vfio reset module init: that way we
    make sure symbols exported by base are available when vfio-platform
    driver gets probed.

    The open/release being implemented in the base module, the ref
    count is applied to the parent module instead.

    Signed-off-by: Eric Auger
    Suggested-by: Arnd Bergmann
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Alex Williamson

    Eric Auger