Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2729166pxj; Mon, 31 May 2021 09:15:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/xPvSdPa8fN47feZhMPklBluvqFPhvsGhB3PSiBONWf+L7GI3e/QahSZOwieGMHjpvSDI X-Received: by 2002:aa7:d30d:: with SMTP id p13mr25474036edq.46.1622477738291; Mon, 31 May 2021 09:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622477738; cv=none; d=google.com; s=arc-20160816; b=uj9JPNQSbEkvvqqgvTvIOh2kZqpuuwRzh6Nk1PNLY7LnyYbOEZye14lKlIaxo3QToI H1PShjH6aoc1TUxZmt/it6BiK69BGzKDABA5beDXwaAAhpMc/6exEX6w4u/tdjU+eiu7 GLxWnh+OCuNEeP5uXu3CT/08FenFdTFkIEXvDjy2Nh4qtn2+aFx2HbgghniIMEGea6Rg SOK0m9OVVSYbiOpnUR1WMsdsm4uhE0oTVsxcKQxhqCnjtwMeMYhvxhEnpNfWCm0IfUXP E//1U6ZObqDB6lMkrQllKH3A+q5Jjy0hNY+xe8ikpiPoFi6jjsaFADqtR8Hlmtd+yXRK SP4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pmNYCM6ECEuk5A152qWBKQ/9i1xTdn1xGI68EmedeMY=; b=Z22/M0Rubz0zqCrjoHCLEs7B3TxLexnuFemL6dwOwDIauirAYGaYVgVJK86T+JtDxr PZb+aTfSHZb/gBAPyBmOagXLuM7ZW/9Ro023NiwNWryROMFTAniotawPOQiUUsJvt1RD Ciq5SRkqz0IoIBhEfVL0W4i7YxMsDDG6Uz1Yhx1p/PLc/Dy8tlD1/tJ7Rfpt7q4QYRv0 os0mwEZRAN6L5bIq2Nzs8F4HuJ/P9fpXCJ+cmHxhWDGNsNf/sdL9v8BmMRR3bSFF3X2e E68QDts1thB63/vI1uhJxf6qkRbp2xE8VOnuIlIgGsurqbBHwimuhnLJRsCf2bWItG69 Rumw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Intgpqb2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si3789622eje.551.2021.05.31.09.15.15; Mon, 31 May 2021 09:15:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Intgpqb2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbhEaQPz (ORCPT + 99 others); Mon, 31 May 2021 12:15:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:38018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234179AbhEaOjg (ORCPT ); Mon, 31 May 2021 10:39:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EC49061C62; Mon, 31 May 2021 13:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469166; bh=a6U4P9qpJ+bpOtv1WRP3SiEYiF7qP2V/P3fQITGQGZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Intgpqb2olZsXW4hqI2sRB0RGt6v+IFmYX9g8MM//MAh3vXikYBt5C3MHd3Z1ipiH D5vcEd+LBDXVU/I7rCaXHH7AkpF9nYuOKKhWNAXIFUbLnXJSQv35nF2eNHO/a4CdvI zA4JCinENGw8OdgW3sEr3B3PHhO4ctpwAwfD9Vyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ganzhorn , Mathias Nyman Subject: [PATCH 5.12 093/296] xhci: Fix 5.12 regression of missing xHC cache clearing command after a Stall Date: Mon, 31 May 2021 15:12:28 +0200 Message-Id: <20210531130707.032553686@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathias Nyman commit a7f2e9272aff1ccfe0fc801dab1d5a7a1c6b7ed2 upstream. If endpoints halts due to a stall then the dequeue pointer read from hardware may already be set ahead of the stalled TRB. After commit 674f8438c121 ("xhci: split handling halted endpoints into two steps") in 5.12 xhci driver won't issue a Set TR Dequeue if hardware dequeue pointer is already in the right place. Turns out the "Set TR Dequeue pointer" command is anyway needed as it in addition to moving the dequeue pointer also clears endpoint state and cache. Fixes: 674f8438c121 ("xhci: split handling halted endpoints into two steps") Cc: # 5.12 Reported-by: Peter Ganzhorn Tested-by: Peter Ganzhorn Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20210525074100.1154090-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-ring.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -934,14 +934,18 @@ static int xhci_invalidate_cancelled_tds continue; } /* - * If ring stopped on the TD we need to cancel, then we have to + * If a ring stopped on the TD we need to cancel then we have to * move the xHC endpoint ring dequeue pointer past this TD. + * Rings halted due to STALL may show hw_deq is past the stalled + * TD, but still require a set TR Deq command to flush xHC cache. */ hw_deq = xhci_get_hw_deq(xhci, ep->vdev, ep->ep_index, td->urb->stream_id); hw_deq &= ~0xf; - if (trb_in_td(xhci, td->start_seg, td->first_trb, + if (td->cancel_status == TD_HALTED) { + cached_td = td; + } else if (trb_in_td(xhci, td->start_seg, td->first_trb, td->last_trb, hw_deq, false)) { switch (td->cancel_status) { case TD_CLEARED: /* TD is already no-op */