05 Oct, 2020

2 commits


24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

10 Jul, 2020

4 commits

  • Connecting master to an output port when GTH driver module is not loaded
    triggers a NULL dereference:

    > RIP: 0010:intel_th_set_output+0x35/0x70 [intel_th]
    > Call Trace:
    > ? sth_stm_link+0x12/0x20 [intel_th_sth]
    > stm_source_link_store+0x164/0x270 [stm_core]
    > dev_attr_store+0x17/0x30
    > sysfs_kf_write+0x3e/0x50
    > kernfs_fop_write+0xda/0x1b0
    > __vfs_write+0x1b/0x40
    > vfs_write+0xb9/0x1a0
    > ksys_write+0x67/0xe0
    > __x64_sys_write+0x1a/0x20
    > do_syscall_64+0x57/0x1d0
    > entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Make sure the module in question is loaded and return an error if not.

    Signed-off-by: Alexander Shishkin
    Fixes: 39f4034693b7c ("intel_th: Add driver infrastructure for Intel(R) Trace Hub devices")
    Reviewed-by: Andy Shevchenko
    Reported-by: Ammy Yi
    Tested-by: Ammy Yi
    Cc: stable@vger.kernel.org # v4.4
    Link: https://lore.kernel.org/r/20200706161339.55468-5-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This adds support for the Trace Hub in Emmitsburg PCH.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org # v4.14+
    Link: https://lore.kernel.org/r/20200706161339.55468-4-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This adds support for the Trace Hub in Tiger Lake PCH-H.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org # v4.14+
    Link: https://lore.kernel.org/r/20200706161339.55468-3-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This adds support for the Trace Hub in Jasper Lake CPU.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org # v4.14+
    Link: https://lore.kernel.org/r/20200706161339.55468-2-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     

24 Mar, 2020

1 commit

  • Some use cases prefer to keep collecting the trace data into the last
    available window while the other windows are being offloaded instead of
    stopping the trace. In this scenario, the window switch happens
    automatically when the next window becomes available again.

    Add an option to allow this and a sysfs attribute to enable it.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20200319085152.52183-1-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     

23 Mar, 2020

1 commit


18 Mar, 2020

4 commits

  • This adds support for the Trace Hub in Elkhart Lake CPU.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200317062215.15598-7-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • There are a few places in the driver that end up returning ENOTSUPP to
    the user, replace those with EINVAL.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Fixes: ba82664c134ef ("intel_th: Add Memory Storage Unit driver")
    Cc: stable@vger.kernel.org # v4.4+
    Link: https://lore.kernel.org/r/20200317062215.15598-6-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • The unexpected state warning should only warn on illegal state
    transitions. Fix that.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Fixes: 615c164da0eb4 ("intel_th: msu: Introduce buffer interface")
    Cc: stable@vger.kernel.org # v5.4+
    Link: https://lore.kernel.org/r/20200317062215.15598-5-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • Some versions of Intel TH have an issue that prevents the multi mode of
    MSU from working correctly, resulting in no trace data and potentially
    stuck MSU pipeline.

    Disable multi mode on such devices.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20200317062215.15598-2-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     

17 Dec, 2019

4 commits

  • Commit 6cac7866c2741 ("intel_th: msu: Add a sysfs attribute to trigger
    window switch") adds a NULL pointer dereference in the case when there are
    no windows allocated:

    > BUG: kernel NULL pointer dereference, address: 0000000000000000
    > #PF: supervisor read access in kernel mode
    > #PF: error_code(0x0000) - not-present page
    > PGD 0 P4D 0
    > Oops: 0000 1 SMP
    > CPU: 5 PID: 1110 Comm: bash Not tainted 5.5.0-rc1+ #1
    > RIP: 0010:msc_win_switch+0xa/0x80 [intel_th_msu]
    > Call Trace:
    > ? win_switch_store+0x9b/0xc0 [intel_th_msu]
    > dev_attr_store+0x17/0x30
    > sysfs_kf_write+0x3e/0x50
    > kernfs_fop_write+0xda/0x1b0
    > __vfs_write+0x1b/0x40
    > vfs_write+0xb9/0x1a0
    > ksys_write+0x67/0xe0
    > __x64_sys_write+0x1a/0x20
    > do_syscall_64+0x57/0x1d0
    > entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Fix that by disallowing window switching with multiwindow buffers without
    windows.

    Signed-off-by: Alexander Shishkin
    Fixes: 6cac7866c274 ("intel_th: msu: Add a sysfs attribute to trigger window switch")
    Reviewed-by: Andy Shevchenko
    Reported-by: Ammy Yi
    Tested-by: Ammy Yi
    Cc: stable@vger.kernel.org # v5.2+
    Link: https://lore.kernel.org/r/20191217115527.74383-5-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • Commit aac8da65174a ("intel_th: msu: Start handling IRQs") implicitly
    relies on the use of devm_request_irq() to subsequently free the irqs on
    device removal, but in case of the pci_free_irq_vectors() API, the
    handlers need to be freed before it is called. Therefore, at the moment
    the driver's remove path trips a BUG_ON(irq_has_action()):

    > kernel BUG at drivers/pci/msi.c:375!
    > invalid opcode: 0000 1 SMP
    > CPU: 2 PID: 818 Comm: rmmod Not tainted 5.5.0-rc1+ #1
    > RIP: 0010:free_msi_irqs+0x67/0x1c0
    > pci_disable_msi+0x116/0x150
    > pci_free_irq_vectors+0x1b/0x20
    > intel_th_pci_remove+0x22/0x30 [intel_th_pci]
    > pci_device_remove+0x3e/0xb0
    > device_release_driver_internal+0xf0/0x1c0
    > driver_detach+0x4c/0x8f
    > bus_remove_driver+0x5c/0xd0
    > driver_unregister+0x31/0x50
    > pci_unregister_driver+0x40/0x90
    > intel_th_pci_driver_exit+0x10/0xad6 [intel_th_pci]
    > __x64_sys_delete_module+0x147/0x290
    > ? exit_to_usermode_loop+0xd7/0x120
    > do_syscall_64+0x57/0x1b0
    > entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Fix this by explicitly freeing irqs before freeing the vectors. We keep
    using the devm_* variants because they are still useful in early error
    paths.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Fixes: aac8da65174a ("intel_th: msu: Start handling IRQs")
    Reported-by: Ammy Yi
    Tested-by: Ammy Yi
    Cc: stable@vger.kernel.org # v5.2+
    Link: https://lore.kernel.org/r/20191217115527.74383-4-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This adds support for Intel Trace Hub in Elkhart Lake.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191217115527.74383-3-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This adds Intel(R) Trace Hub PCI ID for Comet Lake PCH-V.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc:
    Link: https://lore.kernel.org/r/20191217115527.74383-2-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     

20 Nov, 2019

3 commits

  • This adds support for the Trace Hub in Tiger Lake CPU.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191120130806.44028-4-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This adds support for the Trace Hub in Ice Lake CPU.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191120130806.44028-3-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • Commit a753bfcfdb1f ("intel_th: Make the switch allocate its subdevices")
    factored out intel_th_subdevice_alloc() from intel_th_populate(), but got
    the error path wrong, resulting in two instances of a double put_device()
    on a freshly initialized, but not 'added' device.

    Fix this by only doing one put_device() in the error path.

    Signed-off-by: Alexander Shishkin
    Fixes: a753bfcfdb1f ("intel_th: Make the switch allocate its subdevices")
    Reported-by: Wen Yang
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org # v4.14+
    Link: https://lore.kernel.org/r/20191120130806.44028-2-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     

04 Nov, 2019

7 commits

  • This adds support for Intel TH on Jasper Lake PCH.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191028070651.9770-8-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This adds support for Intel TH on Comet Lake PCH.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191028070651.9770-7-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • 'mode' is malloced in mode_store() and should be freed before leaving
    from the error handling cases, otherwise it will cause memory leak.

    Fixes: 615c164da0eb ("intel_th: msu: Introduce buffer interface")
    Signed-off-by: Wei Yongjun
    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/lkml/20190801013825.182543-1-weiyongjun1@huawei.com/
    Link: https://lore.kernel.org/r/20191028070651.9770-6-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Wei Yongjun
     
  • The shift of the unsigned int win->nr_blocks by PAGE_SHIFT may
    potentially overflow. Note that the intended return of this shift
    is expected to be a size_t however the shift is being performed as
    an unsigned int. Fix this by casting win->nr_blocks to a size_t
    before performing the shift.

    Addresses-Coverity: ("Unintentional integer overflow")
    Fixes: 615c164da0eb ("intel_th: msu: Introduce buffer interface")
    Signed-off-by: Colin Ian King
    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/lkml/20190726113151.8967-1-colin.king@canonical.com/
    Link: https://lore.kernel.org/r/20191028070651.9770-5-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     
  • Commit 615c164da0eb ("intel_th: msu: Introduce buffer interface") forgot
    to add a NULL pointer check for the value returned from kstrdup(), which
    will be troublesome if the allocation fails.

    Fix that by adding the check.

    Addresses-Coverity: ("Dereference null return")
    Fixes: 615c164da0eb ("intel_th: msu: Introduce buffer interface")
    Signed-off-by: Colin Ian King
    [alexander.shishkin: amended the commit message]
    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/lkml/20190726120421.9650-1-colin.king@canonical.com/
    Link: https://lore.kernel.org/r/20191028070651.9770-4-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     
  • Commit 615c164da0eb ("intel_th: msu: Introduce buffer interface") added a
    mutex that it forgot to initialize, resulting in a lockdep splat.

    Fix that by initializing the mutex statically.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Fixes: 615c164da0eb ("intel_th: msu: Introduce buffer interface")
    Link: https://lore.kernel.org/r/20191028070651.9770-3-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • Commit 8116db57cf16 ("intel_th: Add switch triggering support") added
    a trigger assertion of the CTS, but forgot to de-assert it at the end
    of the sequence. This results in window switches randomly not happening.

    Fix that by de-asserting the trigger at the end of the window switch
    sequence.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Fixes: 8116db57cf16 ("intel_th: Add switch triggering support")
    Cc: stable
    Link: https://lore.kernel.org/r/20191028070651.9770-2-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     

19 Sep, 2019

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the big char/misc driver pull request for 5.4-rc1.

    As has been happening in previous releases, more and more individual
    driver subsystem trees are ending up in here. Now if that is good or
    bad I can't tell, but hopefully it makes your life easier as it's more
    of an aggregation of trees together to one merge point for you.

    Anyway, lots of stuff in here:
    - habanalabs driver updates
    - thunderbolt driver updates
    - misc driver updates
    - coresight and intel_th hwtracing driver updates
    - fpga driver updates
    - extcon driver updates
    - some dma driver updates
    - char driver updates
    - android binder driver updates
    - nvmem driver updates
    - phy driver updates
    - parport driver fixes
    - pcmcia driver fix
    - uio driver updates
    - w1 driver updates
    - configfs fixes
    - other assorted driver updates

    All of these have been in linux-next for a long time with no reported
    issues"

    * tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (200 commits)
    misc: mic: Use PTR_ERR_OR_ZERO rather than its implementation
    habanalabs: correctly cast variable to __le32
    habanalabs: show correct id in error print
    habanalabs: stop using the acronym KMD
    habanalabs: display card name as sensors header
    habanalabs: add uapi to retrieve aggregate H/W events
    habanalabs: add uapi to retrieve device utilization
    habanalabs: Make the Coresight timestamp perpetual
    habanalabs: explicitly set the queue-id enumerated numbers
    habanalabs: print to kernel log when reset is finished
    habanalabs: replace __le32_to_cpu with le32_to_cpu
    habanalabs: replace __cpu_to_le32/64 with cpu_to_le32/64
    habanalabs: Handle HW_IP_INFO if device disabled or in reset
    habanalabs: Expose devices after initialization is done
    habanalabs: improve security in Debug IOCTL
    habanalabs: use default structure for user input in Debug IOCTL
    habanalabs: Add descriptive name to PSOC app status register
    habanalabs: Add descriptive names to PSOC scratch-pad registers
    habanalabs: create two char devices per ASIC
    habanalabs: change device_setup_cdev() to be more generic
    ...

    Linus Torvalds
     

18 Sep, 2019

1 commit

  • …anaszewski/linux-leds

    Pull LED updates from Jacek Anaszewski:
    "In this cycle we've finally managed to contribute the patch set
    sorting out LED naming issues. Besides that there are many changes
    scattered among various LED class drivers and triggers.

    LED naming related improvements:

    - add new 'function' and 'color' fwnode properties and deprecate
    'label' property which has been frequently abused for conveying
    vendor specific names that have been available in sysfs anyway

    - introduce a set of standard LED_FUNCTION* definitions

    - introduce a set of standard LED_COLOR_ID* definitions

    - add a new {devm_}led_classdev_register_ext() API with the
    capability of automatic LED name composition basing on the
    properties available in the passed fwnode; the function is
    backwards compatible in a sense that it uses 'label' data, if
    present in the fwnode, for creating LED name

    - add tools/leds/get_led_device_info.sh script for retrieving LED
    vendor, product and bus names, if applicable; it also performs
    basic validation of an LED name

    - update following drivers and their DT bindings to use the new LED
    registration API:

    - leds-an30259a, leds-gpio, leds-as3645a, leds-aat1290, leds-cr0014114,
    leds-lm3601x, leds-lm3692x, leds-lp8860, leds-lt3593, leds-sc27xx-blt

    Other LED class improvements:

    - replace {devm_}led_classdev_register() macros with inlines

    - allow to call led_classdev_unregister() unconditionally

    - switch to use fwnode instead of be stuck with OF one

    LED triggers improvements:

    - led-triggers:
    - fix dereferencing of null pointer
    - fix a memory leak bug

    - ledtrig-gpio:
    - GPIO 0 is valid

    Drop superseeded apu2/3 support from leds-apu since for apu2+ a newer,
    more complete driver exists, based on a generic driver for the AMD
    SOCs gpio-controller, supporting LEDs as well other devices:

    - drop profile field from priv data

    - drop iosize field from priv data

    - drop enum_apu_led_platform_types

    - drop superseeded apu2/3 led support

    - add pr_fmt prefix for better log output

    - fix error message on probing failure

    Other misc fixes and improvements to existing LED class drivers:

    - leds-ns2, leds-max77650:
    - add of_node_put() before return

    - leds-pwm, leds-is31fl32xx:
    - use struct_size() helper

    - leds-lm3697, leds-lm36274, leds-lm3532:
    - switch to use fwnode_property_count_uXX()

    - leds-lm3532:
    - fix brightness control for i2c mode
    - change the define for the fs current register
    - fixes for the driver for stability
    - add full scale current configuration
    - dt: Add property for full scale current.
    - avoid potentially unpaired regulator calls
    - move static keyword to the front of declarations
    - fix optional led-max-microamp prop error handling

    - leds-max77650:
    - add of_node_put() before return
    - add MODULE_ALIAS()
    - Switch to fwnode property API

    - leds-as3645a:
    - fix misuse of strlcpy

    - leds-netxbig:
    - add of_node_put() in netxbig_leds_get_of_pdata()
    - remove legacy board-file support

    - leds-is31fl319x:
    - simplify getting the adapter of a client

    - leds-ti-lmu-common:
    - fix coccinelle issue
    - move static keyword to the front of declaration

    - leds-syscon:
    - use resource managed variant of device register

    - leds-ktd2692:
    - fix a typo in the name of a constant

    - leds-lp5562:
    - allow firmware files up to the maximum length

    - leds-an30259a:
    - fix typo

    - leds-pca953x:
    - include the right header"

    * tag 'leds-for-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: (72 commits)
    leds: lm3532: Fix optional led-max-microamp prop error handling
    led: triggers: Fix dereferencing of null pointer
    leds: ti-lmu-common: Move static keyword to the front of declaration
    leds: lm3532: Move static keyword to the front of declarations
    leds: trigger: gpio: GPIO 0 is valid
    leds: pwm: Use struct_size() helper
    leds: is31fl32xx: Use struct_size() helper
    leds: ti-lmu-common: Fix coccinelle issue in TI LMU
    leds: lm3532: Avoid potentially unpaired regulator calls
    leds: syscon: Use resource managed variant of device register
    leds: Replace {devm_}led_classdev_register() macros with inlines
    leds: Allow to call led_classdev_unregister() unconditionally
    leds: lm3532: Add full scale current configuration
    dt: lm3532: Add property for full scale current.
    leds: lm3532: Fixes for the driver for stability
    leds: lm3532: Change the define for the fs current register
    leds: lm3532: Fix brightness control for i2c mode
    leds: Switch to use fwnode instead of be stuck with OF one
    leds: max77650: Switch to fwnode property API
    led: triggers: Fix a memory leak bug
    ...

    Linus Torvalds
     

03 Sep, 2019

1 commit


29 Aug, 2019

2 commits


19 Aug, 2019

1 commit


31 Jul, 2019

1 commit

  • This patch corrects the SPDX License Identifier style
    in header files related to Drivers for Intel(R) Trace Hub
    controller.
    For C header files Documentation/process/license-rules.rst
    mandates C-like comments (opposed to C source files where
    C++ style should be used)

    Changes made by using a script provided by Joe Perches here:
    https://lkml.org/lkml/2019/2/7/46

    Suggested-by: Joe Perches
    Signed-off-by: Nishad Kamdar
    Signed-off-by: Greg Kroah-Hartman

    Nishad Kamdar
     

30 Jul, 2019

1 commit

  • Add a helper to match a device by its type and provide wrappers
    for {bus/class/driver}_find_device() APIs.

    Cc: Alexander Shishkin
    Cc: Arnd Bergmann
    Cc: Harald Freudenberger
    Cc: Heiko Carstens
    Cc: linux-usb@vger.kernel.org
    Cc: Oliver Neukum
    Cc: Sebastian Andrzej Siewior
    Cc: Tomas Winkler
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Cc: Ulf Hansson
    Cc: Joe Perches
    Signed-off-by: Suzuki K Poulose
    Link: https://lore.kernel.org/r/20190723221838.12024-5-suzuki.poulose@arm.com
    Signed-off-by: Greg Kroah-Hartman

    Suzuki K Poulose
     

25 Jul, 2019

5 commits

  • The MSU configuration registers may contain buffer address/size set by
    the BIOS or an external hardware debugger, which may want to take over
    tracing from the driver when the driver is not actively tracing.

    Preserve these settings when not actively tracing.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20190705141425.19894-6-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • We already prevent freeing buffers via sysfs interface in case there are
    existing users or if trace is active. Treat the existence of locked windows
    similarly and return -EBUSY on attempts to free the buffer. When the last
    window is unlocked, the freeing will succeed.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20190705141425.19894-5-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • Currently, the window size is limited to the maximum number of sg entries
    in one table. This is because the code addresses individual blocks within
    the window by their numeric index. In reality, though, the blocks most
    often are iterated through sequentially. By rewriting the logic to use sg
    pointers instead of block indices we loose the necessity to dereference
    them directly and gain the ability to use multiple chained tables if
    necessary.

    Get rid of the limitation by replacing index-based block accesses with
    sequential block accesses.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20190705141425.19894-4-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • This patch adds an example MSU buffer "sink", which consumes trace
    data from MSC buffers.

    Functionally, it acts similarly to "multi" mode with automatic window
    switching.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20190705141425.19894-3-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin
     
  • Introduces a concept of external buffers, which is a mechanism for creating
    trace sinks that would receive trace data from MSC buffers and transfer it
    elsewhere.

    A external buffer can implement its own window allocation/deallocation if
    it has to. It must provide a callback that's used to notify it when a
    window fills up, so that it can then start a DMA transaction from that
    window 'elsewhere'. This window remains in a 'locked' state and won't be
    used for storing new trace data until the buffer 'unlocks' it with a
    provided API call, at which point the window can be used again for storing
    trace data.

    This relies on a functional "last block" interrupt, so not all versions of
    Trace Hub can use this feature, which does not reflect on existing users.

    Signed-off-by: Alexander Shishkin
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20190705141425.19894-2-alexander.shishkin@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Shishkin