10 Sep, 2018

1 commit

  • commit 3512a18cbd8d09e22a790540cb9624c3c49827ba upstream.

    There is a potential execution path in which function
    platform_get_resource() returns NULL. If this happens,
    we will end up having a NULL pointer dereference.

    Fix this by replacing devm_ioremap with devm_ioremap_resource,
    which has the NULL check and the memory region request.

    This code was detected with the help of Coccinelle.

    Cc: stable@vger.kernel.org
    Fixes: f700e84f417b ("mailbox: Add support for APM X-Gene platform mailbox driver")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Jassi Brar
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     

14 Dec, 2017

1 commit

  • [ Upstream commit e339c80af95e14de3712d69ddea09a3868fa14cd ]

    Currently we rely on the first byte of the Rx buffer to check if there's
    any data available to be read. If the first byte of the received buffer
    is zero (i.e. null character), then we fail to signal that data is
    available even when it's available.

    Instead introduce a boolean variable to track the data availability and
    update it in the channel receive callback as ready and clear it when the
    data is read.

    Signed-off-by: Sudeep Holla
    Signed-off-by: Jassi Brar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     

30 Nov, 2017

1 commit

  • commit a371c10ea4b38a5f120e86d906d404d50a0f4660 upstream.

    As-per suggestion from FlexRM HW folks, we have to first set
    FlexRM ring flush state and then clear it for FlexRM ring flush
    to work properly.

    Currently, the FlexRM driver has incomplete FlexRM ring flush
    sequence which causes repeated insmod+rmmod of mailbox client
    drivers to fail.

    This patch fixes FlexRM ring flush sequence in flexrm_shutdown()
    as described above.

    Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM
    ring manager")

    Signed-off-by: Anup Patel
    Reviewed-by: Scott Branden
    Signed-off-by: Jassi Brar
    Signed-off-by: Greg Kroah-Hartman

    Anup Patel
     

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
     

08 Sep, 2017

1 commit

  • Pull mailbox updates from Jassi Brar:
    "Just behavorial changes to a controller driver: the Broadcom's Flexrm
    mailbox driver has been modifified to support debugfs and TX-Done
    mechanism by ACK.

    Nothing for the core mailbox stack"

    * tag 'mailbox-v4.14' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
    mailbox: bcm-flexrm-mailbox: Use txdone_ack instead of txdone_poll
    mailbox: bcm-flexrm-mailbox: Use bitmap instead of IDA
    mailbox: bcm-flexrm-mailbox: Fix mask used in CMPL_START_ADDR_VALUE()
    mailbox: bcm-flexrm-mailbox: Add debugfs support
    mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQs

    Linus Torvalds
     

31 Aug, 2017

5 commits

  • Currently, FlexRM driver uses txdone_poll method of Linux Mailbox
    to model the send_data() callback. To achieve this, we have introduced
    "last_pending_msg" pointer for each FlexRM ring which keeps track of
    the message that did not fit in the FlexRM ring.

    This patch updates FlexRM driver to use txdone_ack method instead of
    txdone_poll method because txdone_poll is not efficient for FlexRM
    and requires additional tracking in FlexRM driver.

    Also, moving to txdone_ack method helps us remove "last_pending_msg"
    pointer and last_tx_done() callback.

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Signed-off-by: Jassi Brar

    Anup Patel
     
  • Currently, we are using IDA library for managing IDs
    on a FlexRM ring. The IDA library dynamically allocates
    memory for underlying data structures which can cause
    potential locking issue when allocating/free IDs from
    flexrm_new_request() and flexrm_process_completions().

    To tackle this, we replace use of IDA with bitmap for
    each FlexRM ring and also protect the bitmap with FlexRM
    ring lock.

    Signed-off-by: Anup Patel
    Signed-off-by: Jassi Brar

    Anup Patel
     
  • The mask used in CMPL_START_ADDR_VALUE() should be 27bits instead of
    26bits. This incorrect mask was causing completion writes to 40bits
    physical address fail.

    This patch fixes mask used in CMPL_START_ADDR_VALUE() macro.

    Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM
    ring manager")

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Reviewed-by: Scott Branden
    Cc: stable@vger.kernel.org
    Signed-off-by: Jassi Brar

    Anup Patel
     
  • This patch adds debugfs support to Broadcom FlexRM driver
    so that we can see FlexRM ring state when any issue happens.

    Signed-off-by: Anup Patel
    Reviewed-by: Vikram Prakash
    Reviewed-by: Scott Branden
    Signed-off-by: Jassi Brar

    Anup Patel
     
  • This patch set IRQ affinity hint for FlexRM ring IRQ at time of
    enabling ring (i.e. flexrm_startup()). The IRQ affinity hint will
    allow FlexRM driver to distribute FlexRM ring IRQs across online
    CPUs so that all FlexRM ring IRQs don't land in CPU0 by default.

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Reviewed-by: Scott Branden
    Signed-off-by: Jassi Brar

    Anup Patel
     

10 Aug, 2017

1 commit

  • When booting on an ACPI enabled system that does not provide the
    Platform Communications Channel Table (PCCT), the pcc mailbox driver
    prints -

    [ 0.484261] PCCT header not found.

    during probe before returning -ENODEV.

    This message clutters the bootlog and doesn't provide any useful
    information. Drop this message.

    Signed-off-by: Punit Agrawal
    Acked-by: Alexey Klimov
    Signed-off-by: Rafael J. Wysocki

    Punit Agrawal
     

26 Jul, 2017

1 commit

  • When PCCT is not available, kernel crashes as below when requests PCC
    channel 0. This patch fixes this issue.

    [ 0.920454] PCCT header not found.
    ...
    [ 8.031309] Unable to handle kernel NULL pointer dereference at virtual address 00000010
    [ 8.031310] [0000000000000010] user address but active_mm is swapper
    [ 8.031312] Internal error: Oops: 96000004 [#1] PREEMPT SMP
    [ 8.031313] Modules linked in:
    [ 8.031316] CPU: 31 PID: 1 Comm: swapper/0 Tainted: G W 4.13.0-rc1 #18
    [ 8.031317] Hardware name: AppliedMicro(R) 07/20/2017
    [ 8.031318] task: ffff809ef3b08000 task.stack: ffff809ef3b10000
    [ 8.031322] PC is at pcc_mbox_request_channel+0x8c/0x160
    [ 8.031325] LR is at xgene_slimpro_i2c_probe+0x1c0/0x378
    [ 8.031326] pc : [] lr : [] pstate: 00000045
    [ 8.031327] sp : ffff809ef3b13bd0
    [ 8.031327] x29: ffff809ef3b13bd0 x28: ffff000008ed90a0
    [ 8.031329] x27: ffff000009091000 x26: ffff000008e50470
    [ 8.031330] x25: ffff000008ed9100 x24: ffff809eefd9ac30
    [ 8.031332] x23: 0000000000000000 x22: ffff0000090e3e10
    [ 8.031333] x21: ffff0000090e3000 x20: 0000000000000000
    [ 8.031335] x19: 0000000000000000 x18: 0000000000087ffc
    [ 8.031336] x17: 2fe48d76a78303f0 x16: 0000000000087ffc
    [ 8.031337] x15: ffff000000000000 x14: 0000000000000000
    [ 8.031339] x13: 0000000000000000 x12: 0000000000000018
    [ 8.031340] x11: 0000000000000018 x10: 0101010101010101
    [ 8.031342] x9 : 0000000000000000 x8 : 7f7f7f7f7f7f7f7f
    [ 8.031343] x7 : fefefefeff6b646d x6 : 0000008080808080
    [ 8.031345] x5 : 0000000000000000 x4 : 0000000000000001
    [ 8.031346] x3 : 0000000000000000 x2 : ffff000008819b64
    [ 8.031348] x1 : 0000000000000000 x0 : 0000000000000000
    ...
    [ 8.031393] Call trace:
    [ 8.031394] Exception stack(0xffff809ef3b13a00 to 0xffff809ef3b13b30)
    [ 8.031395] 3a00: 0000000000000000 0001000000000000 ffff809ef3b13bd0 ffff000008899450
    [ 8.031397] 3a20: ffff809f7e1f9a10 ffff000008f60be0 0000000000000001 ffff809ef3b13b7c
    [ 8.031398] 3a40: ffff809f7e1f9a10 0000000000000000 ffff000009091000 0000000000000003
    [ 8.031399] 3a60: ffff000009091000 0000000000000003 ffff809ef3b13a80 ffff0000084e0794
    [ 8.031400] 3a80: ffff809ef3b13a90 ffff00000850bb64 ffff809ef3b13ad0 ffff00000850bf34
    [ 8.031402] 3aa0: 0000000000000000 0000000000000000 ffff000008819b64 0000000000000000
    [ 8.031403] 3ac0: 0000000000000001 0000000000000000 0000008080808080 fefefefeff6b646d
    [ 8.031404] 3ae0: 7f7f7f7f7f7f7f7f 0000000000000000 0101010101010101 0000000000000018
    [ 8.031405] 3b00: 0000000000000018 0000000000000000 0000000000000000 ffff000000000000
    [ 8.031406] 3b20: 0000000000087ffc 2fe48d76a78303f0
    [ 8.031409] [] pcc_mbox_request_channel+0x8c/0x160
    [ 8.031410] [] xgene_slimpro_i2c_probe+0x1c0/0x378
    [ 8.031413] [] platform_drv_probe+0x50/0xbc
    [ 8.031414] [] driver_probe_device+0x21c/0x2d0
    [ 8.031416] [] __driver_attach+0xac/0xb0
    [ 8.031417] [] bus_for_each_dev+0x58/0x98
    [ 8.031418] [] driver_attach+0x20/0x28
    [ 8.031419] [] bus_add_driver+0x1c8/0x22c
    [ 8.031421] [] driver_register+0x60/0xf4
    [ 8.031422] [] __platform_driver_register+0x4c/0x54
    [ 8.031425] [] xgene_slimpro_i2c_driver_init+0x18/0x20
    [ 8.031426] [] do_one_initcall+0x38/0x124
    [ 8.031429] [] kernel_init_freeable+0x190/0x22c
    [ 8.031431] [] kernel_init+0x10/0xfc
    [ 8.031432] [] ret_from_fork+0x10/0x50
    [ 8.031434] Code: cb030e63 8b030013 b140067f 54fffda8 (f9400a61)
    [ 8.031448] ---[ end trace 14eb48a4e1e1f9fb ]---

    Signed-off-by: Hoan Tran
    Acked-by: Prashanth Prakash
    Signed-off-by: Rafael J. Wysocki

    Hoan Tran
     

08 Jul, 2017

1 commit


14 Jun, 2017

2 commits


12 Jun, 2017

1 commit

  • ACPICA commit e7b817e3c405a4fb9ae9ee7ae4992b8c1f20d284

    Extended PCC Subspaces (types 3 and 4)

    Link: https://github.com/acpica/acpica/commit/e7b817e3
    Signed-off-by: David E. Box
    Signed-off-by: Bob Moore
    Signed-off-by: Lv Zheng
    Signed-off-by: Rafael J. Wysocki

    David E. Box
     

27 Apr, 2017

3 commits

  • We already check if the message is empty before calling the client
    tx_done callback. Calling completion on a wait event is also invalid
    if the message is empty.

    This patch moves the existing empty message check earlier.

    Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox")
    Signed-off-by: Sudeep Holla
    Signed-off-by: Jassi Brar

    Sudeep Holla
     
  • If a wait_for_completion_timeout() call returns due to a timeout,
    complete() can get called after returning from the wait which is
    incorrect and can cause subsequent transmissions on a channel to fail.
    Since the wait_for_completion_timeout() sees the completion variable
    is non-zero caused by the erroneous/spurious complete() call, and
    it immediately returns without waiting for the time as expected by the
    client.

    This patch fixes the issue by skipping complete() call for the timer
    expiry.

    Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox")
    Reported-by: Alexey Klimov
    Signed-off-by: Sudeep Holla
    Signed-off-by: Jassi Brar

    Sudeep Holla
     
  • There exists a race when msg_submit return immediately as there was an
    active request being processed which may have completed just before it's
    checked again in mbox_send_message. This will result in return to the
    caller without waiting in mbox_send_message even when it's blocking Tx.

    This patch fixes the issue by waiting for the completion always if Tx
    is in blocking mode.

    Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox")
    Reported-by: Alexey Klimov
    Signed-off-by: Sudeep Holla
    Reviewed-by: Alexey Klimov
    Signed-off-by: Jassi Brar

    Sudeep Holla
     

29 Mar, 2017

5 commits

  • The Broadcom FlexRM mailbox driver uses platform MSI support but
    not all ARCHs provide asm/msi.h. Due to this, we get compilation
    error in Broadcom FlexRM mailbox driver via linux/msi.h on ARCHs
    which lack asm/msi.h.

    This patch removes "depends on COMPILE_TEST" for Kconfig option
    BCM_FLEXRM_MBOX so that Broadcom FlexRM mailbox driver is only
    compiled for ARM64.

    Signed-off-by: Anup Patel
    Signed-off-by: Jassi Brar

    Anup Patel
     
  • It is allowed by code to register mailbox controller that sets txdone_poll
    flag to request timer-based polling with missed ->last_tx_done() method.
    If such thing happens and since presence of last_tx_done() is not checked
    it will fail in hrtimer callback function txdone_hrtimer() when first
    message will be transmitted.

    This patch adds check for this method and logging of error on
    registration of mailbox controller if it requested timer-based polling.

    Signed-off-by: Alexey Klimov
    Acked-by: Sudeep Holla
    Signed-off-by: Jassi Brar

    Alexey Klimov
     
  • Some of the Broadcom iProc SoCs have FlexRM ring manager
    which provides a ring-based programming interface to various
    offload engines (e.g. RAID, Crypto, etc).

    This patch adds a common mailbox driver for Broadcom FlexRM
    ring manager which can be shared by various offload engine
    drivers (implemented as mailbox clients).

    Reviewed-by: Ray Jui
    Reviewed-by: Scott Branden
    Reviewed-by: Pramod KUMAR
    Signed-off-by: Anup Patel
    Signed-off-by: Jassi Brar

    Anup Patel
     
  • Adds support for Northstar Plus (NS+) products to the PDC mailbox
    driver. The PDC driver was originally written to support the PDC
    ring manager in the Northstar2 (64-bit) device. The NS+ (32 bit
    device) uses an almost identical ring manager, though with a
    different name. We just need to check for the type of hardware in
    use, in order to write the appropriate interrupt configuration register.
    Also updated DMA width to be correct for both NS+ and NS2.

    Tested on NS+ and NS2.

    Signed-off-by: Steve Lin
    Acked-by: Jon Mason
    Signed-off-by: Jassi Brar

    Steve Lin
     
  • Check for mbox_chan_ops structures that are only stored in the ops field
    of a mbox_controller structure. This field is of type const struct
    mbox_chan_ops *, so mbox_chan_ops structures having this property can be
    declared as const.
    Done using Coccinelle:

    @r1 disable optional_qualifier @
    identifier i;
    position p;
    @@
    struct mbox_chan_ops i@p = {...};

    @ok1@
    identifier r1.i;
    struct hi6220_mbox mbox;
    struct slimpro_mbox ctx;
    position p;
    @@
    (
    mbox.controller.ops=&i@p
    |
    ctx.mb_ctrl.ops=&i@p
    )

    @bad@
    position p!={r1.p,ok1.p};
    identifier r1.i;
    @@
    i@p

    @depends on !bad disable optional_qualifier@
    identifier r1.i;
    @@
    +const
    struct mbox_chan_ops i;

    File size details:

    text data bss dec hex filename
    2310 248 0 2558 9fe drivers/mailbox/hi6220-mailbox.o
    2366 192 0 2558 9fe drivers/mailbox/hi6220-mailbox.o

    1500 248 0 1748 6d4 mailbox/mailbox-xgene-slimpro.o
    1556 192 0 1748 6d4 mailbox/mailbox-xgene-slimpro.o

    Signed-off-by: Bhumika Goyal
    Signed-off-by: Jassi Brar

    Bhumika Goyal
     

02 Mar, 2017

1 commit


26 Dec, 2016

1 commit

  • ktime_set(S,N) was required for the timespec storage type and is still
    useful for situations where a Seconds and Nanoseconds part of a time value
    needs to be converted. For anything where the Seconds argument is 0, this
    is pointless and can be replaced with a simple assignment.

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra

    Thomas Gleixner
     

23 Dec, 2016

1 commit

  • Pull more ACPI updates from Rafael Wysocki:
    "Here are new versions of two ACPICA changes that were deferred
    previously due to a problem they had introduced, two cleanups on top
    of them and the removal of a useless warning message from the ACPI
    core.

    Specifics:

    - Move some Linux-specific functionality to upstream ACPICA and
    update the in-kernel users of it accordingly (Lv Zheng)

    - Drop a useless warning (triggered by the lack of an optional
    object) from the ACPI namespace scanning code (Zhang Rui)"

    * tag 'acpi-extra-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    ACPI / osl: Remove deprecated acpi_get_table_with_size()/early_acpi_os_unmap_memory()
    ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users
    ACPICA: Tables: Allow FADT to be customized with virtual address
    ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel
    ACPI: do not warn if _BQC does not exist

    Linus Torvalds
     

22 Dec, 2016

1 commit

  • * acpica:
    ACPI / osl: Remove deprecated acpi_get_table_with_size()/early_acpi_os_unmap_memory()
    ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users
    ACPICA: Tables: Allow FADT to be customized with virtual address
    ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel

    * acpi-scan:
    ACPI: do not warn if _BQC does not exist

    Rafael J. Wysocki
     

21 Dec, 2016

2 commits

  • This patch removes the users of the deprectated APIs:
    acpi_get_table_with_size()
    early_acpi_os_unmap_memory()
    The following APIs should be used instead of:
    acpi_get_table()
    acpi_put_table()

    The deprecated APIs are invented to be a replacement of acpi_get_table()
    during the early stage so that the early mapped pointer will not be stored
    in ACPICA core and thus the late stage acpi_get_table() won't return a
    wrong pointer. The mapping size is returned just because it is required by
    early_acpi_os_unmap_memory() to unmap the pointer during early stage.

    But as the mapping size equals to the acpi_table_header.length
    (see acpi_tb_init_table_descriptor() and acpi_tb_validate_table()), when
    such a convenient result is returned, driver code will start to use it
    instead of accessing acpi_table_header to obtain the length.

    Thus this patch cleans up the drivers by replacing returned table size with
    acpi_table_header.length, and should be a no-op.

    Reported-by: Dan Williams
    Signed-off-by: Lv Zheng
    Signed-off-by: Rafael J. Wysocki

    Lv Zheng
     
  • Pull mailbox updates from Jassi Brar:

    - new features (poll and SRAM usage) added to the mailbox-test driver

    - major update of Broadcom's PDC controller driver

    - minor fix for auto-loading test and STI driver modules

    * 'mailbox-for-next' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
    mailbox: mailbox-test: allow reserved areas in SRAM
    mailbox: mailbox-test: add support for fasync/poll
    mailbox: bcm-pdc: Remove unnecessary void* casts
    mailbox: bcm-pdc: Simplify interrupt handler logic
    mailbox: bcm-pdc: Performance improvements
    mailbox: bcm-pdc: Don't use iowrite32 to write DMA descriptors
    mailbox: bcm-pdc: Convert from threaded IRQ to tasklet
    mailbox: bcm-pdc: Try to improve branch prediction
    mailbox: bcm-pdc: streamline rx code
    mailbox: bcm-pdc: Convert from interrupts to poll for tx done
    mailbox: bcm-pdc: PDC driver leaves debugfs files after removal
    mailbox: bcm-pdc: Changes so mbox client can be removed / re-inserted
    mailbox: bcm-pdc: Use octal permissions rather than symbolic
    mailbox: sti: Fix module autoload for OF registration
    mailbox: mailbox-test: Fix module autoload

    Linus Torvalds
     

19 Dec, 2016

10 commits

  • When CONFIG_SRAM is enable and the SRAM region is found, the entire SRAM
    region resource is requested and marked as occupied by SRAM driver even
    if certain parts of regions is marked reserved.

    It's quite possible that a small region of the SRAM is reserved for all
    the mailbox communication and hence it may fail to request the region
    as it's already marked busy region.

    This patch tries to just do a ioremap of this mailbox memory region if
    it finds it busy.

    Cc: Lee Jones
    Signed-off-by: Sudeep Holla
    Signed-off-by: Jassi Brar

    Sudeep Holla
     
  • Currently the read operation on the message debug file returns error if
    there's no data ready to be read. It expects the userspace to retry if
    it fails. Since the mailbox response could be asynchronous, it would be
    good to add support to block the read until the data is available.

    We can also implement poll file operations so that the userspace can
    wait to become ready to perform any I/O.

    This patch implements the poll and fasync file operation callback for
    the test mailbox device.

    Cc: Lee Jones
    Signed-off-by: Sudeep Holla
    Signed-off-by: Jassi Brar

    Sudeep Holla
     
  • Remove unnecessary void* casts in register writes. Fix two other
    minor formatting issues.

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Reviewed-by: Jon Mason
    Signed-off-by: Jassi Brar

    Rob Rice
     
  • Earlier versions of the PDC driver registered for both
    transmit and receive interrupts. The hard IRQ handler had to
    communicate to the soft handler which interrupt(s) had occurred.
    The PDC driver no longer registers for tx interrupts. So there is
    no reason to save the intstatus. So remove the intstatus member
    of the PDC state.

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Signed-off-by: Jassi Brar

    Rob Rice
     
  • Three changes to improve performance in the PDC driver:
    - disable and reenable interrupts while the interrupt handler is
    running
    - update rxin and txin descriptor indexes more efficiently
    - group receive descriptor context into a structure and keep
    context in a single array rather than five to improve locality
    of reference

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Signed-off-by: Jassi Brar

    Rob Rice
     
  • In PDC driver, it is not necessary to use iowrite32()
    when writing DMA descriptors to the transmit and receive rings.
    The ring memory is in host memory. So convert to normal
    assignment statements.

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Signed-off-by: Jassi Brar

    Rob Rice
     
  • Previously used threaded IRQs in the PDC driver to defer
    processing the rx DMA ring after getting an rx done interrupt.
    Instead, use a tasklet at normal priority for deferred processing.

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Signed-off-by: Jassi Brar

    Rob Rice
     
  • Use likely/unlikely directives to improve branch prediction.

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Signed-off-by: Jassi Brar

    Rob Rice
     
  • Remove the unnecessary rmb() from the receive path.

    If the rx ring has multiple messages ready, avoid reading
    last_rx_curr multiple times from the register.

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Signed-off-by: Jassi Brar

    Rob Rice
     
  • The PDC driver is a mailbox controller. A mailbox controller
    can report that a mailbox message has been "transmitted" either when
    a tx interrupt fires or by having the mailbox framework poll. This
    commit converts the PDC driver to the poll method. We found that the
    tx interrupt happens when the descriptors are read by the SPU hw. Thus,
    the interrupt method does not allow more than one tx message in the PDC
    tx DMA ring at a time. To keep the SPU hw busy, we would like to keep
    the tx ring full under heavy load.

    With the poll method, the PDC driver responds that the previous message
    has been transmitted if the tx ring has space for another message.
    SPU request messages take a variable number of descriptors. If 15
    descriptors are available, there is a good chance another message will
    fit. Also increased the ring size from 128 to 512 descriptors.

    With this change, I found the PDC driver hangs on its spinlock under
    heavy load. The PDC spinlock is not required; so I removed it. Calls
    to pdc_send_data() are already synchronized because of the channel
    spinlock in the mailbox framework. Other references to ring indexes
    should not require locking because they only written on either the
    tx or rx side.

    Signed-off-by: Rob Rice
    Reviewed-by: Andy Gospodarek
    Signed-off-by: Jassi Brar

    Rob Rice