12 Jan, 2017

3 commits

  • commit e09ee853c92011860a4bd2fbdf6126f60fc16bd3 upstream.

    The credentials handling was pushed to the write handlers
    but error handling wasn't done properly.
    Move write callbacks to completion queue to destroy them
    and to notify a blocked writer about the failure

    Fixes: 136698e535cd1 (mei: push credentials inside the irq write handler)
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit 5026c9cb0744a9cd40242743ca91a5d712f468c6 upstream.

    Adjust function name in KDoc.

    Fixes: d49dc5e76fc9 (mei: bus: use mei_cldev_ prefix for the API functions)
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit 967b274e02e18c9fbb4d19b96a89bd0afbc77b7a upstream.

    Parameter renaming to fop_type was not reflected in KDoc

    Fixes: 3030dc0564594 (mei: add wrapper for queuing control commands)
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

09 Jan, 2017

2 commits

  • commit 9ff2007bea1f1bfc53ac0bc7ccf8200bb275fd52 upstream.

    Add MEI Lewisburg PCH IDs for Purley based workstations.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • commit d5f8e166c25750adc147b0adf64a62a91653438a upstream.

    pm_runtime_autosuspend can take synchronous or asynchronous
    paths, Because we are calling pm_runtime_mark_last_busy just before
    this most of the cases it takes the asynchronous way. However,
    when the FW or driver resets during already running runtime suspend,
    the call will result in calling to the driver's rpm callback and results
    in a deadlock on device_lock.
    The simplest fix is to replace pm_runtime_autosuspend with
    asynchronous pm_request_autosuspend.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

01 Nov, 2016

1 commit

  • NFC version reply size checked against only header size, not against
    full message size. That may lead potentially to uninitialized memory access
    in version data.

    That leads to warnings when version data is accessed:
    drivers/misc/mei/bus-fixup.c: warning: '*((void *)&ver+11)' may be used uninitialized in this function [-Wuninitialized]: => 212:2

    Reported in
    Build regressions/improvements in v4.9-rc3
    https://lkml.org/lkml/2016/10/30/57

    Fixes: 59fcd7c63abf (mei: nfc: Initial nfc implementation)
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

25 Oct, 2016

1 commit

  • SEC registers are not accessible when the TXE device is in low power
    state, hence the SEC interrupt cannot be processed if device is not
    awake.

    In some rare cases entrance to low power state (aliveness off) and input
    ready bits can be signaled at the same time, resulting in communication
    stall as input ready won't be signaled again after waking up. To resolve
    this IPC_HHIER_SEC bit in HHISR_REG should not be cleaned if the
    interrupt is not processed.

    Cc: stable@vger.kernel.org
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

27 Sep, 2016

1 commit

  • The stall timer worker checks periodically if there is a stalled i/o
    transaction. The issue with the current implementation is that the timer
    is ticking also when there is no pending i/o transaction.
    This patch provides a simple change that prevents rescheduling
    of the delayed work when there is no pending i/o.

    Cc: Andy Lutomirski
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

12 Sep, 2016

1 commit


05 Sep, 2016

1 commit


30 Aug, 2016

25 commits

  • The device lock was unnecessary obtained in bus rescan work before the
    amthif client search. That causes incorrect lock ordering and task
    hang:
    ...
    [88004.613213] INFO: task kworker/1:14:21832 blocked for more than 120 seconds.
    ...
    [88004.645934] Workqueue: events mei_cl_bus_rescan_work
    ...

    The correct lock order is
    cl_bus_lock
    device_lock
    me_clients_rwsem

    Move device_lock into amthif init function that called
    after me_clients_rwsem is released.

    This fixes regression introduced by commit:
    commit 025fb792bac3 ("mei: split amthif client init from end of clients enumeration")

    Cc: # 4.6+
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • mei_amthif_read have only one difference from mei_read, it is not
    calling mei_read_start().
    Make mei_read_start return immediately for amthif client and drop the
    special mei_amthif_read function.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • The FW supports only one pending read per host client, in order to
    support issuing of consecutive reads the driver queues read requests
    internally and send them to the firmware after pending one has
    completed.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Enclose the boiler plate code of allocating a control/hbm command cb
    and enqueueing it onto ctrl_wr.list in a convenient wrapper
    mei_cl_enqueue_ctrl_wr_cb().

    This is a preparatory patch for enabling consecutive reads.

    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • With the introduction of the receive control flow credits prefixed with
    rx_ we add tx_ prefix to the variables and function used for tracking
    the transmit control flow credits.

    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • Use RX flow control counter in the host client structure to
    track the number of simultaneous outstanding reads.
    This eliminates search in queues and makes ground for
    enabling for parallel read.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • The read callbacks for the fixed address clients, that don't have flow
    control are built now on the receive path. In order to have a single
    allocation place we remove the allocation from the read request.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • The read callback is always prepared with MTU-sized buffer and the FW
    can't send more than the MTU in one message.
    Checking for buffer existence and krealloc to increase receive buffer
    size are redundant and may be safely discarded.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Open code mei_clear_lists into its only caller mei_amthif_releas
    and drop unused parameter 'dev' form from mei_clear_list function.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • The Fixed address clients do not work with the flow control, and the
    packet RX callback was allocated upon TX with anticipation of a
    following RX. This won't work if the clients with unsolicited Rx. Rather
    than preparing read callback upon a write we allocate one directly on
    the reciev path if one doesn't exists.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Store the file associated with a client in the host client structure,
    this enables dropping the special amthif client file pointer from struct
    mei_device, and this is also a preparation for changing the way rx
    packet allocation for fixed_address clients

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Move read cb to the completion queue if a read finds out that client
    is not connected. This expedite user space reader wake on error
    condition.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Correct errno on client disconnection is -ENODEV not -EBUSY

    Cc: #4.3+
    Signed-off-by: Tomas Winkler
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • In the course of the read flow we want to wait for read completion only
    if the read queue is empty.
    However the calling list_empty(&cl->rd_completed) is a duplication as the
    same check was performed by mei_cl_read_cb() and the waiting is skipped
    if it returns not NULL.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • In mei_hbm_cl_hdr buf argument was not described

    Signed-off-by: Tomas Winkler
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • Schedule link reset if failed to perform runtime suspend or resume.
    Set active runtime pm stte on link reset
    to clean runtimr pm error, if present.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • mei_io_cb_alloc_buf have a single caller :mei_cl_alloc_cb. After amthif
    stopped using it, the code can be integrated into the caller and the
    function can be dropped.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Use mei_cl_alloc_cb wrapper instead of open code steps

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Incorporate the mei_amthif_send_cmd code into its only caller:
    mei_amthif_run_next_cmd

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Currently the poll function is bailing early for amthif client and
    ignores requests for async events notifications.
    Move async event processing before amthif to enable async events
    notifications on amthif client.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • iamthif_current_cb was used in request cancel in amthif code.
    Now a canceled request is discarded only at the end of the processing
    and the variable lost its purpose and can be safely removed.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Currently, all requests cancelled by the user are immediately removed
    from the queues. Such removal can cause unexpected behavior in the case
    when a request is partially written or a reply is received after the
    request is cancelled. To resolve this a request is always fully
    processed and the result is discarded in case the request was canceled.
    This completes the partial fix in commit:
    9d04ee1 ("mei: amthif: discard not read messages")

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • AMTHIF code now uses read completed queue to store replies from the FW.
    It is possible to send the next request as soon as a read from the FW is
    completed. With these changes we don't need the READ_COMPLETE state.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • Sunrise Point PCH with SPS Firmware doesn't expose working
    MEI interface, we need to quirk it out.
    The SPS Firmware is identifiable only on the first PCI function
    of the device.

    Cc: #4.6+
    Tested-by: Sujith Pandel
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     

25 Jun, 2016

1 commit


11 Jun, 2016

2 commits

  • wr_ctrl waiters are none interruptible, so should be waken up
    with call to wake_up and not to wake_up_interruptible.

    This fixes commit:
    7ff4bdd ("mei: fix waiting for wr_ctrl for corner cases.")

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • The control messages are usually small, around 8 bytes, and can be
    allocated on the stack.
    Using on stack allocation allows us to drop 'wr_msg' a rather large
    buffer reserved in the mei_dev structure and relax contention
    of this device global buffer.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

04 May, 2016

1 commit


01 May, 2016

1 commit

  • A control message reply may not be received if either a link reset has
    occurred or disconnection is initiated by the FW.
    In the both cases the client state will be set straight to DISCONNECTED
    and the driver will wait till timeout.
    Adding DISCONNECTED state in the waiting condition will release the
    client from the stall.

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin